1 //===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 // ARM Instruction Format Definitions.
15 // Format specifies the encoding used by the instruction. This is part of the
16 // ad-hoc solution used to emit machine instruction encodings by our machine
18 class Format<bits<6> val> {
22 def Pseudo : Format<0>;
23 def MulFrm : Format<1>;
24 def BrFrm : Format<2>;
25 def BrMiscFrm : Format<3>;
27 def DPFrm : Format<4>;
28 def DPSoRegFrm : Format<5>;
30 def LdFrm : Format<6>;
31 def StFrm : Format<7>;
32 def LdMiscFrm : Format<8>;
33 def StMiscFrm : Format<9>;
34 def LdStMulFrm : Format<10>;
36 def LdStExFrm : Format<11>;
38 def ArithMiscFrm : Format<12>;
39 def SatFrm : Format<13>;
40 def ExtFrm : Format<14>;
42 def VFPUnaryFrm : Format<15>;
43 def VFPBinaryFrm : Format<16>;
44 def VFPConv1Frm : Format<17>;
45 def VFPConv2Frm : Format<18>;
46 def VFPConv3Frm : Format<19>;
47 def VFPConv4Frm : Format<20>;
48 def VFPConv5Frm : Format<21>;
49 def VFPLdStFrm : Format<22>;
50 def VFPLdStMulFrm : Format<23>;
51 def VFPMiscFrm : Format<24>;
53 def ThumbFrm : Format<25>;
54 def MiscFrm : Format<26>;
56 def NGetLnFrm : Format<27>;
57 def NSetLnFrm : Format<28>;
58 def NDupFrm : Format<29>;
59 def NLdStFrm : Format<30>;
60 def N1RegModImmFrm: Format<31>;
61 def N2RegFrm : Format<32>;
62 def NVCVTFrm : Format<33>;
63 def NVDupLnFrm : Format<34>;
64 def N2RegVShLFrm : Format<35>;
65 def N2RegVShRFrm : Format<36>;
66 def N3RegFrm : Format<37>;
67 def N3RegVShFrm : Format<38>;
68 def NVExtFrm : Format<39>;
69 def NVMulSLFrm : Format<40>;
70 def NVTBLFrm : Format<41>;
74 // the instruction has a Rn register operand.
75 // UnaryDP - Indicates this is a unary data processing instruction, i.e.
76 // it doesn't have a Rn operand.
77 class UnaryDP { bit isUnaryDataProc = 1; }
79 // Xform16Bit - Indicates this Thumb2 instruction may be transformed into
80 // a 16-bit Thumb instruction if certain conditions are met.
81 class Xform16Bit { bit canXformTo16Bit = 1; }
83 //===----------------------------------------------------------------------===//
84 // ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
88 class AddrMode<bits<5> val> {
91 def AddrModeNone : AddrMode<0>;
92 def AddrMode1 : AddrMode<1>;
93 def AddrMode2 : AddrMode<2>;
94 def AddrMode3 : AddrMode<3>;
95 def AddrMode4 : AddrMode<4>;
96 def AddrMode5 : AddrMode<5>;
97 def AddrMode6 : AddrMode<6>;
98 def AddrModeT1_1 : AddrMode<7>;
99 def AddrModeT1_2 : AddrMode<8>;
100 def AddrModeT1_4 : AddrMode<9>;
101 def AddrModeT1_s : AddrMode<10>;
102 def AddrModeT2_i12 : AddrMode<11>;
103 def AddrModeT2_i8 : AddrMode<12>;
104 def AddrModeT2_so : AddrMode<13>;
105 def AddrModeT2_pc : AddrMode<14>;
106 def AddrModeT2_i8s4 : AddrMode<15>;
107 def AddrMode_i12 : AddrMode<16>;
110 class SizeFlagVal<bits<3> val> {
113 def SizeInvalid : SizeFlagVal<0>; // Unset.
114 def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
115 def Size8Bytes : SizeFlagVal<2>;
116 def Size4Bytes : SizeFlagVal<3>;
117 def Size2Bytes : SizeFlagVal<4>;
119 // Load / store index mode.
120 class IndexMode<bits<2> val> {
123 def IndexModeNone : IndexMode<0>;
124 def IndexModePre : IndexMode<1>;
125 def IndexModePost : IndexMode<2>;
126 def IndexModeUpd : IndexMode<3>;
128 // Instruction execution domain.
129 class Domain<bits<2> val> {
132 def GenericDomain : Domain<0>;
133 def VFPDomain : Domain<1>; // Instructions in VFP domain only
134 def NeonDomain : Domain<2>; // Instructions in Neon domain only
135 def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
137 //===----------------------------------------------------------------------===//
139 // ARM special operands.
142 def CondCodeOperand : AsmOperandClass {
143 let Name = "CondCode";
144 let SuperClasses = [];
147 // ARM Predicate operand. Default to 14 = always (AL). Second part is CC
148 // register whose default is 0 (no register).
149 def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
150 (ops (i32 14), (i32 zero_reg))> {
151 let PrintMethod = "printPredicateOperand";
152 let ParserMatchClass = CondCodeOperand;
155 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
156 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
157 string EncoderMethod = "getCCOutOpValue";
158 let PrintMethod = "printSBitModifierOperand";
161 // Same as cc_out except it defaults to setting CPSR.
162 def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
163 string EncoderMethod = "getCCOutOpValue";
164 let PrintMethod = "printSBitModifierOperand";
167 // ARM special operands for disassembly only.
169 def setend_op : Operand<i32> {
170 let PrintMethod = "printSetendOperand";
173 def cps_opt : Operand<i32> {
174 let PrintMethod = "printCPSOptionOperand";
177 def msr_mask : Operand<i32> {
178 let PrintMethod = "printMSRMaskOperand";
181 // A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
182 // The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
183 def neg_zero : Operand<i32> {
184 let PrintMethod = "printNegZeroOperand";
187 //===----------------------------------------------------------------------===//
189 // ARM Instruction templates.
192 class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
193 Format f, Domain d, string cstr, InstrItinClass itin>
195 let Namespace = "ARM";
200 bits<2> IndexModeBits = IM.Value;
202 bits<6> Form = F.Value;
204 bit isUnaryDataProc = 0;
205 bit canXformTo16Bit = 0;
207 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
208 let TSFlags{4-0} = AM.Value;
209 let TSFlags{7-5} = SZ.Value;
210 let TSFlags{9-8} = IndexModeBits;
211 let TSFlags{15-10} = Form;
212 let TSFlags{16} = isUnaryDataProc;
213 let TSFlags{17} = canXformTo16Bit;
214 let TSFlags{19-18} = D.Value;
216 let Constraints = cstr;
217 let Itinerary = itin;
224 class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
225 Format f, Domain d, string cstr, InstrItinClass itin>
226 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
228 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
229 // on by adding flavors to specific instructions.
230 class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
231 Format f, Domain d, string cstr, InstrItinClass itin>
232 : InstTemplate<am, sz, im, f, d, cstr, itin>;
234 class PseudoInst<dag oops, dag iops, InstrItinClass itin,
235 string asm, list<dag> pattern>
236 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
238 let OutOperandList = oops;
239 let InOperandList = iops;
241 let Pattern = pattern;
244 // Almost all ARM instructions are predicable.
245 class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
246 IndexMode im, Format f, InstrItinClass itin,
247 string opc, string asm, string cstr,
249 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
252 let OutOperandList = oops;
253 let InOperandList = !con(iops, (ins pred:$p));
254 let AsmString = !strconcat(opc, "${p}", asm);
255 let Pattern = pattern;
256 list<Predicate> Predicates = [IsARM];
259 // A few are not predicable
260 class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
261 IndexMode im, Format f, InstrItinClass itin,
262 string opc, string asm, string cstr,
264 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
265 let OutOperandList = oops;
266 let InOperandList = iops;
267 let AsmString = !strconcat(opc, asm);
268 let Pattern = pattern;
269 let isPredicable = 0;
270 list<Predicate> Predicates = [IsARM];
273 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
274 // operand since by default it's a zero register. It will become an implicit def
275 // once it's "flipped".
276 class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
277 IndexMode im, Format f, InstrItinClass itin,
278 string opc, string asm, string cstr,
280 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
281 bits<4> p; // Predicate operand
282 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
286 let OutOperandList = oops;
287 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
288 let AsmString = !strconcat(opc, "${s}${p}", asm);
289 let Pattern = pattern;
290 list<Predicate> Predicates = [IsARM];
294 class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
295 IndexMode im, Format f, InstrItinClass itin,
296 string asm, string cstr, list<dag> pattern>
297 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
298 let OutOperandList = oops;
299 let InOperandList = iops;
301 let Pattern = pattern;
302 list<Predicate> Predicates = [IsARM];
305 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
306 string opc, string asm, list<dag> pattern>
307 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
308 opc, asm, "", pattern>;
309 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
310 string opc, string asm, list<dag> pattern>
311 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
312 opc, asm, "", pattern>;
313 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
314 string asm, list<dag> pattern>
315 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
317 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
318 string opc, string asm, list<dag> pattern>
319 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
320 opc, asm, "", pattern>;
322 // Ctrl flow instructions
323 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
324 string opc, string asm, list<dag> pattern>
325 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
326 opc, asm, "", pattern> {
327 let Inst{27-24} = opcod;
329 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
330 string asm, list<dag> pattern>
331 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
333 let Inst{27-24} = opcod;
335 class ABXIx2<dag oops, dag iops, InstrItinClass itin,
336 string asm, list<dag> pattern>
337 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
340 // BR_JT instructions
341 class JTI<dag oops, dag iops, InstrItinClass itin,
342 string asm, list<dag> pattern>
343 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
346 // Atomic load/store instructions
347 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
348 string opc, string asm, list<dag> pattern>
349 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
350 opc, asm, "", pattern> {
351 let Inst{27-23} = 0b00011;
352 let Inst{22-21} = opcod;
354 let Inst{11-0} = 0b111110011111;
356 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
357 string opc, string asm, list<dag> pattern>
358 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
359 opc, asm, "", pattern> {
360 let Inst{27-23} = 0b00011;
361 let Inst{22-21} = opcod;
363 let Inst{11-4} = 0b11111001;
366 // addrmode1 instructions
367 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
368 string opc, string asm, list<dag> pattern>
369 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
370 opc, asm, "", pattern> {
371 let Inst{24-21} = opcod;
372 let Inst{27-26} = 0b00;
374 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
375 string opc, string asm, list<dag> pattern>
376 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
377 opc, asm, "", pattern> {
378 let Inst{24-21} = opcod;
379 let Inst{27-26} = 0b00;
381 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
382 string asm, list<dag> pattern>
383 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
385 let Inst{24-21} = opcod;
386 let Inst{27-26} = 0b00;
388 class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
389 string opc, string asm, list<dag> pattern>
390 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
391 opc, asm, "", pattern>;
394 // addrmode2 loads and stores
395 class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
396 string opc, string asm, list<dag> pattern>
397 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
398 opc, asm, "", pattern> {
399 let Inst{27-26} = 0b01;
405 class AIldst1<bits<3> op, bit opc22, bit isLd, dag oops, dag iops, AddrMode am,
406 Format f, InstrItinClass itin, string opc, string asm,
408 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
410 let Inst{27-25} = op;
411 let Inst{24} = 1; // 24 == P
413 let Inst{22} = opc22;
414 let Inst{21} = 0; // 21 == W
417 // LDRH/LDRSB/LDRSH/LDRD
418 class AIldr2<bits<4> op, bit opc22, bit opc20, dag oops, dag iops, AddrMode am,
419 Format f, InstrItinClass itin, string opc, string asm,
421 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
423 let Inst{27-25} = 0b000;
424 let Inst{24} = 1; // 24 == P
426 let Inst{22} = opc22;
427 let Inst{21} = 0; // 21 == W
428 let Inst{20} = opc20;
436 class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
437 string opc, string asm, list<dag> pattern>
438 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
439 opc, asm, "", pattern> {
440 let Inst{20} = 1; // L bit
441 let Inst{21} = 0; // W bit
442 let Inst{22} = 0; // B bit
443 let Inst{24} = 1; // P bit
444 let Inst{27-26} = 0b01;
446 class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
447 string asm, list<dag> pattern>
448 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
450 let Inst{20} = 1; // L bit
451 let Inst{21} = 0; // W bit
452 let Inst{22} = 0; // B bit
453 let Inst{24} = 1; // P bit
454 let Inst{27-26} = 0b01;
456 class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
457 string opc, string asm, list<dag> pattern>
458 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
459 opc, asm, "", pattern> {
460 let Inst{20} = 1; // L bit
461 let Inst{21} = 0; // W bit
462 let Inst{22} = 1; // B bit
463 let Inst{24} = 1; // P bit
464 let Inst{27-26} = 0b01;
466 class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
467 string asm, list<dag> pattern>
468 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
470 let Inst{20} = 1; // L bit
471 let Inst{21} = 0; // W bit
472 let Inst{22} = 1; // B bit
473 let Inst{24} = 1; // P bit
474 let Inst{27-26} = 0b01;
478 class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
479 string opc, string asm, list<dag> pattern>
480 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
481 opc, asm, "", pattern> {
482 let Inst{20} = 0; // L bit
483 let Inst{21} = 0; // W bit
484 let Inst{22} = 0; // B bit
485 let Inst{24} = 1; // P bit
486 let Inst{27-26} = 0b01;
488 class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
489 string asm, list<dag> pattern>
490 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
492 let Inst{20} = 0; // L bit
493 let Inst{21} = 0; // W bit
494 let Inst{22} = 0; // B bit
495 let Inst{24} = 1; // P bit
496 let Inst{27-26} = 0b01;
498 class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
499 string opc, string asm, list<dag> pattern>
500 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
501 opc, asm, "", pattern> {
502 let Inst{20} = 0; // L bit
503 let Inst{21} = 0; // W bit
504 let Inst{22} = 1; // B bit
505 let Inst{24} = 1; // P bit
506 let Inst{27-26} = 0b01;
508 class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
509 string asm, list<dag> pattern>
510 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
512 let Inst{20} = 0; // L bit
513 let Inst{21} = 0; // W bit
514 let Inst{22} = 1; // B bit
515 let Inst{24} = 1; // P bit
516 let Inst{27-26} = 0b01;
520 class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
521 string opc, string asm, string cstr, list<dag> pattern>
522 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
523 opc, asm, cstr, pattern> {
524 let Inst{20} = 1; // L bit
525 let Inst{21} = 1; // W bit
526 let Inst{22} = 0; // B bit
527 let Inst{24} = 1; // P bit
528 let Inst{27-26} = 0b01;
530 class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
531 string opc, string asm, string cstr, list<dag> pattern>
532 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
533 opc, asm, cstr, pattern> {
534 let Inst{20} = 1; // L bit
535 let Inst{21} = 1; // W bit
536 let Inst{22} = 1; // B bit
537 let Inst{24} = 1; // P bit
538 let Inst{27-26} = 0b01;
541 // Pre-indexed stores
542 class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
543 string opc, string asm, string cstr, list<dag> pattern>
544 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
545 opc, asm, cstr, pattern> {
546 let Inst{20} = 0; // L bit
547 let Inst{21} = 1; // W bit
548 let Inst{22} = 0; // B bit
549 let Inst{24} = 1; // P bit
550 let Inst{27-26} = 0b01;
552 class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
553 string opc, string asm, string cstr, list<dag> pattern>
554 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
555 opc, asm, cstr, pattern> {
556 let Inst{20} = 0; // L bit
557 let Inst{21} = 1; // W bit
558 let Inst{22} = 1; // B bit
559 let Inst{24} = 1; // P bit
560 let Inst{27-26} = 0b01;
563 // Post-indexed loads
564 class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
565 string opc, string asm, string cstr, list<dag> pattern>
566 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
567 opc, asm, cstr,pattern> {
568 let Inst{20} = 1; // L bit
569 let Inst{21} = 0; // W bit
570 let Inst{22} = 0; // B bit
571 let Inst{24} = 0; // P bit
572 let Inst{27-26} = 0b01;
574 class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
575 string opc, string asm, string cstr, list<dag> pattern>
576 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
577 opc, asm, cstr,pattern> {
578 let Inst{20} = 1; // L bit
579 let Inst{21} = 0; // W bit
580 let Inst{22} = 1; // B bit
581 let Inst{24} = 0; // P bit
582 let Inst{27-26} = 0b01;
585 // Post-indexed stores
586 class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
587 string opc, string asm, string cstr, list<dag> pattern>
588 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
589 opc, asm, cstr,pattern> {
590 let Inst{20} = 0; // L bit
591 let Inst{21} = 0; // W bit
592 let Inst{22} = 0; // B bit
593 let Inst{24} = 0; // P bit
594 let Inst{27-26} = 0b01;
596 class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
597 string opc, string asm, string cstr, list<dag> pattern>
598 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
599 opc, asm, cstr,pattern> {
600 let Inst{20} = 0; // L bit
601 let Inst{21} = 0; // W bit
602 let Inst{22} = 1; // B bit
603 let Inst{24} = 0; // P bit
604 let Inst{27-26} = 0b01;
607 // addrmode3 instructions
608 class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
609 string opc, string asm, list<dag> pattern>
610 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
611 opc, asm, "", pattern>;
612 class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
613 string asm, list<dag> pattern>
614 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
618 class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
619 string opc, string asm, list<dag> pattern>
620 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
621 opc, asm, "", pattern> {
623 let Inst{5} = 1; // H bit
624 let Inst{6} = 0; // S bit
626 let Inst{20} = 1; // L bit
627 let Inst{21} = 0; // W bit
628 let Inst{24} = 1; // P bit
629 let Inst{27-25} = 0b000;
631 class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
632 string asm, list<dag> pattern>
633 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
636 let Inst{5} = 1; // H bit
637 let Inst{6} = 0; // S bit
639 let Inst{20} = 1; // L bit
640 let Inst{21} = 0; // W bit
641 let Inst{24} = 1; // P bit
643 class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
644 string opc, string asm, list<dag> pattern>
645 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
646 opc, asm, "", pattern> {
648 let Inst{5} = 1; // H bit
649 let Inst{6} = 1; // S bit
651 let Inst{20} = 1; // L bit
652 let Inst{21} = 0; // W bit
653 let Inst{24} = 1; // P bit
654 let Inst{27-25} = 0b000;
656 class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
657 string asm, list<dag> pattern>
658 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
661 let Inst{5} = 1; // H bit
662 let Inst{6} = 1; // S bit
664 let Inst{20} = 1; // L bit
665 let Inst{21} = 0; // W bit
666 let Inst{24} = 1; // P bit
668 class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
669 string opc, string asm, list<dag> pattern>
670 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
671 opc, asm, "", pattern> {
673 let Inst{5} = 0; // H bit
674 let Inst{6} = 1; // S bit
676 let Inst{20} = 1; // L bit
677 let Inst{21} = 0; // W bit
678 let Inst{24} = 1; // P bit
679 let Inst{27-25} = 0b000;
681 class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
682 string asm, list<dag> pattern>
683 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
686 let Inst{5} = 0; // H bit
687 let Inst{6} = 1; // S bit
689 let Inst{20} = 1; // L bit
690 let Inst{21} = 0; // W bit
691 let Inst{24} = 1; // P bit
693 class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
694 string opc, string asm, list<dag> pattern>
695 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
696 opc, asm, "", pattern> {
698 let Inst{5} = 0; // H bit
699 let Inst{6} = 1; // S bit
701 let Inst{20} = 0; // L bit
702 let Inst{21} = 0; // W bit
703 let Inst{24} = 1; // P bit
704 let Inst{27-25} = 0b000;
708 class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
709 string opc, string asm, list<dag> pattern>
710 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
711 opc, asm, "", pattern> {
713 let Inst{5} = 1; // H bit
714 let Inst{6} = 0; // S bit
716 let Inst{20} = 0; // L bit
717 let Inst{21} = 0; // W bit
718 let Inst{24} = 1; // P bit
719 let Inst{27-25} = 0b000;
721 class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
722 string asm, list<dag> pattern>
723 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
726 let Inst{5} = 1; // H bit
727 let Inst{6} = 0; // S bit
729 let Inst{20} = 0; // L bit
730 let Inst{21} = 0; // W bit
731 let Inst{24} = 1; // P bit
733 class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
734 string opc, string asm, list<dag> pattern>
735 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
736 opc, asm, "", pattern> {
738 let Inst{5} = 1; // H bit
739 let Inst{6} = 1; // S bit
741 let Inst{20} = 0; // L bit
742 let Inst{21} = 0; // W bit
743 let Inst{24} = 1; // P bit
744 let Inst{27-25} = 0b000;
748 class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
749 string opc, string asm, string cstr, list<dag> pattern>
750 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
751 opc, asm, cstr, pattern> {
753 let Inst{5} = 1; // H bit
754 let Inst{6} = 0; // S bit
756 let Inst{20} = 1; // L bit
757 let Inst{21} = 1; // W bit
758 let Inst{24} = 1; // P bit
759 let Inst{27-25} = 0b000;
761 class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
762 string opc, string asm, string cstr, list<dag> pattern>
763 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
764 opc, asm, cstr, pattern> {
766 let Inst{5} = 1; // H bit
767 let Inst{6} = 1; // S bit
769 let Inst{20} = 1; // L bit
770 let Inst{21} = 1; // W bit
771 let Inst{24} = 1; // P bit
772 let Inst{27-25} = 0b000;
774 class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
775 string opc, string asm, string cstr, list<dag> pattern>
776 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
777 opc, asm, cstr, pattern> {
779 let Inst{5} = 0; // H bit
780 let Inst{6} = 1; // S bit
782 let Inst{20} = 1; // L bit
783 let Inst{21} = 1; // W bit
784 let Inst{24} = 1; // P bit
785 let Inst{27-25} = 0b000;
787 class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
788 string opc, string asm, string cstr, list<dag> pattern>
789 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
790 opc, asm, cstr, pattern> {
792 let Inst{5} = 0; // H bit
793 let Inst{6} = 1; // S bit
795 let Inst{20} = 0; // L bit
796 let Inst{21} = 1; // W bit
797 let Inst{24} = 1; // P bit
798 let Inst{27-25} = 0b000;
802 // Pre-indexed stores
803 class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
804 string opc, string asm, string cstr, list<dag> pattern>
805 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
806 opc, asm, cstr, pattern> {
808 let Inst{5} = 1; // H bit
809 let Inst{6} = 0; // S bit
811 let Inst{20} = 0; // L bit
812 let Inst{21} = 1; // W bit
813 let Inst{24} = 1; // P bit
814 let Inst{27-25} = 0b000;
816 class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
817 string opc, string asm, string cstr, list<dag> pattern>
818 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
819 opc, asm, cstr, pattern> {
821 let Inst{5} = 1; // H bit
822 let Inst{6} = 1; // S bit
824 let Inst{20} = 0; // L bit
825 let Inst{21} = 1; // W bit
826 let Inst{24} = 1; // P bit
827 let Inst{27-25} = 0b000;
830 // Post-indexed loads
831 class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
832 string opc, string asm, string cstr, list<dag> pattern>
833 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
834 opc, asm, cstr,pattern> {
836 let Inst{5} = 1; // H bit
837 let Inst{6} = 0; // S bit
839 let Inst{20} = 1; // L bit
840 let Inst{21} = 0; // W bit
841 let Inst{24} = 0; // P bit
842 let Inst{27-25} = 0b000;
844 class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
845 string opc, string asm, string cstr, list<dag> pattern>
846 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
847 opc, asm, cstr,pattern> {
849 let Inst{5} = 1; // H bit
850 let Inst{6} = 1; // S bit
852 let Inst{20} = 1; // L bit
853 let Inst{21} = 0; // W bit
854 let Inst{24} = 0; // P bit
855 let Inst{27-25} = 0b000;
857 class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
858 string opc, string asm, string cstr, list<dag> pattern>
859 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
860 opc, asm, cstr,pattern> {
862 let Inst{5} = 0; // H bit
863 let Inst{6} = 1; // S bit
865 let Inst{20} = 1; // L bit
866 let Inst{21} = 0; // W bit
867 let Inst{24} = 0; // P bit
868 let Inst{27-25} = 0b000;
870 class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
871 string opc, string asm, string cstr, list<dag> pattern>
872 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
873 opc, asm, cstr, pattern> {
875 let Inst{5} = 0; // H bit
876 let Inst{6} = 1; // S bit
878 let Inst{20} = 0; // L bit
879 let Inst{21} = 0; // W bit
880 let Inst{24} = 0; // P bit
881 let Inst{27-25} = 0b000;
884 // Post-indexed stores
885 class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
886 string opc, string asm, string cstr, list<dag> pattern>
887 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
888 opc, asm, cstr,pattern> {
890 let Inst{5} = 1; // H bit
891 let Inst{6} = 0; // S bit
893 let Inst{20} = 0; // L bit
894 let Inst{21} = 0; // W bit
895 let Inst{24} = 0; // P bit
896 let Inst{27-25} = 0b000;
898 class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
899 string opc, string asm, string cstr, list<dag> pattern>
900 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
901 opc, asm, cstr, pattern> {
903 let Inst{5} = 1; // H bit
904 let Inst{6} = 1; // S bit
906 let Inst{20} = 0; // L bit
907 let Inst{21} = 0; // W bit
908 let Inst{24} = 0; // P bit
909 let Inst{27-25} = 0b000;
912 // addrmode4 instructions
913 class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
914 string asm, string cstr, list<dag> pattern>
915 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
916 asm, cstr, pattern> {
917 let Inst{20} = 1; // L bit
918 let Inst{22} = 0; // S bit
919 let Inst{27-25} = 0b100;
921 class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
922 string asm, string cstr, list<dag> pattern>
923 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
924 asm, cstr, pattern> {
925 let Inst{20} = 0; // L bit
926 let Inst{22} = 0; // S bit
927 let Inst{27-25} = 0b100;
930 // Unsigned multiply, multiply-accumulate instructions.
931 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
932 string opc, string asm, list<dag> pattern>
933 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
934 opc, asm, "", pattern> {
935 let Inst{7-4} = 0b1001;
936 let Inst{20} = 0; // S bit
937 let Inst{27-21} = opcod;
939 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
940 string opc, string asm, list<dag> pattern>
941 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
942 opc, asm, "", pattern> {
943 let Inst{7-4} = 0b1001;
944 let Inst{27-21} = opcod;
947 // Most significant word multiply
948 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
949 InstrItinClass itin, string opc, string asm, list<dag> pattern>
950 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
951 opc, asm, "", pattern> {
955 let Inst{7-4} = opc7_4;
957 let Inst{27-21} = opcod;
958 let Inst{19-16} = Rd;
962 // MSW multiple w/ Ra operand
963 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
964 InstrItinClass itin, string opc, string asm, list<dag> pattern>
965 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
967 let Inst{15-12} = Ra;
970 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
971 class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
972 InstrItinClass itin, string opc, string asm, list<dag> pattern>
973 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
974 opc, asm, "", pattern> {
980 let Inst{27-21} = opcod;
981 let Inst{6-5} = bit6_5;
985 class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
986 InstrItinClass itin, string opc, string asm, list<dag> pattern>
987 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
989 let Inst{19-16} = Rd;
992 // AMulxyI with Ra operand
993 class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
994 InstrItinClass itin, string opc, string asm, list<dag> pattern>
995 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
997 let Inst{15-12} = Ra;
1000 class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
1001 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1002 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
1005 let Inst{19-16} = RdHi;
1006 let Inst{15-12} = RdLo;
1009 // Extend instructions.
1010 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1011 string opc, string asm, list<dag> pattern>
1012 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
1013 opc, asm, "", pattern> {
1014 // All AExtI instructions have Rd and Rm register operands.
1017 let Inst{15-12} = Rd;
1019 let Inst{7-4} = 0b0111;
1020 let Inst{9-8} = 0b00;
1021 let Inst{27-20} = opcod;
1024 // Misc Arithmetic instructions.
1025 class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
1026 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1027 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1028 opc, asm, "", pattern> {
1031 let Inst{27-20} = opcod;
1032 let Inst{19-16} = 0b1111;
1033 let Inst{15-12} = Rd;
1034 let Inst{11-8} = 0b1111;
1035 let Inst{7-4} = opc7_4;
1040 class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
1041 string opc, string asm, list<dag> pattern>
1042 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1043 opc, asm, "", pattern> {
1048 let Inst{27-20} = opcod;
1049 let Inst{19-16} = Rn;
1050 let Inst{15-12} = Rd;
1051 let Inst{11-7} = sh{7-3};
1053 let Inst{5-4} = 0b01;
1057 //===----------------------------------------------------------------------===//
1059 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
1060 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
1061 list<Predicate> Predicates = [IsARM];
1063 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
1064 list<Predicate> Predicates = [IsARM, HasV5TE];
1066 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
1067 list<Predicate> Predicates = [IsARM, HasV6];
1070 //===----------------------------------------------------------------------===//
1072 // Thumb Instruction Format Definitions.
1075 // TI - Thumb instruction.
1077 class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1078 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
1079 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1080 let OutOperandList = oops;
1081 let InOperandList = iops;
1082 let AsmString = asm;
1083 let Pattern = pattern;
1084 list<Predicate> Predicates = [IsThumb];
1087 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1088 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1090 // Two-address instructions
1091 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
1093 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
1096 // tBL, tBX 32-bit instructions
1097 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
1098 dag oops, dag iops, InstrItinClass itin, string asm,
1100 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
1102 let Inst{31-27} = opcod1;
1103 let Inst{15-14} = opcod2;
1104 let Inst{12} = opcod3;
1107 // BR_JT instructions
1108 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1110 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
1113 class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1114 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
1115 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1116 let OutOperandList = oops;
1117 let InOperandList = iops;
1118 let AsmString = asm;
1119 let Pattern = pattern;
1120 list<Predicate> Predicates = [IsThumb1Only];
1123 class T1I<dag oops, dag iops, InstrItinClass itin,
1124 string asm, list<dag> pattern>
1125 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1126 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1127 string asm, list<dag> pattern>
1128 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1129 class T1JTI<dag oops, dag iops, InstrItinClass itin,
1130 string asm, list<dag> pattern>
1131 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
1133 // Two-address instructions
1134 class T1It<dag oops, dag iops, InstrItinClass itin,
1135 string asm, string cstr, list<dag> pattern>
1136 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
1137 asm, cstr, pattern>;
1139 // Thumb1 instruction that can either be predicated or set CPSR.
1140 class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1141 InstrItinClass itin,
1142 string opc, string asm, string cstr, list<dag> pattern>
1143 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1144 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1145 let InOperandList = !con(iops, (ins pred:$p));
1146 let AsmString = !strconcat(opc, "${s}${p}", asm);
1147 let Pattern = pattern;
1148 list<Predicate> Predicates = [IsThumb1Only];
1151 class T1sI<dag oops, dag iops, InstrItinClass itin,
1152 string opc, string asm, list<dag> pattern>
1153 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
1155 // Two-address instructions
1156 class T1sIt<dag oops, dag iops, InstrItinClass itin,
1157 string opc, string asm, list<dag> pattern>
1158 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
1159 "$lhs = $dst", pattern>;
1161 // Thumb1 instruction that can be predicated.
1162 class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1163 InstrItinClass itin,
1164 string opc, string asm, string cstr, list<dag> pattern>
1165 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1166 let OutOperandList = oops;
1167 let InOperandList = !con(iops, (ins pred:$p));
1168 let AsmString = !strconcat(opc, "${p}", asm);
1169 let Pattern = pattern;
1170 list<Predicate> Predicates = [IsThumb1Only];
1173 class T1pI<dag oops, dag iops, InstrItinClass itin,
1174 string opc, string asm, list<dag> pattern>
1175 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
1177 // Two-address instructions
1178 class T1pIt<dag oops, dag iops, InstrItinClass itin,
1179 string opc, string asm, list<dag> pattern>
1180 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
1181 "$lhs = $dst", pattern>;
1183 class T1pI1<dag oops, dag iops, InstrItinClass itin,
1184 string opc, string asm, list<dag> pattern>
1185 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1186 class T1pI2<dag oops, dag iops, InstrItinClass itin,
1187 string opc, string asm, list<dag> pattern>
1188 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1189 class T1pI4<dag oops, dag iops, InstrItinClass itin,
1190 string opc, string asm, list<dag> pattern>
1191 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1192 class T1pIs<dag oops, dag iops,
1193 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1194 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
1196 class Encoding16 : Encoding {
1197 let Inst{31-16} = 0x0000;
1200 // A6.2 16-bit Thumb instruction encoding
1201 class T1Encoding<bits<6> opcode> : Encoding16 {
1202 let Inst{15-10} = opcode;
1205 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
1206 class T1General<bits<5> opcode> : Encoding16 {
1207 let Inst{15-14} = 0b00;
1208 let Inst{13-9} = opcode;
1211 // A6.2.2 Data-processing encoding.
1212 class T1DataProcessing<bits<4> opcode> : Encoding16 {
1213 let Inst{15-10} = 0b010000;
1214 let Inst{9-6} = opcode;
1217 // A6.2.3 Special data instructions and branch and exchange encoding.
1218 class T1Special<bits<4> opcode> : Encoding16 {
1219 let Inst{15-10} = 0b010001;
1220 let Inst{9-6} = opcode;
1223 // A6.2.4 Load/store single data item encoding.
1224 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
1225 let Inst{15-12} = opA;
1226 let Inst{11-9} = opB;
1228 class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1229 class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1230 class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1231 class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1232 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1234 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1235 class T1Misc<bits<7> opcode> : Encoding16 {
1236 let Inst{15-12} = 0b1011;
1237 let Inst{11-5} = opcode;
1240 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1241 class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1242 InstrItinClass itin,
1243 string opc, string asm, string cstr, list<dag> pattern>
1244 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1245 let OutOperandList = oops;
1246 let InOperandList = !con(iops, (ins pred:$p));
1247 let AsmString = !strconcat(opc, "${p}", asm);
1248 let Pattern = pattern;
1249 list<Predicate> Predicates = [IsThumb2];
1252 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1253 // input operand since by default it's a zero register. It will become an
1254 // implicit def once it's "flipped".
1256 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1258 class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1259 InstrItinClass itin,
1260 string opc, string asm, string cstr, list<dag> pattern>
1261 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1262 let OutOperandList = oops;
1263 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1264 let AsmString = !strconcat(opc, "${s}${p}", asm);
1265 let Pattern = pattern;
1266 list<Predicate> Predicates = [IsThumb2];
1270 class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1271 InstrItinClass itin,
1272 string asm, string cstr, list<dag> pattern>
1273 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1274 let OutOperandList = oops;
1275 let InOperandList = iops;
1276 let AsmString = asm;
1277 let Pattern = pattern;
1278 list<Predicate> Predicates = [IsThumb2];
1281 class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1282 InstrItinClass itin,
1283 string asm, string cstr, list<dag> pattern>
1284 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1285 let OutOperandList = oops;
1286 let InOperandList = iops;
1287 let AsmString = asm;
1288 let Pattern = pattern;
1289 list<Predicate> Predicates = [IsThumb1Only];
1292 class T2I<dag oops, dag iops, InstrItinClass itin,
1293 string opc, string asm, list<dag> pattern>
1294 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1295 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1296 string opc, string asm, list<dag> pattern>
1297 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
1298 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1299 string opc, string asm, list<dag> pattern>
1300 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1301 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1302 string opc, string asm, list<dag> pattern>
1303 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1304 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1305 string opc, string asm, list<dag> pattern>
1306 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
1307 class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
1308 string opc, string asm, list<dag> pattern>
1309 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1311 let Inst{31-27} = 0b11101;
1312 let Inst{26-25} = 0b00;
1314 let Inst{23} = ?; // The U bit.
1317 let Inst{20} = load;
1320 class T2sI<dag oops, dag iops, InstrItinClass itin,
1321 string opc, string asm, list<dag> pattern>
1322 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1324 class T2XI<dag oops, dag iops, InstrItinClass itin,
1325 string asm, list<dag> pattern>
1326 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1327 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1328 string asm, list<dag> pattern>
1329 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
1331 class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1332 string opc, string asm, list<dag> pattern>
1333 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1335 // Two-address instructions
1336 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1337 string asm, string cstr, list<dag> pattern>
1338 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
1340 // T2Iidxldst - Thumb2 indexed load / store instructions.
1341 class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1343 AddrMode am, IndexMode im, InstrItinClass itin,
1344 string opc, string asm, string cstr, list<dag> pattern>
1345 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
1346 let OutOperandList = oops;
1347 let InOperandList = !con(iops, (ins pred:$p));
1348 let AsmString = !strconcat(opc, "${p}", asm);
1349 let Pattern = pattern;
1350 list<Predicate> Predicates = [IsThumb2];
1351 let Inst{31-27} = 0b11111;
1352 let Inst{26-25} = 0b00;
1353 let Inst{24} = signed;
1355 let Inst{22-21} = opcod;
1356 let Inst{20} = load;
1358 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1359 let Inst{10} = pre; // The P bit.
1360 let Inst{8} = 1; // The W bit.
1363 // Helper class for disassembly only
1364 // A6.3.16 & A6.3.17
1365 // T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1366 class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1367 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1368 : T2I<oops, iops, itin, opc, asm, pattern> {
1369 let Inst{31-27} = 0b11111;
1370 let Inst{26-24} = 0b011;
1371 let Inst{23} = long;
1372 let Inst{22-20} = op22_20;
1373 let Inst{7-4} = op7_4;
1376 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1377 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1378 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1381 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1382 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1383 list<Predicate> Predicates = [IsThumb1Only];
1386 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1387 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1388 list<Predicate> Predicates = [IsThumb2];
1391 //===----------------------------------------------------------------------===//
1393 //===----------------------------------------------------------------------===//
1394 // ARM VFP Instruction templates.
1397 // Almost all VFP instructions are predicable.
1398 class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1399 IndexMode im, Format f, InstrItinClass itin,
1400 string opc, string asm, string cstr, list<dag> pattern>
1401 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1403 let Inst{31-28} = p;
1404 let OutOperandList = oops;
1405 let InOperandList = !con(iops, (ins pred:$p));
1406 let AsmString = !strconcat(opc, "${p}", asm);
1407 let Pattern = pattern;
1408 list<Predicate> Predicates = [HasVFP2];
1412 class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1413 IndexMode im, Format f, InstrItinClass itin,
1414 string asm, string cstr, list<dag> pattern>
1415 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1416 let OutOperandList = oops;
1417 let InOperandList = iops;
1418 let AsmString = asm;
1419 let Pattern = pattern;
1420 list<Predicate> Predicates = [HasVFP2];
1423 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1424 string opc, string asm, list<dag> pattern>
1425 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1426 opc, asm, "", pattern>;
1428 // ARM VFP addrmode5 loads and stores
1429 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1430 InstrItinClass itin,
1431 string opc, string asm, list<dag> pattern>
1432 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
1433 VFPLdStFrm, itin, opc, asm, "", pattern> {
1434 // TODO: Mark the instructions with the appropriate subtarget info.
1435 let Inst{27-24} = opcod1;
1436 let Inst{21-20} = opcod2;
1437 let Inst{11-9} = 0b101;
1438 let Inst{8} = 1; // Double precision
1440 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1441 let D = VFPNeonDomain;
1444 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1445 InstrItinClass itin,
1446 string opc, string asm, list<dag> pattern>
1447 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
1448 VFPLdStFrm, itin, opc, asm, "", pattern> {
1449 // TODO: Mark the instructions with the appropriate subtarget info.
1450 let Inst{27-24} = opcod1;
1451 let Inst{21-20} = opcod2;
1452 let Inst{11-9} = 0b101;
1453 let Inst{8} = 0; // Single precision
1456 // VFP Load / store multiple pseudo instructions.
1457 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1459 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1461 let OutOperandList = oops;
1462 let InOperandList = !con(iops, (ins pred:$p));
1463 let Pattern = pattern;
1464 list<Predicate> Predicates = [HasVFP2];
1467 // Load / store multiple
1468 class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1469 string asm, string cstr, list<dag> pattern>
1470 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
1471 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1472 // TODO: Mark the instructions with the appropriate subtarget info.
1473 let Inst{27-25} = 0b110;
1474 let Inst{11-9} = 0b101;
1475 let Inst{8} = 1; // Double precision
1477 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1478 let D = VFPNeonDomain;
1481 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1482 string asm, string cstr, list<dag> pattern>
1483 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
1484 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1485 // TODO: Mark the instructions with the appropriate subtarget info.
1486 let Inst{27-25} = 0b110;
1487 let Inst{11-9} = 0b101;
1488 let Inst{8} = 0; // Single precision
1491 // Double precision, unary
1492 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1493 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1494 string asm, list<dag> pattern>
1495 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1496 let Inst{27-23} = opcod1;
1497 let Inst{21-20} = opcod2;
1498 let Inst{19-16} = opcod3;
1499 let Inst{11-9} = 0b101;
1500 let Inst{8} = 1; // Double precision
1501 let Inst{7-6} = opcod4;
1502 let Inst{4} = opcod5;
1505 // Double precision, binary
1506 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1507 dag iops, InstrItinClass itin, string opc, string asm,
1509 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1510 let Inst{27-23} = opcod1;
1511 let Inst{21-20} = opcod2;
1512 let Inst{11-9} = 0b101;
1513 let Inst{8} = 1; // Double precision
1518 // Double precision, binary, VML[AS] (for additional predicate)
1519 class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1520 dag iops, InstrItinClass itin, string opc, string asm,
1522 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1523 let Inst{27-23} = opcod1;
1524 let Inst{21-20} = opcod2;
1525 let Inst{11-9} = 0b101;
1526 let Inst{8} = 1; // Double precision
1529 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1532 // Single precision, unary
1533 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1534 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1535 string asm, list<dag> pattern>
1536 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1537 let Inst{27-23} = opcod1;
1538 let Inst{21-20} = opcod2;
1539 let Inst{19-16} = opcod3;
1540 let Inst{11-9} = 0b101;
1541 let Inst{8} = 0; // Single precision
1542 let Inst{7-6} = opcod4;
1543 let Inst{4} = opcod5;
1546 // Single precision unary, if no NEON
1547 // Same as ASuI except not available if NEON is enabled
1548 class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1549 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1550 string asm, list<dag> pattern>
1551 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1553 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1556 // Single precision, binary
1557 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1558 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1559 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1560 let Inst{27-23} = opcod1;
1561 let Inst{21-20} = opcod2;
1562 let Inst{11-9} = 0b101;
1563 let Inst{8} = 0; // Single precision
1568 // Single precision binary, if no NEON
1569 // Same as ASbI except not available if NEON is enabled
1570 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1571 dag iops, InstrItinClass itin, string opc, string asm,
1573 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1574 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1577 // VFP conversion instructions
1578 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1579 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1581 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1582 let Inst{27-23} = opcod1;
1583 let Inst{21-20} = opcod2;
1584 let Inst{19-16} = opcod3;
1585 let Inst{11-8} = opcod4;
1590 // VFP conversion between floating-point and fixed-point
1591 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1592 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1594 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1595 // size (fixed-point number): sx == 0 ? 16 : 32
1596 let Inst{7} = op5; // sx
1599 // VFP conversion instructions, if no NEON
1600 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1601 dag oops, dag iops, InstrItinClass itin,
1602 string opc, string asm, list<dag> pattern>
1603 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1605 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1608 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1609 InstrItinClass itin,
1610 string opc, string asm, list<dag> pattern>
1611 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1612 let Inst{27-20} = opcod1;
1613 let Inst{11-8} = opcod2;
1617 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1618 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1619 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1621 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1622 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1623 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1625 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1626 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1627 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1629 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1630 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1631 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1633 //===----------------------------------------------------------------------===//
1635 //===----------------------------------------------------------------------===//
1636 // ARM NEON Instruction templates.
1639 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1640 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1642 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
1643 let OutOperandList = oops;
1644 let InOperandList = !con(iops, (ins pred:$p));
1645 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1646 let Pattern = pattern;
1647 list<Predicate> Predicates = [HasNEON];
1650 // Same as NeonI except it does not have a "data type" specifier.
1651 class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1652 InstrItinClass itin, string opc, string asm, string cstr,
1654 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
1655 let OutOperandList = oops;
1656 let InOperandList = !con(iops, (ins pred:$p));
1657 let AsmString = !strconcat(opc, "${p}", "\t", asm);
1658 let Pattern = pattern;
1659 list<Predicate> Predicates = [HasNEON];
1662 class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1663 dag oops, dag iops, InstrItinClass itin,
1664 string opc, string dt, string asm, string cstr, list<dag> pattern>
1665 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1667 let Inst{31-24} = 0b11110100;
1668 let Inst{23} = op23;
1669 let Inst{21-20} = op21_20;
1670 let Inst{11-8} = op11_8;
1671 let Inst{7-4} = op7_4;
1674 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1675 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1677 let OutOperandList = oops;
1678 let InOperandList = !con(iops, (ins pred:$p));
1679 list<Predicate> Predicates = [HasNEON];
1682 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1684 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1686 let OutOperandList = oops;
1687 let InOperandList = !con(iops, (ins pred:$p));
1688 let Pattern = pattern;
1689 list<Predicate> Predicates = [HasNEON];
1692 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1693 string opc, string dt, string asm, string cstr, list<dag> pattern>
1694 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1696 let Inst{31-25} = 0b1111001;
1699 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1700 string opc, string asm, string cstr, list<dag> pattern>
1701 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1703 let Inst{31-25} = 0b1111001;
1706 // NEON "one register and a modified immediate" format.
1707 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1709 dag oops, dag iops, InstrItinClass itin,
1710 string opc, string dt, string asm, string cstr,
1712 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1713 let Inst{23} = op23;
1714 let Inst{21-19} = op21_19;
1715 let Inst{11-8} = op11_8;
1721 // Instruction operands.
1725 let Inst{15-12} = Vd{3-0};
1726 let Inst{22} = Vd{4};
1727 let Inst{24} = SIMM{7};
1728 let Inst{18-16} = SIMM{6-4};
1729 let Inst{3-0} = SIMM{3-0};
1732 // NEON 2 vector register format.
1733 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1734 bits<5> op11_7, bit op6, bit op4,
1735 dag oops, dag iops, InstrItinClass itin,
1736 string opc, string dt, string asm, string cstr, list<dag> pattern>
1737 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1738 let Inst{24-23} = op24_23;
1739 let Inst{21-20} = op21_20;
1740 let Inst{19-18} = op19_18;
1741 let Inst{17-16} = op17_16;
1742 let Inst{11-7} = op11_7;
1746 // Instruction operands.
1750 let Inst{15-12} = Vd{3-0};
1751 let Inst{22} = Vd{4};
1752 let Inst{3-0} = Vm{3-0};
1753 let Inst{5} = Vm{4};
1756 // Same as N2V except it doesn't have a datatype suffix.
1757 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1758 bits<5> op11_7, bit op6, bit op4,
1759 dag oops, dag iops, InstrItinClass itin,
1760 string opc, string asm, string cstr, list<dag> pattern>
1761 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1762 let Inst{24-23} = op24_23;
1763 let Inst{21-20} = op21_20;
1764 let Inst{19-18} = op19_18;
1765 let Inst{17-16} = op17_16;
1766 let Inst{11-7} = op11_7;
1770 // Instruction operands.
1774 let Inst{15-12} = Vd{3-0};
1775 let Inst{22} = Vd{4};
1776 let Inst{3-0} = Vm{3-0};
1777 let Inst{5} = Vm{4};
1780 // NEON 2 vector register with immediate.
1781 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1782 dag oops, dag iops, Format f, InstrItinClass itin,
1783 string opc, string dt, string asm, string cstr, list<dag> pattern>
1784 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1785 let Inst{24} = op24;
1786 let Inst{23} = op23;
1787 let Inst{11-8} = op11_8;
1792 // Instruction operands.
1797 let Inst{15-12} = Vd{3-0};
1798 let Inst{22} = Vd{4};
1799 let Inst{3-0} = Vm{3-0};
1800 let Inst{5} = Vm{4};
1801 let Inst{21-16} = SIMM{5-0};
1804 // NEON 3 vector register format.
1805 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1806 dag oops, dag iops, Format f, InstrItinClass itin,
1807 string opc, string dt, string asm, string cstr, list<dag> pattern>
1808 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1809 let Inst{24} = op24;
1810 let Inst{23} = op23;
1811 let Inst{21-20} = op21_20;
1812 let Inst{11-8} = op11_8;
1816 // Instruction operands.
1821 let Inst{15-12} = Vd{3-0};
1822 let Inst{22} = Vd{4};
1823 let Inst{19-16} = Vn{3-0};
1824 let Inst{7} = Vn{4};
1825 let Inst{3-0} = Vm{3-0};
1826 let Inst{5} = Vm{4};
1829 // Same as N3V except it doesn't have a data type suffix.
1830 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1832 dag oops, dag iops, Format f, InstrItinClass itin,
1833 string opc, string asm, string cstr, list<dag> pattern>
1834 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1835 let Inst{24} = op24;
1836 let Inst{23} = op23;
1837 let Inst{21-20} = op21_20;
1838 let Inst{11-8} = op11_8;
1842 // Instruction operands.
1847 let Inst{15-12} = Vd{3-0};
1848 let Inst{22} = Vd{4};
1849 let Inst{19-16} = Vn{3-0};
1850 let Inst{7} = Vn{4};
1851 let Inst{3-0} = Vm{3-0};
1852 let Inst{5} = Vm{4};
1855 // NEON VMOVs between scalar and core registers.
1856 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1857 dag oops, dag iops, Format f, InstrItinClass itin,
1858 string opc, string dt, string asm, list<dag> pattern>
1859 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, NeonDomain,
1861 let Inst{27-20} = opcod1;
1862 let Inst{11-8} = opcod2;
1863 let Inst{6-5} = opcod3;
1866 let OutOperandList = oops;
1867 let InOperandList = !con(iops, (ins pred:$p));
1868 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1869 let Pattern = pattern;
1870 list<Predicate> Predicates = [HasNEON];
1877 let Inst{31-28} = p{3-0};
1879 let Inst{19-16} = V{3-0};
1880 let Inst{15-12} = R{3-0};
1882 class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1883 dag oops, dag iops, InstrItinClass itin,
1884 string opc, string dt, string asm, list<dag> pattern>
1885 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
1886 opc, dt, asm, pattern>;
1887 class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1888 dag oops, dag iops, InstrItinClass itin,
1889 string opc, string dt, string asm, list<dag> pattern>
1890 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
1891 opc, dt, asm, pattern>;
1892 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1893 dag oops, dag iops, InstrItinClass itin,
1894 string opc, string dt, string asm, list<dag> pattern>
1895 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1896 opc, dt, asm, pattern>;
1898 // Vector Duplicate Lane (from scalar to all elements)
1899 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1900 InstrItinClass itin, string opc, string dt, string asm,
1902 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1903 let Inst{24-23} = 0b11;
1904 let Inst{21-20} = 0b11;
1905 let Inst{19-16} = op19_16;
1906 let Inst{11-7} = 0b11000;
1914 let Inst{22} = Vd{4};
1915 let Inst{15-12} = Vd{3-0};
1916 let Inst{5} = Vm{4};
1917 let Inst{3-0} = Vm{3-0};
1920 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1921 // for single-precision FP.
1922 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1923 list<Predicate> Predicates = [HasNEON,UseNEONForFP];