sse3: _mm_movedup_pd

This commit is contained in:
gwenn 2017-09-30 12:51:50 +02:00 committed by Andrew Gallant
parent e4ffcb6fdd
commit 8e07404403

View file

@ -1,4 +1,5 @@
use x86::__m128i;
use simd_llvm::simd_shuffle2;
use v128::*;
#[cfg(test)]
@ -68,6 +69,15 @@ pub unsafe fn _mm_lddqu_si128(mem_addr: *const __m128i) -> __m128i {
lddqu(mem_addr as *const _)
}
/// Duplicate the low double-precision (64-bit) floating-point element
/// from `a`.
#[inline(always)]
#[target_feature = "+sse3"]
#[cfg_attr(test, assert_instr(movddup))]
pub unsafe fn _mm_movedup_pd(a: f64x2) -> f64x2 {
simd_shuffle2(a, a, [0, 0])
}
#[allow(improper_ctypes)]
extern {
#[link_name = "llvm.x86.sse3.addsub.ps"]
@ -148,4 +158,11 @@ mod tests {
let r = sse3::_mm_lddqu_si128(&a);
assert_eq!(a, r);
}
#[simd_test = "sse3"]
unsafe fn _mm_movedup_pd() {
let a = f64x2::new(-1.0, 5.0);
let r = sse3::_mm_movedup_pd(a);
assert_eq!(r, f64x2::new(-1.0, -1.0));
}
}