@@ -30,6 +30,9 @@ macro_rules! is_target_feature_detected {
30
30
( "aes" ) => {
31
31
$crate:: arch:: detect:: check_for(
32
32
$crate:: arch:: detect:: Feature :: aes) } ;
33
+ ( "pclmulqdq" ) => {
34
+ $crate:: arch:: detect:: check_for(
35
+ $crate:: arch:: detect:: Feature :: pclmulqdq) } ;
33
36
( "tsc" ) => {
34
37
$crate:: arch:: detect:: check_for(
35
38
$crate:: arch:: detect:: Feature :: tsc) } ;
@@ -174,6 +177,8 @@ macro_rules! is_target_feature_detected {
174
177
pub enum Feature {
175
178
/// AES (Advanced Encryption Standard New Instructions AES-NI)
176
179
aes,
180
+ /// CLMUL (Carry-less Multiplication)
181
+ pclmulqdq,
177
182
/// TSC (Time Stamp Counter)
178
183
tsc,
179
184
/// MMX
@@ -345,6 +350,7 @@ pub fn detect_features() -> cache::Initializer {
345
350
enable ( proc_info_ecx, 20 , Feature :: sse4_2) ;
346
351
enable ( proc_info_ecx, 23 , Feature :: popcnt) ;
347
352
enable ( proc_info_ecx, 25 , Feature :: aes) ;
353
+ enable ( proc_info_ecx, 1 , Feature :: pclmulqdq) ;
348
354
enable ( proc_info_edx, 4 , Feature :: tsc) ;
349
355
enable ( proc_info_edx, 23 , Feature :: mmx) ;
350
356
enable ( proc_info_edx, 24 , Feature :: fxsr) ;
@@ -457,6 +463,7 @@ mod tests {
457
463
#[ test]
458
464
fn dump ( ) {
459
465
println ! ( "aes: {:?}" , is_target_feature_detected!( "aes" ) ) ;
466
+ println ! ( "pclmulqdq: {:?}" , cfg_feature_enabled!( "pclmulqdq" ) ) ;
460
467
println ! ( "tsc: {:?}" , is_target_feature_detected!( "tsc" ) ) ;
461
468
println ! ( "sse: {:?}" , is_target_feature_detected!( "sse" ) ) ;
462
469
println ! ( "sse2: {:?}" , is_target_feature_detected!( "sse2" ) ) ;
@@ -498,6 +505,7 @@ mod tests {
498
505
fn compare_with_cupid ( ) {
499
506
let information = cupid:: master ( ) . unwrap ( ) ;
500
507
assert_eq ! ( is_target_feature_detected!( "aes" ) , information. aesni( ) ) ;
508
+ assert_eq ! ( cfg_feature_enabled!( "pclmulqdq" ) , information. pclmulqdq( ) ) ;
501
509
assert_eq ! ( is_target_feature_detected!( "tsc" ) , information. tsc( ) ) ;
502
510
assert_eq ! ( is_target_feature_detected!( "sse" ) , information. sse( ) ) ;
503
511
assert_eq ! ( is_target_feature_detected!( "sse2" ) , information. sse2( ) ) ;
0 commit comments