convert _mm_mask_i32gather_pd to const generics

This commit is contained in:
Rémy Rakic 2021-03-06 00:59:15 +01:00 committed by Amanieu d'Antras
parent 47fc2fc7ed
commit 14d2899eda

View file

@ -1385,24 +1385,19 @@ pub unsafe fn _mm_i32gather_pd<const SCALE: i32>(slice: *const f64, offsets: __m
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_i32gather_pd)
#[inline]
#[target_feature(enable = "avx2")]
#[cfg_attr(test, assert_instr(vgatherdpd, scale = 1))]
#[rustc_args_required_const(4)]
#[cfg_attr(test, assert_instr(vgatherdpd, SCALE = 1))]
#[rustc_legacy_const_generics(4)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_mask_i32gather_pd(
pub unsafe fn _mm_mask_i32gather_pd<const SCALE: i32>(
src: __m128d,
slice: *const f64,
offsets: __m128i,
mask: __m128d,
scale: i32,
) -> __m128d {
static_assert_imm8_scale!(SCALE);
let offsets = offsets.as_i32x4();
let slice = slice as *const i8;
macro_rules! call {
($imm8:expr) => {
pgatherdpd(src, slice, offsets, mask, $imm8)
};
}
constify_imm8_gather!(scale, call)
pgatherdpd(src, slice, offsets, mask, SCALE as i8)
}
/// Returns values from `slice` at offsets determined by `offsets * scale`,
@ -5717,12 +5712,11 @@ mod tests {
j += 1.0;
}
// A multiplier of 8 is word-addressing for f64s
let r = _mm_mask_i32gather_pd(
let r = _mm_mask_i32gather_pd::<8>(
_mm_set1_pd(256.0),
arr.as_ptr(),
_mm_setr_epi32(16, 16, 16, 16),
_mm_setr_pd(-1.0, 0.0),
8,
);
assert_eq_m128d(r, _mm_setr_pd(16.0, 256.0));
}