From 12e8ab4a0d0344f851f79862cd2e288dae318be6 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sat, 3 Nov 2018 12:41:02 +0100 Subject: [PATCH] [breaking change]: mask argument type of _mm_shuffle_ps --- coresimd/x86/sse.rs | 6 +++--- crates/stdsimd-verify/tests/x86-intel.rs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/coresimd/x86/sse.rs b/coresimd/x86/sse.rs index 3d2cc65ae8..515f39312b 100644 --- a/coresimd/x86/sse.rs +++ b/coresimd/x86/sse.rs @@ -981,8 +981,8 @@ pub unsafe fn _mm_setzero_ps() -> __m128 { #[inline] #[allow(non_snake_case)] #[unstable(feature = "stdsimd", issue = "27731")] -pub const fn _MM_SHUFFLE(z: u32, y: u32, x: u32, w: u32) -> u32 { - (z << 6) | (y << 4) | (x << 2) | w +pub const fn _MM_SHUFFLE(z: u32, y: u32, x: u32, w: u32) -> i32 { + ((z << 6) | (y << 4) | (x << 2) | w) as i32 } /// Shuffle packed single-precision (32-bit) floating-point elements in `a` and @@ -997,7 +997,7 @@ pub const fn _MM_SHUFFLE(z: u32, y: u32, x: u32, w: u32) -> u32 { #[cfg_attr(test, assert_instr(shufps, mask = 3))] #[rustc_args_required_const(2)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_shuffle_ps(a: __m128, b: __m128, mask: u32) -> __m128 { +pub unsafe fn _mm_shuffle_ps(a: __m128, b: __m128, mask: i32) -> __m128 { let mask = (mask & 0xFF) as u8; macro_rules! shuffle_done { diff --git a/crates/stdsimd-verify/tests/x86-intel.rs b/crates/stdsimd-verify/tests/x86-intel.rs index 2bb8f19525..ce1201de5a 100644 --- a/crates/stdsimd-verify/tests/x86-intel.rs +++ b/crates/stdsimd-verify/tests/x86-intel.rs @@ -142,7 +142,11 @@ fn verify_all_signatures() { // verified. "__readeflags" | "__writeeflags" | "__cpuid_count" | "__cpuid" | "__get_cpuid_max" => continue, - + // Intel requires the mask argument for _mm_shuffle_ps to be an + // unsigned integer, but all other _mm_shuffle_.. intrinsics + // take a signed-integer. This breaks `_MM_SHUFFLE` for + // `_mm_shuffle_ps`: + "_mm_shuffle_ps" => continue, _ => {} }