Skip to content

Commit efe2c44

Browse files
Rollup merge of rust-lang#133053 - liushuyu:simd-test-x86-baseline-fix, r=workingjubilee
tests: Fix the SIMD FFI tests with certain x86 configuration This pull request fixes the SIMD FFI tests with certain x86 configurations by gating the SSE2 intrinsic behind the `sse2` feature gate. A generic LLVM intrinsic that is easy to un-fuse on those platforms is added to compensate for those platforms.
2 parents cea081e + 0733ed7 commit efe2c44

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Diff for: tests/run-make/simd-ffi/simd.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub struct i32x4([i32; 4]);
2525

2626
extern "C" {
2727
// _mm_sll_epi32
28-
#[cfg(any(target_arch = "x86", target_arch = "x86-64"))]
28+
#[cfg(all(any(target_arch = "x86", target_arch = "x86-64"), target_feature = "sse2"))]
2929
#[link_name = "llvm.x86.sse2.psll.d"]
3030
fn integer(a: i32x4, b: i32x4) -> i32x4;
3131

@@ -38,15 +38,13 @@ extern "C" {
3838
#[link_name = "llvm.aarch64.neon.maxs.v4i32"]
3939
fn integer(a: i32x4, b: i32x4) -> i32x4;
4040

41-
// just some substitute foreign symbol, not an LLVM intrinsic; so
42-
// we still get type checking, but not as detailed as (ab)using
43-
// LLVM.
41+
// Use a generic LLVM intrinsic to do type checking on other platforms
4442
#[cfg(not(any(
45-
target_arch = "x86",
46-
target_arch = "x86-64",
43+
all(any(target_arch = "x86", target_arch = "x86-64"), target_feature = "sse2"),
4744
target_arch = "arm",
4845
target_arch = "aarch64"
4946
)))]
47+
#[link_name = "llvm.smax.v4i32"]
5048
fn integer(a: i32x4, b: i32x4) -> i32x4;
5149
}
5250

0 commit comments

Comments
 (0)