Skip to content

Commit

Permalink
Merge pull request rust-lang#48 from alexcrichton/assert-detection-co…
Browse files Browse the repository at this point in the history
…rrect

Add a test for x86 runtime support
  • Loading branch information
alexcrichton authored Sep 26, 2017
2 parents d93e1d2 + 3f72e3a commit 03e9793
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ opt-level = 3

[dev-dependencies]
stdsimd-test = { path = "stdsimd-test" }
cupid = "0.3"
25 changes: 25 additions & 0 deletions tests/cpu-detection.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#![feature(cfg_target_feature)]

#[macro_use]
extern crate stdsimd;
extern crate cupid;

#[test]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
fn works() {
let information = cupid::master().unwrap();
assert_eq!(cfg_feature_enabled!("sse"), information.sse());
assert_eq!(cfg_feature_enabled!("sse2"), information.sse2());
assert_eq!(cfg_feature_enabled!("sse3"), information.sse3());
assert_eq!(cfg_feature_enabled!("ssse3"), information.ssse3());
assert_eq!(cfg_feature_enabled!("sse4.1"), information.sse4_1());
assert_eq!(cfg_feature_enabled!("sse4.2"), information.sse4_2());
assert_eq!(cfg_feature_enabled!("avx"), information.avx());
assert_eq!(cfg_feature_enabled!("avx2"), information.avx2());
assert_eq!(cfg_feature_enabled!("fma"), information.fma());
assert_eq!(cfg_feature_enabled!("bmi"), information.bmi1());
assert_eq!(cfg_feature_enabled!("bmi2"), information.bmi2());
assert_eq!(cfg_feature_enabled!("popcnt"), information.popcnt());

// TODO: tbm, abm, lzcnt
}

0 comments on commit 03e9793

Please sign in to comment.