@@ -258,6 +258,7 @@ macro_rules! is_x86_feature_detected {
258
258
/// This is an unstable implementation detail subject to change.
259
259
#[ allow( non_camel_case_types) ]
260
260
#[ repr( u8 ) ]
261
+ #[ derive( Copy , Clone ) ]
261
262
#[ doc( hidden) ]
262
263
#[ unstable( feature = "stdsimd_internal" , issue = "0" ) ]
263
264
pub enum Feature {
@@ -345,4 +346,54 @@ pub enum Feature {
345
346
adx,
346
347
/// RTM, Intel (Restricted Transactional Memory)
347
348
rtm,
349
+ // Do not add variants after last:
350
+ _last,
351
+ }
352
+
353
+ impl Feature {
354
+ pub fn to_str ( self ) -> & ' static str {
355
+ match self {
356
+ Feature :: aes => "aes" ,
357
+ Feature :: pclmulqdq => "pclmulqdq" ,
358
+ Feature :: rdrand => "rdrand" ,
359
+ Feature :: rdseed => "rdseed" ,
360
+ Feature :: tsc => "tsc" ,
361
+ Feature :: mmx => "mmx" ,
362
+ Feature :: sse => "sse" ,
363
+ Feature :: sse2 => "sse2" ,
364
+ Feature :: sse3 => "sse3" ,
365
+ Feature :: ssse3 => "ssse3" ,
366
+ Feature :: sse4_1 => "sse4.1" ,
367
+ Feature :: sse4_2 => "sse4.2" ,
368
+ Feature :: sse4a => "sse4a" ,
369
+ Feature :: sha => "sha" ,
370
+ Feature :: avx => "avx" ,
371
+ Feature :: avx2 => "avx2" ,
372
+ Feature :: avx512f => "avx512f" ,
373
+ Feature :: avx512cd => "avx512cd" ,
374
+ Feature :: avx512er => "avx512er" ,
375
+ Feature :: avx512pf => "avx512pf" ,
376
+ Feature :: avx512bw => "avx512bw" ,
377
+ Feature :: avx512dq => "avx512dq" ,
378
+ Feature :: avx512vl => "avx512vl" ,
379
+ Feature :: avx512_ifma => "avx512ifma" ,
380
+ Feature :: avx512_vbmi => "avx512vbmi" ,
381
+ Feature :: avx512_vpopcntdq => "avx512vpopcntdq" ,
382
+ Feature :: fma => "fma" ,
383
+ Feature :: bmi => "bmi" ,
384
+ Feature :: bmi2 => "bmi2" ,
385
+ Feature :: abm => "abm" ,
386
+ Feature :: tbm => "tbm" ,
387
+ Feature :: popcnt => "popcnt" ,
388
+ Feature :: fxsr => "fxsr" ,
389
+ Feature :: xsave => "xsave" ,
390
+ Feature :: xsaveopt => "xsaveopt" ,
391
+ Feature :: xsaves => "xsaves" ,
392
+ Feature :: xsavec => "xsavec" ,
393
+ Feature :: cmpxchg16b => "cmpxchg16b" ,
394
+ Feature :: adx => "adx" ,
395
+ Feature :: rtm => "rtm" ,
396
+ Feature :: _last => unreachable ! ( ) ,
397
+ }
398
+ }
348
399
}
0 commit comments