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