[llvm] 61d547e - [Clang][AArch64][ARM] PMUv3 Option Added
Mubashar Ahmad via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 17 06:33:36 PST 2022
Author: Mubashar Ahmad
Date: 2022-01-17T14:33:03Z
New Revision: 61d547e82494daa839731ba87e5b9ee20d12a22b
URL: https://github.com/llvm/llvm-project/commit/61d547e82494daa839731ba87e5b9ee20d12a22b
DIFF: https://github.com/llvm/llvm-project/commit/61d547e82494daa839731ba87e5b9ee20d12a22b.diff
LOG: [Clang][AArch64][ARM] PMUv3 Option Added
An option has been added to Clang to enable or disable
the PMU v3 architecture extension.
Differential Revision: https://reviews.llvm.org/D116748
Added:
clang/test/Driver/aarch64-perfmon.c
Modified:
llvm/include/llvm/Support/AArch64TargetParser.def
llvm/include/llvm/Support/AArch64TargetParser.h
llvm/lib/Support/AArch64TargetParser.cpp
llvm/unittests/Support/TargetParserTest.cpp
Removed:
################################################################################
diff --git a/clang/test/Driver/aarch64-perfmon.c b/clang/test/Driver/aarch64-perfmon.c
new file mode 100644
index 0000000000000..ca5e75dbbef64
--- /dev/null
+++ b/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
diff --git a/llvm/include/llvm/Support/AArch64TargetParser.def b/llvm/include/llvm/Support/AArch64TargetParser.def
index 9d92d96e67a2d..26f4bae53119e 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.def
+++ b/llvm/include/llvm/Support/AArch64TargetParser.def
@@ -146,6 +146,7 @@ AARCH64_ARCH_EXT_NAME("sme-f64", AArch64::AEK_SMEF64, "+sme-f64",
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
diff --git a/llvm/include/llvm/Support/AArch64TargetParser.h b/llvm/include/llvm/Support/AArch64TargetParser.h
index b998bb481d8da..e53f16a8dd425 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.h
+++ b/llvm/include/llvm/Support/AArch64TargetParser.h
@@ -71,6 +71,7 @@ enum ArchExtKind : uint64_t {
AEK_SMEI64 = 1ULL << 39,
AEK_HBC = 1ULL << 40,
AEK_MOPS = 1ULL << 41,
+ AEK_PERFMON = 1ULL << 42,
};
enum class ArchKind {
diff --git a/llvm/lib/Support/AArch64TargetParser.cpp b/llvm/lib/Support/AArch64TargetParser.cpp
index 9f1c17104cf43..cdf7c8ade9aac 100644
--- a/llvm/lib/Support/AArch64TargetParser.cpp
+++ b/llvm/lib/Support/AArch64TargetParser.cpp
@@ -118,6 +118,8 @@ bool AArch64::getExtensionFeatures(uint64_t Extensions,
Features.push_back("+hbc");
if (Extensions & AArch64::AEK_MOPS)
Features.push_back("+mops");
+ if (Extensions & AArch64::AEK_PERFMON)
+ Features.push_back("+perfmon");
return true;
}
diff --git a/llvm/unittests/Support/TargetParserTest.cpp b/llvm/unittests/Support/TargetParserTest.cpp
index 9e2a29a1dc0e0..8fe13caab0ca7 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -1428,17 +1428,14 @@ TEST(TargetParserTest, testAArch64Extension) {
TEST(TargetParserTest, AArch64ExtensionFeatures) {
std::vector<uint64_t> 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<StringRef> Features;
@@ -1473,6 +1470,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
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 @@ TEST(TargetParserTest, AArch64ArchExtFeature) {
{"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++) {
More information about the llvm-commits
mailing list