From d6822f9c433bd70f786b157f17beaf64ee28d83a Mon Sep 17 00:00:00 2001 From: Georgio Nicolas Date: Sat, 1 Aug 2020 00:46:26 +0300 Subject: [PATCH 1/2] Edit docs to explain mask type discrepancy in _mm_shuffle_ps between Rust and Intel's Intrinsics Guide --- crates/core_arch/src/x86/sse.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/core_arch/src/x86/sse.rs b/crates/core_arch/src/x86/sse.rs index 551da7652b..7ca8326495 100644 --- a/crates/core_arch/src/x86/sse.rs +++ b/crates/core_arch/src/x86/sse.rs @@ -992,6 +992,12 @@ pub const fn _MM_SHUFFLE(z: u32, y: u32, x: u32, w: u32) -> i32 { /// `b`. Mask is split to 2 control bits each to index the element from inputs. /// /// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_ps) +/// +/// Note that there appears to be a mistake within Intel's Intrinsics Guide. +/// `_mm_shuffle_ps` is supposed to take an `i32` instead of an `u32` +/// as is the case for [other shuffle intrinsics](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_). +/// Performing an implicit type conversion between an unsigned integer and a signed integer +/// does not cause a problem in C, however Rust's commitment to safety does not allow this. #[inline] #[target_feature(enable = "sse")] #[cfg_attr(test, assert_instr(shufps, mask = 3))] From 86b6a8c625e6f845372ffa35d52a2f9f6a0f6783 Mon Sep 17 00:00:00 2001 From: Georgio Nicolas Date: Sat, 1 Aug 2020 01:47:31 +0300 Subject: [PATCH 2/2] Add suggestion --- crates/core_arch/src/x86/sse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core_arch/src/x86/sse.rs b/crates/core_arch/src/x86/sse.rs index 7ca8326495..c01aa1bc9f 100644 --- a/crates/core_arch/src/x86/sse.rs +++ b/crates/core_arch/src/x86/sse.rs @@ -997,7 +997,7 @@ pub const fn _MM_SHUFFLE(z: u32, y: u32, x: u32, w: u32) -> i32 { /// `_mm_shuffle_ps` is supposed to take an `i32` instead of an `u32` /// as is the case for [other shuffle intrinsics](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_). /// Performing an implicit type conversion between an unsigned integer and a signed integer -/// does not cause a problem in C, however Rust's commitment to safety does not allow this. +/// does not cause a problem in C, however Rust's commitment to strong typing does not allow this. #[inline] #[target_feature(enable = "sse")] #[cfg_attr(test, assert_instr(shufps, mask = 3))]