Skip to content

Commit 6b5206b

Browse files
lu-zeroAmanieu
authored andcommitted
Add power9 and power8 target-features
1 parent c27bb21 commit 6b5206b

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

crates/std_detect/src/detect/arch/powerpc.rs

+13
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,17 @@ features! {
1414
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power8: "power8";
1515
without cfg check: true;
1616
/// Power8
17+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power8_altivec: "power8-altivec";
18+
/// Power8 altivec
19+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power8_vector: "power8-vector";
20+
/// Power8 vector
21+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power8_crypto: "power8-crypto";
22+
/// Power8 crypto
23+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power9: "power9";
24+
without cfg check: true;
25+
/// Power9
26+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power9_altivec: "power9-altivec";
27+
/// Power9 altivec
28+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power9_vector: "power9-vector";
29+
/// Power9 vector
1730
}

crates/std_detect/src/detect/arch/powerpc64.rs

+13
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,17 @@ features! {
1414
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power8: "power8";
1515
without cfg check: true;
1616
/// Power8
17+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power8_altivec: "power8-altivec";
18+
/// Power8 altivec
19+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power8_vector: "power8-vector";
20+
/// Power8 vector
21+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power8_crypto: "power8-crypto";
22+
/// Power8 crypto
23+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power9: "power9";
24+
without cfg check: true;
25+
/// Power9
26+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power9_altivec: "power9-altivec";
27+
/// Power9 altivec
28+
@FEATURE: #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")] power9_vector: "power9-vector";
29+
/// Power9 vector
1730
}

crates/std_detect/src/detect/os/linux/powerpc.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ pub(crate) fn detect_features() -> cache::Initializer {
2020
// index of the bit to test like in ARM and Aarch64)
2121
enable_feature(&mut value, Feature::altivec, auxv.hwcap & 0x10000000 != 0);
2222
enable_feature(&mut value, Feature::vsx, auxv.hwcap & 0x00000080 != 0);
23-
enable_feature(&mut value, Feature::power8, auxv.hwcap2 & 0x80000000 != 0);
23+
let power8_features = auxv.hwcap2 & 0x80000000 != 0;
24+
enable_feature(&mut value, Feature::power8, power8_features);
25+
enable_feature(&mut value, Feature::power8_altivec, power8_features);
26+
enable_feature(&mut value, Feature::power8_crypto, power8_features);
27+
enable_feature(&mut value, Feature::power8_vector, power8_features);
28+
let power9_features = auxv.hwcap2 & 0x00800000 != 0;
29+
enable_feature(&mut value, Feature::power9, power9_features);
30+
enable_feature(&mut value, Feature::power9_altivec, power9_features);
31+
enable_feature(&mut value, Feature::power9_vector, power9_features);
2432
return value;
2533
}
2634
value

crates/std_detect/tests/cpu-detection.rs

+1
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ fn powerpc64_linux_or_freebsd() {
340340
println!("altivec: {}", is_powerpc64_feature_detected!("altivec"));
341341
println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
342342
println!("power8: {}", is_powerpc64_feature_detected!("power8"));
343+
println!("power9: {}", is_powerpc64_feature_detected!("power9"));
343344
}
344345

345346
#[test]

0 commit comments

Comments
 (0)