Convert _mm_cmp_pd to const generics and fix imm width
This commit is contained in:
parent
33937e8ef7
commit
b41577b7d8
1 changed files with 6 additions and 10 deletions
|
|
@ -792,16 +792,12 @@ pub const _CMP_TRUE_US: i32 = 0x1f;
|
|||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_cmp_pd)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx,sse2")]
|
||||
#[cfg_attr(test, assert_instr(vcmpeqpd, imm8 = 0))] // TODO Validate vcmppd
|
||||
#[rustc_args_required_const(2)]
|
||||
#[cfg_attr(test, assert_instr(vcmpeqpd, IMM8 = 0))] // TODO Validate vcmppd
|
||||
#[rustc_legacy_const_generics(2)]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _mm_cmp_pd(a: __m128d, b: __m128d, imm8: i32) -> __m128d {
|
||||
macro_rules! call {
|
||||
($imm8:expr) => {
|
||||
vcmppd(a, b, $imm8)
|
||||
};
|
||||
}
|
||||
constify_imm6!(imm8, call)
|
||||
pub unsafe fn _mm_cmp_pd<const IMM8: i32>(a: __m128d, b: __m128d) -> __m128d {
|
||||
static_assert_imm5!(IMM8);
|
||||
vcmppd(a, b, IMM8 as i8)
|
||||
}
|
||||
|
||||
/// Compares packed double-precision (64-bit) floating-point
|
||||
|
|
@ -3635,7 +3631,7 @@ mod tests {
|
|||
unsafe fn test_mm_cmp_pd() {
|
||||
let a = _mm_setr_pd(4., 9.);
|
||||
let b = _mm_setr_pd(4., 3.);
|
||||
let r = _mm_cmp_pd(a, b, _CMP_GE_OS);
|
||||
let r = _mm_cmp_pd::<_CMP_GE_OS>(a, b);
|
||||
assert!(get_m128d(r, 0).is_nan());
|
||||
assert!(get_m128d(r, 1).is_nan());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue