Skip to content

Commit babe45c

Browse files
lqdAmanieu
authored andcommitted
convert _mm256_mask_i64gather_pd to const generics
1 parent cdb0a0e commit babe45c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

crates/core_arch/src/x86/avx2.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,24 +1797,19 @@ pub unsafe fn _mm256_i64gather_pd<const SCALE: i32>(
17971797
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_mask_i64gather_pd)
17981798
#[inline]
17991799
#[target_feature(enable = "avx2")]
1800-
#[cfg_attr(test, assert_instr(vgatherqpd, scale = 1))]
1801-
#[rustc_args_required_const(4)]
1800+
#[cfg_attr(test, assert_instr(vgatherqpd, SCALE = 1))]
1801+
#[rustc_legacy_const_generics(4)]
18021802
#[stable(feature = "simd_x86", since = "1.27.0")]
1803-
pub unsafe fn _mm256_mask_i64gather_pd(
1803+
pub unsafe fn _mm256_mask_i64gather_pd<const SCALE: i32>(
18041804
src: __m256d,
18051805
slice: *const f64,
18061806
offsets: __m256i,
18071807
mask: __m256d,
1808-
scale: i32,
18091808
) -> __m256d {
1809+
static_assert_imm8_scale!(SCALE);
18101810
let slice = slice as *const i8;
18111811
let offsets = offsets.as_i64x4();
1812-
macro_rules! call {
1813-
($imm8:expr) => {
1814-
vpgatherqpd(src, slice, offsets, mask, $imm8)
1815-
};
1816-
}
1817-
constify_imm8_gather!(scale, call)
1812+
vpgatherqpd(src, slice, offsets, mask, SCALE as i8)
18181813
}
18191814

18201815
/// Copies `a` to `dst`, then insert 128 bits (of integer data) from `b` at the
@@ -5917,12 +5912,11 @@ mod tests {
59175912
j += 1.0;
59185913
}
59195914
// A multiplier of 8 is word-addressing for f64s
5920-
let r = _mm256_mask_i64gather_pd(
5915+
let r = _mm256_mask_i64gather_pd::<8>(
59215916
_mm256_set1_pd(256.0),
59225917
arr.as_ptr(),
59235918
_mm256_setr_epi64x(0, 16, 64, 96),
59245919
_mm256_setr_pd(-1.0, -1.0, -1.0, 0.0),
5925-
8,
59265920
);
59275921
assert_eq_m256d(r, _mm256_setr_pd(0.0, 16.0, 64.0, 256.0));
59285922
}

0 commit comments

Comments
 (0)