@@ -210,6 +210,21 @@ struct I64X2(i64, i64);
210210#[ allow( improper_ctypes_definitions) ]
211211extern "C" fn foo ( _a : I64X2 ) { }
212212
213+ #[ cfg( target_arch = "x86_64" ) ]
214+ #[ target_feature( enable = "sse4.2" ) ]
215+ #[ cfg( not( jit) ) ]
216+ unsafe fn test_crc32 ( ) {
217+ assert ! ( is_x86_feature_detected!( "sse4.2" ) ) ;
218+
219+ let a = 42u32 ;
220+ let b = 0xdeadbeefu64 ;
221+
222+ assert_eq ! ( _mm_crc32_u8( a, b as u8 ) , 4135334616 ) ;
223+ assert_eq ! ( _mm_crc32_u16( a, b as u16 ) , 1200687288 ) ;
224+ assert_eq ! ( _mm_crc32_u32( a, b as u32 ) , 2543798776 ) ;
225+ assert_eq ! ( _mm_crc32_u64( a as u64 , b as u64 ) , 241952147 ) ;
226+ }
227+
213228#[ cfg( target_arch = "x86_64" ) ]
214229#[ target_feature( enable = "sse2" ) ]
215230unsafe fn test_simd ( ) {
@@ -244,10 +259,14 @@ unsafe fn test_simd() {
244259
245260 test_mm256_shuffle_epi8 ( ) ;
246261 test_mm256_permute2x128_si256 ( ) ;
262+ test_mm256_permutevar8x32_epi32 ( ) ;
247263
248264 #[ rustfmt:: skip]
249265 let mask1 = _mm_movemask_epi8 ( dbg ! ( _mm_setr_epi8( 255u8 as i8 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ) ) ;
250266 assert_eq ! ( mask1, 1 ) ;
267+
268+ #[ cfg( not( jit) ) ]
269+ test_crc32 ( ) ;
251270}
252271
253272#[ cfg( target_arch = "x86_64" ) ]
@@ -447,6 +466,16 @@ unsafe fn test_mm256_permute2x128_si256() {
447466 assert_eq_m256i ( r, e) ;
448467}
449468
469+ #[ cfg( target_arch = "x86_64" ) ]
470+ #[ target_feature( enable = "avx2" ) ]
471+ unsafe fn test_mm256_permutevar8x32_epi32 ( ) {
472+ let a = _mm256_setr_epi32 ( 100 , 200 , 300 , 400 , 500 , 600 , 700 , 800 ) ;
473+ let idx = _mm256_setr_epi32 ( 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 ) ;
474+ let r = _mm256_setr_epi32 ( 800 , 700 , 600 , 500 , 400 , 300 , 200 , 100 ) ;
475+ let e = _mm256_permutevar8x32_epi32 ( a, idx) ;
476+ assert_eq_m256i ( r, e) ;
477+ }
478+
450479fn test_checked_mul ( ) {
451480 let u: Option < u8 > = u8:: from_str_radix ( "1000" , 10 ) . ok ( ) ;
452481 assert_eq ! ( u, None ) ;
0 commit comments