summaryrefslogtreecommitdiff
path: root/llvm/test/TableGen/HwModeEncodeAPInt.td
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /llvm/test/TableGen/HwModeEncodeAPInt.td
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'llvm/test/TableGen/HwModeEncodeAPInt.td')
-rw-r--r--llvm/test/TableGen/HwModeEncodeAPInt.td52
1 files changed, 29 insertions, 23 deletions
diff --git a/llvm/test/TableGen/HwModeEncodeAPInt.td b/llvm/test/TableGen/HwModeEncodeAPInt.td
index 43ca5edd952a..82d99940aa0f 100644
--- a/llvm/test/TableGen/HwModeEncodeAPInt.td
+++ b/llvm/test/TableGen/HwModeEncodeAPInt.td
@@ -17,9 +17,9 @@ def Myi32 : Operand<i32> {
def HasA : Predicate<"Subtarget->hasA()">;
def HasB : Predicate<"Subtarget->hasB()">;
-def ModeA : HwMode<"+a", [HasA]>; // Mode 1
-def ModeB : HwMode<"+b", [HasB]>; // Mode 2
-def ModeC : HwMode<"+c", []>; // Mode 3
+def ModeA : HwMode<[HasA]>; // Mode 1
+def ModeB : HwMode<[HasB]>; // Mode 2
+def ModeC : HwMode<[]>; // Mode 3
def fooTypeEncDefault : InstructionEncoding {
@@ -114,32 +114,38 @@ def unrelated: Instruction {
// For 'baz' we only assigned ModeB for it, so it will be presented
// as '0' in the tables of ModeA, ModeC and Default Mode.
// ENCODER-LABEL: static const uint64_t InstBits[] = {
-// ENCODER: UINT64_C(2), UINT64_C(0), // bar
-// ENCODER: UINT64_C(0), UINT64_C(0), // baz
-// ENCODER: UINT64_C(8), UINT64_C(0), // foo
-// ENCODER: UINT64_C(2), UINT64_C(0), // unrelated
+// ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // bar
+// ENCODER-NEXT: UINT64_C(0), UINT64_C(0), // baz
+// ENCODER-NEXT: UINT64_C(8), UINT64_C(0), // foo
+// ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // unrelated
+// ENCODER-NEXT: };
// ENCODER-LABEL: static const uint64_t InstBits_ModeA[] = {
-// ENCODER: UINT64_C(2), UINT64_C(0), // bar
-// ENCODER: UINT64_C(0), UINT64_C(0), // baz
-// ENCODER: UINT64_C(12), UINT64_C(0), // foo
-// ENCODER: UINT64_C(2), UINT64_C(0), // unrelated
+// ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // bar
+// ENCODER-NEXT: UINT64_C(0), UINT64_C(0), // baz
+// ENCODER-NEXT: UINT64_C(12), UINT64_C(0), // foo
+// ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // unrelated
+// ENCODER-NEXT: };
// ENCODER-LABEL: static const uint64_t InstBits_ModeB[] = {
-// ENCODER: UINT64_C(2), UINT64_C(0), // bar
-// ENCODER: UINT64_C(12), UINT64_C(0), // baz
-// ENCODER: UINT64_C(0), UINT64_C(211106232532992), // foo
-// ENCODER: UINT64_C(2), UINT64_C(0), // unrelated
+// ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // bar
+// ENCODER-NEXT: UINT64_C(12), UINT64_C(0), // baz
+// ENCODER-NEXT: UINT64_C(0), UINT64_C(211106232532992), // foo
+// ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // unrelated
+// ENCODER-NEXT: };
// ENCODER-LABEL: static const uint64_t InstBits_ModeC[] = {
-// ENCODER: UINT64_C(2), UINT64_C(0), // bar
-// ENCODER: UINT64_C(0), UINT64_C(0), // baz
-// ENCODER: UINT64_C(12582915), UINT64_C(0), // foo
-// ENCODER: UINT64_C(2), UINT64_C(0), // unrelated
-
+// ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // bar
+// ENCODER-NEXT: UINT64_C(0), UINT64_C(0), // baz
+// ENCODER-NEXT: UINT64_C(12582915), UINT64_C(0), // foo
+// ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // unrelated
+// ENCODER-NEXT: };
// ENCODER: const uint64_t *InstBitsByHw;
+// ENCODER: constexpr unsigned FirstSupportedOpcode
// ENCODER: const unsigned opcode = MI.getOpcode();
+// ENCODER: if (opcode < FirstSupportedOpcode)
+// ENCODER: unsigned TableIndex = opcode - FirstSupportedOpcode
// ENCODER: if (Scratch.getBitWidth() != 128)
// ENCODER: Scratch = Scratch.zext(128);
-// ENCODER: Inst = APInt(128, ArrayRef(InstBits + opcode * 2, 2));
+// ENCODER: Inst = APInt(128, ArrayRef(InstBits + TableIndex * 2, 2));
// ENCODER: APInt &Value = Inst;
// ENCODER: APInt &op = Scratch;
// ENCODER: switch (opcode) {
@@ -155,7 +161,7 @@ def unrelated: Instruction {
// ENCODER: case 2: InstBitsByHw = InstBits_ModeB; break;
// ENCODER: case 3: InstBitsByHw = InstBits_ModeC; break;
// ENCODER: };
-// ENCODER: Inst = APInt(128, ArrayRef(InstBitsByHw + opcode * 2, 2));
+// ENCODER: Inst = APInt(128, ArrayRef(InstBitsByHw + TableIndex * 2, 2));
// ENCODER: Value = Inst;
// ENCODER: switch (HwMode) {
// ENCODER: default: llvm_unreachable("Unhandled HwMode");
@@ -189,7 +195,7 @@ def unrelated: Instruction {
// ENCODER: default: llvm_unreachable("Unknown hardware mode!"); break;
// ENCODER: case 2: InstBitsByHw = InstBits_ModeB; break;
// ENCODER: };
-// ENCODER: Inst = APInt(128, ArrayRef(InstBitsByHw + opcode * 2, 2));
+// ENCODER: Inst = APInt(128, ArrayRef(InstBitsByHw + TableIndex * 2, 2));
// ENCODER: Value = Inst;
// ENCODER: switch (HwMode) {
// ENCODER: default: llvm_unreachable("Unhandled HwMode");