convert _mm512_cmp_epi8_mask to const generics
This commit is contained in:
parent
08422280d5
commit
d94f7cf7d3
1 changed files with 11 additions and 15 deletions
|
|
@ -4005,22 +4005,18 @@ pub unsafe fn _mm_mask_cmp_epi16_mask<const IMM8: i32>(
|
|||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm512_cmp_epi8_mask&expand=709)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx512bw")]
|
||||
#[rustc_args_required_const(2)]
|
||||
#[cfg_attr(test, assert_instr(vpcmp, imm8 = 0))]
|
||||
pub unsafe fn _mm512_cmp_epi8_mask(a: __m512i, b: __m512i, imm8: i32) -> __mmask64 {
|
||||
#[rustc_legacy_const_generics(2)]
|
||||
#[cfg_attr(test, assert_instr(vpcmp, IMM8 = 0))]
|
||||
pub unsafe fn _mm512_cmp_epi8_mask<const IMM8: i32>(a: __m512i, b: __m512i) -> __mmask64 {
|
||||
static_assert_imm3!(IMM8);
|
||||
let a = a.as_i8x64();
|
||||
let b = b.as_i8x64();
|
||||
macro_rules! call {
|
||||
($imm3:expr) => {
|
||||
vpcmpb(
|
||||
a,
|
||||
b,
|
||||
$imm3,
|
||||
0b11111111_11111111_11111111_11111111_11111111_11111111_11111111_11111111,
|
||||
)
|
||||
};
|
||||
}
|
||||
let r = constify_imm3!(imm8, call);
|
||||
let r = vpcmpb(
|
||||
a,
|
||||
b,
|
||||
IMM8,
|
||||
0b11111111_11111111_11111111_11111111_11111111_11111111_11111111_11111111,
|
||||
);
|
||||
transmute(r)
|
||||
}
|
||||
|
||||
|
|
@ -13544,7 +13540,7 @@ mod tests {
|
|||
unsafe fn test_mm512_cmp_epi8_mask() {
|
||||
let a = _mm512_set1_epi8(0);
|
||||
let b = _mm512_set1_epi8(1);
|
||||
let m = _mm512_cmp_epi8_mask(a, b, _MM_CMPINT_LT);
|
||||
let m = _mm512_cmp_epi8_mask::<_MM_CMPINT_LT>(a, b);
|
||||
assert_eq!(
|
||||
m,
|
||||
0b11111111_11111111_11111111_11111111_11111111_11111111_11111111_11111111
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue