diff options
| author | gnzlbg <gonzalobg88@gmail.com> | 2019-04-23 15:51:20 +0200 |
|---|---|---|
| committer | gnzlbg <gnzlbg@users.noreply.github.com> | 2019-09-16 23:43:01 +0200 |
| commit | 1f44c1407dc6e6f91600f9303739ca8acbcc8194 (patch) | |
| tree | fb4d4c554ce3aaceccc1ce679c33fc9003a259bc /library/stdarch/crates/std_detect/tests/cpu-detection.rs | |
| parent | f3140f4b25860a1aa6257c6afc064efe177b0b67 (diff) | |
| download | rust-1f44c1407dc6e6f91600f9303739ca8acbcc8194.tar.gz rust-1f44c1407dc6e6f91600f9303739ca8acbcc8194.zip | |
Add std_detect::detect::features() -> impl Iterator<Item=(&'static str, bool)> API
Diffstat (limited to 'library/stdarch/crates/std_detect/tests/cpu-detection.rs')
| -rw-r--r-- | library/stdarch/crates/std_detect/tests/cpu-detection.rs | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/library/stdarch/crates/std_detect/tests/cpu-detection.rs b/library/stdarch/crates/std_detect/tests/cpu-detection.rs index d0c9901c4cd..d441f4e1eff 100644 --- a/library/stdarch/crates/std_detect/tests/cpu-detection.rs +++ b/library/stdarch/crates/std_detect/tests/cpu-detection.rs @@ -1,7 +1,6 @@ #![feature(stdsimd)] #![allow(clippy::option_unwrap_used, clippy::use_debug, clippy::print_stdout)] - -#[cfg(any( +#![cfg(any( target_arch = "arm", target_arch = "aarch64", target_arch = "x86", @@ -9,10 +8,18 @@ target_arch = "powerpc", target_arch = "powerpc64" ))] + #[macro_use] extern crate std_detect; #[test] +fn all() { + for (f, e) in std_detect::detect::features() { + println!("{}: {}", f, e); + } +} + +#[test] #[cfg(all(target_arch = "arm", any(target_os = "linux", target_os = "android")))] fn arm_linux() { println!("neon: {}", is_arm_feature_detected!("neon")); @@ -73,17 +80,17 @@ fn x86_all() { println!("sha: {:?}", is_x86_feature_detected!("sha")); println!("avx: {:?}", is_x86_feature_detected!("avx")); println!("avx2: {:?}", is_x86_feature_detected!("avx2")); - println!("avx512f {:?}", is_x86_feature_detected!("avx512f")); - println!("avx512cd {:?}", is_x86_feature_detected!("avx512cd")); - println!("avx512er {:?}", is_x86_feature_detected!("avx512er")); - println!("avx512pf {:?}", is_x86_feature_detected!("avx512pf")); - println!("avx512bw {:?}", is_x86_feature_detected!("avx512bw")); - println!("avx512dq {:?}", is_x86_feature_detected!("avx512dq")); - println!("avx512vl {:?}", is_x86_feature_detected!("avx512vl")); - println!("avx512_ifma {:?}", is_x86_feature_detected!("avx512ifma")); - println!("avx512_vbmi {:?}", is_x86_feature_detected!("avx512vbmi")); + println!("avx512f: {:?}", is_x86_feature_detected!("avx512f")); + println!("avx512cd: {:?}", is_x86_feature_detected!("avx512cd")); + println!("avx512er: {:?}", is_x86_feature_detected!("avx512er")); + println!("avx512pf: {:?}", is_x86_feature_detected!("avx512pf")); + println!("avx512bw: {:?}", is_x86_feature_detected!("avx512bw")); + println!("avx512dq: {:?}", is_x86_feature_detected!("avx512dq")); + println!("avx512vl: {:?}", is_x86_feature_detected!("avx512vl")); + println!("avx512ifma: {:?}", is_x86_feature_detected!("avx512ifma")); + println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi")); println!( - "avx512_vpopcntdq {:?}", + "avx512vpopcntdq: {:?}", is_x86_feature_detected!("avx512vpopcntdq") ); println!("f16c: {:?}", is_x86_feature_detected!("f16c")); |
