mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 09:38:26 +03:00
Rollup merge of #156202 - maurer:splat, r=nikic
llvm: Use correct type for splat mask After llvm/llvm-project#195486 , LLVM has explicit handling for null pointers in simd operations instead of using special handling based on zeroes. This causes LLVM with asserts enabled to detect an improperly typed mask passed to splat (if the output vector does not have i32 elements), and can cause SIGSEGV in more complex cases with asserts disabled. @rustbot label: +llvm-main r? @durin42
This commit is contained in:
@@ -2086,7 +2086,7 @@ fn vector_mask_to_bitmask<'a, 'll, 'tcx>(
|
||||
}
|
||||
|
||||
if name == sym::simd_splat {
|
||||
let (_out_len, out_ty) = require_simd!(ret_ty, SimdReturn);
|
||||
let (out_len, out_ty) = require_simd!(ret_ty, SimdReturn);
|
||||
|
||||
require!(
|
||||
args[0].layout.ty == out_ty,
|
||||
@@ -2105,7 +2105,8 @@ fn vector_mask_to_bitmask<'a, 'll, 'tcx>(
|
||||
|
||||
// `shufflevector <N x elem> v0, <N x elem> poison, <N x i32> zeroinitializer`
|
||||
// The masks is all zeros, so this splats lane 0 (which has our element in it).
|
||||
let splat = bx.shuffle_vector(v0, poison_vec, bx.const_null(llret_ty));
|
||||
let mask_ty = bx.type_vector(bx.type_i32(), out_len);
|
||||
let splat = bx.shuffle_vector(v0, poison_vec, bx.const_null(mask_ty));
|
||||
|
||||
return Ok(splat);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user