@@ -8,7 +8,7 @@ use rustc_abi::{
88} ;
99use rustc_macros:: HashStable_Generic ;
1010
11- use crate :: spec:: { HasTargetSpec , HasWasmCAbiOpt , HasX86AbiOpt , RustcAbi , WasmCAbi } ;
11+ use crate :: spec:: { HasTargetSpec , HasWasmCAbiOpt , HasX86AbiOpt , WasmCAbi } ;
1212
1313mod aarch64;
1414mod amdgpu;
@@ -733,24 +733,6 @@ impl<'a, Ty> FnAbi<'a, Ty> {
733733 _ => { }
734734 } ;
735735
736- // Decides whether we can pass the given SIMD argument via `PassMode::Direct`.
737- // May only return `true` if the target will always pass those arguments the same way,
738- // no matter what the user does with `-Ctarget-feature`! In other words, whatever
739- // target features are required to pass a SIMD value in registers must be listed in
740- // the `abi_required_features` for the current target and ABI.
741- let can_pass_simd_directly = |arg : & ArgAbi < ' _ , Ty > | match & * spec. arch {
742- // On x86, if we have SSE2 (which we have by default for x86_64), we can always pass up
743- // to 128-bit-sized vectors.
744- "x86" if spec. rustc_abi == Some ( RustcAbi :: X86Sse2 ) => arg. layout . size . bits ( ) <= 128 ,
745- "x86_64" if spec. rustc_abi != Some ( RustcAbi :: X86Softfloat ) => {
746- // FIXME once https://github.com/bytecodealliance/wasmtime/issues/10254 is fixed
747- // accept vectors up to 128bit rather than vectors of exactly 128bit.
748- arg. layout . size . bits ( ) == 128
749- }
750- // So far, we haven't implemented this logic for any other target.
751- _ => false ,
752- } ;
753-
754736 for ( arg_idx, arg) in self
755737 . args
756738 . iter_mut ( )
@@ -850,9 +832,10 @@ impl<'a, Ty> FnAbi<'a, Ty> {
850832 // target feature sets. Some more information about this
851833 // issue can be found in #44367.
852834 //
853- // Note that the intrinsic ABI is exempt here as those are not
854- // real functions anyway, and the backend expects very specific types.
855- if spec. simd_types_indirect && !can_pass_simd_directly ( arg) {
835+ // We *could* do better in some cases, e.g. on x86_64 targets where SSE2 is
836+ // required. However, it turns out that that makes LLVM worse at optimizing this
837+ // code, so we pass things indirectly even there. See #139029 for more on that.
838+ if spec. simd_types_indirect {
856839 arg. make_indirect ( ) ;
857840 }
858841 }
0 commit comments