sse3: _mm_moveldup_ps

This commit is contained in:
gwenn 2017-09-30 13:16:37 +02:00 committed by Andrew Gallant
parent 261534cb0f
commit 4cbb838e2e

View file

@ -87,6 +87,15 @@ pub unsafe fn _mm_movehdup_ps(a: f32x4) -> f32x4 {
simd_shuffle4(a, a, [1, 1, 3, 3])
}
/// Duplicate even-indexed single-precision (32-bit) floating-point elements
/// from `a`.
#[inline(always)]
#[target_feature = "+sse3"]
#[cfg_attr(test, assert_instr(movsldup))]
pub unsafe fn _mm_moveldup_ps(a: f32x4) -> f32x4 {
simd_shuffle4(a, a, [0, 0, 2, 2])
}
#[allow(improper_ctypes)]
extern {
#[link_name = "llvm.x86.sse3.addsub.ps"]
@ -181,4 +190,11 @@ mod tests {
let r = sse3::_mm_movehdup_ps(a);
assert_eq!(r, f32x4::new(5.0, 5.0, -10.0, -10.0));
}
#[simd_test = "sse3"]
unsafe fn _mm_moveldup_ps() {
let a = f32x4::new(-1.0, 5.0, 0.0, -10.0);
let r = sse3::_mm_moveldup_ps(a);
assert_eq!(r, f32x4::new(-1.0, -1.0, 0.0, 0.0));
}
}