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