@@ -503,16 +503,11 @@ pub unsafe fn _mm_bsrli_si128(a: __m128i, imm8: i32) -> __m128i {
503
503
#[ inline]
504
504
#[ target_feature( enable = "sse2" ) ]
505
505
#[ cfg_attr( test, assert_instr( psllw, imm8 = 7 ) ) ]
506
- #[ rustc_args_required_const ( 1 ) ]
506
+ #[ rustc_legacy_const_generics ( 1 ) ]
507
507
#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
508
- pub unsafe fn _mm_slli_epi16 ( a : __m128i , imm8 : i32 ) -> __m128i {
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)
508
+ pub unsafe fn _mm_slli_epi16 < const imm8: i32 > ( a : __m128i ) -> __m128i {
509
+ static_assert_imm8 ! ( imm8) ;
510
+ transmute ( pslliw ( a. as_i16x8 ( ) , imm8) )
516
511
}
517
512
518
513
/// Shifts packed 16-bit integers in `a` left by `count` while shifting in
@@ -533,16 +528,11 @@ pub unsafe fn _mm_sll_epi16(a: __m128i, count: __m128i) -> __m128i {
533
528
#[ inline]
534
529
#[ target_feature( enable = "sse2" ) ]
535
530
#[ cfg_attr( test, assert_instr( pslld, imm8 = 7 ) ) ]
536
- #[ rustc_args_required_const ( 1 ) ]
531
+ #[ rustc_legacy_const_generics ( 1 ) ]
537
532
#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
538
- pub unsafe fn _mm_slli_epi32 ( a : __m128i , imm8 : i32 ) -> __m128i {
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)
533
+ pub unsafe fn _mm_slli_epi32 < const imm8: i32 > ( a : __m128i ) -> __m128i {
534
+ static_assert_imm8 ! ( imm8) ;
535
+ transmute ( psllid ( a. as_i32x4 ( ) , imm8) )
546
536
}
547
537
548
538
/// Shifts packed 32-bit integers in `a` left by `count` while shifting in
@@ -563,16 +553,11 @@ pub unsafe fn _mm_sll_epi32(a: __m128i, count: __m128i) -> __m128i {
563
553
#[ inline]
564
554
#[ target_feature( enable = "sse2" ) ]
565
555
#[ cfg_attr( test, assert_instr( psllq, imm8 = 7 ) ) ]
566
- #[ rustc_args_required_const ( 1 ) ]
556
+ #[ rustc_legacy_const_generics ( 1 ) ]
567
557
#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
568
- pub unsafe fn _mm_slli_epi64 ( a : __m128i , imm8 : i32 ) -> __m128i {
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)
558
+ pub unsafe fn _mm_slli_epi64 < const imm8: i32 > ( a : __m128i ) -> __m128i {
559
+ static_assert_imm8 ! ( imm8) ;
560
+ transmute ( pslliq ( a. as_i64x2 ( ) , imm8) )
576
561
}
577
562
578
563
/// Shifts packed 64-bit integers in `a` left by `count` while shifting in
@@ -713,16 +698,11 @@ unsafe fn _mm_srli_si128_impl(a: __m128i, imm8: i32) -> __m128i {
713
698
#[ inline]
714
699
#[ target_feature( enable = "sse2" ) ]
715
700
#[ cfg_attr( test, assert_instr( psrlw, imm8 = 1 ) ) ]
716
- #[ rustc_args_required_const ( 1 ) ]
701
+ #[ rustc_legacy_const_generics ( 1 ) ]
717
702
#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
718
- pub unsafe fn _mm_srli_epi16 ( a : __m128i , imm8 : i32 ) -> __m128i {
719
- let a = a. as_i16x8 ( ) ;
720
- macro_rules! call {
721
- ( $imm8: expr) => {
722
- transmute( psrliw( a, $imm8) )
723
- } ;
724
- }
725
- constify_imm8 ! ( imm8, call)
703
+ pub unsafe fn _mm_srli_epi16 < const imm8: i32 > ( a : __m128i ) -> __m128i {
704
+ static_assert_imm8 ! ( imm8) ;
705
+ transmute ( psrliw ( a. as_i16x8 ( ) , imm8) )
726
706
}
727
707
728
708
/// Shifts packed 16-bit integers in `a` right by `count` while shifting in
@@ -744,16 +724,11 @@ pub unsafe fn _mm_srl_epi16(a: __m128i, count: __m128i) -> __m128i {
744
724
#[ inline]
745
725
#[ target_feature( enable = "sse2" ) ]
746
726
#[ cfg_attr( test, assert_instr( psrld, imm8 = 8 ) ) ]
747
- #[ rustc_args_required_const ( 1 ) ]
727
+ #[ rustc_legacy_const_generics ( 1 ) ]
748
728
#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
749
- pub unsafe fn _mm_srli_epi32 ( a : __m128i , imm8 : i32 ) -> __m128i {
750
- let a = a. as_i32x4 ( ) ;
751
- macro_rules! call {
752
- ( $imm8: expr) => {
753
- transmute( psrlid( a, $imm8) )
754
- } ;
755
- }
756
- constify_imm8 ! ( imm8, call)
729
+ pub unsafe fn _mm_srli_epi32 < const imm8: i32 > ( a : __m128i ) -> __m128i {
730
+ static_assert_imm8 ! ( imm8) ;
731
+ transmute ( psrlid ( a. as_i32x4 ( ) , imm8) )
757
732
}
758
733
759
734
/// Shifts packed 32-bit integers in `a` right by `count` while shifting in
@@ -775,9 +750,10 @@ pub unsafe fn _mm_srl_epi32(a: __m128i, count: __m128i) -> __m128i {
775
750
#[ inline]
776
751
#[ target_feature( enable = "sse2" ) ]
777
752
#[ cfg_attr( test, assert_instr( psrlq, imm8 = 1 ) ) ]
778
- #[ rustc_args_required_const ( 1 ) ]
753
+ #[ rustc_legacy_const_generics ( 1 ) ]
779
754
#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
780
- pub unsafe fn _mm_srli_epi64 ( a : __m128i , imm8 : i32 ) -> __m128i {
755
+ pub unsafe fn _mm_srli_epi64 < const imm8: i32 > ( a : __m128i ) -> __m128i {
756
+ static_assert_imm8 ! ( imm8) ;
781
757
transmute ( psrliq ( a. as_i64x2 ( ) , imm8) )
782
758
}
783
759
@@ -3439,7 +3415,7 @@ mod tests {
3439
3415
let a = _mm_setr_epi16 (
3440
3416
0xFFFF as u16 as i16 , 0x0FFF , 0x00FF , 0x000F , 0 , 0 , 0 , 0 ,
3441
3417
) ;
3442
- let r = _mm_slli_epi16 ( a , 4 ) ;
3418
+ let r = _mm_slli_epi16 :: < 4 > ( a ) ;
3443
3419
3444
3420
#[ rustfmt:: skip]
3445
3421
let e = _mm_setr_epi16 (
@@ -3460,7 +3436,7 @@ mod tests {
3460
3436
3461
3437
#[ simd_test( enable = "sse2" ) ]
3462
3438
unsafe fn test_mm_slli_epi32 ( ) {
3463
- let r = _mm_slli_epi32 ( _mm_set1_epi32 ( 0xFFFF ) , 4 ) ;
3439
+ let r = _mm_slli_epi32 :: < 4 > ( _mm_set1_epi32 ( 0xFFFF ) ) ;
3464
3440
assert_eq_m128i ( r, _mm_set1_epi32 ( 0xFFFF0 ) ) ;
3465
3441
}
3466
3442
@@ -3474,7 +3450,7 @@ mod tests {
3474
3450
3475
3451
#[ simd_test( enable = "sse2" ) ]
3476
3452
unsafe fn test_mm_slli_epi64 ( ) {
3477
- let r = _mm_slli_epi64 ( _mm_set1_epi64x ( 0xFFFFFFFF ) , 4 ) ;
3453
+ let r = _mm_slli_epi64 :: < 4 > ( _mm_set1_epi64x ( 0xFFFFFFFF ) ) ;
3478
3454
assert_eq_m128i ( r, _mm_set1_epi64x ( 0xFFFFFFFF0 ) ) ;
3479
3455
}
3480
3456
@@ -3563,7 +3539,7 @@ mod tests {
3563
3539
let a = _mm_setr_epi16 (
3564
3540
0xFFFF as u16 as i16 , 0x0FFF , 0x00FF , 0x000F , 0 , 0 , 0 , 0 ,
3565
3541
) ;
3566
- let r = _mm_srli_epi16 ( a , 4 ) ;
3542
+ let r = _mm_srli_epi16 :: < 4 > ( a ) ;
3567
3543
#[ rustfmt:: skip]
3568
3544
let e = _mm_setr_epi16 (
3569
3545
0xFFF as u16 as i16 , 0xFF as u16 as i16 , 0xF , 0 , 0 , 0 , 0 , 0 ,
@@ -3582,7 +3558,7 @@ mod tests {
3582
3558
3583
3559
#[ simd_test( enable = "sse2" ) ]
3584
3560
unsafe fn test_mm_srli_epi32 ( ) {
3585
- let r = _mm_srli_epi32 ( _mm_set1_epi32 ( 0xFFFF ) , 4 ) ;
3561
+ let r = _mm_srli_epi32 :: < 4 > ( _mm_set1_epi32 ( 0xFFFF ) ) ;
3586
3562
assert_eq_m128i ( r, _mm_set1_epi32 ( 0xFFF ) ) ;
3587
3563
}
3588
3564
@@ -3596,7 +3572,7 @@ mod tests {
3596
3572
3597
3573
#[ simd_test( enable = "sse2" ) ]
3598
3574
unsafe fn test_mm_srli_epi64 ( ) {
3599
- let r = _mm_srli_epi64 ( _mm_set1_epi64x ( 0xFFFFFFFF ) , 4 ) ;
3575
+ let r = _mm_srli_epi64 :: < 4 > ( _mm_set1_epi64x ( 0xFFFFFFFF ) ) ;
3600
3576
assert_eq_m128i ( r, _mm_set1_epi64x ( 0xFFFFFFF ) ) ;
3601
3577
}
3602
3578
0 commit comments