@@ -7,7 +7,7 @@ use rustc_abi::{
77use rustc_macros:: HashStable_Generic ;
88
99pub use crate :: spec:: AbiMap ;
10- use crate :: spec:: { HasTargetSpec , HasWasmCAbiOpt , HasX86AbiOpt , RustcAbi , WasmCAbi } ;
10+ use crate :: spec:: { HasTargetSpec , HasWasmCAbiOpt , HasX86AbiOpt , WasmCAbi } ;
1111
1212mod aarch64;
1313mod amdgpu;
@@ -696,24 +696,6 @@ impl<'a, Ty> FnAbi<'a, Ty> {
696696 _ => { }
697697 } ;
698698
699- // Decides whether we can pass the given SIMD argument via `PassMode::Direct`.
700- // May only return `true` if the target will always pass those arguments the same way,
701- // no matter what the user does with `-Ctarget-feature`! In other words, whatever
702- // target features are required to pass a SIMD value in registers must be listed in
703- // the `abi_required_features` for the current target and ABI.
704- let can_pass_simd_directly = |arg : & ArgAbi < ' _ , Ty > | match & * spec. arch {
705- // On x86, if we have SSE2 (which we have by default for x86_64), we can always pass up
706- // to 128-bit-sized vectors.
707- "x86" if spec. rustc_abi == Some ( RustcAbi :: X86Sse2 ) => arg. layout . size . bits ( ) <= 128 ,
708- "x86_64" if spec. rustc_abi != Some ( RustcAbi :: X86Softfloat ) => {
709- // FIXME once https://github.com/bytecodealliance/wasmtime/issues/10254 is fixed
710- // accept vectors up to 128bit rather than vectors of exactly 128bit.
711- arg. layout . size . bits ( ) == 128
712- }
713- // So far, we haven't implemented this logic for any other target.
714- _ => false ,
715- } ;
716-
717699 for ( arg_idx, arg) in self
718700 . args
719701 . iter_mut ( )
@@ -813,9 +795,10 @@ impl<'a, Ty> FnAbi<'a, Ty> {
813795 // target feature sets. Some more information about this
814796 // issue can be found in #44367.
815797 //
816- // Note that the intrinsic ABI is exempt here as those are not
817- // real functions anyway, and the backend expects very specific types.
818- if spec. simd_types_indirect && !can_pass_simd_directly ( arg) {
798+ // We *could* do better in some cases, e.g. on x86_64 targets where SSE2 is
799+ // required. However, it turns out that that makes LLVM worse at optimizing this
800+ // code, so we pass things indirectly even there. See #139029 for more on that.
801+ if spec. simd_types_indirect {
819802 arg. make_indirect ( ) ;
820803 }
821804 }
0 commit comments