[llvm] 64a52e1 - [llvm-exegesis] Don't erroneously refuse to measure POPCNT instruction

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 4 04:38:36 PDT 2021


Author: Roman Lebedev
Date: 2021-04-04T14:38:26+03:00
New Revision: 64a52e1e3266d04856850ffa1c5bc7532c511a21

URL: https://github.com/llvm/llvm-project/commit/64a52e1e3266d04856850ffa1c5bc7532c511a21
DIFF: https://github.com/llvm/llvm-project/commit/64a52e1e3266d04856850ffa1c5bc7532c511a21.diff

LOG: [llvm-exegesis] Don't erroneously refuse to measure POPCNT instruction

Added: 
    llvm/test/tools/llvm-exegesis/X86/uops-POPCNT32rr.s

Modified: 
    llvm/tools/llvm-exegesis/lib/X86/Target.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-exegesis/X86/uops-POPCNT32rr.s b/llvm/test/tools/llvm-exegesis/X86/uops-POPCNT32rr.s
new file mode 100644
index 0000000000000..67d652444e0c4
--- /dev/null
+++ b/llvm/test/tools/llvm-exegesis/X86/uops-POPCNT32rr.s
@@ -0,0 +1,7 @@
+# RUN: llvm-exegesis -mode=uops -opcode-name=POPCNT32rr 2>&1 | FileCheck %s
+
+CHECK:      ---
+CHECK-NEXT: mode: uops
+CHECK-NEXT: key:
+CHECK-NEXT:   instructions:
+CHECK-NEXT:     - 'POPCNT32rr

diff  --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
index f8c677dd7de87..40fed0789a819 100644
--- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -194,8 +194,9 @@ static const char *isInvalidOpcode(const Instruction &Instr) {
   const auto OpcodeName = Instr.Name;
   if ((Instr.Description.TSFlags & X86II::FormMask) == X86II::Pseudo)
     return "unsupported opcode: pseudo instruction";
-  if (OpcodeName.startswith("POP") || OpcodeName.startswith("PUSH") ||
-      OpcodeName.startswith("ADJCALLSTACK") || OpcodeName.startswith("LEAVE"))
+  if ((OpcodeName.startswith("POP") && !OpcodeName.startswith("POPCNT")) ||
+      OpcodeName.startswith("PUSH") || OpcodeName.startswith("ADJCALLSTACK") ||
+      OpcodeName.startswith("LEAVE"))
     return "unsupported opcode: Push/Pop/AdjCallStack/Leave";
   switch (Instr.Description.Opcode) {
   case X86::LFS16rm:


        


More information about the llvm-commits mailing list