diff options
| author | bors <bors@rust-lang.org> | 2025-09-04 08:50:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-09-04 08:50:59 +0000 |
| commit | 45b9d13b455f820c12760e0fbf6ce69110a3aeda (patch) | |
| tree | a203d84b6dc54d8f74524ff36ab5a6ce648870e1 /compiler/rustc_codegen_llvm/src | |
| parent | 79bdc627562db90599edcf16cb166a532919a0a8 (diff) | |
| parent | b4f76b3de821b460e32934c8d80cd731434df4af (diff) | |
| download | rust-45b9d13b455f820c12760e0fbf6ce69110a3aeda.tar.gz rust-45b9d13b455f820c12760e0fbf6ce69110a3aeda.zip | |
Auto merge of #146192 - jhpratt:rollup-mam0bss, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang/rust#145682 (Promote aarch64-pc-windows-msvc to Tier 1) - rust-lang/rust#145690 (Implement Integer funnel shifts) - rust-lang/rust#146119 (compiletest: Implement an experimental `--new-output-capture` mode) - rust-lang/rust#146168 (Update bootstrap's dependencies to remove winapi and old windows-sys) - rust-lang/rust#146182 (Don't require next-solver `ProbeRef` to be `Copy`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 49d3dedbeab..85f71f331a4 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -383,7 +383,9 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { | sym::rotate_left | sym::rotate_right | sym::saturating_add - | sym::saturating_sub => { + | sym::saturating_sub + | sym::unchecked_funnel_shl + | sym::unchecked_funnel_shr => { let ty = args[0].layout.ty; if !ty.is_integral() { tcx.dcx().emit_err(InvalidMonomorphization::BasicIntegerType { @@ -424,18 +426,26 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { sym::bitreverse => { self.call_intrinsic("llvm.bitreverse", &[llty], &[args[0].immediate()]) } - sym::rotate_left | sym::rotate_right => { - let is_left = name == sym::rotate_left; - let val = args[0].immediate(); - let raw_shift = args[1].immediate(); - // rotate = funnel shift with first two args the same + sym::rotate_left + | sym::rotate_right + | sym::unchecked_funnel_shl + | sym::unchecked_funnel_shr => { + let is_left = name == sym::rotate_left || name == sym::unchecked_funnel_shl; + let lhs = args[0].immediate(); + let (rhs, raw_shift) = + if name == sym::rotate_left || name == sym::rotate_right { + // rotate = funnel shift with first two args the same + (lhs, args[1].immediate()) + } else { + (args[1].immediate(), args[2].immediate()) + }; let llvm_name = format!("llvm.fsh{}", if is_left { 'l' } else { 'r' }); // llvm expects shift to be the same type as the values, but rust // always uses `u32`. - let raw_shift = self.intcast(raw_shift, self.val_ty(val), false); + let raw_shift = self.intcast(raw_shift, self.val_ty(lhs), false); - self.call_intrinsic(llvm_name, &[llty], &[val, val, raw_shift]) + self.call_intrinsic(llvm_name, &[llty], &[lhs, rhs, raw_shift]) } sym::saturating_add | sym::saturating_sub => { let is_add = name == sym::saturating_add; |
