@@ -8,7 +8,7 @@ use rustc_abi::{
8
8
} ;
9
9
use rustc_macros:: HashStable_Generic ;
10
10
11
- use crate :: spec:: { HasTargetSpec , HasWasmCAbiOpt , HasX86AbiOpt , RustcAbi , WasmCAbi } ;
11
+ use crate :: spec:: { HasTargetSpec , HasWasmCAbiOpt , HasX86AbiOpt , WasmCAbi } ;
12
12
13
13
mod aarch64;
14
14
mod amdgpu;
@@ -733,24 +733,6 @@ impl<'a, Ty> FnAbi<'a, Ty> {
733
733
_ => { }
734
734
} ;
735
735
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
-
754
736
for ( arg_idx, arg) in self
755
737
. args
756
738
. iter_mut ( )
@@ -850,9 +832,10 @@ impl<'a, Ty> FnAbi<'a, Ty> {
850
832
// target feature sets. Some more information about this
851
833
// issue can be found in #44367.
852
834
//
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 {
856
839
arg. make_indirect ( ) ;
857
840
}
858
841
}
0 commit comments