convert _mm512_cmp_epi16_mask to const generics

This commit is contained in:
Rémy Rakic 2021-03-04 22:39:20 +01:00 committed by Amanieu d'Antras
parent 4af10e89a4
commit 1059ffc990

View file

@ -3903,17 +3903,13 @@ pub unsafe fn _mm_mask_cmp_epu8_mask<const IMM8: i32>(
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm512_cmp_epi16_mask&expand=691)
#[inline]
#[target_feature(enable = "avx512bw")]
#[rustc_args_required_const(2)]
#[cfg_attr(test, assert_instr(vpcmp, imm8 = 0))]
pub unsafe fn _mm512_cmp_epi16_mask(a: __m512i, b: __m512i, imm8: i32) -> __mmask32 {
#[rustc_legacy_const_generics(2)]
#[cfg_attr(test, assert_instr(vpcmp, IMM8 = 0))]
pub unsafe fn _mm512_cmp_epi16_mask<const IMM8: i32>(a: __m512i, b: __m512i) -> __mmask32 {
static_assert_imm3!(IMM8);
let a = a.as_i16x32();
let b = b.as_i16x32();
macro_rules! call {
($imm3:expr) => {
vpcmpw(a, b, $imm3, 0b11111111_11111111_11111111_11111111)
};
}
let r = constify_imm3!(imm8, call);
let r = vpcmpw(a, b, IMM8, 0b11111111_11111111_11111111_11111111);
transmute(r)
}
@ -13515,7 +13511,7 @@ mod tests {
unsafe fn test_mm512_cmp_epi16_mask() {
let a = _mm512_set1_epi16(0);
let b = _mm512_set1_epi16(1);
let m = _mm512_cmp_epi16_mask(a, b, _MM_CMPINT_LT);
let m = _mm512_cmp_epi16_mask::<_MM_CMPINT_LT>(a, b);
assert_eq!(m, 0b11111111_11111111_11111111_11111111);
}