Skip to content

Commit b80b3a6

Browse files
committed
Revert '_mm_extract_ps' to return i32
1 parent 2373618 commit b80b3a6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/x86/sse41.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
use std::mem;
3+
14
#[cfg(test)]
25
use stdsimd_test::assert_instr;
36

@@ -66,9 +69,9 @@ pub unsafe fn _mm_blend_ps(a: f32x4, b: f32x4, imm4: u8) -> f32x4 {
6669
/// Extract a single-precision (32-bit) floating-point element from `a`, selected with `imm8`
6770
#[inline(always)]
6871
#[target_feature = "+sse4.1"]
69-
#[cfg_attr(test, assert_instr(extractps, imm8=2))]
70-
pub unsafe fn _mm_extract_ps(a: f32x4, imm8: u8) -> f32 {
71-
a.extract(imm8 as u32 & 0b11)
72+
#[cfg_attr(test, assert_instr(extractps, imm8=0))]
73+
pub unsafe fn _mm_extract_ps(a: f32x4, imm8: u8) -> i32 {
74+
mem::transmute(a.extract(imm8 as u32 & 0b11))
7275
}
7376

7477
/// Extract an 8-bit integer from `a` selected with `imm8`
@@ -321,9 +324,9 @@ mod tests {
321324
#[simd_test = "sse4.1"]
322325
unsafe fn _mm_extract_ps() {
323326
let a = f32x4::new(0.0, 1.0, 2.0, 3.0);
324-
let r = sse41::_mm_extract_ps(a, 1);
327+
let r: f32 = mem::transmute(sse41::_mm_extract_ps(a, 1));
325328
assert_eq!(r, 1.0);
326-
let r = sse41::_mm_extract_ps(a, 5);
329+
let r: f32 = mem::transmute(sse41::_mm_extract_ps(a, 5));
327330
assert_eq!(r, 1.0);
328331
}
329332

0 commit comments

Comments
 (0)