Skip to content

Commit 54fe30d

Browse files
committed
return changes to stdsimd/arch/detect/x86.rs
1 parent d7bc54e commit 54fe30d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

stdsimd/arch/detect/x86.rs

+8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ macro_rules! is_target_feature_detected {
3030
("aes") => {
3131
$crate::arch::detect::check_for(
3232
$crate::arch::detect::Feature::aes) };
33+
("pclmulqdq") => {
34+
$crate::arch::detect::check_for(
35+
$crate::arch::detect::Feature::pclmulqdq) };
3336
("tsc") => {
3437
$crate::arch::detect::check_for(
3538
$crate::arch::detect::Feature::tsc) };
@@ -174,6 +177,8 @@ macro_rules! is_target_feature_detected {
174177
pub enum Feature {
175178
/// AES (Advanced Encryption Standard New Instructions AES-NI)
176179
aes,
180+
/// CLMUL (Carry-less Multiplication)
181+
pclmulqdq,
177182
/// TSC (Time Stamp Counter)
178183
tsc,
179184
/// MMX
@@ -345,6 +350,7 @@ pub fn detect_features() -> cache::Initializer {
345350
enable(proc_info_ecx, 20, Feature::sse4_2);
346351
enable(proc_info_ecx, 23, Feature::popcnt);
347352
enable(proc_info_ecx, 25, Feature::aes);
353+
enable(proc_info_ecx, 1, Feature::pclmulqdq);
348354
enable(proc_info_edx, 4, Feature::tsc);
349355
enable(proc_info_edx, 23, Feature::mmx);
350356
enable(proc_info_edx, 24, Feature::fxsr);
@@ -457,6 +463,7 @@ mod tests {
457463
#[test]
458464
fn dump() {
459465
println!("aes: {:?}", is_target_feature_detected!("aes"));
466+
println!("pclmulqdq: {:?}", cfg_feature_enabled!("pclmulqdq"));
460467
println!("tsc: {:?}", is_target_feature_detected!("tsc"));
461468
println!("sse: {:?}", is_target_feature_detected!("sse"));
462469
println!("sse2: {:?}", is_target_feature_detected!("sse2"));
@@ -498,6 +505,7 @@ mod tests {
498505
fn compare_with_cupid() {
499506
let information = cupid::master().unwrap();
500507
assert_eq!(is_target_feature_detected!("aes"), information.aesni());
508+
assert_eq!(cfg_feature_enabled!("pclmulqdq"), information.pclmulqdq());
501509
assert_eq!(is_target_feature_detected!("tsc"), information.tsc());
502510
assert_eq!(is_target_feature_detected!("sse"), information.sse());
503511
assert_eq!(is_target_feature_detected!("sse2"), information.sse2());

0 commit comments

Comments
 (0)