Add one AVX512f comparison and the intrinsics needed to test it
This commit is contained in:
committed by
Amanieu d'Antras
parent
7a29fcc1c8
commit
e0ffa88fe7
@@ -201,3 +201,7 @@ simd_ty!(i32x16[i32]:
|
|||||||
simd_ty!(i64x8[i64]:
|
simd_ty!(i64x8[i64]:
|
||||||
i64, i64, i64, i64, i64, i64, i64, i64
|
i64, i64, i64, i64, i64, i64, i64, i64
|
||||||
| x0, x1, x2, x3, x4, x5, x6, x7);
|
| x0, x1, x2, x3, x4, x5, x6, x7);
|
||||||
|
|
||||||
|
simd_ty!(u64x8[u64]:
|
||||||
|
u64, u64, u64, u64, u64, u64, u64, u64
|
||||||
|
| x0, x1, x2, x3, x4, x5, x6, x7);
|
||||||
|
|||||||
@@ -94,6 +94,35 @@ pub unsafe fn _mm512_set1_epi64(a: i64) -> __m512i {
|
|||||||
transmute(i64x8::splat(a))
|
transmute(i64x8::splat(a))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets packed 64-bit integers in `dst` with the supplied values.
|
||||||
|
///
|
||||||
|
/// [Intel's documentation]( https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062,4909&text=_mm512_set_epi64)
|
||||||
|
#[inline]
|
||||||
|
#[target_feature(enable = "avx512f")]
|
||||||
|
pub unsafe fn _mm512_set_epi64(
|
||||||
|
e7: i64,
|
||||||
|
e6: i64,
|
||||||
|
e5: i64,
|
||||||
|
e4: i64,
|
||||||
|
e3: i64,
|
||||||
|
e2: i64,
|
||||||
|
e1: i64,
|
||||||
|
e0: i64,
|
||||||
|
) -> __m512i {
|
||||||
|
let r = i64x8(e0, e1, e2, e3, e4, e5, e6, e7);
|
||||||
|
transmute(r)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Compare packed unsigned 64-bit integers in a and b for less-than, and store the results in a mask vector.
|
||||||
|
///
|
||||||
|
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062&text=_mm512_cmplt_epu64)
|
||||||
|
#[inline]
|
||||||
|
#[target_feature(enable = "avx512f")]
|
||||||
|
#[cfg_attr(test, assert_instr(vpcmpuq))]
|
||||||
|
pub unsafe fn _mm512_cmplt_epu64_mask(a: __m512i, b: __m512i) -> __mmask8 {
|
||||||
|
simd_bitmask::<__m512i, _>(simd_lt(a.as_u64x8(), b.as_u64x8()))
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std;
|
use std;
|
||||||
@@ -197,4 +226,12 @@ mod tests {
|
|||||||
);
|
);
|
||||||
assert_eq_m512i(r, e);
|
assert_eq_m512i(r, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[simd_test(enable = "avx512f")]
|
||||||
|
unsafe fn test_mm512_cmplt_epu64_mask() {
|
||||||
|
let a = _mm512_set_epi64(0, 1, -1, u64::MAX as i64, i64::MAX, i64::MIN, 100, -100);
|
||||||
|
let b = _mm512_set1_epi64(-1);
|
||||||
|
let m = _mm512_cmplt_epu64_mask(a, b);
|
||||||
|
assert_eq!(m, 0b11001111);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -346,6 +346,10 @@ types! {
|
|||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub type __mmask16 = u16;
|
pub type __mmask16 = u16;
|
||||||
|
|
||||||
|
/// The `__mmask8` type used in AVX-512 intrinsics, a 8-bit integer
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
pub type __mmask8 = u8;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test;
|
mod test;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -509,6 +513,11 @@ pub(crate) trait m512iExt: Sized {
|
|||||||
fn as_i32x16(self) -> crate::core_arch::simd::i32x16 {
|
fn as_i32x16(self) -> crate::core_arch::simd::i32x16 {
|
||||||
unsafe { transmute(self.as_m512i()) }
|
unsafe { transmute(self.as_m512i()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn as_u64x8(self) -> crate::core_arch::simd::u64x8 {
|
||||||
|
unsafe { transmute(self.as_m512i()) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl m512iExt for __m512i {
|
impl m512iExt for __m512i {
|
||||||
|
|||||||
Reference in New Issue
Block a user