From 213351ae9e7d6745a70457925546cd032d4f0c51 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sun, 19 May 2024 19:04:03 -0700 Subject: clarify the second arg to llvm.ctlz and cttz --- compiler/rustc_codegen_llvm/src/intrinsic.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_codegen_llvm') diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 7e6d7491798..80e863af893 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -2368,16 +2368,16 @@ fn generic_simd_intrinsic<'ll, 'tcx>( // byte swap is no-op for i8/u8 sym::simd_bswap if int_size == 8 => Ok(args[0].immediate()), sym::simd_ctlz | sym::simd_cttz => { - // this fun bonus i1 arg means "poison if the arg vector contains zero" + // for the (int, i1 immediate) pair, the second arg adds `(0, true) => poison` let fn_ty = bx.type_func(&[vec_ty, bx.type_i1()], vec_ty); + let dont_poison_on_zero = bx.const_int(bx.type_i1(), 0); let f = bx.declare_cfn(llvm_intrinsic, llvm::UnnamedAddr::No, fn_ty); Ok(bx.call( fn_ty, None, None, f, - // simd_ctlz and simd_cttz are exposed to safe code, so let's not poison anything - &[args[0].immediate(), bx.const_int(bx.type_i1(), 0)], + &[args[0].immediate(), dont_poison_on_zero], None, None, )) -- cgit 1.4.1-3-g733a5