Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/llvm/Target/TargetSelectionDAG.td is written in an unsupported language. File is not indexed.

0001 //===- TargetSelectionDAG.td - Common code for DAG isels ---*- tablegen -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines the target-independent interfaces used by SelectionDAG
0010 // instruction selection generators.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 //===----------------------------------------------------------------------===//
0015 // Selection DAG Type Constraint definitions.
0016 //
0017 // Note that the semantics of these constraints are hard coded into tblgen.  To
0018 // modify or add constraints, you have to hack tblgen.
0019 //
0020 
0021 class SDTypeConstraint<int opnum> {
0022   int OperandNum = opnum;
0023 }
0024 
0025 // SDTCisVT - The specified operand has exactly this VT.
0026 class SDTCisVT<int OpNum, ValueType vt> : SDTypeConstraint<OpNum> {
0027   ValueType VT = vt;
0028 }
0029 
0030 class SDTCisPtrTy<int OpNum> : SDTypeConstraint<OpNum>;
0031 
0032 // SDTCisInt - The specified operand has integer type.
0033 class SDTCisInt<int OpNum> : SDTypeConstraint<OpNum>;
0034 
0035 // SDTCisFP - The specified operand has floating-point type.
0036 class SDTCisFP<int OpNum> : SDTypeConstraint<OpNum>;
0037 
0038 // SDTCisVec - The specified operand has a vector type.
0039 class SDTCisVec<int OpNum> : SDTypeConstraint<OpNum>;
0040 
0041 // SDTCisSameAs - The two specified operands have identical types.
0042 class SDTCisSameAs<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> {
0043   int OtherOperandNum = OtherOp;
0044 }
0045 
0046 // SDTCisVTSmallerThanOp - The specified operand is a VT SDNode, and its type is
0047 // smaller than the 'Other' operand.
0048 class SDTCisVTSmallerThanOp<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> {
0049   int OtherOperandNum = OtherOp;
0050 }
0051 
0052 class SDTCisOpSmallerThanOp<int SmallOp, int BigOp> : SDTypeConstraint<SmallOp>{
0053   int BigOperandNum = BigOp;
0054 }
0055 
0056 /// SDTCisEltOfVec - This indicates that ThisOp is a scalar type of the same
0057 /// type as the element type of OtherOp, which is a vector type.
0058 class SDTCisEltOfVec<int ThisOp, int OtherOp>
0059   : SDTypeConstraint<ThisOp> {
0060   int OtherOpNum = OtherOp;
0061 }
0062 
0063 /// SDTCisSubVecOfVec - This indicates that ThisOp is a vector type
0064 /// with length less that of OtherOp, which is a vector type.
0065 class SDTCisSubVecOfVec<int ThisOp, int OtherOp>
0066   : SDTypeConstraint<ThisOp> {
0067   int OtherOpNum = OtherOp;
0068 }
0069 
0070 // SDTCVecEltisVT - The specified operand is vector type with element type
0071 // of VT.
0072 class SDTCVecEltisVT<int OpNum, ValueType vt> : SDTypeConstraint<OpNum> {
0073   ValueType VT = vt;
0074 }
0075 
0076 // SDTCisSameNumEltsAs - The two specified operands have identical number
0077 // of elements.
0078 class SDTCisSameNumEltsAs<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> {
0079   int OtherOperandNum = OtherOp;
0080 }
0081 
0082 // SDTCisSameSizeAs - The two specified operands have identical size.
0083 class SDTCisSameSizeAs<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> {
0084   int OtherOperandNum = OtherOp;
0085 }
0086 
0087 //===----------------------------------------------------------------------===//
0088 // Selection DAG Type Profile definitions.
0089 //
0090 // These use the constraints defined above to describe the type requirements of
0091 // the various nodes.  These are not hard coded into tblgen, allowing targets to
0092 // add their own if needed.
0093 //
0094 
0095 // SDTypeProfile - This profile describes the type requirements of a Selection
0096 // DAG node.
0097 class SDTypeProfile<int numresults, int numoperands,
0098                     list<SDTypeConstraint> constraints> {
0099   int NumResults = numresults;
0100   int NumOperands = numoperands;
0101   list<SDTypeConstraint> Constraints = constraints;
0102 }
0103 
0104 // Builtin profiles.
0105 def SDTIntLeaf: SDTypeProfile<1, 0, [SDTCisInt<0>]>;         // for 'imm'.
0106 def SDTFPLeaf : SDTypeProfile<1, 0, [SDTCisFP<0>]>;          // for 'fpimm'.
0107 def SDTPtrLeaf: SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>;       // for '&g'.
0108 def SDTOther  : SDTypeProfile<1, 0, [SDTCisVT<0, OtherVT>]>; // for 'vt'.
0109 def SDTUNDEF  : SDTypeProfile<1, 0, []>;                     // for 'undef'.
0110 def SDTUnaryOp  : SDTypeProfile<1, 1, []>;                   // for bitconvert.
0111 
0112 def SDTPtrAddOp : SDTypeProfile<1, 2, [     // ptradd
0113   SDTCisSameAs<0, 1>, SDTCisInt<2>, SDTCisPtrTy<1>
0114 ]>;
0115 def SDTIntBinOp : SDTypeProfile<1, 2, [     // add, and, or, xor, udiv, etc.
0116   SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>
0117 ]>;
0118 def SDTIntShiftOp : SDTypeProfile<1, 2, [   // shl, sra, srl
0119   SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisInt<2>
0120 ]>;
0121 def SDTIntShiftPairOp : SDTypeProfile<2, 3, [ // shl_parts, sra_parts, srl_parts
0122   SDTCisInt<0>, SDTCisSameAs<1, 0>,
0123   SDTCisSameAs<2, 0>, SDTCisSameAs<3, 0>, SDTCisInt<4>
0124 ]>;
0125 def SDTIntShiftDOp: SDTypeProfile<1, 3, [   // fshl, fshr
0126   SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>, SDTCisInt<3>
0127 ]>;
0128 def SDTIntSatNoShOp : SDTypeProfile<1, 2, [   // ssat with no shift
0129   SDTCisSameAs<0, 1>, SDTCisInt<2>
0130 ]>;
0131 def SDTIntBinHiLoOp : SDTypeProfile<2, 2, [ // smullohi, umullohi, sdivrem, udivrem
0132   SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisInt<0>
0133 ]>;
0134 def SDTIntScaledBinOp : SDTypeProfile<1, 3, [  // smulfix, sdivfix, etc
0135   SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>, SDTCisInt<3>
0136 ]>;
0137 
0138 def SDTFPBinOp : SDTypeProfile<1, 2, [      // fadd, fmul, etc.
0139   SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisFP<0>
0140 ]>;
0141 def SDTFPSignOp : SDTypeProfile<1, 2, [     // fcopysign.
0142   SDTCisSameAs<0, 1>, SDTCisFP<0>, SDTCisFP<2>
0143 ]>;
0144 def SDTFPTernaryOp : SDTypeProfile<1, 3, [  // fmadd, fnmsub, etc.
0145   SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisFP<0>
0146 ]>;
0147 def SDTIntUnaryOp : SDTypeProfile<1, 1, [ // bitreverse
0148   SDTCisSameAs<0, 1>, SDTCisInt<0>
0149 ]>;
0150 def SDTIntBitCountUnaryOp : SDTypeProfile<1, 1, [   // ctlz, cttz
0151   SDTCisInt<0>, SDTCisInt<1>
0152 ]>;
0153 def SDTIntExtendOp : SDTypeProfile<1, 1, [  // sext, zext, anyext
0154   SDTCisInt<0>, SDTCisInt<1>, SDTCisOpSmallerThanOp<1, 0>, SDTCisSameNumEltsAs<0, 1>
0155 ]>;
0156 def SDTIntTruncOp  : SDTypeProfile<1, 1, [  // trunc
0157   SDTCisInt<0>, SDTCisInt<1>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1>
0158 ]>;
0159 def SDTFPUnaryOp  : SDTypeProfile<1, 1, [   // fneg, fsqrt, etc
0160   SDTCisSameAs<0, 1>, SDTCisFP<0>
0161 ]>;
0162 def SDTFPRoundOp  : SDTypeProfile<1, 1, [   // fpround
0163   SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1>
0164 ]>;
0165 def SDTFPTruncRoundOp  : SDTypeProfile<1, 2, [
0166   SDTCisFP<0>, SDTCisFP<1>, SDTCisInt<2>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1>
0167 ]>;
0168 def SDTFPExtendOp  : SDTypeProfile<1, 1, [  // fpextend
0169   SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<1, 0>, SDTCisSameNumEltsAs<0, 1>
0170 ]>;
0171 def SDIsFPClassOp : SDTypeProfile<1, 2, [   // is_fpclass
0172   SDTCisInt<0>, SDTCisFP<1>, SDTCisInt<2>, SDTCisSameNumEltsAs<0, 1>
0173 ]>;
0174 def SDTIntToFPOp : SDTypeProfile<1, 1, [    // [su]int_to_fp
0175   SDTCisFP<0>, SDTCisInt<1>, SDTCisSameNumEltsAs<0, 1>
0176 ]>;
0177 def SDTFPToIntOp : SDTypeProfile<1, 1, [    // fp_to_[su]int
0178   SDTCisInt<0>, SDTCisFP<1>, SDTCisSameNumEltsAs<0, 1>
0179 ]>;
0180 def SDTFPToIntSatOp : SDTypeProfile<1, 2, [    // fp_to_[su]int_sat
0181   SDTCisInt<0>, SDTCisFP<1>, SDTCisSameNumEltsAs<0, 1>, SDTCisVT<2, OtherVT>
0182 ]>;
0183 def SDTFPExpOp : SDTypeProfile<1, 2, [      // ldexp
0184   SDTCisSameAs<0, 1>, SDTCisFP<0>, SDTCisInt<2>
0185 ]>;
0186 def SDTGetFPStateOp : SDTypeProfile<1, 0, [ // get_fpenv, get_fpmode
0187   SDTCisInt<0>
0188 ]>;
0189 def SDTSetFPStateOp : SDTypeProfile<0, 1, [ // set_fpenv, set_fpmode
0190   SDTCisInt<0>
0191 ]>;
0192 def SDTExtInreg : SDTypeProfile<1, 2, [     // sext_inreg
0193   SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisVT<2, OtherVT>,
0194   SDTCisVTSmallerThanOp<2, 1>
0195 ]>;
0196 def SDTExtInvec : SDTypeProfile<1, 1, [     // sext_invec
0197   SDTCisInt<0>, SDTCisVec<0>, SDTCisInt<1>, SDTCisVec<1>,
0198   SDTCisOpSmallerThanOp<1, 0>
0199 ]>;
0200 def SDTFreeze : SDTypeProfile<1, 1, [
0201   SDTCisSameAs<0, 1>
0202 ]>;
0203 
0204 def SDTSetCC : SDTypeProfile<1, 3, [        // setcc
0205   SDTCisInt<0>, SDTCisSameAs<1, 2>, SDTCisVT<3, OtherVT>
0206 ]>;
0207 
0208 def SDTSelect : SDTypeProfile<1, 3, [       // select
0209   SDTCisInt<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3>
0210 ]>;
0211 
0212 def SDTVSelect : SDTypeProfile<1, 3, [       // vselect
0213   SDTCisVec<0>, SDTCisInt<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3>, SDTCisSameNumEltsAs<0, 1>
0214 ]>;
0215 
0216 def SDTSelectCC : SDTypeProfile<1, 5, [     // select_cc
0217   SDTCisSameAs<1, 2>, SDTCisSameAs<3, 4>, SDTCisSameAs<0, 3>,
0218   SDTCisVT<5, OtherVT>
0219 ]>;
0220 
0221 def SDTBr : SDTypeProfile<0, 1, [           // br
0222   SDTCisVT<0, OtherVT>
0223 ]>;
0224 
0225 def SDTBrCC : SDTypeProfile<0, 4, [       // brcc
0226   SDTCisVT<0, OtherVT>, SDTCisSameAs<1, 2>, SDTCisVT<3, OtherVT>
0227 ]>;
0228 
0229 def SDTBrcond : SDTypeProfile<0, 2, [       // brcond
0230   SDTCisInt<0>, SDTCisVT<1, OtherVT>
0231 ]>;
0232 
0233 def SDTBrind : SDTypeProfile<0, 1, [        // brind
0234   SDTCisPtrTy<0>
0235 ]>;
0236 
0237 def SDTCatchret : SDTypeProfile<0, 2, [     // catchret
0238   SDTCisVT<0, OtherVT>, SDTCisVT<1, OtherVT>
0239 ]>;
0240 
0241 def SDTCleanupret : SDTypeProfile<0, 1, [   // cleanupret
0242   SDTCisVT<0, OtherVT>
0243 ]>;
0244 
0245 def SDTNone : SDTypeProfile<0, 0, []>;      // ret, trap
0246 
0247 def SDTUBSANTrap : SDTypeProfile<0, 1, []>;      // ubsantrap
0248 
0249 def SDTLoad : SDTypeProfile<1, 1, [         // load
0250   SDTCisPtrTy<1>
0251 ]>;
0252 
0253 def SDTStore : SDTypeProfile<0, 2, [        // store
0254   SDTCisPtrTy<1>
0255 ]>;
0256 
0257 def SDTIStore : SDTypeProfile<1, 3, [       // indexed store
0258   SDTCisSameAs<0, 2>, SDTCisPtrTy<0>, SDTCisPtrTy<3>
0259 ]>;
0260 
0261 def SDTMaskedStore: SDTypeProfile<0, 4, [       // masked store
0262   SDTCisVec<0>, SDTCisPtrTy<1>, SDTCisPtrTy<2>, SDTCisVec<3>, SDTCisSameNumEltsAs<0, 3>
0263 ]>;
0264 
0265 def SDTMaskedLoad: SDTypeProfile<1, 4, [       // masked load
0266   SDTCisVec<0>, SDTCisPtrTy<1>, SDTCisPtrTy<2>, SDTCisVec<3>, SDTCisSameAs<0, 4>,
0267   SDTCisSameNumEltsAs<0, 3>
0268 ]>;
0269 
0270 def SDTMaskedGather : SDTypeProfile<1, 4, [
0271   SDTCisVec<0>, SDTCisSameAs<0, 1>, SDTCisVec<2>, SDTCisPtrTy<3>, SDTCisVec<4>,
0272   SDTCisSameNumEltsAs<0, 2>, SDTCisSameNumEltsAs<0, 4>
0273 ]>;
0274 
0275 def SDTMaskedScatter : SDTypeProfile<0, 4, [
0276   SDTCisVec<0>, SDTCisVec<1>, SDTCisPtrTy<2>, SDTCisVec<3>,
0277   SDTCisSameNumEltsAs<0, 1>, SDTCisSameNumEltsAs<0, 3>
0278 ]>;
0279 
0280 def SDTVectorCompress : SDTypeProfile<1, 3, [
0281   SDTCisVec<0>, SDTCisSameAs<0, 1>,
0282   SDTCisVec<2>, SDTCisSameNumEltsAs<1, 2>,
0283   SDTCisSameAs<1, 3>
0284 ]>;
0285 
0286 def SDTVecShuffle : SDTypeProfile<1, 2, [
0287   SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>
0288 ]>;
0289 def SDTVecSlice : SDTypeProfile<1, 3, [     // vector splice
0290   SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisInt<3>
0291 ]>;
0292 def SDTVecExtract : SDTypeProfile<1, 2, [   // vector extract
0293   SDTCisEltOfVec<0, 1>, SDTCisPtrTy<2>
0294 ]>;
0295 def SDTVecInsert : SDTypeProfile<1, 3, [    // vector insert
0296   SDTCisEltOfVec<2, 1>, SDTCisSameAs<0, 1>, SDTCisPtrTy<3>
0297 ]>;
0298 def SDTVecReduce : SDTypeProfile<1, 1, [    // vector reduction
0299   SDTCisInt<0>, SDTCisVec<1>
0300 ]>;
0301 def SDTFPVecReduce : SDTypeProfile<1, 1, [  // FP vector reduction
0302   SDTCisFP<0>, SDTCisVec<1>
0303 ]>;
0304 
0305 def SDTVecReverse : SDTypeProfile<1, 1, [  // vector reverse
0306   SDTCisVec<0>, SDTCisSameAs<0,1>
0307 ]>;
0308 
0309 def SDTSubVecExtract : SDTypeProfile<1, 2, [// subvector extract
0310   SDTCisSubVecOfVec<0,1>, SDTCisInt<2>
0311 ]>;
0312 def SDTSubVecInsert : SDTypeProfile<1, 3, [ // subvector insert
0313   SDTCisSubVecOfVec<2, 1>, SDTCisSameAs<0,1>, SDTCisInt<3>
0314 ]>;
0315 
0316 def SDTPrefetch : SDTypeProfile<0, 4, [     // prefetch
0317   SDTCisPtrTy<0>, SDTCisSameAs<1, 2>, SDTCisSameAs<1, 3>, SDTCisInt<1>
0318 ]>;
0319 
0320 def SDTAtomicFence : SDTypeProfile<0, 2, [
0321   SDTCisSameAs<0,1>, SDTCisPtrTy<0>
0322 ]>;
0323 def SDTAtomic3 : SDTypeProfile<1, 3, [
0324   SDTCisSameAs<0,2>,  SDTCisSameAs<0,3>, SDTCisInt<0>, SDTCisPtrTy<1>
0325 ]>;
0326 def SDTAtomic2 : SDTypeProfile<1, 2, [
0327   SDTCisSameAs<0,2>, SDTCisInt<0>, SDTCisPtrTy<1>
0328 ]>;
0329 
0330 def SDTFPAtomic2 : SDTypeProfile<1, 2, [
0331   SDTCisSameAs<0,2>, SDTCisFP<0>, SDTCisPtrTy<1>
0332 ]>;
0333 
0334 def SDTAtomicStore : SDTypeProfile<0, 2, [
0335   SDTCisInt<0>, SDTCisPtrTy<1>
0336 ]>;
0337 def SDTAtomicLoad : SDTypeProfile<1, 1, [
0338   SDTCisPtrTy<1>
0339 ]>;
0340 
0341 class SDCallSeqStart<list<SDTypeConstraint> constraints> :
0342         SDTypeProfile<0, 2, constraints>;
0343 class SDCallSeqEnd<list<SDTypeConstraint> constraints> :
0344         SDTypeProfile<0, 2, constraints>;
0345 
0346 //===----------------------------------------------------------------------===//
0347 // Selection DAG Node definitions.
0348 //
0349 class SDNode<string opcode, SDTypeProfile typeprof,
0350              list<SDNodeProperty> props = [], string sdclass = "SDNode">
0351              : SDPatternOperator {
0352   string Opcode  = opcode;
0353   string SDClass = sdclass;
0354   let Properties = props;
0355   SDTypeProfile TypeProfile = typeprof;
0356   bit IsStrictFP = false;
0357   bits<32> TSFlags = 0;
0358 }
0359 
0360 // Special TableGen-recognized dag nodes
0361 def set;
0362 def implicit;
0363 def node;
0364 def srcvalue;
0365 
0366 def imm        : SDNode<"ISD::Constant"  , SDTIntLeaf , [], "ConstantSDNode">;
0367 def timm       : SDNode<"ISD::TargetConstant",SDTIntLeaf, [], "ConstantSDNode">;
0368 def fpimm      : SDNode<"ISD::ConstantFP", SDTFPLeaf  , [], "ConstantFPSDNode">;
0369 def vt         : SDNode<"ISD::VALUETYPE" , SDTOther   , [], "VTSDNode">;
0370 def bb         : SDNode<"ISD::BasicBlock", SDTOther   , [], "BasicBlockSDNode">;
0371 def cond       : SDNode<"ISD::CONDCODE"  , SDTOther   , [], "CondCodeSDNode">;
0372 def undef      : SDNode<"ISD::UNDEF"     , SDTUNDEF   , []>;
0373 def vscale     : SDNode<"ISD::VSCALE"    , SDTIntUnaryOp, []>;
0374 def globaladdr : SDNode<"ISD::GlobalAddress",         SDTPtrLeaf, [],
0375                         "GlobalAddressSDNode">;
0376 def tglobaladdr : SDNode<"ISD::TargetGlobalAddress",  SDTPtrLeaf, [],
0377                          "GlobalAddressSDNode">;
0378 def globaltlsaddr : SDNode<"ISD::GlobalTLSAddress",         SDTPtrLeaf, [],
0379                           "GlobalAddressSDNode">;
0380 def tglobaltlsaddr : SDNode<"ISD::TargetGlobalTLSAddress",  SDTPtrLeaf, [],
0381                            "GlobalAddressSDNode">;
0382 def constpool   : SDNode<"ISD::ConstantPool",         SDTPtrLeaf, [],
0383                          "ConstantPoolSDNode">;
0384 def tconstpool  : SDNode<"ISD::TargetConstantPool",   SDTPtrLeaf, [],
0385                          "ConstantPoolSDNode">;
0386 def jumptable   : SDNode<"ISD::JumpTable",            SDTPtrLeaf, [],
0387                          "JumpTableSDNode">;
0388 def tjumptable  : SDNode<"ISD::TargetJumpTable",      SDTPtrLeaf, [],
0389                          "JumpTableSDNode">;
0390 def frameindex  : SDNode<"ISD::FrameIndex",           SDTPtrLeaf, [],
0391                          "FrameIndexSDNode">;
0392 def tframeindex : SDNode<"ISD::TargetFrameIndex",     SDTPtrLeaf, [],
0393                          "FrameIndexSDNode">;
0394 def externalsym : SDNode<"ISD::ExternalSymbol",       SDTPtrLeaf, [],
0395                          "ExternalSymbolSDNode">;
0396 def texternalsym: SDNode<"ISD::TargetExternalSymbol", SDTPtrLeaf, [],
0397                          "ExternalSymbolSDNode">;
0398 def mcsym: SDNode<"ISD::MCSymbol", SDTPtrLeaf, [], "MCSymbolSDNode">;
0399 def blockaddress : SDNode<"ISD::BlockAddress",        SDTPtrLeaf, [],
0400                          "BlockAddressSDNode">;
0401 def tblockaddress: SDNode<"ISD::TargetBlockAddress",  SDTPtrLeaf, [],
0402                          "BlockAddressSDNode">;
0403 
0404 def add        : SDNode<"ISD::ADD"       , SDTIntBinOp   ,
0405                         [SDNPCommutative, SDNPAssociative]>;
0406 def ptradd     : SDNode<"ISD::ADD"       , SDTPtrAddOp, []>;
0407 def sub        : SDNode<"ISD::SUB"       , SDTIntBinOp>;
0408 def mul        : SDNode<"ISD::MUL"       , SDTIntBinOp,
0409                         [SDNPCommutative, SDNPAssociative]>;
0410 def mulhs      : SDNode<"ISD::MULHS"     , SDTIntBinOp, [SDNPCommutative]>;
0411 def mulhu      : SDNode<"ISD::MULHU"     , SDTIntBinOp, [SDNPCommutative]>;
0412 def avgfloors  : SDNode<"ISD::AVGFLOORS" , SDTIntBinOp, [SDNPCommutative]>;
0413 def avgflooru  : SDNode<"ISD::AVGFLOORU" , SDTIntBinOp, [SDNPCommutative]>;
0414 def avgceils   : SDNode<"ISD::AVGCEILS"  , SDTIntBinOp, [SDNPCommutative]>;
0415 def avgceilu   : SDNode<"ISD::AVGCEILU"  , SDTIntBinOp, [SDNPCommutative]>;
0416 def abds       : SDNode<"ISD::ABDS"      , SDTIntBinOp, [SDNPCommutative]>;
0417 def abdu       : SDNode<"ISD::ABDU"      , SDTIntBinOp, [SDNPCommutative]>;
0418 def smullohi   : SDNode<"ISD::SMUL_LOHI" , SDTIntBinHiLoOp, [SDNPCommutative]>;
0419 def umullohi   : SDNode<"ISD::UMUL_LOHI" , SDTIntBinHiLoOp, [SDNPCommutative]>;
0420 def sdiv       : SDNode<"ISD::SDIV"      , SDTIntBinOp>;
0421 def udiv       : SDNode<"ISD::UDIV"      , SDTIntBinOp>;
0422 def srem       : SDNode<"ISD::SREM"      , SDTIntBinOp>;
0423 def urem       : SDNode<"ISD::UREM"      , SDTIntBinOp>;
0424 def sdivrem    : SDNode<"ISD::SDIVREM"   , SDTIntBinHiLoOp>;
0425 def udivrem    : SDNode<"ISD::UDIVREM"   , SDTIntBinHiLoOp>;
0426 def srl        : SDNode<"ISD::SRL"       , SDTIntShiftOp>;
0427 def sra        : SDNode<"ISD::SRA"       , SDTIntShiftOp>;
0428 def shl        : SDNode<"ISD::SHL"       , SDTIntShiftOp>;
0429 def rotl       : SDNode<"ISD::ROTL"      , SDTIntShiftOp>;
0430 def rotr       : SDNode<"ISD::ROTR"      , SDTIntShiftOp>;
0431 def shl_parts  : SDNode<"ISD::SHL_PARTS" , SDTIntShiftPairOp>;
0432 def sra_parts  : SDNode<"ISD::SRA_PARTS" , SDTIntShiftPairOp>;
0433 def srl_parts  : SDNode<"ISD::SRL_PARTS" , SDTIntShiftPairOp>;
0434 def fshl       : SDNode<"ISD::FSHL"      , SDTIntShiftDOp>;
0435 def fshr       : SDNode<"ISD::FSHR"      , SDTIntShiftDOp>;
0436 def and        : SDNode<"ISD::AND"       , SDTIntBinOp,
0437                         [SDNPCommutative, SDNPAssociative]>;
0438 def or         : SDNode<"ISD::OR"        , SDTIntBinOp,
0439                         [SDNPCommutative, SDNPAssociative]>;
0440 def xor        : SDNode<"ISD::XOR"       , SDTIntBinOp,
0441                         [SDNPCommutative, SDNPAssociative]>;
0442 def addc       : SDNode<"ISD::ADDC"      , SDTIntBinOp,
0443                         [SDNPCommutative, SDNPOutGlue]>;
0444 def adde       : SDNode<"ISD::ADDE"      , SDTIntBinOp,
0445                         [SDNPCommutative, SDNPOutGlue, SDNPInGlue]>;
0446 def subc       : SDNode<"ISD::SUBC"      , SDTIntBinOp,
0447                         [SDNPOutGlue]>;
0448 def sube       : SDNode<"ISD::SUBE"      , SDTIntBinOp,
0449                         [SDNPOutGlue, SDNPInGlue]>;
0450 def smin       : SDNode<"ISD::SMIN"      , SDTIntBinOp,
0451                                   [SDNPCommutative, SDNPAssociative]>;
0452 def smax       : SDNode<"ISD::SMAX"      , SDTIntBinOp,
0453                                   [SDNPCommutative, SDNPAssociative]>;
0454 def umin       : SDNode<"ISD::UMIN"      , SDTIntBinOp,
0455                                   [SDNPCommutative, SDNPAssociative]>;
0456 def umax       : SDNode<"ISD::UMAX"      , SDTIntBinOp,
0457                                   [SDNPCommutative, SDNPAssociative]>;
0458 
0459 def scmp       : SDNode<"ISD::SCMP"      , SDTIntBinOp,
0460                                   []>;
0461 def ucmp       : SDNode<"ISD::UCMP"      , SDTIntBinOp,
0462                                   []>;
0463 
0464 def saddsat    : SDNode<"ISD::SADDSAT"   , SDTIntBinOp, [SDNPCommutative]>;
0465 def uaddsat    : SDNode<"ISD::UADDSAT"   , SDTIntBinOp, [SDNPCommutative]>;
0466 def ssubsat    : SDNode<"ISD::SSUBSAT"   , SDTIntBinOp>;
0467 def usubsat    : SDNode<"ISD::USUBSAT"   , SDTIntBinOp>;
0468 def sshlsat    : SDNode<"ISD::SSHLSAT"   , SDTIntBinOp>;
0469 def ushlsat    : SDNode<"ISD::USHLSAT"   , SDTIntBinOp>;
0470 
0471 def smulfix    : SDNode<"ISD::SMULFIX"   , SDTIntScaledBinOp, [SDNPCommutative]>;
0472 def smulfixsat : SDNode<"ISD::SMULFIXSAT", SDTIntScaledBinOp, [SDNPCommutative]>;
0473 def umulfix    : SDNode<"ISD::UMULFIX"   , SDTIntScaledBinOp, [SDNPCommutative]>;
0474 def umulfixsat : SDNode<"ISD::UMULFIXSAT", SDTIntScaledBinOp, [SDNPCommutative]>;
0475 def sdivfix    : SDNode<"ISD::SDIVFIX"   , SDTIntScaledBinOp>;
0476 def sdivfixsat : SDNode<"ISD::SDIVFIXSAT", SDTIntScaledBinOp>;
0477 def udivfix    : SDNode<"ISD::UDIVFIX"   , SDTIntScaledBinOp>;
0478 def udivfixsat : SDNode<"ISD::UDIVFIXSAT", SDTIntScaledBinOp>;
0479 
0480 def sext_inreg : SDNode<"ISD::SIGN_EXTEND_INREG", SDTExtInreg>;
0481 def sext_invec : SDNode<"ISD::SIGN_EXTEND_VECTOR_INREG", SDTExtInvec>;
0482 def zext_invec : SDNode<"ISD::ZERO_EXTEND_VECTOR_INREG", SDTExtInvec>;
0483 
0484 def abs        : SDNode<"ISD::ABS"        , SDTIntUnaryOp>;
0485 def bitreverse : SDNode<"ISD::BITREVERSE" , SDTIntUnaryOp>;
0486 def bswap      : SDNode<"ISD::BSWAP"      , SDTIntUnaryOp>;
0487 def ctlz       : SDNode<"ISD::CTLZ"       , SDTIntBitCountUnaryOp>;
0488 def cttz       : SDNode<"ISD::CTTZ"       , SDTIntBitCountUnaryOp>;
0489 def ctpop      : SDNode<"ISD::CTPOP"      , SDTIntBitCountUnaryOp>;
0490 def ctlz_zero_undef : SDNode<"ISD::CTLZ_ZERO_UNDEF", SDTIntBitCountUnaryOp>;
0491 def cttz_zero_undef : SDNode<"ISD::CTTZ_ZERO_UNDEF", SDTIntBitCountUnaryOp>;
0492 def sext       : SDNode<"ISD::SIGN_EXTEND", SDTIntExtendOp>;
0493 def zext       : SDNode<"ISD::ZERO_EXTEND", SDTIntExtendOp>;
0494 def anyext     : SDNode<"ISD::ANY_EXTEND" , SDTIntExtendOp>;
0495 def trunc      : SDNode<"ISD::TRUNCATE"   , SDTIntTruncOp>;
0496 def truncssat_s : SDNode<"ISD::TRUNCATE_SSAT_S", SDTIntTruncOp>;
0497 def truncssat_u : SDNode<"ISD::TRUNCATE_SSAT_U", SDTIntTruncOp>;
0498 def truncusat_u : SDNode<"ISD::TRUNCATE_USAT_U", SDTIntTruncOp>;
0499 def bitconvert : SDNode<"ISD::BITCAST"    , SDTUnaryOp>;
0500 def addrspacecast : SDNode<"ISD::ADDRSPACECAST", SDTUnaryOp>;
0501 def freeze     : SDNode<"ISD::FREEZE"     , SDTFreeze>;
0502 def extractelt : SDNode<"ISD::EXTRACT_VECTOR_ELT", SDTVecExtract>;
0503 def insertelt  : SDNode<"ISD::INSERT_VECTOR_ELT", SDTVecInsert>;
0504 
0505 def vecreduce_add  : SDNode<"ISD::VECREDUCE_ADD", SDTVecReduce>;
0506 def vecreduce_smax  : SDNode<"ISD::VECREDUCE_SMAX", SDTVecReduce>;
0507 def vecreduce_umax  : SDNode<"ISD::VECREDUCE_UMAX", SDTVecReduce>;
0508 def vecreduce_smin  : SDNode<"ISD::VECREDUCE_SMIN", SDTVecReduce>;
0509 def vecreduce_umin  : SDNode<"ISD::VECREDUCE_UMIN", SDTVecReduce>;
0510 def vecreduce_fadd  : SDNode<"ISD::VECREDUCE_FADD", SDTFPVecReduce>;
0511 def vecreduce_fmin  : SDNode<"ISD::VECREDUCE_FMIN", SDTFPVecReduce>;
0512 def vecreduce_fmax  : SDNode<"ISD::VECREDUCE_FMAX", SDTFPVecReduce>;
0513 def vecreduce_fminimum : SDNode<"ISD::VECREDUCE_FMINIMUM", SDTFPVecReduce>;
0514 def vecreduce_fmaximum : SDNode<"ISD::VECREDUCE_FMAXIMUM", SDTFPVecReduce>;
0515 
0516 def fadd       : SDNode<"ISD::FADD"       , SDTFPBinOp, [SDNPCommutative]>;
0517 def fsub       : SDNode<"ISD::FSUB"       , SDTFPBinOp>;
0518 def fmul       : SDNode<"ISD::FMUL"       , SDTFPBinOp, [SDNPCommutative]>;
0519 def fdiv       : SDNode<"ISD::FDIV"       , SDTFPBinOp>;
0520 def frem       : SDNode<"ISD::FREM"       , SDTFPBinOp>;
0521 def fma        : SDNode<"ISD::FMA"        , SDTFPTernaryOp, [SDNPCommutative]>;
0522 def fmad       : SDNode<"ISD::FMAD"       , SDTFPTernaryOp, [SDNPCommutative]>;
0523 def fabs       : SDNode<"ISD::FABS"       , SDTFPUnaryOp>;
0524 def fminnum    : SDNode<"ISD::FMINNUM"    , SDTFPBinOp,
0525                                   [SDNPCommutative, SDNPAssociative]>;
0526 def fmaxnum    : SDNode<"ISD::FMAXNUM"    , SDTFPBinOp,
0527                                   [SDNPCommutative, SDNPAssociative]>;
0528 def fminnum_ieee : SDNode<"ISD::FMINNUM_IEEE", SDTFPBinOp,
0529                           [SDNPCommutative]>;
0530 def fmaxnum_ieee  : SDNode<"ISD::FMAXNUM_IEEE", SDTFPBinOp,
0531                            [SDNPCommutative]>;
0532 def fminimum   : SDNode<"ISD::FMINIMUM"   , SDTFPBinOp,
0533                         [SDNPCommutative, SDNPAssociative]>;
0534 def fmaximum   : SDNode<"ISD::FMAXIMUM"   , SDTFPBinOp,
0535                         [SDNPCommutative, SDNPAssociative]>;
0536 def fminimumnum   : SDNode<"ISD::FMINIMUMNUM"   , SDTFPBinOp,
0537                         [SDNPCommutative, SDNPAssociative]>;
0538 def fmaximumnum   : SDNode<"ISD::FMAXIMUMNUM"   , SDTFPBinOp,
0539                         [SDNPCommutative, SDNPAssociative]>;
0540 def fgetsign   : SDNode<"ISD::FGETSIGN"   , SDTFPToIntOp>;
0541 def fcanonicalize : SDNode<"ISD::FCANONICALIZE", SDTFPUnaryOp>;
0542 def fneg       : SDNode<"ISD::FNEG"       , SDTFPUnaryOp>;
0543 def fsqrt      : SDNode<"ISD::FSQRT"      , SDTFPUnaryOp>;
0544 def fsin       : SDNode<"ISD::FSIN"       , SDTFPUnaryOp>;
0545 def fcos       : SDNode<"ISD::FCOS"       , SDTFPUnaryOp>;
0546 def ftan       : SDNode<"ISD::FTAN"       , SDTFPUnaryOp>;
0547 def fasin      : SDNode<"ISD::FASIN"      , SDTFPUnaryOp>;
0548 def facos      : SDNode<"ISD::FACOS"      , SDTFPUnaryOp>;
0549 def fatan      : SDNode<"ISD::FATAN"      , SDTFPUnaryOp>;
0550 def fatan2     : SDNode<"ISD::FATAN2"     , SDTFPBinOp>;
0551 def fsinh      : SDNode<"ISD::FSINH"      , SDTFPUnaryOp>;
0552 def fcosh      : SDNode<"ISD::FCOSH"      , SDTFPUnaryOp>;
0553 def ftanh      : SDNode<"ISD::FTANH"      , SDTFPUnaryOp>;
0554 def fexp2      : SDNode<"ISD::FEXP2"      , SDTFPUnaryOp>;
0555 def fexp10     : SDNode<"ISD::FEXP10"     , SDTFPUnaryOp>;
0556 def fpow       : SDNode<"ISD::FPOW"       , SDTFPBinOp>;
0557 def flog2      : SDNode<"ISD::FLOG2"      , SDTFPUnaryOp>;
0558 def fldexp     : SDNode<"ISD::FLDEXP"     , SDTFPExpOp>;
0559 def frint      : SDNode<"ISD::FRINT"      , SDTFPUnaryOp>;
0560 def ftrunc     : SDNode<"ISD::FTRUNC"     , SDTFPUnaryOp>;
0561 def fceil      : SDNode<"ISD::FCEIL"      , SDTFPUnaryOp>;
0562 def ffloor     : SDNode<"ISD::FFLOOR"     , SDTFPUnaryOp>;
0563 def fnearbyint : SDNode<"ISD::FNEARBYINT" , SDTFPUnaryOp>;
0564 def fround     : SDNode<"ISD::FROUND"     , SDTFPUnaryOp>;
0565 def froundeven : SDNode<"ISD::FROUNDEVEN" , SDTFPUnaryOp>;
0566 
0567 def lround     : SDNode<"ISD::LROUND"     , SDTFPToIntOp>;
0568 def llround    : SDNode<"ISD::LLROUND"    , SDTFPToIntOp>;
0569 def lrint      : SDNode<"ISD::LRINT"      , SDTFPToIntOp>;
0570 def llrint     : SDNode<"ISD::LLRINT"     , SDTFPToIntOp>;
0571 
0572 def fptrunc_round : SDNode<"ISD::FPTRUNC_ROUND", SDTFPTruncRoundOp>;
0573 
0574 def fpround    : SDNode<"ISD::FP_ROUND"   , SDTFPRoundOp>;
0575 def fpextend   : SDNode<"ISD::FP_EXTEND"  , SDTFPExtendOp>;
0576 def fcopysign  : SDNode<"ISD::FCOPYSIGN"  , SDTFPSignOp>;
0577 
0578 def is_fpclass : SDNode<"ISD::IS_FPCLASS" , SDIsFPClassOp>;
0579 
0580 def sint_to_fp : SDNode<"ISD::SINT_TO_FP" , SDTIntToFPOp>;
0581 def uint_to_fp : SDNode<"ISD::UINT_TO_FP" , SDTIntToFPOp>;
0582 def fp_to_sint : SDNode<"ISD::FP_TO_SINT" , SDTFPToIntOp>;
0583 def fp_to_uint : SDNode<"ISD::FP_TO_UINT" , SDTFPToIntOp>;
0584 def fp_to_sint_sat : SDNode<"ISD::FP_TO_SINT_SAT" , SDTFPToIntSatOp>;
0585 def fp_to_uint_sat : SDNode<"ISD::FP_TO_UINT_SAT" , SDTFPToIntSatOp>;
0586 def fp_to_sint_sat_gi : SDNode<"ISD::FP_TO_SINT_SAT" , SDTFPToIntOp>;
0587 def fp_to_uint_sat_gi : SDNode<"ISD::FP_TO_UINT_SAT" , SDTFPToIntOp>;
0588 def f16_to_fp  : SDNode<"ISD::FP16_TO_FP" , SDTIntToFPOp>;
0589 def fp_to_f16  : SDNode<"ISD::FP_TO_FP16" , SDTFPToIntOp>;
0590 def bf16_to_fp  : SDNode<"ISD::BF16_TO_FP" , SDTIntToFPOp>;
0591 def fp_to_bf16  : SDNode<"ISD::FP_TO_BF16" , SDTFPToIntOp>;
0592 
0593 def strict_fadd       : SDNode<"ISD::STRICT_FADD",
0594                                SDTFPBinOp, [SDNPHasChain, SDNPCommutative]>;
0595 def strict_fsub       : SDNode<"ISD::STRICT_FSUB",
0596                                SDTFPBinOp, [SDNPHasChain]>;
0597 def strict_fmul       : SDNode<"ISD::STRICT_FMUL",
0598                                SDTFPBinOp, [SDNPHasChain, SDNPCommutative]>;
0599 def strict_fdiv       : SDNode<"ISD::STRICT_FDIV",
0600                                SDTFPBinOp, [SDNPHasChain]>;
0601 def strict_frem       : SDNode<"ISD::STRICT_FREM",
0602                                SDTFPBinOp, [SDNPHasChain]>;
0603 def strict_fma        : SDNode<"ISD::STRICT_FMA",
0604                                SDTFPTernaryOp, [SDNPHasChain, SDNPCommutative]>;
0605 def strict_fsqrt      : SDNode<"ISD::STRICT_FSQRT",
0606                                SDTFPUnaryOp, [SDNPHasChain]>;
0607 def strict_fsin       : SDNode<"ISD::STRICT_FSIN",
0608                                SDTFPUnaryOp, [SDNPHasChain]>;
0609 def strict_fcos       : SDNode<"ISD::STRICT_FCOS",
0610                                SDTFPUnaryOp, [SDNPHasChain]>;
0611 def strict_ftan       : SDNode<"ISD::STRICT_FTAN",
0612                                SDTFPUnaryOp, [SDNPHasChain]>;
0613 def strict_fasin      : SDNode<"ISD::STRICT_FASIN",
0614                                SDTFPUnaryOp, [SDNPHasChain]>;
0615 def strict_facos      : SDNode<"ISD::STRICT_FACOS",
0616                                SDTFPUnaryOp, [SDNPHasChain]>;
0617 def strict_fatan      : SDNode<"ISD::STRICT_FATAN",
0618                                SDTFPUnaryOp, [SDNPHasChain]>;
0619 def strict_fatan2     : SDNode<"ISD::STRICT_FATAN2",
0620                                SDTFPBinOp, [SDNPHasChain]>;
0621 def strict_fsinh      : SDNode<"ISD::STRICT_FSINH",
0622                                SDTFPUnaryOp, [SDNPHasChain]>;
0623 def strict_fcosh      : SDNode<"ISD::STRICT_FCOSH",
0624                                SDTFPUnaryOp, [SDNPHasChain]>;
0625 def strict_ftanh      : SDNode<"ISD::STRICT_FTANH",
0626                                SDTFPUnaryOp, [SDNPHasChain]>;
0627 def strict_fexp2      : SDNode<"ISD::STRICT_FEXP2",
0628                                SDTFPUnaryOp, [SDNPHasChain]>;
0629 def strict_fpow       : SDNode<"ISD::STRICT_FPOW",
0630                                SDTFPBinOp, [SDNPHasChain]>;
0631 def strict_fldexp     : SDNode<"ISD::STRICT_FLDEXP",
0632                                SDTFPExpOp, [SDNPHasChain]>;
0633 def strict_flog2      : SDNode<"ISD::STRICT_FLOG2",
0634                                SDTFPUnaryOp, [SDNPHasChain]>;
0635 def strict_frint      : SDNode<"ISD::STRICT_FRINT",
0636                                SDTFPUnaryOp, [SDNPHasChain]>;
0637 def strict_lrint      : SDNode<"ISD::STRICT_LRINT",
0638                                SDTFPToIntOp, [SDNPHasChain]>;
0639 def strict_llrint     : SDNode<"ISD::STRICT_LLRINT",
0640                                SDTFPToIntOp, [SDNPHasChain]>;
0641 def strict_fnearbyint : SDNode<"ISD::STRICT_FNEARBYINT",
0642                                SDTFPUnaryOp, [SDNPHasChain]>;
0643 def strict_fceil      : SDNode<"ISD::STRICT_FCEIL",
0644                                SDTFPUnaryOp, [SDNPHasChain]>;
0645 def strict_ffloor     : SDNode<"ISD::STRICT_FFLOOR",
0646                                SDTFPUnaryOp, [SDNPHasChain]>;
0647 def strict_lround     : SDNode<"ISD::STRICT_LROUND",
0648                                SDTFPToIntOp, [SDNPHasChain]>;
0649 def strict_llround    : SDNode<"ISD::STRICT_LLROUND",
0650                                SDTFPToIntOp, [SDNPHasChain]>;
0651 def strict_fround     : SDNode<"ISD::STRICT_FROUND",
0652                                SDTFPUnaryOp, [SDNPHasChain]>;
0653 def strict_froundeven : SDNode<"ISD::STRICT_FROUNDEVEN",
0654                                SDTFPUnaryOp, [SDNPHasChain]>;
0655 def strict_ftrunc     : SDNode<"ISD::STRICT_FTRUNC",
0656                                SDTFPUnaryOp, [SDNPHasChain]>;
0657 def strict_fminnum    : SDNode<"ISD::STRICT_FMINNUM",
0658                                SDTFPBinOp, [SDNPHasChain,
0659                                             SDNPCommutative, SDNPAssociative]>;
0660 def strict_fmaxnum    : SDNode<"ISD::STRICT_FMAXNUM",
0661                                SDTFPBinOp, [SDNPHasChain,
0662                                             SDNPCommutative, SDNPAssociative]>;
0663 def strict_fminimum   : SDNode<"ISD::STRICT_FMINIMUM",
0664                                SDTFPBinOp, [SDNPHasChain,
0665                                             SDNPCommutative, SDNPAssociative]>;
0666 def strict_fmaximum   : SDNode<"ISD::STRICT_FMAXIMUM",
0667                                SDTFPBinOp, [SDNPHasChain,
0668                                             SDNPCommutative, SDNPAssociative]>;
0669 def strict_fpround    : SDNode<"ISD::STRICT_FP_ROUND",
0670                                SDTFPRoundOp, [SDNPHasChain]>;
0671 def strict_fpextend   : SDNode<"ISD::STRICT_FP_EXTEND",
0672                                SDTFPExtendOp, [SDNPHasChain]>;
0673 def strict_fp_to_sint : SDNode<"ISD::STRICT_FP_TO_SINT",
0674                                SDTFPToIntOp, [SDNPHasChain]>;
0675 def strict_fp_to_uint : SDNode<"ISD::STRICT_FP_TO_UINT",
0676                                SDTFPToIntOp, [SDNPHasChain]>;
0677 def strict_sint_to_fp : SDNode<"ISD::STRICT_SINT_TO_FP",
0678                                SDTIntToFPOp, [SDNPHasChain]>;
0679 def strict_uint_to_fp : SDNode<"ISD::STRICT_UINT_TO_FP",
0680                                SDTIntToFPOp, [SDNPHasChain]>;
0681 
0682 def strict_f16_to_fp  : SDNode<"ISD::STRICT_FP16_TO_FP",
0683                                SDTIntToFPOp, [SDNPHasChain]>;
0684 def strict_fp_to_f16  : SDNode<"ISD::STRICT_FP_TO_FP16",
0685                                SDTFPToIntOp, [SDNPHasChain]>;
0686 
0687 def strict_bf16_to_fp  : SDNode<"ISD::STRICT_BF16_TO_FP",
0688                                SDTIntToFPOp, [SDNPHasChain]>;
0689 def strict_fp_to_bf16  : SDNode<"ISD::STRICT_FP_TO_BF16",
0690                                SDTFPToIntOp, [SDNPHasChain]>;
0691 
0692 def strict_fsetcc  : SDNode<"ISD::STRICT_FSETCC",  SDTSetCC, [SDNPHasChain]>;
0693 def strict_fsetccs : SDNode<"ISD::STRICT_FSETCCS", SDTSetCC, [SDNPHasChain]>;
0694 
0695 def get_fpenv      : SDNode<"ISD::GET_FPENV", SDTGetFPStateOp, [SDNPHasChain]>;
0696 def set_fpenv      : SDNode<"ISD::SET_FPENV", SDTSetFPStateOp, [SDNPHasChain]>;
0697 def reset_fpenv    : SDNode<"ISD::RESET_FPENV", SDTNone, [SDNPHasChain]>;
0698 def get_fpmode     : SDNode<"ISD::GET_FPMODE", SDTGetFPStateOp, [SDNPHasChain]>;
0699 def set_fpmode     : SDNode<"ISD::SET_FPMODE", SDTSetFPStateOp, [SDNPHasChain]>;
0700 def reset_fpmode   : SDNode<"ISD::RESET_FPMODE", SDTNone, [SDNPHasChain]>;
0701 
0702 def setcc      : SDNode<"ISD::SETCC"      , SDTSetCC>;
0703 def select     : SDNode<"ISD::SELECT"     , SDTSelect>;
0704 def vselect    : SDNode<"ISD::VSELECT"    , SDTVSelect>;
0705 def selectcc   : SDNode<"ISD::SELECT_CC"  , SDTSelectCC>;
0706 
0707 def brcc       : SDNode<"ISD::BR_CC"      , SDTBrCC,   [SDNPHasChain]>;
0708 def brcond     : SDNode<"ISD::BRCOND"     , SDTBrcond, [SDNPHasChain]>;
0709 def brind      : SDNode<"ISD::BRIND"      , SDTBrind,  [SDNPHasChain]>;
0710 def br         : SDNode<"ISD::BR"         , SDTBr,     [SDNPHasChain]>;
0711 def catchret   : SDNode<"ISD::CATCHRET"   , SDTCatchret,
0712                         [SDNPHasChain, SDNPSideEffect]>;
0713 def cleanupret : SDNode<"ISD::CLEANUPRET" , SDTCleanupret, [SDNPHasChain]>;
0714 
0715 def trap       : SDNode<"ISD::TRAP"       , SDTNone,
0716                         [SDNPHasChain, SDNPSideEffect]>;
0717 def debugtrap  : SDNode<"ISD::DEBUGTRAP"  , SDTNone,
0718                         [SDNPHasChain, SDNPSideEffect]>;
0719 def ubsantrap  : SDNode<"ISD::UBSANTRAP"  , SDTUBSANTrap,
0720                         [SDNPHasChain, SDNPSideEffect]>;
0721 
0722 def prefetch   : SDNode<"ISD::PREFETCH"   , SDTPrefetch,
0723                         [SDNPHasChain, SDNPMayLoad, SDNPMayStore,
0724                          SDNPMemOperand]>;
0725 
0726 def readcyclecounter : SDNode<"ISD::READCYCLECOUNTER", SDTIntLeaf,
0727                      [SDNPHasChain, SDNPSideEffect]>;
0728 
0729 def readsteadycounter : SDNode<"ISD::READSTEADYCOUNTER", SDTIntLeaf,
0730                      [SDNPHasChain, SDNPSideEffect]>;
0731 
0732 def membarrier : SDNode<"ISD::MEMBARRIER", SDTNone,
0733                         [SDNPHasChain, SDNPSideEffect]>;
0734 
0735 def jump_table_debug_info : SDNode<"ISD::JUMP_TABLE_DEBUG_INFO", SDTNone,
0736                         [SDNPHasChain]>;
0737 
0738 def atomic_fence : SDNode<"ISD::ATOMIC_FENCE" , SDTAtomicFence,
0739                           [SDNPHasChain, SDNPSideEffect]>;
0740 
0741 def atomic_cmp_swap : SDNode<"ISD::ATOMIC_CMP_SWAP" , SDTAtomic3,
0742                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0743 def atomic_load_add : SDNode<"ISD::ATOMIC_LOAD_ADD" , SDTAtomic2,
0744                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0745 def atomic_swap     : SDNode<"ISD::ATOMIC_SWAP", SDTAtomic2,
0746                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0747 def atomic_load_sub : SDNode<"ISD::ATOMIC_LOAD_SUB" , SDTAtomic2,
0748                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0749 def atomic_load_and : SDNode<"ISD::ATOMIC_LOAD_AND" , SDTAtomic2,
0750                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0751 def atomic_load_clr : SDNode<"ISD::ATOMIC_LOAD_CLR" , SDTAtomic2,
0752                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0753 def atomic_load_or  : SDNode<"ISD::ATOMIC_LOAD_OR" , SDTAtomic2,
0754                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0755 def atomic_load_xor : SDNode<"ISD::ATOMIC_LOAD_XOR" , SDTAtomic2,
0756                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0757 def atomic_load_nand: SDNode<"ISD::ATOMIC_LOAD_NAND", SDTAtomic2,
0758                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0759 def atomic_load_min : SDNode<"ISD::ATOMIC_LOAD_MIN", SDTAtomic2,
0760                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0761 def atomic_load_max : SDNode<"ISD::ATOMIC_LOAD_MAX", SDTAtomic2,
0762                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0763 def atomic_load_umin : SDNode<"ISD::ATOMIC_LOAD_UMIN", SDTAtomic2,
0764                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0765 def atomic_load_umax : SDNode<"ISD::ATOMIC_LOAD_UMAX", SDTAtomic2,
0766                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0767 def atomic_load_fadd : SDNode<"ISD::ATOMIC_LOAD_FADD" , SDTFPAtomic2,
0768                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0769 def atomic_load_fsub : SDNode<"ISD::ATOMIC_LOAD_FSUB" , SDTFPAtomic2,
0770                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0771 def atomic_load_fmax : SDNode<"ISD::ATOMIC_LOAD_FMAX", SDTFPAtomic2,
0772                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0773 def atomic_load_fmin : SDNode<"ISD::ATOMIC_LOAD_FMIN", SDTFPAtomic2,
0774                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0775 def atomic_load_uinc_wrap : SDNode<"ISD::ATOMIC_LOAD_UINC_WRAP", SDTAtomic2,
0776                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0777 def atomic_load_udec_wrap : SDNode<"ISD::ATOMIC_LOAD_UDEC_WRAP", SDTAtomic2,
0778                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0779 def atomic_load_usub_cond : SDNode<"ISD::ATOMIC_LOAD_USUB_COND", SDTAtomic2,
0780                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0781 def atomic_load_usub_sat : SDNode<"ISD::ATOMIC_LOAD_USUB_SAT", SDTAtomic2,
0782                     [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>;
0783 
0784 def atomic_load      : SDNode<"ISD::ATOMIC_LOAD", SDTAtomicLoad,
0785                     [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
0786 def atomic_store     : SDNode<"ISD::ATOMIC_STORE", SDTAtomicStore,
0787                     [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
0788 
0789 def masked_st    : SDNode<"ISD::MSTORE",  SDTMaskedStore,
0790                        [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
0791 def masked_ld    : SDNode<"ISD::MLOAD",  SDTMaskedLoad,
0792                        [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
0793 
0794 def masked_gather : SDNode<"ISD::MGATHER", SDTMaskedGather,
0795                            [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
0796 
0797 def masked_scatter : SDNode<"ISD::MSCATTER", SDTMaskedScatter,
0798                             [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
0799 
0800 def vector_compress : SDNode<"ISD::VECTOR_COMPRESS", SDTVectorCompress>;
0801 
0802 // Do not use ld, st directly. Use load, extload, sextload, zextload, store,
0803 // and truncst (see below).
0804 def ld         : SDNode<"ISD::LOAD"       , SDTLoad,
0805                         [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
0806 def st         : SDNode<"ISD::STORE"      , SDTStore,
0807                         [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
0808 def ist        : SDNode<"ISD::STORE"      , SDTIStore,
0809                         [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
0810 
0811 def vector_shuffle : SDNode<"ISD::VECTOR_SHUFFLE", SDTVecShuffle, []>;
0812 def vector_reverse : SDNode<"ISD::VECTOR_REVERSE", SDTVecReverse>;
0813 def vector_splice : SDNode<"ISD::VECTOR_SPLICE", SDTVecSlice, []>;
0814 def build_vector : SDNode<"ISD::BUILD_VECTOR", SDTypeProfile<1, -1, []>, []>;
0815 def splat_vector : SDNode<"ISD::SPLAT_VECTOR", SDTypeProfile<1, 1, []>, []>;
0816 def step_vector : SDNode<"ISD::STEP_VECTOR", SDTypeProfile<1, 1,
0817                        [SDTCisVec<0>, SDTCisInt<1>]>, []>;
0818 def scalar_to_vector : SDNode<"ISD::SCALAR_TO_VECTOR", SDTypeProfile<1, 1, []>,
0819                               []>;
0820 
0821 // vector_extract/vector_insert are deprecated. extractelt/insertelt
0822 // are preferred.
0823 def vector_extract : SDNode<"ISD::EXTRACT_VECTOR_ELT",
0824     SDTypeProfile<1, 2, [SDTCisPtrTy<2>]>, []>;
0825 def vector_insert : SDNode<"ISD::INSERT_VECTOR_ELT",
0826     SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, SDTCisPtrTy<3>]>, []>;
0827 def concat_vectors : SDNode<"ISD::CONCAT_VECTORS",
0828     SDTypeProfile<1, 2, [SDTCisSubVecOfVec<1, 0>, SDTCisSameAs<1, 2>]>,[]>;
0829 
0830 // This operator does not do subvector type checking.  The ARM
0831 // backend, at least, needs it.
0832 def vector_extract_subvec : SDNode<"ISD::EXTRACT_SUBVECTOR",
0833     SDTypeProfile<1, 2, [SDTCisInt<2>, SDTCisVec<1>, SDTCisVec<0>]>,
0834     []>;
0835 def vector_insert_subvec : SDNode<"ISD::INSERT_SUBVECTOR",
0836     SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>, SDTCisVec<2>, SDTCisInt<3>]>,
0837     []>;
0838 
0839 // This operator does subvector type checking.
0840 def extract_subvector : SDNode<"ISD::EXTRACT_SUBVECTOR", SDTSubVecExtract, []>;
0841 def insert_subvector : SDNode<"ISD::INSERT_SUBVECTOR", SDTSubVecInsert, []>;
0842 
0843 // Nodes for intrinsics, you should use the intrinsic itself and let tblgen use
0844 // these internally.  Don't reference these directly.
0845 def intrinsic_void : SDNode<"ISD::INTRINSIC_VOID",
0846                             SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>,
0847                             [SDNPHasChain]>;
0848 def intrinsic_w_chain : SDNode<"ISD::INTRINSIC_W_CHAIN",
0849                                SDTypeProfile<1, -1, [SDTCisPtrTy<1>]>,
0850                                [SDNPHasChain]>;
0851 def intrinsic_wo_chain : SDNode<"ISD::INTRINSIC_WO_CHAIN",
0852                                 SDTypeProfile<1, -1, [SDTCisPtrTy<1>]>, []>;
0853 
0854 def SDT_assert : SDTypeProfile<1, 1,
0855   [SDTCisInt<0>, SDTCisInt<1>, SDTCisSameAs<1, 0>]>;
0856 def assertsext : SDNode<"ISD::AssertSext", SDT_assert>;
0857 def assertzext : SDNode<"ISD::AssertZext", SDT_assert>;
0858 def assertalign : SDNode<"ISD::AssertAlign", SDT_assert>;
0859 
0860 def convergencectrl_anchor : SDNode<"ISD::CONVERGENCECTRL_ANCHOR",
0861                                     SDTypeProfile<1, 0, [SDTCisVT<0,untyped>]>>;
0862 def convergencectrl_entry  : SDNode<"ISD::CONVERGENCECTRL_ENTRY",
0863                                     SDTypeProfile<1, 0, [SDTCisVT<0,untyped>]>>;
0864 def convergencectrl_loop   : SDNode<"ISD::CONVERGENCECTRL_LOOP",
0865                                     SDTypeProfile<1, 1,
0866                                       [SDTCisVT<0,untyped>, SDTCisVT<1,untyped>]>>;
0867 def convergencectrl_glue   : SDNode<"ISD::CONVERGENCECTRL_GLUE",
0868                                     SDTypeProfile<0, 1, [SDTCisVT<0, untyped>]>>;
0869 
0870 //===----------------------------------------------------------------------===//
0871 // Selection DAG Condition Codes
0872 
0873 class CondCode<string fcmpName = "", string icmpName = ""> {
0874   string ICmpPredicate = icmpName;
0875   string FCmpPredicate = fcmpName;
0876 }
0877 
0878 // ISD::CondCode enums, and mapping to CmpInst::Predicate names
0879 def SETOEQ : CondCode<"FCMP_OEQ">;
0880 def SETOGT : CondCode<"FCMP_OGT">;
0881 def SETOGE : CondCode<"FCMP_OGE">;
0882 def SETOLT : CondCode<"FCMP_OLT">;
0883 def SETOLE : CondCode<"FCMP_OLE">;
0884 def SETONE : CondCode<"FCMP_ONE">;
0885 def SETO   : CondCode<"FCMP_ORD">;
0886 def SETUO  : CondCode<"FCMP_UNO">;
0887 def SETUEQ : CondCode<"FCMP_UEQ">;
0888 def SETUGT : CondCode<"FCMP_UGT", "ICMP_UGT">;
0889 def SETUGE : CondCode<"FCMP_UGE", "ICMP_UGE">;
0890 def SETULT : CondCode<"FCMP_ULT", "ICMP_ULT">;
0891 def SETULE : CondCode<"FCMP_ULE", "ICMP_ULE">;
0892 def SETUNE : CondCode<"FCMP_UNE">;
0893 def SETEQ : CondCode<"", "ICMP_EQ">;
0894 def SETGT : CondCode<"", "ICMP_SGT">;
0895 def SETGE : CondCode<"", "ICMP_SGE">;
0896 def SETLT : CondCode<"", "ICMP_SLT">;
0897 def SETLE : CondCode<"", "ICMP_SLE">;
0898 def SETNE : CondCode<"", "ICMP_NE">;
0899 
0900 //===----------------------------------------------------------------------===//
0901 // Selection DAG Node Transformation Functions.
0902 //
0903 // This mechanism allows targets to manipulate nodes in the output DAG once a
0904 // match has been formed.  This is typically used to manipulate immediate
0905 // values.
0906 //
0907 class SDNodeXForm<SDNode opc, code xformFunction> {
0908   SDNode Opcode = opc;
0909   code XFormFunction = xformFunction;
0910 }
0911 
0912 def NOOP_SDNodeXForm : SDNodeXForm<imm, [{}]>;
0913 
0914 //===----------------------------------------------------------------------===//
0915 // Selection DAG Pattern Fragments.
0916 //
0917 // Pattern fragments are reusable chunks of dags that match specific things.
0918 // They can take arguments and have C++ predicates that control whether they
0919 // match.  They are intended to make the patterns for common instructions more
0920 // compact and readable.
0921 //
0922 
0923 /// PatFrags - Represents a set of pattern fragments.  Each single fragment
0924 /// can match something on the DAG, from a single node to multiple nested other
0925 /// fragments.   The whole set of fragments matches if any of the single
0926 /// fragments match.  This allows e.g. matching and "add with overflow" and
0927 /// a regular "add" with the same fragment set.
0928 ///
0929 class PatFrags<dag ops, list<dag> frags, code pred = [{}],
0930                SDNodeXForm xform = NOOP_SDNodeXForm> : SDPatternOperator {
0931   dag Operands = ops;
0932   list<dag> Fragments = frags;
0933   code PredicateCode = pred;
0934   code GISelPredicateCode = [{}];
0935   code ImmediateCode = [{}];
0936   SDNodeXForm OperandTransform = xform;
0937 
0938   // When this is set, the PredicateCode may refer to a constant Operands
0939   // vector which contains the captured nodes of the DAG, in the order listed
0940   // by the Operands field above.
0941   //
0942   // This is useful when Fragments involves associative / commutative
0943   // operators: a single piece of code can easily refer to all operands even
0944   // when re-associated / commuted variants of the fragment are matched.
0945   bit PredicateCodeUsesOperands = false;
0946 
0947   // Define a few pre-packaged predicates. This helps GlobalISel import
0948   // existing rules from SelectionDAG for many common cases.
0949   // They will be tested prior to the code in pred and must not be used in
0950   // ImmLeaf and its subclasses.
0951 
0952   // If set to true, a predicate is added that checks for the absence of use of
0953   // the first result.
0954   bit HasNoUse = ?;
0955   // If set to true, a predicate is added that checks for the sole use of
0956   // the first result.
0957   bit HasOneUse = ?;
0958 
0959   // Is the desired pre-packaged predicate for a load?
0960   bit IsLoad = ?;
0961   // Is the desired pre-packaged predicate for a store?
0962   bit IsStore = ?;
0963   // Is the desired pre-packaged predicate for an atomic?
0964   bit IsAtomic = ?;
0965 
0966   // cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
0967   // cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
0968   bit IsUnindexed = ?;
0969 
0970   // cast<LoadSDNode>(N)->getExtensionType() != ISD::NON_EXTLOAD
0971   bit IsNonExtLoad = ?;
0972   // cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD;
0973   bit IsAnyExtLoad = ?;
0974   // cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD;
0975   bit IsSignExtLoad = ?;
0976   // cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD;
0977   bit IsZeroExtLoad = ?;
0978   // !cast<StoreSDNode>(N)->isTruncatingStore();
0979   // cast<StoreSDNode>(N)->isTruncatingStore();
0980   bit IsTruncStore = ?;
0981 
0982   // cast<MemSDNode>(N)->getAddressSpace() ==
0983   // If this empty, accept any address space.
0984   list<int> AddressSpaces = ?;
0985 
0986   // cast<MemSDNode>(N)->getAlign() >=
0987   // If this is empty, accept any alignment.
0988   int MinAlignment = ?;
0989 
0990   // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::Monotonic
0991   bit IsAtomicOrderingMonotonic = ?;
0992   // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::Acquire
0993   bit IsAtomicOrderingAcquire = ?;
0994   // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::Release
0995   bit IsAtomicOrderingRelease = ?;
0996   // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::AcquireRelease
0997   bit IsAtomicOrderingAcquireRelease = ?;
0998   // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::SequentiallyConsistent
0999   bit IsAtomicOrderingSequentiallyConsistent = ?;
1000 
1001   // isAcquireOrStronger(cast<AtomicSDNode>(N)->getOrdering())
1002   // !isAcquireOrStronger(cast<AtomicSDNode>(N)->getOrdering())
1003   bit IsAtomicOrderingAcquireOrStronger = ?;
1004 
1005   // isReleaseOrStronger(cast<AtomicSDNode>(N)->getOrdering())
1006   // !isReleaseOrStronger(cast<AtomicSDNode>(N)->getOrdering())
1007   bit IsAtomicOrderingReleaseOrStronger = ?;
1008 
1009   // cast<LoadSDNode>(N)->getMemoryVT() == MVT::<VT>;
1010   // cast<StoreSDNode>(N)->getMemoryVT() == MVT::<VT>;
1011   ValueType MemoryVT = ?;
1012   // cast<LoadSDNode>(N)->getMemoryVT().getScalarType() == MVT::<VT>;
1013   // cast<StoreSDNode>(N)->getMemoryVT().getScalarType() == MVT::<VT>;
1014   ValueType ScalarMemoryVT = ?;
1015 }
1016 
1017 // Patterns and PatFrags can also subclass GISelFlags to set flags that affect
1018 // how GlobalISel behaves when matching them.
1019 class GISelFlags {
1020   bit GIIgnoreCopies = ?;
1021 }
1022 
1023 // PatFrag - A version of PatFrags matching only a single fragment.
1024 class PatFrag<dag ops, dag frag, code pred = [{}],
1025               SDNodeXForm xform = NOOP_SDNodeXForm>
1026   : PatFrags<ops, [frag], pred, xform>;
1027 
1028 // OutPatFrag is a pattern fragment that is used as part of an output pattern
1029 // (not an input pattern). These do not have predicates or transforms, but are
1030 // used to avoid repeated subexpressions in output patterns.
1031 class OutPatFrag<dag ops, dag frag>
1032  : PatFrag<ops, frag, [{}], NOOP_SDNodeXForm>;
1033 
1034 // PatLeaf's are pattern fragments that have no operands.  This is just a helper
1035 // to define immediates and other common things concisely.
1036 class PatLeaf<dag frag, code pred = [{}], SDNodeXForm xform = NOOP_SDNodeXForm>
1037  : PatFrag<(ops), frag, pred, xform>;
1038 
1039 
1040 // ImmLeaf is a pattern fragment with a constraint on the immediate.  The
1041 // constraint is a function that is run on the immediate (always with the value
1042 // sign extended out to an int64_t) as Imm.  For example:
1043 //
1044 //  def immSExt8 : ImmLeaf<i16, [{ return (char)Imm == Imm; }]>;
1045 //
1046 // this is a more convenient form to match 'imm' nodes in than PatLeaf and also
1047 // is preferred over using PatLeaf because it allows the code generator to
1048 // reason more about the constraint.
1049 //
1050 // If FastIsel should ignore all instructions that have an operand of this type,
1051 // the FastIselShouldIgnore flag can be set.  This is an optimization to reduce
1052 // the code size of the generated fast instruction selector.
1053 class ImmLeaf<ValueType vt, code pred, SDNodeXForm xform = NOOP_SDNodeXForm,
1054               SDNode ImmNode = imm>
1055   : PatFrag<(ops), (vt ImmNode), [{}], xform> {
1056   let ImmediateCode = pred;
1057   bit FastIselShouldIgnore = false;
1058 
1059   // Is the data type of the immediate an APInt?
1060   bit IsAPInt = false;
1061 
1062   // Is the data type of the immediate an APFloat?
1063   bit IsAPFloat = false;
1064 }
1065 
1066 // Convenience wrapper for ImmLeaf to use timm/TargetConstant instead
1067 // of imm/Constant.
1068 class TImmLeaf<ValueType vt, code pred, SDNodeXForm xform = NOOP_SDNodeXForm,
1069   SDNode ImmNode = timm> : ImmLeaf<vt, pred, xform, ImmNode>;
1070 
1071 // An ImmLeaf except that Imm is an APInt. This is useful when you need to
1072 // zero-extend the immediate instead of sign-extend it.
1073 //
1074 // Note that FastISel does not currently understand IntImmLeaf and will not
1075 // generate code for rules that make use of it. As such, it does not make sense
1076 // to replace ImmLeaf with IntImmLeaf. However, replacing PatLeaf with an
1077 // IntImmLeaf will allow GlobalISel to import the rule.
1078 class IntImmLeaf<ValueType vt, code pred, SDNodeXForm xform = NOOP_SDNodeXForm>
1079     : ImmLeaf<vt, pred, xform> {
1080   let IsAPInt = true;
1081   let FastIselShouldIgnore = true;
1082 }
1083 
1084 // An ImmLeaf except that Imm is an APFloat.
1085 //
1086 // Note that FastISel does not currently understand FPImmLeaf and will not
1087 // generate code for rules that make use of it.
1088 class FPImmLeaf<ValueType vt, code pred, SDNodeXForm xform = NOOP_SDNodeXForm>
1089   : ImmLeaf<vt, pred, xform, fpimm> {
1090   let IsAPFloat = true;
1091   let FastIselShouldIgnore = true;
1092 }
1093 
1094 // Leaf fragments.
1095 
1096 def vtInt      : PatLeaf<(vt),  [{ return N->getVT().isInteger(); }]>;
1097 def vtFP       : PatLeaf<(vt),  [{ return N->getVT().isFloatingPoint(); }]>;
1098 
1099 // Use ISD::isConstantSplatVectorAllOnes or ISD::isConstantSplatVectorAllZeros
1100 // to look for the corresponding build_vector or splat_vector. Will look through
1101 // bitcasts and check for either opcode, except when used as a pattern root.
1102 // When used as a pattern root, only fixed-length build_vector and scalable
1103 // splat_vector are supported.
1104 def immAllOnesV  : SDPatternOperator; // ISD::isConstantSplatVectorAllOnes
1105 def immAllZerosV : SDPatternOperator; // ISD::isConstantSplatVectorAllZeros
1106 
1107 // Other helper fragments.
1108 def not  : PatFrag<(ops node:$in), (xor node:$in, -1)>;
1109 def vnot : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV)>;
1110 def ineg : PatFrag<(ops node:$in), (sub 0, node:$in)>;
1111 
1112 def zanyext : PatFrags<(ops node:$op),
1113                        [(zext node:$op),
1114                         (anyext node:$op)]>;
1115 
1116 def zext_nneg : PatFrag<(ops node:$src), (zext node:$src), [{
1117   return N->getFlags().hasNonNeg();
1118 }]>;
1119 def sext_like : PatFrags<(ops node:$src),
1120                          [(zext_nneg node:$src),
1121                           (sext node:$src)]>;
1122 
1123 // null_frag - The null pattern operator is used in multiclass instantiations
1124 // which accept an SDPatternOperator for use in matching patterns for internal
1125 // definitions. When expanding a pattern, if the null fragment is referenced
1126 // in the expansion, the pattern is discarded and it is as-if '[]' had been
1127 // specified. This allows multiclasses to have the isel patterns be optional.
1128 def null_frag : SDPatternOperator;
1129 
1130 // load fragments.
1131 def unindexedload : PatFrag<(ops node:$ptr), (ld node:$ptr)> {
1132   let IsLoad = true;
1133   let IsUnindexed = true;
1134 }
1135 def load : PatFrag<(ops node:$ptr), (unindexedload node:$ptr)> {
1136   let IsLoad = true;
1137   let IsNonExtLoad = true;
1138 }
1139 
1140 // extending load fragments.
1141 def extload   : PatFrag<(ops node:$ptr), (unindexedload node:$ptr)> {
1142   let IsLoad = true;
1143   let IsAnyExtLoad = true;
1144 }
1145 def sextload  : PatFrag<(ops node:$ptr), (unindexedload node:$ptr)> {
1146   let IsLoad = true;
1147   let IsSignExtLoad = true;
1148 }
1149 def zextload  : PatFrag<(ops node:$ptr), (unindexedload node:$ptr)> {
1150   let IsLoad = true;
1151   let IsZeroExtLoad = true;
1152 }
1153 
1154 def extloadi1  : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1155   let IsLoad = true;
1156   let MemoryVT = i1;
1157 }
1158 def extloadi8  : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1159   let IsLoad = true;
1160   let MemoryVT = i8;
1161 }
1162 def extloadi16 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1163   let IsLoad = true;
1164   let MemoryVT = i16;
1165 }
1166 def extloadi32 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1167   let IsLoad = true;
1168   let MemoryVT = i32;
1169 }
1170 def extloadi64 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1171   let IsLoad = true;
1172   let MemoryVT = i64;
1173 }
1174 def extloadf16 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1175   let IsLoad = true;
1176   let MemoryVT = f16;
1177 }
1178 def extloadf32 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1179   let IsLoad = true;
1180   let MemoryVT = f32;
1181 }
1182 def extloadf64 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1183   let IsLoad = true;
1184   let MemoryVT = f64;
1185 }
1186 
1187 def sextloadi1  : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1188   let IsLoad = true;
1189   let MemoryVT = i1;
1190 }
1191 def sextloadi8  : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1192   let IsLoad = true;
1193   let MemoryVT = i8;
1194 }
1195 def sextloadi16 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1196   let IsLoad = true;
1197   let MemoryVT = i16;
1198 }
1199 def sextloadi32 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1200   let IsLoad = true;
1201   let MemoryVT = i32;
1202 }
1203 def sextloadi64 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1204   let IsLoad = true;
1205   let MemoryVT = i64;
1206 }
1207 
1208 def zextloadi1  : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1209   let IsLoad = true;
1210   let MemoryVT = i1;
1211 }
1212 def zextloadi8  : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1213   let IsLoad = true;
1214   let MemoryVT = i8;
1215 }
1216 def zextloadi16 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1217   let IsLoad = true;
1218   let MemoryVT = i16;
1219 }
1220 def zextloadi32 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1221   let IsLoad = true;
1222   let MemoryVT = i32;
1223 }
1224 def zextloadi64 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1225   let IsLoad = true;
1226   let MemoryVT = i64;
1227 }
1228 
1229 def extloadvi1  : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1230   let IsLoad = true;
1231   let ScalarMemoryVT = i1;
1232 }
1233 def extloadvi8  : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1234   let IsLoad = true;
1235   let ScalarMemoryVT = i8;
1236 }
1237 def extloadvi16 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1238   let IsLoad = true;
1239   let ScalarMemoryVT = i16;
1240 }
1241 def extloadvi32 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1242   let IsLoad = true;
1243   let ScalarMemoryVT = i32;
1244 }
1245 def extloadvf16 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1246   let IsLoad = true;
1247   let ScalarMemoryVT = f16;
1248 }
1249 def extloadvf32 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1250   let IsLoad = true;
1251   let ScalarMemoryVT = f32;
1252 }
1253 def extloadvf64 : PatFrag<(ops node:$ptr), (extload node:$ptr)> {
1254   let IsLoad = true;
1255   let ScalarMemoryVT = f64;
1256 }
1257 
1258 def sextloadvi1  : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1259   let IsLoad = true;
1260   let ScalarMemoryVT = i1;
1261 }
1262 def sextloadvi8  : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1263   let IsLoad = true;
1264   let ScalarMemoryVT = i8;
1265 }
1266 def sextloadvi16 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1267   let IsLoad = true;
1268   let ScalarMemoryVT = i16;
1269 }
1270 def sextloadvi32 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> {
1271   let IsLoad = true;
1272   let ScalarMemoryVT = i32;
1273 }
1274 
1275 def zextloadvi1  : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1276   let IsLoad = true;
1277   let ScalarMemoryVT = i1;
1278 }
1279 def zextloadvi8  : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1280   let IsLoad = true;
1281   let ScalarMemoryVT = i8;
1282 }
1283 def zextloadvi16 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1284   let IsLoad = true;
1285   let ScalarMemoryVT = i16;
1286 }
1287 def zextloadvi32 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> {
1288   let IsLoad = true;
1289   let ScalarMemoryVT = i32;
1290 }
1291 
1292 // store fragments.
1293 def unindexedstore : PatFrag<(ops node:$val, node:$ptr),
1294                              (st node:$val, node:$ptr)> {
1295   let IsStore = true;
1296   let IsUnindexed = true;
1297 }
1298 def store : PatFrag<(ops node:$val, node:$ptr),
1299                     (unindexedstore node:$val, node:$ptr)> {
1300   let IsStore = true;
1301   let IsTruncStore = false;
1302 }
1303 
1304 // truncstore fragments.
1305 def truncstore : PatFrag<(ops node:$val, node:$ptr),
1306                          (unindexedstore node:$val, node:$ptr)> {
1307   let IsStore = true;
1308   let IsTruncStore = true;
1309 }
1310 def truncstorei8 : PatFrag<(ops node:$val, node:$ptr),
1311                            (truncstore node:$val, node:$ptr)> {
1312   let IsStore = true;
1313   let MemoryVT = i8;
1314   let IsTruncStore = true;
1315 }
1316 def truncstorei16 : PatFrag<(ops node:$val, node:$ptr),
1317                             (truncstore node:$val, node:$ptr)> {
1318   let IsStore = true;
1319   let MemoryVT = i16;
1320   let IsTruncStore = true;
1321 }
1322 def truncstorei32 : PatFrag<(ops node:$val, node:$ptr),
1323                             (truncstore node:$val, node:$ptr)> {
1324   let IsStore = true;
1325   let MemoryVT = i32;
1326   let IsTruncStore = true;
1327 }
1328 def truncstorei64 : PatFrag<(ops node:$val, node:$ptr),
1329                             (truncstore node:$val, node:$ptr)> {
1330   let IsStore = true;
1331   let MemoryVT = i64;
1332   let IsTruncStore = true;
1333 }
1334 def truncstoref16 : PatFrag<(ops node:$val, node:$ptr),
1335                             (truncstore node:$val, node:$ptr)> {
1336   let IsStore = true;
1337   let MemoryVT = f16;
1338 }
1339 def truncstoref32 : PatFrag<(ops node:$val, node:$ptr),
1340                             (truncstore node:$val, node:$ptr)> {
1341   let IsStore = true;
1342   let MemoryVT = f32;
1343 }
1344 def truncstoref64 : PatFrag<(ops node:$val, node:$ptr),
1345                             (truncstore node:$val, node:$ptr)> {
1346   let IsStore = true;
1347   let MemoryVT = f64;
1348 }
1349 
1350 def truncstorevi8 : PatFrag<(ops node:$val, node:$ptr),
1351                             (truncstore node:$val, node:$ptr)> {
1352   let IsStore = true;
1353   let ScalarMemoryVT = i8;
1354 }
1355 
1356 def truncstorevi16 : PatFrag<(ops node:$val, node:$ptr),
1357                              (truncstore node:$val, node:$ptr)> {
1358   let IsStore = true;
1359   let ScalarMemoryVT = i16;
1360 }
1361 
1362 def truncstorevi32 : PatFrag<(ops node:$val, node:$ptr),
1363                              (truncstore node:$val, node:$ptr)> {
1364   let IsStore = true;
1365   let ScalarMemoryVT = i32;
1366 }
1367 
1368 // indexed store fragments.
1369 def istore : PatFrag<(ops node:$val, node:$base, node:$offset),
1370                      (ist node:$val, node:$base, node:$offset)> {
1371   let IsStore = true;
1372   let IsTruncStore = false;
1373 }
1374 
1375 def pre_store : PatFrag<(ops node:$val, node:$base, node:$offset),
1376                         (istore node:$val, node:$base, node:$offset), [{
1377   ISD::MemIndexedMode AM = cast<StoreSDNode>(N)->getAddressingMode();
1378   return AM == ISD::PRE_INC || AM == ISD::PRE_DEC;
1379 }]>;
1380 
1381 def itruncstore : PatFrag<(ops node:$val, node:$base, node:$offset),
1382                           (ist node:$val, node:$base, node:$offset)> {
1383   let IsStore = true;
1384   let IsTruncStore = true;
1385 }
1386 def pre_truncst : PatFrag<(ops node:$val, node:$base, node:$offset),
1387                           (itruncstore node:$val, node:$base, node:$offset), [{
1388   ISD::MemIndexedMode AM = cast<StoreSDNode>(N)->getAddressingMode();
1389   return AM == ISD::PRE_INC || AM == ISD::PRE_DEC;
1390 }]>;
1391 def pre_truncsti1 : PatFrag<(ops node:$val, node:$base, node:$offset),
1392                             (pre_truncst node:$val, node:$base, node:$offset)> {
1393   let IsStore = true;
1394   let MemoryVT = i1;
1395 }
1396 def pre_truncsti8 : PatFrag<(ops node:$val, node:$base, node:$offset),
1397                             (pre_truncst node:$val, node:$base, node:$offset)> {
1398   let IsStore = true;
1399   let MemoryVT = i8;
1400 }
1401 def pre_truncsti16 : PatFrag<(ops node:$val, node:$base, node:$offset),
1402                              (pre_truncst node:$val, node:$base, node:$offset)> {
1403   let IsStore = true;
1404   let MemoryVT = i16;
1405 }
1406 def pre_truncsti32 : PatFrag<(ops node:$val, node:$base, node:$offset),
1407                              (pre_truncst node:$val, node:$base, node:$offset)> {
1408   let IsStore = true;
1409   let MemoryVT = i32;
1410 }
1411 def pre_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset),
1412                              (pre_truncst node:$val, node:$base, node:$offset)> {
1413   let IsStore = true;
1414   let MemoryVT = f32;
1415 }
1416 def pre_truncstvi8 : PatFrag<(ops node:$val, node:$base, node:$offset),
1417                              (pre_truncst node:$val, node:$base, node:$offset)> {
1418   let IsStore = true;
1419   let ScalarMemoryVT = i8;
1420 }
1421 def pre_truncstvi16 : PatFrag<(ops node:$val, node:$base, node:$offset),
1422                               (pre_truncst node:$val, node:$base, node:$offset)> {
1423   let IsStore = true;
1424   let ScalarMemoryVT = i16;
1425 }
1426 
1427 def post_store : PatFrag<(ops node:$val, node:$ptr, node:$offset),
1428                          (istore node:$val, node:$ptr, node:$offset), [{
1429   ISD::MemIndexedMode AM = cast<StoreSDNode>(N)->getAddressingMode();
1430   return AM == ISD::POST_INC || AM == ISD::POST_DEC;
1431 }]>;
1432 
1433 def post_truncst : PatFrag<(ops node:$val, node:$base, node:$offset),
1434                            (itruncstore node:$val, node:$base, node:$offset), [{
1435   ISD::MemIndexedMode AM = cast<StoreSDNode>(N)->getAddressingMode();
1436   return AM == ISD::POST_INC || AM == ISD::POST_DEC;
1437 }]>;
1438 def post_truncsti1 : PatFrag<(ops node:$val, node:$base, node:$offset),
1439                              (post_truncst node:$val, node:$base, node:$offset)> {
1440   let IsStore = true;
1441   let MemoryVT = i1;
1442 }
1443 def post_truncsti8 : PatFrag<(ops node:$val, node:$base, node:$offset),
1444                              (post_truncst node:$val, node:$base, node:$offset)> {
1445   let IsStore = true;
1446   let MemoryVT = i8;
1447 }
1448 def post_truncsti16 : PatFrag<(ops node:$val, node:$base, node:$offset),
1449                               (post_truncst node:$val, node:$base, node:$offset)> {
1450   let IsStore = true;
1451   let MemoryVT = i16;
1452 }
1453 def post_truncsti32 : PatFrag<(ops node:$val, node:$base, node:$offset),
1454                               (post_truncst node:$val, node:$base, node:$offset)> {
1455   let IsStore = true;
1456   let MemoryVT = i32;
1457 }
1458 def post_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset),
1459                               (post_truncst node:$val, node:$base, node:$offset)> {
1460   let IsStore = true;
1461   let MemoryVT = f32;
1462 }
1463 def post_truncstvi8 : PatFrag<(ops node:$val, node:$base, node:$offset),
1464                               (post_truncst node:$val, node:$base, node:$offset)> {
1465   let IsStore = true;
1466   let ScalarMemoryVT = i8;
1467 }
1468 def post_truncstvi16 : PatFrag<(ops node:$val, node:$base, node:$offset),
1469                                (post_truncst node:$val, node:$base, node:$offset)> {
1470   let IsStore = true;
1471   let ScalarMemoryVT = i16;
1472 }
1473 
1474 // A helper for matching undef or freeze undef
1475 def undef_or_freeze_undef : PatFrags<(ops), [(undef), (freeze undef)]>;
1476 
1477 // TODO: Split these into volatile and unordered flavors to enable
1478 // selectively legal optimizations for each.  (See D66309)
1479 def simple_load : PatFrag<(ops node:$ptr),
1480                           (load node:$ptr), [{
1481   return cast<LoadSDNode>(N)->isSimple();
1482 }]>;
1483 def simple_store : PatFrag<(ops node:$val, node:$ptr),
1484                            (store node:$val, node:$ptr), [{
1485   return cast<StoreSDNode>(N)->isSimple();
1486 }]>;
1487 
1488 // nontemporal store fragments.
1489 def nontemporalstore : PatFrag<(ops node:$val, node:$ptr),
1490                                (store node:$val, node:$ptr), [{
1491   return cast<StoreSDNode>(N)->isNonTemporal();
1492 }]>;
1493 
1494 def alignednontemporalstore : PatFrag<(ops node:$val, node:$ptr),
1495                                       (nontemporalstore node:$val, node:$ptr), [{
1496   StoreSDNode *St = cast<StoreSDNode>(N);
1497   return St->getAlign() >= St->getMemoryVT().getStoreSize();
1498 }]>;
1499 
1500 def unalignednontemporalstore : PatFrag<(ops node:$val, node:$ptr),
1501                                         (nontemporalstore node:$val, node:$ptr), [{
1502   StoreSDNode *St = cast<StoreSDNode>(N);
1503   return St->getAlignment() < St->getMemoryVT().getStoreSize();
1504 }]>;
1505 
1506 // nontemporal load fragments.
1507 def nontemporalload : PatFrag<(ops node:$ptr),
1508                                (load node:$ptr), [{
1509   return cast<LoadSDNode>(N)->isNonTemporal();
1510 }]>;
1511 
1512 def alignednontemporalload : PatFrag<(ops node:$ptr),
1513                                       (nontemporalload node:$ptr), [{
1514   LoadSDNode *Ld = cast<LoadSDNode>(N);
1515   return Ld->getAlign() >= Ld->getMemoryVT().getStoreSize();
1516 }]>;
1517 
1518 // setcc convenience fragments.
1519 def setoeq : PatFrag<(ops node:$lhs, node:$rhs),
1520                      (setcc node:$lhs, node:$rhs, SETOEQ)>;
1521 def setogt : PatFrag<(ops node:$lhs, node:$rhs),
1522                      (setcc node:$lhs, node:$rhs, SETOGT)>;
1523 def setoge : PatFrag<(ops node:$lhs, node:$rhs),
1524                      (setcc node:$lhs, node:$rhs, SETOGE)>;
1525 def setolt : PatFrag<(ops node:$lhs, node:$rhs),
1526                      (setcc node:$lhs, node:$rhs, SETOLT)>;
1527 def setole : PatFrag<(ops node:$lhs, node:$rhs),
1528                      (setcc node:$lhs, node:$rhs, SETOLE)>;
1529 def setone : PatFrag<(ops node:$lhs, node:$rhs),
1530                      (setcc node:$lhs, node:$rhs, SETONE)>;
1531 def seto   : PatFrag<(ops node:$lhs, node:$rhs),
1532                      (setcc node:$lhs, node:$rhs, SETO)>;
1533 def setuo  : PatFrag<(ops node:$lhs, node:$rhs),
1534                      (setcc node:$lhs, node:$rhs, SETUO)>;
1535 def setueq : PatFrag<(ops node:$lhs, node:$rhs),
1536                      (setcc node:$lhs, node:$rhs, SETUEQ)>;
1537 def setugt : PatFrag<(ops node:$lhs, node:$rhs),
1538                      (setcc node:$lhs, node:$rhs, SETUGT)>;
1539 def setuge : PatFrag<(ops node:$lhs, node:$rhs),
1540                      (setcc node:$lhs, node:$rhs, SETUGE)>;
1541 def setult : PatFrag<(ops node:$lhs, node:$rhs),
1542                      (setcc node:$lhs, node:$rhs, SETULT)>;
1543 def setule : PatFrag<(ops node:$lhs, node:$rhs),
1544                      (setcc node:$lhs, node:$rhs, SETULE)>;
1545 def setune : PatFrag<(ops node:$lhs, node:$rhs),
1546                      (setcc node:$lhs, node:$rhs, SETUNE)>;
1547 def seteq  : PatFrag<(ops node:$lhs, node:$rhs),
1548                      (setcc node:$lhs, node:$rhs, SETEQ)>;
1549 def setgt  : PatFrag<(ops node:$lhs, node:$rhs),
1550                      (setcc node:$lhs, node:$rhs, SETGT)>;
1551 def setge  : PatFrag<(ops node:$lhs, node:$rhs),
1552                      (setcc node:$lhs, node:$rhs, SETGE)>;
1553 def setlt  : PatFrag<(ops node:$lhs, node:$rhs),
1554                      (setcc node:$lhs, node:$rhs, SETLT)>;
1555 def setle  : PatFrag<(ops node:$lhs, node:$rhs),
1556                      (setcc node:$lhs, node:$rhs, SETLE)>;
1557 def setne  : PatFrag<(ops node:$lhs, node:$rhs),
1558                      (setcc node:$lhs, node:$rhs, SETNE)>;
1559 
1560 // We don't have strict FP extended loads as single DAG nodes, but we can
1561 // still provide convenience fragments to match those operations.
1562 def strict_extloadf32 : PatFrag<(ops node:$ptr),
1563                                 (strict_fpextend (f32 (load node:$ptr)))>;
1564 def strict_extloadf64 : PatFrag<(ops node:$ptr),
1565                                 (strict_fpextend (f64 (load node:$ptr)))>;
1566 
1567 // Convenience fragments to match both strict and non-strict fp operations
1568 def any_fadd       : PatFrags<(ops node:$lhs, node:$rhs),
1569                               [(strict_fadd node:$lhs, node:$rhs),
1570                                (fadd node:$lhs, node:$rhs)]>;
1571 def any_fsub       : PatFrags<(ops node:$lhs, node:$rhs),
1572                               [(strict_fsub node:$lhs, node:$rhs),
1573                                (fsub node:$lhs, node:$rhs)]>;
1574 def any_fmul       : PatFrags<(ops node:$lhs, node:$rhs),
1575                               [(strict_fmul node:$lhs, node:$rhs),
1576                                (fmul node:$lhs, node:$rhs)]>;
1577 def any_fdiv       : PatFrags<(ops node:$lhs, node:$rhs),
1578                               [(strict_fdiv node:$lhs, node:$rhs),
1579                                (fdiv node:$lhs, node:$rhs)]>;
1580 def any_frem       : PatFrags<(ops node:$lhs, node:$rhs),
1581                               [(strict_frem node:$lhs, node:$rhs),
1582                                (frem node:$lhs, node:$rhs)]>;
1583 def any_fma        : PatFrags<(ops node:$src1, node:$src2, node:$src3),
1584                               [(strict_fma node:$src1, node:$src2, node:$src3),
1585                                (fma node:$src1, node:$src2, node:$src3)]>;
1586 def any_fsqrt      : PatFrags<(ops node:$src),
1587                               [(strict_fsqrt node:$src),
1588                                (fsqrt node:$src)]>;
1589 def any_fsin       : PatFrags<(ops node:$src),
1590                               [(strict_fsin node:$src),
1591                                (fsin node:$src)]>;
1592 def any_fcos       : PatFrags<(ops node:$src),
1593                               [(strict_fcos node:$src),
1594                                (fcos node:$src)]>;
1595 def any_ftan       : PatFrags<(ops node:$src),
1596                               [(strict_ftan node:$src),
1597                                (ftan node:$src)]>;
1598 def any_fasin      : PatFrags<(ops node:$src),
1599                               [(strict_fasin node:$src),
1600                                (fasin node:$src)]>;
1601 def any_facos      : PatFrags<(ops node:$src),
1602                               [(strict_facos node:$src),
1603                                (facos node:$src)]>;
1604 def any_fatan      : PatFrags<(ops node:$src),
1605                               [(strict_fatan node:$src),
1606                                (fatan node:$src)]>;
1607 def any_fatan2      : PatFrags<(ops node:$src1, node:$src2),
1608                               [(strict_fatan2 node:$src1, node:$src2),
1609                                (fatan2 node:$src1, node:$src2)]>;
1610 def any_fsinh      : PatFrags<(ops node:$src),
1611                               [(strict_fsinh node:$src),
1612                                (fsinh node:$src)]>;
1613 def any_fcosh      : PatFrags<(ops node:$src),
1614                               [(strict_fcosh node:$src),
1615                                (fcosh node:$src)]>;
1616 def any_ftanh      : PatFrags<(ops node:$src),
1617                               [(strict_ftanh node:$src),
1618                                (ftanh node:$src)]>;
1619 def any_fexp2      : PatFrags<(ops node:$src),
1620                               [(strict_fexp2 node:$src),
1621                                (fexp2 node:$src)]>;
1622 def any_fpow       : PatFrags<(ops node:$lhs, node:$rhs),
1623                               [(strict_fpow node:$lhs, node:$rhs),
1624                                (fpow node:$lhs, node:$rhs)]>;
1625 def any_fldexp      : PatFrags<(ops node:$lhs, node:$rhs),
1626                               [(strict_fldexp node:$lhs, node:$rhs),
1627                                (fldexp node:$lhs, node:$rhs)]>;
1628 def any_flog2      : PatFrags<(ops node:$src),
1629                               [(strict_flog2 node:$src),
1630                                (flog2 node:$src)]>;
1631 def any_frint      : PatFrags<(ops node:$src),
1632                               [(strict_frint node:$src),
1633                                (frint node:$src)]>;
1634 def any_lrint      : PatFrags<(ops node:$src),
1635                               [(strict_lrint node:$src),
1636                                (lrint node:$src)]>;
1637 def any_llrint     : PatFrags<(ops node:$src),
1638                               [(strict_llrint node:$src),
1639                                (llrint node:$src)]>;
1640 def any_fnearbyint : PatFrags<(ops node:$src),
1641                               [(strict_fnearbyint node:$src),
1642                                (fnearbyint node:$src)]>;
1643 def any_fceil      : PatFrags<(ops node:$src),
1644                               [(strict_fceil node:$src),
1645                                (fceil node:$src)]>;
1646 def any_ffloor     : PatFrags<(ops node:$src),
1647                               [(strict_ffloor node:$src),
1648                                (ffloor node:$src)]>;
1649 def any_lround     : PatFrags<(ops node:$src),
1650                               [(strict_lround node:$src),
1651                                (lround node:$src)]>;
1652 def any_llround    : PatFrags<(ops node:$src),
1653                               [(strict_llround node:$src),
1654                                (llround node:$src)]>;
1655 def any_fround     : PatFrags<(ops node:$src),
1656                               [(strict_fround node:$src),
1657                                (fround node:$src)]>;
1658 def any_froundeven : PatFrags<(ops node:$src),
1659                               [(strict_froundeven node:$src),
1660                                (froundeven node:$src)]>;
1661 def any_ftrunc     : PatFrags<(ops node:$src),
1662                               [(strict_ftrunc node:$src),
1663                                (ftrunc node:$src)]>;
1664 def any_fmaxnum    : PatFrags<(ops node:$lhs, node:$rhs),
1665                               [(strict_fmaxnum node:$lhs, node:$rhs),
1666                                (fmaxnum node:$lhs, node:$rhs)]>;
1667 def any_fminnum    : PatFrags<(ops node:$lhs, node:$rhs),
1668                               [(strict_fminnum node:$lhs, node:$rhs),
1669                                (fminnum node:$lhs, node:$rhs)]>;
1670 def any_fmaximum   : PatFrags<(ops node:$lhs, node:$rhs),
1671                               [(strict_fmaximum node:$lhs, node:$rhs),
1672                                (fmaximum node:$lhs, node:$rhs)]>;
1673 def any_fminimum   : PatFrags<(ops node:$lhs, node:$rhs),
1674                               [(strict_fminimum node:$lhs, node:$rhs),
1675                                (fminimum node:$lhs, node:$rhs)]>;
1676 def any_fpround    : PatFrags<(ops node:$src),
1677                               [(strict_fpround node:$src),
1678                                (fpround node:$src)]>;
1679 def any_fpextend   : PatFrags<(ops node:$src),
1680                               [(strict_fpextend node:$src),
1681                                (fpextend node:$src)]>;
1682 def any_extloadf32 : PatFrags<(ops node:$ptr),
1683                               [(strict_extloadf32 node:$ptr),
1684                                (extloadf32 node:$ptr)]>;
1685 def any_extloadf64 : PatFrags<(ops node:$ptr),
1686                               [(strict_extloadf64 node:$ptr),
1687                                (extloadf64 node:$ptr)]>;
1688 def any_fp_to_sint : PatFrags<(ops node:$src),
1689                               [(strict_fp_to_sint node:$src),
1690                                (fp_to_sint node:$src)]>;
1691 def any_fp_to_uint : PatFrags<(ops node:$src),
1692                               [(strict_fp_to_uint node:$src),
1693                                (fp_to_uint node:$src)]>;
1694 def any_sint_to_fp : PatFrags<(ops node:$src),
1695                               [(strict_sint_to_fp node:$src),
1696                                (sint_to_fp node:$src)]>;
1697 def any_uint_to_fp : PatFrags<(ops node:$src),
1698                               [(strict_uint_to_fp node:$src),
1699                                (uint_to_fp node:$src)]>;
1700 def any_fsetcc : PatFrags<(ops node:$lhs, node:$rhs, node:$pred),
1701                           [(strict_fsetcc node:$lhs, node:$rhs, node:$pred),
1702                            (setcc node:$lhs, node:$rhs, node:$pred)]>;
1703 def any_fsetccs : PatFrags<(ops node:$lhs, node:$rhs, node:$pred),
1704                           [(strict_fsetccs node:$lhs, node:$rhs, node:$pred),
1705                            (setcc node:$lhs, node:$rhs, node:$pred)]>;
1706 
1707 def any_f16_to_fp : PatFrags<(ops node:$src),
1708                               [(f16_to_fp node:$src),
1709                                (strict_f16_to_fp node:$src)]>;
1710 def any_fp_to_f16 : PatFrags<(ops node:$src),
1711                               [(fp_to_f16 node:$src),
1712                                (strict_fp_to_f16 node:$src)]>;
1713 def any_bf16_to_fp : PatFrags<(ops node:$src),
1714                                [(bf16_to_fp node:$src),
1715                                 (strict_bf16_to_fp node:$src)]>;
1716 def any_fp_to_bf16 : PatFrags<(ops node:$src),
1717                                [(fp_to_bf16 node:$src),
1718                                 (strict_fp_to_bf16 node:$src)]>;
1719 
1720 multiclass binary_atomic_op_ord {
1721   def NAME#_monotonic : PatFrag<(ops node:$ptr, node:$val),
1722       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$val)> {
1723     let IsAtomic = true;
1724     let IsAtomicOrderingMonotonic = true;
1725   }
1726   def NAME#_acquire : PatFrag<(ops node:$ptr, node:$val),
1727       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$val)> {
1728     let IsAtomic = true;
1729     let IsAtomicOrderingAcquire = true;
1730   }
1731   def NAME#_release : PatFrag<(ops node:$ptr, node:$val),
1732       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$val)> {
1733     let IsAtomic = true;
1734     let IsAtomicOrderingRelease = true;
1735   }
1736   def NAME#_acq_rel : PatFrag<(ops node:$ptr, node:$val),
1737       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$val)> {
1738     let IsAtomic = true;
1739     let IsAtomicOrderingAcquireRelease = true;
1740   }
1741   def NAME#_seq_cst : PatFrag<(ops node:$ptr, node:$val),
1742       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$val)> {
1743     let IsAtomic = true;
1744     let IsAtomicOrderingSequentiallyConsistent = true;
1745   }
1746 }
1747 
1748 multiclass ternary_atomic_op_ord {
1749   def NAME#_monotonic : PatFrag<(ops node:$ptr, node:$cmp, node:$val),
1750       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$cmp, node:$val)> {
1751     let IsAtomic = true;
1752     let IsAtomicOrderingMonotonic = true;
1753   }
1754   def NAME#_acquire : PatFrag<(ops node:$ptr, node:$cmp, node:$val),
1755       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$cmp, node:$val)> {
1756     let IsAtomic = true;
1757     let IsAtomicOrderingAcquire = true;
1758   }
1759   def NAME#_release : PatFrag<(ops node:$ptr, node:$cmp, node:$val),
1760       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$cmp, node:$val)> {
1761     let IsAtomic = true;
1762     let IsAtomicOrderingRelease = true;
1763   }
1764   def NAME#_acq_rel : PatFrag<(ops node:$ptr, node:$cmp, node:$val),
1765       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$cmp, node:$val)> {
1766     let IsAtomic = true;
1767     let IsAtomicOrderingAcquireRelease = true;
1768   }
1769   def NAME#_seq_cst : PatFrag<(ops node:$ptr, node:$cmp, node:$val),
1770       (!cast<SDPatternOperator>(NAME) node:$ptr, node:$cmp, node:$val)> {
1771     let IsAtomic = true;
1772     let IsAtomicOrderingSequentiallyConsistent = true;
1773   }
1774 }
1775 
1776 multiclass binary_atomic_op<SDNode atomic_op> {
1777   foreach vt = [ i8, i16, i32, i64 ] in {
1778     def _#vt : PatFrag<(ops node:$ptr, node:$val),
1779                        (atomic_op  node:$ptr, node:$val)> {
1780       let IsAtomic = true;
1781       let MemoryVT = vt;
1782     }
1783 
1784     defm NAME#_#vt  : binary_atomic_op_ord;
1785   }
1786 }
1787 
1788 multiclass binary_atomic_op_fp<SDNode atomic_op> {
1789   foreach vt = [ f16, bf16, v2f16, v2bf16, f32, f64 ] in {
1790     def _#vt : PatFrag<(ops node:$ptr, node:$val),
1791                        (atomic_op node:$ptr, node:$val)> {
1792       let IsAtomic = true;
1793       let MemoryVT = vt;
1794     }
1795 
1796     defm NAME#_#vt : binary_atomic_op_ord;
1797   }
1798 }
1799 
1800 multiclass ternary_atomic_op<SDNode atomic_op> {
1801   foreach vt = [ i8, i16, i32, i64 ] in {
1802     def _#vt : PatFrag<(ops node:$ptr, node:$cmp, node:$val),
1803                        (atomic_op node:$ptr, node:$cmp, node:$val)> {
1804       let IsAtomic = true;
1805       let MemoryVT = vt;
1806     }
1807 
1808     defm NAME#_#vt  : ternary_atomic_op_ord;
1809   }
1810 }
1811 
1812 defm atomic_load_add  : binary_atomic_op<atomic_load_add>;
1813 defm atomic_swap      : binary_atomic_op<atomic_swap>;
1814 defm atomic_load_sub  : binary_atomic_op<atomic_load_sub>;
1815 defm atomic_load_and  : binary_atomic_op<atomic_load_and>;
1816 defm atomic_load_clr  : binary_atomic_op<atomic_load_clr>;
1817 defm atomic_load_or   : binary_atomic_op<atomic_load_or>;
1818 defm atomic_load_xor  : binary_atomic_op<atomic_load_xor>;
1819 defm atomic_load_nand : binary_atomic_op<atomic_load_nand>;
1820 defm atomic_load_min  : binary_atomic_op<atomic_load_min>;
1821 defm atomic_load_max  : binary_atomic_op<atomic_load_max>;
1822 defm atomic_load_umin : binary_atomic_op<atomic_load_umin>;
1823 defm atomic_load_umax : binary_atomic_op<atomic_load_umax>;
1824 defm atomic_cmp_swap  : ternary_atomic_op<atomic_cmp_swap>;
1825 
1826 /// Atomic load which zeroes the excess high bits.
1827 def atomic_load_zext :
1828   PatFrag<(ops node:$ptr), (atomic_load node:$ptr)> {
1829   let IsAtomic = true; // FIXME: Should be IsLoad and/or IsAtomic?
1830   let IsZeroExtLoad = true;
1831 }
1832 
1833 /// Atomic load which sign extends the excess high bits.
1834 def atomic_load_sext :
1835   PatFrag<(ops node:$ptr), (atomic_load node:$ptr)> {
1836   let IsAtomic = true; // FIXME: Should be IsLoad and/or IsAtomic?
1837   let IsSignExtLoad = true;
1838 }
1839 
1840 def atomic_load_8 :
1841   PatFrag<(ops node:$ptr),
1842           (atomic_load node:$ptr)> {
1843   let IsAtomic = true;
1844   let MemoryVT = i8;
1845 }
1846 
1847 def atomic_load_16 :
1848   PatFrag<(ops node:$ptr),
1849           (atomic_load node:$ptr)> {
1850   let IsAtomic = true;
1851   let MemoryVT = i16;
1852 }
1853 
1854 def atomic_load_32 :
1855   PatFrag<(ops node:$ptr),
1856           (atomic_load node:$ptr)> {
1857   let IsAtomic = true;
1858   let MemoryVT = i32;
1859 }
1860 def atomic_load_64 :
1861   PatFrag<(ops node:$ptr),
1862           (atomic_load node:$ptr)> {
1863   let IsAtomic = true;
1864   let MemoryVT = i64;
1865 }
1866 
1867 def atomic_load_zext_8 :
1868   PatFrag<(ops node:$ptr), (atomic_load_zext node:$ptr)> {
1869   let IsAtomic = true; // FIXME: Should be IsLoad and/or IsAtomic?
1870   let MemoryVT = i8;
1871 }
1872 
1873 def atomic_load_zext_16 :
1874   PatFrag<(ops node:$ptr), (atomic_load_zext node:$ptr)> {
1875   let IsAtomic = true; // FIXME: Should be IsLoad and/or IsAtomic?
1876   let MemoryVT = i16;
1877 }
1878 
1879 def atomic_load_sext_8 :
1880   PatFrag<(ops node:$ptr), (atomic_load_sext node:$ptr)> {
1881   let IsAtomic = true; // FIXME: Should be IsLoad and/or IsAtomic?
1882   let MemoryVT = i8;
1883 }
1884 
1885 def atomic_load_sext_16 :
1886   PatFrag<(ops node:$ptr), (atomic_load_sext node:$ptr)> {
1887   let IsAtomic = true; // FIXME: Should be IsLoad and/or IsAtomic?
1888   let MemoryVT = i16;
1889 }
1890 
1891 // Atomic load which zeroes or anyextends the high bits.
1892 def atomic_load_az_8 : PatFrags<(ops node:$op),
1893                                 [(atomic_load_8 node:$op),
1894                                  (atomic_load_zext_8 node:$op)]>;
1895 
1896 // Atomic load which zeroes or anyextends the high bits.
1897 def atomic_load_az_16 : PatFrags<(ops node:$op),
1898                                  [(atomic_load_16 node:$op),
1899                                   (atomic_load_zext_16 node:$op)]>;
1900 
1901 def nonext_masked_gather :
1902   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1903           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1904   return cast<MaskedGatherSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD;
1905 }]>;
1906 
1907 // Any extending masked gather fragments.
1908 def ext_masked_gather_i8 :
1909   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1910           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1911   auto MGN = cast<MaskedGatherSDNode>(N);
1912   return MGN->getExtensionType() == ISD::EXTLOAD &&
1913          MGN->getMemoryVT().getScalarType() == MVT::i8;
1914 }]>;
1915 def ext_masked_gather_i16 :
1916   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1917           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1918   auto MGN = cast<MaskedGatherSDNode>(N);
1919   return MGN->getExtensionType() == ISD::EXTLOAD &&
1920          MGN->getMemoryVT().getScalarType() == MVT::i16;
1921 }]>;
1922 def ext_masked_gather_i32 :
1923   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1924           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1925   auto MGN = cast<MaskedGatherSDNode>(N);
1926   return MGN->getExtensionType() == ISD::EXTLOAD &&
1927          MGN->getMemoryVT().getScalarType() == MVT::i32;
1928 }]>;
1929 
1930 // Sign extending masked gather fragments.
1931 def sext_masked_gather_i8 :
1932   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1933           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1934   auto MGN = cast<MaskedGatherSDNode>(N);
1935   return MGN->getExtensionType() == ISD::SEXTLOAD &&
1936          MGN->getMemoryVT().getScalarType() == MVT::i8;
1937 }]>;
1938 def sext_masked_gather_i16 :
1939   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1940           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1941   auto MGN = cast<MaskedGatherSDNode>(N);
1942   return MGN->getExtensionType() == ISD::SEXTLOAD &&
1943          MGN->getMemoryVT().getScalarType() == MVT::i16;
1944 }]>;
1945 def sext_masked_gather_i32 :
1946   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1947           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1948   auto MGN = cast<MaskedGatherSDNode>(N);
1949   return MGN->getExtensionType() == ISD::SEXTLOAD &&
1950          MGN->getMemoryVT().getScalarType() == MVT::i32;
1951 }]>;
1952 
1953 // Zero extending masked gather fragments.
1954 def zext_masked_gather_i8 :
1955   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1956           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1957   auto MGN = cast<MaskedGatherSDNode>(N);
1958   return MGN->getExtensionType() == ISD::ZEXTLOAD &&
1959          MGN->getMemoryVT().getScalarType() == MVT::i8;
1960 }]>;
1961 def zext_masked_gather_i16 :
1962   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1963           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1964   auto MGN = cast<MaskedGatherSDNode>(N);
1965   return MGN->getExtensionType() == ISD::ZEXTLOAD &&
1966          MGN->getMemoryVT().getScalarType() == MVT::i16;
1967 }]>;
1968 def zext_masked_gather_i32 :
1969   PatFrag<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1970           (masked_gather node:$def, node:$pred, node:$ptr, node:$idx), [{
1971   auto MGN = cast<MaskedGatherSDNode>(N);
1972   return MGN->getExtensionType() == ISD::ZEXTLOAD &&
1973          MGN->getMemoryVT().getScalarType() == MVT::i32;
1974 }]>;
1975 
1976 // Any/Zero extending masked gather fragments.
1977 def azext_masked_gather_i8 :
1978   PatFrags<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1979            [(ext_masked_gather_i8 node:$def, node:$pred, node:$ptr, node:$idx),
1980             (zext_masked_gather_i8 node:$def, node:$pred, node:$ptr, node:$idx)]>;
1981 def azext_masked_gather_i16 :
1982   PatFrags<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1983            [(ext_masked_gather_i16 node:$def, node:$pred, node:$ptr, node:$idx),
1984             (zext_masked_gather_i16 node:$def, node:$pred, node:$ptr, node:$idx)]>;
1985 def azext_masked_gather_i32 :
1986   PatFrags<(ops node:$def, node:$pred, node:$ptr, node:$idx),
1987            [(ext_masked_gather_i32 node:$def, node:$pred, node:$ptr, node:$idx),
1988             (zext_masked_gather_i32 node:$def, node:$pred, node:$ptr, node:$idx)]>;
1989 
1990 def nontrunc_masked_scatter :
1991   PatFrag<(ops node:$val, node:$pred, node:$ptr, node:$idx),
1992           (masked_scatter node:$val, node:$pred, node:$ptr, node:$idx), [{
1993   return !cast<MaskedScatterSDNode>(N)->isTruncatingStore();
1994 }]>;
1995 
1996 // Truncating masked scatter fragments.
1997 def trunc_masked_scatter_i8 :
1998   PatFrag<(ops node:$val, node:$pred, node:$ptr, node:$idx),
1999           (masked_scatter node:$val, node:$pred, node:$ptr, node:$idx), [{
2000   auto MSN = cast<MaskedScatterSDNode>(N);
2001   return MSN->isTruncatingStore() &&
2002          MSN->getMemoryVT().getScalarType() == MVT::i8;
2003 }]>;
2004 def trunc_masked_scatter_i16 :
2005   PatFrag<(ops node:$val, node:$pred, node:$ptr, node:$idx),
2006           (masked_scatter node:$val, node:$pred, node:$ptr, node:$idx), [{
2007   auto MSN = cast<MaskedScatterSDNode>(N);
2008   return MSN->isTruncatingStore() &&
2009          MSN->getMemoryVT().getScalarType() == MVT::i16;
2010 }]>;
2011 def trunc_masked_scatter_i32 :
2012   PatFrag<(ops node:$val, node:$pred, node:$ptr, node:$idx),
2013           (masked_scatter node:$val, node:$pred, node:$ptr, node:$idx), [{
2014   auto MSN = cast<MaskedScatterSDNode>(N);
2015   return MSN->isTruncatingStore() &&
2016          MSN->getMemoryVT().getScalarType() == MVT::i32;
2017 }]>;
2018 
2019 
2020 def atomic_store_8 :
2021   PatFrag<(ops node:$val, node:$ptr),
2022           (atomic_store node:$val, node:$ptr)> {
2023   let IsAtomic = true;
2024   let MemoryVT = i8;
2025 }
2026 
2027 def atomic_store_16 :
2028   PatFrag<(ops node:$val, node:$ptr),
2029           (atomic_store node:$val, node:$ptr)> {
2030   let IsAtomic = true;
2031   let MemoryVT = i16;
2032 }
2033 
2034 def atomic_store_32 :
2035   PatFrag<(ops node:$val, node:$ptr),
2036           (atomic_store node:$val, node:$ptr)> {
2037   let IsAtomic = true;
2038   let MemoryVT = i32;
2039 }
2040 
2041 def atomic_store_64 :
2042   PatFrag<(ops node:$val, node:$ptr),
2043           (atomic_store node:$val, node:$ptr)> {
2044   let IsAtomic = true;
2045   let MemoryVT = i64;
2046 }
2047 
2048 //===----------------------------------------------------------------------===//
2049 // Selection DAG Pattern Support.
2050 //
2051 // Patterns are what are actually matched against by the target-flavored
2052 // instruction selection DAG.  Instructions defined by the target implicitly
2053 // define patterns in most cases, but patterns can also be explicitly added when
2054 // an operation is defined by a sequence of instructions (e.g. loading a large
2055 // immediate value on RISC targets that do not support immediates as large as
2056 // their GPRs).
2057 //
2058 
2059 class Pattern<dag patternToMatch, list<dag> resultInstrs> {
2060   dag             PatternToMatch  = patternToMatch;
2061   list<dag>       ResultInstrs    = resultInstrs;
2062   list<Predicate> Predicates      = [];  // See class Instruction in Target.td.
2063   int             AddedComplexity = 0;   // See class Instruction in Target.td.
2064   bit           GISelShouldIgnore = 0;
2065 }
2066 
2067 // Pat - A simple (but common) form of a pattern, which produces a simple result
2068 // not needing a full list.
2069 class Pat<dag pattern, dag result> : Pattern<pattern, [result]>;
2070 
2071 //===----------------------------------------------------------------------===//
2072 // Complex pattern definitions.
2073 //
2074 
2075 // Complex patterns, e.g. X86 addressing mode, requires pattern matching code
2076 // in C++. Ty is the type of return value; NumOperands is the number of operands
2077 // returned by the select function; SelectFunc is the name of the function used
2078 // to pattern match the max. pattern; RootNodes are the list of possible root nodes
2079 // of the sub-dags to match.
2080 // e.g. X86 addressing mode - def addr : ComplexPattern<iPTR, 4, "SelectAddr", [add]>;
2081 //
2082 class ComplexPattern<ValueType ty, int numops, string fn,
2083                      list<SDNode> roots = [], list<SDNodeProperty> props = [],
2084                      int complexity = -1> {
2085   ValueType Ty = ty;
2086   int NumOperands = numops;
2087   string SelectFunc = fn;
2088   list<SDNode> RootNodes = roots;
2089   list<SDNodeProperty> Properties = props;
2090   int Complexity = complexity;
2091 
2092   // Set this to true if SelectFunc wants an additional argument
2093   // that is the root of the matched pattern.
2094   bit WantsRoot = false;
2095 
2096   // Set this to true if SelectFunc wants an additional argument
2097   // that is the parent of the matched node.
2098   bit WantsParent = false;
2099 }