blob: 666e1580918ee2e94ff9fe37053e851cd8299aea [file] [log] [blame]
Tom Stellardf98f2ce2012-12-11 21:25:42 +00001//===-- AMDGPUISelLowering.cpp - AMDGPU Common DAG lowering functions -----===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10/// \file
11/// \brief This is the parent TargetLowering class for hardware code gen
12/// targets.
13//
14//===----------------------------------------------------------------------===//
15
16#include "AMDGPUISelLowering.h"
Tom Stellarde7397ee2013-06-03 17:40:11 +000017#include "AMDGPU.h"
Christian Konig90c64cb2013-03-07 09:03:52 +000018#include "AMDGPURegisterInfo.h"
Christian Konig90c64cb2013-03-07 09:03:52 +000019#include "AMDGPUSubtarget.h"
Benjamin Kramer5c352902013-05-23 17:10:37 +000020#include "AMDILIntrinsicInfo.h"
Tom Stellarde7397ee2013-06-03 17:40:11 +000021#include "SIMachineFunctionInfo.h"
Christian Konig90c64cb2013-03-07 09:03:52 +000022#include "llvm/CodeGen/CallingConvLower.h"
Tom Stellardf98f2ce2012-12-11 21:25:42 +000023#include "llvm/CodeGen/MachineFunction.h"
24#include "llvm/CodeGen/MachineRegisterInfo.h"
25#include "llvm/CodeGen/SelectionDAG.h"
26#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
Tom Stellarde3d4cbc2013-06-28 15:47:08 +000027#include "llvm/IR/DataLayout.h"
Tom Stellardf98f2ce2012-12-11 21:25:42 +000028
29using namespace llvm;
30
Christian Konig90c64cb2013-03-07 09:03:52 +000031#include "AMDGPUGenCallingConv.inc"
32
Tom Stellardf98f2ce2012-12-11 21:25:42 +000033AMDGPUTargetLowering::AMDGPUTargetLowering(TargetMachine &TM) :
34 TargetLowering(TM, new TargetLoweringObjectFileELF()) {
35
36 // Initialize target lowering borrowed from AMDIL
37 InitAMDILLowering();
38
39 // We need to custom lower some of the intrinsics
40 setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom);
41
42 // Library functions. These default to Expand, but we have instructions
43 // for them.
44 setOperationAction(ISD::FCEIL, MVT::f32, Legal);
45 setOperationAction(ISD::FEXP2, MVT::f32, Legal);
46 setOperationAction(ISD::FPOW, MVT::f32, Legal);
47 setOperationAction(ISD::FLOG2, MVT::f32, Legal);
48 setOperationAction(ISD::FABS, MVT::f32, Legal);
49 setOperationAction(ISD::FFLOOR, MVT::f32, Legal);
50 setOperationAction(ISD::FRINT, MVT::f32, Legal);
51
Tom Stellardba534c22013-05-20 15:02:19 +000052 // The hardware supports ROTR, but not ROTL
53 setOperationAction(ISD::ROTL, MVT::i32, Expand);
54
Tom Stellardf98f2ce2012-12-11 21:25:42 +000055 // Lower floating point store/load to integer store/load to reduce the number
56 // of patterns in tablegen.
57 setOperationAction(ISD::STORE, MVT::f32, Promote);
58 AddPromotedToType(ISD::STORE, MVT::f32, MVT::i32);
59
Tom Stellardfc047272013-07-18 21:43:42 +000060 setOperationAction(ISD::STORE, MVT::v2f32, Promote);
61 AddPromotedToType(ISD::STORE, MVT::v2f32, MVT::v2i32);
62
Tom Stellardf98f2ce2012-12-11 21:25:42 +000063 setOperationAction(ISD::STORE, MVT::v4f32, Promote);
64 AddPromotedToType(ISD::STORE, MVT::v4f32, MVT::v4i32);
65
Tom Stellard68e13282013-07-12 18:14:56 +000066 setOperationAction(ISD::STORE, MVT::f64, Promote);
67 AddPromotedToType(ISD::STORE, MVT::f64, MVT::i64);
68
Tom Stellardf98f2ce2012-12-11 21:25:42 +000069 setOperationAction(ISD::LOAD, MVT::f32, Promote);
70 AddPromotedToType(ISD::LOAD, MVT::f32, MVT::i32);
71
72 setOperationAction(ISD::LOAD, MVT::v4f32, Promote);
73 AddPromotedToType(ISD::LOAD, MVT::v4f32, MVT::v4i32);
74
Tom Stellard68e13282013-07-12 18:14:56 +000075 setOperationAction(ISD::LOAD, MVT::f64, Promote);
76 AddPromotedToType(ISD::LOAD, MVT::f64, MVT::i64);
77
Christian Konig45b14e32013-03-27 09:12:51 +000078 setOperationAction(ISD::MUL, MVT::i64, Expand);
79
Tom Stellardf98f2ce2012-12-11 21:25:42 +000080 setOperationAction(ISD::UDIV, MVT::i32, Expand);
81 setOperationAction(ISD::UDIVREM, MVT::i32, Custom);
82 setOperationAction(ISD::UREM, MVT::i32, Expand);
Tom Stellardf5660aa2013-07-18 21:43:35 +000083 setOperationAction(ISD::VSELECT, MVT::v2f32, Expand);
84 setOperationAction(ISD::VSELECT, MVT::v4f32, Expand);
Aaron Watryf97c7fe2013-06-25 13:55:57 +000085
Craig Topper787e71d2013-07-15 06:39:13 +000086 static const int types[] = {
Aaron Watryf97c7fe2013-06-25 13:55:57 +000087 (int)MVT::v2i32,
88 (int)MVT::v4i32
89 };
Craig Topperb9df53a2013-07-15 04:27:47 +000090 const size_t NumTypes = array_lengthof(types);
Aaron Watryf97c7fe2013-06-25 13:55:57 +000091
92 for (unsigned int x = 0; x < NumTypes; ++x) {
93 MVT::SimpleValueType VT = (MVT::SimpleValueType)types[x];
94 //Expand the following operations for the current type by default
95 setOperationAction(ISD::ADD, VT, Expand);
96 setOperationAction(ISD::AND, VT, Expand);
97 setOperationAction(ISD::MUL, VT, Expand);
98 setOperationAction(ISD::OR, VT, Expand);
99 setOperationAction(ISD::SHL, VT, Expand);
100 setOperationAction(ISD::SRL, VT, Expand);
101 setOperationAction(ISD::SRA, VT, Expand);
102 setOperationAction(ISD::SUB, VT, Expand);
103 setOperationAction(ISD::UDIV, VT, Expand);
104 setOperationAction(ISD::UREM, VT, Expand);
Tom Stellardf5660aa2013-07-18 21:43:35 +0000105 setOperationAction(ISD::VSELECT, VT, Expand);
Aaron Watryf97c7fe2013-06-25 13:55:57 +0000106 setOperationAction(ISD::XOR, VT, Expand);
107 }
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000108}
109
110//===---------------------------------------------------------------------===//
111// TargetLowering Callbacks
112//===---------------------------------------------------------------------===//
113
Christian Konig90c64cb2013-03-07 09:03:52 +0000114void AMDGPUTargetLowering::AnalyzeFormalArguments(CCState &State,
115 const SmallVectorImpl<ISD::InputArg> &Ins) const {
116
117 State.AnalyzeFormalArguments(Ins, CC_AMDGPU);
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000118}
119
120SDValue AMDGPUTargetLowering::LowerReturn(
121 SDValue Chain,
122 CallingConv::ID CallConv,
123 bool isVarArg,
124 const SmallVectorImpl<ISD::OutputArg> &Outs,
125 const SmallVectorImpl<SDValue> &OutVals,
Andrew Trickac6d9be2013-05-25 02:42:55 +0000126 SDLoc DL, SelectionDAG &DAG) const {
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000127 return DAG.getNode(AMDGPUISD::RET_FLAG, DL, MVT::Other, Chain);
128}
129
130//===---------------------------------------------------------------------===//
131// Target specific lowering
132//===---------------------------------------------------------------------===//
133
134SDValue AMDGPUTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG)
135 const {
136 switch (Op.getOpcode()) {
137 default:
138 Op.getNode()->dump();
139 assert(0 && "Custom lowering code for this"
140 "instruction is not implemented yet!");
141 break;
142 // AMDIL DAG lowering
143 case ISD::SDIV: return LowerSDIV(Op, DAG);
144 case ISD::SREM: return LowerSREM(Op, DAG);
145 case ISD::SIGN_EXTEND_INREG: return LowerSIGN_EXTEND_INREG(Op, DAG);
146 case ISD::BRCOND: return LowerBRCOND(Op, DAG);
147 // AMDGPU DAG lowering
148 case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN(Op, DAG);
149 case ISD::UDIVREM: return LowerUDIVREM(Op, DAG);
150 }
151 return Op;
152}
153
Tom Stellarde3d4cbc2013-06-28 15:47:08 +0000154SDValue AMDGPUTargetLowering::LowerGlobalAddress(AMDGPUMachineFunction* MFI,
155 SDValue Op,
156 SelectionDAG &DAG) const {
157
158 const DataLayout *TD = getTargetMachine().getDataLayout();
159 GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Op);
160 // XXX: What does the value of G->getOffset() mean?
161 assert(G->getOffset() == 0 &&
162 "Do not know what to do with an non-zero offset");
163
164 unsigned Offset = MFI->LDSSize;
165 const GlobalValue *GV = G->getGlobal();
166 uint64_t Size = TD->getTypeAllocSize(GV->getType()->getElementType());
167
168 // XXX: Account for alignment?
169 MFI->LDSSize += Size;
170
Michel Danzera3e39dc2013-07-10 16:37:07 +0000171 return DAG.getConstant(Offset, TD->getPointerSize() == 8 ? MVT::i64 : MVT::i32);
Tom Stellarde3d4cbc2013-06-28 15:47:08 +0000172}
173
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000174SDValue AMDGPUTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
175 SelectionDAG &DAG) const {
176 unsigned IntrinsicID = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
Andrew Trickac6d9be2013-05-25 02:42:55 +0000177 SDLoc DL(Op);
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000178 EVT VT = Op.getValueType();
179
180 switch (IntrinsicID) {
181 default: return Op;
182 case AMDGPUIntrinsic::AMDIL_abs:
183 return LowerIntrinsicIABS(Op, DAG);
184 case AMDGPUIntrinsic::AMDIL_exp:
185 return DAG.getNode(ISD::FEXP2, DL, VT, Op.getOperand(1));
186 case AMDGPUIntrinsic::AMDGPU_lrp:
187 return LowerIntrinsicLRP(Op, DAG);
188 case AMDGPUIntrinsic::AMDIL_fraction:
189 return DAG.getNode(AMDGPUISD::FRACT, DL, VT, Op.getOperand(1));
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000190 case AMDGPUIntrinsic::AMDIL_max:
191 return DAG.getNode(AMDGPUISD::FMAX, DL, VT, Op.getOperand(1),
192 Op.getOperand(2));
193 case AMDGPUIntrinsic::AMDGPU_imax:
194 return DAG.getNode(AMDGPUISD::SMAX, DL, VT, Op.getOperand(1),
195 Op.getOperand(2));
196 case AMDGPUIntrinsic::AMDGPU_umax:
197 return DAG.getNode(AMDGPUISD::UMAX, DL, VT, Op.getOperand(1),
198 Op.getOperand(2));
199 case AMDGPUIntrinsic::AMDIL_min:
200 return DAG.getNode(AMDGPUISD::FMIN, DL, VT, Op.getOperand(1),
201 Op.getOperand(2));
202 case AMDGPUIntrinsic::AMDGPU_imin:
203 return DAG.getNode(AMDGPUISD::SMIN, DL, VT, Op.getOperand(1),
204 Op.getOperand(2));
205 case AMDGPUIntrinsic::AMDGPU_umin:
206 return DAG.getNode(AMDGPUISD::UMIN, DL, VT, Op.getOperand(1),
207 Op.getOperand(2));
208 case AMDGPUIntrinsic::AMDIL_round_nearest:
209 return DAG.getNode(ISD::FRINT, DL, VT, Op.getOperand(1));
210 }
211}
212
213///IABS(a) = SMAX(sub(0, a), a)
214SDValue AMDGPUTargetLowering::LowerIntrinsicIABS(SDValue Op,
215 SelectionDAG &DAG) const {
216
Andrew Trickac6d9be2013-05-25 02:42:55 +0000217 SDLoc DL(Op);
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000218 EVT VT = Op.getValueType();
219 SDValue Neg = DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, VT),
220 Op.getOperand(1));
221
222 return DAG.getNode(AMDGPUISD::SMAX, DL, VT, Neg, Op.getOperand(1));
223}
224
225/// Linear Interpolation
226/// LRP(a, b, c) = muladd(a, b, (1 - a) * c)
227SDValue AMDGPUTargetLowering::LowerIntrinsicLRP(SDValue Op,
228 SelectionDAG &DAG) const {
Andrew Trickac6d9be2013-05-25 02:42:55 +0000229 SDLoc DL(Op);
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000230 EVT VT = Op.getValueType();
231 SDValue OneSubA = DAG.getNode(ISD::FSUB, DL, VT,
232 DAG.getConstantFP(1.0f, MVT::f32),
233 Op.getOperand(1));
234 SDValue OneSubAC = DAG.getNode(ISD::FMUL, DL, VT, OneSubA,
235 Op.getOperand(3));
Vincent Lejeunee3111962013-02-18 14:11:28 +0000236 return DAG.getNode(ISD::FADD, DL, VT,
237 DAG.getNode(ISD::FMUL, DL, VT, Op.getOperand(1), Op.getOperand(2)),
238 OneSubAC);
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000239}
240
241/// \brief Generate Min/Max node
242SDValue AMDGPUTargetLowering::LowerMinMax(SDValue Op,
243 SelectionDAG &DAG) const {
Andrew Trickac6d9be2013-05-25 02:42:55 +0000244 SDLoc DL(Op);
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000245 EVT VT = Op.getValueType();
246
247 SDValue LHS = Op.getOperand(0);
248 SDValue RHS = Op.getOperand(1);
249 SDValue True = Op.getOperand(2);
250 SDValue False = Op.getOperand(3);
251 SDValue CC = Op.getOperand(4);
252
253 if (VT != MVT::f32 ||
254 !((LHS == True && RHS == False) || (LHS == False && RHS == True))) {
255 return SDValue();
256 }
257
258 ISD::CondCode CCOpcode = cast<CondCodeSDNode>(CC)->get();
259 switch (CCOpcode) {
260 case ISD::SETOEQ:
261 case ISD::SETONE:
262 case ISD::SETUNE:
263 case ISD::SETNE:
264 case ISD::SETUEQ:
265 case ISD::SETEQ:
266 case ISD::SETFALSE:
267 case ISD::SETFALSE2:
268 case ISD::SETTRUE:
269 case ISD::SETTRUE2:
270 case ISD::SETUO:
271 case ISD::SETO:
272 assert(0 && "Operation should already be optimised !");
273 case ISD::SETULE:
274 case ISD::SETULT:
275 case ISD::SETOLE:
276 case ISD::SETOLT:
277 case ISD::SETLE:
278 case ISD::SETLT: {
279 if (LHS == True)
280 return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS);
281 else
282 return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS);
283 }
284 case ISD::SETGT:
285 case ISD::SETGE:
286 case ISD::SETUGE:
287 case ISD::SETOGE:
288 case ISD::SETUGT:
289 case ISD::SETOGT: {
290 if (LHS == True)
291 return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS);
292 else
293 return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS);
294 }
295 case ISD::SETCC_INVALID:
296 assert(0 && "Invalid setcc condcode !");
297 }
298 return Op;
299}
300
301
302
303SDValue AMDGPUTargetLowering::LowerUDIVREM(SDValue Op,
304 SelectionDAG &DAG) const {
Andrew Trickac6d9be2013-05-25 02:42:55 +0000305 SDLoc DL(Op);
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000306 EVT VT = Op.getValueType();
307
308 SDValue Num = Op.getOperand(0);
309 SDValue Den = Op.getOperand(1);
310
311 SmallVector<SDValue, 8> Results;
312
313 // RCP = URECIP(Den) = 2^32 / Den + e
314 // e is rounding error.
315 SDValue RCP = DAG.getNode(AMDGPUISD::URECIP, DL, VT, Den);
316
317 // RCP_LO = umulo(RCP, Den) */
318 SDValue RCP_LO = DAG.getNode(ISD::UMULO, DL, VT, RCP, Den);
319
320 // RCP_HI = mulhu (RCP, Den) */
321 SDValue RCP_HI = DAG.getNode(ISD::MULHU, DL, VT, RCP, Den);
322
323 // NEG_RCP_LO = -RCP_LO
324 SDValue NEG_RCP_LO = DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, VT),
325 RCP_LO);
326
327 // ABS_RCP_LO = (RCP_HI == 0 ? NEG_RCP_LO : RCP_LO)
328 SDValue ABS_RCP_LO = DAG.getSelectCC(DL, RCP_HI, DAG.getConstant(0, VT),
329 NEG_RCP_LO, RCP_LO,
330 ISD::SETEQ);
331 // Calculate the rounding error from the URECIP instruction
332 // E = mulhu(ABS_RCP_LO, RCP)
333 SDValue E = DAG.getNode(ISD::MULHU, DL, VT, ABS_RCP_LO, RCP);
334
335 // RCP_A_E = RCP + E
336 SDValue RCP_A_E = DAG.getNode(ISD::ADD, DL, VT, RCP, E);
337
338 // RCP_S_E = RCP - E
339 SDValue RCP_S_E = DAG.getNode(ISD::SUB, DL, VT, RCP, E);
340
341 // Tmp0 = (RCP_HI == 0 ? RCP_A_E : RCP_SUB_E)
342 SDValue Tmp0 = DAG.getSelectCC(DL, RCP_HI, DAG.getConstant(0, VT),
343 RCP_A_E, RCP_S_E,
344 ISD::SETEQ);
345 // Quotient = mulhu(Tmp0, Num)
346 SDValue Quotient = DAG.getNode(ISD::MULHU, DL, VT, Tmp0, Num);
347
348 // Num_S_Remainder = Quotient * Den
349 SDValue Num_S_Remainder = DAG.getNode(ISD::UMULO, DL, VT, Quotient, Den);
350
351 // Remainder = Num - Num_S_Remainder
352 SDValue Remainder = DAG.getNode(ISD::SUB, DL, VT, Num, Num_S_Remainder);
353
354 // Remainder_GE_Den = (Remainder >= Den ? -1 : 0)
355 SDValue Remainder_GE_Den = DAG.getSelectCC(DL, Remainder, Den,
356 DAG.getConstant(-1, VT),
357 DAG.getConstant(0, VT),
358 ISD::SETGE);
359 // Remainder_GE_Zero = (Remainder >= 0 ? -1 : 0)
360 SDValue Remainder_GE_Zero = DAG.getSelectCC(DL, Remainder,
361 DAG.getConstant(0, VT),
362 DAG.getConstant(-1, VT),
363 DAG.getConstant(0, VT),
364 ISD::SETGE);
365 // Tmp1 = Remainder_GE_Den & Remainder_GE_Zero
366 SDValue Tmp1 = DAG.getNode(ISD::AND, DL, VT, Remainder_GE_Den,
367 Remainder_GE_Zero);
368
369 // Calculate Division result:
370
371 // Quotient_A_One = Quotient + 1
372 SDValue Quotient_A_One = DAG.getNode(ISD::ADD, DL, VT, Quotient,
373 DAG.getConstant(1, VT));
374
375 // Quotient_S_One = Quotient - 1
376 SDValue Quotient_S_One = DAG.getNode(ISD::SUB, DL, VT, Quotient,
377 DAG.getConstant(1, VT));
378
379 // Div = (Tmp1 == 0 ? Quotient : Quotient_A_One)
380 SDValue Div = DAG.getSelectCC(DL, Tmp1, DAG.getConstant(0, VT),
381 Quotient, Quotient_A_One, ISD::SETEQ);
382
383 // Div = (Remainder_GE_Zero == 0 ? Quotient_S_One : Div)
384 Div = DAG.getSelectCC(DL, Remainder_GE_Zero, DAG.getConstant(0, VT),
385 Quotient_S_One, Div, ISD::SETEQ);
386
387 // Calculate Rem result:
388
389 // Remainder_S_Den = Remainder - Den
390 SDValue Remainder_S_Den = DAG.getNode(ISD::SUB, DL, VT, Remainder, Den);
391
392 // Remainder_A_Den = Remainder + Den
393 SDValue Remainder_A_Den = DAG.getNode(ISD::ADD, DL, VT, Remainder, Den);
394
395 // Rem = (Tmp1 == 0 ? Remainder : Remainder_S_Den)
396 SDValue Rem = DAG.getSelectCC(DL, Tmp1, DAG.getConstant(0, VT),
397 Remainder, Remainder_S_Den, ISD::SETEQ);
398
399 // Rem = (Remainder_GE_Zero == 0 ? Remainder_A_Den : Rem)
400 Rem = DAG.getSelectCC(DL, Remainder_GE_Zero, DAG.getConstant(0, VT),
401 Remainder_A_Den, Rem, ISD::SETEQ);
402 SDValue Ops[2];
403 Ops[0] = Div;
404 Ops[1] = Rem;
405 return DAG.getMergeValues(Ops, 2, DL);
406}
407
408//===----------------------------------------------------------------------===//
409// Helper functions
410//===----------------------------------------------------------------------===//
411
412bool AMDGPUTargetLowering::isHWTrueValue(SDValue Op) const {
413 if (ConstantFPSDNode * CFP = dyn_cast<ConstantFPSDNode>(Op)) {
414 return CFP->isExactlyValue(1.0);
415 }
416 if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
417 return C->isAllOnesValue();
418 }
419 return false;
420}
421
422bool AMDGPUTargetLowering::isHWFalseValue(SDValue Op) const {
423 if (ConstantFPSDNode * CFP = dyn_cast<ConstantFPSDNode>(Op)) {
424 return CFP->getValueAPF().isZero();
425 }
426 if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
427 return C->isNullValue();
428 }
429 return false;
430}
431
432SDValue AMDGPUTargetLowering::CreateLiveInRegister(SelectionDAG &DAG,
433 const TargetRegisterClass *RC,
434 unsigned Reg, EVT VT) const {
435 MachineFunction &MF = DAG.getMachineFunction();
436 MachineRegisterInfo &MRI = MF.getRegInfo();
437 unsigned VirtualRegister;
438 if (!MRI.isLiveIn(Reg)) {
439 VirtualRegister = MRI.createVirtualRegister(RC);
440 MRI.addLiveIn(Reg, VirtualRegister);
441 } else {
442 VirtualRegister = MRI.getLiveInVirtReg(Reg);
443 }
444 return DAG.getRegister(VirtualRegister, VT);
445}
446
447#define NODE_NAME_CASE(node) case AMDGPUISD::node: return #node;
448
449const char* AMDGPUTargetLowering::getTargetNodeName(unsigned Opcode) const {
450 switch (Opcode) {
451 default: return 0;
452 // AMDIL DAG nodes
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000453 NODE_NAME_CASE(CALL);
454 NODE_NAME_CASE(UMUL);
455 NODE_NAME_CASE(DIV_INF);
456 NODE_NAME_CASE(RET_FLAG);
457 NODE_NAME_CASE(BRANCH_COND);
458
459 // AMDGPU DAG nodes
460 NODE_NAME_CASE(DWORDADDR)
461 NODE_NAME_CASE(FRACT)
462 NODE_NAME_CASE(FMAX)
463 NODE_NAME_CASE(SMAX)
464 NODE_NAME_CASE(UMAX)
465 NODE_NAME_CASE(FMIN)
466 NODE_NAME_CASE(SMIN)
467 NODE_NAME_CASE(UMIN)
468 NODE_NAME_CASE(URECIP)
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000469 NODE_NAME_CASE(EXPORT)
Tom Stellardc7e18882013-01-23 02:09:03 +0000470 NODE_NAME_CASE(CONST_ADDRESS)
Tom Stellardc0b0c672013-02-06 17:32:29 +0000471 NODE_NAME_CASE(REGISTER_LOAD)
472 NODE_NAME_CASE(REGISTER_STORE)
Tom Stellardf98f2ce2012-12-11 21:25:42 +0000473 }
474}