[clang] d17fb46 - [Clang][AArch64][ARM] PMUv3.4 Option Added
Mubashar Ahmad via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 10 03:28:50 PST 2022
Author: Mubashar Ahmad
Date: 2022-01-10T11:28:19Z
New Revision: d17fb46e894501568a1bf3b11a5d920817444630
URL: https://github.com/llvm/llvm-project/commit/d17fb46e894501568a1bf3b11a5d920817444630
DIFF: https://github.com/llvm/llvm-project/commit/d17fb46e894501568a1bf3b11a5d920817444630.diff
LOG: [Clang][AArch64][ARM] PMUv3.4 Option Added
An option has been added to Clang to enable or disable
the PMU v3.4 architecture extension.
Differential Revision: https://reviews.llvm.org/D116748
Added:
clang/test/Driver/aarch64-perfmon.c
clang/test/Driver/arm-perfmon.c
Modified:
llvm/include/llvm/Support/AArch64TargetParser.def
llvm/include/llvm/Support/AArch64TargetParser.h
llvm/include/llvm/Support/ARMTargetParser.def
llvm/include/llvm/Support/ARMTargetParser.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..228e6d6f3f15a
--- /dev/null
+++ b/clang/test/Driver/aarch64-perfmon.c
@@ -0,0 +1,13 @@
+// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a+pmuv3p4 %s 2>&1 | FileCheck --check-prefix=CHECK-PERFMON %s
+// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.2a+pmuv3p4 %s 2>&1 | FileCheck --check-prefix=CHECK-PERFMON %s
+// CHECK-PERFMON: "-target-feature" "+perfmon"
+
+// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a+nopmuv3p4 %s 2>&1 | FileCheck --check-prefix=CHECK-NOPERFMON %s
+// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.2a+nopmuv3p4 %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/clang/test/Driver/arm-perfmon.c b/clang/test/Driver/arm-perfmon.c
new file mode 100644
index 0000000000000..618bd98044691
--- /dev/null
+++ b/clang/test/Driver/arm-perfmon.c
@@ -0,0 +1,13 @@
+// RUN: %clang -### -target arm-none-none-eabi -march=armv8.4a+pmuv3p4 %s 2>&1 | FileCheck --check-prefix=CHECK-PERFMON %s
+// RUN: %clang -### -target arm-none-none-eabi -march=armv8.2a+pmuv3p4 %s 2>&1 | FileCheck --check-prefix=CHECK-PERFMON %s
+// CHECK-PERFMON: "-target-feature" "+perfmon"
+
+// RUN: %clang -### -target arm-none-none-eabi -march=armv8.4a+nopmuv3p4 %s 2>&1 | FileCheck --check-prefix=CHECK-NOPERFMON %s
+// RUN: %clang -### -target arm-none-none-eabi -march=armv8.2a+nopmuv3p4 %s 2>&1 | FileCheck --check-prefix=CHECK-NOPERFMON %s
+// CHECK-NOPERFMON: "-target-feature" "-perfmon"
+
+// RUN: %clang -### -target arm-none-none-eabi %s 2>&1 | FileCheck %s --check-prefix=ABSENTPERFMON
+// RUN: %clang -### -target arm-none-none-eabi -march=armv8.4a %s 2>&1 | FileCheck %s --check-prefix=ABSENTPERFMON
+// RUN: %clang -### -target arm-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 9d45f6abae6be..6619864e7ca16 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.def
+++ b/llvm/include/llvm/Support/AArch64TargetParser.def
@@ -144,6 +144,7 @@ AARCH64_ARCH_EXT_NAME("flagm", AArch64::AEK_FLAGM, "+flagm", "-flag
AARCH64_ARCH_EXT_NAME("sme", AArch64::AEK_SME, "+sme", "-sme")
AARCH64_ARCH_EXT_NAME("sme-f64", AArch64::AEK_SMEF64, "+sme-f64", "-sme-f64")
AARCH64_ARCH_EXT_NAME("sme-i64", AArch64::AEK_SMEI64, "+sme-i64", "-sme-i64")
+AARCH64_ARCH_EXT_NAME("pmuv3p4", 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 15bb428f19bcd..06aad515c8bde 100644
--- a/llvm/include/llvm/Support/AArch64TargetParser.h
+++ b/llvm/include/llvm/Support/AArch64TargetParser.h
@@ -69,6 +69,7 @@ enum ArchExtKind : uint64_t {
AEK_SME = 1ULL << 37,
AEK_SMEF64 = 1ULL << 38,
AEK_SMEI64 = 1ULL << 39,
+ AEK_PERFMON = 1ULL << 40,
};
enum class ArchKind {
diff --git a/llvm/include/llvm/Support/ARMTargetParser.def b/llvm/include/llvm/Support/ARMTargetParser.def
index 433d7fdc2c3b7..4465fc5cefb1d 100644
--- a/llvm/include/llvm/Support/ARMTargetParser.def
+++ b/llvm/include/llvm/Support/ARMTargetParser.def
@@ -213,6 +213,7 @@ ARM_ARCH_EXT_NAME("cdecp5", ARM::AEK_CDECP5, "+cdecp5", "-cdecp5")
ARM_ARCH_EXT_NAME("cdecp6", ARM::AEK_CDECP6, "+cdecp6", "-cdecp6")
ARM_ARCH_EXT_NAME("cdecp7", ARM::AEK_CDECP7, "+cdecp7", "-cdecp7")
ARM_ARCH_EXT_NAME("pacbti", ARM::AEK_PACBTI, "+pacbti", "-pacbti")
+ARM_ARCH_EXT_NAME("pmuv3p4", ARM::AEK_PERFMON, "+perfmon", "-perfmon")
#undef ARM_ARCH_EXT_NAME
#ifndef ARM_HW_DIV_NAME
diff --git a/llvm/include/llvm/Support/ARMTargetParser.h b/llvm/include/llvm/Support/ARMTargetParser.h
index b40704c24e87c..841728d866d58 100644
--- a/llvm/include/llvm/Support/ARMTargetParser.h
+++ b/llvm/include/llvm/Support/ARMTargetParser.h
@@ -60,6 +60,7 @@ enum ArchExtKind : uint64_t {
AEK_CDECP6 = 1 << 28,
AEK_CDECP7 = 1 << 29,
AEK_PACBTI = 1 << 30,
+ AEK_PERFMON = 1ULL << 31,
// Unsupported extensions.
AEK_OS = 1ULL << 59,
AEK_IWMMXT = 1ULL << 60,
diff --git a/llvm/lib/Support/AArch64TargetParser.cpp b/llvm/lib/Support/AArch64TargetParser.cpp
index 42a941ca08e62..676824006dabe 100644
--- a/llvm/lib/Support/AArch64TargetParser.cpp
+++ b/llvm/lib/Support/AArch64TargetParser.cpp
@@ -114,6 +114,8 @@ bool AArch64::getExtensionFeatures(uint64_t Extensions,
Features.push_back("+sme-f64");
if (Extensions & AArch64::AEK_SMEI64)
Features.push_back("+sme-i64");
+ 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 3ea7ed4f2c301..71f17d73c545a 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -728,7 +728,8 @@ TEST(TargetParserTest, ARMArchExtFeature) {
{"sb", "nosb", "+sb", "-sb"},
{"i8mm", "noi8mm", "+i8mm", "-i8mm"},
{"mve", "nomve", "+mve", "-mve"},
- {"mve.fp", "nomve.fp", "+mve.fp", "-mve.fp"}};
+ {"mve.fp", "nomve.fp", "+mve.fp", "-mve.fp"},
+ {"pmuv3p4", "nopmuv3p4", "+perfmon", "-perfmon"}};
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
EXPECT_EQ(StringRef(ArchExt[i][2]), ARM::getArchExtFeature(ArchExt[i][0]));
@@ -1428,17 +1429,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 +1471,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) {
@@ -1485,43 +1484,41 @@ TEST(TargetParserTest, AArch64ArchFeatures) {
}
TEST(TargetParserTest, AArch64ArchExtFeature) {
- const char *ArchExt[][4] = {{"crc", "nocrc", "+crc", "-crc"},
- {"crypto", "nocrypto", "+crypto", "-crypto"},
- {"flagm", "noflagm", "+flagm", "-flagm"},
- {"fp", "nofp", "+fp-armv8", "-fp-armv8"},
- {"simd", "nosimd", "+neon", "-neon"},
- {"fp16", "nofp16", "+fullfp16", "-fullfp16"},
- {"fp16fml", "nofp16fml", "+fp16fml", "-fp16fml"},
- {"profile", "noprofile", "+spe", "-spe"},
- {"ras", "noras", "+ras", "-ras"},
- {"lse", "nolse", "+lse", "-lse"},
- {"rdm", "nordm", "+rdm", "-rdm"},
- {"sve", "nosve", "+sve", "-sve"},
- {"sve2", "nosve2", "+sve2", "-sve2"},
- {"sve2-aes", "nosve2-aes", "+sve2-aes",
- "-sve2-aes"},
- {"sve2-sm4", "nosve2-sm4", "+sve2-sm4",
- "-sve2-sm4"},
- {"sve2-sha3", "nosve2-sha3", "+sve2-sha3",
- "-sve2-sha3"},
- {"sve2-bitperm", "nosve2-bitperm",
- "+sve2-bitperm", "-sve2-bitperm"},
- {"dotprod", "nodotprod", "+dotprod", "-dotprod"},
- {"rcpc", "norcpc", "+rcpc", "-rcpc" },
- {"rng", "norng", "+rand", "-rand"},
- {"memtag", "nomemtag", "+mte", "-mte"},
- {"tme", "notme", "+tme", "-tme"},
- {"pauth", "nopauth", "+pauth", "-pauth"},
- {"ssbs", "nossbs", "+ssbs", "-ssbs"},
- {"sb", "nosb", "+sb", "-sb"},
- {"predres", "nopredres", "+predres", "-predres"},
- {"i8mm", "noi8mm", "+i8mm", "-i8mm"},
- {"f32mm", "nof32mm", "+f32mm", "-f32mm"},
- {"f64mm", "nof64mm", "+f64mm", "-f64mm"},
- {"sme", "nosme", "+sme", "-sme"},
- {"sme-f64", "nosme-f64", "+sme-f64", "-sme-f64"},
- {"sme-i64", "nosme-i64", "+sme-i64", "-sme-i64"},
-};
+ const char *ArchExt[][4] = {
+ {"crc", "nocrc", "+crc", "-crc"},
+ {"crypto", "nocrypto", "+crypto", "-crypto"},
+ {"flagm", "noflagm", "+flagm", "-flagm"},
+ {"fp", "nofp", "+fp-armv8", "-fp-armv8"},
+ {"simd", "nosimd", "+neon", "-neon"},
+ {"fp16", "nofp16", "+fullfp16", "-fullfp16"},
+ {"fp16fml", "nofp16fml", "+fp16fml", "-fp16fml"},
+ {"profile", "noprofile", "+spe", "-spe"},
+ {"ras", "noras", "+ras", "-ras"},
+ {"lse", "nolse", "+lse", "-lse"},
+ {"rdm", "nordm", "+rdm", "-rdm"},
+ {"sve", "nosve", "+sve", "-sve"},
+ {"sve2", "nosve2", "+sve2", "-sve2"},
+ {"sve2-aes", "nosve2-aes", "+sve2-aes", "-sve2-aes"},
+ {"sve2-sm4", "nosve2-sm4", "+sve2-sm4", "-sve2-sm4"},
+ {"sve2-sha3", "nosve2-sha3", "+sve2-sha3", "-sve2-sha3"},
+ {"sve2-bitperm", "nosve2-bitperm", "+sve2-bitperm", "-sve2-bitperm"},
+ {"dotprod", "nodotprod", "+dotprod", "-dotprod"},
+ {"rcpc", "norcpc", "+rcpc", "-rcpc"},
+ {"rng", "norng", "+rand", "-rand"},
+ {"memtag", "nomemtag", "+mte", "-mte"},
+ {"tme", "notme", "+tme", "-tme"},
+ {"pauth", "nopauth", "+pauth", "-pauth"},
+ {"ssbs", "nossbs", "+ssbs", "-ssbs"},
+ {"sb", "nosb", "+sb", "-sb"},
+ {"predres", "nopredres", "+predres", "-predres"},
+ {"i8mm", "noi8mm", "+i8mm", "-i8mm"},
+ {"f32mm", "nof32mm", "+f32mm", "-f32mm"},
+ {"f64mm", "nof64mm", "+f64mm", "-f64mm"},
+ {"sme", "nosme", "+sme", "-sme"},
+ {"sme-f64", "nosme-f64", "+sme-f64", "-sme-f64"},
+ {"sme-i64", "nosme-i64", "+sme-i64", "-sme-i64"},
+ {"pmuv3p4", "nopmuv3p4", "+perfmon", "-perfmon"},
+ };
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
EXPECT_EQ(StringRef(ArchExt[i][2]),
More information about the cfe-commits
mailing list