Rollup merge of #137318 - bjorn3:cg_clif_abi_workaround, r=workingjubilee

Workaround Cranelift not yet properly supporting vectors smaller than 128bit

While it would technically be possible to workaround this in cg_clif, it quickly becomes very messy and would likely cause correctness issues. Working around it in rustc instead is much simper and won't have any negative impact for code running on stable as vectors smaller than 128bit can only be made on nightly using core::simd or #[repr(simd)].
This commit is contained in:
Jubilee 2025-02-20 14:58:19 -08:00 committed by GitHub
commit 8d5eb73ea6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -736,7 +736,9 @@ impl<'a, Ty> FnAbi<'a, Ty> {
// to 128-bit-sized vectors. // to 128-bit-sized vectors.
"x86" if spec.rustc_abi == Some(RustcAbi::X86Sse2) => arg.layout.size.bits() <= 128, "x86" if spec.rustc_abi == Some(RustcAbi::X86Sse2) => arg.layout.size.bits() <= 128,
"x86_64" if spec.rustc_abi != Some(RustcAbi::X86Softfloat) => { "x86_64" if spec.rustc_abi != Some(RustcAbi::X86Softfloat) => {
arg.layout.size.bits() <= 128 // FIXME once https://github.com/bytecodealliance/wasmtime/issues/10254 is fixed
// accept vectors up to 128bit rather than vectors of exactly 128bit.
arg.layout.size.bits() == 128
} }
// So far, we haven't implemented this logic for any other target. // So far, we haven't implemented this logic for any other target.
_ => false, _ => false,