@@ -243,139 +243,3 @@ pub(crate) fn detect_features() -> cache::Initializer {
243
243
244
244
value
245
245
}
246
-
247
- #[ cfg( test) ]
248
- mod tests {
249
- extern crate cupid;
250
-
251
- #[ test]
252
- fn dump ( ) {
253
- println ! ( "aes: {:?}" , is_x86_feature_detected!( "aes" ) ) ;
254
- println ! ( "pclmulqdq: {:?}" , is_x86_feature_detected!( "pclmulqdq" ) ) ;
255
- println ! ( "rdrand: {:?}" , is_x86_feature_detected!( "rdrand" ) ) ;
256
- println ! ( "rdseed: {:?}" , is_x86_feature_detected!( "rdseed" ) ) ;
257
- println ! ( "tsc: {:?}" , is_x86_feature_detected!( "tsc" ) ) ;
258
- println ! ( "sse: {:?}" , is_x86_feature_detected!( "sse" ) ) ;
259
- println ! ( "sse2: {:?}" , is_x86_feature_detected!( "sse2" ) ) ;
260
- println ! ( "sse3: {:?}" , is_x86_feature_detected!( "sse3" ) ) ;
261
- println ! ( "ssse3: {:?}" , is_x86_feature_detected!( "ssse3" ) ) ;
262
- println ! ( "sse4.1: {:?}" , is_x86_feature_detected!( "sse4.1" ) ) ;
263
- println ! ( "sse4.2: {:?}" , is_x86_feature_detected!( "sse4.2" ) ) ;
264
- println ! ( "sse4a: {:?}" , is_x86_feature_detected!( "sse4a" ) ) ;
265
- println ! ( "sha: {:?}" , is_x86_feature_detected!( "sha" ) ) ;
266
- println ! ( "avx: {:?}" , is_x86_feature_detected!( "avx" ) ) ;
267
- println ! ( "avx2: {:?}" , is_x86_feature_detected!( "avx2" ) ) ;
268
- println ! ( "avx512f {:?}" , is_x86_feature_detected!( "avx512f" ) ) ;
269
- println ! ( "avx512cd {:?}" , is_x86_feature_detected!( "avx512cd" ) ) ;
270
- println ! ( "avx512er {:?}" , is_x86_feature_detected!( "avx512er" ) ) ;
271
- println ! ( "avx512pf {:?}" , is_x86_feature_detected!( "avx512pf" ) ) ;
272
- println ! ( "avx512bw {:?}" , is_x86_feature_detected!( "avx512bw" ) ) ;
273
- println ! ( "avx512dq {:?}" , is_x86_feature_detected!( "avx512dq" ) ) ;
274
- println ! ( "avx512vl {:?}" , is_x86_feature_detected!( "avx512vl" ) ) ;
275
- println ! ( "avx512_ifma {:?}" , is_x86_feature_detected!( "avx512ifma" ) ) ;
276
- println ! ( "avx512_vbmi {:?}" , is_x86_feature_detected!( "avx512vbmi" ) ) ;
277
- println ! (
278
- "avx512_vpopcntdq {:?}" ,
279
- is_x86_feature_detected!( "avx512vpopcntdq" )
280
- ) ;
281
- println ! ( "fma: {:?}" , is_x86_feature_detected!( "fma" ) ) ;
282
- println ! ( "abm: {:?}" , is_x86_feature_detected!( "abm" ) ) ;
283
- println ! ( "bmi: {:?}" , is_x86_feature_detected!( "bmi1" ) ) ;
284
- println ! ( "bmi2: {:?}" , is_x86_feature_detected!( "bmi2" ) ) ;
285
- println ! ( "tbm: {:?}" , is_x86_feature_detected!( "tbm" ) ) ;
286
- println ! ( "popcnt: {:?}" , is_x86_feature_detected!( "popcnt" ) ) ;
287
- println ! ( "lzcnt: {:?}" , is_x86_feature_detected!( "lzcnt" ) ) ;
288
- println ! ( "fxsr: {:?}" , is_x86_feature_detected!( "fxsr" ) ) ;
289
- println ! ( "xsave: {:?}" , is_x86_feature_detected!( "xsave" ) ) ;
290
- println ! ( "xsaveopt: {:?}" , is_x86_feature_detected!( "xsaveopt" ) ) ;
291
- println ! ( "xsaves: {:?}" , is_x86_feature_detected!( "xsaves" ) ) ;
292
- println ! ( "xsavec: {:?}" , is_x86_feature_detected!( "xsavec" ) ) ;
293
- println ! ( "cmpxchg16b: {:?}" , is_x86_feature_detected!( "cmpxchg16b" ) ) ;
294
- println ! ( "adx: {:?}" , is_x86_feature_detected!( "adx" ) ) ;
295
- println ! ( "rtm: {:?}" , is_x86_feature_detected!( "rtm" ) ) ;
296
- }
297
-
298
- #[ cfg( feature = "std_detect_env_override" ) ]
299
- #[ test]
300
- fn env_override_no_avx ( ) {
301
- if let Ok ( disable) = crate :: env:: var ( "RUST_STD_DETECT_UNSTABLE" ) {
302
- let information = cupid:: master ( ) . unwrap ( ) ;
303
- for d in disable. split ( " " ) {
304
- match d {
305
- "avx" => if information. avx ( ) {
306
- assert_ne ! ( is_x86_feature_detected!( "avx" ) , information. avx( ) )
307
- }
308
- "avx2" => if information. avx2 ( ) {
309
- assert_ne ! ( is_x86_feature_detected!( "avx2" ) , information. avx2( ) )
310
- }
311
- _ => { }
312
- }
313
- }
314
- }
315
- }
316
-
317
- #[ test]
318
- fn compare_with_cupid ( ) {
319
- let information = cupid:: master ( ) . unwrap ( ) ;
320
- assert_eq ! ( is_x86_feature_detected!( "aes" ) , information. aesni( ) ) ;
321
- assert_eq ! (
322
- is_x86_feature_detected!( "pclmulqdq" ) ,
323
- information. pclmulqdq( )
324
- ) ;
325
- assert_eq ! ( is_x86_feature_detected!( "rdrand" ) , information. rdrand( ) ) ;
326
- assert_eq ! ( is_x86_feature_detected!( "rdseed" ) , information. rdseed( ) ) ;
327
- assert_eq ! ( is_x86_feature_detected!( "tsc" ) , information. tsc( ) ) ;
328
- assert_eq ! ( is_x86_feature_detected!( "sse" ) , information. sse( ) ) ;
329
- assert_eq ! ( is_x86_feature_detected!( "sse2" ) , information. sse2( ) ) ;
330
- assert_eq ! ( is_x86_feature_detected!( "sse3" ) , information. sse3( ) ) ;
331
- assert_eq ! ( is_x86_feature_detected!( "ssse3" ) , information. ssse3( ) ) ;
332
- assert_eq ! ( is_x86_feature_detected!( "sse4.1" ) , information. sse4_1( ) ) ;
333
- assert_eq ! ( is_x86_feature_detected!( "sse4.2" ) , information. sse4_2( ) ) ;
334
- assert_eq ! ( is_x86_feature_detected!( "sse4a" ) , information. sse4a( ) ) ;
335
- assert_eq ! ( is_x86_feature_detected!( "sha" ) , information. sha( ) ) ;
336
- assert_eq ! ( is_x86_feature_detected!( "avx" ) , information. avx( ) ) ;
337
- assert_eq ! ( is_x86_feature_detected!( "avx2" ) , information. avx2( ) ) ;
338
- assert_eq ! ( is_x86_feature_detected!( "avx512f" ) , information. avx512f( ) ) ;
339
- assert_eq ! ( is_x86_feature_detected!( "avx512cd" ) , information. avx512cd( ) ) ;
340
- assert_eq ! ( is_x86_feature_detected!( "avx512er" ) , information. avx512er( ) ) ;
341
- assert_eq ! ( is_x86_feature_detected!( "avx512pf" ) , information. avx512pf( ) ) ;
342
- assert_eq ! ( is_x86_feature_detected!( "avx512bw" ) , information. avx512bw( ) ) ;
343
- assert_eq ! ( is_x86_feature_detected!( "avx512dq" ) , information. avx512dq( ) ) ;
344
- assert_eq ! ( is_x86_feature_detected!( "avx512vl" ) , information. avx512vl( ) ) ;
345
- assert_eq ! (
346
- is_x86_feature_detected!( "avx512ifma" ) ,
347
- information. avx512_ifma( )
348
- ) ;
349
- assert_eq ! (
350
- is_x86_feature_detected!( "avx512vbmi" ) ,
351
- information. avx512_vbmi( )
352
- ) ;
353
- assert_eq ! (
354
- is_x86_feature_detected!( "avx512vpopcntdq" ) ,
355
- information. avx512_vpopcntdq( )
356
- ) ;
357
- assert_eq ! ( is_x86_feature_detected!( "fma" ) , information. fma( ) ) ;
358
- assert_eq ! ( is_x86_feature_detected!( "bmi1" ) , information. bmi1( ) ) ;
359
- assert_eq ! ( is_x86_feature_detected!( "bmi2" ) , information. bmi2( ) ) ;
360
- assert_eq ! ( is_x86_feature_detected!( "popcnt" ) , information. popcnt( ) ) ;
361
- assert_eq ! ( is_x86_feature_detected!( "abm" ) , information. lzcnt( ) ) ;
362
- assert_eq ! ( is_x86_feature_detected!( "tbm" ) , information. tbm( ) ) ;
363
- assert_eq ! ( is_x86_feature_detected!( "lzcnt" ) , information. lzcnt( ) ) ;
364
- assert_eq ! ( is_x86_feature_detected!( "xsave" ) , information. xsave( ) ) ;
365
- assert_eq ! ( is_x86_feature_detected!( "xsaveopt" ) , information. xsaveopt( ) ) ;
366
- assert_eq ! (
367
- is_x86_feature_detected!( "xsavec" ) ,
368
- information. xsavec_and_xrstor( )
369
- ) ;
370
- assert_eq ! (
371
- is_x86_feature_detected!( "xsaves" ) ,
372
- information. xsaves_xrstors_and_ia32_xss( )
373
- ) ;
374
- assert_eq ! (
375
- is_x86_feature_detected!( "cmpxchg16b" ) ,
376
- information. cmpxchg16b( ) ,
377
- ) ;
378
- assert_eq ! ( is_x86_feature_detected!( "adx" ) , information. adx( ) , ) ;
379
- assert_eq ! ( is_x86_feature_detected!( "rtm" ) , information. rtm( ) , ) ;
380
- }
381
- }
0 commit comments