@@ -29,6 +29,9 @@ use super::bit;
29
29
#[ macro_export]
30
30
#[ doc( hidden) ]
31
31
macro_rules! __unstable_detect_feature {
32
+ ( "aes" , $unstable_detect_feature: path) => {
33
+ $unstable_detect_feature(
34
+ $crate:: __vendor_runtime:: __Feature:: aes{ } ) } ;
32
35
( "mmx" , $unstable_detect_feature: path) => {
33
36
$unstable_detect_feature(
34
37
$crate:: __vendor_runtime:: __Feature:: mmx{ } ) } ;
@@ -168,6 +171,8 @@ macro_rules! __unstable_detect_feature {
168
171
#[ allow( non_camel_case_types) ]
169
172
#[ repr( u8 ) ]
170
173
pub enum __Feature {
174
+ /// AES (Advanced Encryption Standard New Instructions AES-NI)
175
+ aes,
171
176
/// MMX
172
177
mmx,
173
178
/// SSE (Streaming SIMD Extensions)
@@ -339,6 +344,7 @@ pub fn detect_features() -> usize {
339
344
enable ( proc_info_ecx, 19 , __Feature:: sse4_1) ;
340
345
enable ( proc_info_ecx, 20 , __Feature:: sse4_2) ;
341
346
enable ( proc_info_ecx, 23 , __Feature:: popcnt) ;
347
+ enable ( proc_info_ecx, 25 , __Feature:: aes) ;
342
348
enable ( proc_info_edx, 24 , __Feature:: fxsr) ;
343
349
enable ( proc_info_edx, 23 , __Feature:: mmx) ;
344
350
enable ( proc_info_edx, 25 , __Feature:: sse) ;
@@ -449,6 +455,7 @@ mod tests {
449
455
450
456
#[ test]
451
457
fn dump ( ) {
458
+ println ! ( "aes: {:?}" , cfg_feature_enabled!( "aes" ) ) ;
452
459
println ! ( "sse: {:?}" , cfg_feature_enabled!( "sse" ) ) ;
453
460
println ! ( "sse2: {:?}" , cfg_feature_enabled!( "sse2" ) ) ;
454
461
println ! ( "sse3: {:?}" , cfg_feature_enabled!( "sse3" ) ) ;
@@ -488,6 +495,7 @@ mod tests {
488
495
#[ test]
489
496
fn compare_with_cupid ( ) {
490
497
let information = cupid:: master ( ) . unwrap ( ) ;
498
+ assert_eq ! ( cfg_feature_enabled!( "aes" ) , information. aesni( ) ) ;
491
499
assert_eq ! ( cfg_feature_enabled!( "sse" ) , information. sse( ) ) ;
492
500
assert_eq ! ( cfg_feature_enabled!( "sse2" ) , information. sse2( ) ) ;
493
501
assert_eq ! ( cfg_feature_enabled!( "sse3" ) , information. sse3( ) ) ;
0 commit comments