1 //===-- SystemZOperands.td - SystemZ instruction operands ----*- tblgen-*--===//
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
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 class ImmediateAsmOperand<string name>
16 let RenderMethod = "addImmOperands";
18 class ImmediateTLSAsmOperand<string name>
21 let RenderMethod = "addImmTLSOperands";
24 class ImmediateOp<ValueType vt, string asmop> : Operand<vt> {
25 let PrintMethod = "print"##asmop##"Operand";
26 let DecoderMethod = "decode"##asmop##"Operand";
27 let ParserMatchClass = !cast<AsmOperandClass>(asmop);
30 class ImmOpWithPattern<ValueType vt, string asmop, code pred, SDNodeXForm xform,
31 SDNode ImmNode = imm> :
32 ImmediateOp<vt, asmop>, PatLeaf<(vt ImmNode), pred, xform>;
34 // class ImmediatePatLeaf<ValueType vt, code pred,
35 // SDNodeXForm xform, SDNode ImmNode>
36 // : PatLeaf<(vt ImmNode), pred, xform>;
39 // Constructs both a DAG pattern and instruction operand for an immediate
40 // of type VT. PRED returns true if a node is acceptable and XFORM returns
41 // the operand value associated with the node. ASMOP is the name of the
42 // associated asm operand, and also forms the basis of the asm print method.
43 multiclass Immediate<ValueType vt, code pred, SDNodeXForm xform, string asmop> {
44 // def "" : ImmediateOp<vt, asmop>,
45 // PatLeaf<(vt imm), pred, xform>;
46 def "" : ImmOpWithPattern<vt, asmop, pred, xform>;
48 // def _timm : PatLeaf<(vt timm), pred, xform>;
49 def _timm : ImmOpWithPattern<vt, asmop, pred, xform, timm>;
52 // Constructs an asm operand for a PC-relative address. SIZE says how
53 // many bits there are.
54 class PCRelAsmOperand<string size> : ImmediateAsmOperand<"PCRel"##size> {
55 let PredicateMethod = "isImm";
56 let ParserMethod = "parsePCRel"##size;
58 class PCRelTLSAsmOperand<string size>
59 : ImmediateTLSAsmOperand<"PCRelTLS"##size> {
60 let PredicateMethod = "isImmTLS";
61 let ParserMethod = "parsePCRelTLS"##size;
64 // Constructs an operand for a PC-relative address with address type VT.
65 // ASMOP is the associated asm operand.
66 class PCRelOperand<ValueType vt, AsmOperandClass asmop> : Operand<vt> {
67 let PrintMethod = "printPCRelOperand";
68 let ParserMatchClass = asmop;
70 class PCRelTLSOperand<ValueType vt, AsmOperandClass asmop> : Operand<vt> {
71 let PrintMethod = "printPCRelTLSOperand";
72 let ParserMatchClass = asmop;
75 // Constructs both a DAG pattern and instruction operand for a PC-relative
76 // address with address size VT. SELF is the name of the operand and
77 // ASMOP is the associated asm operand.
78 class PCRelAddress<ValueType vt, string self, AsmOperandClass asmop>
79 : ComplexPattern<vt, 1, "selectPCRelAddress",
80 [z_pcrel_wrapper, z_pcrel_offset]>,
81 PCRelOperand<vt, asmop> {
82 let MIOperandInfo = (ops !cast<Operand>(self));
85 // Constructs an AsmOperandClass for addressing mode FORMAT, treating the
86 // registers as having BITSIZE bits and displacements as having DISPSIZE bits.
87 // LENGTH is "LenN" for addresses with an N-bit length field, otherwise it
89 class AddressAsmOperand<string format, string bitsize, string dispsize,
92 let Name = format##bitsize##"Disp"##dispsize##length;
93 let ParserMethod = "parse"##format##bitsize;
94 let RenderMethod = "add"##format##"Operands";
97 // Constructs an instruction operand for an addressing mode. FORMAT,
98 // BITSIZE, DISPSIZE and LENGTH are the parameters to an associated
99 // AddressAsmOperand. OPERANDS is a list of individual operands
100 // (base register, displacement, etc.).
101 class AddressOperand<string bitsize, string dispsize, string length,
102 string format, dag operands>
103 : Operand<!cast<ValueType>("i"##bitsize)> {
104 let PrintMethod = "print"##format##"Operand";
105 let EncoderMethod = "get"##format##dispsize##length##"Encoding";
107 "decode"##format##bitsize##"Disp"##dispsize##length##"Operand";
108 let MIOperandInfo = operands;
109 let ParserMatchClass =
110 !cast<AddressAsmOperand>(format##bitsize##"Disp"##dispsize##length);
113 // Constructs both a DAG pattern and instruction operand for an addressing mode.
114 // FORMAT, BITSIZE, DISPSIZE and LENGTH are the parameters to an associated
115 // AddressAsmOperand. OPERANDS is a list of NUMOPS individual operands
116 // (base register, displacement, etc.). SELTYPE is the type of the memory
117 // operand for selection purposes; sometimes we want different selection
118 // choices for the same underlying addressing mode. SUFFIX is similarly
119 // a suffix appended to the displacement for selection purposes;
120 // e.g. we want to reject small 20-bit displacements if a 12-bit form
121 // also exists, but we want to accept them otherwise.
122 class AddressingMode<string seltype, string bitsize, string dispsize,
123 string suffix, string length, int numops, string format,
125 : ComplexPattern<!cast<ValueType>("i"##bitsize), numops,
126 "select"##seltype##dispsize##suffix##length,
127 [add, sub, or, frameindex, z_adjdynalloc]>,
128 AddressOperand<bitsize, dispsize, length, format, operands>;
130 // An addressing mode with a base and displacement but no index.
131 class BDMode<string type, string bitsize, string dispsize, string suffix>
132 : AddressingMode<type, bitsize, dispsize, suffix, "", 2, "BDAddr",
133 (ops !cast<RegisterOperand>("ADDR"##bitsize),
134 !cast<Operand>("disp"##dispsize##"imm"##bitsize))>;
136 // An addressing mode with a base, displacement and index.
137 class BDXMode<string type, string bitsize, string dispsize, string suffix>
138 : AddressingMode<type, bitsize, dispsize, suffix, "", 3, "BDXAddr",
139 (ops !cast<RegisterOperand>("ADDR"##bitsize),
140 !cast<Operand>("disp"##dispsize##"imm"##bitsize),
141 !cast<RegisterOperand>("ADDR"##bitsize))>;
143 // A BDMode paired with an immediate length operand of LENSIZE bits.
144 class BDLMode<string type, string bitsize, string dispsize, string suffix,
146 : AddressingMode<type, bitsize, dispsize, suffix, "Len"##lensize, 3,
148 (ops !cast<RegisterOperand>("ADDR"##bitsize),
149 !cast<Operand>("disp"##dispsize##"imm"##bitsize),
150 !cast<Operand>("imm"##bitsize))>;
152 // A BDMode paired with a register length operand.
153 class BDRMode<string type, string bitsize, string dispsize, string suffix>
154 : AddressingMode<type, bitsize, dispsize, suffix, "", 3, "BDRAddr",
155 (ops !cast<RegisterOperand>("ADDR"##bitsize),
156 !cast<Operand>("disp"##dispsize##"imm"##bitsize),
157 !cast<RegisterOperand>("GR"##bitsize))>;
159 // An addressing mode with a base, displacement and a vector index.
160 class BDVMode<string bitsize, string dispsize>
161 : AddressOperand<bitsize, dispsize, "", "BDVAddr",
162 (ops !cast<RegisterOperand>("ADDR"##bitsize),
163 !cast<Operand>("disp"##dispsize##"imm"##bitsize),
164 !cast<RegisterOperand>("VR128"))>;
166 //===----------------------------------------------------------------------===//
167 // Extracting immediate operands from nodes
168 // These all create MVT::i64 nodes to ensure the value is not sign-extended
169 // when converted from an SDNode to a MachineOperand later on.
170 //===----------------------------------------------------------------------===//
172 // Bits 0-15 (counting from the lsb).
173 def LL16 : SDNodeXForm<imm, [{
174 uint64_t Value = N->getZExtValue() & 0x000000000000FFFFULL;
175 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
178 // Bits 16-31 (counting from the lsb).
179 def LH16 : SDNodeXForm<imm, [{
180 uint64_t Value = (N->getZExtValue() & 0x00000000FFFF0000ULL) >> 16;
181 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
184 // Bits 32-47 (counting from the lsb).
185 def HL16 : SDNodeXForm<imm, [{
186 uint64_t Value = (N->getZExtValue() & 0x0000FFFF00000000ULL) >> 32;
187 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
190 // Bits 48-63 (counting from the lsb).
191 def HH16 : SDNodeXForm<imm, [{
192 uint64_t Value = (N->getZExtValue() & 0xFFFF000000000000ULL) >> 48;
193 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
197 def LF32 : SDNodeXForm<imm, [{
198 uint64_t Value = N->getZExtValue() & 0x00000000FFFFFFFFULL;
199 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
203 def HF32 : SDNodeXForm<imm, [{
204 uint64_t Value = N->getZExtValue() >> 32;
205 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
209 def NEGLH16 : SDNodeXForm<imm, [{
210 uint64_t Value = (-N->getZExtValue() & 0x00000000FFFF0000ULL) >> 16;
211 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
214 def NEGLF32 : SDNodeXForm<imm, [{
215 uint64_t Value = -N->getZExtValue() & 0x00000000FFFFFFFFULL;
216 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
219 // Truncate an immediate to a 8-bit signed quantity.
220 def SIMM8 : SDNodeXForm<imm, [{
221 return CurDAG->getTargetConstant(int8_t(N->getZExtValue()), SDLoc(N),
225 // Truncate an immediate to a 8-bit unsigned quantity.
226 def UIMM8 : SDNodeXForm<imm, [{
227 return CurDAG->getTargetConstant(uint8_t(N->getZExtValue()), SDLoc(N),
231 // Truncate an immediate to a 8-bit unsigned quantity and mask off low bit.
232 def UIMM8EVEN : SDNodeXForm<imm, [{
233 return CurDAG->getTargetConstant(N->getZExtValue() & 0xfe, SDLoc(N),
237 // Truncate an immediate to a 12-bit unsigned quantity.
238 def UIMM12 : SDNodeXForm<imm, [{
239 return CurDAG->getTargetConstant(N->getZExtValue() & 0xfff, SDLoc(N),
243 // Truncate an immediate to a 16-bit signed quantity.
244 def SIMM16 : SDNodeXForm<imm, [{
245 return CurDAG->getTargetConstant(int16_t(N->getZExtValue()), SDLoc(N),
249 // Negate and then truncate an immediate to a 16-bit signed quantity.
250 def NEGSIMM16 : SDNodeXForm<imm, [{
251 return CurDAG->getTargetConstant(int16_t(-N->getZExtValue()), SDLoc(N),
255 // Truncate an immediate to a 16-bit unsigned quantity.
256 def UIMM16 : SDNodeXForm<imm, [{
257 return CurDAG->getTargetConstant(uint16_t(N->getZExtValue()), SDLoc(N),
261 // Truncate an immediate to a 32-bit signed quantity.
262 def SIMM32 : SDNodeXForm<imm, [{
263 return CurDAG->getTargetConstant(int32_t(N->getZExtValue()), SDLoc(N),
267 // Negate and then truncate an immediate to a 32-bit unsigned quantity.
268 def NEGSIMM32 : SDNodeXForm<imm, [{
269 return CurDAG->getTargetConstant(int32_t(-N->getZExtValue()), SDLoc(N),
273 // Truncate an immediate to a 32-bit unsigned quantity.
274 def UIMM32 : SDNodeXForm<imm, [{
275 return CurDAG->getTargetConstant(uint32_t(N->getZExtValue()), SDLoc(N),
279 // Negate and then truncate an immediate to a 32-bit unsigned quantity.
280 def NEGUIMM32 : SDNodeXForm<imm, [{
281 return CurDAG->getTargetConstant(uint32_t(-N->getZExtValue()), SDLoc(N),
285 // Truncate an immediate to a 48-bit unsigned quantity.
286 def UIMM48 : SDNodeXForm<imm, [{
287 return CurDAG->getTargetConstant(uint64_t(N->getZExtValue()) & 0xffffffffffff,
291 //===----------------------------------------------------------------------===//
292 // Immediate asm operands.
293 //===----------------------------------------------------------------------===//
295 def U1Imm : ImmediateAsmOperand<"U1Imm">;
296 def U2Imm : ImmediateAsmOperand<"U2Imm">;
297 def U3Imm : ImmediateAsmOperand<"U3Imm">;
298 def U4Imm : ImmediateAsmOperand<"U4Imm">;
299 def U6Imm : ImmediateAsmOperand<"U6Imm">;
300 def S8Imm : ImmediateAsmOperand<"S8Imm">;
301 def U8Imm : ImmediateAsmOperand<"U8Imm">;
302 def U12Imm : ImmediateAsmOperand<"U12Imm">;
303 def S16Imm : ImmediateAsmOperand<"S16Imm">;
304 def U16Imm : ImmediateAsmOperand<"U16Imm">;
305 def S32Imm : ImmediateAsmOperand<"S32Imm">;
306 def U32Imm : ImmediateAsmOperand<"U32Imm">;
307 def U48Imm : ImmediateAsmOperand<"U48Imm">;
309 //===----------------------------------------------------------------------===//
311 //===----------------------------------------------------------------------===//
313 // Immediates for the lower and upper 16 bits of an i32, with the other
314 // bits of the i32 being zero.
315 defm imm32ll16 : Immediate<i32, [{
316 return SystemZ::isImmLL(N->getZExtValue());
319 defm imm32lh16 : Immediate<i32, [{
320 return SystemZ::isImmLH(N->getZExtValue());
323 // Immediates for the lower and upper 16 bits of an i32, with the other
324 // bits of the i32 being one.
325 defm imm32ll16c : Immediate<i32, [{
326 return SystemZ::isImmLL(uint32_t(~N->getZExtValue()));
329 defm imm32lh16c : Immediate<i32, [{
330 return SystemZ::isImmLH(uint32_t(~N->getZExtValue()));
334 defm imm32zx1 : Immediate<i32, [{
335 return isUInt<1>(N->getZExtValue());
336 }], NOOP_SDNodeXForm, "U1Imm">;
338 defm imm32zx2 : Immediate<i32, [{
339 return isUInt<2>(N->getZExtValue());
340 }], NOOP_SDNodeXForm, "U2Imm">;
342 defm imm32zx3 : Immediate<i32, [{
343 return isUInt<3>(N->getZExtValue());
344 }], NOOP_SDNodeXForm, "U3Imm">;
346 defm imm32zx4 : Immediate<i32, [{
347 return isUInt<4>(N->getZExtValue());
348 }], NOOP_SDNodeXForm, "U4Imm">;
350 // Note: this enforces an even value during code generation only.
351 // When used from the assembler, any 4-bit value is allowed.
352 defm imm32zx4even : Immediate<i32, [{
353 return isUInt<4>(N->getZExtValue());
354 }], UIMM8EVEN, "U4Imm">;
356 defm imm32zx6 : Immediate<i32, [{
357 return isUInt<6>(N->getZExtValue());
358 }], NOOP_SDNodeXForm, "U6Imm">;
360 defm imm32sx8 : Immediate<i32, [{
361 return isInt<8>(N->getSExtValue());
364 defm imm32zx8 : Immediate<i32, [{
365 return isUInt<8>(N->getZExtValue());
368 defm imm32zx8trunc : Immediate<i32, [{}], UIMM8, "U8Imm">;
370 defm imm32zx12 : Immediate<i32, [{
371 return isUInt<12>(N->getZExtValue());
372 }], UIMM12, "U12Imm">;
374 defm imm32sx16 : Immediate<i32, [{
375 return isInt<16>(N->getSExtValue());
376 }], SIMM16, "S16Imm">;
378 defm imm32sx16n : Immediate<i32, [{
379 return isInt<16>(-N->getSExtValue());
380 }], NEGSIMM16, "S16Imm">;
382 defm imm32zx16 : Immediate<i32, [{
383 return isUInt<16>(N->getZExtValue());
384 }], UIMM16, "U16Imm">;
386 defm imm32sx16trunc : Immediate<i32, [{}], SIMM16, "S16Imm">;
387 defm imm32zx16trunc : Immediate<i32, [{}], UIMM16, "U16Imm">;
389 // Full 32-bit immediates. we need both signed and unsigned versions
390 // because the assembler is picky. E.g. AFI requires signed operands
391 // while NILF requires unsigned ones.
392 defm simm32 : Immediate<i32, [{}], SIMM32, "S32Imm">;
393 defm uimm32 : Immediate<i32, [{}], UIMM32, "U32Imm">;
395 defm simm32n : Immediate<i32, [{
396 return isInt<32>(-N->getSExtValue());
397 }], NEGSIMM32, "S32Imm">;
399 def imm32 : ImmLeaf<i32, [{}]>;
401 //===----------------------------------------------------------------------===//
403 //===----------------------------------------------------------------------===//
405 // Immediates for 16-bit chunks of an i64, with the other bits of the
407 defm imm64ll16 : Immediate<i64, [{
408 return SystemZ::isImmLL(N->getZExtValue());
411 defm imm64lh16 : Immediate<i64, [{
412 return SystemZ::isImmLH(N->getZExtValue());
415 defm imm64hl16 : Immediate<i64, [{
416 return SystemZ::isImmHL(N->getZExtValue());
419 defm imm64hh16 : Immediate<i64, [{
420 return SystemZ::isImmHH(N->getZExtValue());
423 // Immediates for 16-bit chunks of an i64, with the other bits of the
425 defm imm64ll16c : Immediate<i64, [{
426 return SystemZ::isImmLL(uint64_t(~N->getZExtValue()));
429 defm imm64lh16c : Immediate<i64, [{
430 return SystemZ::isImmLH(uint64_t(~N->getZExtValue()));
433 defm imm64hl16c : Immediate<i64, [{
434 return SystemZ::isImmHL(uint64_t(~N->getZExtValue()));
437 defm imm64hh16c : Immediate<i64, [{
438 return SystemZ::isImmHH(uint64_t(~N->getZExtValue()));
441 // Immediates for the lower and upper 32 bits of an i64, with the other
442 // bits of the i32 being zero.
443 defm imm64lf32 : Immediate<i64, [{
444 return SystemZ::isImmLF(N->getZExtValue());
447 defm imm64hf32 : Immediate<i64, [{
448 return SystemZ::isImmHF(N->getZExtValue());
451 // Immediates for the lower and upper 32 bits of an i64, with the other
452 // bits of the i32 being one.
453 defm imm64lf32c : Immediate<i64, [{
454 return SystemZ::isImmLF(uint64_t(~N->getZExtValue()));
457 defm imm64hf32c : Immediate<i64, [{
458 return SystemZ::isImmHF(uint64_t(~N->getZExtValue()));
461 // Negated immediates that fit LF32 or LH16.
462 defm imm64lh16n : Immediate<i64, [{
463 return SystemZ::isImmLH(uint64_t(-N->getZExtValue()));
464 }], NEGLH16, "U16Imm">;
466 defm imm64lf32n : Immediate<i64, [{
467 return SystemZ::isImmLF(uint64_t(-N->getZExtValue()));
468 }], NEGLF32, "U32Imm">;
471 defm imm64sx8 : Immediate<i64, [{
472 return isInt<8>(N->getSExtValue());
475 defm imm64zx8 : Immediate<i64, [{
476 return isUInt<8>(N->getSExtValue());
479 defm imm64sx16 : Immediate<i64, [{
480 return isInt<16>(N->getSExtValue());
481 }], SIMM16, "S16Imm">;
483 defm imm64sx16n : Immediate<i64, [{
484 return isInt<16>(-N->getSExtValue());
485 }], NEGSIMM16, "S16Imm">;
487 defm imm64zx16 : Immediate<i64, [{
488 return isUInt<16>(N->getZExtValue());
489 }], UIMM16, "U16Imm">;
491 defm imm64sx32 : Immediate<i64, [{
492 return isInt<32>(N->getSExtValue());
493 }], SIMM32, "S32Imm">;
495 defm imm64sx32n : Immediate<i64, [{
496 return isInt<32>(-N->getSExtValue());
497 }], NEGSIMM32, "S32Imm">;
499 defm imm64zx32 : Immediate<i64, [{
500 return isUInt<32>(N->getZExtValue());
501 }], UIMM32, "U32Imm">;
503 defm imm64zx32n : Immediate<i64, [{
504 return isUInt<32>(-N->getSExtValue());
505 }], NEGUIMM32, "U32Imm">;
507 defm imm64zx48 : Immediate<i64, [{
508 return isUInt<64>(N->getZExtValue());
509 }], UIMM48, "U48Imm">;
511 def imm64 : ImmLeaf<i64, [{}]>, Operand<i64>;
513 //===----------------------------------------------------------------------===//
514 // Floating-point immediates
515 //===----------------------------------------------------------------------===//
517 // Floating-point zero.
518 def fpimm0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(+0.0); }]>;
520 // Floating point negative zero.
521 def fpimmneg0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(-0.0); }]>;
523 //===----------------------------------------------------------------------===//
524 // Symbolic address operands
525 //===----------------------------------------------------------------------===//
527 // PC-relative asm operands.
528 def PCRel12 : PCRelAsmOperand<"12">;
529 def PCRel16 : PCRelAsmOperand<"16">;
530 def PCRel24 : PCRelAsmOperand<"24">;
531 def PCRel32 : PCRelAsmOperand<"32">;
532 def PCRelTLS16 : PCRelTLSAsmOperand<"16">;
533 def PCRelTLS32 : PCRelTLSAsmOperand<"32">;
535 // PC-relative offsets of a basic block. The offset is sign-extended
536 // and multiplied by 2.
537 def brtarget16 : PCRelOperand<OtherVT, PCRel16> {
538 let EncoderMethod = "getPC16DBLEncoding";
539 let DecoderMethod = "decodePC16DBLBranchOperand";
541 def brtarget32 : PCRelOperand<OtherVT, PCRel32> {
542 let EncoderMethod = "getPC32DBLEncoding";
543 let DecoderMethod = "decodePC32DBLBranchOperand";
546 // Variants of brtarget for use with branch prediction preload.
547 def brtarget12bpp : PCRelOperand<OtherVT, PCRel12> {
548 let EncoderMethod = "getPC12DBLBPPEncoding";
549 let DecoderMethod = "decodePC12DBLBranchOperand";
551 def brtarget16bpp : PCRelOperand<OtherVT, PCRel16> {
552 let EncoderMethod = "getPC16DBLBPPEncoding";
553 let DecoderMethod = "decodePC16DBLBranchOperand";
555 def brtarget24bpp : PCRelOperand<OtherVT, PCRel24> {
556 let EncoderMethod = "getPC24DBLBPPEncoding";
557 let DecoderMethod = "decodePC24DBLBranchOperand";
560 // Variants of brtarget16/32 with an optional additional TLS symbol.
561 // These are used to annotate calls to __tls_get_offset.
562 def tlssym : Operand<i64> { }
563 def brtarget16tls : PCRelTLSOperand<OtherVT, PCRelTLS16> {
564 let MIOperandInfo = (ops brtarget16:$func, tlssym:$sym);
565 let EncoderMethod = "getPC16DBLTLSEncoding";
566 let DecoderMethod = "decodePC16DBLBranchOperand";
568 def brtarget32tls : PCRelTLSOperand<OtherVT, PCRelTLS32> {
569 let MIOperandInfo = (ops brtarget32:$func, tlssym:$sym);
570 let EncoderMethod = "getPC32DBLTLSEncoding";
571 let DecoderMethod = "decodePC32DBLBranchOperand";
574 // A PC-relative offset of a global value. The offset is sign-extended
575 // and multiplied by 2.
576 def pcrel32 : PCRelAddress<i64, "pcrel32", PCRel32> {
577 let EncoderMethod = "getPC32DBLEncoding";
578 let DecoderMethod = "decodePC32DBLOperand";
581 //===----------------------------------------------------------------------===//
583 //===----------------------------------------------------------------------===//
585 // 12-bit displacement operands.
586 def disp12imm32 : Operand<i32>;
587 def disp12imm64 : Operand<i64>;
589 // 20-bit displacement operands.
590 def disp20imm32 : Operand<i32>;
591 def disp20imm64 : Operand<i64>;
593 def BDAddr32Disp12 : AddressAsmOperand<"BDAddr", "32", "12">;
594 def BDAddr32Disp20 : AddressAsmOperand<"BDAddr", "32", "20">;
595 def BDAddr64Disp12 : AddressAsmOperand<"BDAddr", "64", "12">;
596 def BDAddr64Disp20 : AddressAsmOperand<"BDAddr", "64", "20">;
597 def BDXAddr64Disp12 : AddressAsmOperand<"BDXAddr", "64", "12">;
598 def BDXAddr64Disp20 : AddressAsmOperand<"BDXAddr", "64", "20">;
599 def BDLAddr64Disp12Len4 : AddressAsmOperand<"BDLAddr", "64", "12", "Len4">;
600 def BDLAddr64Disp12Len8 : AddressAsmOperand<"BDLAddr", "64", "12", "Len8">;
601 def BDRAddr64Disp12 : AddressAsmOperand<"BDRAddr", "64", "12">;
602 def BDVAddr64Disp12 : AddressAsmOperand<"BDVAddr", "64", "12">;
604 // DAG patterns and operands for addressing modes. Each mode has
605 // the form <type><range><group>[<len>] where:
608 // shift : base + displacement (32-bit)
609 // bdaddr : base + displacement
610 // mviaddr : like bdaddr, but reject cases with a natural index
611 // bdxaddr : base + displacement + index
612 // laaddr : like bdxaddr, but used for Load Address operations
613 // dynalloc : base + displacement + index + ADJDYNALLOC
614 // bdladdr : base + displacement with a length field
615 // bdvaddr : base + displacement with a vector index
617 // <range> is one of:
618 // 12 : the displacement is an unsigned 12-bit value
619 // 20 : the displacement is a signed 20-bit value
621 // <group> is one of:
622 // pair : used when there is an equivalent instruction with the opposite
623 // range value (12 or 20)
624 // only : used when there is no equivalent instruction with the opposite
629 // <empty> : there is no length field
630 // len8 : the length field is 8 bits, with a range of [1, 0x100].
631 def shift12only : BDMode <"BDAddr", "32", "12", "Only">;
632 def shift20only : BDMode <"BDAddr", "32", "20", "Only">;
633 def bdaddr12only : BDMode <"BDAddr", "64", "12", "Only">;
634 def bdaddr12pair : BDMode <"BDAddr", "64", "12", "Pair">;
635 def bdaddr20only : BDMode <"BDAddr", "64", "20", "Only">;
636 def bdaddr20pair : BDMode <"BDAddr", "64", "20", "Pair">;
637 def mviaddr12pair : BDMode <"MVIAddr", "64", "12", "Pair">;
638 def mviaddr20pair : BDMode <"MVIAddr", "64", "20", "Pair">;
639 def bdxaddr12only : BDXMode<"BDXAddr", "64", "12", "Only">;
640 def bdxaddr12pair : BDXMode<"BDXAddr", "64", "12", "Pair">;
641 def bdxaddr20only : BDXMode<"BDXAddr", "64", "20", "Only">;
642 def bdxaddr20only128 : BDXMode<"BDXAddr", "64", "20", "Only128">;
643 def bdxaddr20pair : BDXMode<"BDXAddr", "64", "20", "Pair">;
644 def dynalloc12only : BDXMode<"DynAlloc", "64", "12", "Only">;
645 def laaddr12pair : BDXMode<"LAAddr", "64", "12", "Pair">;
646 def laaddr20pair : BDXMode<"LAAddr", "64", "20", "Pair">;
647 def bdladdr12onlylen4 : BDLMode<"BDLAddr", "64", "12", "Only", "4">;
648 def bdladdr12onlylen8 : BDLMode<"BDLAddr", "64", "12", "Only", "8">;
649 def bdraddr12only : BDRMode<"BDRAddr", "64", "12", "Only">;
650 def bdvaddr12only : BDVMode< "64", "12">;
652 //===----------------------------------------------------------------------===//
654 //===----------------------------------------------------------------------===//
656 // A 4-bit condition-code mask.
657 def cond4 : PatLeaf<(i32 timm), [{ return (N->getZExtValue() < 16); }]>,
659 let PrintMethod = "printCond4Operand";