about summary refs log tree commit diff
path: root/library/std/tests
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-16 09:40:05 +0800
committerGitHub <noreply@github.com>2025-03-16 09:40:05 +0800
commit8210b84aaf77a9de1e8fd00f404068c487d07531 (patch)
tree11427246fa2dbf2d10eac5ac9189f9ac045a1b5c /library/std/tests
parente0846806dbfaa8d838832f48771a8a709f35ee0a (diff)
parenta312635821c84611be8e6ab84c1ef4815ba7d99e (diff)
Rollup merge of #138275 - folkertdev:expose-is-s390x-feature-detected, r=Mark-Simulacrum
expose `is_s390x_feature_detected!` from `std::arch`

tracking issue: https://github.com/rust-lang/rust/issues/135413
implementation: https://github.com/rust-lang/stdarch/pull/1699 (more features added in https://github.com/rust-lang/stdarch/pull/1720)

This macro was part of the recent `stdarch` synchronization, but not yet exposed via `std::arch`.

r? libs
Diffstat (limited to 'library/std/tests')
-rw-r--r--library/std/tests/run-time-detect.rs30
1 files changed, 30 insertions, 0 deletions
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;