convert _mm512_mask_cmp_epi8_mask to const generics

This commit is contained in:
Rémy Rakic 2021-03-04 22:46:06 +01:00 committed by Amanieu d'Antras
parent d94f7cf7d3
commit ce60830a8a

View file

@ -4025,22 +4025,17 @@ pub unsafe fn _mm512_cmp_epi8_mask<const IMM8: i32>(a: __m512i, b: __m512i) -> _
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm512_mask_cmp_epi8_mask&expand=710)
#[inline]
#[target_feature(enable = "avx512bw")]
#[rustc_args_required_const(3)]
#[cfg_attr(test, assert_instr(vpcmp, imm8 = 0))]
pub unsafe fn _mm512_mask_cmp_epi8_mask(
#[rustc_legacy_const_generics(3)]
#[cfg_attr(test, assert_instr(vpcmp, IMM8 = 0))]
pub unsafe fn _mm512_mask_cmp_epi8_mask<const IMM8: i32>(
k1: __mmask64,
a: __m512i,
b: __m512i,
imm8: i32,
) -> __mmask64 {
static_assert_imm3!(IMM8);
let a = a.as_i8x64();
let b = b.as_i8x64();
macro_rules! call {
($imm3:expr) => {
vpcmpb(a, b, $imm3, k1)
};
}
let r = constify_imm3!(imm8, call);
let r = vpcmpb(a, b, IMM8, k1);
transmute(r)
}
@ -13552,7 +13547,7 @@ mod tests {
let a = _mm512_set1_epi8(0);
let b = _mm512_set1_epi8(1);
let mask = 0b01010101_01010101_01010101_01010101_01010101_01010101_01010101_01010101;
let r = _mm512_mask_cmp_epi8_mask(mask, a, b, _MM_CMPINT_LT);
let r = _mm512_mask_cmp_epi8_mask::<_MM_CMPINT_LT>(mask, a, b);
assert_eq!(
r,
0b01010101_01010101_01010101_01010101_01010101_01010101_01010101_01010101