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 // Constructs both a DAG pattern and instruction operand for an immediate
25 // of type VT. PRED returns true if a node is acceptable and XFORM returns
26 // the operand value associated with the node. ASMOP is the name of the
27 // associated asm operand, and also forms the basis of the asm print method.
28 class Immediate<ValueType vt, code pred, SDNodeXForm xform, string asmop>
29 : PatLeaf<(vt imm), pred, xform>, Operand<vt> {
30 let PrintMethod = "print"##asmop##"Operand";
31 let DecoderMethod = "decode"##asmop##"Operand";
32 let ParserMatchClass = !cast<AsmOperandClass>(asmop);
35 // Constructs an asm operand for a PC-relative address. SIZE says how
36 // many bits there are.
37 class PCRelAsmOperand<string size> : ImmediateAsmOperand<"PCRel"##size> {
38 let PredicateMethod = "isImm";
39 let ParserMethod = "parsePCRel"##size;
41 class PCRelTLSAsmOperand<string size>
42 : ImmediateTLSAsmOperand<"PCRelTLS"##size> {
43 let PredicateMethod = "isImmTLS";
44 let ParserMethod = "parsePCRelTLS"##size;
47 // Constructs an operand for a PC-relative address with address type VT.
48 // ASMOP is the associated asm operand.
49 class PCRelOperand<ValueType vt, AsmOperandClass asmop> : Operand<vt> {
50 let PrintMethod = "printPCRelOperand";
51 let ParserMatchClass = asmop;
53 class PCRelTLSOperand<ValueType vt, AsmOperandClass asmop> : Operand<vt> {
54 let PrintMethod = "printPCRelTLSOperand";
55 let ParserMatchClass = asmop;
58 // Constructs both a DAG pattern and instruction operand for a PC-relative
59 // address with address size VT. SELF is the name of the operand and
60 // ASMOP is the associated asm operand.
61 class PCRelAddress<ValueType vt, string self, AsmOperandClass asmop>
62 : ComplexPattern<vt, 1, "selectPCRelAddress",
63 [z_pcrel_wrapper, z_pcrel_offset]>,
64 PCRelOperand<vt, asmop> {
65 let MIOperandInfo = (ops !cast<Operand>(self));
68 // Constructs an AsmOperandClass for addressing mode FORMAT, treating the
69 // registers as having BITSIZE bits and displacements as having DISPSIZE bits.
70 // LENGTH is "LenN" for addresses with an N-bit length field, otherwise it
72 class AddressAsmOperand<string format, string bitsize, string dispsize,
75 let Name = format##bitsize##"Disp"##dispsize##length;
76 let ParserMethod = "parse"##format##bitsize;
77 let RenderMethod = "add"##format##"Operands";
80 // Constructs an instruction operand for an addressing mode. FORMAT,
81 // BITSIZE, DISPSIZE and LENGTH are the parameters to an associated
82 // AddressAsmOperand. OPERANDS is a list of individual operands
83 // (base register, displacement, etc.).
84 class AddressOperand<string bitsize, string dispsize, string length,
85 string format, dag operands>
86 : Operand<!cast<ValueType>("i"##bitsize)> {
87 let PrintMethod = "print"##format##"Operand";
88 let EncoderMethod = "get"##format##dispsize##length##"Encoding";
90 "decode"##format##bitsize##"Disp"##dispsize##length##"Operand";
91 let MIOperandInfo = operands;
92 let ParserMatchClass =
93 !cast<AddressAsmOperand>(format##bitsize##"Disp"##dispsize##length);
96 // Constructs both a DAG pattern and instruction operand for an addressing mode.
97 // FORMAT, BITSIZE, DISPSIZE and LENGTH are the parameters to an associated
98 // AddressAsmOperand. OPERANDS is a list of NUMOPS individual operands
99 // (base register, displacement, etc.). SELTYPE is the type of the memory
100 // operand for selection purposes; sometimes we want different selection
101 // choices for the same underlying addressing mode. SUFFIX is similarly
102 // a suffix appended to the displacement for selection purposes;
103 // e.g. we want to reject small 20-bit displacements if a 12-bit form
104 // also exists, but we want to accept them otherwise.
105 class AddressingMode<string seltype, string bitsize, string dispsize,
106 string suffix, string length, int numops, string format,
108 : ComplexPattern<!cast<ValueType>("i"##bitsize), numops,
109 "select"##seltype##dispsize##suffix##length,
110 [add, sub, or, frameindex, z_adjdynalloc]>,
111 AddressOperand<bitsize, dispsize, length, format, operands>;
113 // An addressing mode with a base and displacement but no index.
114 class BDMode<string type, string bitsize, string dispsize, string suffix>
115 : AddressingMode<type, bitsize, dispsize, suffix, "", 2, "BDAddr",
116 (ops !cast<RegisterOperand>("ADDR"##bitsize),
117 !cast<Operand>("disp"##dispsize##"imm"##bitsize))>;
119 // An addressing mode with a base, displacement and index.
120 class BDXMode<string type, string bitsize, string dispsize, string suffix>
121 : AddressingMode<type, bitsize, dispsize, suffix, "", 3, "BDXAddr",
122 (ops !cast<RegisterOperand>("ADDR"##bitsize),
123 !cast<Operand>("disp"##dispsize##"imm"##bitsize),
124 !cast<RegisterOperand>("ADDR"##bitsize))>;
126 // A BDMode paired with an immediate length operand of LENSIZE bits.
127 class BDLMode<string type, string bitsize, string dispsize, string suffix,
129 : AddressingMode<type, bitsize, dispsize, suffix, "Len"##lensize, 3,
131 (ops !cast<RegisterOperand>("ADDR"##bitsize),
132 !cast<Operand>("disp"##dispsize##"imm"##bitsize),
133 !cast<Operand>("imm"##bitsize))>;
135 // A BDMode paired with a register length operand.
136 class BDRMode<string type, string bitsize, string dispsize, string suffix>
137 : AddressingMode<type, bitsize, dispsize, suffix, "", 3, "BDRAddr",
138 (ops !cast<RegisterOperand>("ADDR"##bitsize),
139 !cast<Operand>("disp"##dispsize##"imm"##bitsize),
140 !cast<RegisterOperand>("GR"##bitsize))>;
142 // An addressing mode with a base, displacement and a vector index.
143 class BDVMode<string bitsize, string dispsize>
144 : AddressOperand<bitsize, dispsize, "", "BDVAddr",
145 (ops !cast<RegisterOperand>("ADDR"##bitsize),
146 !cast<Operand>("disp"##dispsize##"imm"##bitsize),
147 !cast<RegisterOperand>("VR128"))>;
149 //===----------------------------------------------------------------------===//
150 // Extracting immediate operands from nodes
151 // These all create MVT::i64 nodes to ensure the value is not sign-extended
152 // when converted from an SDNode to a MachineOperand later on.
153 //===----------------------------------------------------------------------===//
155 // Bits 0-15 (counting from the lsb).
156 def LL16 : SDNodeXForm<imm, [{
157 uint64_t Value = N->getZExtValue() & 0x000000000000FFFFULL;
158 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
161 // Bits 16-31 (counting from the lsb).
162 def LH16 : SDNodeXForm<imm, [{
163 uint64_t Value = (N->getZExtValue() & 0x00000000FFFF0000ULL) >> 16;
164 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
167 // Bits 32-47 (counting from the lsb).
168 def HL16 : SDNodeXForm<imm, [{
169 uint64_t Value = (N->getZExtValue() & 0x0000FFFF00000000ULL) >> 32;
170 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
173 // Bits 48-63 (counting from the lsb).
174 def HH16 : SDNodeXForm<imm, [{
175 uint64_t Value = (N->getZExtValue() & 0xFFFF000000000000ULL) >> 48;
176 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
180 def LF32 : SDNodeXForm<imm, [{
181 uint64_t Value = N->getZExtValue() & 0x00000000FFFFFFFFULL;
182 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
186 def HF32 : SDNodeXForm<imm, [{
187 uint64_t Value = N->getZExtValue() >> 32;
188 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
192 def NEGLH16 : SDNodeXForm<imm, [{
193 uint64_t Value = (-N->getZExtValue() & 0x00000000FFFF0000ULL) >> 16;
194 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
197 def NEGLF32 : SDNodeXForm<imm, [{
198 uint64_t Value = -N->getZExtValue() & 0x00000000FFFFFFFFULL;
199 return CurDAG->getTargetConstant(Value, SDLoc(N), MVT::i64);
202 // Truncate an immediate to a 8-bit signed quantity.
203 def SIMM8 : SDNodeXForm<imm, [{
204 return CurDAG->getTargetConstant(int8_t(N->getZExtValue()), SDLoc(N),
208 // Truncate an immediate to a 8-bit unsigned quantity.
209 def UIMM8 : SDNodeXForm<imm, [{
210 return CurDAG->getTargetConstant(uint8_t(N->getZExtValue()), SDLoc(N),
214 // Truncate an immediate to a 8-bit unsigned quantity and mask off low bit.
215 def UIMM8EVEN : SDNodeXForm<imm, [{
216 return CurDAG->getTargetConstant(N->getZExtValue() & 0xfe, SDLoc(N),
220 // Truncate an immediate to a 12-bit unsigned quantity.
221 def UIMM12 : SDNodeXForm<imm, [{
222 return CurDAG->getTargetConstant(N->getZExtValue() & 0xfff, SDLoc(N),
226 // Truncate an immediate to a 16-bit signed quantity.
227 def SIMM16 : SDNodeXForm<imm, [{
228 return CurDAG->getTargetConstant(int16_t(N->getZExtValue()), SDLoc(N),
232 // Negate and then truncate an immediate to a 16-bit signed quantity.
233 def NEGSIMM16 : SDNodeXForm<imm, [{
234 return CurDAG->getTargetConstant(int16_t(-N->getZExtValue()), SDLoc(N),
238 // Truncate an immediate to a 16-bit unsigned quantity.
239 def UIMM16 : SDNodeXForm<imm, [{
240 return CurDAG->getTargetConstant(uint16_t(N->getZExtValue()), SDLoc(N),
244 // Truncate an immediate to a 32-bit signed quantity.
245 def SIMM32 : SDNodeXForm<imm, [{
246 return CurDAG->getTargetConstant(int32_t(N->getZExtValue()), SDLoc(N),
250 // Negate and then truncate an immediate to a 32-bit unsigned quantity.
251 def NEGSIMM32 : SDNodeXForm<imm, [{
252 return CurDAG->getTargetConstant(int32_t(-N->getZExtValue()), SDLoc(N),
256 // Truncate an immediate to a 32-bit unsigned quantity.
257 def UIMM32 : SDNodeXForm<imm, [{
258 return CurDAG->getTargetConstant(uint32_t(N->getZExtValue()), SDLoc(N),
262 // Negate and then truncate an immediate to a 32-bit unsigned quantity.
263 def NEGUIMM32 : SDNodeXForm<imm, [{
264 return CurDAG->getTargetConstant(uint32_t(-N->getZExtValue()), SDLoc(N),
268 // Truncate an immediate to a 48-bit unsigned quantity.
269 def UIMM48 : SDNodeXForm<imm, [{
270 return CurDAG->getTargetConstant(uint64_t(N->getZExtValue()) & 0xffffffffffff,
274 //===----------------------------------------------------------------------===//
275 // Immediate asm operands.
276 //===----------------------------------------------------------------------===//
278 def U1Imm : ImmediateAsmOperand<"U1Imm">;
279 def U2Imm : ImmediateAsmOperand<"U2Imm">;
280 def U3Imm : ImmediateAsmOperand<"U3Imm">;
281 def U4Imm : ImmediateAsmOperand<"U4Imm">;
282 def U6Imm : ImmediateAsmOperand<"U6Imm">;
283 def S8Imm : ImmediateAsmOperand<"S8Imm">;
284 def U8Imm : ImmediateAsmOperand<"U8Imm">;
285 def U12Imm : ImmediateAsmOperand<"U12Imm">;
286 def S16Imm : ImmediateAsmOperand<"S16Imm">;
287 def U16Imm : ImmediateAsmOperand<"U16Imm">;
288 def S32Imm : ImmediateAsmOperand<"S32Imm">;
289 def U32Imm : ImmediateAsmOperand<"U32Imm">;
290 def U48Imm : ImmediateAsmOperand<"U48Imm">;
292 //===----------------------------------------------------------------------===//
294 //===----------------------------------------------------------------------===//
296 // Immediates for the lower and upper 16 bits of an i32, with the other
297 // bits of the i32 being zero.
298 def imm32ll16 : Immediate<i32, [{
299 return SystemZ::isImmLL(N->getZExtValue());
302 def imm32lh16 : Immediate<i32, [{
303 return SystemZ::isImmLH(N->getZExtValue());
306 // Immediates for the lower and upper 16 bits of an i32, with the other
307 // bits of the i32 being one.
308 def imm32ll16c : Immediate<i32, [{
309 return SystemZ::isImmLL(uint32_t(~N->getZExtValue()));
312 def imm32lh16c : Immediate<i32, [{
313 return SystemZ::isImmLH(uint32_t(~N->getZExtValue()));
317 def imm32zx1 : Immediate<i32, [{
318 return isUInt<1>(N->getZExtValue());
319 }], NOOP_SDNodeXForm, "U1Imm">;
321 def imm32zx2 : Immediate<i32, [{
322 return isUInt<2>(N->getZExtValue());
323 }], NOOP_SDNodeXForm, "U2Imm">;
325 def imm32zx3 : Immediate<i32, [{
326 return isUInt<3>(N->getZExtValue());
327 }], NOOP_SDNodeXForm, "U3Imm">;
329 def imm32zx4 : Immediate<i32, [{
330 return isUInt<4>(N->getZExtValue());
331 }], NOOP_SDNodeXForm, "U4Imm">;
333 // Note: this enforces an even value during code generation only.
334 // When used from the assembler, any 4-bit value is allowed.
335 def imm32zx4even : Immediate<i32, [{
336 return isUInt<4>(N->getZExtValue());
337 }], UIMM8EVEN, "U4Imm">;
339 def imm32zx6 : Immediate<i32, [{
340 return isUInt<6>(N->getZExtValue());
341 }], NOOP_SDNodeXForm, "U6Imm">;
343 def imm32sx8 : Immediate<i32, [{
344 return isInt<8>(N->getSExtValue());
347 def imm32zx8 : Immediate<i32, [{
348 return isUInt<8>(N->getZExtValue());
351 def imm32zx8trunc : Immediate<i32, [{}], UIMM8, "U8Imm">;
353 def imm32zx12 : Immediate<i32, [{
354 return isUInt<12>(N->getZExtValue());
355 }], UIMM12, "U12Imm">;
357 def imm32sx16 : Immediate<i32, [{
358 return isInt<16>(N->getSExtValue());
359 }], SIMM16, "S16Imm">;
361 def imm32sx16n : Immediate<i32, [{
362 return isInt<16>(-N->getSExtValue());
363 }], NEGSIMM16, "S16Imm">;
365 def imm32zx16 : Immediate<i32, [{
366 return isUInt<16>(N->getZExtValue());
367 }], UIMM16, "U16Imm">;
369 def imm32sx16trunc : Immediate<i32, [{}], SIMM16, "S16Imm">;
370 def imm32zx16trunc : Immediate<i32, [{}], UIMM16, "U16Imm">;
372 // Full 32-bit immediates. we need both signed and unsigned versions
373 // because the assembler is picky. E.g. AFI requires signed operands
374 // while NILF requires unsigned ones.
375 def simm32 : Immediate<i32, [{}], SIMM32, "S32Imm">;
376 def uimm32 : Immediate<i32, [{}], UIMM32, "U32Imm">;
378 def simm32n : Immediate<i32, [{
379 return isInt<32>(-N->getSExtValue());
380 }], NEGSIMM32, "S32Imm">;
382 def imm32 : ImmLeaf<i32, [{}]>;
384 //===----------------------------------------------------------------------===//
386 //===----------------------------------------------------------------------===//
388 // Immediates for 16-bit chunks of an i64, with the other bits of the
390 def imm64ll16 : Immediate<i64, [{
391 return SystemZ::isImmLL(N->getZExtValue());
394 def imm64lh16 : Immediate<i64, [{
395 return SystemZ::isImmLH(N->getZExtValue());
398 def imm64hl16 : Immediate<i64, [{
399 return SystemZ::isImmHL(N->getZExtValue());
402 def imm64hh16 : Immediate<i64, [{
403 return SystemZ::isImmHH(N->getZExtValue());
406 // Immediates for 16-bit chunks of an i64, with the other bits of the
408 def imm64ll16c : Immediate<i64, [{
409 return SystemZ::isImmLL(uint64_t(~N->getZExtValue()));
412 def imm64lh16c : Immediate<i64, [{
413 return SystemZ::isImmLH(uint64_t(~N->getZExtValue()));
416 def imm64hl16c : Immediate<i64, [{
417 return SystemZ::isImmHL(uint64_t(~N->getZExtValue()));
420 def imm64hh16c : Immediate<i64, [{
421 return SystemZ::isImmHH(uint64_t(~N->getZExtValue()));
424 // Immediates for the lower and upper 32 bits of an i64, with the other
425 // bits of the i32 being zero.
426 def imm64lf32 : Immediate<i64, [{
427 return SystemZ::isImmLF(N->getZExtValue());
430 def imm64hf32 : Immediate<i64, [{
431 return SystemZ::isImmHF(N->getZExtValue());
434 // Immediates for the lower and upper 32 bits of an i64, with the other
435 // bits of the i32 being one.
436 def imm64lf32c : Immediate<i64, [{
437 return SystemZ::isImmLF(uint64_t(~N->getZExtValue()));
440 def imm64hf32c : Immediate<i64, [{
441 return SystemZ::isImmHF(uint64_t(~N->getZExtValue()));
444 // Negated immediates that fit LF32 or LH16.
445 def imm64lh16n : Immediate<i64, [{
446 return SystemZ::isImmLH(uint64_t(-N->getZExtValue()));
447 }], NEGLH16, "U16Imm">;
449 def imm64lf32n : Immediate<i64, [{
450 return SystemZ::isImmLF(uint64_t(-N->getZExtValue()));
451 }], NEGLF32, "U32Imm">;
454 def imm64sx8 : Immediate<i64, [{
455 return isInt<8>(N->getSExtValue());
458 def imm64zx8 : Immediate<i64, [{
459 return isUInt<8>(N->getSExtValue());
462 def imm64sx16 : Immediate<i64, [{
463 return isInt<16>(N->getSExtValue());
464 }], SIMM16, "S16Imm">;
466 def imm64sx16n : Immediate<i64, [{
467 return isInt<16>(-N->getSExtValue());
468 }], NEGSIMM16, "S16Imm">;
470 def imm64zx16 : Immediate<i64, [{
471 return isUInt<16>(N->getZExtValue());
472 }], UIMM16, "U16Imm">;
474 def imm64sx32 : Immediate<i64, [{
475 return isInt<32>(N->getSExtValue());
476 }], SIMM32, "S32Imm">;
478 def imm64sx32n : Immediate<i64, [{
479 return isInt<32>(-N->getSExtValue());
480 }], NEGSIMM32, "S32Imm">;
482 def imm64zx32 : Immediate<i64, [{
483 return isUInt<32>(N->getZExtValue());
484 }], UIMM32, "U32Imm">;
486 def imm64zx32n : Immediate<i64, [{
487 return isUInt<32>(-N->getSExtValue());
488 }], NEGUIMM32, "U32Imm">;
490 def imm64zx48 : Immediate<i64, [{
491 return isUInt<64>(N->getZExtValue());
492 }], UIMM48, "U48Imm">;
494 def imm64 : ImmLeaf<i64, [{}]>, Operand<i64>;
496 //===----------------------------------------------------------------------===//
497 // Floating-point immediates
498 //===----------------------------------------------------------------------===//
500 // Floating-point zero.
501 def fpimm0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(+0.0); }]>;
503 // Floating point negative zero.
504 def fpimmneg0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(-0.0); }]>;
506 //===----------------------------------------------------------------------===//
507 // Symbolic address operands
508 //===----------------------------------------------------------------------===//
510 // PC-relative asm operands.
511 def PCRel12 : PCRelAsmOperand<"12">;
512 def PCRel16 : PCRelAsmOperand<"16">;
513 def PCRel24 : PCRelAsmOperand<"24">;
514 def PCRel32 : PCRelAsmOperand<"32">;
515 def PCRelTLS16 : PCRelTLSAsmOperand<"16">;
516 def PCRelTLS32 : PCRelTLSAsmOperand<"32">;
518 // PC-relative offsets of a basic block. The offset is sign-extended
519 // and multiplied by 2.
520 def brtarget16 : PCRelOperand<OtherVT, PCRel16> {
521 let EncoderMethod = "getPC16DBLEncoding";
522 let DecoderMethod = "decodePC16DBLBranchOperand";
524 def brtarget32 : PCRelOperand<OtherVT, PCRel32> {
525 let EncoderMethod = "getPC32DBLEncoding";
526 let DecoderMethod = "decodePC32DBLBranchOperand";
529 // Variants of brtarget for use with branch prediction preload.
530 def brtarget12bpp : PCRelOperand<OtherVT, PCRel12> {
531 let EncoderMethod = "getPC12DBLBPPEncoding";
532 let DecoderMethod = "decodePC12DBLBranchOperand";
534 def brtarget16bpp : PCRelOperand<OtherVT, PCRel16> {
535 let EncoderMethod = "getPC16DBLBPPEncoding";
536 let DecoderMethod = "decodePC16DBLBranchOperand";
538 def brtarget24bpp : PCRelOperand<OtherVT, PCRel24> {
539 let EncoderMethod = "getPC24DBLBPPEncoding";
540 let DecoderMethod = "decodePC24DBLBranchOperand";
543 // Variants of brtarget16/32 with an optional additional TLS symbol.
544 // These are used to annotate calls to __tls_get_offset.
545 def tlssym : Operand<i64> { }
546 def brtarget16tls : PCRelTLSOperand<OtherVT, PCRelTLS16> {
547 let MIOperandInfo = (ops brtarget16:$func, tlssym:$sym);
548 let EncoderMethod = "getPC16DBLTLSEncoding";
549 let DecoderMethod = "decodePC16DBLBranchOperand";
551 def brtarget32tls : PCRelTLSOperand<OtherVT, PCRelTLS32> {
552 let MIOperandInfo = (ops brtarget32:$func, tlssym:$sym);
553 let EncoderMethod = "getPC32DBLTLSEncoding";
554 let DecoderMethod = "decodePC32DBLBranchOperand";
557 // A PC-relative offset of a global value. The offset is sign-extended
558 // and multiplied by 2.
559 def pcrel32 : PCRelAddress<i64, "pcrel32", PCRel32> {
560 let EncoderMethod = "getPC32DBLEncoding";
561 let DecoderMethod = "decodePC32DBLOperand";
564 //===----------------------------------------------------------------------===//
566 //===----------------------------------------------------------------------===//
568 // 12-bit displacement operands.
569 def disp12imm32 : Operand<i32>;
570 def disp12imm64 : Operand<i64>;
572 // 20-bit displacement operands.
573 def disp20imm32 : Operand<i32>;
574 def disp20imm64 : Operand<i64>;
576 def BDAddr32Disp12 : AddressAsmOperand<"BDAddr", "32", "12">;
577 def BDAddr32Disp20 : AddressAsmOperand<"BDAddr", "32", "20">;
578 def BDAddr64Disp12 : AddressAsmOperand<"BDAddr", "64", "12">;
579 def BDAddr64Disp20 : AddressAsmOperand<"BDAddr", "64", "20">;
580 def BDXAddr64Disp12 : AddressAsmOperand<"BDXAddr", "64", "12">;
581 def BDXAddr64Disp20 : AddressAsmOperand<"BDXAddr", "64", "20">;
582 def BDLAddr64Disp12Len4 : AddressAsmOperand<"BDLAddr", "64", "12", "Len4">;
583 def BDLAddr64Disp12Len8 : AddressAsmOperand<"BDLAddr", "64", "12", "Len8">;
584 def BDRAddr64Disp12 : AddressAsmOperand<"BDRAddr", "64", "12">;
585 def BDVAddr64Disp12 : AddressAsmOperand<"BDVAddr", "64", "12">;
587 // DAG patterns and operands for addressing modes. Each mode has
588 // the form <type><range><group>[<len>] where:
591 // shift : base + displacement (32-bit)
592 // bdaddr : base + displacement
593 // mviaddr : like bdaddr, but reject cases with a natural index
594 // bdxaddr : base + displacement + index
595 // laaddr : like bdxaddr, but used for Load Address operations
596 // dynalloc : base + displacement + index + ADJDYNALLOC
597 // bdladdr : base + displacement with a length field
598 // bdvaddr : base + displacement with a vector index
600 // <range> is one of:
601 // 12 : the displacement is an unsigned 12-bit value
602 // 20 : the displacement is a signed 20-bit value
604 // <group> is one of:
605 // pair : used when there is an equivalent instruction with the opposite
606 // range value (12 or 20)
607 // only : used when there is no equivalent instruction with the opposite
612 // <empty> : there is no length field
613 // len8 : the length field is 8 bits, with a range of [1, 0x100].
614 def shift12only : BDMode <"BDAddr", "32", "12", "Only">;
615 def shift20only : BDMode <"BDAddr", "32", "20", "Only">;
616 def bdaddr12only : BDMode <"BDAddr", "64", "12", "Only">;
617 def bdaddr12pair : BDMode <"BDAddr", "64", "12", "Pair">;
618 def bdaddr20only : BDMode <"BDAddr", "64", "20", "Only">;
619 def bdaddr20pair : BDMode <"BDAddr", "64", "20", "Pair">;
620 def mviaddr12pair : BDMode <"MVIAddr", "64", "12", "Pair">;
621 def mviaddr20pair : BDMode <"MVIAddr", "64", "20", "Pair">;
622 def bdxaddr12only : BDXMode<"BDXAddr", "64", "12", "Only">;
623 def bdxaddr12pair : BDXMode<"BDXAddr", "64", "12", "Pair">;
624 def bdxaddr20only : BDXMode<"BDXAddr", "64", "20", "Only">;
625 def bdxaddr20only128 : BDXMode<"BDXAddr", "64", "20", "Only128">;
626 def bdxaddr20pair : BDXMode<"BDXAddr", "64", "20", "Pair">;
627 def dynalloc12only : BDXMode<"DynAlloc", "64", "12", "Only">;
628 def laaddr12pair : BDXMode<"LAAddr", "64", "12", "Pair">;
629 def laaddr20pair : BDXMode<"LAAddr", "64", "20", "Pair">;
630 def bdladdr12onlylen4 : BDLMode<"BDLAddr", "64", "12", "Only", "4">;
631 def bdladdr12onlylen8 : BDLMode<"BDLAddr", "64", "12", "Only", "8">;
632 def bdraddr12only : BDRMode<"BDRAddr", "64", "12", "Only">;
633 def bdvaddr12only : BDVMode< "64", "12">;
635 //===----------------------------------------------------------------------===//
637 //===----------------------------------------------------------------------===//
639 // A 4-bit condition-code mask.
640 def cond4 : PatLeaf<(i32 imm), [{ return (N->getZExtValue() < 16); }]>,
642 let PrintMethod = "printCond4Operand";