Skip to content

Commit 5a8322c

Browse files
committed
Only coresimd depends on stdsimd-test.
1 parent 8597062 commit 5a8322c

File tree

5 files changed

+52
-62
lines changed

5 files changed

+52
-62
lines changed

Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ opt-level = 3
2929
debug = true
3030
opt-level = 3
3131

32-
[dev-dependencies]
33-
stdsimd-test = { version = "0.*", path = "stdsimd-test" }
34-
cupid = "0.5.0"
35-
3632
[features]
3733
# Internal-usage only: denies all warnings.
3834
strict = [ "coresimd/strict" ]

coresimd/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ is-it-maintained-open-issues = { repository = "BurntSushi/stdsimd" }
1919
maintenance = { status = "experimental" }
2020

2121
[dev-dependencies]
22+
cupid = "0.5.0"
2223
stdsimd-test = { version = "0.*", path = "../stdsimd-test" }
2324

2425
[features]

coresimd/src/runtime/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ mod bit;
55
#[macro_use]
66
mod macros;
77

8-
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
98
#[macro_use]
109
mod x86;
11-
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
1210
pub use self::x86::__Feature;
13-
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
1411
use self::x86::detect_features;
1512

1613
/// Performs run-time feature detection.

coresimd/src/runtime/x86.rs

