about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-03-09 14:01:01 +0100
committerFolkert de Vries <folkert@folkertdev.nl>2025-03-09 14:04:39 +0100
commita312635821c84611be8e6ab84c1ef4815ba7d99e (patch)
treebeac1d9e2da3412e62c333373955e15920a04215 /library/std
parent4f521991945886709a875ba2aeaa859574126c0e (diff)
downloadrust-a312635821c84611be8e6ab84c1ef4815ba7d99e.tar.gz
rust-a312635821c84611be8e6ab84c1ef4815ba7d99e.zip
expose `is_s390x_feature_detected` from `std::arch`
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/lib.rs2
-rw-r--r--library/std/tests/run-time-detect.rs30
2 files changed, 32 insertions, 0 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 938b8c6e4f4..35ada678740 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -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")]
diff --git a/library/std/tests/run-time-detect.rs b/library/std/tests/run-time-detect.rs
index dd14c0266aa..e59ae2f3d7f 100644
--- a/library/std/tests/run-time-detect.rs
+++ b/library/std/tests/run-time-detect.rs
@@ -9,6 +9,10 @@
     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)
 )]
@@ -133,6 +137,32 @@ fn powerpc64_linux() {
 }
 
 #[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() {
     use std::arch::is_x86_feature_detected;