diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp --- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp @@ -114,10 +114,16 @@ std::pair Split = StringRef(MarchLowerCase).split("+"); llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseArch(Split.first); - if (ArchKind == llvm::AArch64::ArchKind::INVALID || - !llvm::AArch64::getArchFeatures(ArchKind, Features) || - (Split.second.size() && - !DecodeAArch64Features(D, Split.second, Features, ArchKind))) + + if (!llvm::AArch64::getArchFeatures(ArchKind, Features)) + return false; + + if (ArchKind == llvm::AArch64::ArchKind::ARMV8_6A) { + Features.push_back("+i8mm"); + Features.push_back("+bf16"); + } + + if (!DecodeAArch64Features(D, Split.second, Features, ArchKind)) return false; return true; diff --git a/clang/test/Preprocessor/aarch64-target-features.c b/clang/test/Preprocessor/aarch64-target-features.c --- a/clang/test/Preprocessor/aarch64-target-features.c +++ b/clang/test/Preprocessor/aarch64-target-features.c @@ -112,6 +112,12 @@ // CHECK-SVE-F64MM: __ARM_FEATURE_SVE 1 // CHECK-SVE-F64MM: __ARM_FEATURE_SVE_MATMUL_FP64 1 +// RUN: %clang -target aarch64-none-linux-gnu -march=armv8.6-a+sve -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE-8_6 %s +// CHECK-SVE-8_6: __ARM_FEATURE_SVE 1 +// CHECK-SVE-8_6: __ARM_FEATURE_SVE_BF16 1 +// CHECK-SVE-8_6: __ARM_FEATURE_SVE_MATMUL_FP32 1 +// CHECK-SVE-8_6: __ARM_FEATURE_SVE_MATMUL_INT8 1 + // The following tests may need to be revised in the future since // SVE2 is currently still part of Future Architecture Technologies // (https://developer.arm.com/docs/ddi0602/latest) @@ -412,4 +418,3 @@ // CHECK-BFLOAT: __ARM_BF16_FORMAT_ALTERNATIVE 1 // CHECK-BFLOAT: __ARM_FEATURE_BF16 1 // CHECK-BFLOAT: __ARM_FEATURE_BF16_VECTOR_ARITHMETIC 1 -