Skip to content

Commit 8210b84

Browse files
authored
Rollup merge of #138275 - folkertdev:expose-is-s390x-feature-detected, r=Mark-Simulacrum
expose `is_s390x_feature_detected!` from `std::arch` tracking issue: #135413 implementation: rust-lang/stdarch#1699 (more features added in rust-lang/stdarch#1720) This macro was part of the recent `stdarch` synchronization, but not yet exposed via `std::arch`. r? libs
2 parents e084680 + a312635 commit 8210b84

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

library/std/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,8 @@ pub mod arch {
666666
pub use std_detect::is_loongarch_feature_detected;
667667
#[unstable(feature = "is_riscv_feature_detected", issue = "111192")]
668668
pub use std_detect::is_riscv_feature_detected;
669+
#[unstable(feature = "stdarch_s390x_feature_detection", issue = "135413")]
670+
pub use std_detect::is_s390x_feature_detected;
669671
#[stable(feature = "simd_x86", since = "1.27.0")]
670672
pub use std_detect::is_x86_feature_detected;
671673
#[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")]

library/std/tests/run-time-detect.rs

+30
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")),
99
feature(stdarch_aarch64_feature_detection)
1010
)]
11+
#![cfg_attr(
12+
all(target_arch = "s390x", target_os = "linux"),
13+
feature(stdarch_s390x_feature_detection)
14+
)]
1115
#![cfg_attr(
1216
all(target_arch = "powerpc", target_os = "linux"),
1317
feature(stdarch_powerpc_feature_detection)
@@ -132,6 +136,32 @@ fn powerpc64_linux() {
132136
// tidy-alphabetical-end
133137
}
134138

139+
#[test]
140+
#[cfg(all(target_arch = "s390x", target_os = "linux"))]
141+
fn s390x_linux() {
142+
use std::arch::is_s390x_feature_detected;
143+
// tidy-alphabetical-start
144+
println!("deflate-conversion: {}", is_s390x_feature_detected!("deflate-conversion"));
145+
println!("enhanced-sort: {}", is_s390x_feature_detected!("enhanced-sort"));
146+
println!("guarded-storage: {}", is_s390x_feature_detected!("guarded-storage"));
147+
println!("high-word: {}", is_s390x_feature_detected!("high-word"));
148+
println!("nnp-assist: {}", is_s390x_feature_detected!("nnp-assist"));
149+
println!("transactional-execution: {}", is_s390x_feature_detected!("transactional-execution"));
150+
println!("vector-enhancements-1: {}", is_s390x_feature_detected!("vector-enhancements-1"));
151+
println!("vector-enhancements-2: {}", is_s390x_feature_detected!("vector-enhancements-2"));
152+
println!(
153+
"vector-packed-decimal-enhancement-2: {}",
154+
is_s390x_feature_detected!("vector-packed-decimal-enhancement-2")
155+
);
156+
println!(
157+
"vector-packed-decimal-enhancement: {}",
158+
is_s390x_feature_detected!("vector-packed-decimal-enhancement")
159+
);
160+
println!("vector-packed-decimal: {}", is_s390x_feature_detected!("vector-packed-decimal"));
161+
println!("vector: {}", is_s390x_feature_detected!("vector"));
162+
// tidy-alphabetical-end
163+
}
164+
135165
#[test]
136166
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
137167
fn x86_all() {

0 commit comments

Comments
 (0)