Skip to content

Commit 213351a

Browse files
clarify the second arg to llvm.ctlz and cttz
1 parent 9557b90 commit 213351a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_codegen_llvm/src/intrinsic.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2368,16 +2368,16 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
23682368
// byte swap is no-op for i8/u8
23692369
sym::simd_bswap if int_size == 8 => Ok(args[0].immediate()),
23702370
sym::simd_ctlz | sym::simd_cttz => {
2371-
// this fun bonus i1 arg means "poison if the arg vector contains zero"
2371+
// for the (int, i1 immediate) pair, the second arg adds `(0, true) => poison`
23722372
let fn_ty = bx.type_func(&[vec_ty, bx.type_i1()], vec_ty);
2373+
let dont_poison_on_zero = bx.const_int(bx.type_i1(), 0);
23732374
let f = bx.declare_cfn(llvm_intrinsic, llvm::UnnamedAddr::No, fn_ty);
23742375
Ok(bx.call(
23752376
fn_ty,
23762377
None,
23772378
None,
23782379
f,
2379-
// simd_ctlz and simd_cttz are exposed to safe code, so let's not poison anything
2380-
&[args[0].immediate(), bx.const_int(bx.type_i1(), 0)],
2380+
&[args[0].immediate(), dont_poison_on_zero],
23812381
None,
23822382
None,
23832383
))

0 commit comments

Comments
 (0)