convert _mm_mask_i64gather_ps to const generics
This commit is contained in:
parent
34339ea8a6
commit
26fb95c7c7
1 changed files with 6 additions and 12 deletions
|
|
@ -1570,24 +1570,19 @@ pub unsafe fn _mm_i64gather_ps<const SCALE: i32>(slice: *const f32, offsets: __m
|
|||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_mask_i64gather_ps)
|
||||
#[inline]
|
||||
#[target_feature(enable = "avx2")]
|
||||
#[cfg_attr(test, assert_instr(vgatherqps, scale = 1))]
|
||||
#[rustc_args_required_const(4)]
|
||||
#[cfg_attr(test, assert_instr(vgatherqps, SCALE = 1))]
|
||||
#[rustc_legacy_const_generics(4)]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _mm_mask_i64gather_ps(
|
||||
pub unsafe fn _mm_mask_i64gather_ps<const SCALE: i32>(
|
||||
src: __m128,
|
||||
slice: *const f32,
|
||||
offsets: __m128i,
|
||||
mask: __m128,
|
||||
scale: i32,
|
||||
) -> __m128 {
|
||||
static_assert_imm8_scale!(SCALE);
|
||||
let offsets = offsets.as_i64x2();
|
||||
let slice = slice as *const i8;
|
||||
macro_rules! call {
|
||||
($imm8:expr) => {
|
||||
pgatherqps(src, slice, offsets, mask, $imm8)
|
||||
};
|
||||
}
|
||||
constify_imm8_gather!(scale, call)
|
||||
pgatherqps(src, slice, offsets, mask, SCALE as i8)
|
||||
}
|
||||
|
||||
/// Returns values from `slice` at offsets determined by `offsets * scale`,
|
||||
|
|
@ -5806,12 +5801,11 @@ mod tests {
|
|||
j += 1.0;
|
||||
}
|
||||
// A multiplier of 4 is word-addressing for f32s
|
||||
let r = _mm_mask_i64gather_ps(
|
||||
let r = _mm_mask_i64gather_ps::<4>(
|
||||
_mm_set1_ps(256.0),
|
||||
arr.as_ptr(),
|
||||
_mm_setr_epi64x(0, 16),
|
||||
_mm_setr_ps(-1.0, 0.0, -1.0, 0.0),
|
||||
4,
|
||||
);
|
||||
assert_eq_m128(r, _mm_setr_ps(0.0, 256.0, 0.0, 0.0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue