@@ -1813,24 +1813,22 @@ pub unsafe fn _mm256_mask_i64gather_pd<const SCALE: i32>(
1813
1813
}
1814
1814
1815
1815
/// Copies `a` to `dst`, then insert 128 bits (of integer data) from `b` at the
1816
- /// location specified by `imm8 `.
1816
+ /// location specified by `IMM1 `.
1817
1817
///
1818
1818
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_inserti128_si256)
1819
1819
#[ inline]
1820
1820
#[ target_feature( enable = "avx2" ) ]
1821
1821
#[ cfg_attr(
1822
1822
all( test, not( target_os = "windows" ) ) ,
1823
- assert_instr( vinsertf128, imm8 = 1 )
1823
+ assert_instr( vinsertf128, IMM1 = 1 )
1824
1824
) ]
1825
- #[ rustc_args_required_const ( 2 ) ]
1825
+ #[ rustc_legacy_const_generics ( 2 ) ]
1826
1826
#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
1827
- pub unsafe fn _mm256_inserti128_si256 ( a : __m256i , b : __m128i , imm8 : i32 ) -> __m256i {
1827
+ pub unsafe fn _mm256_inserti128_si256 < const IMM1 : i32 > ( a : __m256i , b : __m128i ) -> __m256i {
1828
+ static_assert_imm1 ! ( IMM1 ) ;
1828
1829
let a = a. as_i64x4 ( ) ;
1829
1830
let b = _mm256_castsi128_si256 ( b) . as_i64x4 ( ) ;
1830
- let dst: i64x4 = match imm8 & 0b01 {
1831
- 0 => simd_shuffle4 ( a, b, [ 4 , 5 , 2 , 3 ] ) ,
1832
- _ => simd_shuffle4 ( a, b, [ 0 , 1 , 4 , 5 ] ) ,
1833
- } ;
1831
+ let dst: i64x4 = simd_shuffle4 ( a, b, [ [ 4 , 5 , 2 , 3 ] , [ 0 , 1 , 4 , 5 ] ] [ IMM1 as usize ] ) ;
1834
1832
transmute ( dst)
1835
1833
}
1836
1834
@@ -4494,7 +4492,7 @@ mod tests {
4494
4492
unsafe fn test_mm256_inserti128_si256 ( ) {
4495
4493
let a = _mm256_setr_epi64x ( 1 , 2 , 3 , 4 ) ;
4496
4494
let b = _mm_setr_epi64x ( 7 , 8 ) ;
4497
- let r = _mm256_inserti128_si256 ( a, b, 0b01 ) ;
4495
+ let r = _mm256_inserti128_si256 :: < 1 > ( a, b) ;
4498
4496
let e = _mm256_setr_epi64x ( 1 , 2 , 7 , 8 ) ;
4499
4497
assert_eq_m256i ( r, e) ;
4500
4498
}
0 commit comments