1 // RUN: llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
2 // RUN: -combiners=MyCombiner %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 InstTest0 : GICombineRule<
13 (match (G_BUILD_VECTOR $a, $b, $c, $d)),
16 def InstTest1 : GICombineRule<
18 (match (G_BUILD_VECTOR $a, $b)),
21 def InstTest2 : GICombineRule<
23 (match (G_UNMERGE_VALUES $a, $b)),
26 def InstTest3 : GICombineRule<
28 (match (G_UNMERGE_VALUES $a, $b, $c, $d)),
31 def MyCombiner: GICombiner<"GenMyCombiner", [
38 // CHECK: const int64_t *GenMyCombiner::getMatchTable() const {
39 // CHECK-NEXT: constexpr static int64_t MatchTable0[] = {
40 // CHECK-NEXT: GIM_SwitchOpcode, /*MI*/0, /*[*/65, 69, /*)*//*default:*//*Label 2*/ 51,
41 // CHECK-NEXT: /*TargetOpcode::G_UNMERGE_VALUES*//*Label 0*/ 9, 0, 0,
42 // CHECK-NEXT: /*TargetOpcode::G_BUILD_VECTOR*//*Label 1*/ 30,
43 // CHECK-NEXT: // Label 0: @9
44 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 3*/ 19, // Rule ID 2 //
45 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule2Enabled,
46 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
47 // CHECK-NEXT: // MIs[0] a
48 // CHECK-NEXT: // No operand predicates
49 // CHECK-NEXT: // MIs[0] b
50 // CHECK-NEXT: // No operand predicates
51 // CHECK-NEXT: // Combiner Rule #2: InstTest2
52 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
53 // CHECK-NEXT: GIR_Done,
54 // CHECK-NEXT: // Label 3: @19
55 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 4*/ 29, // Rule ID 3 //
56 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule3Enabled,
57 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/4,
58 // CHECK-NEXT: // MIs[0] a
59 // CHECK-NEXT: // No operand predicates
60 // CHECK-NEXT: // MIs[0] b
61 // CHECK-NEXT: // No operand predicates
62 // CHECK-NEXT: // MIs[0] c
63 // CHECK-NEXT: // No operand predicates
64 // CHECK-NEXT: // MIs[0] d
65 // CHECK-NEXT: // No operand predicates
66 // CHECK-NEXT: // Combiner Rule #3: InstTest3
67 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
68 // CHECK-NEXT: GIR_Done,
69 // CHECK-NEXT: // Label 4: @29
70 // CHECK-NEXT: GIM_Reject,
71 // CHECK-NEXT: // Label 1: @30
72 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 5*/ 40, // Rule ID 1 //
73 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule1Enabled,
74 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
75 // CHECK-NEXT: // MIs[0] a
76 // CHECK-NEXT: // No operand predicates
77 // CHECK-NEXT: // MIs[0] b
78 // CHECK-NEXT: // No operand predicates
79 // CHECK-NEXT: // Combiner Rule #1: InstTest1
80 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
81 // CHECK-NEXT: GIR_Done,
82 // CHECK-NEXT: // Label 5: @40
83 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 6*/ 50, // Rule ID 0 //
84 // CHECK-NEXT: GIM_CheckSimplePredicate, GICXXPred_Simple_IsRule0Enabled,
85 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/4,
86 // CHECK-NEXT: // MIs[0] a
87 // CHECK-NEXT: // No operand predicates
88 // CHECK-NEXT: // MIs[0] b
89 // CHECK-NEXT: // No operand predicates
90 // CHECK-NEXT: // MIs[0] c
91 // CHECK-NEXT: // No operand predicates
92 // CHECK-NEXT: // MIs[0] d
93 // CHECK-NEXT: // No operand predicates
94 // CHECK-NEXT: // Combiner Rule #0: InstTest0
95 // CHECK-NEXT: GIR_CustomAction, GICXXCustomAction_CombineApplyGICombiner0,
96 // CHECK-NEXT: GIR_Done,
97 // CHECK-NEXT: // Label 6: @50
98 // CHECK-NEXT: GIM_Reject,
99 // CHECK-NEXT: // Label 2: @51
100 // CHECK-NEXT: GIM_Reject,
102 // CHECK-NEXT: return MatchTable0;