File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,9 @@ fn main() {
122
122
#[ cfg( target_arch = "x86_64" ) ]
123
123
unsafe {
124
124
test_simd ( ) ;
125
+
126
+ #[ cfg( not( jit) ) ]
127
+ test_crc32 ( ) ;
125
128
}
126
129
127
130
Box :: pin (
@@ -210,6 +213,21 @@ struct I64X2(i64, i64);
210
213
#[ allow( improper_ctypes_definitions) ]
211
214
extern "C" fn foo ( _a : I64X2 ) { }
212
215
216
+ #[ cfg( target_arch = "x86_64" ) ]
217
+ #[ target_feature( enable = "sse4.2" ) ]
218
+ #[ cfg( not( jit) ) ]
219
+ unsafe fn test_crc32 ( ) {
220
+ assert ! ( is_x86_feature_detected!( "sse4.2" ) ) ;
221
+
222
+ let a = 42u32 ;
223
+ let b = 0xdeadbeefu64 ;
224
+
225
+ assert_eq ! ( _mm_crc32_u8( a, b as u8 ) , 4135334616 ) ;
226
+ assert_eq ! ( _mm_crc32_u16( a, b as u16 ) , 1200687288 ) ;
227
+ assert_eq ! ( _mm_crc32_u32( a, b as u32 ) , 2543798776 ) ;
228
+ assert_eq ! ( _mm_crc32_u64( a as u64 , b as u64 ) , 241952147 ) ;
229
+ }
230
+
213
231
#[ cfg( target_arch = "x86_64" ) ]
214
232
#[ target_feature( enable = "sse2" ) ]
215
233
unsafe fn test_simd ( ) {
You can’t perform that action at this time.
0 commit comments