|
| 1 | + |
| 2 | +use std::mem; |
| 3 | + |
1 | 4 | #[cfg(test)]
|
2 | 5 | use stdsimd_test::assert_instr;
|
3 | 6 |
|
@@ -66,9 +69,9 @@ pub unsafe fn _mm_blend_ps(a: f32x4, b: f32x4, imm4: u8) -> f32x4 {
|
66 | 69 | /// Extract a single-precision (32-bit) floating-point element from `a`, selected with `imm8`
|
67 | 70 | #[inline(always)]
|
68 | 71 | #[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)) |
72 | 75 | }
|
73 | 76 |
|
74 | 77 | /// Extract an 8-bit integer from `a` selected with `imm8`
|
@@ -321,9 +324,9 @@ mod tests {
|
321 | 324 | #[simd_test = "sse4.1"]
|
322 | 325 | unsafe fn _mm_extract_ps() {
|
323 | 326 | 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)); |
325 | 328 | 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)); |
327 | 330 | assert_eq!(r, 1.0);
|
328 | 331 | }
|
329 | 332 |
|
|
0 commit comments