1//===- TargetSelectionDAG.td - Common code for DAG isels ---*- tablegen -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// This file defines the target-independent interfaces used by SelectionDAG 10// instruction selection generators. 11// 12//===----------------------------------------------------------------------===// 13 14//===----------------------------------------------------------------------===// 15// Selection DAG Type Constraint definitions. 16// 17// Note that the semantics of these constraints are hard coded into tblgen. To 18// modify or add constraints, you have to hack tblgen. 19// 20 21class SDTypeConstraint<int opnum> { 22 int OperandNum = opnum; 23} 24 25// SDTCisVT - The specified operand has exactly this VT. 26class SDTCisVT<int OpNum, ValueType vt> : SDTypeConstraint<OpNum> { 27 ValueType VT = vt; 28} 29 30class SDTCisPtrTy<int OpNum> : SDTypeConstraint<OpNum>; 31 32// SDTCisInt - The specified operand has integer type. 33class SDTCisInt<int OpNum> : SDTypeConstraint<OpNum>; 34 35// SDTCisFP - The specified operand has floating-point type. 36class SDTCisFP<int OpNum> : SDTypeConstraint<OpNum>; 37 38// SDTCisVec - The specified operand has a vector type. 39class SDTCisVec<int OpNum> : SDTypeConstraint<OpNum>; 40 41// SDTCisSameAs - The two specified operands have identical types. 42class SDTCisSameAs<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> { 43 int OtherOperandNum = OtherOp; 44} 45 46// SDTCisVTSmallerThanOp - The specified operand is a VT SDNode, and its type is 47// smaller than the 'Other' operand. 48class SDTCisVTSmallerThanOp<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> { 49 int OtherOperandNum = OtherOp; 50} 51 52class SDTCisOpSmallerThanOp<int SmallOp, int BigOp> : SDTypeConstraint<SmallOp>{ 53 int BigOperandNum = BigOp; 54} 55 56/// SDTCisEltOfVec - This indicates that ThisOp is a scalar type of the same 57/// type as the element type of OtherOp, which is a vector type. 58class SDTCisEltOfVec<int ThisOp, int OtherOp> 59 : SDTypeConstraint<ThisOp> { 60 int OtherOpNum = OtherOp; 61} 62 63/// SDTCisSubVecOfVec - This indicates that ThisOp is a vector type 64/// with length less that of OtherOp, which is a vector type. 65class SDTCisSubVecOfVec<int ThisOp, int OtherOp> 66 : SDTypeConstraint<ThisOp> { 67 int OtherOpNum = OtherOp; 68} 69 70// SDTCVecEltisVT - The specified operand is vector type with element type 71// of VT. 72class SDTCVecEltisVT<int OpNum, ValueType vt> : SDTypeConstraint<OpNum> { 73 ValueType VT = vt; 74} 75 76// SDTCisSameNumEltsAs - The two specified operands have identical number 77// of elements. 78class SDTCisSameNumEltsAs<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> { 79 int OtherOperandNum = OtherOp; 80} 81 82// SDTCisSameSizeAs - The two specified operands have identical size. 83class SDTCisSameSizeAs<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> { 84 int OtherOperandNum = OtherOp; 85} 86 87//===----------------------------------------------------------------------===// 88// Selection DAG Type Profile definitions. 89// 90// These use the constraints defined above to describe the type requirements of 91// the various nodes. These are not hard coded into tblgen, allowing targets to 92// add their own if needed. 93// 94 95// SDTypeProfile - This profile describes the type requirements of a Selection 96// DAG node. 97class SDTypeProfile<int numresults, int numoperands, 98 list<SDTypeConstraint> constraints> { 99 int NumResults = numresults; 100 int NumOperands = numoperands; 101 list<SDTypeConstraint> Constraints = constraints; 102} 103 104// Builtin profiles. 105def SDTIntLeaf: SDTypeProfile<1, 0, [SDTCisInt<0>]>; // for 'imm'. 106def SDTFPLeaf : SDTypeProfile<1, 0, [SDTCisFP<0>]>; // for 'fpimm'. 107def SDTPtrLeaf: SDTypeProfile<1, 0, [SDTCisPtrTy<0>]>; // for '&g'. 108def SDTOther : SDTypeProfile<1, 0, [SDTCisVT<0, OtherVT>]>; // for 'vt'. 109def SDTUNDEF : SDTypeProfile<1, 0, []>; // for 'undef'. 110def SDTUnaryOp : SDTypeProfile<1, 1, []>; // for bitconvert. 111 112def SDTPtrAddOp : SDTypeProfile<1, 2, [ // ptradd 113 SDTCisSameAs<0, 1>, SDTCisInt<2>, SDTCisPtrTy<1> 114]>; 115def SDTIntBinOp : SDTypeProfile<1, 2, [ // add, and, or, xor, udiv, etc. 116 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0> 117]>; 118def SDTIntShiftOp : SDTypeProfile<1, 2, [ // shl, sra, srl 119 SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisInt<2> 120]>; 121def SDTIntShiftPairOp : SDTypeProfile<2, 3, [ // shl_parts, sra_parts, srl_parts 122 SDTCisInt<0>, SDTCisSameAs<1, 0>, 123 SDTCisSameAs<2, 0>, SDTCisSameAs<3, 0>, SDTCisInt<4> 124]>; 125def SDTIntShiftDOp: SDTypeProfile<1, 3, [ // fshl, fshr 126 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>, SDTCisInt<3> 127]>; 128def SDTIntSatNoShOp : SDTypeProfile<1, 2, [ // ssat with no shift 129 SDTCisSameAs<0, 1>, SDTCisInt<2> 130]>; 131def SDTIntBinHiLoOp : SDTypeProfile<2, 2, [ // smullohi, umullohi, sdivrem, udivrem 132 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisInt<0> 133]>; 134def SDTIntScaledBinOp : SDTypeProfile<1, 3, [ // smulfix, sdivfix, etc 135 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>, SDTCisInt<3> 136]>; 137 138def SDTFPBinOp : SDTypeProfile<1, 2, [ // fadd, fmul, etc. 139 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisFP<0> 140]>; 141def SDTFPSignOp : SDTypeProfile<1, 2, [ // fcopysign. 142 SDTCisSameAs<0, 1>, SDTCisFP<0>, SDTCisFP<2> 143]>; 144def SDTFPTernaryOp : SDTypeProfile<1, 3, [ // fmadd, fnmsub, etc. 145 SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisFP<0> 146]>; 147def SDTIntUnaryOp : SDTypeProfile<1, 1, [ // bitreverse 148 SDTCisSameAs<0, 1>, SDTCisInt<0> 149]>; 150def SDTIntBitCountUnaryOp : SDTypeProfile<1, 1, [ // ctlz, cttz 151 SDTCisInt<0>, SDTCisInt<1> 152]>; 153def SDTIntExtendOp : SDTypeProfile<1, 1, [ // sext, zext, anyext 154 SDTCisInt<0>, SDTCisInt<1>, SDTCisOpSmallerThanOp<1, 0>, SDTCisSameNumEltsAs<0, 1> 155]>; 156def SDTIntTruncOp : SDTypeProfile<1, 1, [ // trunc 157 SDTCisInt<0>, SDTCisInt<1>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1> 158]>; 159def SDTFPUnaryOp : SDTypeProfile<1, 1, [ // fneg, fsqrt, etc 160 SDTCisSameAs<0, 1>, SDTCisFP<0> 161]>; 162def SDTFPRoundOp : SDTypeProfile<1, 1, [ // fpround 163 SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1> 164]>; 165def SDTFPTruncRoundOp : SDTypeProfile<1, 2, [ 166 SDTCisFP<0>, SDTCisFP<1>, SDTCisInt<2>, SDTCisOpSmallerThanOp<0, 1>, SDTCisSameNumEltsAs<0, 1> 167]>; 168def SDTFPExtendOp : SDTypeProfile<1, 1, [ // fpextend 169 SDTCisFP<0>, SDTCisFP<1>, SDTCisOpSmallerThanOp<1, 0>, SDTCisSameNumEltsAs<0, 1> 170]>; 171def SDIsFPClassOp : SDTypeProfile<1, 2, [ // is_fpclass 172 SDTCisInt<0>, SDTCisFP<1>, SDTCisInt<2>, SDTCisSameNumEltsAs<0, 1> 173]>; 174def SDTIntToFPOp : SDTypeProfile<1, 1, [ // [su]int_to_fp 175 SDTCisFP<0>, SDTCisInt<1>, SDTCisSameNumEltsAs<0, 1> 176]>; 177def SDTFPToIntOp : SDTypeProfile<1, 1, [ // fp_to_[su]int 178 SDTCisInt<0>, SDTCisFP<1>, SDTCisSameNumEltsAs<0, 1> 179]>; 180def SDTFPToIntSatOp : SDTypeProfile<1, 2, [ // fp_to_[su]int_sat 181 SDTCisInt<0>, SDTCisFP<1>, SDTCisSameNumEltsAs<0, 1>, SDTCisVT<2, OtherVT> 182]>; 183def SDTFPExpOp : SDTypeProfile<1, 2, [ // ldexp 184 SDTCisSameAs<0, 1>, SDTCisFP<0>, SDTCisInt<2> 185]>; 186def SDTGetFPStateOp : SDTypeProfile<1, 0, [ // get_fpenv, get_fpmode 187 SDTCisInt<0> 188]>; 189def SDTSetFPStateOp : SDTypeProfile<0, 1, [ // set_fpenv, set_fpmode 190 SDTCisInt<0> 191]>; 192def SDTExtInreg : SDTypeProfile<1, 2, [ // sext_inreg 193 SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisVT<2, OtherVT>, 194 SDTCisVTSmallerThanOp<2, 1> 195]>; 196def SDTExtInvec : SDTypeProfile<1, 1, [ // sext_invec 197 SDTCisInt<0>, SDTCisVec<0>, SDTCisInt<1>, SDTCisVec<1>, 198 SDTCisOpSmallerThanOp<1, 0> 199]>; 200def SDTFreeze : SDTypeProfile<1, 1, [ 201 SDTCisSameAs<0, 1> 202]>; 203 204def SDTSetCC : SDTypeProfile<1, 3, [ // setcc 205 SDTCisInt<0>, SDTCisSameAs<1, 2>, SDTCisVT<3, OtherVT> 206]>; 207 208def SDTSelect : SDTypeProfile<1, 3, [ // select 209 SDTCisInt<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3> 210]>; 211 212def SDTVSelect : SDTypeProfile<1, 3, [ // vselect 213 SDTCisVec<0>, SDTCisInt<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<2, 3>, SDTCisSameNumEltsAs<0, 1> 214]>; 215 216def SDTSelectCC : SDTypeProfile<1, 5, [ // select_cc 217 SDTCisSameAs<1, 2>, SDTCisSameAs<3, 4>, SDTCisSameAs<0, 3>, 218 SDTCisVT<5, OtherVT> 219]>; 220 221def SDTBr : SDTypeProfile<0, 1, [ // br 222 SDTCisVT<0, OtherVT> 223]>; 224 225def SDTBrCC : SDTypeProfile<0, 4, [ // brcc 226 SDTCisVT<0, OtherVT>, SDTCisSameAs<1, 2>, SDTCisVT<3, OtherVT> 227]>; 228 229def SDTBrcond : SDTypeProfile<0, 2, [ // brcond 230 SDTCisInt<0>, SDTCisVT<1, OtherVT> 231]>; 232 233def SDTBrind : SDTypeProfile<0, 1, [ // brind 234 SDTCisPtrTy<0> 235]>; 236 237def SDTCatchret : SDTypeProfile<0, 2, [ // catchret 238 SDTCisVT<0, OtherVT>, SDTCisVT<1, OtherVT> 239]>; 240 241def SDTCleanupret : SDTypeProfile<0, 1, [ // cleanupret 242 SDTCisVT<0, OtherVT> 243]>; 244 245def SDTNone : SDTypeProfile<0, 0, []>; // ret, trap 246 247def SDTUBSANTrap : SDTypeProfile<0, 1, []>; // ubsantrap 248 249def SDTLoad : SDTypeProfile<1, 1, [ // load 250 SDTCisPtrTy<1> 251]>; 252 253def SDTStore : SDTypeProfile<0, 2, [ // store 254 SDTCisPtrTy<1> 255]>; 256 257def SDTIStore : SDTypeProfile<1, 3, [ // indexed store 258 SDTCisSameAs<0, 2>, SDTCisPtrTy<0>, SDTCisPtrTy<3> 259]>; 260 261def SDTMaskedStore: SDTypeProfile<0, 4, [ // masked store 262 SDTCisVec<0>, SDTCisPtrTy<1>, SDTCisPtrTy<2>, SDTCisVec<3>, SDTCisSameNumEltsAs<0, 3> 263]>; 264 265def SDTMaskedLoad: SDTypeProfile<1, 4, [ // masked load 266 SDTCisVec<0>, SDTCisPtrTy<1>, SDTCisPtrTy<2>, SDTCisVec<3>, SDTCisSameAs<0, 4>, 267 SDTCisSameNumEltsAs<0, 3> 268]>; 269 270def SDTMaskedGather : SDTypeProfile<1, 4, [ 271 SDTCisVec<0>, SDTCisSameAs<0, 1>, SDTCisVec<2>, SDTCisPtrTy<3>, SDTCisVec<4>, 272 SDTCisSameNumEltsAs<0, 2>, SDTCisSameNumEltsAs<0, 4> 273]>; 274 275def SDTMaskedScatter : SDTypeProfile<0, 4, [ 276 SDTCisVec<0>, SDTCisVec<1>, SDTCisPtrTy<2>, SDTCisVec<3>, 277 SDTCisSameNumEltsAs<0, 1>, SDTCisSameNumEltsAs<0, 3> 278]>; 279 280def SDTVectorCompress : SDTypeProfile<1, 3, [ 281 SDTCisVec<0>, SDTCisSameAs<0, 1>, 282 SDTCisVec<2>, SDTCisSameNumEltsAs<1, 2>, 283 SDTCisSameAs<1, 3> 284]>; 285 286def SDTVecShuffle : SDTypeProfile<1, 2, [ 287 SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2> 288]>; 289def SDTVecSlice : SDTypeProfile<1, 3, [ // vector splice 290 SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisInt<3> 291]>; 292def SDTVecExtract : SDTypeProfile<1, 2, [ // vector extract 293 SDTCisEltOfVec<0, 1>, SDTCisPtrTy<2> 294]>; 295def SDTVecInsert : SDTypeProfile<1, 3, [ // vector insert 296 SDTCisEltOfVec<2, 1>, SDTCisSameAs<0, 1>, SDTCisPtrTy<3> 297]>; 298def SDTVecReduce : SDTypeProfile<1, 1, [ // vector reduction 299 SDTCisInt<0>, SDTCisVec<1> 300]>; 301def SDTFPVecReduce : SDTypeProfile<1, 1, [ // FP vector reduction 302 SDTCisFP<0>, SDTCisVec<1> 303]>; 304 305def SDTVecReverse : SDTypeProfile<1, 1, [ // vector reverse 306 SDTCisVec<0>, SDTCisSameAs<0,1> 307]>; 308 309def SDTSubVecExtract : SDTypeProfile<1, 2, [// subvector extract 310 SDTCisSubVecOfVec<0,1>, SDTCisInt<2> 311]>; 312def SDTSubVecInsert : SDTypeProfile<1, 3, [ // subvector insert 313 SDTCisSubVecOfVec<2, 1>, SDTCisSameAs<0,1>, SDTCisInt<3> 314]>; 315 316def SDTPrefetch : SDTypeProfile<0, 4, [ // prefetch 317 SDTCisPtrTy<0>, SDTCisSameAs<1, 2>, SDTCisSameAs<1, 3>, SDTCisInt<1> 318]>; 319 320def SDTAtomicFence : SDTypeProfile<0, 2, [ 321 SDTCisSameAs<0,1>, SDTCisPtrTy<0> 322]>; 323def SDTAtomic3 : SDTypeProfile<1, 3, [ 324 SDTCisSameAs<0,2>, SDTCisSameAs<0,3>, SDTCisInt<0>, SDTCisPtrTy<1> 325]>; 326def SDTAtomic2 : SDTypeProfile<1, 2, [ 327 SDTCisSameAs<0,2>, SDTCisInt<0>, SDTCisPtrTy<1> 328]>; 329 330def SDTFPAtomic2 : SDTypeProfile<1, 2, [ 331 SDTCisSameAs<0,2>, SDTCisFP<0>, SDTCisPtrTy<1> 332]>; 333 334def SDTAtomicStore : SDTypeProfile<0, 2, [ 335 SDTCisInt<0>, SDTCisPtrTy<1> 336]>; 337def SDTAtomicLoad : SDTypeProfile<1, 1, [ 338 SDTCisPtrTy<1> 339]>; 340 341class SDCallSeqStart<list<SDTypeConstraint> constraints> : 342 SDTypeProfile<0, 2, constraints>; 343class SDCallSeqEnd<list<SDTypeConstraint> constraints> : 344 SDTypeProfile<0, 2, constraints>; 345 346//===----------------------------------------------------------------------===// 347// Selection DAG Node definitions. 348// 349class SDNode<string opcode, SDTypeProfile typeprof, 350 list<SDNodeProperty> props = [], string sdclass = "SDNode"> 351 : SDPatternOperator { 352 string Opcode = opcode; 353 string SDClass = sdclass; 354 let Properties = props; 355 SDTypeProfile TypeProfile = typeprof; 356 bit IsStrictFP = false; 357 bits<32> TSFlags = 0; 358} 359 360// Special TableGen-recognized dag nodes 361def set; 362def implicit; 363def node; 364def srcvalue; 365 366def imm : SDNode<"ISD::Constant" , SDTIntLeaf , [], "ConstantSDNode">; 367def timm : SDNode<"ISD::TargetConstant",SDTIntLeaf, [], "ConstantSDNode">; 368def fpimm : SDNode<"ISD::ConstantFP", SDTFPLeaf , [], "ConstantFPSDNode">; 369def vt : SDNode<"ISD::VALUETYPE" , SDTOther , [], "VTSDNode">; 370def bb : SDNode<"ISD::BasicBlock", SDTOther , [], "BasicBlockSDNode">; 371def cond : SDNode<"ISD::CONDCODE" , SDTOther , [], "CondCodeSDNode">; 372def undef : SDNode<"ISD::UNDEF" , SDTUNDEF , []>; 373def vscale : SDNode<"ISD::VSCALE" , SDTIntUnaryOp, []>; 374def globaladdr : SDNode<"ISD::GlobalAddress", SDTPtrLeaf, [], 375 "GlobalAddressSDNode">; 376def tglobaladdr : SDNode<"ISD::TargetGlobalAddress", SDTPtrLeaf, [], 377 "GlobalAddressSDNode">; 378def globaltlsaddr : SDNode<"ISD::GlobalTLSAddress", SDTPtrLeaf, [], 379 "GlobalAddressSDNode">; 380def tglobaltlsaddr : SDNode<"ISD::TargetGlobalTLSAddress", SDTPtrLeaf, [], 381 "GlobalAddressSDNode">; 382def constpool : SDNode<"ISD::ConstantPool", SDTPtrLeaf, [], 383 "ConstantPoolSDNode">; 384def tconstpool : SDNode<"ISD::TargetConstantPool", SDTPtrLeaf, [], 385 "ConstantPoolSDNode">; 386def jumptable : SDNode<"ISD::JumpTable", SDTPtrLeaf, [], 387 "JumpTableSDNode">; 388def tjumptable : SDNode<"ISD::TargetJumpTable", SDTPtrLeaf, [], 389 "JumpTableSDNode">; 390def frameindex : SDNode<"ISD::FrameIndex", SDTPtrLeaf, [], 391 "FrameIndexSDNode">; 392def tframeindex : SDNode<"ISD::TargetFrameIndex", SDTPtrLeaf, [], 393 "FrameIndexSDNode">; 394def externalsym : SDNode<"ISD::ExternalSymbol", SDTPtrLeaf, [], 395 "ExternalSymbolSDNode">; 396def texternalsym: SDNode<"ISD::TargetExternalSymbol", SDTPtrLeaf, [], 397 "ExternalSymbolSDNode">; 398def mcsym: SDNode<"ISD::MCSymbol", SDTPtrLeaf, [], "MCSymbolSDNode">; 399def blockaddress : SDNode<"ISD::BlockAddress", SDTPtrLeaf, [], 400 "BlockAddressSDNode">; 401def tblockaddress: SDNode<"ISD::TargetBlockAddress", SDTPtrLeaf, [], 402 "BlockAddressSDNode">; 403 404def add : SDNode<"ISD::ADD" , SDTIntBinOp , 405 [SDNPCommutative, SDNPAssociative]>; 406def ptradd : SDNode<"ISD::ADD" , SDTPtrAddOp, []>; 407def sub : SDNode<"ISD::SUB" , SDTIntBinOp>; 408def mul : SDNode<"ISD::MUL" , SDTIntBinOp, 409 [SDNPCommutative, SDNPAssociative]>; 410def mulhs : SDNode<"ISD::MULHS" , SDTIntBinOp, [SDNPCommutative]>; 411def mulhu : SDNode<"ISD::MULHU" , SDTIntBinOp, [SDNPCommutative]>; 412def avgfloors : SDNode<"ISD::AVGFLOORS" , SDTIntBinOp, [SDNPCommutative]>; 413def avgflooru : SDNode<"ISD::AVGFLOORU" , SDTIntBinOp, [SDNPCommutative]>; 414def avgceils : SDNode<"ISD::AVGCEILS" , SDTIntBinOp, [SDNPCommutative]>; 415def avgceilu : SDNode<"ISD::AVGCEILU" , SDTIntBinOp, [SDNPCommutative]>; 416def abds : SDNode<"ISD::ABDS" , SDTIntBinOp, [SDNPCommutative]>; 417def abdu : SDNode<"ISD::ABDU" , SDTIntBinOp, [SDNPCommutative]>; 418def smullohi : SDNode<"ISD::SMUL_LOHI" , SDTIntBinHiLoOp, [SDNPCommutative]>; 419def umullohi : SDNode<"ISD::UMUL_LOHI" , SDTIntBinHiLoOp, [SDNPCommutative]>; 420def sdiv : SDNode<"ISD::SDIV" , SDTIntBinOp>; 421def udiv : SDNode<"ISD::UDIV" , SDTIntBinOp>; 422def srem : SDNode<"ISD::SREM" , SDTIntBinOp>; 423def urem : SDNode<"ISD::UREM" , SDTIntBinOp>; 424def sdivrem : SDNode<"ISD::SDIVREM" , SDTIntBinHiLoOp>; 425def udivrem : SDNode<"ISD::UDIVREM" , SDTIntBinHiLoOp>; 426def srl : SDNode<"ISD::SRL" , SDTIntShiftOp>; 427def sra : SDNode<"ISD::SRA" , SDTIntShiftOp>; 428def shl : SDNode<"ISD::SHL" , SDTIntShiftOp>; 429def rotl : SDNode<"ISD::ROTL" , SDTIntShiftOp>; 430def rotr : SDNode<"ISD::ROTR" , SDTIntShiftOp>; 431def shl_parts : SDNode<"ISD::SHL_PARTS" , SDTIntShiftPairOp>; 432def sra_parts : SDNode<"ISD::SRA_PARTS" , SDTIntShiftPairOp>; 433def srl_parts : SDNode<"ISD::SRL_PARTS" , SDTIntShiftPairOp>; 434def fshl : SDNode<"ISD::FSHL" , SDTIntShiftDOp>; 435def fshr : SDNode<"ISD::FSHR" , SDTIntShiftDOp>; 436def and : SDNode<"ISD::AND" , SDTIntBinOp, 437 [SDNPCommutative, SDNPAssociative]>; 438def or : SDNode<"ISD::OR" , SDTIntBinOp, 439 [SDNPCommutative, SDNPAssociative]>; 440def xor : SDNode<"ISD::XOR" , SDTIntBinOp, 441 [SDNPCommutative, SDNPAssociative]>; 442def addc : SDNode<"ISD::ADDC" , SDTIntBinOp, 443 [SDNPCommutative, SDNPOutGlue]>; 444def adde : SDNode<"ISD::ADDE" , SDTIntBinOp, 445 [SDNPCommutative, SDNPOutGlue, SDNPInGlue]>; 446def subc : SDNode<"ISD::SUBC" , SDTIntBinOp, 447 [SDNPOutGlue]>; 448def sube : SDNode<"ISD::SUBE" , SDTIntBinOp, 449 [SDNPOutGlue, SDNPInGlue]>; 450def smin : SDNode<"ISD::SMIN" , SDTIntBinOp, 451 [SDNPCommutative, SDNPAssociative]>; 452def smax : SDNode<"ISD::SMAX" , SDTIntBinOp, 453 [SDNPCommutative, SDNPAssociative]>; 454def umin : SDNode<"ISD::UMIN" , SDTIntBinOp, 455 [SDNPCommutative, SDNPAssociative]>; 456def umax : SDNode<"ISD::UMAX" , SDTIntBinOp, 457 [SDNPCommutative, SDNPAssociative]>; 458 459def scmp : SDNode<"ISD::SCMP" , SDTIntBinOp, 460 []>; 461def ucmp : SDNode<"ISD::UCMP" , SDTIntBinOp, 462 []>; 463 464def saddsat : SDNode<"ISD::SADDSAT" , SDTIntBinOp, [SDNPCommutative]>; 465def uaddsat : SDNode<"ISD::UADDSAT" , SDTIntBinOp, [SDNPCommutative]>; 466def ssubsat : SDNode<"ISD::SSUBSAT" , SDTIntBinOp>; 467def usubsat : SDNode<"ISD::USUBSAT" , SDTIntBinOp>; 468def sshlsat : SDNode<"ISD::SSHLSAT" , SDTIntBinOp>; 469def ushlsat : SDNode<"ISD::USHLSAT" , SDTIntBinOp>; 470 471def smulfix : SDNode<"ISD::SMULFIX" , SDTIntScaledBinOp, [SDNPCommutative]>; 472def smulfixsat : SDNode<"ISD::SMULFIXSAT", SDTIntScaledBinOp, [SDNPCommutative]>; 473def umulfix : SDNode<"ISD::UMULFIX" , SDTIntScaledBinOp, [SDNPCommutative]>; 474def umulfixsat : SDNode<"ISD::UMULFIXSAT", SDTIntScaledBinOp, [SDNPCommutative]>; 475def sdivfix : SDNode<"ISD::SDIVFIX" , SDTIntScaledBinOp>; 476def sdivfixsat : SDNode<"ISD::SDIVFIXSAT", SDTIntScaledBinOp>; 477def udivfix : SDNode<"ISD::UDIVFIX" , SDTIntScaledBinOp>; 478def udivfixsat : SDNode<"ISD::UDIVFIXSAT", SDTIntScaledBinOp>; 479 480def sext_inreg : SDNode<"ISD::SIGN_EXTEND_INREG", SDTExtInreg>; 481def sext_invec : SDNode<"ISD::SIGN_EXTEND_VECTOR_INREG", SDTExtInvec>; 482def zext_invec : SDNode<"ISD::ZERO_EXTEND_VECTOR_INREG", SDTExtInvec>; 483 484def abs : SDNode<"ISD::ABS" , SDTIntUnaryOp>; 485def bitreverse : SDNode<"ISD::BITREVERSE" , SDTIntUnaryOp>; 486def bswap : SDNode<"ISD::BSWAP" , SDTIntUnaryOp>; 487def ctlz : SDNode<"ISD::CTLZ" , SDTIntBitCountUnaryOp>; 488def cttz : SDNode<"ISD::CTTZ" , SDTIntBitCountUnaryOp>; 489def ctpop : SDNode<"ISD::CTPOP" , SDTIntBitCountUnaryOp>; 490def ctlz_zero_undef : SDNode<"ISD::CTLZ_ZERO_UNDEF", SDTIntBitCountUnaryOp>; 491def cttz_zero_undef : SDNode<"ISD::CTTZ_ZERO_UNDEF", SDTIntBitCountUnaryOp>; 492def sext : SDNode<"ISD::SIGN_EXTEND", SDTIntExtendOp>; 493def zext : SDNode<"ISD::ZERO_EXTEND", SDTIntExtendOp>; 494def anyext : SDNode<"ISD::ANY_EXTEND" , SDTIntExtendOp>; 495def trunc : SDNode<"ISD::TRUNCATE" , SDTIntTruncOp>; 496def truncssat_s : SDNode<"ISD::TRUNCATE_SSAT_S", SDTIntTruncOp>; 497def truncssat_u : SDNode<"ISD::TRUNCATE_SSAT_U", SDTIntTruncOp>; 498def truncusat_u : SDNode<"ISD::TRUNCATE_USAT_U", SDTIntTruncOp>; 499def bitconvert : SDNode<"ISD::BITCAST" , SDTUnaryOp>; 500def addrspacecast : SDNode<"ISD::ADDRSPACECAST", SDTUnaryOp>; 501def freeze : SDNode<"ISD::FREEZE" , SDTFreeze>; 502def extractelt : SDNode<"ISD::EXTRACT_VECTOR_ELT", SDTVecExtract>; 503def insertelt : SDNode<"ISD::INSERT_VECTOR_ELT", SDTVecInsert>; 504 505def vecreduce_add : SDNode<"ISD::VECREDUCE_ADD", SDTVecReduce>; 506def vecreduce_smax : SDNode<"ISD::VECREDUCE_SMAX", SDTVecReduce>; 507def vecreduce_umax : SDNode<"ISD::VECREDUCE_UMAX", SDTVecReduce>; 508def vecreduce_smin : SDNode<"ISD::VECREDUCE_SMIN", SDTVecReduce>; 509def vecreduce_umin : SDNode<"ISD::VECREDUCE_UMIN", SDTVecReduce>; 510def vecreduce_fadd : SDNode<"ISD::VECREDUCE_FADD", SDTFPVecReduce>; 511def vecreduce_fmin : SDNode<"ISD::VECREDUCE_FMIN", SDTFPVecReduce>; 512def vecreduce_fmax : SDNode<"ISD::VECREDUCE_FMAX", SDTFPVecReduce>; 513def vecreduce_fminimum : SDNode<"ISD::VECREDUCE_FMINIMUM", SDTFPVecReduce>; 514def vecreduce_fmaximum : SDNode<"ISD::VECREDUCE_FMAXIMUM", SDTFPVecReduce>; 515 516def fadd : SDNode<"ISD::FADD" , SDTFPBinOp, [SDNPCommutative]>; 517def fsub : SDNode<"ISD::FSUB" , SDTFPBinOp>; 518def fmul : SDNode<"ISD::FMUL" , SDTFPBinOp, [SDNPCommutative]>; 519def fdiv : SDNode<"ISD::FDIV" , SDTFPBinOp>; 520def frem : SDNode<"ISD::FREM" , SDTFPBinOp>; 521def fma : SDNode<"ISD::FMA" , SDTFPTernaryOp, [SDNPCommutative]>; 522def fmad : SDNode<"ISD::FMAD" , SDTFPTernaryOp, [SDNPCommutative]>; 523def fabs : SDNode<"ISD::FABS" , SDTFPUnaryOp>; 524def fminnum : SDNode<"ISD::FMINNUM" , SDTFPBinOp, 525 [SDNPCommutative, SDNPAssociative]>; 526def fmaxnum : SDNode<"ISD::FMAXNUM" , SDTFPBinOp, 527 [SDNPCommutative, SDNPAssociative]>; 528def fminnum_ieee : SDNode<"ISD::FMINNUM_IEEE", SDTFPBinOp, 529 [SDNPCommutative]>; 530def fmaxnum_ieee : SDNode<"ISD::FMAXNUM_IEEE", SDTFPBinOp, 531 [SDNPCommutative]>; 532def fminimum : SDNode<"ISD::FMINIMUM" , SDTFPBinOp, 533 [SDNPCommutative, SDNPAssociative]>; 534def fmaximum : SDNode<"ISD::FMAXIMUM" , SDTFPBinOp, 535 [SDNPCommutative, SDNPAssociative]>; 536def fminimumnum : SDNode<"ISD::FMINIMUMNUM" , SDTFPBinOp, 537 [SDNPCommutative, SDNPAssociative]>; 538def fmaximumnum : SDNode<"ISD::FMAXIMUMNUM" , SDTFPBinOp, 539 [SDNPCommutative, SDNPAssociative]>; 540def fgetsign : SDNode<"ISD::FGETSIGN" , SDTFPToIntOp>; 541def fcanonicalize : SDNode<"ISD::FCANONICALIZE", SDTFPUnaryOp>; 542def fneg : SDNode<"ISD::FNEG" , SDTFPUnaryOp>; 543def fsqrt : SDNode<"ISD::FSQRT" , SDTFPUnaryOp>; 544def fsin : SDNode<"ISD::FSIN" , SDTFPUnaryOp>; 545def fcos : SDNode<"ISD::FCOS" , SDTFPUnaryOp>; 546def ftan : SDNode<"ISD::FTAN" , SDTFPUnaryOp>; 547def fasin : SDNode<"ISD::FASIN" , SDTFPUnaryOp>; 548def facos : SDNode<"ISD::FACOS" , SDTFPUnaryOp>; 549def fatan : SDNode<"ISD::FATAN" , SDTFPUnaryOp>; 550def fatan2 : SDNode<"ISD::FATAN2" , SDTFPBinOp>; 551def fsinh : SDNode<"ISD::FSINH" , SDTFPUnaryOp>; 552def fcosh : SDNode<"ISD::FCOSH" , SDTFPUnaryOp>; 553def ftanh : SDNode<"ISD::FTANH" , SDTFPUnaryOp>; 554def fexp2 : SDNode<"ISD::FEXP2" , SDTFPUnaryOp>; 555def fexp10 : SDNode<"ISD::FEXP10" , SDTFPUnaryOp>; 556def fpow : SDNode<"ISD::FPOW" , SDTFPBinOp>; 557def flog2 : SDNode<"ISD::FLOG2" , SDTFPUnaryOp>; 558def fldexp : SDNode<"ISD::FLDEXP" , SDTFPExpOp>; 559def frint : SDNode<"ISD::FRINT" , SDTFPUnaryOp>; 560def ftrunc : SDNode<"ISD::FTRUNC" , SDTFPUnaryOp>; 561def fceil : SDNode<"ISD::FCEIL" , SDTFPUnaryOp>; 562def ffloor : SDNode<"ISD::FFLOOR" , SDTFPUnaryOp>; 563def fnearbyint : SDNode<"ISD::FNEARBYINT" , SDTFPUnaryOp>; 564def fround : SDNode<"ISD::FROUND" , SDTFPUnaryOp>; 565def froundeven : SDNode<"ISD::FROUNDEVEN" , SDTFPUnaryOp>; 566 567def lround : SDNode<"ISD::LROUND" , SDTFPToIntOp>; 568def llround : SDNode<"ISD::LLROUND" , SDTFPToIntOp>; 569def lrint : SDNode<"ISD::LRINT" , SDTFPToIntOp>; 570def llrint : SDNode<"ISD::LLRINT" , SDTFPToIntOp>; 571 572def fptrunc_round : SDNode<"ISD::FPTRUNC_ROUND", SDTFPTruncRoundOp>; 573 574def fpround : SDNode<"ISD::FP_ROUND" , SDTFPRoundOp>; 575def fpextend : SDNode<"ISD::FP_EXTEND" , SDTFPExtendOp>; 576def fcopysign : SDNode<"ISD::FCOPYSIGN" , SDTFPSignOp>; 577 578def is_fpclass : SDNode<"ISD::IS_FPCLASS" , SDIsFPClassOp>; 579 580def sint_to_fp : SDNode<"ISD::SINT_TO_FP" , SDTIntToFPOp>; 581def uint_to_fp : SDNode<"ISD::UINT_TO_FP" , SDTIntToFPOp>; 582def fp_to_sint : SDNode<"ISD::FP_TO_SINT" , SDTFPToIntOp>; 583def fp_to_uint : SDNode<"ISD::FP_TO_UINT" , SDTFPToIntOp>; 584def fp_to_sint_sat : SDNode<"ISD::FP_TO_SINT_SAT" , SDTFPToIntSatOp>; 585def fp_to_uint_sat : SDNode<"ISD::FP_TO_UINT_SAT" , SDTFPToIntSatOp>; 586def fp_to_sint_sat_gi : SDNode<"ISD::FP_TO_SINT_SAT" , SDTFPToIntOp>; 587def fp_to_uint_sat_gi : SDNode<"ISD::FP_TO_UINT_SAT" , SDTFPToIntOp>; 588def f16_to_fp : SDNode<"ISD::FP16_TO_FP" , SDTIntToFPOp>; 589def fp_to_f16 : SDNode<"ISD::FP_TO_FP16" , SDTFPToIntOp>; 590def bf16_to_fp : SDNode<"ISD::BF16_TO_FP" , SDTIntToFPOp>; 591def fp_to_bf16 : SDNode<"ISD::FP_TO_BF16" , SDTFPToIntOp>; 592 593def strict_fadd : SDNode<"ISD::STRICT_FADD", 594 SDTFPBinOp, [SDNPHasChain, SDNPCommutative]>; 595def strict_fsub : SDNode<"ISD::STRICT_FSUB", 596 SDTFPBinOp, [SDNPHasChain]>; 597def strict_fmul : SDNode<"ISD::STRICT_FMUL", 598 SDTFPBinOp, [SDNPHasChain, SDNPCommutative]>; 599def strict_fdiv : SDNode<"ISD::STRICT_FDIV", 600 SDTFPBinOp, [SDNPHasChain]>; 601def strict_frem : SDNode<"ISD::STRICT_FREM", 602 SDTFPBinOp, [SDNPHasChain]>; 603def strict_fma : SDNode<"ISD::STRICT_FMA", 604 SDTFPTernaryOp, [SDNPHasChain, SDNPCommutative]>; 605def strict_fsqrt : SDNode<"ISD::STRICT_FSQRT", 606 SDTFPUnaryOp, [SDNPHasChain]>; 607def strict_fsin : SDNode<"ISD::STRICT_FSIN", 608 SDTFPUnaryOp, [SDNPHasChain]>; 609def strict_fcos : SDNode<"ISD::STRICT_FCOS", 610 SDTFPUnaryOp, [SDNPHasChain]>; 611def strict_ftan : SDNode<"ISD::STRICT_FTAN", 612 SDTFPUnaryOp, [SDNPHasChain]>; 613def strict_fasin : SDNode<"ISD::STRICT_FASIN", 614 SDTFPUnaryOp, [SDNPHasChain]>; 615def strict_facos : SDNode<"ISD::STRICT_FACOS", 616 SDTFPUnaryOp, [SDNPHasChain]>; 617def strict_fatan : SDNode<"ISD::STRICT_FATAN", 618 SDTFPUnaryOp, [SDNPHasChain]>; 619def strict_fatan2 : SDNode<"ISD::STRICT_FATAN2", 620 SDTFPBinOp, [SDNPHasChain]>; 621def strict_fsinh : SDNode<"ISD::STRICT_FSINH", 622 SDTFPUnaryOp, [SDNPHasChain]>; 623def strict_fcosh : SDNode<"ISD::STRICT_FCOSH", 624 SDTFPUnaryOp, [SDNPHasChain]>; 625def strict_ftanh : SDNode<"ISD::STRICT_FTANH", 626 SDTFPUnaryOp, [SDNPHasChain]>; 627def strict_fexp2 : SDNode<"ISD::STRICT_FEXP2", 628 SDTFPUnaryOp, [SDNPHasChain]>; 629def strict_fpow : SDNode<"ISD::STRICT_FPOW", 630 SDTFPBinOp, [SDNPHasChain]>; 631def strict_fldexp : SDNode<"ISD::STRICT_FLDEXP", 632 SDTFPExpOp, [SDNPHasChain]>; 633def strict_flog2 : SDNode<"ISD::STRICT_FLOG2", 634 SDTFPUnaryOp, [SDNPHasChain]>; 635def strict_frint : SDNode<"ISD::STRICT_FRINT", 636 SDTFPUnaryOp, [SDNPHasChain]>; 637def strict_lrint : SDNode<"ISD::STRICT_LRINT", 638 SDTFPToIntOp, [SDNPHasChain]>; 639def strict_llrint : SDNode<"ISD::STRICT_LLRINT", 640 SDTFPToIntOp, [SDNPHasChain]>; 641def strict_fnearbyint : SDNode<"ISD::STRICT_FNEARBYINT", 642 SDTFPUnaryOp, [SDNPHasChain]>; 643def strict_fceil : SDNode<"ISD::STRICT_FCEIL", 644 SDTFPUnaryOp, [SDNPHasChain]>; 645def strict_ffloor : SDNode<"ISD::STRICT_FFLOOR", 646 SDTFPUnaryOp, [SDNPHasChain]>; 647def strict_lround : SDNode<"ISD::STRICT_LROUND", 648 SDTFPToIntOp, [SDNPHasChain]>; 649def strict_llround : SDNode<"ISD::STRICT_LLROUND", 650 SDTFPToIntOp, [SDNPHasChain]>; 651def strict_fround : SDNode<"ISD::STRICT_FROUND", 652 SDTFPUnaryOp, [SDNPHasChain]>; 653def strict_froundeven : SDNode<"ISD::STRICT_FROUNDEVEN", 654 SDTFPUnaryOp, [SDNPHasChain]>; 655def strict_ftrunc : SDNode<"ISD::STRICT_FTRUNC", 656 SDTFPUnaryOp, [SDNPHasChain]>; 657def strict_fminnum : SDNode<"ISD::STRICT_FMINNUM", 658 SDTFPBinOp, [SDNPHasChain, 659 SDNPCommutative, SDNPAssociative]>; 660def strict_fmaxnum : SDNode<"ISD::STRICT_FMAXNUM", 661 SDTFPBinOp, [SDNPHasChain, 662 SDNPCommutative, SDNPAssociative]>; 663def strict_fminimum : SDNode<"ISD::STRICT_FMINIMUM", 664 SDTFPBinOp, [SDNPHasChain, 665 SDNPCommutative, SDNPAssociative]>; 666def strict_fmaximum : SDNode<"ISD::STRICT_FMAXIMUM", 667 SDTFPBinOp, [SDNPHasChain, 668 SDNPCommutative, SDNPAssociative]>; 669def strict_fpround : SDNode<"ISD::STRICT_FP_ROUND", 670 SDTFPRoundOp, [SDNPHasChain]>; 671def strict_fpextend : SDNode<"ISD::STRICT_FP_EXTEND", 672 SDTFPExtendOp, [SDNPHasChain]>; 673def strict_fp_to_sint : SDNode<"ISD::STRICT_FP_TO_SINT", 674 SDTFPToIntOp, [SDNPHasChain]>; 675def strict_fp_to_uint : SDNode<"ISD::STRICT_FP_TO_UINT", 676 SDTFPToIntOp, [SDNPHasChain]>; 677def strict_sint_to_fp : SDNode<"ISD::STRICT_SINT_TO_FP", 678 SDTIntToFPOp, [SDNPHasChain]>; 679def strict_uint_to_fp : SDNode<"ISD::STRICT_UINT_TO_FP", 680 SDTIntToFPOp, [SDNPHasChain]>; 681 682def strict_f16_to_fp : SDNode<"ISD::STRICT_FP16_TO_FP", 683 SDTIntToFPOp, [SDNPHasChain]>; 684def strict_fp_to_f16 : SDNode<"ISD::STRICT_FP_TO_FP16", 685 SDTFPToIntOp, [SDNPHasChain]>; 686 687def strict_bf16_to_fp : SDNode<"ISD::STRICT_BF16_TO_FP", 688 SDTIntToFPOp, [SDNPHasChain]>; 689def strict_fp_to_bf16 : SDNode<"ISD::STRICT_FP_TO_BF16", 690 SDTFPToIntOp, [SDNPHasChain]>; 691 692def strict_fsetcc : SDNode<"ISD::STRICT_FSETCC", SDTSetCC, [SDNPHasChain]>; 693def strict_fsetccs : SDNode<"ISD::STRICT_FSETCCS", SDTSetCC, [SDNPHasChain]>; 694 695def get_fpenv : SDNode<"ISD::GET_FPENV", SDTGetFPStateOp, [SDNPHasChain]>; 696def set_fpenv : SDNode<"ISD::SET_FPENV", SDTSetFPStateOp, [SDNPHasChain]>; 697def reset_fpenv : SDNode<"ISD::RESET_FPENV", SDTNone, [SDNPHasChain]>; 698def get_fpmode : SDNode<"ISD::GET_FPMODE", SDTGetFPStateOp, [SDNPHasChain]>; 699def set_fpmode : SDNode<"ISD::SET_FPMODE", SDTSetFPStateOp, [SDNPHasChain]>; 700def reset_fpmode : SDNode<"ISD::RESET_FPMODE", SDTNone, [SDNPHasChain]>; 701 702def setcc : SDNode<"ISD::SETCC" , SDTSetCC>; 703def select : SDNode<"ISD::SELECT" , SDTSelect>; 704def vselect : SDNode<"ISD::VSELECT" , SDTVSelect>; 705def selectcc : SDNode<"ISD::SELECT_CC" , SDTSelectCC>; 706 707def brcc : SDNode<"ISD::BR_CC" , SDTBrCC, [SDNPHasChain]>; 708def brcond : SDNode<"ISD::BRCOND" , SDTBrcond, [SDNPHasChain]>; 709def brind : SDNode<"ISD::BRIND" , SDTBrind, [SDNPHasChain]>; 710def br : SDNode<"ISD::BR" , SDTBr, [SDNPHasChain]>; 711def catchret : SDNode<"ISD::CATCHRET" , SDTCatchret, 712 [SDNPHasChain, SDNPSideEffect]>; 713def cleanupret : SDNode<"ISD::CLEANUPRET" , SDTCleanupret, [SDNPHasChain]>; 714 715def trap : SDNode<"ISD::TRAP" , SDTNone, 716 [SDNPHasChain, SDNPSideEffect]>; 717def debugtrap : SDNode<"ISD::DEBUGTRAP" , SDTNone, 718 [SDNPHasChain, SDNPSideEffect]>; 719def ubsantrap : SDNode<"ISD::UBSANTRAP" , SDTUBSANTrap, 720 [SDNPHasChain, SDNPSideEffect]>; 721 722def prefetch : SDNode<"ISD::PREFETCH" , SDTPrefetch, 723 [SDNPHasChain, SDNPMayLoad, SDNPMayStore, 724 SDNPMemOperand]>; 725 726def readcyclecounter : SDNode<"ISD::READCYCLECOUNTER", SDTIntLeaf, 727 [SDNPHasChain, SDNPSideEffect]>; 728 729def readsteadycounter : SDNode<"ISD::READSTEADYCOUNTER", SDTIntLeaf, 730 [SDNPHasChain, SDNPSideEffect]>; 731 732def membarrier : SDNode<"ISD::MEMBARRIER", SDTNone, 733 [SDNPHasChain, SDNPSideEffect]>; 734 735def jump_table_debug_info : SDNode<"ISD::JUMP_TABLE_DEBUG_INFO", SDTNone, 736 [SDNPHasChain]>; 737 738def atomic_fence : SDNode<"ISD::ATOMIC_FENCE" , SDTAtomicFence, 739 [SDNPHasChain, SDNPSideEffect]>; 740 741def atomic_cmp_swap : SDNode<"ISD::ATOMIC_CMP_SWAP" , SDTAtomic3, 742 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 743def atomic_load_add : SDNode<"ISD::ATOMIC_LOAD_ADD" , SDTAtomic2, 744 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 745def atomic_swap : SDNode<"ISD::ATOMIC_SWAP", SDTAtomic2, 746 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 747def atomic_load_sub : SDNode<"ISD::ATOMIC_LOAD_SUB" , SDTAtomic2, 748 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 749def atomic_load_and : SDNode<"ISD::ATOMIC_LOAD_AND" , SDTAtomic2, 750 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 751def atomic_load_clr : SDNode<"ISD::ATOMIC_LOAD_CLR" , SDTAtomic2, 752 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 753def atomic_load_or : SDNode<"ISD::ATOMIC_LOAD_OR" , SDTAtomic2, 754 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 755def atomic_load_xor : SDNode<"ISD::ATOMIC_LOAD_XOR" , SDTAtomic2, 756 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 757def atomic_load_nand: SDNode<"ISD::ATOMIC_LOAD_NAND", SDTAtomic2, 758 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 759def atomic_load_min : SDNode<"ISD::ATOMIC_LOAD_MIN", SDTAtomic2, 760 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 761def atomic_load_max : SDNode<"ISD::ATOMIC_LOAD_MAX", SDTAtomic2, 762 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 763def atomic_load_umin : SDNode<"ISD::ATOMIC_LOAD_UMIN", SDTAtomic2, 764 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 765def atomic_load_umax : SDNode<"ISD::ATOMIC_LOAD_UMAX", SDTAtomic2, 766 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 767def atomic_load_fadd : SDNode<"ISD::ATOMIC_LOAD_FADD" , SDTFPAtomic2, 768 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 769def atomic_load_fsub : SDNode<"ISD::ATOMIC_LOAD_FSUB" , SDTFPAtomic2, 770 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 771def atomic_load_fmax : SDNode<"ISD::ATOMIC_LOAD_FMAX", SDTFPAtomic2, 772 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 773def atomic_load_fmin : SDNode<"ISD::ATOMIC_LOAD_FMIN", SDTFPAtomic2, 774 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 775def atomic_load_uinc_wrap : SDNode<"ISD::ATOMIC_LOAD_UINC_WRAP", SDTAtomic2, 776 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 777def atomic_load_udec_wrap : SDNode<"ISD::ATOMIC_LOAD_UDEC_WRAP", SDTAtomic2, 778 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 779def atomic_load_usub_cond : SDNode<"ISD::ATOMIC_LOAD_USUB_COND", SDTAtomic2, 780 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 781def atomic_load_usub_sat : SDNode<"ISD::ATOMIC_LOAD_USUB_SAT", SDTAtomic2, 782 [SDNPHasChain, SDNPMayStore, SDNPMayLoad, SDNPMemOperand]>; 783 784def atomic_load : SDNode<"ISD::ATOMIC_LOAD", SDTAtomicLoad, 785 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; 786def atomic_store : SDNode<"ISD::ATOMIC_STORE", SDTAtomicStore, 787 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; 788 789def masked_st : SDNode<"ISD::MSTORE", SDTMaskedStore, 790 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; 791def masked_ld : SDNode<"ISD::MLOAD", SDTMaskedLoad, 792 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; 793 794def masked_gather : SDNode<"ISD::MGATHER", SDTMaskedGather, 795 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; 796 797def masked_scatter : SDNode<"ISD::MSCATTER", SDTMaskedScatter, 798 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; 799 800def vector_compress : SDNode<"ISD::VECTOR_COMPRESS", SDTVectorCompress>; 801 802// Do not use ld, st directly. Use load, extload, sextload, zextload, store, 803// and truncst (see below). 804def ld : SDNode<"ISD::LOAD" , SDTLoad, 805 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; 806def st : SDNode<"ISD::STORE" , SDTStore, 807 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; 808def ist : SDNode<"ISD::STORE" , SDTIStore, 809 [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>; 810 811def vector_shuffle : SDNode<"ISD::VECTOR_SHUFFLE", SDTVecShuffle, []>; 812def vector_reverse : SDNode<"ISD::VECTOR_REVERSE", SDTVecReverse>; 813def vector_splice : SDNode<"ISD::VECTOR_SPLICE", SDTVecSlice, []>; 814def build_vector : SDNode<"ISD::BUILD_VECTOR", SDTypeProfile<1, -1, []>, []>; 815def splat_vector : SDNode<"ISD::SPLAT_VECTOR", SDTypeProfile<1, 1, []>, []>; 816def step_vector : SDNode<"ISD::STEP_VECTOR", SDTypeProfile<1, 1, 817 [SDTCisVec<0>, SDTCisInt<1>]>, []>; 818def scalar_to_vector : SDNode<"ISD::SCALAR_TO_VECTOR", SDTypeProfile<1, 1, []>, 819 []>; 820 821// vector_extract/vector_insert are deprecated. extractelt/insertelt 822// are preferred. 823def vector_extract : SDNode<"ISD::EXTRACT_VECTOR_ELT", 824 SDTypeProfile<1, 2, [SDTCisPtrTy<2>]>, []>; 825def vector_insert : SDNode<"ISD::INSERT_VECTOR_ELT", 826 SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, SDTCisPtrTy<3>]>, []>; 827def concat_vectors : SDNode<"ISD::CONCAT_VECTORS", 828 SDTypeProfile<1, 2, [SDTCisSubVecOfVec<1, 0>, SDTCisSameAs<1, 2>]>,[]>; 829 830// This operator does not do subvector type checking. The ARM 831// backend, at least, needs it. 832def vector_extract_subvec : SDNode<"ISD::EXTRACT_SUBVECTOR", 833 SDTypeProfile<1, 2, [SDTCisInt<2>, SDTCisVec<1>, SDTCisVec<0>]>, 834 []>; 835def vector_insert_subvec : SDNode<"ISD::INSERT_SUBVECTOR", 836 SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>, SDTCisVec<2>, SDTCisInt<3>]>, 837 []>; 838 839// This operator does subvector type checking. 840def extract_subvector : SDNode<"ISD::EXTRACT_SUBVECTOR", SDTSubVecExtract, []>; 841def insert_subvector : SDNode<"ISD::INSERT_SUBVECTOR", SDTSubVecInsert, []>; 842 843// Nodes for intrinsics, you should use the intrinsic itself and let tblgen use 844// these internally. Don't reference these directly. 845def intrinsic_void : SDNode<"ISD::INTRINSIC_VOID", 846 SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>, 847 [SDNPHasChain]>; 848def intrinsic_w_chain : SDNode<"ISD::INTRINSIC_W_CHAIN", 849 SDTypeProfile<1, -1, [SDTCisPtrTy<1>]>, 850 [SDNPHasChain]>; 851def intrinsic_wo_chain : SDNode<"ISD::INTRINSIC_WO_CHAIN", 852 SDTypeProfile<1, -1, [SDTCisPtrTy<1>]>, []>; 853 854def SDT_assert : SDTypeProfile<1, 1, 855 [SDTCisInt<0>, SDTCisInt<1>, SDTCisSameAs<1, 0>]>; 856def assertsext : SDNode<"ISD::AssertSext", SDT_assert>; 857def assertzext : SDNode<"ISD::AssertZext", SDT_assert>; 858def assertalign : SDNode<"ISD::AssertAlign", SDT_assert>; 859 860def convergencectrl_anchor : SDNode<"ISD::CONVERGENCECTRL_ANCHOR", 861 SDTypeProfile<1, 0, [SDTCisVT<0,untyped>]>>; 862def convergencectrl_entry : SDNode<"ISD::CONVERGENCECTRL_ENTRY", 863 SDTypeProfile<1, 0, [SDTCisVT<0,untyped>]>>; 864def convergencectrl_loop : SDNode<"ISD::CONVERGENCECTRL_LOOP", 865 SDTypeProfile<1, 1, 866 [SDTCisVT<0,untyped>, SDTCisVT<1,untyped>]>>; 867def convergencectrl_glue : SDNode<"ISD::CONVERGENCECTRL_GLUE", 868 SDTypeProfile<0, 1, [SDTCisVT<0, untyped>]>>; 869 870//===----------------------------------------------------------------------===// 871// Selection DAG Condition Codes 872 873class CondCode<string fcmpName = "", string icmpName = ""> { 874 string ICmpPredicate = icmpName; 875 string FCmpPredicate = fcmpName; 876} 877 878// ISD::CondCode enums, and mapping to CmpInst::Predicate names 879def SETOEQ : CondCode<"FCMP_OEQ">; 880def SETOGT : CondCode<"FCMP_OGT">; 881def SETOGE : CondCode<"FCMP_OGE">; 882def SETOLT : CondCode<"FCMP_OLT">; 883def SETOLE : CondCode<"FCMP_OLE">; 884def SETONE : CondCode<"FCMP_ONE">; 885def SETO : CondCode<"FCMP_ORD">; 886def SETUO : CondCode<"FCMP_UNO">; 887def SETUEQ : CondCode<"FCMP_UEQ">; 888def SETUGT : CondCode<"FCMP_UGT", "ICMP_UGT">; 889def SETUGE : CondCode<"FCMP_UGE", "ICMP_UGE">; 890def SETULT : CondCode<"FCMP_ULT", "ICMP_ULT">; 891def SETULE : CondCode<"FCMP_ULE", "ICMP_ULE">; 892def SETUNE : CondCode<"FCMP_UNE">; 893def SETEQ : CondCode<"", "ICMP_EQ">; 894def SETGT : CondCode<"", "ICMP_SGT">; 895def SETGE : CondCode<"", "ICMP_SGE">; 896def SETLT : CondCode<"", "ICMP_SLT">; 897def SETLE : CondCode<"", "ICMP_SLE">; 898def SETNE : CondCode<"", "ICMP_NE">; 899 900//===----------------------------------------------------------------------===// 901// Selection DAG Node Transformation Functions. 902// 903// This mechanism allows targets to manipulate nodes in the output DAG once a 904// match has been formed. This is typically used to manipulate immediate 905// values. 906// 907class SDNodeXForm<SDNode opc, code xformFunction> { 908 SDNode Opcode = opc; 909 code XFormFunction = xformFunction; 910} 911 912def NOOP_SDNodeXForm : SDNodeXForm<imm, [{}]>; 913 914//===----------------------------------------------------------------------===// 915// Selection DAG Pattern Fragments. 916// 917// Pattern fragments are reusable chunks of dags that match specific things. 918// They can take arguments and have C++ predicates that control whether they 919// match. They are intended to make the patterns for common instructions more 920// compact and readable. 921// 922 923/// PatFrags - Represents a set of pattern fragments. Each single fragment 924/// can match something on the DAG, from a single node to multiple nested other 925/// fragments. The whole set of fragments matches if any of the single 926/// fragments match. This allows e.g. matching and "add with overflow" and 927/// a regular "add" with the same fragment set. 928/// 929class PatFrags<dag ops, list<dag> frags, code pred = [{}], 930 SDNodeXForm xform = NOOP_SDNodeXForm> : SDPatternOperator { 931 dag Operands = ops; 932 list<dag> Fragments = frags; 933 code PredicateCode = pred; 934 code GISelPredicateCode = [{}]; 935 code ImmediateCode = [{}]; 936 SDNodeXForm OperandTransform = xform; 937 938 // When this is set, the PredicateCode may refer to a constant Operands 939 // vector which contains the captured nodes of the DAG, in the order listed 940 // by the Operands field above. 941 // 942 // This is useful when Fragments involves associative / commutative 943 // operators: a single piece of code can easily refer to all operands even 944 // when re-associated / commuted variants of the fragment are matched. 945 bit PredicateCodeUsesOperands = false; 946 947 // Define a few pre-packaged predicates. This helps GlobalISel import 948 // existing rules from SelectionDAG for many common cases. 949 // They will be tested prior to the code in pred and must not be used in 950 // ImmLeaf and its subclasses. 951 952 // If set to true, a predicate is added that checks for the absence of use of 953 // the first result. 954 bit HasNoUse = ?; 955 // If set to true, a predicate is added that checks for the sole use of 956 // the first result. 957 bit HasOneUse = ?; 958 959 // Is the desired pre-packaged predicate for a load? 960 bit IsLoad = ?; 961 // Is the desired pre-packaged predicate for a store? 962 bit IsStore = ?; 963 // Is the desired pre-packaged predicate for an atomic? 964 bit IsAtomic = ?; 965 966 // cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED; 967 // cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED; 968 bit IsUnindexed = ?; 969 970 // cast<LoadSDNode>(N)->getExtensionType() != ISD::NON_EXTLOAD 971 bit IsNonExtLoad = ?; 972 // cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD; 973 bit IsAnyExtLoad = ?; 974 // cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD; 975 bit IsSignExtLoad = ?; 976 // cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD; 977 bit IsZeroExtLoad = ?; 978 // !cast<StoreSDNode>(N)->isTruncatingStore(); 979 // cast<StoreSDNode>(N)->isTruncatingStore(); 980 bit IsTruncStore = ?; 981 982 // cast<MemSDNode>(N)->getAddressSpace() == 983 // If this empty, accept any address space. 984 list<int> AddressSpaces = ?; 985 986 // cast<MemSDNode>(N)->getAlign() >= 987 // If this is empty, accept any alignment. 988 int MinAlignment = ?; 989 990 // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::Monotonic 991 bit IsAtomicOrderingMonotonic = ?; 992 // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::Acquire 993 bit IsAtomicOrderingAcquire = ?; 994 // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::Release 995 bit IsAtomicOrderingRelease = ?; 996 // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::AcquireRelease 997 bit IsAtomicOrderingAcquireRelease = ?; 998 // cast<AtomicSDNode>(N)->getOrdering() == AtomicOrdering::SequentiallyConsistent 999 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. 1019class GISelFlags { 1020 bit GIIgnoreCopies = ?; 1021} 1022 1023// PatFrag - A version of PatFrags matching only a single fragment. 1024class 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. 1031class 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. 1036class 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. 1053class 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. 1068class 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. 1078class 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. 1088class 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 1096def vtInt : PatLeaf<(vt), [{ return N->getVT().isInteger(); }]>; 1097def 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. 1104def immAllOnesV : SDPatternOperator; // ISD::isConstantSplatVectorAllOnes 1105def immAllZerosV : SDPatternOperator; // ISD::isConstantSplatVectorAllZeros 1106 1107// Other helper fragments. 1108def not : PatFrag<(ops node:$in), (xor node:$in, -1)>; 1109def vnot : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV)>; 1110def ineg : PatFrag<(ops node:$in), (sub 0, node:$in)>; 1111 1112def zanyext : PatFrags<(ops node:$op), 1113 [(zext node:$op), 1114 (anyext node:$op)]>; 1115 1116def zext_nneg : PatFrag<(ops node:$src), (zext node:$src), [{ 1117 return N->getFlags().hasNonNeg(); 1118}]>; 1119def 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. 1128def null_frag : SDPatternOperator; 1129 1130// load fragments. 1131def unindexedload : PatFrag<(ops node:$ptr), (ld node:$ptr)> { 1132 let IsLoad = true; 1133 let IsUnindexed = true; 1134} 1135def load : PatFrag<(ops node:$ptr), (unindexedload node:$ptr)> { 1136 let IsLoad = true; 1137 let IsNonExtLoad = true; 1138} 1139 1140// extending load fragments. 1141def extload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr)> { 1142 let IsLoad = true; 1143 let IsAnyExtLoad = true; 1144} 1145def sextload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr)> { 1146 let IsLoad = true; 1147 let IsSignExtLoad = true; 1148} 1149def zextload : PatFrag<(ops node:$ptr), (unindexedload node:$ptr)> { 1150 let IsLoad = true; 1151 let IsZeroExtLoad = true; 1152} 1153 1154def extloadi1 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1155 let IsLoad = true; 1156 let MemoryVT = i1; 1157} 1158def extloadi8 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1159 let IsLoad = true; 1160 let MemoryVT = i8; 1161} 1162def extloadi16 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1163 let IsLoad = true; 1164 let MemoryVT = i16; 1165} 1166def extloadi32 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1167 let IsLoad = true; 1168 let MemoryVT = i32; 1169} 1170def extloadi64 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1171 let IsLoad = true; 1172 let MemoryVT = i64; 1173} 1174def extloadf16 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1175 let IsLoad = true; 1176 let MemoryVT = f16; 1177} 1178def extloadf32 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1179 let IsLoad = true; 1180 let MemoryVT = f32; 1181} 1182def extloadf64 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1183 let IsLoad = true; 1184 let MemoryVT = f64; 1185} 1186 1187def sextloadi1 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1188 let IsLoad = true; 1189 let MemoryVT = i1; 1190} 1191def sextloadi8 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1192 let IsLoad = true; 1193 let MemoryVT = i8; 1194} 1195def sextloadi16 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1196 let IsLoad = true; 1197 let MemoryVT = i16; 1198} 1199def sextloadi32 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1200 let IsLoad = true; 1201 let MemoryVT = i32; 1202} 1203def sextloadi64 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1204 let IsLoad = true; 1205 let MemoryVT = i64; 1206} 1207 1208def zextloadi1 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1209 let IsLoad = true; 1210 let MemoryVT = i1; 1211} 1212def zextloadi8 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1213 let IsLoad = true; 1214 let MemoryVT = i8; 1215} 1216def zextloadi16 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1217 let IsLoad = true; 1218 let MemoryVT = i16; 1219} 1220def zextloadi32 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1221 let IsLoad = true; 1222 let MemoryVT = i32; 1223} 1224def zextloadi64 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1225 let IsLoad = true; 1226 let MemoryVT = i64; 1227} 1228 1229def extloadvi1 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1230 let IsLoad = true; 1231 let ScalarMemoryVT = i1; 1232} 1233def extloadvi8 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1234 let IsLoad = true; 1235 let ScalarMemoryVT = i8; 1236} 1237def extloadvi16 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1238 let IsLoad = true; 1239 let ScalarMemoryVT = i16; 1240} 1241def extloadvi32 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1242 let IsLoad = true; 1243 let ScalarMemoryVT = i32; 1244} 1245def extloadvf16 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1246 let IsLoad = true; 1247 let ScalarMemoryVT = f16; 1248} 1249def extloadvf32 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1250 let IsLoad = true; 1251 let ScalarMemoryVT = f32; 1252} 1253def extloadvf64 : PatFrag<(ops node:$ptr), (extload node:$ptr)> { 1254 let IsLoad = true; 1255 let ScalarMemoryVT = f64; 1256} 1257 1258def sextloadvi1 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1259 let IsLoad = true; 1260 let ScalarMemoryVT = i1; 1261} 1262def sextloadvi8 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1263 let IsLoad = true; 1264 let ScalarMemoryVT = i8; 1265} 1266def sextloadvi16 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1267 let IsLoad = true; 1268 let ScalarMemoryVT = i16; 1269} 1270def sextloadvi32 : PatFrag<(ops node:$ptr), (sextload node:$ptr)> { 1271 let IsLoad = true; 1272 let ScalarMemoryVT = i32; 1273} 1274 1275def zextloadvi1 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1276 let IsLoad = true; 1277 let ScalarMemoryVT = i1; 1278} 1279def zextloadvi8 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1280 let IsLoad = true; 1281 let ScalarMemoryVT = i8; 1282} 1283def zextloadvi16 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1284 let IsLoad = true; 1285 let ScalarMemoryVT = i16; 1286} 1287def zextloadvi32 : PatFrag<(ops node:$ptr), (zextload node:$ptr)> { 1288 let IsLoad = true; 1289 let ScalarMemoryVT = i32; 1290} 1291 1292// store fragments. 1293def unindexedstore : PatFrag<(ops node:$val, node:$ptr), 1294 (st node:$val, node:$ptr)> { 1295 let IsStore = true; 1296 let IsUnindexed = true; 1297} 1298def 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. 1305def truncstore : PatFrag<(ops node:$val, node:$ptr), 1306 (unindexedstore node:$val, node:$ptr)> { 1307 let IsStore = true; 1308 let IsTruncStore = true; 1309} 1310def 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} 1316def 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} 1322def 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} 1328def 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} 1334def truncstoref16 : PatFrag<(ops node:$val, node:$ptr), 1335 (truncstore node:$val, node:$ptr)> { 1336 let IsStore = true; 1337 let MemoryVT = f16; 1338} 1339def truncstoref32 : PatFrag<(ops node:$val, node:$ptr), 1340 (truncstore node:$val, node:$ptr)> { 1341 let IsStore = true; 1342 let MemoryVT = f32; 1343} 1344def truncstoref64 : PatFrag<(ops node:$val, node:$ptr), 1345 (truncstore node:$val, node:$ptr)> { 1346 let IsStore = true; 1347 let MemoryVT = f64; 1348} 1349 1350def truncstorevi8 : PatFrag<(ops node:$val, node:$ptr), 1351 (truncstore node:$val, node:$ptr)> { 1352 let IsStore = true; 1353 let ScalarMemoryVT = i8; 1354} 1355 1356def truncstorevi16 : PatFrag<(ops node:$val, node:$ptr), 1357 (truncstore node:$val, node:$ptr)> { 1358 let IsStore = true; 1359 let ScalarMemoryVT = i16; 1360} 1361 1362def 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. 1369def 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 1375def 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 1381def 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} 1386def 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}]>; 1391def 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} 1396def 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} 1401def 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} 1406def 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} 1411def 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} 1416def 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} 1421def 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 1427def 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 1433def 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}]>; 1438def 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} 1443def 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} 1448def 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} 1453def 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} 1458def 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} 1463def 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} 1468def 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 1475def 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) 1479def simple_load : PatFrag<(ops node:$ptr), 1480 (load node:$ptr), [{ 1481 return cast<LoadSDNode>(N)->isSimple(); 1482}]>; 1483def 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. 1489def nontemporalstore : PatFrag<(ops node:$val, node:$ptr), 1490 (store node:$val, node:$ptr), [{ 1491 return cast<StoreSDNode>(N)->isNonTemporal(); 1492}]>; 1493 1494def 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 1500def 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. 1507def nontemporalload : PatFrag<(ops node:$ptr), 1508 (load node:$ptr), [{ 1509 return cast<LoadSDNode>(N)->isNonTemporal(); 1510}]>; 1511 1512def 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. 1519def setoeq : PatFrag<(ops node:$lhs, node:$rhs), 1520 (setcc node:$lhs, node:$rhs, SETOEQ)>; 1521def setogt : PatFrag<(ops node:$lhs, node:$rhs), 1522 (setcc node:$lhs, node:$rhs, SETOGT)>; 1523def setoge : PatFrag<(ops node:$lhs, node:$rhs), 1524 (setcc node:$lhs, node:$rhs, SETOGE)>; 1525def setolt : PatFrag<(ops node:$lhs, node:$rhs), 1526 (setcc node:$lhs, node:$rhs, SETOLT)>; 1527def setole : PatFrag<(ops node:$lhs, node:$rhs), 1528 (setcc node:$lhs, node:$rhs, SETOLE)>; 1529def setone : PatFrag<(ops node:$lhs, node:$rhs), 1530 (setcc node:$lhs, node:$rhs, SETONE)>; 1531def seto : PatFrag<(ops node:$lhs, node:$rhs), 1532 (setcc node:$lhs, node:$rhs, SETO)>; 1533def setuo : PatFrag<(ops node:$lhs, node:$rhs), 1534 (setcc node:$lhs, node:$rhs, SETUO)>; 1535def setueq : PatFrag<(ops node:$lhs, node:$rhs), 1536 (setcc node:$lhs, node:$rhs, SETUEQ)>; 1537def setugt : PatFrag<(ops node:$lhs, node:$rhs), 1538 (setcc node:$lhs, node:$rhs, SETUGT)>; 1539def setuge : PatFrag<(ops node:$lhs, node:$rhs), 1540 (setcc node:$lhs, node:$rhs, SETUGE)>; 1541def setult : PatFrag<(ops node:$lhs, node:$rhs), 1542 (setcc node:$lhs, node:$rhs, SETULT)>; 1543def setule : PatFrag<(ops node:$lhs, node:$rhs), 1544 (setcc node:$lhs, node:$rhs, SETULE)>; 1545def setune : PatFrag<(ops node:$lhs, node:$rhs), 1546 (setcc node:$lhs, node:$rhs, SETUNE)>; 1547def seteq : PatFrag<(ops node:$lhs, node:$rhs), 1548 (setcc node:$lhs, node:$rhs, SETEQ)>; 1549def setgt : PatFrag<(ops node:$lhs, node:$rhs), 1550 (setcc node:$lhs, node:$rhs, SETGT)>; 1551def setge : PatFrag<(ops node:$lhs, node:$rhs), 1552 (setcc node:$lhs, node:$rhs, SETGE)>; 1553def setlt : PatFrag<(ops node:$lhs, node:$rhs), 1554 (setcc node:$lhs, node:$rhs, SETLT)>; 1555def setle : PatFrag<(ops node:$lhs, node:$rhs), 1556 (setcc node:$lhs, node:$rhs, SETLE)>; 1557def 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. 1562def strict_extloadf32 : PatFrag<(ops node:$ptr), 1563 (strict_fpextend (f32 (load node:$ptr)))>; 1564def 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 1568def any_fadd : PatFrags<(ops node:$lhs, node:$rhs), 1569 [(strict_fadd node:$lhs, node:$rhs), 1570 (fadd node:$lhs, node:$rhs)]>; 1571def any_fsub : PatFrags<(ops node:$lhs, node:$rhs), 1572 [(strict_fsub node:$lhs, node:$rhs), 1573 (fsub node:$lhs, node:$rhs)]>; 1574def any_fmul : PatFrags<(ops node:$lhs, node:$rhs), 1575 [(strict_fmul node:$lhs, node:$rhs), 1576 (fmul node:$lhs, node:$rhs)]>; 1577def any_fdiv : PatFrags<(ops node:$lhs, node:$rhs), 1578 [(strict_fdiv node:$lhs, node:$rhs), 1579 (fdiv node:$lhs, node:$rhs)]>; 1580def any_frem : PatFrags<(ops node:$lhs, node:$rhs), 1581 [(strict_frem node:$lhs, node:$rhs), 1582 (frem node:$lhs, node:$rhs)]>; 1583def 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)]>; 1586def any_fsqrt : PatFrags<(ops node:$src), 1587 [(strict_fsqrt node:$src), 1588 (fsqrt node:$src)]>; 1589def any_fsin : PatFrags<(ops node:$src), 1590 [(strict_fsin node:$src), 1591 (fsin node:$src)]>; 1592def any_fcos : PatFrags<(ops node:$src), 1593 [(strict_fcos node:$src), 1594 (fcos node:$src)]>; 1595def any_ftan : PatFrags<(ops node:$src), 1596 [(strict_ftan node:$src), 1597 (ftan node:$src)]>; 1598def any_fasin : PatFrags<(ops node:$src), 1599 [(strict_fasin node:$src), 1600 (fasin node:$src)]>; 1601def any_facos : PatFrags<(ops node:$src), 1602 [(strict_facos node:$src), 1603 (facos node:$src)]>; 1604def any_fatan : PatFrags<(ops node:$src), 1605 [(strict_fatan node:$src), 1606 (fatan node:$src)]>; 1607def any_fatan2 : PatFrags<(ops node:$src1, node:$src2), 1608 [(strict_fatan2 node:$src1, node:$src2), 1609 (fatan2 node:$src1, node:$src2)]>; 1610def any_fsinh : PatFrags<(ops node:$src), 1611 [(strict_fsinh node:$src), 1612 (fsinh node:$src)]>; 1613def any_fcosh : PatFrags<(ops node:$src), 1614 [(strict_fcosh node:$src), 1615 (fcosh node:$src)]>; 1616def any_ftanh : PatFrags<(ops node:$src), 1617 [(strict_ftanh node:$src), 1618 (ftanh node:$src)]>; 1619def any_fexp2 : PatFrags<(ops node:$src), 1620 [(strict_fexp2 node:$src), 1621 (fexp2 node:$src)]>; 1622def any_fpow : PatFrags<(ops node:$lhs, node:$rhs), 1623 [(strict_fpow node:$lhs, node:$rhs), 1624 (fpow node:$lhs, node:$rhs)]>; 1625def any_fldexp : PatFrags<(ops node:$lhs, node:$rhs), 1626 [(strict_fldexp node:$lhs, node:$rhs), 1627 (fldexp node:$lhs, node:$rhs)]>; 1628def any_flog2 : PatFrags<(ops node:$src), 1629 [(strict_flog2 node:$src), 1630 (flog2 node:$src)]>; 1631def any_frint : PatFrags<(ops node:$src), 1632 [(strict_frint node:$src), 1633 (frint node:$src)]>; 1634def any_lrint : PatFrags<(ops node:$src), 1635 [(strict_lrint node:$src), 1636 (lrint node:$src)]>; 1637def any_llrint : PatFrags<(ops node:$src), 1638 [(strict_llrint node:$src), 1639 (llrint node:$src)]>; 1640def any_fnearbyint : PatFrags<(ops node:$src), 1641 [(strict_fnearbyint node:$src), 1642 (fnearbyint node:$src)]>; 1643def any_fceil : PatFrags<(ops node:$src), 1644 [(strict_fceil node:$src), 1645 (fceil node:$src)]>; 1646def any_ffloor : PatFrags<(ops node:$src), 1647 [(strict_ffloor node:$src), 1648 (ffloor node:$src)]>; 1649def any_lround : PatFrags<(ops node:$src), 1650 [(strict_lround node:$src), 1651 (lround node:$src)]>; 1652def any_llround : PatFrags<(ops node:$src), 1653 [(strict_llround node:$src), 1654 (llround node:$src)]>; 1655def any_fround : PatFrags<(ops node:$src), 1656 [(strict_fround node:$src), 1657 (fround node:$src)]>; 1658def any_froundeven : PatFrags<(ops node:$src), 1659 [(strict_froundeven node:$src), 1660 (froundeven node:$src)]>; 1661def any_ftrunc : PatFrags<(ops node:$src), 1662 [(strict_ftrunc node:$src), 1663 (ftrunc node:$src)]>; 1664def any_fmaxnum : PatFrags<(ops node:$lhs, node:$rhs), 1665 [(strict_fmaxnum node:$lhs, node:$rhs), 1666 (fmaxnum node:$lhs, node:$rhs)]>; 1667def any_fminnum : PatFrags<(ops node:$lhs, node:$rhs), 1668 [(strict_fminnum node:$lhs, node:$rhs), 1669 (fminnum node:$lhs, node:$rhs)]>; 1670def any_fmaximum : PatFrags<(ops node:$lhs, node:$rhs), 1671 [(strict_fmaximum node:$lhs, node:$rhs), 1672 (fmaximum node:$lhs, node:$rhs)]>; 1673def any_fminimum : PatFrags<(ops node:$lhs, node:$rhs), 1674 [(strict_fminimum node:$lhs, node:$rhs), 1675 (fminimum node:$lhs, node:$rhs)]>; 1676def any_fpround : PatFrags<(ops node:$src), 1677 [(strict_fpround node:$src), 1678 (fpround node:$src)]>; 1679def any_fpextend : PatFrags<(ops node:$src), 1680 [(strict_fpextend node:$src), 1681 (fpextend node:$src)]>; 1682def any_extloadf32 : PatFrags<(ops node:$ptr), 1683 [(strict_extloadf32 node:$ptr), 1684 (extloadf32 node:$ptr)]>; 1685def any_extloadf64 : PatFrags<(ops node:$ptr), 1686 [(strict_extloadf64 node:$ptr), 1687 (extloadf64 node:$ptr)]>; 1688def any_fp_to_sint : PatFrags<(ops node:$src), 1689 [(strict_fp_to_sint node:$src), 1690 (fp_to_sint node:$src)]>; 1691def any_fp_to_uint : PatFrags<(ops node:$src), 1692 [(strict_fp_to_uint node:$src), 1693 (fp_to_uint node:$src)]>; 1694def any_sint_to_fp : PatFrags<(ops node:$src), 1695 [(strict_sint_to_fp node:$src), 1696 (sint_to_fp node:$src)]>; 1697def any_uint_to_fp : PatFrags<(ops node:$src), 1698 [(strict_uint_to_fp node:$src), 1699 (uint_to_fp node:$src)]>; 1700def 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)]>; 1703def 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 1707def any_f16_to_fp : PatFrags<(ops node:$src), 1708 [(f16_to_fp node:$src), 1709 (strict_f16_to_fp node:$src)]>; 1710def any_fp_to_f16 : PatFrags<(ops node:$src), 1711 [(fp_to_f16 node:$src), 1712 (strict_fp_to_f16 node:$src)]>; 1713def any_bf16_to_fp : PatFrags<(ops node:$src), 1714 [(bf16_to_fp node:$src), 1715 (strict_bf16_to_fp node:$src)]>; 1716def any_fp_to_bf16 : PatFrags<(ops node:$src), 1717 [(fp_to_bf16 node:$src), 1718 (strict_fp_to_bf16 node:$src)]>; 1719 1720multiclass 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 1748multiclass 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 1776multiclass 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 1788multiclass 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 1800multiclass 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 1812defm atomic_load_add : binary_atomic_op<atomic_load_add>; 1813defm atomic_swap : binary_atomic_op<atomic_swap>; 1814defm atomic_load_sub : binary_atomic_op<atomic_load_sub>; 1815defm atomic_load_and : binary_atomic_op<atomic_load_and>; 1816defm atomic_load_clr : binary_atomic_op<atomic_load_clr>; 1817defm atomic_load_or : binary_atomic_op<atomic_load_or>; 1818defm atomic_load_xor : binary_atomic_op<atomic_load_xor>; 1819defm atomic_load_nand : binary_atomic_op<atomic_load_nand>; 1820defm atomic_load_min : binary_atomic_op<atomic_load_min>; 1821defm atomic_load_max : binary_atomic_op<atomic_load_max>; 1822defm atomic_load_umin : binary_atomic_op<atomic_load_umin>; 1823defm atomic_load_umax : binary_atomic_op<atomic_load_umax>; 1824defm atomic_cmp_swap : ternary_atomic_op<atomic_cmp_swap>; 1825 1826/// Atomic load which zeroes the excess high bits. 1827def 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. 1834def 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 1840def atomic_load_8 : 1841 PatFrag<(ops node:$ptr), 1842 (atomic_load node:$ptr)> { 1843 let IsAtomic = true; 1844 let MemoryVT = i8; 1845} 1846 1847def atomic_load_16 : 1848 PatFrag<(ops node:$ptr), 1849 (atomic_load node:$ptr)> { 1850 let IsAtomic = true; 1851 let MemoryVT = i16; 1852} 1853 1854def atomic_load_32 : 1855 PatFrag<(ops node:$ptr), 1856 (atomic_load node:$ptr)> { 1857 let IsAtomic = true; 1858 let MemoryVT = i32; 1859} 1860def atomic_load_64 : 1861 PatFrag<(ops node:$ptr), 1862 (atomic_load node:$ptr)> { 1863 let IsAtomic = true; 1864 let MemoryVT = i64; 1865} 1866 1867def 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 1873def 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 1879def 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 1885def 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. 1892def 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. 1897def atomic_load_az_16 : PatFrags<(ops node:$op), 1898 [(atomic_load_16 node:$op), 1899 (atomic_load_zext_16 node:$op)]>; 1900 1901def 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. 1908def 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}]>; 1915def 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}]>; 1922def 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. 1931def 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}]>; 1938def 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}]>; 1945def 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. 1954def 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}]>; 1961def 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}]>; 1968def 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. 1977def 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)]>; 1981def 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)]>; 1985def 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 1990def 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. 1997def 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}]>; 2004def 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}]>; 2011def 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 2020def 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 2027def 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 2034def 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 2041def 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 2059class 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. 2069class 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// 2082class 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} 2100