Skip to content

Commit

Permalink
return changes to stdsimd/arch/detect/x86.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Feb 18, 2018
1 parent d7bc54e commit 54fe30d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions stdsimd/arch/detect/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ macro_rules! is_target_feature_detected {
("aes") => {
$crate::arch::detect::check_for(
$crate::arch::detect::Feature::aes) };
("pclmulqdq") => {
$crate::arch::detect::check_for(
$crate::arch::detect::Feature::pclmulqdq) };
("tsc") => {
$crate::arch::detect::check_for(
$crate::arch::detect::Feature::tsc) };
Expand Down Expand Up @@ -174,6 +177,8 @@ macro_rules! is_target_feature_detected {
pub enum Feature {
/// AES (Advanced Encryption Standard New Instructions AES-NI)
aes,
/// CLMUL (Carry-less Multiplication)
pclmulqdq,
/// TSC (Time Stamp Counter)
tsc,
/// MMX
Expand Down Expand Up @@ -345,6 +350,7 @@ pub fn detect_features() -> cache::Initializer {
enable(proc_info_ecx, 20, Feature::sse4_2);
enable(proc_info_ecx, 23, Feature::popcnt);
enable(proc_info_ecx, 25, Feature::aes);
enable(proc_info_ecx, 1, Feature::pclmulqdq);
enable(proc_info_edx, 4, Feature::tsc);
enable(proc_info_edx, 23, Feature::mmx);
enable(proc_info_edx, 24, Feature::fxsr);
Expand Down Expand Up @@ -457,6 +463,7 @@ mod tests {
#[test]
fn dump() {
println!("aes: {:?}", is_target_feature_detected!("aes"));
println!("pclmulqdq: {:?}", cfg_feature_enabled!("pclmulqdq"));
println!("tsc: {:?}", is_target_feature_detected!("tsc"));
println!("sse: {:?}", is_target_feature_detected!("sse"));
println!("sse2: {:?}", is_target_feature_detected!("sse2"));
Expand Down Expand Up @@ -498,6 +505,7 @@ mod tests {
fn compare_with_cupid() {
let information = cupid::master().unwrap();
assert_eq!(is_target_feature_detected!("aes"), information.aesni());
assert_eq!(cfg_feature_enabled!("pclmulqdq"), information.pclmulqdq());
assert_eq!(is_target_feature_detected!("tsc"), information.tsc());
assert_eq!(is_target_feature_detected!("sse"), information.sse());
assert_eq!(is_target_feature_detected!("sse2"), information.sse2());
Expand Down

0 comments on commit 54fe30d

Please sign in to comment.