@@ -2323,10 +2323,11 @@ pub const fn _mm256_or_si256(a: __m256i, b: __m256i) -> __m256i {
23232323#[ target_feature( enable = "avx2" ) ]
23242324#[ cfg_attr( test, assert_instr( vpacksswb) ) ]
23252325#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
2326- pub fn _mm256_packs_epi16 ( a : __m256i , b : __m256i ) -> __m256i {
2326+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
2327+ pub const fn _mm256_packs_epi16 ( a : __m256i , b : __m256i ) -> __m256i {
23272328 unsafe {
2328- let max = simd_splat ( i16 :: from ( i8:: MAX ) ) ;
2329- let min = simd_splat ( i16 :: from ( i8:: MIN ) ) ;
2329+ let max = simd_splat ( i8:: MAX as i16 ) ;
2330+ let min = simd_splat ( i8:: MIN as i16 ) ;
23302331
23312332 let clamped_a = simd_imax ( simd_imin ( a. as_i16x16 ( ) , max) , min)
23322333 . as_m256i ( )
@@ -2356,10 +2357,11 @@ pub fn _mm256_packs_epi16(a: __m256i, b: __m256i) -> __m256i {
23562357#[ target_feature( enable = "avx2" ) ]
23572358#[ cfg_attr( test, assert_instr( vpackssdw) ) ]
23582359#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
2359- pub fn _mm256_packs_epi32 ( a : __m256i , b : __m256i ) -> __m256i {
2360+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
2361+ pub const fn _mm256_packs_epi32 ( a : __m256i , b : __m256i ) -> __m256i {
23602362 unsafe {
2361- let max = simd_splat ( i32 :: from ( i16:: MAX ) ) ;
2362- let min = simd_splat ( i32 :: from ( i16:: MIN ) ) ;
2363+ let max = simd_splat ( i16:: MAX as i32 ) ;
2364+ let min = simd_splat ( i16:: MIN as i32 ) ;
23632365
23642366 let clamped_a = simd_imax ( simd_imin ( a. as_i32x8 ( ) , max) , min)
23652367 . as_m256i ( )
@@ -2389,10 +2391,11 @@ pub fn _mm256_packs_epi32(a: __m256i, b: __m256i) -> __m256i {
23892391#[ target_feature( enable = "avx2" ) ]
23902392#[ cfg_attr( test, assert_instr( vpackuswb) ) ]
23912393#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
2392- pub fn _mm256_packus_epi16 ( a : __m256i , b : __m256i ) -> __m256i {
2394+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
2395+ pub const fn _mm256_packus_epi16 ( a : __m256i , b : __m256i ) -> __m256i {
23932396 unsafe {
2394- let max = simd_splat ( i16 :: from ( u8:: MAX ) ) ;
2395- let min = simd_splat ( i16 :: from ( u8:: MIN ) ) ;
2397+ let max = simd_splat ( u8:: MAX as i16 ) ;
2398+ let min = simd_splat ( u8:: MIN as i16 ) ;
23962399
23972400 let clamped_a = simd_imax ( simd_imin ( a. as_i16x16 ( ) , max) , min)
23982401 . as_m256i ( )
@@ -2422,10 +2425,11 @@ pub fn _mm256_packus_epi16(a: __m256i, b: __m256i) -> __m256i {
24222425#[ target_feature( enable = "avx2" ) ]
24232426#[ cfg_attr( test, assert_instr( vpackusdw) ) ]
24242427#[ stable( feature = "simd_x86" , since = "1.27.0" ) ]
2425- pub fn _mm256_packus_epi32 ( a : __m256i , b : __m256i ) -> __m256i {
2428+ #[ rustc_const_unstable( feature = "stdarch_const_x86" , issue = "149298" ) ]
2429+ pub const fn _mm256_packus_epi32 ( a : __m256i , b : __m256i ) -> __m256i {
24262430 unsafe {
2427- let max = simd_splat ( i32 :: from ( u16:: MAX ) ) ;
2428- let min = simd_splat ( i32 :: from ( u16:: MIN ) ) ;
2431+ let max = simd_splat ( u16:: MAX as i32 ) ;
2432+ let min = simd_splat ( u16:: MIN as i32 ) ;
24292433
24302434 let clamped_a = simd_imax ( simd_imin ( a. as_i32x8 ( ) , max) , min)
24312435 . as_m256i ( )
@@ -5064,7 +5068,7 @@ mod tests {
50645068 }
50655069
50665070 #[ simd_test( enable = "avx2" ) ]
5067- fn test_mm256_packs_epi16 ( ) {
5071+ const fn test_mm256_packs_epi16 ( ) {
50685072 let a = _mm256_set1_epi16 ( 2 ) ;
50695073 let b = _mm256_set1_epi16 ( 4 ) ;
50705074 let r = _mm256_packs_epi16 ( a, b) ;
@@ -5080,7 +5084,7 @@ mod tests {
50805084 }
50815085
50825086 #[ simd_test( enable = "avx2" ) ]
5083- fn test_mm256_packs_epi32 ( ) {
5087+ const fn test_mm256_packs_epi32 ( ) {
50845088 let a = _mm256_set1_epi32 ( 2 ) ;
50855089 let b = _mm256_set1_epi32 ( 4 ) ;
50865090 let r = _mm256_packs_epi32 ( a, b) ;
@@ -5090,7 +5094,7 @@ mod tests {
50905094 }
50915095
50925096 #[ simd_test( enable = "avx2" ) ]
5093- fn test_mm256_packus_epi16 ( ) {
5097+ const fn test_mm256_packus_epi16 ( ) {
50945098 let a = _mm256_set1_epi16 ( 2 ) ;
50955099 let b = _mm256_set1_epi16 ( 4 ) ;
50965100 let r = _mm256_packus_epi16 ( a, b) ;
@@ -5106,7 +5110,7 @@ mod tests {
51065110 }
51075111
51085112 #[ simd_test( enable = "avx2" ) ]
5109- fn test_mm256_packus_epi32 ( ) {
5113+ const fn test_mm256_packus_epi32 ( ) {
51105114 let a = _mm256_set1_epi32 ( 2 ) ;
51115115 let b = _mm256_set1_epi32 ( 4 ) ;
51125116 let r = _mm256_packus_epi32 ( a, b) ;
0 commit comments