1 // RUN: llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
2 // RUN: -combiners=MyCombiner -gicombiner-debug-cxxpreds %s | \
5 include "llvm/Target/Target.td"
6 include "llvm/Target/GlobalISel/Combine.td"
8 def MyTargetISA : InstrInfo;
9 def MyTarget : Target { let InstructionSet = MyTargetISA; }
11 def MatchFooPerms: GICombinePatFrag<
15 (pattern (G_ZEXT $foo, $b), (G_TRUNC $b, $x):$dbg0, "return foo(${x}, ${cst})"),
16 (pattern (G_TRUNC $foo, $z):$dbg1, "return bar(${foo}, ${cst})")
19 def Test0 : GICombineRule<
21 (match (G_AND $dst, $cst0, $tmp),
22 (G_AND $tmp, $cst1, $cst2),
23 (MatchFooPerms $cst0, (i32 10)):$a,
24 (MatchFooPerms $cst1, (i32 20)):$b,
25 (MatchFooPerms $cst2, (i32 30)):$c
27 (apply (COPY $dst, (i32 0)), "APPLY ${cst0}")>;
29 def MyCombiner: GICombiner<"GenMyCombiner", [
33 // CHECK: bool GenMyCombiner::testMIPredicate_MI(unsigned PredicateID, const MachineInstr & MI, const MatcherState &State) const {
34 // CHECK-NEXT: switch (PredicateID) {
35 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner0: {
36 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[0], c[0]]
37 // CHECK-NEXT: return foo(State.MIs[2]->getOperand(1), 10)
38 // CHECK-NEXT: llvm_unreachable("GICombiner0 should have returned");
40 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner1: {
41 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[0], c[0]]
42 // CHECK-NEXT: return foo(State.MIs[5]->getOperand(1), 20)
43 // CHECK-NEXT: llvm_unreachable("GICombiner1 should have returned");
45 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner2: {
46 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[0], c[0]]
47 // CHECK-NEXT: return foo(State.MIs[7]->getOperand(1), 30)
48 // CHECK-NEXT: llvm_unreachable("GICombiner2 should have returned");
50 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner3: {
51 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[0], c[1]]
52 // CHECK-NEXT: return foo(State.MIs[2]->getOperand(1), 10)
53 // CHECK-NEXT: llvm_unreachable("GICombiner3 should have returned");
55 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner4: {
56 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[0], c[1]]
57 // CHECK-NEXT: return foo(State.MIs[5]->getOperand(1), 20)
58 // CHECK-NEXT: llvm_unreachable("GICombiner4 should have returned");
60 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner5: {
61 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[0], c[1]]
62 // CHECK-NEXT: return bar(State.MIs[3]->getOperand(2), 30)
63 // CHECK-NEXT: llvm_unreachable("GICombiner5 should have returned");
65 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner6: {
66 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[1], c[0]]
67 // CHECK-NEXT: return foo(State.MIs[2]->getOperand(1), 10)
68 // CHECK-NEXT: llvm_unreachable("GICombiner6 should have returned");
70 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner7: {
71 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[1], c[0]]
72 // CHECK-NEXT: return bar(State.MIs[3]->getOperand(1), 20)
73 // CHECK-NEXT: llvm_unreachable("GICombiner7 should have returned");
75 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner8: {
76 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[1], c[0]]
77 // CHECK-NEXT: return foo(State.MIs[6]->getOperand(1), 30)
78 // CHECK-NEXT: llvm_unreachable("GICombiner8 should have returned");
80 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner9: {
81 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[1], c[1]]
82 // CHECK-NEXT: return foo(State.MIs[2]->getOperand(1), 10)
83 // CHECK-NEXT: llvm_unreachable("GICombiner9 should have returned");
85 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner10: {
86 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[1], c[1]]
87 // CHECK-NEXT: return bar(State.MIs[3]->getOperand(1), 20)
88 // CHECK-NEXT: llvm_unreachable("GICombiner10 should have returned");
90 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner11: {
91 // CHECK-NEXT: // Pattern Alternatives: [a[0], b[1], c[1]]
92 // CHECK-NEXT: return bar(State.MIs[3]->getOperand(2), 30)
93 // CHECK-NEXT: llvm_unreachable("GICombiner11 should have returned");
95 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner12: {
96 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[0], c[0]]
97 // CHECK-NEXT: return bar(State.MIs[0]->getOperand(1), 10)
98 // CHECK-NEXT: llvm_unreachable("GICombiner12 should have returned");
100 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner13: {
101 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[0], c[0]]
102 // CHECK-NEXT: return foo(State.MIs[4]->getOperand(1), 20)
103 // CHECK-NEXT: llvm_unreachable("GICombiner13 should have returned");
105 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner14: {
106 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[0], c[0]]
107 // CHECK-NEXT: return foo(State.MIs[6]->getOperand(1), 30)
108 // CHECK-NEXT: llvm_unreachable("GICombiner14 should have returned");
110 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner15: {
111 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[0], c[1]]
112 // CHECK-NEXT: return bar(State.MIs[0]->getOperand(1), 10)
113 // CHECK-NEXT: llvm_unreachable("GICombiner15 should have returned");
115 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner16: {
116 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[0], c[1]]
117 // CHECK-NEXT: return foo(State.MIs[4]->getOperand(1), 20)
118 // CHECK-NEXT: llvm_unreachable("GICombiner16 should have returned");
120 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner17: {
121 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[0], c[1]]
122 // CHECK-NEXT: return bar(State.MIs[3]->getOperand(2), 30)
123 // CHECK-NEXT: llvm_unreachable("GICombiner17 should have returned");
125 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner18: {
126 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[1], c[0]]
127 // CHECK-NEXT: return bar(State.MIs[0]->getOperand(1), 10)
128 // CHECK-NEXT: llvm_unreachable("GICombiner18 should have returned");
130 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner19: {
131 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[1], c[0]]
132 // CHECK-NEXT: return bar(State.MIs[3]->getOperand(1), 20)
133 // CHECK-NEXT: llvm_unreachable("GICombiner19 should have returned");
135 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner20: {
136 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[1], c[0]]
137 // CHECK-NEXT: return foo(State.MIs[5]->getOperand(1), 30)
138 // CHECK-NEXT: llvm_unreachable("GICombiner20 should have returned");
140 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner21: {
141 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[1], c[1]]
142 // CHECK-NEXT: return bar(State.MIs[0]->getOperand(1), 10)
143 // CHECK-NEXT: llvm_unreachable("GICombiner21 should have returned");
145 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner22: {
146 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[1], c[1]]
147 // CHECK-NEXT: return bar(State.MIs[3]->getOperand(1), 20)
148 // CHECK-NEXT: llvm_unreachable("GICombiner22 should have returned");
150 // CHECK-NEXT: case GICXXPred_MI_Predicate_GICombiner23: {
151 // CHECK-NEXT: // Pattern Alternatives: [a[1], b[1], c[1]]
152 // CHECK-NEXT: return bar(State.MIs[3]->getOperand(2), 30)
153 // CHECK-NEXT: llvm_unreachable("GICombiner23 should have returned");
156 // CHECK-NEXT: llvm_unreachable("Unknown predicate");
157 // CHECK-NEXT: return false;
160 // CHECK: const int64_t *GenMyCombiner::getMatchTable() const {
161 // CHECK-NEXT: constexpr static int64_t MatchTable0[] = {
162 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 0*/ 682,
163 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, TargetOpcode::G_AND,
164 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 1*/ 76, // Rule ID 7 //
165 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
166 // CHECK-NEXT: // MIs[0] dst
167 // CHECK-NEXT: // No operand predicates
168 // CHECK-NEXT: // MIs[0] cst0
169 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
170 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_TRUNC,
171 // CHECK-NEXT: // MIs[1] a.z
172 // CHECK-NEXT: // No operand predicates
173 // CHECK-NEXT: // MIs[0] tmp
174 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/0, /*OpIdx*/2, // MIs[2]
175 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_AND,
176 // CHECK-NEXT: // MIs[2] cst1
177 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/3, /*MI*/2, /*OpIdx*/1, // MIs[3]
178 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/3, TargetOpcode::G_TRUNC,
179 // CHECK-NEXT: // MIs[3] b.z
180 // CHECK-NEXT: // No operand predicates
181 // CHECK-NEXT: // MIs[2] cst2
182 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/4, /*MI*/2, /*OpIdx*/2, // MIs[4]
183 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/4, TargetOpcode::G_TRUNC,
184 // CHECK-NEXT: // MIs[4] c.z
185 // CHECK-NEXT: // No operand predicates
186 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner21,
187 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner22,
188 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner23,
189 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/1,
190 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/2,
191 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/3,
192 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/4,
193 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
194 // CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/0,
195 // CHECK-NEXT: // Combiner Rule #0: Test0 @ [a[1], b[1], c[1]]
196 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/TargetOpcode::COPY,
197 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
198 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/0,
199 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
200 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
201 // CHECK-NEXT: GIR_Done,
202 // CHECK-NEXT: // Label 1: @76
203 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 2*/ 156, // Rule ID 6 //
204 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
205 // CHECK-NEXT: // MIs[0] dst
206 // CHECK-NEXT: // No operand predicates
207 // CHECK-NEXT: // MIs[0] cst0
208 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
209 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_TRUNC,
210 // CHECK-NEXT: // MIs[1] a.z
211 // CHECK-NEXT: // No operand predicates
212 // CHECK-NEXT: // MIs[0] tmp
213 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/0, /*OpIdx*/2, // MIs[2]
214 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_AND,
215 // CHECK-NEXT: // MIs[2] cst1
216 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/3, /*MI*/2, /*OpIdx*/1, // MIs[3]
217 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/3, TargetOpcode::G_TRUNC,
218 // CHECK-NEXT: // MIs[3] b.z
219 // CHECK-NEXT: // No operand predicates
220 // CHECK-NEXT: // MIs[2] cst2
221 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/4, /*MI*/2, /*OpIdx*/2, // MIs[4]
222 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/4, TargetOpcode::G_ZEXT,
223 // CHECK-NEXT: // MIs[4] c.b
224 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/5, /*MI*/4, /*OpIdx*/1, // MIs[5]
225 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/5, TargetOpcode::G_TRUNC,
226 // CHECK-NEXT: // MIs[5] c.x
227 // CHECK-NEXT: // No operand predicates
228 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner18,
229 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner19,
230 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner20,
231 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/1,
232 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/2,
233 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/3,
234 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/4,
235 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/5,
236 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
237 // CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/0,
238 // CHECK-NEXT: // Combiner Rule #0: Test0 @ [a[1], b[1], c[0]]
239 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/TargetOpcode::COPY,
240 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
241 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/0,
242 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
243 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
244 // CHECK-NEXT: GIR_Done,
245 // CHECK-NEXT: // Label 2: @156
246 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 3*/ 236, // Rule ID 5 //
247 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
248 // CHECK-NEXT: // MIs[0] dst
249 // CHECK-NEXT: // No operand predicates
250 // CHECK-NEXT: // MIs[0] cst0
251 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
252 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_TRUNC,
253 // CHECK-NEXT: // MIs[1] a.z
254 // CHECK-NEXT: // No operand predicates
255 // CHECK-NEXT: // MIs[0] tmp
256 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/0, /*OpIdx*/2, // MIs[2]
257 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_AND,
258 // CHECK-NEXT: // MIs[2] cst1
259 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/3, /*MI*/2, /*OpIdx*/1, // MIs[3]
260 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/3, TargetOpcode::G_ZEXT,
261 // CHECK-NEXT: // MIs[3] b.b
262 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/4, /*MI*/3, /*OpIdx*/1, // MIs[4]
263 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/4, TargetOpcode::G_TRUNC,
264 // CHECK-NEXT: // MIs[4] b.x
265 // CHECK-NEXT: // No operand predicates
266 // CHECK-NEXT: // MIs[2] cst2
267 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/5, /*MI*/2, /*OpIdx*/2, // MIs[5]
268 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/5, TargetOpcode::G_TRUNC,
269 // CHECK-NEXT: // MIs[5] c.z
270 // CHECK-NEXT: // No operand predicates
271 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner15,
272 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner16,
273 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner17,
274 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/1,
275 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/2,
276 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/3,
277 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/4,
278 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/5,
279 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
280 // CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/0,
281 // CHECK-NEXT: // Combiner Rule #0: Test0 @ [a[1], b[0], c[1]]
282 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/TargetOpcode::COPY,
283 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
284 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/0,
285 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
286 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
287 // CHECK-NEXT: GIR_Done,
288 // CHECK-NEXT: // Label 3: @236
289 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 4*/ 325, // Rule ID 4 //
290 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
291 // CHECK-NEXT: // MIs[0] dst
292 // CHECK-NEXT: // No operand predicates
293 // CHECK-NEXT: // MIs[0] cst0
294 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
295 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_TRUNC,
296 // CHECK-NEXT: // MIs[1] a.z
297 // CHECK-NEXT: // No operand predicates
298 // CHECK-NEXT: // MIs[0] tmp
299 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/0, /*OpIdx*/2, // MIs[2]
300 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_AND,
301 // CHECK-NEXT: // MIs[2] cst1
302 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/3, /*MI*/2, /*OpIdx*/1, // MIs[3]
303 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/3, TargetOpcode::G_ZEXT,
304 // CHECK-NEXT: // MIs[3] b.b
305 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/4, /*MI*/3, /*OpIdx*/1, // MIs[4]
306 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/4, TargetOpcode::G_TRUNC,
307 // CHECK-NEXT: // MIs[4] b.x
308 // CHECK-NEXT: // No operand predicates
309 // CHECK-NEXT: // MIs[2] cst2
310 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/5, /*MI*/2, /*OpIdx*/2, // MIs[5]
311 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/5, TargetOpcode::G_ZEXT,
312 // CHECK-NEXT: // MIs[5] c.b
313 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/6, /*MI*/5, /*OpIdx*/1, // MIs[6]
314 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/6, TargetOpcode::G_TRUNC,
315 // CHECK-NEXT: // MIs[6] c.x
316 // CHECK-NEXT: // No operand predicates
317 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner12,
318 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner13,
319 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner14,
320 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/1,
321 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/2,
322 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/3,
323 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/4,
324 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/5,
325 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/6,
326 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
327 // CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/0,
328 // CHECK-NEXT: // Combiner Rule #0: Test0 @ [a[1], b[0], c[0]]
329 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/TargetOpcode::COPY,
330 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
331 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/0,
332 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
333 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
334 // CHECK-NEXT: GIR_Done,
335 // CHECK-NEXT: // Label 4: @325
336 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 5*/ 405, // Rule ID 3 //
337 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
338 // CHECK-NEXT: // MIs[0] dst
339 // CHECK-NEXT: // No operand predicates
340 // CHECK-NEXT: // MIs[0] cst0
341 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
342 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_ZEXT,
343 // CHECK-NEXT: // MIs[1] a.b
344 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/1, /*OpIdx*/1, // MIs[2]
345 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_TRUNC,
346 // CHECK-NEXT: // MIs[2] a.x
347 // CHECK-NEXT: // No operand predicates
348 // CHECK-NEXT: // MIs[0] tmp
349 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/3, /*MI*/0, /*OpIdx*/2, // MIs[3]
350 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/3, TargetOpcode::G_AND,
351 // CHECK-NEXT: // MIs[3] cst1
352 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/4, /*MI*/3, /*OpIdx*/1, // MIs[4]
353 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/4, TargetOpcode::G_TRUNC,
354 // CHECK-NEXT: // MIs[4] b.z
355 // CHECK-NEXT: // No operand predicates
356 // CHECK-NEXT: // MIs[3] cst2
357 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/5, /*MI*/3, /*OpIdx*/2, // MIs[5]
358 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/5, TargetOpcode::G_TRUNC,
359 // CHECK-NEXT: // MIs[5] c.z
360 // CHECK-NEXT: // No operand predicates
361 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner9,
362 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner10,
363 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner11,
364 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/1,
365 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/2,
366 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/3,
367 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/4,
368 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/5,
369 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
370 // CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/0,
371 // CHECK-NEXT: // Combiner Rule #0: Test0 @ [a[0], b[1], c[1]]
372 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/TargetOpcode::COPY,
373 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
374 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/0,
375 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
376 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
377 // CHECK-NEXT: GIR_Done,
378 // CHECK-NEXT: // Label 5: @405
379 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 6*/ 494, // Rule ID 2 //
380 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
381 // CHECK-NEXT: // MIs[0] dst
382 // CHECK-NEXT: // No operand predicates
383 // CHECK-NEXT: // MIs[0] cst0
384 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
385 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_ZEXT,
386 // CHECK-NEXT: // MIs[1] a.b
387 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/1, /*OpIdx*/1, // MIs[2]
388 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_TRUNC,
389 // CHECK-NEXT: // MIs[2] a.x
390 // CHECK-NEXT: // No operand predicates
391 // CHECK-NEXT: // MIs[0] tmp
392 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/3, /*MI*/0, /*OpIdx*/2, // MIs[3]
393 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/3, TargetOpcode::G_AND,
394 // CHECK-NEXT: // MIs[3] cst1
395 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/4, /*MI*/3, /*OpIdx*/1, // MIs[4]
396 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/4, TargetOpcode::G_TRUNC,
397 // CHECK-NEXT: // MIs[4] b.z
398 // CHECK-NEXT: // No operand predicates
399 // CHECK-NEXT: // MIs[3] cst2
400 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/5, /*MI*/3, /*OpIdx*/2, // MIs[5]
401 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/5, TargetOpcode::G_ZEXT,
402 // CHECK-NEXT: // MIs[5] c.b
403 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/6, /*MI*/5, /*OpIdx*/1, // MIs[6]
404 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/6, TargetOpcode::G_TRUNC,
405 // CHECK-NEXT: // MIs[6] c.x
406 // CHECK-NEXT: // No operand predicates
407 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner6,
408 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner7,
409 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner8,
410 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/1,
411 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/2,
412 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/3,
413 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/4,
414 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/5,
415 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/6,
416 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
417 // CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/0,
418 // CHECK-NEXT: // Combiner Rule #0: Test0 @ [a[0], b[1], c[0]]
419 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/TargetOpcode::COPY,
420 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
421 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/0,
422 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
423 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
424 // CHECK-NEXT: GIR_Done,
425 // CHECK-NEXT: // Label 6: @494
426 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ 583, // Rule ID 1 //
427 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
428 // CHECK-NEXT: // MIs[0] dst
429 // CHECK-NEXT: // No operand predicates
430 // CHECK-NEXT: // MIs[0] cst0
431 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
432 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_ZEXT,
433 // CHECK-NEXT: // MIs[1] a.b
434 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/1, /*OpIdx*/1, // MIs[2]
435 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_TRUNC,
436 // CHECK-NEXT: // MIs[2] a.x
437 // CHECK-NEXT: // No operand predicates
438 // CHECK-NEXT: // MIs[0] tmp
439 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/3, /*MI*/0, /*OpIdx*/2, // MIs[3]
440 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/3, TargetOpcode::G_AND,
441 // CHECK-NEXT: // MIs[3] cst1
442 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/4, /*MI*/3, /*OpIdx*/1, // MIs[4]
443 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/4, TargetOpcode::G_ZEXT,
444 // CHECK-NEXT: // MIs[4] b.b
445 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/5, /*MI*/4, /*OpIdx*/1, // MIs[5]
446 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/5, TargetOpcode::G_TRUNC,
447 // CHECK-NEXT: // MIs[5] b.x
448 // CHECK-NEXT: // No operand predicates
449 // CHECK-NEXT: // MIs[3] cst2
450 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/6, /*MI*/3, /*OpIdx*/2, // MIs[6]
451 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/6, TargetOpcode::G_TRUNC,
452 // CHECK-NEXT: // MIs[6] c.z
453 // CHECK-NEXT: // No operand predicates
454 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner3,
455 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner4,
456 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner5,
457 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/1,
458 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/2,
459 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/3,
460 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/4,
461 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/5,
462 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/6,
463 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
464 // CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/0,
465 // CHECK-NEXT: // Combiner Rule #0: Test0 @ [a[0], b[0], c[1]]
466 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/TargetOpcode::COPY,
467 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
468 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/0,
469 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
470 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
471 // CHECK-NEXT: GIR_Done,
472 // CHECK-NEXT: // Label 7: @583
473 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ 681, // Rule ID 0 //
474 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
475 // CHECK-NEXT: // MIs[0] dst
476 // CHECK-NEXT: // No operand predicates
477 // CHECK-NEXT: // MIs[0] cst0
478 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
479 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/1, TargetOpcode::G_ZEXT,
480 // CHECK-NEXT: // MIs[1] a.b
481 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/2, /*MI*/1, /*OpIdx*/1, // MIs[2]
482 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/2, TargetOpcode::G_TRUNC,
483 // CHECK-NEXT: // MIs[2] a.x
484 // CHECK-NEXT: // No operand predicates
485 // CHECK-NEXT: // MIs[0] tmp
486 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/3, /*MI*/0, /*OpIdx*/2, // MIs[3]
487 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/3, TargetOpcode::G_AND,
488 // CHECK-NEXT: // MIs[3] cst1
489 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/4, /*MI*/3, /*OpIdx*/1, // MIs[4]
490 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/4, TargetOpcode::G_ZEXT,
491 // CHECK-NEXT: // MIs[4] b.b
492 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/5, /*MI*/4, /*OpIdx*/1, // MIs[5]
493 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/5, TargetOpcode::G_TRUNC,
494 // CHECK-NEXT: // MIs[5] b.x
495 // CHECK-NEXT: // No operand predicates
496 // CHECK-NEXT: // MIs[3] cst2
497 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/6, /*MI*/3, /*OpIdx*/2, // MIs[6]
498 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/6, TargetOpcode::G_ZEXT,
499 // CHECK-NEXT: // MIs[6] c.b
500 // CHECK-NEXT: GIM_RecordInsnIgnoreCopies, /*DefineMI*/7, /*MI*/6, /*OpIdx*/1, // MIs[7]
501 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/7, TargetOpcode::G_TRUNC,
502 // CHECK-NEXT: // MIs[7] c.x
503 // CHECK-NEXT: // No operand predicates
504 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner0,
505 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner1,
506 // CHECK-NEXT: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GICXXPred_MI_Predicate_GICombiner2,
507 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/1,
508 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/2,
509 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/3,
510 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/4,
511 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/5,
512 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/6,
513 // CHECK-NEXT: GIM_CheckIsSafeToFold, /*InsnID*/7,
514 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
515 // CHECK-NEXT: GIR_BuildConstant, /*TempRegID*/0, /*Val*/0,
516 // CHECK-NEXT: // Combiner Rule #0: Test0 @ [a[0], b[0], c[0]]
517 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/TargetOpcode::COPY,
518 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // dst
519 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/0,
520 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
521 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
522 // CHECK-NEXT: GIR_Done,
523 // CHECK-NEXT: // Label 8: @681
524 // CHECK-NEXT: GIM_Reject,
525 // CHECK-NEXT: // Label 0: @682
526 // CHECK-NEXT: GIM_Reject,
528 // CHECK-NEXT: return MatchTable0;