Skip to content

Commit dfbbdde

Browse files
Daniel SmithAmanieu
authored andcommitted
Add mask variant to cmplt
1 parent 674bb9e commit dfbbdde

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

crates/core_arch/src/x86/avx512f.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ pub unsafe fn _mm512_cmplt_epu64_mask(a: __m512i, b: __m512i) -> __mmask8 {
104104
simd_bitmask::<__m512i, _>(simd_lt(a.as_u64x8(), b.as_u64x8()))
105105
}
106106

107+
///Compare packed unsigned 64-bit integers in a and b for less-than, and store the results in a mask vector k
108+
/// using zeromask m (elements are zeroed out when the corresponding mask bit is not set).
109+
///
110+
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=727,1063,4909,1062,1062,1063&text=_mm512_mask_cmplt_epu64)
111+
#[inline]
112+
#[target_feature(enable = "avx512f")]
113+
#[cfg_attr(test, assert_instr(vpcmp))]
114+
pub unsafe fn _mm512_mask_cmplt_epu64_mask(m: __mmask8, a: __m512i, b: __m512i) -> __mmask8 {
115+
_mm512_cmplt_epu64_mask(a, b) & m
116+
}
117+
107118
#[cfg(test)]
108119
mod tests {
109120
use std;

crates/core_arch/src/x86_64/avx512f.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ mod tests {
5757
assert_eq!(m, 0b11001111);
5858
}
5959

60+
#[simd_test(enable = "avx512f")]
61+
unsafe fn test_mm512_mask_cmplt_epu64_mask() {
62+
let a = _mm512_set_epi64(0, 1, -1, u64::MAX as i64, i64::MAX, i64::MIN, 100, -100);
63+
let b = _mm512_set1_epi64(-1);
64+
let mask = 0b01111010;
65+
let r = _mm512_mask_cmplt_epu64_mask(mask, a, b);
66+
assert_eq!(r, 0b01001010);
67+
}
68+
6069
#[simd_test(enable = "avx512f")]
6170
unsafe fn test_mm512_set_epi64() {
6271
let r = _mm512_setr_epi64(0, 1, 2, 3, 4, 5, 6, 7);

0 commit comments

Comments
 (0)