Index: clang/test/Driver/aarch64-perfmon.c =================================================================== --- /dev/null +++ clang/test/Driver/aarch64-perfmon.c @@ -0,0 +1,13 @@ +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a+pmuv3 %s 2>&1 | FileCheck --check-prefix=CHECK-PERFMON %s +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.2a+pmuv3 %s 2>&1 | FileCheck --check-prefix=CHECK-PERFMON %s +// CHECK-PERFMON: "-target-feature" "+perfmon" + +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a+nopmuv3 %s 2>&1 | FileCheck --check-prefix=CHECK-NOPERFMON %s +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.2a+nopmuv3 %s 2>&1 | FileCheck --check-prefix=CHECK-NOPERFMON %s +// CHECK-NOPERFMON: "-target-feature" "-perfmon" + +// RUN: %clang -### -target aarch64-none-none-eabi %s 2>&1 | FileCheck %s --check-prefix=ABSENTPERFMON +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a %s 2>&1 | FileCheck %s --check-prefix=ABSENTPERFMON +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.2a %s 2>&1 | FileCheck %s --check-prefix=ABSENTPERFMON +// ABSENTPERFMON-NOT: "-target-feature" "+perfmon" +// ABSENTPERFMON-NOT: "-target-feature" "-perfmon" \ No newline at end of file Index: llvm/include/llvm/Support/AArch64TargetParser.h =================================================================== --- llvm/include/llvm/Support/AArch64TargetParser.h +++ llvm/include/llvm/Support/AArch64TargetParser.h @@ -71,6 +71,7 @@ AEK_SMEI64 = 1ULL << 39, AEK_HBC = 1ULL << 40, AEK_MOPS = 1ULL << 41, + AEK_PERFMON = 1ULL << 42, }; enum class ArchKind { Index: llvm/include/llvm/Support/AArch64TargetParser.def =================================================================== --- llvm/include/llvm/Support/AArch64TargetParser.def +++ llvm/include/llvm/Support/AArch64TargetParser.def @@ -146,6 +146,7 @@ AARCH64_ARCH_EXT_NAME("sme-i64", AArch64::AEK_SMEI64, "+sme-i64", "-sme-i64") AARCH64_ARCH_EXT_NAME("hbc", AArch64::AEK_HBC, "+hbc", "-hbc") AARCH64_ARCH_EXT_NAME("mops", AArch64::AEK_MOPS, "+mops", "-mops") +AARCH64_ARCH_EXT_NAME("pmuv3", AArch64::AEK_PERFMON, "+perfmon", "-perfmon") #undef AARCH64_ARCH_EXT_NAME #ifndef AARCH64_CPU_NAME Index: llvm/lib/Support/AArch64TargetParser.cpp =================================================================== --- llvm/lib/Support/AArch64TargetParser.cpp +++ llvm/lib/Support/AArch64TargetParser.cpp @@ -118,6 +118,8 @@ Features.push_back("+hbc"); if (Extensions & AArch64::AEK_MOPS) Features.push_back("+mops"); + if (Extensions & AArch64::AEK_PERFMON) + Features.push_back("+perfmon"); return true; } Index: llvm/unittests/Support/TargetParserTest.cpp =================================================================== --- llvm/unittests/Support/TargetParserTest.cpp +++ llvm/unittests/Support/TargetParserTest.cpp @@ -1428,17 +1428,14 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) { std::vector Extensions = { - AArch64::AEK_CRC, AArch64::AEK_CRYPTO, - AArch64::AEK_FP, AArch64::AEK_SIMD, - AArch64::AEK_FP16, AArch64::AEK_PROFILE, - AArch64::AEK_RAS, AArch64::AEK_LSE, - AArch64::AEK_RDM, AArch64::AEK_DOTPROD, - AArch64::AEK_SVE, AArch64::AEK_SVE2, - AArch64::AEK_SVE2AES, AArch64::AEK_SVE2SM4, - AArch64::AEK_SVE2SHA3, AArch64::AEK_SVE2BITPERM, - AArch64::AEK_RCPC, AArch64::AEK_FP16FML, - AArch64::AEK_SME, AArch64::AEK_SMEF64, - AArch64::AEK_SMEI64 }; + AArch64::AEK_CRC, AArch64::AEK_CRYPTO, AArch64::AEK_FP, + AArch64::AEK_SIMD, AArch64::AEK_FP16, AArch64::AEK_PROFILE, + AArch64::AEK_RAS, AArch64::AEK_LSE, AArch64::AEK_RDM, + AArch64::AEK_DOTPROD, AArch64::AEK_SVE, AArch64::AEK_SVE2, + AArch64::AEK_SVE2AES, AArch64::AEK_SVE2SM4, AArch64::AEK_SVE2SHA3, + AArch64::AEK_SVE2BITPERM, AArch64::AEK_RCPC, AArch64::AEK_FP16FML, + AArch64::AEK_SME, AArch64::AEK_SMEF64, AArch64::AEK_SMEI64, + AArch64::AEK_PERFMON}; std::vector Features; @@ -1473,6 +1470,7 @@ EXPECT_TRUE(llvm::is_contained(Features, "+sme")); EXPECT_TRUE(llvm::is_contained(Features, "+sme-f64")); EXPECT_TRUE(llvm::is_contained(Features, "+sme-i64")); + EXPECT_TRUE(llvm::is_contained(Features, "+perfmon")); } TEST(TargetParserTest, AArch64ArchFeatures) { @@ -1520,6 +1518,7 @@ {"sme-i64", "nosme-i64", "+sme-i64", "-sme-i64"}, {"hbc", "nohbc", "+hbc", "-hbc"}, {"mops", "nomops", "+mops", "-mops"}, + {"pmuv3", "nopmuv3", "+perfmon", "-perfmon"}, }; for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {