diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2024-05-19 19:04:03 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2024-05-19 19:12:38 -0700 |
| commit | 213351ae9e7d6745a70457925546cd032d4f0c51 (patch) | |
| tree | 5328ab95a52814d0ace5e14aae94f69103aa3878 /compiler/rustc_codegen_llvm/src | |
| parent | 9557b903b8dec3873bf93f68b65248e3e4374cfd (diff) | |
| download | rust-213351ae9e7d6745a70457925546cd032d4f0c51.tar.gz rust-213351ae9e7d6745a70457925546cd032d4f0c51.zip | |
clarify the second arg to llvm.ctlz and cttz
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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, )) |
