convert _mm512_maskz_alignr_epi8 to const generics

This commit is contained in:
Rémy Rakic 2021-03-05 01:06:07 +01:00 committed by Amanieu d'Antras
parent 2789905cc6
commit 479f34c331

View file

@ -9074,15 +9074,15 @@ pub unsafe fn _mm512_mask_alignr_epi8<const IMM8: i32>(
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm512_maskz_alignr_epi8&expand=265)
#[inline]
#[target_feature(enable = "avx512bw")]
#[cfg_attr(test, assert_instr(vpalignr, imm8 = 1))]
#[rustc_args_required_const(3)]
pub unsafe fn _mm512_maskz_alignr_epi8(k: __mmask64, a: __m512i, b: __m512i, imm8: i32) -> __m512i {
macro_rules! call {
($imm8:expr) => {
_mm512_alignr_epi8(a, b, $imm8)
};
}
let r = constify_imm8_sae!(imm8, call);
#[cfg_attr(test, assert_instr(vpalignr, IMM8 = 1))]
#[rustc_legacy_const_generics(3)]
pub unsafe fn _mm512_maskz_alignr_epi8<const IMM8: i32>(
k: __mmask64,
a: __m512i,
b: __m512i,
) -> __m512i {
static_assert_imm8!(IMM8);
let r = _mm512_alignr_epi8(a, b, IMM8);
let zero = _mm512_setzero_si512().as_i8x64();
transmute(simd_select_bitmask(k, r.as_i8x64(), zero))
}
@ -17728,13 +17728,12 @@ mod tests {
1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
);
let b = _mm512_set1_epi8(1);
let r = _mm512_maskz_alignr_epi8(0, a, b, 14);
let r = _mm512_maskz_alignr_epi8::<14>(0, a, b);
assert_eq_m512i(r, _mm512_setzero_si512());
let r = _mm512_maskz_alignr_epi8(
let r = _mm512_maskz_alignr_epi8::<14>(
0b11111111_11111111_11111111_11111111_11111111_11111111_11111111_11111111,
a,
b,
14,
);
#[rustfmt::skip]
let e = _mm512_set_epi8(