@@ -506,7 +506,13 @@ pub unsafe fn _mm_bsrli_si128(a: __m128i, imm8: i32) -> __m128i {
506506#[ rustc_args_required_const( 1 ) ]
507507#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
508508pub unsafe fn _mm_slli_epi16 ( a : __m128i , imm8 : i32 ) -> __m128i {
509- transmute ( pslliw ( a. as_i16x8 ( ) , imm8) )
509+ let a = a. as_i16x8 ( ) ;
510+ macro_rules! call {
511+ ( $imm8: expr) => {
512+ transmute( pslliw( a, $imm8) )
513+ } ;
514+ }
515+ constify_imm8 ! ( imm8, call)
510516}
511517
512518/// Shifts packed 16-bit integers in `a` left by `count` while shifting in
@@ -530,7 +536,13 @@ pub unsafe fn _mm_sll_epi16(a: __m128i, count: __m128i) -> __m128i {
530536#[ rustc_args_required_const( 1 ) ]
531537#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
532538pub unsafe fn _mm_slli_epi32 ( a : __m128i , imm8 : i32 ) -> __m128i {
533- transmute ( psllid ( a. as_i32x4 ( ) , imm8) )
539+ let a = a. as_i32x4 ( ) ;
540+ macro_rules! call {
541+ ( $imm8: expr) => {
542+ transmute( psllid( a, $imm8) )
543+ } ;
544+ }
545+ constify_imm8 ! ( imm8, call)
534546}
535547
536548/// Shifts packed 32-bit integers in `a` left by `count` while shifting in
@@ -554,7 +566,13 @@ pub unsafe fn _mm_sll_epi32(a: __m128i, count: __m128i) -> __m128i {
554566#[ rustc_args_required_const( 1 ) ]
555567#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
556568pub unsafe fn _mm_slli_epi64 ( a : __m128i , imm8 : i32 ) -> __m128i {
557- transmute ( pslliq ( a. as_i64x2 ( ) , imm8) )
569+ let a = a. as_i64x2 ( ) ;
570+ macro_rules! call {
571+ ( $imm8: expr) => {
572+ transmute( pslliq( a, $imm8) )
573+ } ;
574+ }
575+ constify_imm8 ! ( imm8, call)
558576}
559577
560578/// Shifts packed 64-bit integers in `a` left by `count` while shifting in
@@ -579,7 +597,13 @@ pub unsafe fn _mm_sll_epi64(a: __m128i, count: __m128i) -> __m128i {
579597#[ rustc_args_required_const( 1 ) ]
580598#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
581599pub unsafe fn _mm_srai_epi16 ( a : __m128i , imm8 : i32 ) -> __m128i {
582- transmute ( psraiw ( a. as_i16x8 ( ) , imm8) )
600+ let a = a. as_i16x8 ( ) ;
601+ macro_rules! call {
602+ ( $imm8: expr) => {
603+ transmute( psraiw( a, $imm8) )
604+ } ;
605+ }
606+ constify_imm8 ! ( imm8, call)
583607}
584608
585609/// Shifts packed 16-bit integers in `a` right by `count` while shifting in sign
@@ -604,7 +628,13 @@ pub unsafe fn _mm_sra_epi16(a: __m128i, count: __m128i) -> __m128i {
604628#[ rustc_args_required_const( 1 ) ]
605629#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
606630pub unsafe fn _mm_srai_epi32 ( a : __m128i , imm8 : i32 ) -> __m128i {
607- transmute ( psraid ( a. as_i32x4 ( ) , imm8) )
631+ let a = a. as_i32x4 ( ) ;
632+ macro_rules! call {
633+ ( $imm8: expr) => {
634+ transmute( psraid( a, $imm8) )
635+ } ;
636+ }
637+ constify_imm8 ! ( imm8, call)
608638}
609639
610640/// Shifts packed 32-bit integers in `a` right by `count` while shifting in sign
@@ -696,7 +726,13 @@ unsafe fn _mm_srli_si128_impl(a: __m128i, imm8: i32) -> __m128i {
696726#[ rustc_args_required_const( 1 ) ]
697727#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
698728pub unsafe fn _mm_srli_epi16 ( a : __m128i , imm8 : i32 ) -> __m128i {
699- transmute ( psrliw ( a. as_i16x8 ( ) , imm8) )
729+ let a = a. as_i16x8 ( ) ;
730+ macro_rules! call {
731+ ( $imm8: expr) => {
732+ transmute( psrliw( a, $imm8) )
733+ } ;
734+ }
735+ constify_imm8 ! ( imm8, call)
700736}
701737
702738/// Shifts packed 16-bit integers in `a` right by `count` while shifting in
@@ -721,7 +757,13 @@ pub unsafe fn _mm_srl_epi16(a: __m128i, count: __m128i) -> __m128i {
721757#[ rustc_args_required_const( 1 ) ]
722758#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
723759pub unsafe fn _mm_srli_epi32 ( a : __m128i , imm8 : i32 ) -> __m128i {
724- transmute ( psrlid ( a. as_i32x4 ( ) , imm8) )
760+ let a = a. as_i32x4 ( ) ;
761+ macro_rules! call {
762+ ( $imm8: expr) => {
763+ transmute( psrlid( a, $imm8) )
764+ } ;
765+ }
766+ constify_imm8 ! ( imm8, call)
725767}
726768
727769/// Shifts packed 32-bit integers in `a` right by `count` while shifting in
@@ -1375,7 +1417,13 @@ pub unsafe fn _mm_packus_epi16(a: __m128i, b: __m128i) -> __m128i {
13751417#[ rustc_args_required_const( 1 ) ]
13761418#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
13771419pub unsafe fn _mm_extract_epi16 ( a : __m128i , imm8 : i32 ) -> i32 {
1378- simd_extract :: < _ , u16 > ( a. as_u16x8 ( ) , ( imm8 & 7 ) as u32 ) as i32
1420+ let a = a. as_u16x8 ( ) ;
1421+ macro_rules! call {
1422+ ( $imm3: expr) => {
1423+ simd_extract:: <_, u16 >( a, $imm3) as i32
1424+ } ;
1425+ }
1426+ constify_imm3 ! ( imm8, call)
13791427}
13801428
13811429/// Returns a new vector where the `imm8` element of `a` is replaced with `i`.
@@ -1387,7 +1435,13 @@ pub unsafe fn _mm_extract_epi16(a: __m128i, imm8: i32) -> i32 {
13871435#[ rustc_args_required_const( 2 ) ]
13881436#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
13891437pub unsafe fn _mm_insert_epi16 ( a : __m128i , i : i32 , imm8 : i32 ) -> __m128i {
1390- transmute ( simd_insert ( a. as_i16x8 ( ) , ( imm8 & 7 ) as u32 , i as i16 ) )
1438+ let a = a. as_i16x8 ( ) ;
1439+ macro_rules! call {
1440+ ( $imm3: expr) => {
1441+ transmute( simd_insert( a, $imm3, i as i16 ) )
1442+ } ;
1443+ }
1444+ constify_imm3 ! ( imm8, call)
13911445}
13921446
13931447/// Returns a mask of the most significant bit of each element in `a`.
0 commit comments