@@ -114,32 +114,38 @@ def unrelated: Instruction {
114114// For 'baz' we only assigned ModeB for it, so it will be presented
115115// as '0' in the tables of ModeA, ModeC and Default Mode.
116116// ENCODER-LABEL: static const uint64_t InstBits[] = {
117- // ENCODER: UINT64_C(2), UINT64_C(0), // bar
118- // ENCODER: UINT64_C(0), UINT64_C(0), // baz
119- // ENCODER: UINT64_C(8), UINT64_C(0), // foo
120- // ENCODER: UINT64_C(2), UINT64_C(0), // unrelated
117+ // ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // bar
118+ // ENCODER-NEXT: UINT64_C(0), UINT64_C(0), // baz
119+ // ENCODER-NEXT: UINT64_C(8), UINT64_C(0), // foo
120+ // ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // unrelated
121+ // ENCODER-NEXT: };
121122// ENCODER-LABEL: static const uint64_t InstBits_ModeA[] = {
122- // ENCODER: UINT64_C(2), UINT64_C(0), // bar
123- // ENCODER: UINT64_C(0), UINT64_C(0), // baz
124- // ENCODER: UINT64_C(12), UINT64_C(0), // foo
125- // ENCODER: UINT64_C(2), UINT64_C(0), // unrelated
123+ // ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // bar
124+ // ENCODER-NEXT: UINT64_C(0), UINT64_C(0), // baz
125+ // ENCODER-NEXT: UINT64_C(12), UINT64_C(0), // foo
126+ // ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // unrelated
127+ // ENCODER-NEXT: };
126128// ENCODER-LABEL: static const uint64_t InstBits_ModeB[] = {
127- // ENCODER: UINT64_C(2), UINT64_C(0), // bar
128- // ENCODER: UINT64_C(12), UINT64_C(0), // baz
129- // ENCODER: UINT64_C(0), UINT64_C(211106232532992), // foo
130- // ENCODER: UINT64_C(2), UINT64_C(0), // unrelated
129+ // ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // bar
130+ // ENCODER-NEXT: UINT64_C(12), UINT64_C(0), // baz
131+ // ENCODER-NEXT: UINT64_C(0), UINT64_C(211106232532992), // foo
132+ // ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // unrelated
133+ // ENCODER-NEXT: };
131134// ENCODER-LABEL: static const uint64_t InstBits_ModeC[] = {
132- // ENCODER: UINT64_C(2), UINT64_C(0), // bar
133- // ENCODER: UINT64_C(0), UINT64_C(0), // baz
134- // ENCODER: UINT64_C(12582915), UINT64_C(0), // foo
135- // ENCODER: UINT64_C(2), UINT64_C(0), // unrelated
136-
135+ // ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // bar
136+ // ENCODER-NEXT: UINT64_C(0), UINT64_C(0), // baz
137+ // ENCODER-NEXT: UINT64_C(12582915), UINT64_C(0), // foo
138+ // ENCODER-NEXT: UINT64_C(2), UINT64_C(0), // unrelated
139+ // ENCODER-NEXT: };
137140
138141// ENCODER: const uint64_t *InstBitsByHw;
142+ // ENCODER: constexpr unsigned FirstSupportedOpcode
139143// ENCODER: const unsigned opcode = MI.getOpcode();
144+ // ENCODER: if (opcode < FirstSupportedOpcode)
145+ // ENCODER: unsigned TableIndex = opcode - FirstSupportedOpcode
140146// ENCODER: if (Scratch.getBitWidth() != 128)
141147// ENCODER: Scratch = Scratch.zext(128);
142- // ENCODER: Inst = APInt(128, ArrayRef(InstBits + opcode * 2, 2));
148+ // ENCODER: Inst = APInt(128, ArrayRef(InstBits + TableIndex * 2, 2));
143149// ENCODER: APInt &Value = Inst;
144150// ENCODER: APInt &op = Scratch;
145151// ENCODER: switch (opcode) {
@@ -155,7 +161,7 @@ def unrelated: Instruction {
155161// ENCODER: case 2: InstBitsByHw = InstBits_ModeB; break;
156162// ENCODER: case 3: InstBitsByHw = InstBits_ModeC; break;
157163// ENCODER: };
158- // ENCODER: Inst = APInt(128, ArrayRef(InstBitsByHw + opcode * 2, 2));
164+ // ENCODER: Inst = APInt(128, ArrayRef(InstBitsByHw + TableIndex * 2, 2));
159165// ENCODER: Value = Inst;
160166// ENCODER: switch (HwMode) {
161167// ENCODER: default: llvm_unreachable("Unhandled HwMode");
@@ -189,7 +195,7 @@ def unrelated: Instruction {
189195// ENCODER: default: llvm_unreachable("Unknown hardware mode!"); break;
190196// ENCODER: case 2: InstBitsByHw = InstBits_ModeB; break;
191197// ENCODER: };
192- // ENCODER: Inst = APInt(128, ArrayRef(InstBitsByHw + opcode * 2, 2));
198+ // ENCODER: Inst = APInt(128, ArrayRef(InstBitsByHw + TableIndex * 2, 2));
193199// ENCODER: Value = Inst;
194200// ENCODER: switch (HwMode) {
195201// ENCODER: default: llvm_unreachable("Unhandled HwMode");
0 commit comments