Author: David Green Date: 2023-01-16T16:58:18Z New Revision: 0f422215ac63da4cb610a21998a2d24c11703fbf
URL: https://github.com/llvm/llvm-project/commit/0f422215ac63da4cb610a21998a2d24c11703fbf DIFF: https://github.com/llvm/llvm-project/commit/0f422215ac63da4cb610a21998a2d24c11703fbf.diff LOG: [AArch64] Move default extensions from clang Driver to TargetParser The default extensions would be better added in the TargetParser, not by the driver. This removes the addition of +i8mm and +bf16 features in the driver as they are already added in 8.6/9.1 architectures. AEK_MOPS and AEK_HBC have been added to 8.8/9.3 architectures to replace the need for +hbc and +mops features. Differential Revision: https://reviews.llvm.org/D141518 Added: Modified: clang/lib/Driver/ToolChains/Arch/AArch64.cpp clang/test/Driver/aarch64-hbc.c clang/test/Driver/aarch64-i8mm.c clang/test/Driver/aarch64-mops.c clang/test/Driver/aarch64-v91a.c clang/test/Driver/aarch64-v92a.c llvm/include/llvm/TargetParser/AArch64TargetParser.h Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp index fcbf2e08d12df..2c559cc8b3b90 100644 --- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp @@ -485,18 +485,6 @@ void aarch64::getAArch64TargetFeatures(const Driver &D, } } - // 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)) diff --git a/clang/test/Driver/aarch64-hbc.c b/clang/test/Driver/aarch64-hbc.c index b25e7c3f52809..90b11b1fd8078 100644 --- a/clang/test/Driver/aarch64-hbc.c +++ b/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 diff --git a/clang/test/Driver/aarch64-i8mm.c b/clang/test/Driver/aarch64-i8mm.c index 4036996e5a3fc..a5e1c4863a273 100644 --- a/clang/test/Driver/aarch64-i8mm.c +++ b/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() {} diff --git a/clang/test/Driver/aarch64-mops.c b/clang/test/Driver/aarch64-mops.c index 8ce3c21d9ddb3..54dc9993ddebb 100644 --- a/clang/test/Driver/aarch64-mops.c +++ b/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 diff --git a/clang/test/Driver/aarch64-v91a.c b/clang/test/Driver/aarch64-v91a.c index 7929f717a3e0c..0feaf32958b32 100644 --- a/clang/test/Driver/aarch64-v91a.c +++ b/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" diff --git a/clang/test/Driver/aarch64-v92a.c b/clang/test/Driver/aarch64-v92a.c index 889e749b27c17..6029c22ba7ef0 100644 --- a/clang/test/Driver/aarch64-v92a.c +++ b/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" diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h index 0ffec6bb9bf48..3c416e4576e56 100644 --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -312,12 +312,12 @@ inline constexpr ArchInfo ARMV8_5A = { VersionTuple{8, 5}, AProfile, "armv8.5-a constexpr unsigned BaseNoCrypto = ARMV8_5A.DefaultExts ^ AArch64::AEK_CRYPTO; // 8.6 onwards has no AEK_CRYPTO inline constexpr ArchInfo ARMV8_6A = { VersionTuple{8, 6}, AProfile, "armv8.6-a", "+v8.6a", (BaseNoCrypto | AArch64::AEK_SM4 | AArch64::AEK_SHA3 | AArch64::AEK_BF16 | AArch64::AEK_SHA2 | AArch64::AEK_AES | AArch64::AEK_I8MM)}; inline constexpr ArchInfo ARMV8_7A = { VersionTuple{8, 7}, AProfile, "armv8.7-a", "+v8.7a", (ARMV8_6A.DefaultExts)}; -inline constexpr ArchInfo ARMV8_8A = { VersionTuple{8, 8}, AProfile, "armv8.8-a", "+v8.8a", (ARMV8_7A.DefaultExts)}; +inline constexpr ArchInfo ARMV8_8A = { VersionTuple{8, 8}, AProfile, "armv8.8-a", "+v8.8a", (ARMV8_7A.DefaultExts | AArch64::AEK_MOPS | AArch64::AEK_HBC)}; inline constexpr ArchInfo ARMV8_9A = { VersionTuple{8, 9}, AProfile, "armv8.9-a", "+v8.9a", (ARMV8_8A.DefaultExts)}; inline constexpr ArchInfo ARMV9A = { VersionTuple{9, 0}, AProfile, "armv9-a", "+v9a", (BaseNoCrypto | AArch64::AEK_SVE | AArch64::AEK_SVE2)}; inline constexpr ArchInfo ARMV9_1A = { VersionTuple{9, 1}, AProfile, "armv9.1-a", "+v9.1a", (ARMV9A.DefaultExts | AArch64::AEK_BF16 | AArch64::AEK_I8MM)}; inline constexpr ArchInfo ARMV9_2A = { VersionTuple{9, 2}, AProfile, "armv9.2-a", "+v9.2a", (ARMV9_1A.DefaultExts)}; -inline constexpr ArchInfo ARMV9_3A = { VersionTuple{9, 3}, AProfile, "armv9.3-a", "+v9.3a", (ARMV9_2A.DefaultExts)}; +inline constexpr ArchInfo ARMV9_3A = { VersionTuple{9, 3}, AProfile, "armv9.3-a", "+v9.3a", (ARMV9_2A.DefaultExts | AArch64::AEK_MOPS | AArch64::AEK_HBC)}; inline constexpr ArchInfo ARMV9_4A = { VersionTuple{9, 4}, AProfile, "armv9.4-a", "+v9.4a", (ARMV9_3A.DefaultExts)}; // For v8-R, we do not enable crypto and align with GCC that enables a more minimal set of optional architecture extensions. inline constexpr ArchInfo ARMV8R = { VersionTuple{8, 0}, RProfile, "armv8-r", "+v8r", ((BaseNoCrypto ^ AArch64::AEK_LSE) | AArch64::AEK_SSBS | AArch64::AEK_FP16 | AArch64::AEK_FP16FML | AArch64::AEK_SB), }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits