aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-11-09 13:15:32 +0000
committerClement Courbet <courbet@google.com>2018-11-09 13:15:32 +0000
commitb4abfc2b2639f1b03c4c50c827a98684d96980ec (patch)
treeaa2a5d3cde46c3a724af0e0b82ab967b6db9457e /unittests
parent25761c3f2ce5c9890fde0cc891d462addd5cdabd (diff)
[llvm-exegesis][NFC] Add a way to declare the default counter binding for unbound CPUs for a target.
Summary: This simplifies the code and moves everything to tablegen for consistency. This also prepares the ground for adding issue counters. Reviewers: gchatelet, john.brawn, jsji Subscribers: nemanjai, mgorny, javed.absar, kbarton, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D54297 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346489 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp6
-rw-r--r--unittests/tools/llvm-exegesis/PowerPC/TargetTest.cpp6
2 files changed, 12 insertions, 0 deletions
diff --git a/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp b/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp
index 8a519bb2e7b..a938db04a48 100644
--- a/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp
+++ b/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp
@@ -59,6 +59,12 @@ TEST_F(AArch64TargetTest, SetRegToConstant) {
EXPECT_THAT(Insts, Not(IsEmpty()));
}
+TEST_F(AArch64TargetTest, DefaultPfmCounters) {
+ EXPECT_EQ(ExegesisTarget_->getPfmCounters("").CycleCounter, "CPU_CYCLES");
+ EXPECT_EQ(ExegesisTarget_->getPfmCounters("unknown_cpu").CycleCounter,
+ "CPU_CYCLES");
+}
+
} // namespace
} // namespace exegesis
} // namespace llvm
diff --git a/unittests/tools/llvm-exegesis/PowerPC/TargetTest.cpp b/unittests/tools/llvm-exegesis/PowerPC/TargetTest.cpp
index e9f6a55af57..f78c141f871 100644
--- a/unittests/tools/llvm-exegesis/PowerPC/TargetTest.cpp
+++ b/unittests/tools/llvm-exegesis/PowerPC/TargetTest.cpp
@@ -59,6 +59,12 @@ TEST_F(PowerPCTargetTest, SetRegToConstant) {
EXPECT_THAT(Insts, Not(IsEmpty()));
}
+TEST_F(PowerPCTargetTest, DefaultPfmCounters) {
+ EXPECT_EQ(ExegesisTarget_->getPfmCounters("").CycleCounter, "CYCLES");
+ EXPECT_EQ(ExegesisTarget_->getPfmCounters("unknown_cpu").CycleCounter,
+ "CYCLES");
+}
+
} // namespace
} // namespace exegesis
} // namespace llvm