diff --git a/llvm/include/llvm/Support/ARMBuildAttributes.h b/llvm/include/llvm/Support/ARMBuildAttributes.h --- a/llvm/include/llvm/Support/ARMBuildAttributes.h +++ b/llvm/include/llvm/Support/ARMBuildAttributes.h @@ -90,25 +90,26 @@ // Legal Values for CPU_arch, (=6), uleb128 enum CPUArch { - Pre_v4 = 0, - v4 = 1, // e.g. SA110 - v4T = 2, // e.g. ARM7TDMI - v5T = 3, // e.g. ARM9TDMI - v5TE = 4, // e.g. ARM946E_S - v5TEJ = 5, // e.g. ARM926EJ_S - v6 = 6, // e.g. ARM1136J_S - v6KZ = 7, // e.g. ARM1176JZ_S - v6T2 = 8, // e.g. ARM1156T2_S - v6K = 9, // e.g. ARM1176JZ_S - v7 = 10, // e.g. Cortex A8, Cortex M3 - v6_M = 11, // e.g. Cortex M1 - v6S_M = 12, // v6_M with the System extensions - v7E_M = 13, // v7_M with DSP extensions - v8_A = 14, // v8_A AArch32 - v8_R = 15, // e.g. Cortex R52 - v8_M_Base= 16, // v8_M_Base AArch32 - v8_M_Main= 17, // v8_M_Main AArch32 - v8_1_M_Main=21, // v8_1_M_Main AArch32 + Pre_v4 = 0, + v4 = 1, // e.g. SA110 + v4T = 2, // e.g. ARM7TDMI + v5T = 3, // e.g. ARM9TDMI + v5TE = 4, // e.g. ARM946E_S + v5TEJ = 5, // e.g. ARM926EJ_S + v6 = 6, // e.g. ARM1136J_S + v6KZ = 7, // e.g. ARM1176JZ_S + v6T2 = 8, // e.g. ARM1156T2_S + v6K = 9, // e.g. ARM1176JZ_S + v7 = 10, // e.g. Cortex A8, Cortex M3 + v6_M = 11, // e.g. Cortex M1 + v6S_M = 12, // v6_M with the System extensions + v7E_M = 13, // v7_M with DSP extensions + v8_A = 14, // v8_A AArch32 + v8_R = 15, // e.g. Cortex R52 + v8_M_Base = 16, // v8_M_Base AArch32 + v8_M_Main = 17, // v8_M_Main AArch32 + v8_1_M_Main = 21, // v8_1_M_Main AArch32 + v9_A = 22, // v9_A AArch32 }; enum CPUArchProfile { // (=7), uleb128 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 @@ -129,22 +129,22 @@ ARM::AEK_DOTPROD | ARM::AEK_BF16 | ARM::AEK_SHA2 | ARM::AEK_AES | ARM::AEK_I8MM)) ARM_ARCH("armv9-a", ARMV9A, "9-A", "v9a", - ARMBuildAttrs::CPUArch::v8_A, FK_NEON_FP_ARMV8, + ARMBuildAttrs::CPUArch::v9_A, FK_NEON_FP_ARMV8, (ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT | ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP | ARM::AEK_CRC | ARM::AEK_RAS | ARM::AEK_DOTPROD)) ARM_ARCH("armv9.1-a", ARMV9_1A, "9.1-A", "v9.1a", - ARMBuildAttrs::CPUArch::v8_A, FK_NEON_FP_ARMV8, + ARMBuildAttrs::CPUArch::v9_A, FK_NEON_FP_ARMV8, (ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT | ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP | ARM::AEK_CRC | ARM::AEK_RAS | ARM::AEK_DOTPROD | ARM::AEK_BF16 | ARM::AEK_I8MM)) ARM_ARCH("armv9.2-a", ARMV9_2A, "9.2-A", "v9.2a", - ARMBuildAttrs::CPUArch::v8_A, FK_NEON_FP_ARMV8, + ARMBuildAttrs::CPUArch::v9_A, FK_NEON_FP_ARMV8, (ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT | ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP | ARM::AEK_CRC | ARM::AEK_RAS | ARM::AEK_DOTPROD | ARM::AEK_BF16 | ARM::AEK_I8MM)) ARM_ARCH("armv9.3-a", ARMV9_3A, "9.3-A", "v9.3a", - ARMBuildAttrs::CPUArch::v8_A, FK_CRYPTO_NEON_FP_ARMV8, + ARMBuildAttrs::CPUArch::v9_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 | ARM::AEK_RAS | ARM::AEK_DOTPROD | ARM::AEK_BF16 | ARM::AEK_I8MM)) diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -574,6 +574,9 @@ case ARMBuildAttrs::v8_1_M_Main: Triple += "v8.1m.main"; break; + case ARMBuildAttrs::v9_A: + Triple += "v9a"; + break; } } if (!isLittleEndian()) diff --git a/llvm/lib/Support/ARMAttributeParser.cpp b/llvm/lib/Support/ARMAttributeParser.cpp --- a/llvm/lib/Support/ARMAttributeParser.cpp +++ b/llvm/lib/Support/ARMAttributeParser.cpp @@ -87,7 +87,7 @@ "ARM v6KZ", "ARM v6T2", "ARM v6K", "ARM v7", "ARM v6-M", "ARM v6S-M", "ARM v7E-M", "ARM v8", nullptr, "ARM v8-M Baseline", "ARM v8-M Mainline", nullptr, nullptr, nullptr, - "ARM v8.1-M Mainline" + "ARM v8.1-M Mainline", "ARM v9-A" }; return parseStringAttribute("CPU_arch", tag, makeArrayRef(strings)); } diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp @@ -122,7 +122,9 @@ if (STI.getCPU() == "xscale") return ARMBuildAttrs::v5TEJ; - if (STI.hasFeature(ARM::HasV8Ops)) { + if (STI.hasFeature(ARM::HasV9_0aOps)) + return ARMBuildAttrs::v9_A; + else if (STI.hasFeature(ARM::HasV8Ops)) { if (STI.hasFeature(ARM::FeatureRClass)) return ARMBuildAttrs::v8_R; return ARMBuildAttrs::v8_A; diff --git a/llvm/unittests/Support/ARMAttributeParser.cpp b/llvm/unittests/Support/ARMAttributeParser.cpp --- a/llvm/unittests/Support/ARMAttributeParser.cpp +++ b/llvm/unittests/Support/ARMAttributeParser.cpp @@ -54,8 +54,8 @@ TEST(ARMAttributeParser, UnknownCPU_arch) { static const uint8_t bytes[] = {'A', 15, 0, 0, 0, 'a', 'e', 'a', 'b', - 'i', 0, 1, 7, 0, 0, 0, 6, 22}; - testParseError(bytes, "unknown CPU_arch value: 22"); + 'i', 0, 1, 7, 0, 0, 0, 6, 23}; + testParseError(bytes, "unknown CPU_arch value: 23"); } TEST(CPUArchBuildAttr, testBuildAttr) { @@ -99,6 +99,9 @@ ARMBuildAttrs::v8_M_Main)); EXPECT_TRUE(testBuildAttr(6, 21, ARMBuildAttrs::CPU_arch, ARMBuildAttrs::v8_1_M_Main)); + EXPECT_TRUE(testBuildAttr(6, 22, ARMBuildAttrs::CPU_arch, + ARMBuildAttrs::v9_A)); + } TEST(CPUArchProfileBuildAttr, testBuildAttr) { 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 @@ -513,13 +513,16 @@ ARMBuildAttrs::CPUArch::v8_A)); EXPECT_TRUE( testARMArch("armv9-a", "generic", "v9a", - ARMBuildAttrs::CPUArch::v8_A)); + ARMBuildAttrs::CPUArch::v9_A)); EXPECT_TRUE( testARMArch("armv9.1-a", "generic", "v9.1a", - ARMBuildAttrs::CPUArch::v8_A)); + ARMBuildAttrs::CPUArch::v9_A)); EXPECT_TRUE( testARMArch("armv9.2-a", "generic", "v9.2a", - ARMBuildAttrs::CPUArch::v8_A)); + ARMBuildAttrs::CPUArch::v9_A)); + EXPECT_TRUE( + testARMArch("armv9.3-a", "generic", "v9.3a", + ARMBuildAttrs::CPUArch::v9_A)); EXPECT_TRUE( testARMArch("armv8-r", "cortex-r52", "v8r", ARMBuildAttrs::CPUArch::v8_R));