blob: 8319c01fc5e270b2c95f15e5f58ee2b319d93c34 [file] [log] [blame]
Ulrich Weigand5f613df2013-05-06 16:15:19 +00001//===-- SystemZISelLowering.h - SystemZ DAG lowering interface --*- C++ -*-===//
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// This file defines the interfaces that SystemZ uses to lower LLVM code into a
11// selection DAG.
12//
13//===----------------------------------------------------------------------===//
14
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000015#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZISELLOWERING_H
16#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZISELLOWERING_H
Ulrich Weigand5f613df2013-05-06 16:15:19 +000017
18#include "SystemZ.h"
Richard Sandiford0fb90ab2013-05-28 10:41:11 +000019#include "llvm/CodeGen/MachineBasicBlock.h"
Ulrich Weigand5f613df2013-05-06 16:15:19 +000020#include "llvm/CodeGen/SelectionDAG.h"
21#include "llvm/Target/TargetLowering.h"
22
23namespace llvm {
24namespace SystemZISD {
Richard Sandifordc2312692014-03-06 10:38:30 +000025enum {
26 FIRST_NUMBER = ISD::BUILTIN_OP_END,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000027
Richard Sandifordc2312692014-03-06 10:38:30 +000028 // Return with a flag operand. Operand 0 is the chain operand.
29 RET_FLAG,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000030
Richard Sandifordc2312692014-03-06 10:38:30 +000031 // Calls a function. Operand 0 is the chain operand and operand 1
32 // is the target address. The arguments start at operand 2.
33 // There is an optional glue operand at the end.
34 CALL,
35 SIBCALL,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000036
Ulrich Weigand7db69182015-02-18 09:13:27 +000037 // TLS calls. Like regular calls, except operand 1 is the TLS symbol.
38 // (The call target is implicitly __tls_get_offset.)
39 TLS_GDCALL,
40 TLS_LDCALL,
41
Richard Sandifordc2312692014-03-06 10:38:30 +000042 // Wraps a TargetGlobalAddress that should be loaded using PC-relative
43 // accesses (LARL). Operand 0 is the address.
44 PCREL_WRAPPER,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000045
Richard Sandifordc2312692014-03-06 10:38:30 +000046 // Used in cases where an offset is applied to a TargetGlobalAddress.
47 // Operand 0 is the full TargetGlobalAddress and operand 1 is a
48 // PCREL_WRAPPER for an anchor point. This is used so that we can
49 // cheaply refer to either the full address or the anchor point
50 // as a register base.
51 PCREL_OFFSET,
Richard Sandiford54b36912013-09-27 15:14:04 +000052
Richard Sandifordc2312692014-03-06 10:38:30 +000053 // Integer absolute.
54 IABS,
Richard Sandiford57485472013-12-13 15:35:00 +000055
Richard Sandifordc2312692014-03-06 10:38:30 +000056 // Integer comparisons. There are three operands: the two values
57 // to compare, and an integer of type SystemZICMP.
58 ICMP,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000059
Richard Sandifordc2312692014-03-06 10:38:30 +000060 // Floating-point comparisons. The two operands are the values to compare.
61 FCMP,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000062
Richard Sandifordc2312692014-03-06 10:38:30 +000063 // Test under mask. The first operand is ANDed with the second operand
64 // and the condition codes are set on the result. The third operand is
65 // a boolean that is true if the condition codes need to distinguish
66 // between CCMASK_TM_MIXED_MSB_0 and CCMASK_TM_MIXED_MSB_1 (which the
67 // register forms do but the memory forms don't).
68 TM,
Richard Sandiford35b9be22013-08-28 10:31:43 +000069
Richard Sandifordc2312692014-03-06 10:38:30 +000070 // Branches if a condition is true. Operand 0 is the chain operand;
71 // operand 1 is the 4-bit condition-code mask, with bit N in
72 // big-endian order meaning "branch if CC=N"; operand 2 is the
73 // target block and operand 3 is the flag operand.
74 BR_CCMASK,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000075
Richard Sandifordc2312692014-03-06 10:38:30 +000076 // Selects between operand 0 and operand 1. Operand 2 is the
77 // mask of condition-code values for which operand 0 should be
78 // chosen over operand 1; it has the same form as BR_CCMASK.
79 // Operand 3 is the flag operand.
80 SELECT_CCMASK,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000081
Richard Sandifordc2312692014-03-06 10:38:30 +000082 // Evaluates to the gap between the stack pointer and the
83 // base of the dynamically-allocatable area.
84 ADJDYNALLOC,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000085
Richard Sandifordc2312692014-03-06 10:38:30 +000086 // Extracts the value of a 32-bit access register. Operand 0 is
87 // the number of the register.
88 EXTRACT_ACCESS,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000089
Ulrich Weigandb4012182015-03-31 12:56:33 +000090 // Count number of bits set in operand 0 per byte.
91 POPCNT,
92
Richard Sandifordc2312692014-03-06 10:38:30 +000093 // Wrappers around the ISD opcodes of the same name. The output and
94 // first input operands are GR128s. The trailing numbers are the
95 // widths of the second operand in bits.
96 UMUL_LOHI64,
97 SDIVREM32,
98 SDIVREM64,
99 UDIVREM32,
100 UDIVREM64,
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000101
Richard Sandifordc2312692014-03-06 10:38:30 +0000102 // Use a series of MVCs to copy bytes from one memory location to another.
103 // The operands are:
104 // - the target address
105 // - the source address
106 // - the constant length
107 //
108 // This isn't a memory opcode because we'd need to attach two
109 // MachineMemOperands rather than one.
110 MVC,
Richard Sandifordd131ff82013-07-08 09:35:23 +0000111
Richard Sandifordc2312692014-03-06 10:38:30 +0000112 // Like MVC, but implemented as a loop that handles X*256 bytes
113 // followed by straight-line code to handle the rest (if any).
114 // The value of X is passed as an additional operand.
115 MVC_LOOP,
Richard Sandiford5e318f02013-08-27 09:54:29 +0000116
Richard Sandifordc2312692014-03-06 10:38:30 +0000117 // Similar to MVC and MVC_LOOP, but for logic operations (AND, OR, XOR).
118 NC,
119 NC_LOOP,
120 OC,
121 OC_LOOP,
122 XC,
123 XC_LOOP,
Richard Sandiford178273a2013-09-05 10:36:45 +0000124
Richard Sandifordc2312692014-03-06 10:38:30 +0000125 // Use CLC to compare two blocks of memory, with the same comments
126 // as for MVC and MVC_LOOP.
127 CLC,
128 CLC_LOOP,
Richard Sandiford761703a2013-08-12 10:17:33 +0000129
Richard Sandifordc2312692014-03-06 10:38:30 +0000130 // Use an MVST-based sequence to implement stpcpy().
131 STPCPY,
Richard Sandifordbb83a502013-08-16 11:29:37 +0000132
Richard Sandifordc2312692014-03-06 10:38:30 +0000133 // Use a CLST-based sequence to implement strcmp(). The two input operands
134 // are the addresses of the strings to compare.
135 STRCMP,
Richard Sandifordca232712013-08-16 11:21:54 +0000136
Richard Sandifordc2312692014-03-06 10:38:30 +0000137 // Use an SRST-based sequence to search a block of memory. The first
138 // operand is the end address, the second is the start, and the third
139 // is the character to search for. CC is set to 1 on success and 2
140 // on failure.
141 SEARCH_STRING,
Richard Sandiford0dec06a2013-08-16 11:41:43 +0000142
Richard Sandifordc2312692014-03-06 10:38:30 +0000143 // Store the CC value in bits 29 and 28 of an integer.
144 IPM,
Richard Sandiford564681c2013-08-12 10:28:10 +0000145
Richard Sandifordc2312692014-03-06 10:38:30 +0000146 // Perform a serialization operation. (BCR 15,0 or BCR 14,0.)
147 SERIALIZE,
Richard Sandiford9afe6132013-12-10 10:36:34 +0000148
Ulrich Weigand57c85f52015-04-01 12:51:43 +0000149 // Transaction begin. The first operand is the chain, the second
150 // the TDB pointer, and the third the immediate control field.
151 // Returns chain and glue.
152 TBEGIN,
153 TBEGIN_NOFLOAT,
154
155 // Transaction end. Just the chain operand. Returns chain and glue.
156 TEND,
157
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000158 // Create a vector constant by filling byte N of the result with bit
159 // 15-N of the single operand.
160 BYTE_MASK,
161
162 // Create a vector constant by replicating an element-sized RISBG-style mask.
163 // The first operand specifies the starting set bit and the second operand
164 // specifies the ending set bit. Both operands count from the MSB of the
165 // element.
166 ROTATE_MASK,
167
168 // Replicate a GPR scalar value into all elements of a vector.
169 REPLICATE,
170
171 // Create a vector from two i64 GPRs.
172 JOIN_DWORDS,
173
174 // Replicate one element of a vector into all elements. The first operand
175 // is the vector and the second is the index of the element to replicate.
176 SPLAT,
177
178 // Interleave elements from the high half of operand 0 and the high half
179 // of operand 1.
180 MERGE_HIGH,
181
182 // Likewise for the low halves.
183 MERGE_LOW,
184
185 // Concatenate the vectors in the first two operands, shift them left
186 // by the third operand, and take the first half of the result.
187 SHL_DOUBLE,
188
189 // Take one element of the first v2i64 operand and the one element of
190 // the second v2i64 operand and concatenate them to form a v2i64 result.
191 // The third operand is a 4-bit value of the form 0A0B, where A and B
192 // are the element selectors for the first operand and second operands
193 // respectively.
194 PERMUTE_DWORDS,
195
196 // Perform a general vector permute on vector operands 0 and 1.
197 // Each byte of operand 2 controls the corresponding byte of the result,
198 // in the same way as a byte-level VECTOR_SHUFFLE mask.
199 PERMUTE,
200
201 // Pack vector operands 0 and 1 into a single vector with half-sized elements.
202 PACK,
203
204 // Shift each element of vector operand 0 by the number of bits specified
205 // by scalar operand 1.
206 VSHL_BY_SCALAR,
207 VSRL_BY_SCALAR,
208 VSRA_BY_SCALAR,
209
210 // For each element of the output type, sum across all sub-elements of
211 // operand 0 belonging to the corresponding element, and add in the
212 // rightmost sub-element of the corresponding element of operand 1.
213 VSUM,
214
215 // Compare integer vector operands 0 and 1 to produce the usual 0/-1
216 // vector result. VICMPE is for equality, VICMPH for "signed greater than"
217 // and VICMPHL for "unsigned greater than".
218 VICMPE,
219 VICMPH,
220 VICMPHL,
221
Ulrich Weigandcd808232015-05-05 19:26:48 +0000222 // Compare floating-point vector operands 0 and 1 to preoduce the usual 0/-1
223 // vector result. VFCMPE is for "ordered and equal", VFCMPH for "ordered and
224 // greater than" and VFCMPHE for "ordered and greater than or equal to".
225 VFCMPE,
226 VFCMPH,
227 VFCMPHE,
228
Richard Sandifordc2312692014-03-06 10:38:30 +0000229 // Wrappers around the inner loop of an 8- or 16-bit ATOMIC_SWAP or
230 // ATOMIC_LOAD_<op>.
231 //
232 // Operand 0: the address of the containing 32-bit-aligned field
233 // Operand 1: the second operand of <op>, in the high bits of an i32
234 // for everything except ATOMIC_SWAPW
235 // Operand 2: how many bits to rotate the i32 left to bring the first
236 // operand into the high bits
237 // Operand 3: the negative of operand 2, for rotating the other way
238 // Operand 4: the width of the field in bits (8 or 16)
239 ATOMIC_SWAPW = ISD::FIRST_TARGET_MEMORY_OPCODE,
240 ATOMIC_LOADW_ADD,
241 ATOMIC_LOADW_SUB,
242 ATOMIC_LOADW_AND,
243 ATOMIC_LOADW_OR,
244 ATOMIC_LOADW_XOR,
245 ATOMIC_LOADW_NAND,
246 ATOMIC_LOADW_MIN,
247 ATOMIC_LOADW_MAX,
248 ATOMIC_LOADW_UMIN,
249 ATOMIC_LOADW_UMAX,
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000250
Richard Sandifordc2312692014-03-06 10:38:30 +0000251 // A wrapper around the inner loop of an ATOMIC_CMP_SWAP.
252 //
253 // Operand 0: the address of the containing 32-bit-aligned field
254 // Operand 1: the compare value, in the low bits of an i32
255 // Operand 2: the swap value, in the low bits of an i32
256 // Operand 3: how many bits to rotate the i32 left to bring the first
257 // operand into the high bits
258 // Operand 4: the negative of operand 2, for rotating the other way
259 // Operand 5: the width of the field in bits (8 or 16)
260 ATOMIC_CMP_SWAPW,
Richard Sandiford03481332013-08-23 11:36:42 +0000261
Richard Sandifordc2312692014-03-06 10:38:30 +0000262 // Prefetch from the second operand using the 4-bit control code in
263 // the first operand. The code is 1 for a load prefetch and 2 for
264 // a store prefetch.
265 PREFETCH
266};
Richard Sandiford54b36912013-09-27 15:14:04 +0000267
Richard Sandifordc2312692014-03-06 10:38:30 +0000268// Return true if OPCODE is some kind of PC-relative address.
269inline bool isPCREL(unsigned Opcode) {
270 return Opcode == PCREL_WRAPPER || Opcode == PCREL_OFFSET;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000271}
Richard Sandifordc2312692014-03-06 10:38:30 +0000272} // end namespace SystemZISD
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000273
Richard Sandiford5bc670b2013-09-06 11:51:39 +0000274namespace SystemZICMP {
Richard Sandifordc2312692014-03-06 10:38:30 +0000275// Describes whether an integer comparison needs to be signed or unsigned,
276// or whether either type is OK.
277enum {
278 Any,
279 UnsignedOnly,
280 SignedOnly
281};
282} // end namespace SystemZICMP
Richard Sandiford5bc670b2013-09-06 11:51:39 +0000283
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000284class SystemZSubtarget;
285class SystemZTargetMachine;
286
287class SystemZTargetLowering : public TargetLowering {
288public:
Eric Christophera6734172015-01-31 00:06:45 +0000289 explicit SystemZTargetLowering(const TargetMachine &TM,
290 const SystemZSubtarget &STI);
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000291
292 // Override TargetLowering.
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000293 MVT getScalarShiftAmountTy(EVT LHSTy) const override {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000294 return MVT::i32;
295 }
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000296 MVT getVectorIdxTy() const override {
297 // Only the lower 12 bits of an element index are used, so we don't
298 // want to clobber the upper 32 bits of a GPR unnecessarily.
299 return MVT::i32;
300 }
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000301 EVT getSetCCResultType(LLVMContext &, EVT) const override;
302 bool isFMAFasterThanFMulAndFAdd(EVT VT) const override;
303 bool isFPImmLegal(const APFloat &Imm, EVT VT) const override;
Ulrich Weigand1f6666a2015-03-31 12:52:27 +0000304 bool isLegalICmpImmediate(int64_t Imm) const override;
305 bool isLegalAddImmediate(int64_t Imm) const override;
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000306 bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const override;
Matt Arsenault6f2a5262014-07-27 17:46:40 +0000307 bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS,
308 unsigned Align,
309 bool *Fast) const override;
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000310 bool isTruncateFree(Type *, Type *) const override;
311 bool isTruncateFree(EVT, EVT) const override;
312 const char *getTargetNodeName(unsigned Opcode) const override;
313 std::pair<unsigned, const TargetRegisterClass *>
Eric Christopher11e4df72015-02-26 22:38:43 +0000314 getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
315 const std::string &Constraint,
316 MVT VT) const override;
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000317 TargetLowering::ConstraintType
Craig Topper73156022014-03-02 09:09:27 +0000318 getConstraintType(const std::string &Constraint) const override;
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000319 TargetLowering::ConstraintWeight
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000320 getSingleConstraintMatchWeight(AsmOperandInfo &info,
Craig Topper73156022014-03-02 09:09:27 +0000321 const char *constraint) const override;
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000322 void LowerAsmOperandForConstraint(SDValue Op,
323 std::string &Constraint,
324 std::vector<SDValue> &Ops,
325 SelectionDAG &DAG) const override;
Daniel Sandersbf5b80f2015-03-16 13:13:41 +0000326
327 unsigned getInlineAsmMemConstraint(
328 const std::string &ConstraintCode) const override {
Daniel Sanders2eeace22015-03-17 16:16:14 +0000329 if (ConstraintCode.size() == 1) {
330 switch(ConstraintCode[0]) {
331 default:
332 break;
333 case 'Q':
334 return InlineAsm::Constraint_Q;
335 case 'R':
336 return InlineAsm::Constraint_R;
337 case 'S':
338 return InlineAsm::Constraint_S;
339 case 'T':
340 return InlineAsm::Constraint_T;
341 }
342 }
343 return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
Daniel Sandersbf5b80f2015-03-16 13:13:41 +0000344 }
345
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000346 MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
347 MachineBasicBlock *BB) const
348 override;
349 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
350 bool allowTruncateForTailCall(Type *, Type *) const override;
351 bool mayBeEmittedAsTailCall(CallInst *CI) const override;
352 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
353 bool isVarArg,
354 const SmallVectorImpl<ISD::InputArg> &Ins,
355 SDLoc DL, SelectionDAG &DAG,
356 SmallVectorImpl<SDValue> &InVals) const override;
357 SDValue LowerCall(CallLoweringInfo &CLI,
358 SmallVectorImpl<SDValue> &InVals) const override;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000359
Richard Sandifordb4d67b52014-03-06 12:03:36 +0000360 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
361 const SmallVectorImpl<ISD::OutputArg> &Outs,
362 const SmallVectorImpl<SDValue> &OutVals,
363 SDLoc DL, SelectionDAG &DAG) const override;
364 SDValue prepareVolatileOrAtomicLoad(SDValue Chain, SDLoc DL,
365 SelectionDAG &DAG) const override;
Richard Sandiford95bc5f92014-03-07 11:34:35 +0000366 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000367
368private:
369 const SystemZSubtarget &Subtarget;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000370
371 // Implement LowerOperation for individual opcodes.
Richard Sandifordf722a8e302013-10-16 11:10:55 +0000372 SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000373 SDValue lowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
374 SDValue lowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
375 SDValue lowerGlobalAddress(GlobalAddressSDNode *Node,
376 SelectionDAG &DAG) const;
Ulrich Weigand7db69182015-02-18 09:13:27 +0000377 SDValue lowerTLSGetOffset(GlobalAddressSDNode *Node,
378 SelectionDAG &DAG, unsigned Opcode,
379 SDValue GOTOffset) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000380 SDValue lowerGlobalTLSAddress(GlobalAddressSDNode *Node,
381 SelectionDAG &DAG) const;
382 SDValue lowerBlockAddress(BlockAddressSDNode *Node,
383 SelectionDAG &DAG) const;
384 SDValue lowerJumpTable(JumpTableSDNode *JT, SelectionDAG &DAG) const;
385 SDValue lowerConstantPool(ConstantPoolSDNode *CP, SelectionDAG &DAG) const;
386 SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const;
387 SDValue lowerVACOPY(SDValue Op, SelectionDAG &DAG) const;
388 SDValue lowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
Richard Sandiford7d86e472013-08-21 09:34:56 +0000389 SDValue lowerSMUL_LOHI(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000390 SDValue lowerUMUL_LOHI(SDValue Op, SelectionDAG &DAG) const;
391 SDValue lowerSDIVREM(SDValue Op, SelectionDAG &DAG) const;
392 SDValue lowerUDIVREM(SDValue Op, SelectionDAG &DAG) const;
393 SDValue lowerBITCAST(SDValue Op, SelectionDAG &DAG) const;
394 SDValue lowerOR(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigandb4012182015-03-31 12:56:33 +0000395 SDValue lowerCTPOP(SDValue Op, SelectionDAG &DAG) const;
Richard Sandifordbef3d7a2013-12-10 10:49:34 +0000396 SDValue lowerATOMIC_LOAD(SDValue Op, SelectionDAG &DAG) const;
397 SDValue lowerATOMIC_STORE(SDValue Op, SelectionDAG &DAG) const;
398 SDValue lowerATOMIC_LOAD_OP(SDValue Op, SelectionDAG &DAG,
399 unsigned Opcode) const;
Richard Sandiford41350a52013-12-24 15:18:04 +0000400 SDValue lowerATOMIC_LOAD_SUB(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000401 SDValue lowerATOMIC_CMP_SWAP(SDValue Op, SelectionDAG &DAG) const;
Richard Sandiford9afe6132013-12-10 10:36:34 +0000402 SDValue lowerLOAD_SEQUENCE_POINT(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000403 SDValue lowerSTACKSAVE(SDValue Op, SelectionDAG &DAG) const;
404 SDValue lowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG) const;
Richard Sandiford03481332013-08-23 11:36:42 +0000405 SDValue lowerPREFETCH(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigand57c85f52015-04-01 12:51:43 +0000406 SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000407 SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
408 SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
409 SDValue lowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigandcd808232015-05-05 19:26:48 +0000410 SDValue lowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
411 SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
Ulrich Weigandce4c1092015-05-05 19:25:42 +0000412 SDValue lowerShift(SDValue Op, SelectionDAG &DAG, unsigned ByScalar) const;
413
414 SDValue combineExtract(SDLoc DL, EVT ElemVT, EVT VecVT, SDValue OrigOp,
415 unsigned Index, DAGCombinerInfo &DCI,
416 bool Force) const;
417 SDValue combineTruncateExtract(SDLoc DL, EVT TruncVT, SDValue Op,
418 DAGCombinerInfo &DCI) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000419
Richard Sandiford0fb90ab2013-05-28 10:41:11 +0000420 // If the last instruction before MBBI in MBB was some form of COMPARE,
421 // try to replace it with a COMPARE AND BRANCH just before MBBI.
422 // CCMask and Target are the BRC-like operands for the branch.
423 // Return true if the change was made.
424 bool convertPrevCompareToBranch(MachineBasicBlock *MBB,
425 MachineBasicBlock::iterator MBBI,
426 unsigned CCMask,
427 MachineBasicBlock *Target) const;
428
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000429 // Implement EmitInstrWithCustomInserter for individual operation types.
430 MachineBasicBlock *emitSelect(MachineInstr *MI,
431 MachineBasicBlock *BB) const;
Richard Sandifordb86a8342013-06-27 09:27:40 +0000432 MachineBasicBlock *emitCondStore(MachineInstr *MI,
433 MachineBasicBlock *BB,
Richard Sandiforda68e6f52013-07-25 08:57:02 +0000434 unsigned StoreOpcode, unsigned STOCOpcode,
435 bool Invert) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000436 MachineBasicBlock *emitExt128(MachineInstr *MI,
437 MachineBasicBlock *MBB,
438 bool ClearEven, unsigned SubReg) const;
439 MachineBasicBlock *emitAtomicLoadBinary(MachineInstr *MI,
440 MachineBasicBlock *BB,
441 unsigned BinOpcode, unsigned BitSize,
442 bool Invert = false) const;
443 MachineBasicBlock *emitAtomicLoadMinMax(MachineInstr *MI,
444 MachineBasicBlock *MBB,
445 unsigned CompareOpcode,
446 unsigned KeepOldMask,
447 unsigned BitSize) const;
448 MachineBasicBlock *emitAtomicCmpSwapW(MachineInstr *MI,
449 MachineBasicBlock *BB) const;
Richard Sandiford564681c2013-08-12 10:28:10 +0000450 MachineBasicBlock *emitMemMemWrapper(MachineInstr *MI,
451 MachineBasicBlock *BB,
452 unsigned Opcode) const;
Richard Sandifordca232712013-08-16 11:21:54 +0000453 MachineBasicBlock *emitStringWrapper(MachineInstr *MI,
454 MachineBasicBlock *BB,
455 unsigned Opcode) const;
Ulrich Weigand57c85f52015-04-01 12:51:43 +0000456 MachineBasicBlock *emitTransactionBegin(MachineInstr *MI,
457 MachineBasicBlock *MBB,
458 unsigned Opcode,
459 bool NoFloat) const;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000460};
461} // end namespace llvm
462
Benjamin Kramera7c40ef2014-08-13 16:26:38 +0000463#endif