Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp @@ -486,18 +486,6 @@ } } - // FIXME: these insertions should ideally be automated using default - // extensions support from the backend target parser. - if (V8Version >= 6 || V9Version >= 1) - Features.insert(std::next(Features.begin() + ArchFeatPos), - {"+i8mm", "+bf16"}); - - // For Armv8.8-a/Armv9.3-a or later, FEAT_HBC and FEAT_MOPS are enabled by - // default. - if (V8Version >= 8 || V9Version >= 3) - Features.insert(std::next(Features.begin() + ArchFeatPos), - {"+hbc", "+mops"}); - if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access, options::OPT_munaligned_access)) { if (A->getOption().matches(options::OPT_mno_unaligned_access)) Index: clang/test/Driver/aarch64-hbc.c =================================================================== --- clang/test/Driver/aarch64-hbc.c +++ clang/test/Driver/aarch64-hbc.c @@ -1,12 +1,14 @@ // Test that target feature hbc is implemented and available correctly -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.7-a+hbc %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+hbc %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+nohbc %s 2>&1 | FileCheck %s --check-prefix=NO_HBC -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.2-a+hbc %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a+hbc %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a+nohbc %s 2>&1 | FileCheck %s --check-prefix=NO_HBC +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv8.7-a+hbc %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv8.8-a %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv8.8-a+hbc %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv8.8-a+nohbc %s 2>&1 | FileCheck %s --check-prefix=NO_HBC +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv9.2-a+hbc %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv9.3-a %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv9.3-a+hbc %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv9.3-a+nohbc %s 2>&1 | FileCheck %s --check-prefix=NO_HBC -// CHECK: "-target-feature" "+hbc" -// NO_HBC: "-target-feature" "-hbc" +// CHECK: "target-features"="{{.*}},+hbc +// NO_HBC: "target-features"="{{.*}},-hbc + +void test() {} \ No newline at end of file Index: clang/test/Driver/aarch64-i8mm.c =================================================================== --- clang/test/Driver/aarch64-i8mm.c +++ clang/test/Driver/aarch64-i8mm.c @@ -1,7 +1,11 @@ // The 8-bit integer matrix multiply extension is a mandatory component of the // Armv8.6-A extensions, but is permitted as an optional feature for any // implementation of Armv8.2-A to Armv8.5-A (inclusive) -// RUN: %clang -target aarch64 -march=armv8.5a -### -c %s 2>&1 | FileCheck -check-prefix=NO-I8MM %s -// RUN: %clang -target aarch64 -march=armv8.5a+i8mm -### -c %s 2>&1 | FileCheck -check-prefix=I8MM %s -// NO-I8MM-NOT: "-target-feature" "+i8mm" -// I8MM: "-target-feature" "+i8mm" +// RUN: %clang -target aarch64 -march=armv8.5a -S -o - -emit-llvm -c %s 2>&1 | FileCheck -check-prefix=NOI8MM %s +// RUN: %clang -target aarch64 -march=armv8.5a+i8mm -S -o - -emit-llvm -c %s 2>&1 | FileCheck -check-prefix=I8MM %s +// RUN: %clang -target aarch64 -march=armv8.6a -S -o - -emit-llvm -c %s 2>&1 | FileCheck -check-prefix=I8MM %s + +// I8MM: "target-features"="{{.*}},+i8mm +// NOI8MM-NOT: "target-features"="{{.*}},+i8mm + +void test() {} Index: clang/test/Driver/aarch64-mops.c =================================================================== --- clang/test/Driver/aarch64-mops.c +++ clang/test/Driver/aarch64-mops.c @@ -1,12 +1,14 @@ // Test that target feature mops is implemented and available correctly -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.7-a+mops %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+mops %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.8-a+nomops %s 2>&1 | FileCheck %s --check-prefix=NO_MOPS -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.2-a+mops %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a+mops %s 2>&1 | FileCheck %s -// RUN: %clang -### -target aarch64-none-none-eabi -march=armv9.3-a+nomops %s 2>&1 | FileCheck %s --check-prefix=NO_MOPS +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv8.7-a+mops %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv8.8-a %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv8.8-a+mops %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv8.8-a+nomops %s 2>&1 | FileCheck %s --check-prefix=NO_MOPS +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv9.2-a+mops %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv9.3-a %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv9.3-a+mops %s 2>&1 | FileCheck %s +// RUN: %clang -S -o - -emit-llvm -target aarch64-none-none-eabi -march=armv9.3-a+nomops %s 2>&1 | FileCheck %s --check-prefix=NO_MOPS -// CHECK: "-target-feature" "+mops" -// NO_MOPS: "-target-feature" "-mops" +// CHECK: "target-features"="{{.*}},+mops +// NO_MOPS: "target-features"="{{.*}},-mops + +void test() {} \ No newline at end of file Index: clang/test/Driver/aarch64-v91a.c =================================================================== --- clang/test/Driver/aarch64-v91a.c +++ clang/test/Driver/aarch64-v91a.c @@ -4,7 +4,7 @@ // RUN: %clang -target aarch64 -mlittle-endian -march=armv9.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV91A %s // RUN: %clang -target aarch64_be -mlittle-endian -march=armv9.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV91A %s // RUN: %clang -target aarch64_be -mlittle-endian -march=armv9.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV91A %s -// GENERICV91A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.1a" "-target-feature" "+i8mm" "-target-feature" "+bf16" "-target-feature" "+sve" "-target-feature" "+sve2" +// GENERICV91A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.1a" "-target-feature" "+sve" "-target-feature" "+sve2" // RUN: %clang -target aarch64_be -march=armv9.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV91A-BE %s // RUN: %clang -target aarch64_be -march=armv9.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV91A-BE %s @@ -12,4 +12,4 @@ // RUN: %clang -target aarch64 -mbig-endian -march=armv9.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV91A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv9.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV91A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv9.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV91A-BE %s -// GENERICV91A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.1a" "-target-feature" "+i8mm" "-target-feature" "+bf16" "-target-feature" "+sve" "-target-feature" "+sve2" +// GENERICV91A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.1a" "-target-feature" "+sve" "-target-feature" "+sve2" Index: clang/test/Driver/aarch64-v92a.c =================================================================== --- clang/test/Driver/aarch64-v92a.c +++ clang/test/Driver/aarch64-v92a.c @@ -4,7 +4,7 @@ // RUN: %clang -target aarch64 -mlittle-endian -march=armv9.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV92A %s // RUN: %clang -target aarch64_be -mlittle-endian -march=armv9.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV92A %s // RUN: %clang -target aarch64_be -mlittle-endian -march=armv9.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV92A %s -// GENERICV92A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.2a" "-target-feature" "+i8mm" "-target-feature" "+bf16" "-target-feature" "+sve" "-target-feature" "+sve2" +// GENERICV92A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.2a" "-target-feature" "+sve" "-target-feature" "+sve2" // RUN: %clang -target aarch64_be -march=armv9.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV92A-BE %s // RUN: %clang -target aarch64_be -march=armv9.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV92A-BE %s @@ -12,4 +12,4 @@ // RUN: %clang -target aarch64 -mbig-endian -march=armv9.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV92A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv9.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV92A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv9.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV92A-BE %s -// GENERICV92A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.2a" "-target-feature" "+i8mm" "-target-feature" "+bf16" "-target-feature" "+sve" "-target-feature" "+sve2" +// GENERICV92A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9.2a" "-target-feature" "+sve" "-target-feature" "+sve2" Index: llvm/include/llvm/TargetParser/AArch64TargetParser.def =================================================================== --- llvm/include/llvm/TargetParser/AArch64TargetParser.def +++ llvm/include/llvm/TargetParser/AArch64TargetParser.def @@ -57,14 +57,15 @@ AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE | AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD | AArch64::AEK_SM4 | AArch64::AEK_SHA3 | AArch64::AEK_BF16 | - AArch64::AEK_SHA2 | AArch64::AEK_AES | AArch64::AEK_I8MM)) + AArch64::AEK_SHA2 | AArch64::AEK_AES | AArch64::AEK_I8MM | + AArch64::AEK_MOPS | AArch64::AEK_HBC)) AARCH64_ARCH("armv8.9-a", ARMV8_9A, "+v8.9a", (AArch64::AEK_CRC | AArch64::AEK_FP | AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE | AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD | AArch64::AEK_SM4 | AArch64::AEK_SHA3 | AArch64::AEK_BF16 | AArch64::AEK_SHA2 | AArch64::AEK_AES | AArch64::AEK_I8MM | - AArch64::AEK_RASv2)) + AArch64::AEK_MOPS | AArch64::AEK_HBC | AArch64::AEK_RASv2)) AARCH64_ARCH("armv9-a", ARMV9A, "+v9a", (AArch64::AEK_CRC | AArch64::AEK_FP | AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE | @@ -87,13 +88,14 @@ AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE | AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD | AArch64::AEK_BF16 | AArch64::AEK_I8MM | AArch64::AEK_SVE | - AArch64::AEK_SVE2)) + AArch64::AEK_SVE2 | AArch64::AEK_MOPS | AArch64::AEK_HBC)) AARCH64_ARCH("armv9.4-a", ARMV9_4A, "+v9.4a", (AArch64::AEK_CRC | AArch64::AEK_FP | AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE | AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD | AArch64::AEK_BF16 | AArch64::AEK_I8MM | AArch64::AEK_SVE | - AArch64::AEK_SVE2 | AArch64::AEK_RASv2)) + AArch64::AEK_SVE2 | AArch64::AEK_MOPS | AArch64::AEK_HBC | + AArch64::AEK_RASv2)) // For v8-R, we do not enable crypto and align with GCC that enables a more // minimal set of optional architecture extensions. AARCH64_ARCH("armv8-r", ARMV8R, "+v8r",