about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-11-14 17:55:27 -0800
committerGitHub <noreply@github.com>2024-11-14 17:55:27 -0800
commitefe2c44269ecf916d3c200bedfba0b211431d32a (patch)
tree741b499897e79b6f54febd095bb51d60d842fde0
parentcea081e98030654dd38cf5ad0d6699bb678f3cc4 (diff)
parent0733ed77d16a691863166561bc8b286a79fa8584 (diff)
downloadrust-efe2c44269ecf916d3c200bedfba0b211431d32a.tar.gz
rust-efe2c44269ecf916d3c200bedfba0b211431d32a.zip
Rollup merge of #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.
-rw-r--r--tests/run-make/simd-ffi/simd.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/run-make/simd-ffi/simd.rs b/tests/run-make/simd-ffi/simd.rs
index b72078faafa..9ea8eb8cf88 100644
--- a/tests/run-make/simd-ffi/simd.rs
+++ b/tests/run-make/simd-ffi/simd.rs
@@ -25,7 +25,7 @@ pub struct i32x4([i32; 4]);
 
 extern "C" {
     // _mm_sll_epi32
-    #[cfg(any(target_arch = "x86", target_arch = "x86-64"))]
+    #[cfg(all(any(target_arch = "x86", target_arch = "x86-64"), target_feature = "sse2"))]
     #[link_name = "llvm.x86.sse2.psll.d"]
     fn integer(a: i32x4, b: i32x4) -> i32x4;
 
@@ -38,15 +38,13 @@ extern "C" {
     #[link_name = "llvm.aarch64.neon.maxs.v4i32"]
     fn integer(a: i32x4, b: i32x4) -> i32x4;
 
-    // just some substitute foreign symbol, not an LLVM intrinsic; so
-    // we still get type checking, but not as detailed as (ab)using
-    // LLVM.
+    // Use a generic LLVM intrinsic to do type checking on other platforms
     #[cfg(not(any(
-        target_arch = "x86",
-        target_arch = "x86-64",
+        all(any(target_arch = "x86", target_arch = "x86-64"), target_feature = "sse2"),
         target_arch = "arm",
         target_arch = "aarch64"
     )))]
+    #[link_name = "llvm.smax.v4i32"]
     fn integer(a: i32x4, b: i32x4) -> i32x4;
 }