xref: /aosp_15_r20/external/llvm/lib/Target/SystemZ/SystemZISelLowering.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- SystemZISelLowering.h - SystemZ DAG lowering interface --*- C++ -*-===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file defines the interfaces that SystemZ uses to lower LLVM code into a
11*9880d681SAndroid Build Coastguard Worker // selection DAG.
12*9880d681SAndroid Build Coastguard Worker //
13*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
14*9880d681SAndroid Build Coastguard Worker 
15*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZISELLOWERING_H
16*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZISELLOWERING_H
17*9880d681SAndroid Build Coastguard Worker 
18*9880d681SAndroid Build Coastguard Worker #include "SystemZ.h"
19*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineBasicBlock.h"
20*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/SelectionDAG.h"
21*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetLowering.h"
22*9880d681SAndroid Build Coastguard Worker 
23*9880d681SAndroid Build Coastguard Worker namespace llvm {
24*9880d681SAndroid Build Coastguard Worker namespace SystemZISD {
25*9880d681SAndroid Build Coastguard Worker enum NodeType : unsigned {
26*9880d681SAndroid Build Coastguard Worker   FIRST_NUMBER = ISD::BUILTIN_OP_END,
27*9880d681SAndroid Build Coastguard Worker 
28*9880d681SAndroid Build Coastguard Worker   // Return with a flag operand.  Operand 0 is the chain operand.
29*9880d681SAndroid Build Coastguard Worker   RET_FLAG,
30*9880d681SAndroid Build Coastguard Worker 
31*9880d681SAndroid Build Coastguard Worker   // Calls a function.  Operand 0 is the chain operand and operand 1
32*9880d681SAndroid Build Coastguard Worker   // is the target address.  The arguments start at operand 2.
33*9880d681SAndroid Build Coastguard Worker   // There is an optional glue operand at the end.
34*9880d681SAndroid Build Coastguard Worker   CALL,
35*9880d681SAndroid Build Coastguard Worker   SIBCALL,
36*9880d681SAndroid Build Coastguard Worker 
37*9880d681SAndroid Build Coastguard Worker   // TLS calls.  Like regular calls, except operand 1 is the TLS symbol.
38*9880d681SAndroid Build Coastguard Worker   // (The call target is implicitly __tls_get_offset.)
39*9880d681SAndroid Build Coastguard Worker   TLS_GDCALL,
40*9880d681SAndroid Build Coastguard Worker   TLS_LDCALL,
41*9880d681SAndroid Build Coastguard Worker 
42*9880d681SAndroid Build Coastguard Worker   // Wraps a TargetGlobalAddress that should be loaded using PC-relative
43*9880d681SAndroid Build Coastguard Worker   // accesses (LARL).  Operand 0 is the address.
44*9880d681SAndroid Build Coastguard Worker   PCREL_WRAPPER,
45*9880d681SAndroid Build Coastguard Worker 
46*9880d681SAndroid Build Coastguard Worker   // Used in cases where an offset is applied to a TargetGlobalAddress.
47*9880d681SAndroid Build Coastguard Worker   // Operand 0 is the full TargetGlobalAddress and operand 1 is a
48*9880d681SAndroid Build Coastguard Worker   // PCREL_WRAPPER for an anchor point.  This is used so that we can
49*9880d681SAndroid Build Coastguard Worker   // cheaply refer to either the full address or the anchor point
50*9880d681SAndroid Build Coastguard Worker   // as a register base.
51*9880d681SAndroid Build Coastguard Worker   PCREL_OFFSET,
52*9880d681SAndroid Build Coastguard Worker 
53*9880d681SAndroid Build Coastguard Worker   // Integer absolute.
54*9880d681SAndroid Build Coastguard Worker   IABS,
55*9880d681SAndroid Build Coastguard Worker 
56*9880d681SAndroid Build Coastguard Worker   // Integer comparisons.  There are three operands: the two values
57*9880d681SAndroid Build Coastguard Worker   // to compare, and an integer of type SystemZICMP.
58*9880d681SAndroid Build Coastguard Worker   ICMP,
59*9880d681SAndroid Build Coastguard Worker 
60*9880d681SAndroid Build Coastguard Worker   // Floating-point comparisons.  The two operands are the values to compare.
61*9880d681SAndroid Build Coastguard Worker   FCMP,
62*9880d681SAndroid Build Coastguard Worker 
63*9880d681SAndroid Build Coastguard Worker   // Test under mask.  The first operand is ANDed with the second operand
64*9880d681SAndroid Build Coastguard Worker   // and the condition codes are set on the result.  The third operand is
65*9880d681SAndroid Build Coastguard Worker   // a boolean that is true if the condition codes need to distinguish
66*9880d681SAndroid Build Coastguard Worker   // between CCMASK_TM_MIXED_MSB_0 and CCMASK_TM_MIXED_MSB_1 (which the
67*9880d681SAndroid Build Coastguard Worker   // register forms do but the memory forms don't).
68*9880d681SAndroid Build Coastguard Worker   TM,
69*9880d681SAndroid Build Coastguard Worker 
70*9880d681SAndroid Build Coastguard Worker   // Branches if a condition is true.  Operand 0 is the chain operand;
71*9880d681SAndroid Build Coastguard Worker   // operand 1 is the 4-bit condition-code mask, with bit N in
72*9880d681SAndroid Build Coastguard Worker   // big-endian order meaning "branch if CC=N"; operand 2 is the
73*9880d681SAndroid Build Coastguard Worker   // target block and operand 3 is the flag operand.
74*9880d681SAndroid Build Coastguard Worker   BR_CCMASK,
75*9880d681SAndroid Build Coastguard Worker 
76*9880d681SAndroid Build Coastguard Worker   // Selects between operand 0 and operand 1.  Operand 2 is the
77*9880d681SAndroid Build Coastguard Worker   // mask of condition-code values for which operand 0 should be
78*9880d681SAndroid Build Coastguard Worker   // chosen over operand 1; it has the same form as BR_CCMASK.
79*9880d681SAndroid Build Coastguard Worker   // Operand 3 is the flag operand.
80*9880d681SAndroid Build Coastguard Worker   SELECT_CCMASK,
81*9880d681SAndroid Build Coastguard Worker 
82*9880d681SAndroid Build Coastguard Worker   // Evaluates to the gap between the stack pointer and the
83*9880d681SAndroid Build Coastguard Worker   // base of the dynamically-allocatable area.
84*9880d681SAndroid Build Coastguard Worker   ADJDYNALLOC,
85*9880d681SAndroid Build Coastguard Worker 
86*9880d681SAndroid Build Coastguard Worker   // Extracts the value of a 32-bit access register.  Operand 0 is
87*9880d681SAndroid Build Coastguard Worker   // the number of the register.
88*9880d681SAndroid Build Coastguard Worker   EXTRACT_ACCESS,
89*9880d681SAndroid Build Coastguard Worker 
90*9880d681SAndroid Build Coastguard Worker   // Count number of bits set in operand 0 per byte.
91*9880d681SAndroid Build Coastguard Worker   POPCNT,
92*9880d681SAndroid Build Coastguard Worker 
93*9880d681SAndroid Build Coastguard Worker   // Wrappers around the ISD opcodes of the same name.  The output and
94*9880d681SAndroid Build Coastguard Worker   // first input operands are GR128s.  The trailing numbers are the
95*9880d681SAndroid Build Coastguard Worker   // widths of the second operand in bits.
96*9880d681SAndroid Build Coastguard Worker   UMUL_LOHI64,
97*9880d681SAndroid Build Coastguard Worker   SDIVREM32,
98*9880d681SAndroid Build Coastguard Worker   SDIVREM64,
99*9880d681SAndroid Build Coastguard Worker   UDIVREM32,
100*9880d681SAndroid Build Coastguard Worker   UDIVREM64,
101*9880d681SAndroid Build Coastguard Worker 
102*9880d681SAndroid Build Coastguard Worker   // Use a series of MVCs to copy bytes from one memory location to another.
103*9880d681SAndroid Build Coastguard Worker   // The operands are:
104*9880d681SAndroid Build Coastguard Worker   // - the target address
105*9880d681SAndroid Build Coastguard Worker   // - the source address
106*9880d681SAndroid Build Coastguard Worker   // - the constant length
107*9880d681SAndroid Build Coastguard Worker   //
108*9880d681SAndroid Build Coastguard Worker   // This isn't a memory opcode because we'd need to attach two
109*9880d681SAndroid Build Coastguard Worker   // MachineMemOperands rather than one.
110*9880d681SAndroid Build Coastguard Worker   MVC,
111*9880d681SAndroid Build Coastguard Worker 
112*9880d681SAndroid Build Coastguard Worker   // Like MVC, but implemented as a loop that handles X*256 bytes
113*9880d681SAndroid Build Coastguard Worker   // followed by straight-line code to handle the rest (if any).
114*9880d681SAndroid Build Coastguard Worker   // The value of X is passed as an additional operand.
115*9880d681SAndroid Build Coastguard Worker   MVC_LOOP,
116*9880d681SAndroid Build Coastguard Worker 
117*9880d681SAndroid Build Coastguard Worker   // Similar to MVC and MVC_LOOP, but for logic operations (AND, OR, XOR).
118*9880d681SAndroid Build Coastguard Worker   NC,
119*9880d681SAndroid Build Coastguard Worker   NC_LOOP,
120*9880d681SAndroid Build Coastguard Worker   OC,
121*9880d681SAndroid Build Coastguard Worker   OC_LOOP,
122*9880d681SAndroid Build Coastguard Worker   XC,
123*9880d681SAndroid Build Coastguard Worker   XC_LOOP,
124*9880d681SAndroid Build Coastguard Worker 
125*9880d681SAndroid Build Coastguard Worker   // Use CLC to compare two blocks of memory, with the same comments
126*9880d681SAndroid Build Coastguard Worker   // as for MVC and MVC_LOOP.
127*9880d681SAndroid Build Coastguard Worker   CLC,
128*9880d681SAndroid Build Coastguard Worker   CLC_LOOP,
129*9880d681SAndroid Build Coastguard Worker 
130*9880d681SAndroid Build Coastguard Worker   // Use an MVST-based sequence to implement stpcpy().
131*9880d681SAndroid Build Coastguard Worker   STPCPY,
132*9880d681SAndroid Build Coastguard Worker 
133*9880d681SAndroid Build Coastguard Worker   // Use a CLST-based sequence to implement strcmp().  The two input operands
134*9880d681SAndroid Build Coastguard Worker   // are the addresses of the strings to compare.
135*9880d681SAndroid Build Coastguard Worker   STRCMP,
136*9880d681SAndroid Build Coastguard Worker 
137*9880d681SAndroid Build Coastguard Worker   // Use an SRST-based sequence to search a block of memory.  The first
138*9880d681SAndroid Build Coastguard Worker   // operand is the end address, the second is the start, and the third
139*9880d681SAndroid Build Coastguard Worker   // is the character to search for.  CC is set to 1 on success and 2
140*9880d681SAndroid Build Coastguard Worker   // on failure.
141*9880d681SAndroid Build Coastguard Worker   SEARCH_STRING,
142*9880d681SAndroid Build Coastguard Worker 
143*9880d681SAndroid Build Coastguard Worker   // Store the CC value in bits 29 and 28 of an integer.
144*9880d681SAndroid Build Coastguard Worker   IPM,
145*9880d681SAndroid Build Coastguard Worker 
146*9880d681SAndroid Build Coastguard Worker   // Perform a serialization operation.  (BCR 15,0 or BCR 14,0.)
147*9880d681SAndroid Build Coastguard Worker   SERIALIZE,
148*9880d681SAndroid Build Coastguard Worker 
149*9880d681SAndroid Build Coastguard Worker   // Compiler barrier only; generate a no-op.
150*9880d681SAndroid Build Coastguard Worker   MEMBARRIER,
151*9880d681SAndroid Build Coastguard Worker 
152*9880d681SAndroid Build Coastguard Worker   // Transaction begin.  The first operand is the chain, the second
153*9880d681SAndroid Build Coastguard Worker   // the TDB pointer, and the third the immediate control field.
154*9880d681SAndroid Build Coastguard Worker   // Returns chain and glue.
155*9880d681SAndroid Build Coastguard Worker   TBEGIN,
156*9880d681SAndroid Build Coastguard Worker   TBEGIN_NOFLOAT,
157*9880d681SAndroid Build Coastguard Worker 
158*9880d681SAndroid Build Coastguard Worker   // Transaction end.  Just the chain operand.  Returns chain and glue.
159*9880d681SAndroid Build Coastguard Worker   TEND,
160*9880d681SAndroid Build Coastguard Worker 
161*9880d681SAndroid Build Coastguard Worker   // Create a vector constant by filling byte N of the result with bit
162*9880d681SAndroid Build Coastguard Worker   // 15-N of the single operand.
163*9880d681SAndroid Build Coastguard Worker   BYTE_MASK,
164*9880d681SAndroid Build Coastguard Worker 
165*9880d681SAndroid Build Coastguard Worker   // Create a vector constant by replicating an element-sized RISBG-style mask.
166*9880d681SAndroid Build Coastguard Worker   // The first operand specifies the starting set bit and the second operand
167*9880d681SAndroid Build Coastguard Worker   // specifies the ending set bit.  Both operands count from the MSB of the
168*9880d681SAndroid Build Coastguard Worker   // element.
169*9880d681SAndroid Build Coastguard Worker   ROTATE_MASK,
170*9880d681SAndroid Build Coastguard Worker 
171*9880d681SAndroid Build Coastguard Worker   // Replicate a GPR scalar value into all elements of a vector.
172*9880d681SAndroid Build Coastguard Worker   REPLICATE,
173*9880d681SAndroid Build Coastguard Worker 
174*9880d681SAndroid Build Coastguard Worker   // Create a vector from two i64 GPRs.
175*9880d681SAndroid Build Coastguard Worker   JOIN_DWORDS,
176*9880d681SAndroid Build Coastguard Worker 
177*9880d681SAndroid Build Coastguard Worker   // Replicate one element of a vector into all elements.  The first operand
178*9880d681SAndroid Build Coastguard Worker   // is the vector and the second is the index of the element to replicate.
179*9880d681SAndroid Build Coastguard Worker   SPLAT,
180*9880d681SAndroid Build Coastguard Worker 
181*9880d681SAndroid Build Coastguard Worker   // Interleave elements from the high half of operand 0 and the high half
182*9880d681SAndroid Build Coastguard Worker   // of operand 1.
183*9880d681SAndroid Build Coastguard Worker   MERGE_HIGH,
184*9880d681SAndroid Build Coastguard Worker 
185*9880d681SAndroid Build Coastguard Worker   // Likewise for the low halves.
186*9880d681SAndroid Build Coastguard Worker   MERGE_LOW,
187*9880d681SAndroid Build Coastguard Worker 
188*9880d681SAndroid Build Coastguard Worker   // Concatenate the vectors in the first two operands, shift them left
189*9880d681SAndroid Build Coastguard Worker   // by the third operand, and take the first half of the result.
190*9880d681SAndroid Build Coastguard Worker   SHL_DOUBLE,
191*9880d681SAndroid Build Coastguard Worker 
192*9880d681SAndroid Build Coastguard Worker   // Take one element of the first v2i64 operand and the one element of
193*9880d681SAndroid Build Coastguard Worker   // the second v2i64 operand and concatenate them to form a v2i64 result.
194*9880d681SAndroid Build Coastguard Worker   // The third operand is a 4-bit value of the form 0A0B, where A and B
195*9880d681SAndroid Build Coastguard Worker   // are the element selectors for the first operand and second operands
196*9880d681SAndroid Build Coastguard Worker   // respectively.
197*9880d681SAndroid Build Coastguard Worker   PERMUTE_DWORDS,
198*9880d681SAndroid Build Coastguard Worker 
199*9880d681SAndroid Build Coastguard Worker   // Perform a general vector permute on vector operands 0 and 1.
200*9880d681SAndroid Build Coastguard Worker   // Each byte of operand 2 controls the corresponding byte of the result,
201*9880d681SAndroid Build Coastguard Worker   // in the same way as a byte-level VECTOR_SHUFFLE mask.
202*9880d681SAndroid Build Coastguard Worker   PERMUTE,
203*9880d681SAndroid Build Coastguard Worker 
204*9880d681SAndroid Build Coastguard Worker   // Pack vector operands 0 and 1 into a single vector with half-sized elements.
205*9880d681SAndroid Build Coastguard Worker   PACK,
206*9880d681SAndroid Build Coastguard Worker 
207*9880d681SAndroid Build Coastguard Worker   // Likewise, but saturate the result and set CC.  PACKS_CC does signed
208*9880d681SAndroid Build Coastguard Worker   // saturation and PACKLS_CC does unsigned saturation.
209*9880d681SAndroid Build Coastguard Worker   PACKS_CC,
210*9880d681SAndroid Build Coastguard Worker   PACKLS_CC,
211*9880d681SAndroid Build Coastguard Worker 
212*9880d681SAndroid Build Coastguard Worker   // Unpack the first half of vector operand 0 into double-sized elements.
213*9880d681SAndroid Build Coastguard Worker   // UNPACK_HIGH sign-extends and UNPACKL_HIGH zero-extends.
214*9880d681SAndroid Build Coastguard Worker   UNPACK_HIGH,
215*9880d681SAndroid Build Coastguard Worker   UNPACKL_HIGH,
216*9880d681SAndroid Build Coastguard Worker 
217*9880d681SAndroid Build Coastguard Worker   // Likewise for the second half.
218*9880d681SAndroid Build Coastguard Worker   UNPACK_LOW,
219*9880d681SAndroid Build Coastguard Worker   UNPACKL_LOW,
220*9880d681SAndroid Build Coastguard Worker 
221*9880d681SAndroid Build Coastguard Worker   // Shift each element of vector operand 0 by the number of bits specified
222*9880d681SAndroid Build Coastguard Worker   // by scalar operand 1.
223*9880d681SAndroid Build Coastguard Worker   VSHL_BY_SCALAR,
224*9880d681SAndroid Build Coastguard Worker   VSRL_BY_SCALAR,
225*9880d681SAndroid Build Coastguard Worker   VSRA_BY_SCALAR,
226*9880d681SAndroid Build Coastguard Worker 
227*9880d681SAndroid Build Coastguard Worker   // For each element of the output type, sum across all sub-elements of
228*9880d681SAndroid Build Coastguard Worker   // operand 0 belonging to the corresponding element, and add in the
229*9880d681SAndroid Build Coastguard Worker   // rightmost sub-element of the corresponding element of operand 1.
230*9880d681SAndroid Build Coastguard Worker   VSUM,
231*9880d681SAndroid Build Coastguard Worker 
232*9880d681SAndroid Build Coastguard Worker   // Compare integer vector operands 0 and 1 to produce the usual 0/-1
233*9880d681SAndroid Build Coastguard Worker   // vector result.  VICMPE is for equality, VICMPH for "signed greater than"
234*9880d681SAndroid Build Coastguard Worker   // and VICMPHL for "unsigned greater than".
235*9880d681SAndroid Build Coastguard Worker   VICMPE,
236*9880d681SAndroid Build Coastguard Worker   VICMPH,
237*9880d681SAndroid Build Coastguard Worker   VICMPHL,
238*9880d681SAndroid Build Coastguard Worker 
239*9880d681SAndroid Build Coastguard Worker   // Likewise, but also set the condition codes on the result.
240*9880d681SAndroid Build Coastguard Worker   VICMPES,
241*9880d681SAndroid Build Coastguard Worker   VICMPHS,
242*9880d681SAndroid Build Coastguard Worker   VICMPHLS,
243*9880d681SAndroid Build Coastguard Worker 
244*9880d681SAndroid Build Coastguard Worker   // Compare floating-point vector operands 0 and 1 to preoduce the usual 0/-1
245*9880d681SAndroid Build Coastguard Worker   // vector result.  VFCMPE is for "ordered and equal", VFCMPH for "ordered and
246*9880d681SAndroid Build Coastguard Worker   // greater than" and VFCMPHE for "ordered and greater than or equal to".
247*9880d681SAndroid Build Coastguard Worker   VFCMPE,
248*9880d681SAndroid Build Coastguard Worker   VFCMPH,
249*9880d681SAndroid Build Coastguard Worker   VFCMPHE,
250*9880d681SAndroid Build Coastguard Worker 
251*9880d681SAndroid Build Coastguard Worker   // Likewise, but also set the condition codes on the result.
252*9880d681SAndroid Build Coastguard Worker   VFCMPES,
253*9880d681SAndroid Build Coastguard Worker   VFCMPHS,
254*9880d681SAndroid Build Coastguard Worker   VFCMPHES,
255*9880d681SAndroid Build Coastguard Worker 
256*9880d681SAndroid Build Coastguard Worker   // Test floating-point data class for vectors.
257*9880d681SAndroid Build Coastguard Worker   VFTCI,
258*9880d681SAndroid Build Coastguard Worker 
259*9880d681SAndroid Build Coastguard Worker   // Extend the even f32 elements of vector operand 0 to produce a vector
260*9880d681SAndroid Build Coastguard Worker   // of f64 elements.
261*9880d681SAndroid Build Coastguard Worker   VEXTEND,
262*9880d681SAndroid Build Coastguard Worker 
263*9880d681SAndroid Build Coastguard Worker   // Round the f64 elements of vector operand 0 to f32s and store them in the
264*9880d681SAndroid Build Coastguard Worker   // even elements of the result.
265*9880d681SAndroid Build Coastguard Worker   VROUND,
266*9880d681SAndroid Build Coastguard Worker 
267*9880d681SAndroid Build Coastguard Worker   // AND the two vector operands together and set CC based on the result.
268*9880d681SAndroid Build Coastguard Worker   VTM,
269*9880d681SAndroid Build Coastguard Worker 
270*9880d681SAndroid Build Coastguard Worker   // String operations that set CC as a side-effect.
271*9880d681SAndroid Build Coastguard Worker   VFAE_CC,
272*9880d681SAndroid Build Coastguard Worker   VFAEZ_CC,
273*9880d681SAndroid Build Coastguard Worker   VFEE_CC,
274*9880d681SAndroid Build Coastguard Worker   VFEEZ_CC,
275*9880d681SAndroid Build Coastguard Worker   VFENE_CC,
276*9880d681SAndroid Build Coastguard Worker   VFENEZ_CC,
277*9880d681SAndroid Build Coastguard Worker   VISTR_CC,
278*9880d681SAndroid Build Coastguard Worker   VSTRC_CC,
279*9880d681SAndroid Build Coastguard Worker   VSTRCZ_CC,
280*9880d681SAndroid Build Coastguard Worker 
281*9880d681SAndroid Build Coastguard Worker   // Test Data Class.
282*9880d681SAndroid Build Coastguard Worker   //
283*9880d681SAndroid Build Coastguard Worker   // Operand 0: the value to test
284*9880d681SAndroid Build Coastguard Worker   // Operand 1: the bit mask
285*9880d681SAndroid Build Coastguard Worker   TDC,
286*9880d681SAndroid Build Coastguard Worker 
287*9880d681SAndroid Build Coastguard Worker   // Wrappers around the inner loop of an 8- or 16-bit ATOMIC_SWAP or
288*9880d681SAndroid Build Coastguard Worker   // ATOMIC_LOAD_<op>.
289*9880d681SAndroid Build Coastguard Worker   //
290*9880d681SAndroid Build Coastguard Worker   // Operand 0: the address of the containing 32-bit-aligned field
291*9880d681SAndroid Build Coastguard Worker   // Operand 1: the second operand of <op>, in the high bits of an i32
292*9880d681SAndroid Build Coastguard Worker   //            for everything except ATOMIC_SWAPW
293*9880d681SAndroid Build Coastguard Worker   // Operand 2: how many bits to rotate the i32 left to bring the first
294*9880d681SAndroid Build Coastguard Worker   //            operand into the high bits
295*9880d681SAndroid Build Coastguard Worker   // Operand 3: the negative of operand 2, for rotating the other way
296*9880d681SAndroid Build Coastguard Worker   // Operand 4: the width of the field in bits (8 or 16)
297*9880d681SAndroid Build Coastguard Worker   ATOMIC_SWAPW = ISD::FIRST_TARGET_MEMORY_OPCODE,
298*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_ADD,
299*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_SUB,
300*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_AND,
301*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_OR,
302*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_XOR,
303*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_NAND,
304*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_MIN,
305*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_MAX,
306*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_UMIN,
307*9880d681SAndroid Build Coastguard Worker   ATOMIC_LOADW_UMAX,
308*9880d681SAndroid Build Coastguard Worker 
309*9880d681SAndroid Build Coastguard Worker   // A wrapper around the inner loop of an ATOMIC_CMP_SWAP.
310*9880d681SAndroid Build Coastguard Worker   //
311*9880d681SAndroid Build Coastguard Worker   // Operand 0: the address of the containing 32-bit-aligned field
312*9880d681SAndroid Build Coastguard Worker   // Operand 1: the compare value, in the low bits of an i32
313*9880d681SAndroid Build Coastguard Worker   // Operand 2: the swap value, in the low bits of an i32
314*9880d681SAndroid Build Coastguard Worker   // Operand 3: how many bits to rotate the i32 left to bring the first
315*9880d681SAndroid Build Coastguard Worker   //            operand into the high bits
316*9880d681SAndroid Build Coastguard Worker   // Operand 4: the negative of operand 2, for rotating the other way
317*9880d681SAndroid Build Coastguard Worker   // Operand 5: the width of the field in bits (8 or 16)
318*9880d681SAndroid Build Coastguard Worker   ATOMIC_CMP_SWAPW,
319*9880d681SAndroid Build Coastguard Worker 
320*9880d681SAndroid Build Coastguard Worker   // Byte swapping load.
321*9880d681SAndroid Build Coastguard Worker   //
322*9880d681SAndroid Build Coastguard Worker   // Operand 0: the address to load from
323*9880d681SAndroid Build Coastguard Worker   // Operand 1: the type of load (i16, i32, i64)
324*9880d681SAndroid Build Coastguard Worker   LRV,
325*9880d681SAndroid Build Coastguard Worker 
326*9880d681SAndroid Build Coastguard Worker   // Byte swapping store.
327*9880d681SAndroid Build Coastguard Worker   //
328*9880d681SAndroid Build Coastguard Worker   // Operand 0: the value to store
329*9880d681SAndroid Build Coastguard Worker   // Operand 1: the address to store to
330*9880d681SAndroid Build Coastguard Worker   // Operand 2: the type of store (i16, i32, i64)
331*9880d681SAndroid Build Coastguard Worker   STRV,
332*9880d681SAndroid Build Coastguard Worker 
333*9880d681SAndroid Build Coastguard Worker   // Prefetch from the second operand using the 4-bit control code in
334*9880d681SAndroid Build Coastguard Worker   // the first operand.  The code is 1 for a load prefetch and 2 for
335*9880d681SAndroid Build Coastguard Worker   // a store prefetch.
336*9880d681SAndroid Build Coastguard Worker   PREFETCH
337*9880d681SAndroid Build Coastguard Worker };
338*9880d681SAndroid Build Coastguard Worker 
339*9880d681SAndroid Build Coastguard Worker // Return true if OPCODE is some kind of PC-relative address.
isPCREL(unsigned Opcode)340*9880d681SAndroid Build Coastguard Worker inline bool isPCREL(unsigned Opcode) {
341*9880d681SAndroid Build Coastguard Worker   return Opcode == PCREL_WRAPPER || Opcode == PCREL_OFFSET;
342*9880d681SAndroid Build Coastguard Worker }
343*9880d681SAndroid Build Coastguard Worker } // end namespace SystemZISD
344*9880d681SAndroid Build Coastguard Worker 
345*9880d681SAndroid Build Coastguard Worker namespace SystemZICMP {
346*9880d681SAndroid Build Coastguard Worker // Describes whether an integer comparison needs to be signed or unsigned,
347*9880d681SAndroid Build Coastguard Worker // or whether either type is OK.
348*9880d681SAndroid Build Coastguard Worker enum {
349*9880d681SAndroid Build Coastguard Worker   Any,
350*9880d681SAndroid Build Coastguard Worker   UnsignedOnly,
351*9880d681SAndroid Build Coastguard Worker   SignedOnly
352*9880d681SAndroid Build Coastguard Worker };
353*9880d681SAndroid Build Coastguard Worker } // end namespace SystemZICMP
354*9880d681SAndroid Build Coastguard Worker 
355*9880d681SAndroid Build Coastguard Worker class SystemZSubtarget;
356*9880d681SAndroid Build Coastguard Worker class SystemZTargetMachine;
357*9880d681SAndroid Build Coastguard Worker 
358*9880d681SAndroid Build Coastguard Worker class SystemZTargetLowering : public TargetLowering {
359*9880d681SAndroid Build Coastguard Worker public:
360*9880d681SAndroid Build Coastguard Worker   explicit SystemZTargetLowering(const TargetMachine &TM,
361*9880d681SAndroid Build Coastguard Worker                                  const SystemZSubtarget &STI);
362*9880d681SAndroid Build Coastguard Worker 
363*9880d681SAndroid Build Coastguard Worker   // Override TargetLowering.
getScalarShiftAmountTy(const DataLayout &,EVT)364*9880d681SAndroid Build Coastguard Worker   MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override {
365*9880d681SAndroid Build Coastguard Worker     return MVT::i32;
366*9880d681SAndroid Build Coastguard Worker   }
getVectorIdxTy(const DataLayout & DL)367*9880d681SAndroid Build Coastguard Worker   MVT getVectorIdxTy(const DataLayout &DL) const override {
368*9880d681SAndroid Build Coastguard Worker     // Only the lower 12 bits of an element index are used, so we don't
369*9880d681SAndroid Build Coastguard Worker     // want to clobber the upper 32 bits of a GPR unnecessarily.
370*9880d681SAndroid Build Coastguard Worker     return MVT::i32;
371*9880d681SAndroid Build Coastguard Worker   }
getPreferredVectorAction(EVT VT)372*9880d681SAndroid Build Coastguard Worker   TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(EVT VT)
373*9880d681SAndroid Build Coastguard Worker     const override {
374*9880d681SAndroid Build Coastguard Worker     // Widen subvectors to the full width rather than promoting integer
375*9880d681SAndroid Build Coastguard Worker     // elements.  This is better because:
376*9880d681SAndroid Build Coastguard Worker     //
377*9880d681SAndroid Build Coastguard Worker     // (a) it means that we can handle the ABI for passing and returning
378*9880d681SAndroid Build Coastguard Worker     //     sub-128 vectors without having to handle them as legal types.
379*9880d681SAndroid Build Coastguard Worker     //
380*9880d681SAndroid Build Coastguard Worker     // (b) we don't have instructions to extend on load and truncate on store,
381*9880d681SAndroid Build Coastguard Worker     //     so promoting the integers is less efficient.
382*9880d681SAndroid Build Coastguard Worker     //
383*9880d681SAndroid Build Coastguard Worker     // (c) there are no multiplication instructions for the widest integer
384*9880d681SAndroid Build Coastguard Worker     //     type (v2i64).
385*9880d681SAndroid Build Coastguard Worker     if (VT.getVectorElementType().getSizeInBits() % 8 == 0)
386*9880d681SAndroid Build Coastguard Worker       return TypeWidenVector;
387*9880d681SAndroid Build Coastguard Worker     return TargetLoweringBase::getPreferredVectorAction(VT);
388*9880d681SAndroid Build Coastguard Worker   }
389*9880d681SAndroid Build Coastguard Worker   EVT getSetCCResultType(const DataLayout &DL, LLVMContext &,
390*9880d681SAndroid Build Coastguard Worker                          EVT) const override;
391*9880d681SAndroid Build Coastguard Worker   bool isFMAFasterThanFMulAndFAdd(EVT VT) const override;
392*9880d681SAndroid Build Coastguard Worker   bool isFPImmLegal(const APFloat &Imm, EVT VT) const override;
393*9880d681SAndroid Build Coastguard Worker   bool isLegalICmpImmediate(int64_t Imm) const override;
394*9880d681SAndroid Build Coastguard Worker   bool isLegalAddImmediate(int64_t Imm) const override;
395*9880d681SAndroid Build Coastguard Worker   bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
396*9880d681SAndroid Build Coastguard Worker                              unsigned AS) const override;
397*9880d681SAndroid Build Coastguard Worker   bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS,
398*9880d681SAndroid Build Coastguard Worker                                       unsigned Align,
399*9880d681SAndroid Build Coastguard Worker                                       bool *Fast) const override;
400*9880d681SAndroid Build Coastguard Worker   bool isTruncateFree(Type *, Type *) const override;
401*9880d681SAndroid Build Coastguard Worker   bool isTruncateFree(EVT, EVT) const override;
402*9880d681SAndroid Build Coastguard Worker   const char *getTargetNodeName(unsigned Opcode) const override;
403*9880d681SAndroid Build Coastguard Worker   std::pair<unsigned, const TargetRegisterClass *>
404*9880d681SAndroid Build Coastguard Worker   getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
405*9880d681SAndroid Build Coastguard Worker                                StringRef Constraint, MVT VT) const override;
406*9880d681SAndroid Build Coastguard Worker   TargetLowering::ConstraintType
407*9880d681SAndroid Build Coastguard Worker   getConstraintType(StringRef Constraint) const override;
408*9880d681SAndroid Build Coastguard Worker   TargetLowering::ConstraintWeight
409*9880d681SAndroid Build Coastguard Worker     getSingleConstraintMatchWeight(AsmOperandInfo &info,
410*9880d681SAndroid Build Coastguard Worker                                    const char *constraint) const override;
411*9880d681SAndroid Build Coastguard Worker   void LowerAsmOperandForConstraint(SDValue Op,
412*9880d681SAndroid Build Coastguard Worker                                     std::string &Constraint,
413*9880d681SAndroid Build Coastguard Worker                                     std::vector<SDValue> &Ops,
414*9880d681SAndroid Build Coastguard Worker                                     SelectionDAG &DAG) const override;
415*9880d681SAndroid Build Coastguard Worker 
getInlineAsmMemConstraint(StringRef ConstraintCode)416*9880d681SAndroid Build Coastguard Worker   unsigned getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
417*9880d681SAndroid Build Coastguard Worker     if (ConstraintCode.size() == 1) {
418*9880d681SAndroid Build Coastguard Worker       switch(ConstraintCode[0]) {
419*9880d681SAndroid Build Coastguard Worker       default:
420*9880d681SAndroid Build Coastguard Worker         break;
421*9880d681SAndroid Build Coastguard Worker       case 'Q':
422*9880d681SAndroid Build Coastguard Worker         return InlineAsm::Constraint_Q;
423*9880d681SAndroid Build Coastguard Worker       case 'R':
424*9880d681SAndroid Build Coastguard Worker         return InlineAsm::Constraint_R;
425*9880d681SAndroid Build Coastguard Worker       case 'S':
426*9880d681SAndroid Build Coastguard Worker         return InlineAsm::Constraint_S;
427*9880d681SAndroid Build Coastguard Worker       case 'T':
428*9880d681SAndroid Build Coastguard Worker         return InlineAsm::Constraint_T;
429*9880d681SAndroid Build Coastguard Worker       }
430*9880d681SAndroid Build Coastguard Worker     }
431*9880d681SAndroid Build Coastguard Worker     return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
432*9880d681SAndroid Build Coastguard Worker   }
433*9880d681SAndroid Build Coastguard Worker 
434*9880d681SAndroid Build Coastguard Worker   /// If a physical register, this returns the register that receives the
435*9880d681SAndroid Build Coastguard Worker   /// exception address on entry to an EH pad.
436*9880d681SAndroid Build Coastguard Worker   unsigned
getExceptionPointerRegister(const Constant * PersonalityFn)437*9880d681SAndroid Build Coastguard Worker   getExceptionPointerRegister(const Constant *PersonalityFn) const override {
438*9880d681SAndroid Build Coastguard Worker     return SystemZ::R6D;
439*9880d681SAndroid Build Coastguard Worker   }
440*9880d681SAndroid Build Coastguard Worker 
441*9880d681SAndroid Build Coastguard Worker   /// If a physical register, this returns the register that receives the
442*9880d681SAndroid Build Coastguard Worker   /// exception typeid on entry to a landing pad.
443*9880d681SAndroid Build Coastguard Worker   unsigned
getExceptionSelectorRegister(const Constant * PersonalityFn)444*9880d681SAndroid Build Coastguard Worker   getExceptionSelectorRegister(const Constant *PersonalityFn) const override {
445*9880d681SAndroid Build Coastguard Worker     return SystemZ::R7D;
446*9880d681SAndroid Build Coastguard Worker   }
447*9880d681SAndroid Build Coastguard Worker 
448*9880d681SAndroid Build Coastguard Worker   /// Override to support customized stack guard loading.
useLoadStackGuardNode()449*9880d681SAndroid Build Coastguard Worker   bool useLoadStackGuardNode() const override {
450*9880d681SAndroid Build Coastguard Worker     return true;
451*9880d681SAndroid Build Coastguard Worker   }
insertSSPDeclarations(Module & M)452*9880d681SAndroid Build Coastguard Worker   void insertSSPDeclarations(Module &M) const override {
453*9880d681SAndroid Build Coastguard Worker   }
454*9880d681SAndroid Build Coastguard Worker 
455*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *
456*9880d681SAndroid Build Coastguard Worker   EmitInstrWithCustomInserter(MachineInstr &MI,
457*9880d681SAndroid Build Coastguard Worker                               MachineBasicBlock *BB) const override;
458*9880d681SAndroid Build Coastguard Worker   SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
459*9880d681SAndroid Build Coastguard Worker   bool allowTruncateForTailCall(Type *, Type *) const override;
460*9880d681SAndroid Build Coastguard Worker   bool mayBeEmittedAsTailCall(CallInst *CI) const override;
461*9880d681SAndroid Build Coastguard Worker   SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
462*9880d681SAndroid Build Coastguard Worker                                bool isVarArg,
463*9880d681SAndroid Build Coastguard Worker                                const SmallVectorImpl<ISD::InputArg> &Ins,
464*9880d681SAndroid Build Coastguard Worker                                const SDLoc &DL, SelectionDAG &DAG,
465*9880d681SAndroid Build Coastguard Worker                                SmallVectorImpl<SDValue> &InVals) const override;
466*9880d681SAndroid Build Coastguard Worker   SDValue LowerCall(CallLoweringInfo &CLI,
467*9880d681SAndroid Build Coastguard Worker                     SmallVectorImpl<SDValue> &InVals) const override;
468*9880d681SAndroid Build Coastguard Worker 
469*9880d681SAndroid Build Coastguard Worker   bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
470*9880d681SAndroid Build Coastguard Worker                       bool isVarArg,
471*9880d681SAndroid Build Coastguard Worker                       const SmallVectorImpl<ISD::OutputArg> &Outs,
472*9880d681SAndroid Build Coastguard Worker                       LLVMContext &Context) const override;
473*9880d681SAndroid Build Coastguard Worker   SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
474*9880d681SAndroid Build Coastguard Worker                       const SmallVectorImpl<ISD::OutputArg> &Outs,
475*9880d681SAndroid Build Coastguard Worker                       const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,
476*9880d681SAndroid Build Coastguard Worker                       SelectionDAG &DAG) const override;
477*9880d681SAndroid Build Coastguard Worker   SDValue prepareVolatileOrAtomicLoad(SDValue Chain, const SDLoc &DL,
478*9880d681SAndroid Build Coastguard Worker                                       SelectionDAG &DAG) const override;
479*9880d681SAndroid Build Coastguard Worker   SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
480*9880d681SAndroid Build Coastguard Worker 
getExtendForAtomicOps()481*9880d681SAndroid Build Coastguard Worker   ISD::NodeType getExtendForAtomicOps() const override {
482*9880d681SAndroid Build Coastguard Worker     return ISD::ANY_EXTEND;
483*9880d681SAndroid Build Coastguard Worker   }
484*9880d681SAndroid Build Coastguard Worker 
supportSwiftError()485*9880d681SAndroid Build Coastguard Worker   bool supportSwiftError() const override {
486*9880d681SAndroid Build Coastguard Worker     return true;
487*9880d681SAndroid Build Coastguard Worker   }
488*9880d681SAndroid Build Coastguard Worker 
489*9880d681SAndroid Build Coastguard Worker private:
490*9880d681SAndroid Build Coastguard Worker   const SystemZSubtarget &Subtarget;
491*9880d681SAndroid Build Coastguard Worker 
492*9880d681SAndroid Build Coastguard Worker   // Implement LowerOperation for individual opcodes.
493*9880d681SAndroid Build Coastguard Worker   SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const;
494*9880d681SAndroid Build Coastguard Worker   SDValue lowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
495*9880d681SAndroid Build Coastguard Worker   SDValue lowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
496*9880d681SAndroid Build Coastguard Worker   SDValue lowerGlobalAddress(GlobalAddressSDNode *Node,
497*9880d681SAndroid Build Coastguard Worker                              SelectionDAG &DAG) const;
498*9880d681SAndroid Build Coastguard Worker   SDValue lowerTLSGetOffset(GlobalAddressSDNode *Node,
499*9880d681SAndroid Build Coastguard Worker                             SelectionDAG &DAG, unsigned Opcode,
500*9880d681SAndroid Build Coastguard Worker                             SDValue GOTOffset) const;
501*9880d681SAndroid Build Coastguard Worker   SDValue lowerThreadPointer(const SDLoc &DL, SelectionDAG &DAG) const;
502*9880d681SAndroid Build Coastguard Worker   SDValue lowerGlobalTLSAddress(GlobalAddressSDNode *Node,
503*9880d681SAndroid Build Coastguard Worker                                 SelectionDAG &DAG) const;
504*9880d681SAndroid Build Coastguard Worker   SDValue lowerBlockAddress(BlockAddressSDNode *Node,
505*9880d681SAndroid Build Coastguard Worker                             SelectionDAG &DAG) const;
506*9880d681SAndroid Build Coastguard Worker   SDValue lowerJumpTable(JumpTableSDNode *JT, SelectionDAG &DAG) const;
507*9880d681SAndroid Build Coastguard Worker   SDValue lowerConstantPool(ConstantPoolSDNode *CP, SelectionDAG &DAG) const;
508*9880d681SAndroid Build Coastguard Worker   SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
509*9880d681SAndroid Build Coastguard Worker   SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
510*9880d681SAndroid Build Coastguard Worker   SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const;
511*9880d681SAndroid Build Coastguard Worker   SDValue lowerVACOPY(SDValue Op, SelectionDAG &DAG) const;
512*9880d681SAndroid Build Coastguard Worker   SDValue lowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
513*9880d681SAndroid Build Coastguard Worker   SDValue lowerGET_DYNAMIC_AREA_OFFSET(SDValue Op, SelectionDAG &DAG) const;
514*9880d681SAndroid Build Coastguard Worker   SDValue lowerSMUL_LOHI(SDValue Op, SelectionDAG &DAG) const;
515*9880d681SAndroid Build Coastguard Worker   SDValue lowerUMUL_LOHI(SDValue Op, SelectionDAG &DAG) const;
516*9880d681SAndroid Build Coastguard Worker   SDValue lowerSDIVREM(SDValue Op, SelectionDAG &DAG) const;
517*9880d681SAndroid Build Coastguard Worker   SDValue lowerUDIVREM(SDValue Op, SelectionDAG &DAG) const;
518*9880d681SAndroid Build Coastguard Worker   SDValue lowerBITCAST(SDValue Op, SelectionDAG &DAG) const;
519*9880d681SAndroid Build Coastguard Worker   SDValue lowerOR(SDValue Op, SelectionDAG &DAG) const;
520*9880d681SAndroid Build Coastguard Worker   SDValue lowerCTPOP(SDValue Op, SelectionDAG &DAG) const;
521*9880d681SAndroid Build Coastguard Worker   SDValue lowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG) const;
522*9880d681SAndroid Build Coastguard Worker   SDValue lowerATOMIC_LOAD(SDValue Op, SelectionDAG &DAG) const;
523*9880d681SAndroid Build Coastguard Worker   SDValue lowerATOMIC_STORE(SDValue Op, SelectionDAG &DAG) const;
524*9880d681SAndroid Build Coastguard Worker   SDValue lowerATOMIC_LOAD_OP(SDValue Op, SelectionDAG &DAG,
525*9880d681SAndroid Build Coastguard Worker                               unsigned Opcode) const;
526*9880d681SAndroid Build Coastguard Worker   SDValue lowerATOMIC_LOAD_SUB(SDValue Op, SelectionDAG &DAG) const;
527*9880d681SAndroid Build Coastguard Worker   SDValue lowerATOMIC_CMP_SWAP(SDValue Op, SelectionDAG &DAG) const;
528*9880d681SAndroid Build Coastguard Worker   SDValue lowerLOAD_SEQUENCE_POINT(SDValue Op, SelectionDAG &DAG) const;
529*9880d681SAndroid Build Coastguard Worker   SDValue lowerSTACKSAVE(SDValue Op, SelectionDAG &DAG) const;
530*9880d681SAndroid Build Coastguard Worker   SDValue lowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG) const;
531*9880d681SAndroid Build Coastguard Worker   SDValue lowerPREFETCH(SDValue Op, SelectionDAG &DAG) const;
532*9880d681SAndroid Build Coastguard Worker   SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
533*9880d681SAndroid Build Coastguard Worker   SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
534*9880d681SAndroid Build Coastguard Worker   SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
535*9880d681SAndroid Build Coastguard Worker   SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
536*9880d681SAndroid Build Coastguard Worker   SDValue lowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
537*9880d681SAndroid Build Coastguard Worker   SDValue lowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
538*9880d681SAndroid Build Coastguard Worker   SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
539*9880d681SAndroid Build Coastguard Worker   SDValue lowerExtendVectorInreg(SDValue Op, SelectionDAG &DAG,
540*9880d681SAndroid Build Coastguard Worker                                  unsigned UnpackHigh) const;
541*9880d681SAndroid Build Coastguard Worker   SDValue lowerShift(SDValue Op, SelectionDAG &DAG, unsigned ByScalar) const;
542*9880d681SAndroid Build Coastguard Worker 
543*9880d681SAndroid Build Coastguard Worker   SDValue combineExtract(const SDLoc &DL, EVT ElemVT, EVT VecVT, SDValue OrigOp,
544*9880d681SAndroid Build Coastguard Worker                          unsigned Index, DAGCombinerInfo &DCI,
545*9880d681SAndroid Build Coastguard Worker                          bool Force) const;
546*9880d681SAndroid Build Coastguard Worker   SDValue combineTruncateExtract(const SDLoc &DL, EVT TruncVT, SDValue Op,
547*9880d681SAndroid Build Coastguard Worker                                  DAGCombinerInfo &DCI) const;
548*9880d681SAndroid Build Coastguard Worker   SDValue combineSIGN_EXTEND(SDNode *N, DAGCombinerInfo &DCI) const;
549*9880d681SAndroid Build Coastguard Worker   SDValue combineMERGE(SDNode *N, DAGCombinerInfo &DCI) const;
550*9880d681SAndroid Build Coastguard Worker   SDValue combineSTORE(SDNode *N, DAGCombinerInfo &DCI) const;
551*9880d681SAndroid Build Coastguard Worker   SDValue combineEXTRACT_VECTOR_ELT(SDNode *N, DAGCombinerInfo &DCI) const;
552*9880d681SAndroid Build Coastguard Worker   SDValue combineJOIN_DWORDS(SDNode *N, DAGCombinerInfo &DCI) const;
553*9880d681SAndroid Build Coastguard Worker   SDValue combineFP_ROUND(SDNode *N, DAGCombinerInfo &DCI) const;
554*9880d681SAndroid Build Coastguard Worker   SDValue combineBSWAP(SDNode *N, DAGCombinerInfo &DCI) const;
555*9880d681SAndroid Build Coastguard Worker   SDValue combineSHIFTROT(SDNode *N, DAGCombinerInfo &DCI) const;
556*9880d681SAndroid Build Coastguard Worker 
557*9880d681SAndroid Build Coastguard Worker   // If the last instruction before MBBI in MBB was some form of COMPARE,
558*9880d681SAndroid Build Coastguard Worker   // try to replace it with a COMPARE AND BRANCH just before MBBI.
559*9880d681SAndroid Build Coastguard Worker   // CCMask and Target are the BRC-like operands for the branch.
560*9880d681SAndroid Build Coastguard Worker   // Return true if the change was made.
561*9880d681SAndroid Build Coastguard Worker   bool convertPrevCompareToBranch(MachineBasicBlock *MBB,
562*9880d681SAndroid Build Coastguard Worker                                   MachineBasicBlock::iterator MBBI,
563*9880d681SAndroid Build Coastguard Worker                                   unsigned CCMask,
564*9880d681SAndroid Build Coastguard Worker                                   MachineBasicBlock *Target) const;
565*9880d681SAndroid Build Coastguard Worker 
566*9880d681SAndroid Build Coastguard Worker   // Implement EmitInstrWithCustomInserter for individual operation types.
567*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitSelect(MachineInstr &MI, MachineBasicBlock *BB) const;
568*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitCondStore(MachineInstr &MI, MachineBasicBlock *BB,
569*9880d681SAndroid Build Coastguard Worker                                    unsigned StoreOpcode, unsigned STOCOpcode,
570*9880d681SAndroid Build Coastguard Worker                                    bool Invert) const;
571*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitExt128(MachineInstr &MI, MachineBasicBlock *MBB,
572*9880d681SAndroid Build Coastguard Worker                                 bool ClearEven, unsigned SubReg) const;
573*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitAtomicLoadBinary(MachineInstr &MI,
574*9880d681SAndroid Build Coastguard Worker                                           MachineBasicBlock *BB,
575*9880d681SAndroid Build Coastguard Worker                                           unsigned BinOpcode, unsigned BitSize,
576*9880d681SAndroid Build Coastguard Worker                                           bool Invert = false) const;
577*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitAtomicLoadMinMax(MachineInstr &MI,
578*9880d681SAndroid Build Coastguard Worker                                           MachineBasicBlock *MBB,
579*9880d681SAndroid Build Coastguard Worker                                           unsigned CompareOpcode,
580*9880d681SAndroid Build Coastguard Worker                                           unsigned KeepOldMask,
581*9880d681SAndroid Build Coastguard Worker                                           unsigned BitSize) const;
582*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitAtomicCmpSwapW(MachineInstr &MI,
583*9880d681SAndroid Build Coastguard Worker                                         MachineBasicBlock *BB) const;
584*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitMemMemWrapper(MachineInstr &MI, MachineBasicBlock *BB,
585*9880d681SAndroid Build Coastguard Worker                                        unsigned Opcode) const;
586*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitStringWrapper(MachineInstr &MI, MachineBasicBlock *BB,
587*9880d681SAndroid Build Coastguard Worker                                        unsigned Opcode) const;
588*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitTransactionBegin(MachineInstr &MI,
589*9880d681SAndroid Build Coastguard Worker                                           MachineBasicBlock *MBB,
590*9880d681SAndroid Build Coastguard Worker                                           unsigned Opcode, bool NoFloat) const;
591*9880d681SAndroid Build Coastguard Worker   MachineBasicBlock *emitLoadAndTestCmp0(MachineInstr &MI,
592*9880d681SAndroid Build Coastguard Worker                                          MachineBasicBlock *MBB,
593*9880d681SAndroid Build Coastguard Worker                                          unsigned Opcode) const;
594*9880d681SAndroid Build Coastguard Worker };
595*9880d681SAndroid Build Coastguard Worker } // end namespace llvm
596*9880d681SAndroid Build Coastguard Worker 
597*9880d681SAndroid Build Coastguard Worker #endif
598