convert _mm256_mask_i32gather_epi32 to const generics
This commit is contained in:
parent
a5ca4611ef
commit
d69a908608
1 changed files with 6 additions and 12 deletions
|
|
@ -1158,26 +1158,21 @@ pub unsafe fn _mm256_i32gather_epi32<const SCALE: i32>(
|
|||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i32gather_epi32)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx2")]
|
||||
#[cfg_attr(test, assert_instr(vpgatherdd, scale = 1))]
|
||||
#[rustc_args_required_const(4)]
|
||||
#[cfg_attr(test, assert_instr(vpgatherdd, SCALE = 1))]
|
||||
#[rustc_legacy_const_generics(4)]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _mm256_mask_i32gather_epi32(
|
||||
pub unsafe fn _mm256_mask_i32gather_epi32<const SCALE: i32>(
|
||||
src: __m256i,
|
||||
slice: *const i32,
|
||||
offsets: __m256i,
|
||||
mask: __m256i,
|
||||
scale: i32,
|
||||
) -> __m256i {
|
||||
static_assert_imm8_scale!(SCALE);
|
||||
let src = src.as_i32x8();
|
||||
let mask = mask.as_i32x8();
|
||||
let offsets = offsets.as_i32x8();
|
||||
let slice = slice as *const i8;
|
||||
macro_rules! call {
|
||||
($imm8:expr) => {
|
||||
vpgatherdd(src, slice, offsets, mask, $imm8)
|
||||
};
|
||||
}
|
||||
let r = constify_imm8_gather!(scale, call);
|
||||
let r = vpgatherdd(src, slice, offsets, mask, SCALE as i8);
|
||||
transmute(r)
|
||||
}
|
||||
|
||||
|
|
@ -5605,12 +5600,11 @@ mod tests {
|
|||
arr[i as usize] = i;
|
||||
}
|
||||
// A multiplier of 4 is word-addressing
|
||||
let r = _mm256_mask_i32gather_epi32(
|
||||
let r = _mm256_mask_i32gather_epi32::<4>(
|
||||
_mm256_set1_epi32(256),
|
||||
arr.as_ptr(),
|
||||
_mm256_setr_epi32(0, 16, 64, 96, 0, 0, 0, 0),
|
||||
_mm256_setr_epi32(-1, -1, -1, 0, 0, 0, 0, 0),
|
||||
4,
|
||||
);
|
||||
assert_eq_m256i(r, _mm256_setr_epi32(0, 16, 64, 256, 256, 256, 256, 256));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue