Only coresimd depends on stdsimd-test.
This commit is contained in:
parent
cb9888f802
commit
86fa377cea
5 changed files with 52 additions and 62 deletions
|
|
@ -29,10 +29,6 @@ opt-level = 3
|
|||
debug = true
|
||||
opt-level = 3
|
||||
|
||||
[dev-dependencies]
|
||||
stdsimd-test = { version = "0.*", path = "stdsimd-test" }
|
||||
cupid = "0.5.0"
|
||||
|
||||
[features]
|
||||
# Internal-usage only: denies all warnings.
|
||||
strict = [ "coresimd/strict" ]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ is-it-maintained-open-issues = { repository = "BurntSushi/stdsimd" }
|
|||
maintenance = { status = "experimental" }
|
||||
|
||||
[dev-dependencies]
|
||||
cupid = "0.5.0"
|
||||
stdsimd-test = { version = "0.*", path = "../stdsimd-test" }
|
||||
|
||||
[features]
|
||||
|
|
|
|||
|
|
@ -5,12 +5,9 @@ mod bit;
|
|||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
#[macro_use]
|
||||
mod x86;
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
pub use self::x86::__Feature;
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
use self::x86::detect_features;
|
||||
|
||||
/// Performs run-time feature detection.
|
||||
|
|
|
|||
|
|
@ -416,8 +416,10 @@ pub fn detect_features() -> usize {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
extern crate cupid;
|
||||
|
||||
#[test]
|
||||
fn runtime_detection_x86_nocapture() {
|
||||
fn dump() {
|
||||
println!("sse: {:?}", cfg_feature_enabled!("sse"));
|
||||
println!("sse2: {:?}", cfg_feature_enabled!("sse2"));
|
||||
println!("sse3: {:?}", cfg_feature_enabled!("sse3"));
|
||||
|
|
@ -433,10 +435,10 @@ mod tests {
|
|||
println!("avx512bw {:?}", cfg_feature_enabled!("avx512bw"));
|
||||
println!("avx512dq {:?}", cfg_feature_enabled!("avx512dq"));
|
||||
println!("avx512vl {:?}", cfg_feature_enabled!("avx512vl"));
|
||||
println!("avx512ifma {:?}", cfg_feature_enabled!("avx512ifma"));
|
||||
println!("avx512vbmi {:?}", cfg_feature_enabled!("avx512vbmi"));
|
||||
println!("avx512_ifma {:?}", cfg_feature_enabled!("avx512ifma"));
|
||||
println!("avx512_vbmi {:?}", cfg_feature_enabled!("avx512vbmi"));
|
||||
println!(
|
||||
"avx512vpopcntdq {:?}",
|
||||
"avx512_vpopcntdq {:?}",
|
||||
cfg_feature_enabled!("avx512vpopcntdq")
|
||||
);
|
||||
println!("fma: {:?}", cfg_feature_enabled!("fma"));
|
||||
|
|
@ -451,4 +453,48 @@ mod tests {
|
|||
println!("xsaves {:?}", cfg_feature_enabled!("xsaves"));
|
||||
println!("xsavec {:?}", cfg_feature_enabled!("xsavec"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compare_with_cupid() {
|
||||
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!("avx512f"), information.avx512f());
|
||||
assert_eq!(cfg_feature_enabled!("avx512cd"), information.avx512cd());
|
||||
assert_eq!(cfg_feature_enabled!("avx512er"), information.avx512er());
|
||||
assert_eq!(cfg_feature_enabled!("avx512pf"), information.avx512pf());
|
||||
assert_eq!(cfg_feature_enabled!("avx512bw"), information.avx512bw());
|
||||
assert_eq!(cfg_feature_enabled!("avx512dq"), information.avx512dq());
|
||||
assert_eq!(cfg_feature_enabled!("avx512vl"), information.avx512vl());
|
||||
assert_eq!(cfg_feature_enabled!("avx512ifma"), information.avx512_ifma());
|
||||
assert_eq!(cfg_feature_enabled!("avx512vbmi"), information.avx512_vbmi());
|
||||
assert_eq!(
|
||||
cfg_feature_enabled!("avx512vpopcntdq"),
|
||||
information.avx512_vpopcntdq()
|
||||
);
|
||||
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());
|
||||
assert_eq!(cfg_feature_enabled!("sse4a"), information.sse4a());
|
||||
assert_eq!(cfg_feature_enabled!("abm"), information.lzcnt());
|
||||
assert_eq!(cfg_feature_enabled!("tbm"), information.tbm());
|
||||
assert_eq!(cfg_feature_enabled!("lzcnt"), information.lzcnt());
|
||||
assert_eq!(cfg_feature_enabled!("xsave"), information.xsave());
|
||||
assert_eq!(cfg_feature_enabled!("xsaveopt"), information.xsaveopt());
|
||||
assert_eq!(
|
||||
cfg_feature_enabled!("xsavec"),
|
||||
information.xsavec_and_xrstor()
|
||||
);
|
||||
assert_eq!(
|
||||
cfg_feature_enabled!("xsaves"),
|
||||
information.xsaves_xrstors_and_ia32_xss()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,60 +2,10 @@
|
|||
#![cfg_attr(feature = "strict", deny(warnings))]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(option_unwrap_used))]
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
extern crate cupid;
|
||||
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "arm",
|
||||
target_arch = "aarch64"))]
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
#[macro_use]
|
||||
extern crate stdsimd;
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
fn x86() {
|
||||
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!("avx512f"), information.avx512f());
|
||||
assert_eq!(cfg_feature_enabled!("avx512cd"), information.avx512cd());
|
||||
assert_eq!(cfg_feature_enabled!("avx512er"), information.avx512er());
|
||||
assert_eq!(cfg_feature_enabled!("avx512pf"), information.avx512pf());
|
||||
assert_eq!(cfg_feature_enabled!("avx512bw"), information.avx512bw());
|
||||
assert_eq!(cfg_feature_enabled!("avx512dq"), information.avx512dq());
|
||||
assert_eq!(cfg_feature_enabled!("avx512vl"), information.avx512vl());
|
||||
assert_eq!(cfg_feature_enabled!("avx512ifma"), information.avx512_ifma());
|
||||
assert_eq!(cfg_feature_enabled!("avx512vbmi"), information.avx512_vbmi());
|
||||
assert_eq!(
|
||||
cfg_feature_enabled!("avx512vpopcntdq"),
|
||||
information.avx512_vpopcntdq()
|
||||
);
|
||||
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());
|
||||
assert_eq!(cfg_feature_enabled!("sse4a"), information.sse4a());
|
||||
assert_eq!(cfg_feature_enabled!("abm"), information.lzcnt());
|
||||
assert_eq!(cfg_feature_enabled!("tbm"), information.tbm());
|
||||
assert_eq!(cfg_feature_enabled!("lzcnt"), information.lzcnt());
|
||||
assert_eq!(cfg_feature_enabled!("xsave"), information.xsave());
|
||||
assert_eq!(cfg_feature_enabled!("xsaveopt"), information.xsaveopt());
|
||||
assert_eq!(
|
||||
cfg_feature_enabled!("xsavec"),
|
||||
information.xsavec_and_xrstor()
|
||||
);
|
||||
assert_eq!(
|
||||
cfg_feature_enabled!("xsavec"),
|
||||
information.xsaves_xrstors_and_ia32_xss()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(all(target_arch = "arm", target_os = "linux"))]
|
||||
fn arm_linux() {
|
||||
println!("neon: {}", cfg_feature_enabled!("neon"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue