diff --git a/clang/test/Driver/arch.c b/clang/test/Driver/arch.c --- a/clang/test/Driver/arch.c +++ b/clang/test/Driver/arch.c @@ -2,4 +2,4 @@ // RUN: %clang -target armv8a-unknown-linux-gnueabi -S -emit-llvm %s -o - | FileCheck %s --check-prefix=V8 // V7: target triple = "armv7-unknown-linux-gnueabi" -// V8: target triple = "armv8-unknown-linux-gnueabi" +// V8: target triple = "armv8a-unknown-linux-gnueabi" diff --git a/clang/test/Driver/arm-cortex-cpus-1.c b/clang/test/Driver/arm-cortex-cpus-1.c --- a/clang/test/Driver/arm-cortex-cpus-1.c +++ b/clang/test/Driver/arm-cortex-cpus-1.c @@ -148,7 +148,7 @@ // RUN: %clang -target armv8a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A %s // RUN: %clang -target arm -march=armv8a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A %s // RUN: %clang -target arm -march=armv8-a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A %s -// CHECK-V8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}}" "-target-cpu" "generic" +// CHECK-V8A: "-cc1"{{.*}} "-triple" "armv8a-{{.*}}" "-target-cpu" "generic" // RUN: %clang -target armv8r-linux-gnueabi -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8R %s // RUN: %clang -target arm -march=armv8r -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8R %s @@ -181,7 +181,7 @@ // RUN: %clang -mcpu=generic -target armv8a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s // RUN: %clang -mcpu=generic -target arm -march=armv8a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s // RUN: %clang -mcpu=generic -target arm -march=armv8-a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s -// CHECK-V8A-GENERIC: "-cc1"{{.*}} "-triple" "armv8-{{.*}}" "-target-cpu" "generic" +// CHECK-V8A-GENERIC: "-cc1"{{.*}} "-triple" "armv8a-{{.*}}" "-target-cpu" "generic" // RUN: %clang -target armebv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A %s // RUN: %clang -target armeb -march=armebv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A %s @@ -193,7 +193,7 @@ // RUN: %clang -target armv8a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A %s // RUN: %clang -target arm -march=armebv8a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A %s // RUN: %clang -target arm -march=armebv8-a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A %s -// CHECK-BE-V8A: "-cc1"{{.*}} "-triple" "armebv8-{{.*}}" "-target-cpu" "generic" +// CHECK-BE-V8A: "-cc1"{{.*}} "-triple" "armebv8a-{{.*}}" "-target-cpu" "generic" // RUN: %clang -target armv8 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-THUMB %s // RUN: %clang -target arm -march=armv8 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-THUMB %s @@ -203,7 +203,7 @@ // RUN: %clang -target arm -march=armv8 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-THUMB %s // RUN: %clang -target armv8a -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-THUMB %s // RUN: %clang -target arm -march=armv8a -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-THUMB %s -// CHECK-V8A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8-{{.*}}" "-target-cpu" "generic" +// CHECK-V8A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8a-{{.*}}" "-target-cpu" "generic" // RUN: %clang -target armebv8 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A-THUMB %s // RUN: %clang -target armeb -march=armebv8 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A-THUMB %s @@ -213,7 +213,7 @@ // RUN: %clang -target arm -march=armebv8 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A-THUMB %s // RUN: %clang -target armv8a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A-THUMB %s // RUN: %clang -target arm -march=armebv8a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A-THUMB %s -// CHECK-BE-V8A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8-{{.*}}" "-target-cpu" "generic" +// CHECK-BE-V8A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8a-{{.*}}" "-target-cpu" "generic" // RUN: %clang -target arm -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s // RUN: %clang -target armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s diff --git a/clang/test/Driver/arm-cortex-cpus-2.c b/clang/test/Driver/arm-cortex-cpus-2.c --- a/clang/test/Driver/arm-cortex-cpus-2.c +++ b/clang/test/Driver/arm-cortex-cpus-2.c @@ -331,7 +331,7 @@ // // RUN: %clang -target arm -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=exynos-m3 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s -// CHECK-CPUV8A: "-cc1"{{.*}} "-triple" "armv8- +// CHECK-CPUV8A: "-cc1"{{.*}} "-triple" "armv8a- // RUN: %clang -target arm -mcpu=cortex-a55 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV82A %s // RUN: %clang -target arm -mcpu=cortex-a75 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV82A %s @@ -365,7 +365,7 @@ // // RUN: %clang -target armeb -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target arm -mcpu=exynos-m3 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s -// CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8- +// CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8a- // RUN: %clang -target armeb -mcpu=cortex-a55 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV82A %s // RUN: %clang -target armeb -mcpu=cortex-a75 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV82A %s @@ -402,7 +402,7 @@ // // RUN: %clang -target arm -mcpu=exynos-m3 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=exynos-m3 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s -// CHECK-CPUV8A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8- +// CHECK-CPUV8A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8a- // RUN: %clang -target arm -mcpu=cortex-a55 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV82A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a75 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV82A-THUMB %s @@ -436,7 +436,7 @@ // // RUN: %clang -target armeb -mcpu=exynos-m3 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=exynos-m3 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s -// CHECK-BE-CPUV8A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8- +// CHECK-BE-CPUV8A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8a- // RUN: %clang -target armeb -mcpu=cortex-a55 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV82A-THUMB %s // RUN: %clang -target armeb -mcpu=cortex-a75 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV82A-THUMB %s @@ -458,7 +458,7 @@ // RUN: %clang -target armv8a-arm-none-eabi -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A73 %s // RUN: %clang -target armv8a-arm-none-eabi -mcpu=cortex-a73 -mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A73-MFPU %s // RUN: %clang -target armv8a-arm-none-eabi -mcpu=cortex-a73 -mfloat-abi=soft -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A73-SOFT %s -// CHECK-CORTEX-A73: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "cortex-a73" +// CHECK-CORTEX-A73: "-cc1"{{.*}} "-triple" "armv8a-{{.*}} "-target-cpu" "cortex-a73" // CHECK-CORTEX-A73-MFPU: "-cc1"{{.*}} "-target-feature" "+fp-armv8" // CHECK-CORTEX-A73-MFPU: "-target-feature" "+sha2" // CHECK-CORTEX-A73-MFPU: "-target-feature" "+aes" diff --git a/clang/test/Driver/arm-features.c b/clang/test/Driver/arm-features.c --- a/clang/test/Driver/arm-features.c +++ b/clang/test/Driver/arm-features.c @@ -1,19 +1,19 @@ // RUN: %clang -target arm-none-none-eabi -mcpu=generic+crc -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRC %s // RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+crc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRC %s -// CHECK-CRC: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+crc" +// CHECK-CRC: "-cc1"{{.*}} "-triple" "armv8a-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+crc" // RUN: %clang -target arm-none-none-eabi -mcpu=generic+crypto -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO %s // RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO %s -// CHECK-CRYPTO: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+sha2" "-target-feature" "+aes" +// CHECK-CRYPTO: "-cc1"{{.*}} "-triple" "armv8a-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+sha2" "-target-feature" "+aes" // RUN: %clang -target arm-none-none-eabi -mcpu=generic+dsp -march=armv8m.main -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-DSP %s // RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8m.main+dsp -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-DSP %s // CHECK-DSP: "-cc1"{{.*}} "-triple" "thumbv8m.main-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+dsp" // RUN: %clang -target arm-none-none-eabi -mcpu=generic+nocrc -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRC %s // RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+nocrc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRC %s -// CHECK-NOCRC: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-crc" +// CHECK-NOCRC: "-cc1"{{.*}} "-triple" "armv8a-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-crc" // RUN: %clang -target arm-none-none-eabi -mcpu=generic+nocrypto -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO %s // RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO %s -// CHECK-NOCRYPTO: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-sha2" "-target-feature" "-aes" +// CHECK-NOCRYPTO: "-cc1"{{.*}} "-triple" "armv8a-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-sha2" "-target-feature" "-aes" // RUN: %clang -target arm-none-none-eabi -mcpu=generic+nodsp -march=armv8m.main -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NODSP %s // RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8m.main+nodsp -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NODSP %s // CHECK-NODSP: "-cc1"{{.*}} "-triple" "thumbv8m.main-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-dsp" diff --git a/clang/test/Driver/arm-target-as-march-mcpu.s b/clang/test/Driver/arm-target-as-march-mcpu.s --- a/clang/test/Driver/arm-target-as-march-mcpu.s +++ b/clang/test/Driver/arm-target-as-march-mcpu.s @@ -99,6 +99,6 @@ // TRIPLE-ARMV4: "-triple" "armv4t-unknown-linux-gnueabi" // TRIPLE-ARMV7: "-triple" "armv7-unknown-linux-gnueabi" -// TRIPLE-ARMV8: "-triple" "armv8-unknown-linux-gnueabi" +// TRIPLE-ARMV8: "-triple" "armv8a-unknown-linux-gnueabi" // CPU-A8: "-target-cpu" "cortex-a8" // EXT-CRC: "-target-feature" "+crc" diff --git a/llvm/include/llvm/Support/AArch64TargetParser.h b/llvm/include/llvm/Support/AArch64TargetParser.h --- a/llvm/include/llvm/Support/AArch64TargetParser.h +++ b/llvm/include/llvm/Support/AArch64TargetParser.h @@ -86,8 +86,8 @@ sizeof(NAME) - 1, \ CPU_ATTR, \ sizeof(CPU_ATTR) - 1, \ - SUB_ARCH, \ - sizeof(SUB_ARCH) - 1, \ + "+" SUB_ARCH, \ + sizeof(SUB_ARCH), \ ARM::FPUKind::ARCH_FPU, \ ARCH_BASE_EXT, \ AArch64::ArchKind::ID, \ diff --git a/llvm/include/llvm/Support/AArch64TargetParser.def b/llvm/include/llvm/Support/AArch64TargetParser.def --- a/llvm/include/llvm/Support/AArch64TargetParser.def +++ b/llvm/include/llvm/Support/AArch64TargetParser.def @@ -17,7 +17,7 @@ #endif AARCH64_ARCH("invalid", INVALID, "", "", ARMBuildAttrs::CPUArch::v8_A, FK_NONE, AArch64::AEK_NONE) -AARCH64_ARCH("armv8-a", ARMV8A, "8-A", "v8", ARMBuildAttrs::CPUArch::v8_A, +AARCH64_ARCH("armv8-a", ARMV8A, "8-A", "v8a", ARMBuildAttrs::CPUArch::v8_A, FK_CRYPTO_NEON_FP_ARMV8, (AArch64::AEK_CRYPTO | AArch64::AEK_FP | AArch64::AEK_SIMD)) AARCH64_ARCH("armv8.1-a", ARMV8_1A, "8.1-A", "v8.1a", @@ -83,7 +83,7 @@ AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE | AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD | AArch64::AEK_SVE2)) -AARCH64_ARCH("armv9.3-a", ARMV9_3A, "9.3-A", "v9.3", +AARCH64_ARCH("armv9.3-a", ARMV9_3A, "9.3-A", "v9.3a", ARMBuildAttrs::CPUArch::v8_A, FK_CRYPTO_NEON_FP_ARMV8, (AArch64::AEK_CRC | AArch64::AEK_FP | AArch64::AEK_SIMD | AArch64::AEK_RAS | AArch64::AEK_LSE | diff --git a/llvm/include/llvm/Support/ARMTargetParser.h b/llvm/include/llvm/Support/ARMTargetParser.h --- a/llvm/include/llvm/Support/ARMTargetParser.h +++ b/llvm/include/llvm/Support/ARMTargetParser.h @@ -216,7 +216,14 @@ StringRef getCPUAttr() const { return StringRef(CPUAttrCStr, CPUAttrLength); } // Sub-Arch name. - StringRef getSubArch() const { return StringRef(SubArchCStr, SubArchLength); } + StringRef getSubArch() const { + return getArchFeature().substr(1, SubArchLength); + } + + // Arch Feature name. + StringRef getArchFeature() const { + return StringRef(SubArchCStr, SubArchLength); + } }; static const ArchNames ARCHNames[] = { @@ -224,7 +231,7 @@ ARCH_BASE_EXT) \ {NAME, sizeof(NAME) - 1, \ CPU_ATTR, sizeof(CPU_ATTR) - 1, \ - SUB_ARCH, sizeof(SUB_ARCH) - 1, \ + "+" SUB_ARCH, sizeof(SUB_ARCH), \ ARCH_FPU, ARCH_BASE_EXT, \ ArchKind::ID, ARCH_ATTR}, #include "llvm/Support/ARMTargetParser.def" diff --git a/llvm/include/llvm/Support/ARMTargetParser.def b/llvm/include/llvm/Support/ARMTargetParser.def --- a/llvm/include/llvm/Support/ARMTargetParser.def +++ b/llvm/include/llvm/Support/ARMTargetParser.def @@ -78,7 +78,7 @@ FK_NONE, ARM::AEK_HWDIVTHUMB) ARM_ARCH("armv7e-m", ARMV7EM, "7E-M", "v7em", ARMBuildAttrs::CPUArch::v7E_M, FK_NONE, (ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP)) -ARM_ARCH("armv8-a", ARMV8A, "8-A", "v8", ARMBuildAttrs::CPUArch::v8_A, +ARM_ARCH("armv8-a", ARMV8A, "8-A", "v8a", ARMBuildAttrs::CPUArch::v8_A, FK_CRYPTO_NEON_FP_ARMV8, (ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT | ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP | ARM::AEK_CRC)) diff --git a/llvm/lib/Support/AArch64TargetParser.cpp b/llvm/lib/Support/AArch64TargetParser.cpp --- a/llvm/lib/Support/AArch64TargetParser.cpp +++ b/llvm/lib/Support/AArch64TargetParser.cpp @@ -78,36 +78,11 @@ bool AArch64::getArchFeatures(AArch64::ArchKind AK, std::vector &Features) { - if (AK == ArchKind::ARMV8A) - Features.push_back("+v8a"); - if (AK == ArchKind::ARMV8_1A) - Features.push_back("+v8.1a"); - if (AK == ArchKind::ARMV8_2A) - Features.push_back("+v8.2a"); - if (AK == ArchKind::ARMV8_3A) - Features.push_back("+v8.3a"); - if (AK == ArchKind::ARMV8_4A) - Features.push_back("+v8.4a"); - if (AK == ArchKind::ARMV8_5A) - Features.push_back("+v8.5a"); - if (AK == AArch64::ArchKind::ARMV8_6A) - Features.push_back("+v8.6a"); - if (AK == AArch64::ArchKind::ARMV8_7A) - Features.push_back("+v8.7a"); - if (AK == AArch64::ArchKind::ARMV8_8A) - Features.push_back("+v8.8a"); - if (AK == AArch64::ArchKind::ARMV9A) - Features.push_back("+v9a"); - if (AK == AArch64::ArchKind::ARMV9_1A) - Features.push_back("+v9.1a"); - if (AK == AArch64::ArchKind::ARMV9_2A) - Features.push_back("+v9.2a"); - if (AK == AArch64::ArchKind::ARMV9_3A) - Features.push_back("+v9.3a"); - if(AK == AArch64::ArchKind::ARMV8R) - Features.push_back("+v8r"); - - return AK != ArchKind::INVALID; + if (AK == ArchKind::INVALID) + return false; + Features.push_back( + AArch64ARCHNames[static_cast(AK)].getArchFeature()); + return true; } StringRef AArch64::getArchName(AArch64::ArchKind AK) { diff --git a/llvm/unittests/Support/TargetParserTest.cpp b/llvm/unittests/Support/TargetParserTest.cpp --- a/llvm/unittests/Support/TargetParserTest.cpp +++ b/llvm/unittests/Support/TargetParserTest.cpp @@ -483,7 +483,7 @@ testARMArch("armv7e-m", "cortex-m4", "v7em", ARMBuildAttrs::CPUArch::v7E_M)); EXPECT_TRUE( - testARMArch("armv8-a", "generic", "v8", + testARMArch("armv8-a", "generic", "v8a", ARMBuildAttrs::CPUArch::v8_A)); EXPECT_TRUE( testARMArch("armv8.1-a", "generic", "v8.1a", @@ -1308,7 +1308,7 @@ } TEST(TargetParserTest, testAArch64Arch) { - EXPECT_TRUE(testAArch64Arch("armv8-a", "cortex-a53", "v8", + EXPECT_TRUE(testAArch64Arch("armv8-a", "cortex-a53", "v8a", ARMBuildAttrs::CPUArch::v8_A)); EXPECT_TRUE(testAArch64Arch("armv8.1-a", "generic", "v8.1a", ARMBuildAttrs::CPUArch::v8_A));