+50-4
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,10 @@ pub fn detect_features() -> usize {
416416

417417
#[cfg(test)]
418418
mod tests {
419+
extern crate cupid;
420+
419421
#[test]
420-
fn runtime_detection_x86_nocapture() {
422+
fn dump() {
421423
println!("sse: {:?}", cfg_feature_enabled!("sse"));
422424
println!("sse2: {:?}", cfg_feature_enabled!("sse2"));
423425
println!("sse3: {:?}", cfg_feature_enabled!("sse3"));
@@ -433,10 +435,10 @@ mod tests {
433435
println!("avx512bw {:?}", cfg_feature_enabled!("avx512bw"));
434436
println!("avx512dq {:?}", cfg_feature_enabled!("avx512dq"));
435437
println!("avx512vl {:?}", cfg_feature_enabled!("avx512vl"));
436-
println!("avx512ifma {:?}", cfg_feature_enabled!("avx512ifma"));
437-
println!("avx512vbmi {:?}", cfg_feature_enabled!("avx512vbmi"));
438+
println!("avx512_ifma {:?}", cfg_feature_enabled!("avx512ifma"));
439+
println!("avx512_vbmi {:?}", cfg_feature_enabled!("avx512vbmi"));
438440
println!(
439-
"avx512vpopcntdq {:?}",
441+
"avx512_vpopcntdq {:?}",
440442
cfg_feature_enabled!("avx512vpopcntdq")
441443
);
442444
println!("fma: {:?}", cfg_feature_enabled!("fma"));
@@ -451,4 +453,48 @@ mod tests {
451453
println!("xsaves {:?}", cfg_feature_enabled!("xsaves"));
452454
println!("xsavec {:?}", cfg_feature_enabled!("xsavec"));
453455
}
456+
457+
#[test]
458+
fn compare_with_cupid() {
459+
let information = cupid::master().unwrap();
460+
assert_eq!(cfg_feature_enabled!("sse"), information.sse());
461+
assert_eq!(cfg_feature_enabled!("sse2"), information.sse2());
462+
assert_eq!(cfg_feature_enabled!("sse3"), information.sse3());
463+
assert_eq!(cfg_feature_enabled!("ssse3"), information.ssse3());
464+
assert_eq!(cfg_feature_enabled!("sse4.1"), information.sse4_1());
465+
assert_eq!(cfg_feature_enabled!("sse4.2"), information.sse4_2());
466+
assert_eq!(cfg_feature_enabled!("avx"), information.avx());
467+
assert_eq!(cfg_feature_enabled!("avx2"), information.avx2());
468+
assert_eq!(cfg_feature_enabled!("avx512f"), information.avx512f());
469+
assert_eq!(cfg_feature_enabled!("avx512cd"), information.avx512cd());
470+
assert_eq!(cfg_feature_enabled!("avx512er"), information.avx512er());
471+
assert_eq!(cfg_feature_enabled!("avx512pf"), information.avx512pf());
472+
assert_eq!(cfg_feature_enabled!("avx512bw"), information.avx512bw());
473+
assert_eq!(cfg_feature_enabled!("avx512dq"), information.avx512dq());
474+
assert_eq!(cfg_feature_enabled!("avx512vl"), information.avx512vl());
475+
assert_eq!(cfg_feature_enabled!("avx512ifma"), information.avx512_ifma());
476+
assert_eq!(cfg_feature_enabled!("avx512vbmi"), information.avx512_vbmi());
477+
assert_eq!(
478+
cfg_feature_enabled!("avx512vpopcntdq"),
479+
information.avx512_vpopcntdq()
480+
);
481+
assert_eq!(cfg_feature_enabled!("fma"), information.fma());
482+
assert_eq!(cfg_feature_enabled!("bmi"), information.bmi1());
483+
assert_eq!(cfg_feature_enabled!("bmi2"), information.bmi2());
484+
assert_eq!(cfg_feature_enabled!("popcnt"), information.popcnt());
485+
assert_eq!(cfg_feature_enabled!("sse4a"), information.sse4a());
486+
assert_eq!(cfg_feature_enabled!("abm"), information.lzcnt());
487+
assert_eq!(cfg_feature_enabled!("tbm"), information.tbm());
488+
assert_eq!(cfg_feature_enabled!("lzcnt"), information.lzcnt());
489+
assert_eq!(cfg_feature_enabled!("xsave"), information.xsave());
490+
assert_eq!(cfg_feature_enabled!("xsaveopt"), information.xsaveopt());
491+
assert_eq!(
492+
cfg_feature_enabled!("xsavec"),
493+
information.xsavec_and_xrstor()
494+
);
495+
assert_eq!(
496+
cfg_feature_enabled!("xsaves"),
497+
information.xsaves_xrstors_and_ia32_xss()
498+
);
499+
}
454500
}

tests/cpu-detection.rs

+1-51
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,10 @@
22
#![cfg_attr(feature = "strict", deny(warnings))]
33
#![cfg_attr(feature = "cargo-clippy", allow(option_unwrap_used))]
44

5-
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
6-
extern crate cupid;
7-
8-
#[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "arm",
9-
target_arch = "aarch64"))]
5+
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
106
#[macro_use]
117
extern crate stdsimd;
128

13-
#[test]
14-
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
15-
fn x86() {
16-
let information = cupid::master().unwrap();
17-
assert_eq!(cfg_feature_enabled!("sse"), information.sse());
18-
assert_eq!(cfg_feature_enabled!("sse2"), information.sse2());
19-
assert_eq!(cfg_feature_enabled!("sse3"), information.sse3());
20-
assert_eq!(cfg_feature_enabled!("ssse3"), information.ssse3());
21-
assert_eq!(cfg_feature_enabled!("sse4.1"), information.sse4_1());
22-
assert_eq!(cfg_feature_enabled!("sse4.2"), information.sse4_2());
23-
assert_eq!(cfg_feature_enabled!("avx"), information.avx());
24-
assert_eq!(cfg_feature_enabled!("avx2"), information.avx2());
25-
assert_eq!(cfg_feature_enabled!("avx512f"), information.avx512f());
26-
assert_eq!(cfg_feature_enabled!("avx512cd"), information.avx512cd());
27-
assert_eq!(cfg_feature_enabled!("avx512er"), information.avx512er());
28-
assert_eq!(cfg_feature_enabled!("avx512pf"), information.avx512pf());
29-
assert_eq!(cfg_feature_enabled!("avx512bw"), information.avx512bw());
30-
assert_eq!(cfg_feature_enabled!("avx512dq"), information.avx512dq());
31-
assert_eq!(cfg_feature_enabled!("avx512vl"), information.avx512vl());
32-
assert_eq!(cfg_feature_enabled!("avx512ifma"), information.avx512_ifma());
33-
assert_eq!(cfg_feature_enabled!("avx512vbmi"), information.avx512_vbmi());
34-
assert_eq!(
35-
cfg_feature_enabled!("avx512vpopcntdq"),
36-
information.avx512_vpopcntdq()
37-
);
38-
assert_eq!(cfg_feature_enabled!("fma"), information.fma());
39-
assert_eq!(cfg_feature_enabled!("bmi"), information.bmi1());
40-
assert_eq!(cfg_feature_enabled!("bmi2"), information.bmi2());
41-
assert_eq!(cfg_feature_enabled!("popcnt"), information.popcnt());
42-
assert_eq!(cfg_feature_enabled!("sse4a"), information.sse4a());
43-
assert_eq!(cfg_feature_enabled!("abm"), information.lzcnt());
44-
assert_eq!(cfg_feature_enabled!("tbm"), information.tbm());
45-
assert_eq!(cfg_feature_enabled!("lzcnt"), information.lzcnt());
46-
assert_eq!(cfg_feature_enabled!("xsave"), information.xsave());
47-
assert_eq!(cfg_feature_enabled!("xsaveopt"), information.xsaveopt());
48-
assert_eq!(
49-
cfg_feature_enabled!("xsavec"),
50-
information.xsavec_and_xrstor()
51-
);
52-
assert_eq!(
53-
cfg_feature_enabled!("xsavec"),
54-
information.xsaves_xrstors_and_ia32_xss()
55-
);
56-
}
57-
58-
#[test]
599
#[cfg(all(target_arch = "arm", target_os = "linux"))]
6010
fn arm_linux() {
6111
println!("neon: {}", cfg_feature_enabled!("neon"));

0 commit comments

Comments
 (0)