Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ pub mod arch {
pub use std_detect::is_loongarch_feature_detected;
#[unstable(feature = "is_riscv_feature_detected", issue = "111192")]
pub use std_detect::is_riscv_feature_detected;
#[unstable(feature = "stdarch_s390x_feature_detection", issue = "135413")]
pub use std_detect::is_s390x_feature_detected;
#[stable(feature = "simd_x86", since = "1.27.0")]
pub use std_detect::is_x86_feature_detected;
#[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")]
Expand Down
30 changes: 30 additions & 0 deletions library/std/tests/run-time-detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")),
feature(stdarch_aarch64_feature_detection)
)]
#![cfg_attr(
all(target_arch = "s390x", target_os = "linux"),
feature(stdarch_s390x_feature_detection)
)]
#![cfg_attr(
all(target_arch = "powerpc", target_os = "linux"),
feature(stdarch_powerpc_feature_detection)
Expand Down Expand Up @@ -132,6 +136,32 @@ fn powerpc64_linux() {
// tidy-alphabetical-end
}

#[test]
#[cfg(all(target_arch = "s390x", target_os = "linux"))]
fn s390x_linux() {
use std::arch::is_s390x_feature_detected;
// tidy-alphabetical-start
println!("deflate-conversion: {}", is_s390x_feature_detected!("deflate-conversion"));
println!("enhanced-sort: {}", is_s390x_feature_detected!("enhanced-sort"));
println!("guarded-storage: {}", is_s390x_feature_detected!("guarded-storage"));
println!("high-word: {}", is_s390x_feature_detected!("high-word"));
println!("nnp-assist: {}", is_s390x_feature_detected!("nnp-assist"));
println!("transactional-execution: {}", is_s390x_feature_detected!("transactional-execution"));
println!("vector-enhancements-1: {}", is_s390x_feature_detected!("vector-enhancements-1"));
println!("vector-enhancements-2: {}", is_s390x_feature_detected!("vector-enhancements-2"));
println!(
"vector-packed-decimal-enhancement-2: {}",
is_s390x_feature_detected!("vector-packed-decimal-enhancement-2")
);
println!(
"vector-packed-decimal-enhancement: {}",
is_s390x_feature_detected!("vector-packed-decimal-enhancement")
);
println!("vector-packed-decimal: {}", is_s390x_feature_detected!("vector-packed-decimal"));
println!("vector: {}", is_s390x_feature_detected!("vector"));
// tidy-alphabetical-end
}

#[test]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
fn x86_all() {
Expand Down
Loading