Add signed variants
This commit is contained in:
parent
d94bc946eb
commit
a50a216567
3 changed files with 119 additions and 0 deletions
|
|
@ -157,6 +157,69 @@ pub unsafe fn _mm512_mask_cmpeq_epu64_mask(m: __mmask8, a: __m512i, b: __m512i)
|
|||
_mm512_cmpeq_epu64_mask(a, b) & m
|
||||
}
|
||||
|
||||
/// 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_epi64)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx512f")]
|
||||
#[cfg_attr(test, assert_instr(vpcmp))]
|
||||
pub unsafe fn _mm512_cmplt_epi64_mask(a: __m512i, b: __m512i) -> __mmask8 {
|
||||
simd_bitmask::<__m512i, _>(simd_lt(a.as_i64x8(), b.as_i64x8()))
|
||||
}
|
||||
|
||||
///Compare packed unsigned 64-bit integers in a and b for less-than, and store the results in a mask vector k
|
||||
/// using zeromask m (elements are zeroed out when the corresponding mask bit is not set).
|
||||
///
|
||||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062,1063&text=_mm512_mask_cmplt_epi64)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx512f")]
|
||||
#[cfg_attr(test, assert_instr(vpcmp))]
|
||||
pub unsafe fn _mm512_mask_cmplt_epi64_mask(m: __mmask8, a: __m512i, b: __m512i) -> __mmask8 {
|
||||
_mm512_cmplt_epi64_mask(a, b) & m
|
||||
}
|
||||
|
||||
/// 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_cmpgt_epi64)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx512f")]
|
||||
#[cfg_attr(test, assert_instr(vpcmp))]
|
||||
pub unsafe fn _mm512_cmpgt_epi64_mask(a: __m512i, b: __m512i) -> __mmask8 {
|
||||
simd_bitmask::<__m512i, _>(simd_gt(a.as_i64x8(), b.as_i64x8()))
|
||||
}
|
||||
|
||||
///Compare packed unsigned 64-bit integers in a and b for less-than, and store the results in a mask vector k
|
||||
/// using zeromask m (elements are zeroed out when the corresponding mask bit is not set).
|
||||
///
|
||||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062,1063&text=_mm512_mask_cmpgt_epi64)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx512f")]
|
||||
#[cfg_attr(test, assert_instr(vpcmp))]
|
||||
pub unsafe fn _mm512_mask_cmpgt_epi64_mask(m: __mmask8, a: __m512i, b: __m512i) -> __mmask8 {
|
||||
_mm512_cmpgt_epi64_mask(a, b) & m
|
||||
}
|
||||
|
||||
/// 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_cmpeq_epi64)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx512f")]
|
||||
#[cfg_attr(test, assert_instr(vpcmp))]
|
||||
pub unsafe fn _mm512_cmpeq_epi64_mask(a: __m512i, b: __m512i) -> __mmask8 {
|
||||
simd_bitmask::<__m512i, _>(simd_eq(a.as_i64x8(), b.as_i64x8()))
|
||||
}
|
||||
|
||||
///Compare packed unsigned 64-bit integers in a and b for less-than, and store the results in a mask vector k
|
||||
/// using zeromask m (elements are zeroed out when the corresponding mask bit is not set).
|
||||
///
|
||||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062,1063&text=_mm512_mask_cmpeq_epi64)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx512f")]
|
||||
#[cfg_attr(test, assert_instr(vpcmp))]
|
||||
pub unsafe fn _mm512_mask_cmpeq_epi64_mask(m: __mmask8, a: __m512i, b: __m512i) -> __mmask8 {
|
||||
_mm512_cmpeq_epi64_mask(a, b) & m
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std;
|
||||
|
|
|
|||
|
|
@ -518,6 +518,11 @@ pub(crate) trait m512iExt: Sized {
|
|||
fn as_u64x8(self) -> crate::core_arch::simd::u64x8 {
|
||||
unsafe { transmute(self.as_m512i()) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn as_i64x8(self) -> crate::core_arch::simd::i64x8 {
|
||||
unsafe { transmute(self.as_m512i()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl m512iExt for __m512i {
|
||||
|
|
|
|||
|
|
@ -100,6 +100,57 @@ mod tests {
|
|||
assert_eq!(r, 0b01001010);
|
||||
}
|
||||
|
||||
#[simd_test(enable = "avx512f")]
|
||||
unsafe fn test_mm512_cmplt_epi64_mask() {
|
||||
let a = _mm512_set_epi64(0, 1, -1, 13, i64::MAX, i64::MIN, 100, -100);
|
||||
let b = _mm512_set1_epi64(-1);
|
||||
let m = _mm512_cmplt_epi64_mask(a, b);
|
||||
assert_eq!(m, 0b00000101);
|
||||
}
|
||||
|
||||
#[simd_test(enable = "avx512f")]
|
||||
unsafe fn test_mm512_mask_cmplt_epi64_mask() {
|
||||
let a = _mm512_set_epi64(0, 1, -1, 13, i64::MAX, i64::MIN, 100, -100);
|
||||
let b = _mm512_set1_epi64(-1);
|
||||
let mask = 0b01100110;
|
||||
let r = _mm512_mask_cmplt_epi64_mask(mask, a, b);
|
||||
assert_eq!(r, 0b00000100);
|
||||
}
|
||||
|
||||
#[simd_test(enable = "avx512f")]
|
||||
unsafe fn test_mm512_cmpgt_epi64_mask() {
|
||||
let a = _mm512_set_epi64(0, 1, -1, 13, i64::MAX, i64::MIN, 100, -100);
|
||||
let b = _mm512_set1_epi64(-1);
|
||||
let m = _mm512_cmpgt_epi64_mask(b, a);
|
||||
assert_eq!(m, 0b00000101);
|
||||
}
|
||||
|
||||
#[simd_test(enable = "avx512f")]
|
||||
unsafe fn test_mm512_mask_cmpgt_epi64_mask() {
|
||||
let a = _mm512_set_epi64(0, 1, -1, 13, i64::MAX, i64::MIN, 100, -100);
|
||||
let b = _mm512_set1_epi64(-1);
|
||||
let mask = 0b01100110;
|
||||
let r = _mm512_mask_cmpgt_epi64_mask(mask, b, a);
|
||||
assert_eq!(r, 0b00000100);
|
||||
}
|
||||
|
||||
#[simd_test(enable = "avx512f")]
|
||||
unsafe fn test_mm512_cmpeq_epi64_mask() {
|
||||
let a = _mm512_set_epi64(0, 1, -1, 13, i64::MAX, i64::MIN, 100, -100);
|
||||
let b = _mm512_set_epi64(0, 1, 13, 42, i64::MAX, i64::MIN, 100, -100);
|
||||
let m = _mm512_cmpeq_epi64_mask(b, a);
|
||||
assert_eq!(m, 0b11001111);
|
||||
}
|
||||
|
||||
#[simd_test(enable = "avx512f")]
|
||||
unsafe fn test_mm512_mask_cmpeq_epi64_mask() {
|
||||
let a = _mm512_set_epi64(0, 1, -1, 13, i64::MAX, i64::MIN, 100, -100);
|
||||
let b = _mm512_set_epi64(0, 1, 13, 42, i64::MAX, i64::MIN, 100, -100);
|
||||
let mask = 0b01111010;
|
||||
let r = _mm512_mask_cmpeq_epi64_mask(mask, b, a);
|
||||
assert_eq!(r, 0b01001010);
|
||||
}
|
||||
|
||||
#[simd_test(enable = "avx512f")]
|
||||
unsafe fn test_mm512_set_epi64() {
|
||||
let r = _mm512_setr_epi64(0, 1, 2, 3, 4, 5, 6, 7);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue