Skip to content

Commit b3209de

Browse files
committed
Only coresimd depends on stdsimd-test.
1 parent 9c35ec8 commit b3209de

File tree

5 files changed

+59
-61
lines changed

5 files changed

+59
-61
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.4.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.4.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

+57-4
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,10 @@ pub fn detect_features() -> usize {
423423

424424
#[cfg(test)]
425425
mod tests {
426+
extern crate cupid;
427+
426428
#[test]
427-
fn runtime_detection_x86_nocapture() {
429+
fn dump() {
428430
println!("sse: {:?}", cfg_feature_enabled!("sse"));
429431
println!("sse2: {:?}", cfg_feature_enabled!("sse2"));
430432
println!("sse3: {:?}", cfg_feature_enabled!("sse3"));
@@ -440,10 +442,10 @@ mod tests {
440442
println!("avx512bw {:?}", cfg_feature_enabled!("avx512bw"));
441443
println!("avx512dq {:?}", cfg_feature_enabled!("avx512dq"));
442444
println!("avx512vl {:?}", cfg_feature_enabled!("avx512vl"));
443-
println!("avx512ifma {:?}", cfg_feature_enabled!("avx512ifma"));
444-
println!("avx512vbmi {:?}", cfg_feature_enabled!("avx512vbmi"));
445+
println!("avx512_ifma {:?}", cfg_feature_enabled!("avx512ifma"));
446+
println!("avx512_vbmi {:?}", cfg_feature_enabled!("avx512vbmi"));
445447
println!(
446-
"avx512vpopcntdq {:?}",
448+
"avx512_vpopcntdq {:?}",
447449
cfg_feature_enabled!("avx512vpopcntdq")
448450
);
449451
println!("fma: {:?}", cfg_feature_enabled!("fma"));
@@ -458,4 +460,55 @@ mod tests {
458460
println!("xsaves {:?}", cfg_feature_enabled!("xsaves"));
459461
println!("xsavec {:?}", cfg_feature_enabled!("xsavec"));
460462
}
463+
464+
#[test]
465+
fn compare_with_cupid() {
466+
let information = cupid::master().unwrap();
467+
assert_eq!(cfg_feature_enabled!("sse"), information.sse());
468+
assert_eq!(cfg_feature_enabled!("sse2"), information.sse2());
469+
assert_eq!(cfg_feature_enabled!("sse3"), information.sse3());
470+
assert_eq!(cfg_feature_enabled!("ssse3"), information.ssse3());
471+
assert_eq!(cfg_feature_enabled!("sse4.1"), information.sse4_1());
472+
assert_eq!(cfg_feature_enabled!("sse4.2"), information.sse4_2());
473+
assert_eq!(cfg_feature_enabled!("avx"), information.avx());
474+
assert_eq!(cfg_feature_enabled!("avx2"), information.avx2());
475+
// assert_eq!(cfg_feature_enabled!("avx512f"), information.avx512f());
476+
// assert_eq!(cfg_feature_enabled!("avx512cd"),
477+
// information.avx512cd());
478+
// assert_eq!(cfg_feature_enabled!("avx512er"),
479+
// information.avx512er());
480+
// assert_eq!(cfg_feature_enabled!("avx512pf"),
481+
// information.avx512pf());
482+
// assert_eq!(cfg_feature_enabled!("avx512bw"),
483+
// information.avx512bw());
484+
// assert_eq!(cfg_feature_enabled!("avx512dq"),
485+
// information.avx512dq());
486+
// assert_eq!(cfg_feature_enabled!("avx512vl"),
487+
// information.avx512vl());
488+
// assert_eq!(cfg_feature_enabled!("avx512ifma"),
489+
// information.avx512_ifma());
490+
// assert_eq!(cfg_feature_enabled!("avx512vbmi"),
491+
// information.avx512_vbmi());
492+
// assert_eq!(cfg_feature_enabled!("avx512vpopcntdq"),
493+
// information.avx512_vpopcntdq());
494+
assert_eq!(cfg_feature_enabled!("fma"), information.fma());
495+
assert_eq!(cfg_feature_enabled!("bmi"), information.bmi1());
496+
assert_eq!(cfg_feature_enabled!("bmi2"), information.bmi2());
497+
assert_eq!(cfg_feature_enabled!("popcnt"), information.popcnt());
498+
// assert_eq!(cfg_feature_enabled!("sse4a"), information.sse4a());
499+
assert_eq!(cfg_feature_enabled!("abm"), information.lzcnt());
500+
assert_eq!(cfg_feature_enabled!("tbm"), information.tbm());
501+
assert_eq!(cfg_feature_enabled!("lzcnt"), information.lzcnt());
502+
assert_eq!(cfg_feature_enabled!("xsave"), information.xsave());
503+
assert_eq!(cfg_feature_enabled!("xsaveopt"), information.xsaveopt());
504+
assert_eq!(
505+
cfg_feature_enabled!("xsavec"),
506+
information.xsavec_and_xrstor()
507+
);
508+
assert_eq!(
509+
cfg_feature_enabled!("xsavec"),
510+
information.xsaves_xrstors_and_ia32_xss()
511+
);
512+
}
513+
461514
}

tests/cpu-detection.rs

+1-50
Original file line numberDiff line numberDiff line change
@@ -2,59 +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"),
33-
// information.avx512_ifma());
34-
// assert_eq!(cfg_feature_enabled!("avx512vbmi"),
35-
// information.avx512_vbmi());
36-
// assert_eq!(cfg_feature_enabled!("avx512vpopcntdq"),
37-
// information.avx512_vpopcntdq());
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-
589
#[test]
5910
#[cfg(all(target_arch = "arm", target_os = "linux"))]
6011
fn arm_linux() {

0 commit comments

Comments
 (0)