1//===-- SystemZOperands.td - SystemZ instruction operands ----*- tblgen-*--===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10//===----------------------------------------------------------------------===// 11// Class definitions 12//===----------------------------------------------------------------------===// 13 14class ImmediateAsmOperand<string name> 15 : AsmOperandClass { 16 let Name = name; 17 let RenderMethod = "addImmOperands"; 18} 19class ImmediateTLSAsmOperand<string name> 20 : AsmOperandClass { 21 let Name = name; 22 let RenderMethod = "addImmTLSOperands"; 23} 24 25// Constructs both a DAG pattern and instruction operand for an immediate 26// of type VT. PRED returns true if a node is acceptable and XFORM returns 27// the operand value associated with the node. ASMOP is the name of the 28// associated asm operand, and also forms the basis of the asm print method. 29class Immediate<ValueType vt, code pred, SDNodeXForm xform, string asmop> 30 : PatLeaf<(vt imm), pred, xform>, Operand<vt> { 31 let PrintMethod = "print"##asmop##"Operand"; 32 let DecoderMethod = "decode"##asmop##"Operand"; 33 let ParserMatchClass = !cast<AsmOperandClass>(asmop); 34} 35 36// Constructs an asm operand for a PC-relative address. SIZE says how 37// many bits there are. 38class PCRelAsmOperand<string size> : ImmediateAsmOperand<"PCRel"##size> { 39 let PredicateMethod = "isImm"; 40 let ParserMethod = "parsePCRel"##size; 41} 42class PCRelTLSAsmOperand<string size> 43 : ImmediateTLSAsmOperand<"PCRelTLS"##size> { 44 let PredicateMethod = "isImmTLS"; 45 let ParserMethod = "parsePCRelTLS"##size; 46} 47 48// Constructs an operand for a PC-relative address with address type VT. 49// ASMOP is the associated asm operand. 50class PCRelOperand<ValueType vt, AsmOperandClass asmop> : Operand<vt> { 51 let PrintMethod = "printPCRelOperand"; 52 let ParserMatchClass = asmop; 53} 54class PCRelTLSOperand<ValueType vt, AsmOperandClass asmop> : Operand<vt> { 55 let PrintMethod = "printPCRelTLSOperand"; 56 let ParserMatchClass = asmop; 57} 58 59// Constructs both a DAG pattern and instruction operand for a PC-relative 60// address with address size VT. SELF is the name of the operand and 61// ASMOP is the associated asm operand. 62class PCRelAddress<ValueType vt, string self, AsmOperandClass asmop> 63 : ComplexPattern<vt, 1, "selectPCRelAddress", 64 [z_pcrel_wrapper, z_pcrel_offset]>, 65 PCRelOperand<vt, asmop> { 66 let MIOperandInfo = (ops !cast<Operand>(self)); 67} 68 69// Constructs an AsmOperandClass for addressing mode FORMAT, treating the 70// registers as having BITSIZE bits and displacements as having DISPSIZE bits. 71// LENGTH is "LenN" for addresses with an N-bit length field, otherwise it 72// is "". 73class AddressAsmOperand<string format, string bitsize, string dispsize, 74 string length = ""> 75 : AsmOperandClass { 76 let Name = format##bitsize##"Disp"##dispsize##length; 77 let ParserMethod = "parse"##format##bitsize; 78 let RenderMethod = "add"##format##"Operands"; 79} 80 81// Constructs an instruction operand for an addressing mode. FORMAT, 82// BITSIZE, DISPSIZE and LENGTH are the parameters to an associated 83// AddressAsmOperand. OPERANDS is a list of individual operands 84// (base register, displacement, etc.). 85class AddressOperand<string bitsize, string dispsize, string length, 86 string format, dag operands> 87 : Operand<!cast<ValueType>("i"##bitsize)> { 88 let PrintMethod = "print"##format##"Operand"; 89 let EncoderMethod = "get"##format##dispsize##length##"Encoding"; 90 let DecoderMethod = 91 "decode"##format##bitsize##"Disp"##dispsize##length##"Operand"; 92 let MIOperandInfo = operands; 93 let ParserMatchClass = 94 !cast<AddressAsmOperand>(format##bitsize##"Disp"##dispsize##length); 95} 96 97// Constructs both a DAG pattern and instruction operand for an addressing mode. 98// FORMAT, BITSIZE, DISPSIZE and LENGTH are the parameters to an associated 99// AddressAsmOperand. OPERANDS is a list of NUMOPS individual operands 100// (base register, displacement, etc.). SELTYPE is the type of the memory 101// operand for selection purposes; sometimes we want different selection 102// choices for the same underlying addressing mode. SUFFIX is similarly 103// a suffix appended to the displacement for selection purposes; 104// e.g. we want to reject small 20-bit displacements if a 12-bit form 105// also exists, but we want to accept them otherwise. 106class AddressingMode<string seltype, string bitsize, string dispsize, 107 string suffix, string length, int numops, string format, 108 dag operands> 109 : ComplexPattern<!cast<ValueType>("i"##bitsize), numops, 110 "select"##seltype##dispsize##suffix##length, 111 [add, sub, or, frameindex, z_adjdynalloc]>, 112 AddressOperand<bitsize, dispsize, length, format, operands>; 113 114// An addressing mode with a base and displacement but no index. 115class BDMode<string type, string bitsize, string dispsize, string suffix> 116 : AddressingMode<type, bitsize, dispsize, suffix, "", 2, "BDAddr", 117 (ops !cast<RegisterOperand>("ADDR"##bitsize), 118 !cast<Operand>("disp"##dispsize##"imm"##bitsize))>; 119 120// An addressing mode with a base, displacement and index. 121class BDXMode<string type, string bitsize, string dispsize, string suffix> 122 : AddressingMode<type, bitsize, dispsize, suffix, "", 3, "BDXAddr", 123 (ops !cast<RegisterOperand>("ADDR"##bitsize), 124 !cast<Operand>("disp"##dispsize##"imm"##bitsize), 125 !cast<RegisterOperand>("ADDR"##bitsize))>; 126 127// A BDMode paired with an immediate length operand of LENSIZE bits. 128class BDLMode<string type, string bitsize, string dispsize, string suffix, 129 string lensize> 130 : AddressingMode<type, bitsize, dispsize, suffix, "Len"##lensize, 3, 131 "BDLAddr", 132 (ops !cast<RegisterOperand>("ADDR"##bitsize), 133 !cast<Operand>("disp"##dispsize##"imm"##bitsize), 134 !cast<Operand>("imm"##bitsize))>; 135 136// A BDMode paired with a register length operand. 137class BDRMode<string type, string bitsize, string dispsize, string suffix> 138 : AddressingMode<type, bitsize, dispsize, suffix, "", 3, "BDRAddr", 139 (ops !cast<RegisterOperand>("ADDR"##bitsize), 140 !cast<Operand>("disp"##dispsize##"imm"##bitsize), 141 !cast<RegisterOperand>("GR"##bitsize))>; 142 143// An addressing mode with a base, displacement and a vector index. 144class BDVMode<string bitsize, string dispsize> 145 : AddressOperand<bitsize, dispsize, "", "BDVAddr", 146 (ops !cast<RegisterOperand>("ADDR"##bitsize), 147 !cast<Operand>("disp"##dispsize##"imm"##bitsize), 148 !cast<RegisterOperand>("VR128"))>; 149 150//===----------------------------------------------------------------------===// 151// Extracting immediate operands from nodes 152// These all create MVT::i64 nodes to ensure the value is not sign-extended 153// when converted from an SDNode to a MachineOperand later on. 154//===----------------------------------------------------------------------===// 155 156// Bits 0-15 (counting from the lsb). 157def LL16 : SDNodeXForm<imm, [{ 158 uint64_t Value = N->getZExtValue() & 0x000000000000FFFFULL; 159 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64); 160}]>; 161 162// Bits 16-31 (counting from the lsb). 163def LH16 : SDNodeXForm<imm, [{ 164 uint64_t Value = (N->getZExtValue() & 0x00000000FFFF0000ULL) >> 16; 165 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64); 166}]>; 167 168// Bits 32-47 (counting from the lsb). 169def HL16 : SDNodeXForm<imm, [{ 170 uint64_t Value = (N->getZExtValue() & 0x0000FFFF00000000ULL) >> 32; 171 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64); 172}]>; 173 174// Bits 48-63 (counting from the lsb). 175def HH16 : SDNodeXForm<imm, [{ 176 uint64_t Value = (N->getZExtValue() & 0xFFFF000000000000ULL) >> 48; 177 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64); 178}]>; 179 180// Low 32 bits. 181def LF32 : SDNodeXForm<imm, [{ 182 uint64_t Value = N->getZExtValue() & 0x00000000FFFFFFFFULL; 183 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64); 184}]>; 185 186// High 32 bits. 187def HF32 : SDNodeXForm<imm, [{ 188 uint64_t Value = N->getZExtValue() >> 32; 189 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64); 190}]>; 191 192// Truncate an immediate to a 8-bit signed quantity. 193def SIMM8 : SDNodeXForm<imm, [{ 194 return CurDAG->getTargetConstant(int8_t(N->getZExtValue()), SDLoc(N), 195 MVT::i64); 196}]>; 197 198// Truncate an immediate to a 8-bit unsigned quantity. 199def UIMM8 : SDNodeXForm<imm, [{ 200 return CurDAG->getTargetConstant(uint8_t(N->getZExtValue()), SDLoc(N), 201 MVT::i64); 202}]>; 203 204// Truncate an immediate to a 8-bit unsigned quantity and mask off low bit. 205def UIMM8EVEN : SDNodeXForm<imm, [{ 206 return CurDAG->getTargetConstant(N->getZExtValue() & 0xfe, SDLoc(N), 207 MVT::i64); 208}]>; 209 210// Truncate an immediate to a 12-bit unsigned quantity. 211def UIMM12 : SDNodeXForm<imm, [{ 212 return CurDAG->getTargetConstant(N->getZExtValue() & 0xfff, SDLoc(N), 213 MVT::i64); 214}]>; 215 216// Truncate an immediate to a 16-bit signed quantity. 217def SIMM16 : SDNodeXForm<imm, [{ 218 return CurDAG->getTargetConstant(int16_t(N->getZExtValue()), SDLoc(N), 219 MVT::i64); 220}]>; 221 222// Truncate an immediate to a 16-bit unsigned quantity. 223def UIMM16 : SDNodeXForm<imm, [{ 224 return CurDAG->getTargetConstant(uint16_t(N->getZExtValue()), SDLoc(N), 225 MVT::i64); 226}]>; 227 228// Truncate an immediate to a 32-bit signed quantity. 229def SIMM32 : SDNodeXForm<imm, [{ 230 return CurDAG->getTargetConstant(int32_t(N->getZExtValue()), SDLoc(N), 231 MVT::i64); 232}]>; 233 234// Truncate an immediate to a 32-bit unsigned quantity. 235def UIMM32 : SDNodeXForm<imm, [{ 236 return CurDAG->getTargetConstant(uint32_t(N->getZExtValue()), SDLoc(N), 237 MVT::i64); 238}]>; 239 240// Truncate an immediate to a 48-bit unsigned quantity. 241def UIMM48 : SDNodeXForm<imm, [{ 242 return CurDAG->getTargetConstant(uint64_t(N->getZExtValue()) & 0xffffffffffff, 243 SDLoc(N), MVT::i64); 244}]>; 245 246// Negate and then truncate an immediate to a 32-bit unsigned quantity. 247def NEGIMM32 : SDNodeXForm<imm, [{ 248 return CurDAG->getTargetConstant(uint32_t(-N->getZExtValue()), SDLoc(N), 249 MVT::i64); 250}]>; 251 252//===----------------------------------------------------------------------===// 253// Immediate asm operands. 254//===----------------------------------------------------------------------===// 255 256def U1Imm : ImmediateAsmOperand<"U1Imm">; 257def U2Imm : ImmediateAsmOperand<"U2Imm">; 258def U3Imm : ImmediateAsmOperand<"U3Imm">; 259def U4Imm : ImmediateAsmOperand<"U4Imm">; 260def U6Imm : ImmediateAsmOperand<"U6Imm">; 261def S8Imm : ImmediateAsmOperand<"S8Imm">; 262def U8Imm : ImmediateAsmOperand<"U8Imm">; 263def U12Imm : ImmediateAsmOperand<"U12Imm">; 264def S16Imm : ImmediateAsmOperand<"S16Imm">; 265def U16Imm : ImmediateAsmOperand<"U16Imm">; 266def S32Imm : ImmediateAsmOperand<"S32Imm">; 267def U32Imm : ImmediateAsmOperand<"U32Imm">; 268def U48Imm : ImmediateAsmOperand<"U48Imm">; 269 270//===----------------------------------------------------------------------===// 271// i32 immediates 272//===----------------------------------------------------------------------===// 273 274// Immediates for the lower and upper 16 bits of an i32, with the other 275// bits of the i32 being zero. 276def imm32ll16 : Immediate<i32, [{ 277 return SystemZ::isImmLL(N->getZExtValue()); 278}], LL16, "U16Imm">; 279 280def imm32lh16 : Immediate<i32, [{ 281 return SystemZ::isImmLH(N->getZExtValue()); 282}], LH16, "U16Imm">; 283 284// Immediates for the lower and upper 16 bits of an i32, with the other 285// bits of the i32 being one. 286def imm32ll16c : Immediate<i32, [{ 287 return SystemZ::isImmLL(uint32_t(~N->getZExtValue())); 288}], LL16, "U16Imm">; 289 290def imm32lh16c : Immediate<i32, [{ 291 return SystemZ::isImmLH(uint32_t(~N->getZExtValue())); 292}], LH16, "U16Imm">; 293 294// Short immediates 295def imm32zx1 : Immediate<i32, [{ 296 return isUInt<1>(N->getZExtValue()); 297}], NOOP_SDNodeXForm, "U1Imm">; 298 299def imm32zx2 : Immediate<i32, [{ 300 return isUInt<2>(N->getZExtValue()); 301}], NOOP_SDNodeXForm, "U2Imm">; 302 303def imm32zx3 : Immediate<i32, [{ 304 return isUInt<3>(N->getZExtValue()); 305}], NOOP_SDNodeXForm, "U3Imm">; 306 307def imm32zx4 : Immediate<i32, [{ 308 return isUInt<4>(N->getZExtValue()); 309}], NOOP_SDNodeXForm, "U4Imm">; 310 311// Note: this enforces an even value during code generation only. 312// When used from the assembler, any 4-bit value is allowed. 313def imm32zx4even : Immediate<i32, [{ 314 return isUInt<4>(N->getZExtValue()); 315}], UIMM8EVEN, "U4Imm">; 316 317def imm32zx6 : Immediate<i32, [{ 318 return isUInt<6>(N->getZExtValue()); 319}], NOOP_SDNodeXForm, "U6Imm">; 320 321def imm32sx8 : Immediate<i32, [{ 322 return isInt<8>(N->getSExtValue()); 323}], SIMM8, "S8Imm">; 324 325def imm32zx8 : Immediate<i32, [{ 326 return isUInt<8>(N->getZExtValue()); 327}], UIMM8, "U8Imm">; 328 329def imm32zx8trunc : Immediate<i32, [{}], UIMM8, "U8Imm">; 330 331def imm32zx12 : Immediate<i32, [{ 332 return isUInt<12>(N->getZExtValue()); 333}], UIMM12, "U12Imm">; 334 335def imm32sx16 : Immediate<i32, [{ 336 return isInt<16>(N->getSExtValue()); 337}], SIMM16, "S16Imm">; 338 339def imm32zx16 : Immediate<i32, [{ 340 return isUInt<16>(N->getZExtValue()); 341}], UIMM16, "U16Imm">; 342 343def imm32sx16trunc : Immediate<i32, [{}], SIMM16, "S16Imm">; 344 345// Full 32-bit immediates. we need both signed and unsigned versions 346// because the assembler is picky. E.g. AFI requires signed operands 347// while NILF requires unsigned ones. 348def simm32 : Immediate<i32, [{}], SIMM32, "S32Imm">; 349def uimm32 : Immediate<i32, [{}], UIMM32, "U32Imm">; 350 351def imm32 : ImmLeaf<i32, [{}]>; 352 353//===----------------------------------------------------------------------===// 354// 64-bit immediates 355//===----------------------------------------------------------------------===// 356 357// Immediates for 16-bit chunks of an i64, with the other bits of the 358// i32 being zero. 359def imm64ll16 : Immediate<i64, [{ 360 return SystemZ::isImmLL(N->getZExtValue()); 361}], LL16, "U16Imm">; 362 363def imm64lh16 : Immediate<i64, [{ 364 return SystemZ::isImmLH(N->getZExtValue()); 365}], LH16, "U16Imm">; 366 367def imm64hl16 : Immediate<i64, [{ 368 return SystemZ::isImmHL(N->getZExtValue()); 369}], HL16, "U16Imm">; 370 371def imm64hh16 : Immediate<i64, [{ 372 return SystemZ::isImmHH(N->getZExtValue()); 373}], HH16, "U16Imm">; 374 375// Immediates for 16-bit chunks of an i64, with the other bits of the 376// i32 being one. 377def imm64ll16c : Immediate<i64, [{ 378 return SystemZ::isImmLL(uint64_t(~N->getZExtValue())); 379}], LL16, "U16Imm">; 380 381def imm64lh16c : Immediate<i64, [{ 382 return SystemZ::isImmLH(uint64_t(~N->getZExtValue())); 383}], LH16, "U16Imm">; 384 385def imm64hl16c : Immediate<i64, [{ 386 return SystemZ::isImmHL(uint64_t(~N->getZExtValue())); 387}], HL16, "U16Imm">; 388 389def imm64hh16c : Immediate<i64, [{ 390 return SystemZ::isImmHH(uint64_t(~N->getZExtValue())); 391}], HH16, "U16Imm">; 392 393// Immediates for the lower and upper 32 bits of an i64, with the other 394// bits of the i32 being zero. 395def imm64lf32 : Immediate<i64, [{ 396 return SystemZ::isImmLF(N->getZExtValue()); 397}], LF32, "U32Imm">; 398 399def imm64hf32 : Immediate<i64, [{ 400 return SystemZ::isImmHF(N->getZExtValue()); 401}], HF32, "U32Imm">; 402 403// Immediates for the lower and upper 32 bits of an i64, with the other 404// bits of the i32 being one. 405def imm64lf32c : Immediate<i64, [{ 406 return SystemZ::isImmLF(uint64_t(~N->getZExtValue())); 407}], LF32, "U32Imm">; 408 409def imm64hf32c : Immediate<i64, [{ 410 return SystemZ::isImmHF(uint64_t(~N->getZExtValue())); 411}], HF32, "U32Imm">; 412 413// Short immediates. 414def imm64sx8 : Immediate<i64, [{ 415 return isInt<8>(N->getSExtValue()); 416}], SIMM8, "S8Imm">; 417 418def imm64zx8 : Immediate<i64, [{ 419 return isUInt<8>(N->getSExtValue()); 420}], UIMM8, "U8Imm">; 421 422def imm64sx16 : Immediate<i64, [{ 423 return isInt<16>(N->getSExtValue()); 424}], SIMM16, "S16Imm">; 425 426def imm64zx16 : Immediate<i64, [{ 427 return isUInt<16>(N->getZExtValue()); 428}], UIMM16, "U16Imm">; 429 430def imm64sx32 : Immediate<i64, [{ 431 return isInt<32>(N->getSExtValue()); 432}], SIMM32, "S32Imm">; 433 434def imm64zx32 : Immediate<i64, [{ 435 return isUInt<32>(N->getZExtValue()); 436}], UIMM32, "U32Imm">; 437 438def imm64zx32n : Immediate<i64, [{ 439 return isUInt<32>(-N->getSExtValue()); 440}], NEGIMM32, "U32Imm">; 441 442def imm64zx48 : Immediate<i64, [{ 443 return isUInt<64>(N->getZExtValue()); 444}], UIMM48, "U48Imm">; 445 446def imm64 : ImmLeaf<i64, [{}]>, Operand<i64>; 447 448//===----------------------------------------------------------------------===// 449// Floating-point immediates 450//===----------------------------------------------------------------------===// 451 452// Floating-point zero. 453def fpimm0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(+0.0); }]>; 454 455// Floating point negative zero. 456def fpimmneg0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(-0.0); }]>; 457 458//===----------------------------------------------------------------------===// 459// Symbolic address operands 460//===----------------------------------------------------------------------===// 461 462// PC-relative asm operands. 463def PCRel12 : PCRelAsmOperand<"12">; 464def PCRel16 : PCRelAsmOperand<"16">; 465def PCRel24 : PCRelAsmOperand<"24">; 466def PCRel32 : PCRelAsmOperand<"32">; 467def PCRelTLS16 : PCRelTLSAsmOperand<"16">; 468def PCRelTLS32 : PCRelTLSAsmOperand<"32">; 469 470// PC-relative offsets of a basic block. The offset is sign-extended 471// and multiplied by 2. 472def brtarget16 : PCRelOperand<OtherVT, PCRel16> { 473 let EncoderMethod = "getPC16DBLEncoding"; 474 let DecoderMethod = "decodePC16DBLBranchOperand"; 475} 476def brtarget32 : PCRelOperand<OtherVT, PCRel32> { 477 let EncoderMethod = "getPC32DBLEncoding"; 478 let DecoderMethod = "decodePC32DBLBranchOperand"; 479} 480 481// Variants of brtarget for use with branch prediction preload. 482def brtarget12bpp : PCRelOperand<OtherVT, PCRel12> { 483 let EncoderMethod = "getPC12DBLBPPEncoding"; 484 let DecoderMethod = "decodePC12DBLBranchOperand"; 485} 486def brtarget16bpp : PCRelOperand<OtherVT, PCRel16> { 487 let EncoderMethod = "getPC16DBLBPPEncoding"; 488 let DecoderMethod = "decodePC16DBLBranchOperand"; 489} 490def brtarget24bpp : PCRelOperand<OtherVT, PCRel24> { 491 let EncoderMethod = "getPC24DBLBPPEncoding"; 492 let DecoderMethod = "decodePC24DBLBranchOperand"; 493} 494 495// Variants of brtarget16/32 with an optional additional TLS symbol. 496// These are used to annotate calls to __tls_get_offset. 497def tlssym : Operand<i64> { } 498def brtarget16tls : PCRelTLSOperand<OtherVT, PCRelTLS16> { 499 let MIOperandInfo = (ops brtarget16:$func, tlssym:$sym); 500 let EncoderMethod = "getPC16DBLTLSEncoding"; 501 let DecoderMethod = "decodePC16DBLBranchOperand"; 502} 503def brtarget32tls : PCRelTLSOperand<OtherVT, PCRelTLS32> { 504 let MIOperandInfo = (ops brtarget32:$func, tlssym:$sym); 505 let EncoderMethod = "getPC32DBLTLSEncoding"; 506 let DecoderMethod = "decodePC32DBLBranchOperand"; 507} 508 509// A PC-relative offset of a global value. The offset is sign-extended 510// and multiplied by 2. 511def pcrel32 : PCRelAddress<i64, "pcrel32", PCRel32> { 512 let EncoderMethod = "getPC32DBLEncoding"; 513 let DecoderMethod = "decodePC32DBLOperand"; 514} 515 516//===----------------------------------------------------------------------===// 517// Addressing modes 518//===----------------------------------------------------------------------===// 519 520// 12-bit displacement operands. 521def disp12imm32 : Operand<i32>; 522def disp12imm64 : Operand<i64>; 523 524// 20-bit displacement operands. 525def disp20imm32 : Operand<i32>; 526def disp20imm64 : Operand<i64>; 527 528def BDAddr32Disp12 : AddressAsmOperand<"BDAddr", "32", "12">; 529def BDAddr32Disp20 : AddressAsmOperand<"BDAddr", "32", "20">; 530def BDAddr64Disp12 : AddressAsmOperand<"BDAddr", "64", "12">; 531def BDAddr64Disp20 : AddressAsmOperand<"BDAddr", "64", "20">; 532def BDXAddr64Disp12 : AddressAsmOperand<"BDXAddr", "64", "12">; 533def BDXAddr64Disp20 : AddressAsmOperand<"BDXAddr", "64", "20">; 534def BDLAddr64Disp12Len4 : AddressAsmOperand<"BDLAddr", "64", "12", "Len4">; 535def BDLAddr64Disp12Len8 : AddressAsmOperand<"BDLAddr", "64", "12", "Len8">; 536def BDRAddr64Disp12 : AddressAsmOperand<"BDRAddr", "64", "12">; 537def BDVAddr64Disp12 : AddressAsmOperand<"BDVAddr", "64", "12">; 538 539// DAG patterns and operands for addressing modes. Each mode has 540// the form <type><range><group>[<len>] where: 541// 542// <type> is one of: 543// shift : base + displacement (32-bit) 544// bdaddr : base + displacement 545// mviaddr : like bdaddr, but reject cases with a natural index 546// bdxaddr : base + displacement + index 547// laaddr : like bdxaddr, but used for Load Address operations 548// dynalloc : base + displacement + index + ADJDYNALLOC 549// bdladdr : base + displacement with a length field 550// bdvaddr : base + displacement with a vector index 551// 552// <range> is one of: 553// 12 : the displacement is an unsigned 12-bit value 554// 20 : the displacement is a signed 20-bit value 555// 556// <group> is one of: 557// pair : used when there is an equivalent instruction with the opposite 558// range value (12 or 20) 559// only : used when there is no equivalent instruction with the opposite 560// range value 561// 562// <len> is one of: 563// 564// <empty> : there is no length field 565// len8 : the length field is 8 bits, with a range of [1, 0x100]. 566def shift12only : BDMode <"BDAddr", "32", "12", "Only">; 567def shift20only : BDMode <"BDAddr", "32", "20", "Only">; 568def bdaddr12only : BDMode <"BDAddr", "64", "12", "Only">; 569def bdaddr12pair : BDMode <"BDAddr", "64", "12", "Pair">; 570def bdaddr20only : BDMode <"BDAddr", "64", "20", "Only">; 571def bdaddr20pair : BDMode <"BDAddr", "64", "20", "Pair">; 572def mviaddr12pair : BDMode <"MVIAddr", "64", "12", "Pair">; 573def mviaddr20pair : BDMode <"MVIAddr", "64", "20", "Pair">; 574def bdxaddr12only : BDXMode<"BDXAddr", "64", "12", "Only">; 575def bdxaddr12pair : BDXMode<"BDXAddr", "64", "12", "Pair">; 576def bdxaddr20only : BDXMode<"BDXAddr", "64", "20", "Only">; 577def bdxaddr20only128 : BDXMode<"BDXAddr", "64", "20", "Only128">; 578def bdxaddr20pair : BDXMode<"BDXAddr", "64", "20", "Pair">; 579def dynalloc12only : BDXMode<"DynAlloc", "64", "12", "Only">; 580def laaddr12pair : BDXMode<"LAAddr", "64", "12", "Pair">; 581def laaddr20pair : BDXMode<"LAAddr", "64", "20", "Pair">; 582def bdladdr12onlylen4 : BDLMode<"BDLAddr", "64", "12", "Only", "4">; 583def bdladdr12onlylen8 : BDLMode<"BDLAddr", "64", "12", "Only", "8">; 584def bdraddr12only : BDRMode<"BDRAddr", "64", "12", "Only">; 585def bdvaddr12only : BDVMode< "64", "12">; 586 587//===----------------------------------------------------------------------===// 588// Miscellaneous 589//===----------------------------------------------------------------------===// 590 591// A 4-bit condition-code mask. 592def cond4 : PatLeaf<(i32 imm), [{ return (N->getZExtValue() < 16); }]>, 593 Operand<i32> { 594 let PrintMethod = "printCond4Operand"; 595} 596