@@ -247,6 +247,7 @@ macro_rules! is_x86_feature_detected {
247
247
/// This is an unstable implementation detail subject to change.
248
248
#[ allow( non_camel_case_types) ]
249
249
#[ repr( u8 ) ]
250
+ #[ derive( Copy , Clone ) ]
250
251
#[ doc( hidden) ]
251
252
#[ unstable( feature = "stdsimd_internal" , issue = "0" ) ]
252
253
pub enum Feature {
@@ -330,4 +331,54 @@ pub enum Feature {
330
331
cmpxchg16b,
331
332
/// ADX, Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
332
333
adx,
334
+
335
+ // Do not add variants after last:
336
+ _last,
337
+ }
338
+
339
+ impl Feature {
340
+ pub fn to_str ( self ) -> & ' static str {
341
+ match self {
342
+ Feature :: aes => "aes" ,
343
+ Feature :: pclmulqdq => "pclmulqdq" ,
344
+ Feature :: rdrand => "rdrand" ,
345
+ Feature :: rdseed => "rdseed" ,
346
+ Feature :: tsc => "tsc" ,
347
+ Feature :: mmx => "mmx" ,
348
+ Feature :: sse => "sse" ,
349
+ Feature :: sse2 => "sse2" ,
350
+ Feature :: sse3 => "sse3" ,
351
+ Feature :: ssse3 => "ssse3" ,
352
+ Feature :: sse4_1 => "sse4.1" ,
353
+ Feature :: sse4_2 => "sse4.2" ,
354
+ Feature :: sse4a => "sse4a" ,
355
+ Feature :: sha => "sha" ,
356
+ Feature :: avx => "avx" ,
357
+ Feature :: avx2 => "avx2" ,
358
+ Feature :: avx512f => "avx512f" ,
359
+ Feature :: avx512cd => "avx512cd" ,
360
+ Feature :: avx512er => "avx512er" ,
361
+ Feature :: avx512pf => "avx512pf" ,
362
+ Feature :: avx512bw => "avx512bw" ,
363
+ Feature :: avx512dq => "avx512dq" ,
364
+ Feature :: avx512vl => "avx512vl" ,
365
+ Feature :: avx512_ifma => "avx512ifma" ,
366
+ Feature :: avx512_vbmi => "avx512vbmi" ,
367
+ Feature :: avx512_vpopcntdq => "avx512vpopcntdq" ,
368
+ Feature :: fma => "fma" ,
369
+ Feature :: bmi => "bmi" ,
370
+ Feature :: bmi2 => "bmi2" ,
371
+ Feature :: abm => "abm" ,
372
+ Feature :: tbm => "tbm" ,
373
+ Feature :: popcnt => "popcnt" ,
374
+ Feature :: fxsr => "fxsr" ,
375
+ Feature :: xsave => "xsave" ,
376
+ Feature :: xsaveopt => "xsaveopt" ,
377
+ Feature :: xsaves => "xsaves" ,
378
+ Feature :: xsavec => "xsavec" ,
379
+ Feature :: cmpxchg16b => "cmpxchg16b" ,
380
+ Feature :: adx => "adx" ,
381
+ Feature :: _last => unreachable ! ( ) ,
382
+ }
383
+ }
333
384
}
0 commit comments