Skip to content

Commit c881fe3

Browse files
mrkajetanpAmanieu
authored andcommitted
std_detect: Add sme-b16b16 as an explicit aarch64 target feature
LLVM 20 split out what used to be called b16b16 and correspond to aarch64 FEAT_SVE_B16B16 into sve-b16b16 and sme-b16b16. Add sme-b16b16 as an explicit feature and update the detection accordingly.
1 parent f827440 commit c881fe3

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ features! {
6262
/// * `"sha3"` - FEAT_SHA512 & FEAT_SHA3
6363
/// * `"sm4"` - FEAT_SM3 & FEAT_SM4
6464
/// * `"sme"` - FEAT_SME
65+
/// * `"sme-b16b16"` - FEAT_SME_B16B16
6566
/// * `"sme-f16f16"` - FEAT_SME_F16F16
6667
/// * `"sme-f64f64"` - FEAT_SME_F64F64
6768
/// * `"sme-f8f16"` - FEAT_SME_F8F16
@@ -76,7 +77,7 @@ features! {
7677
/// * `"ssve-fp8dot4"` - FEAT_SSVE_FP8DOT4
7778
/// * `"ssve-fp8fma"` - FEAT_SSVE_FP8FMA
7879
/// * `"sve"` - FEAT_SVE
79-
/// * `"sve-b16b16"` - FEAT_SVE_B16B16
80+
/// * `"sve-b16b16"` - FEAT_SVE_B16B16 (SVE or SME Z-targeting instructions)
8081
/// * `"sve2"` - FEAT_SVE2
8182
/// * `"sve2-aes"` - FEAT_SVE_AES & FEAT_SVE_PMULL128 (SVE2 AES crypto)
8283
/// * `"sve2-bitperm"` - FEAT_SVE2_BitPerm
@@ -207,6 +208,8 @@ features! {
207208
/// FEAT_SME2 (SME Version 2)
208209
@FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme2p1: "sme2p1";
209210
/// FEAT_SME2p1 (SME Version 2.1)
211+
@FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_b16b16: "sme-b16b16";
212+
/// FEAT_SME_B16B16
210213
@FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_f16f16: "sme-f16f16";
211214
/// FEAT_SME_F16F16 (Non-widening half-precision FP16 to FP16 arithmetic for SME2)
212215
@FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_f64f64: "sme-f64f64";
@@ -238,7 +241,7 @@ features! {
238241
@FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_aes: "sve2-aes";
239242
/// FEAT_SVE_AES & FEAT_SVE_PMULL128 (SVE2 AES crypto)
240243
@FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sve_b16b16: "sve-b16b16";
241-
/// FEAT_SVE_B16B16 (SVE or SME Instructions)
244+
/// FEAT_SVE_B16B16 (SVE or SME Z-targeting instructions)
242245
@FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_bitperm: "sve2-bitperm";
243246
/// FEAT_SVE_BitPerm (SVE2 bit permutation instructions)
244247
@FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_sha3: "sve2-sha3";

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,7 @@ impl AtHwcap {
469469
self.svesha3 && sve2 && self.sha512 && self.sha3 && self.sha1 && self.sha2,
470470
);
471471
enable_feature(Feature::sve2_bitperm, self.svebitperm && self.sve2);
472-
// SVE_B16B16 can be implemented either for SVE or SME
473-
enable_feature(
474-
Feature::sve_b16b16,
475-
self.bf16 && (self.sveb16b16 || self.smeb16b16),
476-
);
472+
enable_feature(Feature::sve_b16b16, self.bf16 && self.sveb16b16);
477473
enable_feature(Feature::hbc, self.hbc);
478474
enable_feature(Feature::mops, self.mops);
479475
enable_feature(Feature::ecv, self.ecv);
@@ -497,6 +493,10 @@ impl AtHwcap {
497493
let sme2 = self.sme2 && sme;
498494
enable_feature(Feature::sme2, sme2);
499495
enable_feature(Feature::sme2p1, self.sme2p1 && sme2);
496+
enable_feature(
497+
Feature::sme_b16b16,
498+
sme2 && self.bf16 && self.sveb16b16 && self.smeb16b16,
499+
);
500500
enable_feature(Feature::sme_f16f16, self.smef16f16 && sme2);
501501
enable_feature(Feature::sme_lutv2, self.smelutv2);
502502
let sme_f8f32 = self.smef8f32 && sme2 && fp8;

crates/std_detect/tests/cpu-detection.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ fn aarch64_linux() {
122122
println!("fp8dot2: {}", is_aarch64_feature_detected!("fp8dot2"));
123123
println!("wfxt: {}", is_aarch64_feature_detected!("wfxt"));
124124
println!("sme: {}", is_aarch64_feature_detected!("sme"));
125+
println!("sme-b16b16: {}", is_aarch64_feature_detected!("sme-b16b16"));
125126
println!("sme-i16i64: {}", is_aarch64_feature_detected!("sme-i16i64"));
126127
println!("sme-f64f64: {}", is_aarch64_feature_detected!("sme-f64f64"));
127128
println!("sme-fa64: {}", is_aarch64_feature_detected!("sme-fa64"));

0 commit comments

Comments
 (0)