1 // RUN: llvm-tblgen %s -gen-global-isel -optimize-match-table=false -I %p/../../include -I %p/Common -o - | FileCheck %s
3 include "llvm/Target/Target.td"
4 include "GlobalISelEmitterCommon.td"
7 def SelectClamp : ComplexPattern<untyped, 2, "SelectClamp">;
8 def SelectOMod : ComplexPattern<untyped, 2, "SelectOMod">;
9 def SelectClampOMod : ComplexPattern<untyped, 3, "SelectClampOMod">;
10 def SelectSrcMods : ComplexPattern<untyped, 2, "SelectSrcMods">;
13 GIComplexOperandMatcher<s32, "selectClamp">,
14 GIComplexPatternEquiv<SelectClamp>;
17 GIComplexOperandMatcher<s32, "selectOMod">,
18 GIComplexPatternEquiv<SelectOMod>;
20 def gi_SelectClampOMod :
21 GIComplexOperandMatcher<s32, "selectClampOMod">,
22 GIComplexPatternEquiv<SelectClampOMod>;
24 def gi_SelectSrcMods :
25 GIComplexOperandMatcher<s32, "selectSrcMods">,
26 GIComplexPatternEquiv<SelectSrcMods>;
29 def src_mods : Operand <i32>;
30 def omod : OperandWithDefaultOps <i32, (ops (i32 0))>;
31 def clamp : OperandWithDefaultOps <i1, (ops (i1 0))>;
34 // CHECK: const uint8_t *MyTargetInstructionSelector::getMatchTable() const {
35 // CHECK-NEXT: constexpr static uint8_t MatchTable0[] = {
36 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 0*/ GIMT_Encode4(79), // Rule ID 3 //
37 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/3,
38 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FMAXNUM),
39 // CHECK-NEXT: // MIs[0] DstI[dst]
40 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
41 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
42 // CHECK-NEXT: // MIs[0] SelectSrcMods:src0:mods0
43 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
44 // CHECK-NEXT: GIM_CheckComplexPattern, /*MI*/0, /*Op*/1, /*Renderer*/GIMT_Encode2(0), GIMT_Encode2(GICP_gi_SelectSrcMods),
45 // CHECK-NEXT: // MIs[0] SelectSrcMods:src1:mods1
46 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/2, /*Type*/GILLT_s32,
47 // CHECK-NEXT: GIM_CheckComplexPattern, /*MI*/0, /*Op*/2, /*Renderer*/GIMT_Encode2(1), GIMT_Encode2(GICP_gi_SelectSrcMods),
48 // CHECK-NEXT: // (fmaxnum:{ *:[f32] } (SelectSrcMods:{ *:[f32] } f32:{ *:[f32] }:$src0, src_mods:{ *:[i32] }:$mods0), (SelectSrcMods:{ *:[f32] } f32:{ *:[f32] }:$src1, src_mods:{ *:[i32] }:$mods1)) => (FMAX:{ *:[f32] } src_mods:{ *:[i32] }:$mods0, f32:{ *:[f32] }:$src0, src_mods:{ *:[i32] }:$mods1, f32:{ *:[f32] }:$src1)
49 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FMAX),
50 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
51 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // mods0
52 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
53 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(1), /*SubOperand*/1, // mods1
54 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(1), /*SubOperand*/0, // src1
55 // CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
56 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
57 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
58 // CHECK-NEXT: // GIR_Coverage, 3,
59 // CHECK-NEXT: GIR_Done,
60 // CHECK-NEXT: // Label 0: @79
61 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 1*/ GIMT_Encode4(139), // Rule ID 2 //
62 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
63 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FFLOOR),
64 // CHECK-NEXT: // MIs[0] DstI[dst]
65 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
66 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
67 // CHECK-NEXT: // MIs[0] SelectClampOMod:src0:omod:clamp
68 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
69 // CHECK-NEXT: GIM_CheckComplexPattern, /*MI*/0, /*Op*/1, /*Renderer*/GIMT_Encode2(0), GIMT_Encode2(GICP_gi_SelectClampOMod),
70 // CHECK-NEXT: // (ffloor:{ *:[f32] } (SelectClampOMod:{ *:[f32] } f32:{ *:[f32] }:$src0, omod:{ *:[i32] }:$omod, i1:{ *:[i1] }:$clamp)) => (FLOMP:{ *:[f32] } f32:{ *:[f32] }:$src0, i1:{ *:[i1] }:$clamp, omod:{ *:[i32] }:$omod)
71 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FLOMP),
72 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
73 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
74 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/2, // clamp
75 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // omod
76 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
77 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
78 // CHECK-NEXT: // GIR_Coverage, 2,
79 // CHECK-NEXT: GIR_Done,
80 // CHECK-NEXT: // Label 1: @139
81 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 2*/ GIMT_Encode4(207), // Rule ID 8 //
82 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
83 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FCANONICALIZE),
84 // CHECK-NEXT: // MIs[0] DstI[dst]
85 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
86 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
87 // CHECK-NEXT: // MIs[0] SelectSrcMods:src:mods
88 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
89 // CHECK-NEXT: GIM_CheckComplexPattern, /*MI*/0, /*Op*/1, /*Renderer*/GIMT_Encode2(0), GIMT_Encode2(GICP_gi_SelectSrcMods),
90 // CHECK-NEXT: // (fcanonicalize:{ *:[f32] } (SelectSrcMods:{ *:[f32] } f32:{ *:[f32] }:$src, i32:{ *:[i32] }:$mods)) => (FMAX:{ *:[f32] } ?:{ *:[i32] }:$mods, ?:{ *:[f32] }:$src, ?:{ *:[i32] }:$mods, ?:{ *:[f32] }:$src, 0:{ *:[i1] })
91 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FMAX),
92 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
93 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // mods
94 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src
95 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // mods
96 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src
97 // CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
98 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
99 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
100 // CHECK-NEXT: // GIR_Coverage, 8,
101 // CHECK-NEXT: GIR_Done,
102 // CHECK-NEXT: // Label 2: @207
103 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 3*/ GIMT_Encode4(265), // Rule ID 5 //
104 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
105 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FCOS),
106 // CHECK-NEXT: // MIs[0] DstI[dst]
107 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
108 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
109 // CHECK-NEXT: // MIs[0] SelectOMod:src0:omod
110 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
111 // CHECK-NEXT: GIM_CheckComplexPattern, /*MI*/0, /*Op*/1, /*Renderer*/GIMT_Encode2(0), GIMT_Encode2(GICP_gi_SelectOMod),
112 // CHECK-NEXT: // (fcos:{ *:[f32] } (SelectOMod:{ *:[f32] } f32:{ *:[f32] }:$src0, i32:{ *:[i32] }:$omod)) => (FLAMP:{ *:[f32] } FPR32:{ *:[f32] }:$src0, omod:{ *:[i32] }:$omod)
113 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FLAMP),
114 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
115 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
116 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // omod
117 // CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
118 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
119 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
120 // CHECK-NEXT: // GIR_Coverage, 5,
121 // CHECK-NEXT: GIR_Done,
122 // CHECK-NEXT: // Label 3: @265
123 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 4*/ GIMT_Encode4(345), // Rule ID 7 //
124 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
125 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FEXP2),
126 // CHECK-NEXT: // MIs[0] DstI[dst]
127 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
128 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
129 // CHECK-NEXT: // MIs[0] SelectClamp:src0:clamp
130 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
131 // CHECK-NEXT: GIM_CheckComplexPattern, /*MI*/0, /*Op*/1, /*Renderer*/GIMT_Encode2(0), GIMT_Encode2(GICP_gi_SelectClamp),
132 // CHECK-NEXT: // (fexp2:{ *:[f32] } (SelectClamp:{ *:[f32] } f32:{ *:[f32] }:$src0, i1:{ *:[i1] }:$clamp)) => (FEEPLE:{ *:[f32] } FPR32:{ *:[f32] }:$src0, (FFOO:{ *:[f32] } FPR32:{ *:[f32] }:$src0), clamp:{ *:[i1] }:$clamp)
133 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
134 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/1, /*Opcode*/GIMT_Encode2(MyTarget::FFOO),
135 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/1, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(RegState::Define),
136 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/1, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
137 // CHECK-NEXT: GIR_AddImm8, /*InsnID*/1, /*Imm*/0,
138 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/1,
139 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FEEPLE),
140 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
141 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
142 // CHECK-NEXT: GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
143 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // clamp
144 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
145 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
146 // CHECK-NEXT: // GIR_Coverage, 7,
147 // CHECK-NEXT: GIR_Done,
148 // CHECK-NEXT: // Label 4: @345
149 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 5*/ GIMT_Encode4(400), // Rule ID 0 //
150 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
151 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FSIN),
152 // CHECK-NEXT: // MIs[0] DstI[dst]
153 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
154 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
155 // CHECK-NEXT: // MIs[0] SelectClamp:src0:clamp
156 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
157 // CHECK-NEXT: GIM_CheckComplexPattern, /*MI*/0, /*Op*/1, /*Renderer*/GIMT_Encode2(0), GIMT_Encode2(GICP_gi_SelectClamp),
158 // CHECK-NEXT: // (fsin:{ *:[f32] } (SelectClamp:{ *:[f32] } f32:{ *:[f32] }:$src0, i1:{ *:[i1] }:$clamp)) => (FFOO:{ *:[f32] } f32:{ *:[f32] }:$src0, i1:{ *:[i1] }:$clamp)
159 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FFOO),
160 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
161 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
162 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // clamp
163 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
164 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
165 // CHECK-NEXT: // GIR_Coverage, 0,
166 // CHECK-NEXT: GIR_Done,
167 // CHECK-NEXT: // Label 5: @400
168 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 6*/ GIMT_Encode4(458), // Rule ID 6 //
169 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
170 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_FSQRT),
171 // CHECK-NEXT: // MIs[0] DstI[dst]
172 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
173 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
174 // CHECK-NEXT: // MIs[0] SelectClamp:src0:clamp
175 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
176 // CHECK-NEXT: GIM_CheckComplexPattern, /*MI*/0, /*Op*/1, /*Renderer*/GIMT_Encode2(0), GIMT_Encode2(GICP_gi_SelectClamp),
177 // CHECK-NEXT: // (fsqrt:{ *:[f32] } (SelectClamp:{ *:[f32] } f32:{ *:[f32] }:$src0, i1:{ *:[i1] }:$clamp)) => (FLAMP:{ *:[f32] } FPR32:{ *:[f32] }:$src0, 93:{ *:[i32] }, clamp:{ *:[i1] }:$clamp)
178 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FLAMP),
179 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
180 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/0, // src0
181 // CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/93,
182 // CHECK-NEXT: GIR_ComplexSubOperandRenderer, /*InsnID*/0, /*RendererID*/GIMT_Encode2(0), /*SubOperand*/1, // clamp
183 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
184 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
185 // CHECK-NEXT: // GIR_Coverage, 6,
186 // CHECK-NEXT: GIR_Done,
187 // CHECK-NEXT: // Label 6: @458
188 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 7*/ GIMT_Encode4(503), // Rule ID 1 //
189 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
190 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_INTRINSIC_ROUND),
191 // CHECK-NEXT: // MIs[0] DstI[dst]
192 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
193 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
194 // CHECK-NEXT: // MIs[0] src0
195 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
196 // CHECK-NEXT: // (fround:{ *:[f32] } f32:{ *:[f32] }:$src0) => (FBAR:{ *:[f32] } f32:{ *:[f32] }:$src0)
197 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FBAR),
198 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
199 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src0
200 // CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
201 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
202 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
203 // CHECK-NEXT: // GIR_Coverage, 1,
204 // CHECK-NEXT: GIR_Done,
205 // CHECK-NEXT: // Label 7: @503
206 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 8*/ GIMT_Encode4(548), // Rule ID 4 //
207 // CHECK-NEXT: GIM_CheckNumOperands, /*MI*/0, /*Expected*/2,
208 // CHECK-NEXT: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_INTRINSIC_TRUNC),
209 // CHECK-NEXT: // MIs[0] DstI[dst]
210 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/0, /*Type*/GILLT_s32,
211 // CHECK-NEXT: GIM_CheckRegBankForClass, /*MI*/0, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::FPR32RegClassID),
212 // CHECK-NEXT: // MIs[0] src0
213 // CHECK-NEXT: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
214 // CHECK-NEXT: // (ftrunc:{ *:[f32] } f32:{ *:[f32] }:$src0) => (FFOO:{ *:[f32] } FPR32:{ *:[f32] }:$src0)
215 // CHECK-NEXT: GIR_BuildMI, /*InsnID*/0, /*Opcode*/GIMT_Encode2(MyTarget::FFOO),
216 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/0, // DstI[dst]
217 // CHECK-NEXT: GIR_Copy, /*NewInsnID*/0, /*OldInsnID*/0, /*OpIdx*/1, // src0
218 // CHECK-NEXT: GIR_AddImm8, /*InsnID*/0, /*Imm*/0,
219 // CHECK-NEXT: GIR_ConstrainSelectedInstOperands, /*InsnID*/0,
220 // CHECK-NEXT: GIR_EraseFromParent, /*InsnID*/0,
221 // CHECK-NEXT: // GIR_Coverage, 4,
222 // CHECK-NEXT: GIR_Done,
223 // CHECK-NEXT: // Label 8: @548
224 // CHECK-NEXT: GIM_Reject,
225 // CHECK-NEXT: }; // Size: 549 bytes
226 // CHECK-NEXT: return MatchTable0;
229 // Have default operand with explicit value from complex pattern.
230 def FFOO : I<(outs FPR32:$dst), (ins FPR32:$src0, clamp:$clamp),
231 [(set FPR32:$dst, (fsin (SelectClamp f32:$src0, i1:$clamp)))]>;
234 // Have default operand, not explicitly specified in a standalone
241 // Have default operand, not explicitly specified in an instruction
242 // definition pattern.
243 def FBAR : I<(outs FPR32:$dst), (ins FPR32:$src0, clamp:$clamp),
244 [(set FPR32:$dst, (fround f32:$src0))]>;
247 // // Swapped order in instruction from pattern
249 (outs FPR32:$dst), (ins FPR32:$src0, clamp:$clamp, omod:$omod),
250 [(set FPR32:$dst, (ffloor (SelectClampOMod f32:$src0, omod:$omod, i1:$clamp)))]>;
252 def FLAMP : I<(outs FPR32:$dst), (ins FPR32:$src0, omod:$omod, clamp:$clamp), []>;
254 // // Have 2 default operands, and the first is specified
256 (fcos (SelectOMod f32:$src0, i32:$omod)),
257 (FLAMP FPR32:$src0, omod:$omod)
260 // Immediate used for first defaulted operand
262 (fsqrt (SelectClamp f32:$src0, i1:$clamp)),
263 (FLAMP FPR32:$src0, 93, clamp:$clamp)
266 def FEEPLE : I<(outs FPR32:$dst),
267 (ins FPR32:$src0, FPR32:$src1, clamp:$clamp), []>;
269 // Default operand isn't on the root ouput instruction
271 (fexp2 (SelectClamp f32:$src0, i1:$clamp)),
272 (FEEPLE FPR32:$src0, (FFOO FPR32:$src0), clamp:$clamp)
275 // Same instruction is used in two different pattern contexts, one
276 // uses the default and one does not.
277 def FMAX : I<(outs FPR32:$dst),
278 (ins src_mods:$mods0, FPR32:$src0, src_mods:$mods1, FPR32:$src1, clamp:$clamp),
279 [(set FPR32:$dst, (f32 (fmaxnum (SelectSrcMods f32:$src0, src_mods:$mods0),
280 (SelectSrcMods f32:$src1, src_mods:$mods1))))]
284 (fcanonicalize (f32 (SelectSrcMods f32:$src, i32:$mods))),
285 (FMAX $mods, $src, $mods, $src, 0)