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