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 DPSoRegRegFrm : 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>;
71 def DPSoRegImmFrm : Format<42>;
75 // The instruction has an Rn register operand.
76 // UnaryDP - Indicates this is a unary data processing instruction, i.e.
77 // it doesn't have a Rn operand.
78 class UnaryDP { bit isUnaryDataProc = 1; }
80 // Xform16Bit - Indicates this Thumb2 instruction may be transformed into
81 // a 16-bit Thumb instruction if certain conditions are met.
82 class Xform16Bit { bit canXformTo16Bit = 1; }
84 //===----------------------------------------------------------------------===//
85 // ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
88 // FIXME: Once the JIT is MC-ized, these can go away.
90 class AddrMode<bits<5> val> {
93 def AddrModeNone : AddrMode<0>;
94 def AddrMode1 : AddrMode<1>;
95 def AddrMode2 : AddrMode<2>;
96 def AddrMode3 : AddrMode<3>;
97 def AddrMode4 : AddrMode<4>;
98 def AddrMode5 : AddrMode<5>;
99 def AddrMode6 : AddrMode<6>;
100 def AddrModeT1_1 : AddrMode<7>;
101 def AddrModeT1_2 : AddrMode<8>;
102 def AddrModeT1_4 : AddrMode<9>;
103 def AddrModeT1_s : AddrMode<10>;
104 def AddrModeT2_i12 : AddrMode<11>;
105 def AddrModeT2_i8 : AddrMode<12>;
106 def AddrModeT2_so : AddrMode<13>;
107 def AddrModeT2_pc : AddrMode<14>;
108 def AddrModeT2_i8s4 : AddrMode<15>;
109 def AddrMode_i12 : AddrMode<16>;
111 // Load / store index mode.
112 class IndexMode<bits<2> val> {
115 def IndexModeNone : IndexMode<0>;
116 def IndexModePre : IndexMode<1>;
117 def IndexModePost : IndexMode<2>;
118 def IndexModeUpd : IndexMode<3>;
120 // Instruction execution domain.
121 class Domain<bits<3> val> {
124 def GenericDomain : Domain<0>;
125 def VFPDomain : Domain<1>; // Instructions in VFP domain only
126 def NeonDomain : Domain<2>; // Instructions in Neon domain only
127 def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
128 def VFPNeonA8Domain : Domain<5>; // Instructions in VFP & Neon under A8
130 //===----------------------------------------------------------------------===//
131 // ARM special operands.
134 // ARM imod and iflag operands, used only by the CPS instruction.
135 def imod_op : Operand<i32> {
136 let PrintMethod = "printCPSIMod";
139 def ProcIFlagsOperand : AsmOperandClass {
140 let Name = "ProcIFlags";
141 let ParserMethod = "parseProcIFlagsOperand";
143 def iflags_op : Operand<i32> {
144 let PrintMethod = "printCPSIFlag";
145 let ParserMatchClass = ProcIFlagsOperand;
148 // ARM Predicate operand. Default to 14 = always (AL). Second part is CC
149 // register whose default is 0 (no register).
150 def CondCodeOperand : AsmOperandClass { let Name = "CondCode"; }
151 def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
152 (ops (i32 14), (i32 zero_reg))> {
153 let PrintMethod = "printPredicateOperand";
154 let ParserMatchClass = CondCodeOperand;
157 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
158 def CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
159 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
160 let EncoderMethod = "getCCOutOpValue";
161 let PrintMethod = "printSBitModifierOperand";
162 let ParserMatchClass = CCOutOperand;
165 // Same as cc_out except it defaults to setting CPSR.
166 def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
167 let EncoderMethod = "getCCOutOpValue";
168 let PrintMethod = "printSBitModifierOperand";
169 let ParserMatchClass = CCOutOperand;
172 // ARM special operands for disassembly only.
174 def SetEndAsmOperand : AsmOperandClass {
175 let Name = "SetEndImm";
176 let ParserMethod = "parseSetEndImm";
178 def setend_op : Operand<i32> {
179 let PrintMethod = "printSetendOperand";
180 let ParserMatchClass = SetEndAsmOperand;
183 def MSRMaskOperand : AsmOperandClass {
184 let Name = "MSRMask";
185 let ParserMethod = "parseMSRMaskOperand";
187 def msr_mask : Operand<i32> {
188 let PrintMethod = "printMSRMaskOperand";
189 let ParserMatchClass = MSRMaskOperand;
192 // Shift Right Immediate - A shift right immediate is encoded differently from
193 // other shift immediates. The imm6 field is encoded like so:
196 // 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
197 // 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
198 // 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
199 // 64 64 - <imm> is encoded in imm6<5:0>
200 def shr_imm8 : Operand<i32> {
201 let EncoderMethod = "getShiftRight8Imm";
203 def shr_imm16 : Operand<i32> {
204 let EncoderMethod = "getShiftRight16Imm";
206 def shr_imm32 : Operand<i32> {
207 let EncoderMethod = "getShiftRight32Imm";
209 def shr_imm64 : Operand<i32> {
210 let EncoderMethod = "getShiftRight64Imm";
213 //===----------------------------------------------------------------------===//
214 // ARM Instruction templates.
217 class InstTemplate<AddrMode am, int sz, IndexMode im,
218 Format f, Domain d, string cstr, InstrItinClass itin>
220 let Namespace = "ARM";
225 bits<2> IndexModeBits = IM.Value;
227 bits<6> Form = F.Value;
229 bit isUnaryDataProc = 0;
230 bit canXformTo16Bit = 0;
232 // If this is a pseudo instruction, mark it isCodeGenOnly.
233 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
235 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
236 let TSFlags{4-0} = AM.Value;
237 let TSFlags{6-5} = IndexModeBits;
238 let TSFlags{12-7} = Form;
239 let TSFlags{13} = isUnaryDataProc;
240 let TSFlags{14} = canXformTo16Bit;
241 let TSFlags{17-15} = D.Value;
243 let Constraints = cstr;
244 let Itinerary = itin;
251 class InstARM<AddrMode am, int sz, IndexMode im,
252 Format f, Domain d, string cstr, InstrItinClass itin>
253 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
254 let DecoderNamespace = "ARM";
257 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
258 // on by adding flavors to specific instructions.
259 class InstThumb<AddrMode am, int sz, IndexMode im,
260 Format f, Domain d, string cstr, InstrItinClass itin>
261 : InstTemplate<am, sz, im, f, d, cstr, itin> {
262 let DecoderNamespace = "Thumb";
265 class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
266 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
267 GenericDomain, "", itin> {
268 let OutOperandList = oops;
269 let InOperandList = iops;
270 let Pattern = pattern;
271 let isCodeGenOnly = 1;
275 // PseudoInst that's ARM-mode only.
276 class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
278 : PseudoInst<oops, iops, itin, pattern> {
280 list<Predicate> Predicates = [IsARM];
283 // PseudoInst that's Thumb-mode only.
284 class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
286 : PseudoInst<oops, iops, itin, pattern> {
288 list<Predicate> Predicates = [IsThumb];
291 // PseudoInst that's Thumb2-mode only.
292 class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
294 : PseudoInst<oops, iops, itin, pattern> {
296 list<Predicate> Predicates = [IsThumb2];
299 class ARMPseudoExpand<dag oops, dag iops, int sz,
300 InstrItinClass itin, list<dag> pattern,
302 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
303 PseudoInstExpansion<Result>;
305 class tPseudoExpand<dag oops, dag iops, int sz,
306 InstrItinClass itin, list<dag> pattern,
308 : tPseudoInst<oops, iops, sz, itin, pattern>,
309 PseudoInstExpansion<Result>;
311 class t2PseudoExpand<dag oops, dag iops, int sz,
312 InstrItinClass itin, list<dag> pattern,
314 : t2PseudoInst<oops, iops, sz, itin, pattern>,
315 PseudoInstExpansion<Result>;
317 // Almost all ARM instructions are predicable.
318 class I<dag oops, dag iops, AddrMode am, int sz,
319 IndexMode im, Format f, InstrItinClass itin,
320 string opc, string asm, string cstr,
322 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
325 let OutOperandList = oops;
326 let InOperandList = !con(iops, (ins pred:$p));
327 let AsmString = !strconcat(opc, "${p}", asm);
328 let Pattern = pattern;
329 list<Predicate> Predicates = [IsARM];
332 // A few are not predicable
333 class InoP<dag oops, dag iops, AddrMode am, int sz,
334 IndexMode im, Format f, InstrItinClass itin,
335 string opc, string asm, string cstr,
337 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
338 let OutOperandList = oops;
339 let InOperandList = iops;
340 let AsmString = !strconcat(opc, asm);
341 let Pattern = pattern;
342 let isPredicable = 0;
343 list<Predicate> Predicates = [IsARM];
346 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
347 // operand since by default it's a zero register. It will become an implicit def
348 // once it's "flipped".
349 class sI<dag oops, dag iops, AddrMode am, int sz,
350 IndexMode im, Format f, InstrItinClass itin,
351 string opc, string asm, string cstr,
353 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
354 bits<4> p; // Predicate operand
355 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
359 let OutOperandList = oops;
360 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
361 let AsmString = !strconcat(opc, "${s}${p}", asm);
362 let Pattern = pattern;
363 list<Predicate> Predicates = [IsARM];
367 class XI<dag oops, dag iops, AddrMode am, int sz,
368 IndexMode im, Format f, InstrItinClass itin,
369 string asm, string cstr, list<dag> pattern>
370 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
371 let OutOperandList = oops;
372 let InOperandList = iops;
374 let Pattern = pattern;
375 list<Predicate> Predicates = [IsARM];
378 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
379 string opc, string asm, list<dag> pattern>
380 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
381 opc, asm, "", pattern>;
382 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
383 string opc, string asm, list<dag> pattern>
384 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
385 opc, asm, "", pattern>;
386 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
387 string asm, list<dag> pattern>
388 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
390 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
391 string opc, string asm, list<dag> pattern>
392 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
393 opc, asm, "", pattern>;
395 // Ctrl flow instructions
396 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
397 string opc, string asm, list<dag> pattern>
398 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
399 opc, asm, "", pattern> {
400 let Inst{27-24} = opcod;
402 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
403 string asm, list<dag> pattern>
404 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
406 let Inst{27-24} = opcod;
409 // BR_JT instructions
410 class JTI<dag oops, dag iops, InstrItinClass itin,
411 string asm, list<dag> pattern>
412 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
415 // Atomic load/store instructions
416 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
417 string opc, string asm, list<dag> pattern>
418 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
419 opc, asm, "", pattern> {
422 let Inst{27-23} = 0b00011;
423 let Inst{22-21} = opcod;
425 let Inst{19-16} = addr;
426 let Inst{15-12} = Rt;
427 let Inst{11-0} = 0b111110011111;
429 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
430 string opc, string asm, list<dag> pattern>
431 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
432 opc, asm, "", pattern> {
436 let Inst{27-23} = 0b00011;
437 let Inst{22-21} = opcod;
439 let Inst{19-16} = addr;
440 let Inst{15-12} = Rd;
441 let Inst{11-4} = 0b11111001;
444 class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
445 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
449 let Inst{27-23} = 0b00010;
451 let Inst{21-20} = 0b00;
452 let Inst{19-16} = addr;
453 let Inst{15-12} = Rt;
454 let Inst{11-4} = 0b00001001;
458 // addrmode1 instructions
459 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
460 string opc, string asm, list<dag> pattern>
461 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
462 opc, asm, "", pattern> {
463 let Inst{24-21} = opcod;
464 let Inst{27-26} = 0b00;
466 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
467 string opc, string asm, list<dag> pattern>
468 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
469 opc, asm, "", pattern> {
470 let Inst{24-21} = opcod;
471 let Inst{27-26} = 0b00;
473 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
474 string asm, list<dag> pattern>
475 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
477 let Inst{24-21} = opcod;
478 let Inst{27-26} = 0b00;
483 // LDR/LDRB/STR/STRB/...
484 class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
485 Format f, InstrItinClass itin, string opc, string asm,
487 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
489 let Inst{27-25} = op;
490 let Inst{24} = 1; // 24 == P
492 let Inst{22} = isByte;
493 let Inst{21} = 0; // 21 == W
496 // Indexed load/stores
497 class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
498 IndexMode im, Format f, InstrItinClass itin, string opc,
499 string asm, string cstr, list<dag> pattern>
500 : I<oops, iops, AddrMode2, 4, im, f, itin,
501 opc, asm, cstr, pattern> {
503 let Inst{27-26} = 0b01;
504 let Inst{24} = isPre; // P bit
505 let Inst{22} = isByte; // B bit
506 let Inst{21} = isPre; // W bit
507 let Inst{20} = isLd; // L bit
508 let Inst{15-12} = Rt;
510 class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
511 IndexMode im, Format f, InstrItinClass itin, string opc,
512 string asm, string cstr, list<dag> pattern>
513 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
515 // AM2 store w/ two operands: (GPR, am2offset)
521 let Inst{23} = offset{12};
522 let Inst{19-16} = Rn;
523 let Inst{11-5} = offset{11-5};
525 let Inst{3-0} = offset{3-0};
528 class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
529 IndexMode im, Format f, InstrItinClass itin, string opc,
530 string asm, string cstr, list<dag> pattern>
531 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
533 // AM2 store w/ two operands: (GPR, am2offset)
539 let Inst{23} = offset{12};
540 let Inst{19-16} = Rn;
541 let Inst{11-0} = offset{11-0};
545 // FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
546 // but for now use this class for STRT and STRBT.
547 class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
548 IndexMode im, Format f, InstrItinClass itin, string opc,
549 string asm, string cstr, list<dag> pattern>
550 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
552 // AM2 store w/ two operands: (GPR, am2offset)
554 // {13} 1 == Rm, 0 == imm12
558 let Inst{25} = addr{13};
559 let Inst{23} = addr{12};
560 let Inst{19-16} = addr{17-14};
561 let Inst{11-0} = addr{11-0};
564 // addrmode3 instructions
565 class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
566 InstrItinClass itin, string opc, string asm, list<dag> pattern>
567 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
568 opc, asm, "", pattern> {
571 let Inst{27-25} = 0b000;
572 let Inst{24} = 1; // P bit
573 let Inst{23} = addr{8}; // U bit
574 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
575 let Inst{21} = 0; // W bit
576 let Inst{20} = op20; // L bit
577 let Inst{19-16} = addr{12-9}; // Rn
578 let Inst{15-12} = Rt; // Rt
579 let Inst{11-8} = addr{7-4}; // imm7_4/zero
581 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
584 class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
585 IndexMode im, Format f, InstrItinClass itin, string opc,
586 string asm, string cstr, list<dag> pattern>
587 : I<oops, iops, AddrMode3, 4, im, f, itin,
588 opc, asm, cstr, pattern> {
590 let Inst{27-25} = 0b000;
591 let Inst{24} = isPre; // P bit
592 let Inst{21} = isPre; // W bit
593 let Inst{20} = op20; // L bit
594 let Inst{15-12} = Rt; // Rt
598 // FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
599 // but for now use this class for LDRSBT, LDRHT, LDSHT.
600 class AI3ldstidxT<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
601 IndexMode im, Format f, InstrItinClass itin, string opc,
602 string asm, string cstr, list<dag> pattern>
603 : I<oops, iops, AddrMode3, 4, im, f, itin,
604 opc, asm, cstr, pattern> {
605 // {13} 1 == imm8, 0 == Rm
612 let Inst{27-25} = 0b000;
613 let Inst{24} = isPre; // P bit
614 let Inst{23} = addr{8}; // U bit
615 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
616 let Inst{20} = op20; // L bit
617 let Inst{19-16} = addr{12-9}; // Rn
618 let Inst{15-12} = Rt; // Rt
619 let Inst{11-8} = addr{7-4}; // imm7_4/zero
621 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
622 let AsmMatchConverter = "cvtLdWriteBackRegAddrMode3";
625 class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
626 IndexMode im, Format f, InstrItinClass itin, string opc,
627 string asm, string cstr, list<dag> pattern>
628 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
630 // AM3 store w/ two operands: (GPR, am3offset)
634 let Inst{27-25} = 0b000;
635 let Inst{23} = offset{8};
636 let Inst{22} = offset{9};
637 let Inst{19-16} = Rn;
638 let Inst{15-12} = Rt; // Rt
639 let Inst{11-8} = offset{7-4}; // imm7_4/zero
641 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
645 class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
646 string opc, string asm, list<dag> pattern>
647 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
648 opc, asm, "", pattern> {
651 let Inst{27-25} = 0b000;
652 let Inst{24} = 1; // P bit
653 let Inst{23} = addr{8}; // U bit
654 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
655 let Inst{21} = 0; // W bit
656 let Inst{20} = 0; // L bit
657 let Inst{19-16} = addr{12-9}; // Rn
658 let Inst{15-12} = Rt; // Rt
659 let Inst{11-8} = addr{7-4}; // imm7_4/zero
661 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
664 // Pre-indexed stores
665 class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
666 string opc, string asm, string cstr, list<dag> pattern>
667 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
668 opc, asm, cstr, pattern> {
670 let Inst{5} = 1; // H bit
671 let Inst{6} = 0; // S bit
673 let Inst{20} = 0; // L bit
674 let Inst{21} = 1; // W bit
675 let Inst{24} = 1; // P bit
676 let Inst{27-25} = 0b000;
678 class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
679 string opc, string asm, string cstr, list<dag> pattern>
680 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
681 opc, asm, cstr, pattern> {
683 let Inst{5} = 1; // H bit
684 let Inst{6} = 1; // S bit
686 let Inst{20} = 0; // L bit
687 let Inst{21} = 1; // W bit
688 let Inst{24} = 1; // P bit
689 let Inst{27-25} = 0b000;
692 // Post-indexed stores
693 class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
694 string opc, string asm, string cstr, list<dag> pattern>
695 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
696 opc, asm, cstr,pattern> {
697 // {13} 1 == imm8, 0 == Rm
704 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
706 let Inst{5} = 1; // H bit
707 let Inst{6} = 0; // S bit
709 let Inst{11-8} = addr{7-4}; // imm7_4/zero
710 let Inst{15-12} = Rt; // Rt
711 let Inst{19-16} = addr{12-9}; // Rn
712 let Inst{20} = 0; // L bit
713 let Inst{21} = 0; // W bit
714 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
715 let Inst{23} = addr{8}; // U bit
716 let Inst{24} = 0; // P bit
717 let Inst{27-25} = 0b000;
719 class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
720 string opc, string asm, string cstr, list<dag> pattern>
721 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
722 opc, asm, cstr, pattern> {
724 let Inst{5} = 1; // H bit
725 let Inst{6} = 1; // S bit
727 let Inst{20} = 0; // L bit
728 let Inst{21} = 0; // W bit
729 let Inst{24} = 0; // P bit
730 let Inst{27-25} = 0b000;
733 // addrmode4 instructions
734 class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
735 string asm, string cstr, list<dag> pattern>
736 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
741 let Inst{27-25} = 0b100;
742 let Inst{22} = 0; // S bit
743 let Inst{19-16} = Rn;
744 let Inst{15-0} = regs;
747 // Unsigned multiply, multiply-accumulate instructions.
748 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
749 string opc, string asm, list<dag> pattern>
750 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
751 opc, asm, "", pattern> {
752 let Inst{7-4} = 0b1001;
753 let Inst{20} = 0; // S bit
754 let Inst{27-21} = opcod;
756 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
757 string opc, string asm, list<dag> pattern>
758 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
759 opc, asm, "", pattern> {
760 let Inst{7-4} = 0b1001;
761 let Inst{27-21} = opcod;
764 // Most significant word multiply
765 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
766 InstrItinClass itin, string opc, string asm, list<dag> pattern>
767 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
768 opc, asm, "", pattern> {
772 let Inst{7-4} = opc7_4;
774 let Inst{27-21} = opcod;
775 let Inst{19-16} = Rd;
779 // MSW multiple w/ Ra operand
780 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
781 InstrItinClass itin, string opc, string asm, list<dag> pattern>
782 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
784 let Inst{15-12} = Ra;
787 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
788 class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
789 InstrItinClass itin, string opc, string asm, list<dag> pattern>
790 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
791 opc, asm, "", pattern> {
797 let Inst{27-21} = opcod;
798 let Inst{6-5} = bit6_5;
802 class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
803 InstrItinClass itin, string opc, string asm, list<dag> pattern>
804 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
806 let Inst{19-16} = Rd;
809 // AMulxyI with Ra operand
810 class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
811 InstrItinClass itin, string opc, string asm, list<dag> pattern>
812 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
814 let Inst{15-12} = Ra;
817 class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
818 InstrItinClass itin, string opc, string asm, list<dag> pattern>
819 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
822 let Inst{19-16} = RdHi;
823 let Inst{15-12} = RdLo;
826 // Extend instructions.
827 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
828 string opc, string asm, list<dag> pattern>
829 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
830 opc, asm, "", pattern> {
831 // All AExtI instructions have Rd and Rm register operands.
834 let Inst{15-12} = Rd;
836 let Inst{7-4} = 0b0111;
837 let Inst{9-8} = 0b00;
838 let Inst{27-20} = opcod;
841 // Misc Arithmetic instructions.
842 class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
843 InstrItinClass itin, string opc, string asm, list<dag> pattern>
844 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
845 opc, asm, "", pattern> {
848 let Inst{27-20} = opcod;
849 let Inst{19-16} = 0b1111;
850 let Inst{15-12} = Rd;
851 let Inst{11-8} = 0b1111;
852 let Inst{7-4} = opc7_4;
857 def PKHLSLAsmOperand : AsmOperandClass {
858 let Name = "PKHLSLImm";
859 let ParserMethod = "parsePKHLSLImm";
861 def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
862 let PrintMethod = "printPKHLSLShiftImm";
863 let ParserMatchClass = PKHLSLAsmOperand;
865 def PKHASRAsmOperand : AsmOperandClass {
866 let Name = "PKHASRImm";
867 let ParserMethod = "parsePKHASRImm";
869 def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
870 let PrintMethod = "printPKHASRShiftImm";
871 let ParserMatchClass = PKHASRAsmOperand;
874 class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
875 string opc, string asm, list<dag> pattern>
876 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
877 opc, asm, "", pattern> {
882 let Inst{27-20} = opcod;
883 let Inst{19-16} = Rn;
884 let Inst{15-12} = Rd;
887 let Inst{5-4} = 0b01;
891 //===----------------------------------------------------------------------===//
893 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
894 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
895 list<Predicate> Predicates = [IsARM];
897 class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
898 list<Predicate> Predicates = [IsARM, HasV5T];
900 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
901 list<Predicate> Predicates = [IsARM, HasV5TE];
903 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
904 list<Predicate> Predicates = [IsARM, HasV6];
907 //===----------------------------------------------------------------------===//
908 // Thumb Instruction Format Definitions.
911 class ThumbI<dag oops, dag iops, AddrMode am, int sz,
912 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
913 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
914 let OutOperandList = oops;
915 let InOperandList = iops;
917 let Pattern = pattern;
918 list<Predicate> Predicates = [IsThumb];
921 // TI - Thumb instruction.
922 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
923 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
925 // Two-address instructions
926 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
928 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
931 // tBL, tBX 32-bit instructions
932 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
933 dag oops, dag iops, InstrItinClass itin, string asm,
935 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
937 let Inst{31-27} = opcod1;
938 let Inst{15-14} = opcod2;
939 let Inst{12} = opcod3;
942 // BR_JT instructions
943 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
945 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
948 class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
949 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
950 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
951 let OutOperandList = oops;
952 let InOperandList = iops;
954 let Pattern = pattern;
955 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
958 class T1I<dag oops, dag iops, InstrItinClass itin,
959 string asm, list<dag> pattern>
960 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
961 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
962 string asm, list<dag> pattern>
963 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
965 // Two-address instructions
966 class T1It<dag oops, dag iops, InstrItinClass itin,
967 string asm, string cstr, list<dag> pattern>
968 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
971 // Thumb1 instruction that can either be predicated or set CPSR.
972 class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
974 string opc, string asm, string cstr, list<dag> pattern>
975 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
976 let OutOperandList = !con(oops, (outs s_cc_out:$s));
977 let InOperandList = !con(iops, (ins pred:$p));
978 let AsmString = !strconcat(opc, "${s}${p}", asm);
979 let Pattern = pattern;
980 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
983 class T1sI<dag oops, dag iops, InstrItinClass itin,
984 string opc, string asm, list<dag> pattern>
985 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
987 // Two-address instructions
988 class T1sIt<dag oops, dag iops, InstrItinClass itin,
989 string opc, string asm, list<dag> pattern>
990 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
991 "$Rn = $Rdn", pattern>;
993 // Thumb1 instruction that can be predicated.
994 class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
996 string opc, string asm, string cstr, list<dag> pattern>
997 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
998 let OutOperandList = oops;
999 let InOperandList = !con(iops, (ins pred:$p));
1000 let AsmString = !strconcat(opc, "${p}", asm);
1001 let Pattern = pattern;
1002 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1005 class T1pI<dag oops, dag iops, InstrItinClass itin,
1006 string opc, string asm, list<dag> pattern>
1007 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
1009 // Two-address instructions
1010 class T1pIt<dag oops, dag iops, InstrItinClass itin,
1011 string opc, string asm, list<dag> pattern>
1012 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
1013 "$Rn = $Rdn", pattern>;
1015 class T1pIs<dag oops, dag iops,
1016 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1017 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
1019 class Encoding16 : Encoding {
1020 let Inst{31-16} = 0x0000;
1023 // A6.2 16-bit Thumb instruction encoding
1024 class T1Encoding<bits<6> opcode> : Encoding16 {
1025 let Inst{15-10} = opcode;
1028 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
1029 class T1General<bits<5> opcode> : Encoding16 {
1030 let Inst{15-14} = 0b00;
1031 let Inst{13-9} = opcode;
1034 // A6.2.2 Data-processing encoding.
1035 class T1DataProcessing<bits<4> opcode> : Encoding16 {
1036 let Inst{15-10} = 0b010000;
1037 let Inst{9-6} = opcode;
1040 // A6.2.3 Special data instructions and branch and exchange encoding.
1041 class T1Special<bits<4> opcode> : Encoding16 {
1042 let Inst{15-10} = 0b010001;
1043 let Inst{9-6} = opcode;
1046 // A6.2.4 Load/store single data item encoding.
1047 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
1048 let Inst{15-12} = opA;
1049 let Inst{11-9} = opB;
1051 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1053 class T1BranchCond<bits<4> opcode> : Encoding16 {
1054 let Inst{15-12} = opcode;
1057 // Helper classes to encode Thumb1 loads and stores. For immediates, the
1058 // following bits are used for "opA" (see A6.2.4):
1060 // 0b0110 => Immediate, 4 bytes
1061 // 0b1000 => Immediate, 2 bytes
1062 // 0b0111 => Immediate, 1 byte
1063 class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1064 InstrItinClass itin, string opc, string asm,
1066 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1067 T1LoadStore<0b0101, opcode> {
1070 let Inst{8-6} = addr{5-3}; // Rm
1071 let Inst{5-3} = addr{2-0}; // Rn
1074 class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1075 InstrItinClass itin, string opc, string asm,
1077 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1078 T1LoadStore<opA, {opB,?,?}> {
1081 let Inst{10-6} = addr{7-3}; // imm5
1082 let Inst{5-3} = addr{2-0}; // Rn
1086 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1087 class T1Misc<bits<7> opcode> : Encoding16 {
1088 let Inst{15-12} = 0b1011;
1089 let Inst{11-5} = opcode;
1092 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1093 class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
1094 InstrItinClass itin,
1095 string opc, string asm, string cstr, list<dag> pattern>
1096 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1097 let OutOperandList = oops;
1098 let InOperandList = !con(iops, (ins pred:$p));
1099 let AsmString = !strconcat(opc, "${p}", asm);
1100 let Pattern = pattern;
1101 list<Predicate> Predicates = [IsThumb2];
1102 let DecoderNamespace = "Thumb2";
1105 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1106 // input operand since by default it's a zero register. It will become an
1107 // implicit def once it's "flipped".
1109 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1111 class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
1112 InstrItinClass itin,
1113 string opc, string asm, string cstr, list<dag> pattern>
1114 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1115 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1118 let OutOperandList = oops;
1119 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1120 let AsmString = !strconcat(opc, "${s}${p}", asm);
1121 let Pattern = pattern;
1122 list<Predicate> Predicates = [IsThumb2];
1123 let DecoderNamespace = "Thumb2";
1127 class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
1128 InstrItinClass itin,
1129 string asm, string cstr, list<dag> pattern>
1130 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1131 let OutOperandList = oops;
1132 let InOperandList = iops;
1133 let AsmString = asm;
1134 let Pattern = pattern;
1135 list<Predicate> Predicates = [IsThumb2];
1136 let DecoderNamespace = "Thumb2";
1139 class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
1140 InstrItinClass itin,
1141 string asm, string cstr, list<dag> pattern>
1142 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1143 let OutOperandList = oops;
1144 let InOperandList = iops;
1145 let AsmString = asm;
1146 let Pattern = pattern;
1147 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1148 let DecoderNamespace = "Thumb";
1151 class T2I<dag oops, dag iops, InstrItinClass itin,
1152 string opc, string asm, list<dag> pattern>
1153 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1154 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1155 string opc, string asm, list<dag> pattern>
1156 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
1157 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1158 string opc, string asm, list<dag> pattern>
1159 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
1160 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1161 string opc, string asm, list<dag> pattern>
1162 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
1163 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1164 string opc, string asm, list<dag> pattern>
1165 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
1166 class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1167 string opc, string asm, list<dag> pattern>
1168 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
1173 let Inst{31-25} = 0b1110100;
1175 let Inst{23} = addr{8};
1178 let Inst{20} = isLoad;
1179 let Inst{19-16} = addr{12-9};
1180 let Inst{15-12} = Rt{3-0};
1181 let Inst{11-8} = Rt2{3-0};
1182 let Inst{7-0} = addr{7-0};
1185 class T2sI<dag oops, dag iops, InstrItinClass itin,
1186 string opc, string asm, list<dag> pattern>
1187 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1189 class T2XI<dag oops, dag iops, InstrItinClass itin,
1190 string asm, list<dag> pattern>
1191 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
1192 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1193 string asm, list<dag> pattern>
1194 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
1196 // Move to/from coprocessor instructions
1197 class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
1198 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
1199 let Inst{31-28} = opc;
1202 // Two-address instructions
1203 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1204 string asm, string cstr, list<dag> pattern>
1205 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
1207 // T2Iidxldst - Thumb2 indexed load / store instructions.
1208 class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1210 AddrMode am, IndexMode im, InstrItinClass itin,
1211 string opc, string asm, string cstr, list<dag> pattern>
1212 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1213 let OutOperandList = oops;
1214 let InOperandList = !con(iops, (ins pred:$p));
1215 let AsmString = !strconcat(opc, "${p}", asm);
1216 let Pattern = pattern;
1217 list<Predicate> Predicates = [IsThumb2];
1218 let DecoderNamespace = "Thumb2";
1219 let Inst{31-27} = 0b11111;
1220 let Inst{26-25} = 0b00;
1221 let Inst{24} = signed;
1223 let Inst{22-21} = opcod;
1224 let Inst{20} = load;
1226 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1227 let Inst{10} = pre; // The P bit.
1228 let Inst{8} = 1; // The W bit.
1231 let Inst{7-0} = addr{7-0};
1232 let Inst{9} = addr{8}; // Sign bit
1236 let Inst{15-12} = Rt{3-0};
1237 let Inst{19-16} = Rn{3-0};
1240 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1241 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1242 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
1245 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1246 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1247 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1250 // T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1251 class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1252 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1255 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1256 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1257 list<Predicate> Predicates = [IsThumb2];
1260 //===----------------------------------------------------------------------===//
1262 //===----------------------------------------------------------------------===//
1263 // ARM VFP Instruction templates.
1266 // Almost all VFP instructions are predicable.
1267 class VFPI<dag oops, dag iops, AddrMode am, int sz,
1268 IndexMode im, Format f, InstrItinClass itin,
1269 string opc, string asm, string cstr, list<dag> pattern>
1270 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1272 let Inst{31-28} = p;
1273 let OutOperandList = oops;
1274 let InOperandList = !con(iops, (ins pred:$p));
1275 let AsmString = !strconcat(opc, "${p}", asm);
1276 let Pattern = pattern;
1277 let PostEncoderMethod = "VFPThumb2PostEncoder";
1278 list<Predicate> Predicates = [HasVFP2];
1282 class VFPXI<dag oops, dag iops, AddrMode am, int sz,
1283 IndexMode im, Format f, InstrItinClass itin,
1284 string asm, string cstr, list<dag> pattern>
1285 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1287 let Inst{31-28} = p;
1288 let OutOperandList = oops;
1289 let InOperandList = iops;
1290 let AsmString = asm;
1291 let Pattern = pattern;
1292 let PostEncoderMethod = "VFPThumb2PostEncoder";
1293 list<Predicate> Predicates = [HasVFP2];
1296 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1297 string opc, string asm, list<dag> pattern>
1298 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
1299 opc, asm, "", pattern> {
1300 let PostEncoderMethod = "VFPThumb2PostEncoder";
1303 // ARM VFP addrmode5 loads and stores
1304 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1305 InstrItinClass itin,
1306 string opc, string asm, list<dag> pattern>
1307 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1308 VFPLdStFrm, itin, opc, asm, "", pattern> {
1309 // Instruction operands.
1313 // Encode instruction operands.
1314 let Inst{23} = addr{8}; // U (add = (U == '1'))
1315 let Inst{22} = Dd{4};
1316 let Inst{19-16} = addr{12-9}; // Rn
1317 let Inst{15-12} = Dd{3-0};
1318 let Inst{7-0} = addr{7-0}; // imm8
1320 // TODO: Mark the instructions with the appropriate subtarget info.
1321 let Inst{27-24} = opcod1;
1322 let Inst{21-20} = opcod2;
1323 let Inst{11-9} = 0b101;
1324 let Inst{8} = 1; // Double precision
1326 // Loads & stores operate on both NEON and VFP pipelines.
1327 let D = VFPNeonDomain;
1330 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1331 InstrItinClass itin,
1332 string opc, string asm, list<dag> pattern>
1333 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1334 VFPLdStFrm, itin, opc, asm, "", pattern> {
1335 // Instruction operands.
1339 // Encode instruction operands.
1340 let Inst{23} = addr{8}; // U (add = (U == '1'))
1341 let Inst{22} = Sd{0};
1342 let Inst{19-16} = addr{12-9}; // Rn
1343 let Inst{15-12} = Sd{4-1};
1344 let Inst{7-0} = addr{7-0}; // imm8
1346 // TODO: Mark the instructions with the appropriate subtarget info.
1347 let Inst{27-24} = opcod1;
1348 let Inst{21-20} = opcod2;
1349 let Inst{11-9} = 0b101;
1350 let Inst{8} = 0; // Single precision
1352 // Loads & stores operate on both NEON and VFP pipelines.
1353 let D = VFPNeonDomain;
1356 // VFP Load / store multiple pseudo instructions.
1357 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1359 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
1361 let OutOperandList = oops;
1362 let InOperandList = !con(iops, (ins pred:$p));
1363 let Pattern = pattern;
1364 list<Predicate> Predicates = [HasVFP2];
1367 // Load / store multiple
1368 class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1369 string asm, string cstr, list<dag> pattern>
1370 : VFPXI<oops, iops, AddrMode4, 4, im,
1371 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1372 // Instruction operands.
1376 // Encode instruction operands.
1377 let Inst{19-16} = Rn;
1378 let Inst{22} = regs{12};
1379 let Inst{15-12} = regs{11-8};
1380 let Inst{7-0} = regs{7-0};
1382 // TODO: Mark the instructions with the appropriate subtarget info.
1383 let Inst{27-25} = 0b110;
1384 let Inst{11-9} = 0b101;
1385 let Inst{8} = 1; // Double precision
1388 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1389 string asm, string cstr, list<dag> pattern>
1390 : VFPXI<oops, iops, AddrMode4, 4, im,
1391 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1392 // Instruction operands.
1396 // Encode instruction operands.
1397 let Inst{19-16} = Rn;
1398 let Inst{22} = regs{8};
1399 let Inst{15-12} = regs{12-9};
1400 let Inst{7-0} = regs{7-0};
1402 // TODO: Mark the instructions with the appropriate subtarget info.
1403 let Inst{27-25} = 0b110;
1404 let Inst{11-9} = 0b101;
1405 let Inst{8} = 0; // Single precision
1408 // Double precision, unary
1409 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1410 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1411 string asm, list<dag> pattern>
1412 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1413 // Instruction operands.
1417 // Encode instruction operands.
1418 let Inst{3-0} = Dm{3-0};
1419 let Inst{5} = Dm{4};
1420 let Inst{15-12} = Dd{3-0};
1421 let Inst{22} = Dd{4};
1423 let Inst{27-23} = opcod1;
1424 let Inst{21-20} = opcod2;
1425 let Inst{19-16} = opcod3;
1426 let Inst{11-9} = 0b101;
1427 let Inst{8} = 1; // Double precision
1428 let Inst{7-6} = opcod4;
1429 let Inst{4} = opcod5;
1432 // Double precision, binary
1433 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1434 dag iops, InstrItinClass itin, string opc, string asm,
1436 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1437 // Instruction operands.
1442 // Encode instruction operands.
1443 let Inst{3-0} = Dm{3-0};
1444 let Inst{5} = Dm{4};
1445 let Inst{19-16} = Dn{3-0};
1446 let Inst{7} = Dn{4};
1447 let Inst{15-12} = Dd{3-0};
1448 let Inst{22} = Dd{4};
1450 let Inst{27-23} = opcod1;
1451 let Inst{21-20} = opcod2;
1452 let Inst{11-9} = 0b101;
1453 let Inst{8} = 1; // Double precision
1458 // Single precision, unary
1459 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1460 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1461 string asm, list<dag> pattern>
1462 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1463 // Instruction operands.
1467 // Encode instruction operands.
1468 let Inst{3-0} = Sm{4-1};
1469 let Inst{5} = Sm{0};
1470 let Inst{15-12} = Sd{4-1};
1471 let Inst{22} = Sd{0};
1473 let Inst{27-23} = opcod1;
1474 let Inst{21-20} = opcod2;
1475 let Inst{19-16} = opcod3;
1476 let Inst{11-9} = 0b101;
1477 let Inst{8} = 0; // Single precision
1478 let Inst{7-6} = opcod4;
1479 let Inst{4} = opcod5;
1482 // Single precision unary, if no NEON. Same as ASuI except not available if
1484 class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1485 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1486 string asm, list<dag> pattern>
1487 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1489 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1492 // Single precision, binary
1493 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1494 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1495 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1496 // Instruction operands.
1501 // Encode instruction operands.
1502 let Inst{3-0} = Sm{4-1};
1503 let Inst{5} = Sm{0};
1504 let Inst{19-16} = Sn{4-1};
1505 let Inst{7} = Sn{0};
1506 let Inst{15-12} = Sd{4-1};
1507 let Inst{22} = Sd{0};
1509 let Inst{27-23} = opcod1;
1510 let Inst{21-20} = opcod2;
1511 let Inst{11-9} = 0b101;
1512 let Inst{8} = 0; // Single precision
1517 // Single precision binary, if no NEON. Same as ASbI except not available if
1519 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1520 dag iops, InstrItinClass itin, string opc, string asm,
1522 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1523 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1525 // Instruction operands.
1530 // Encode instruction operands.
1531 let Inst{3-0} = Sm{4-1};
1532 let Inst{5} = Sm{0};
1533 let Inst{19-16} = Sn{4-1};
1534 let Inst{7} = Sn{0};
1535 let Inst{15-12} = Sd{4-1};
1536 let Inst{22} = Sd{0};
1539 // VFP conversion instructions
1540 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1541 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1543 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1544 let Inst{27-23} = opcod1;
1545 let Inst{21-20} = opcod2;
1546 let Inst{19-16} = opcod3;
1547 let Inst{11-8} = opcod4;
1552 // VFP conversion between floating-point and fixed-point
1553 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1554 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1556 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1557 // size (fixed-point number): sx == 0 ? 16 : 32
1558 let Inst{7} = op5; // sx
1561 // VFP conversion instructions, if no NEON
1562 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1563 dag oops, dag iops, InstrItinClass itin,
1564 string opc, string asm, list<dag> pattern>
1565 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1567 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1570 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1571 InstrItinClass itin,
1572 string opc, string asm, list<dag> pattern>
1573 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1574 let Inst{27-20} = opcod1;
1575 let Inst{11-8} = opcod2;
1579 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1580 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1581 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1583 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1584 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1585 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1587 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1588 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1589 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1591 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1592 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1593 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1595 //===----------------------------------------------------------------------===//
1597 //===----------------------------------------------------------------------===//
1598 // ARM NEON Instruction templates.
1601 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1602 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1604 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1605 let OutOperandList = oops;
1606 let InOperandList = !con(iops, (ins pred:$p));
1607 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1608 let Pattern = pattern;
1609 list<Predicate> Predicates = [HasNEON];
1612 // Same as NeonI except it does not have a "data type" specifier.
1613 class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1614 InstrItinClass itin, string opc, string asm, string cstr,
1616 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1617 let OutOperandList = oops;
1618 let InOperandList = !con(iops, (ins pred:$p));
1619 let AsmString = !strconcat(opc, "${p}", "\t", asm);
1620 let Pattern = pattern;
1621 list<Predicate> Predicates = [HasNEON];
1624 class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1625 dag oops, dag iops, InstrItinClass itin,
1626 string opc, string dt, string asm, string cstr, list<dag> pattern>
1627 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1629 let Inst{31-24} = 0b11110100;
1630 let Inst{23} = op23;
1631 let Inst{21-20} = op21_20;
1632 let Inst{11-8} = op11_8;
1633 let Inst{7-4} = op7_4;
1635 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
1641 let Inst{22} = Vd{4};
1642 let Inst{15-12} = Vd{3-0};
1643 let Inst{19-16} = Rn{3-0};
1644 let Inst{3-0} = Rm{3-0};
1647 class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1648 dag oops, dag iops, InstrItinClass itin,
1649 string opc, string dt, string asm, string cstr, list<dag> pattern>
1650 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1651 dt, asm, cstr, pattern> {
1655 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1656 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1658 let OutOperandList = oops;
1659 let InOperandList = !con(iops, (ins pred:$p));
1660 list<Predicate> Predicates = [HasNEON];
1663 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1665 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1667 let OutOperandList = oops;
1668 let InOperandList = !con(iops, (ins pred:$p));
1669 let Pattern = pattern;
1670 list<Predicate> Predicates = [HasNEON];
1673 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1674 string opc, string dt, string asm, string cstr, list<dag> pattern>
1675 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1677 let Inst{31-25} = 0b1111001;
1678 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1681 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1682 string opc, string asm, string cstr, list<dag> pattern>
1683 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1685 let Inst{31-25} = 0b1111001;
1686 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1689 // NEON "one register and a modified immediate" format.
1690 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1692 dag oops, dag iops, InstrItinClass itin,
1693 string opc, string dt, string asm, string cstr,
1695 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1696 let Inst{23} = op23;
1697 let Inst{21-19} = op21_19;
1698 let Inst{11-8} = op11_8;
1704 // Instruction operands.
1708 let Inst{15-12} = Vd{3-0};
1709 let Inst{22} = Vd{4};
1710 let Inst{24} = SIMM{7};
1711 let Inst{18-16} = SIMM{6-4};
1712 let Inst{3-0} = SIMM{3-0};
1715 // NEON 2 vector register format.
1716 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1717 bits<5> op11_7, bit op6, bit op4,
1718 dag oops, dag iops, InstrItinClass itin,
1719 string opc, string dt, string asm, string cstr, list<dag> pattern>
1720 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1721 let Inst{24-23} = op24_23;
1722 let Inst{21-20} = op21_20;
1723 let Inst{19-18} = op19_18;
1724 let Inst{17-16} = op17_16;
1725 let Inst{11-7} = op11_7;
1729 // Instruction operands.
1733 let Inst{15-12} = Vd{3-0};
1734 let Inst{22} = Vd{4};
1735 let Inst{3-0} = Vm{3-0};
1736 let Inst{5} = Vm{4};
1739 // Same as N2V except it doesn't have a datatype suffix.
1740 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1741 bits<5> op11_7, bit op6, bit op4,
1742 dag oops, dag iops, InstrItinClass itin,
1743 string opc, string asm, string cstr, list<dag> pattern>
1744 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1745 let Inst{24-23} = op24_23;
1746 let Inst{21-20} = op21_20;
1747 let Inst{19-18} = op19_18;
1748 let Inst{17-16} = op17_16;
1749 let Inst{11-7} = op11_7;
1753 // Instruction operands.
1757 let Inst{15-12} = Vd{3-0};
1758 let Inst{22} = Vd{4};
1759 let Inst{3-0} = Vm{3-0};
1760 let Inst{5} = Vm{4};
1763 // NEON 2 vector register with immediate.
1764 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1765 dag oops, dag iops, Format f, InstrItinClass itin,
1766 string opc, string dt, string asm, string cstr, list<dag> pattern>
1767 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1768 let Inst{24} = op24;
1769 let Inst{23} = op23;
1770 let Inst{11-8} = op11_8;
1775 // Instruction operands.
1780 let Inst{15-12} = Vd{3-0};
1781 let Inst{22} = Vd{4};
1782 let Inst{3-0} = Vm{3-0};
1783 let Inst{5} = Vm{4};
1784 let Inst{21-16} = SIMM{5-0};
1787 // NEON 3 vector register format.
1789 class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1790 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1791 string opc, string dt, string asm, string cstr,
1793 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1794 let Inst{24} = op24;
1795 let Inst{23} = op23;
1796 let Inst{21-20} = op21_20;
1797 let Inst{11-8} = op11_8;
1802 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1803 dag oops, dag iops, Format f, InstrItinClass itin,
1804 string opc, string dt, string asm, string cstr, list<dag> pattern>
1805 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1806 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1808 // Instruction operands.
1813 let Inst{15-12} = Vd{3-0};
1814 let Inst{22} = Vd{4};
1815 let Inst{19-16} = Vn{3-0};
1816 let Inst{7} = Vn{4};
1817 let Inst{3-0} = Vm{3-0};
1818 let Inst{5} = Vm{4};
1821 class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1822 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1823 string opc, string dt, string asm, string cstr,
1825 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1826 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1828 // Instruction operands.
1834 let Inst{15-12} = Vd{3-0};
1835 let Inst{22} = Vd{4};
1836 let Inst{19-16} = Vn{3-0};
1837 let Inst{7} = Vn{4};
1838 let Inst{3-0} = Vm{3-0};
1842 class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1843 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1844 string opc, string dt, string asm, string cstr,
1846 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1847 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1849 // Instruction operands.
1855 let Inst{15-12} = Vd{3-0};
1856 let Inst{22} = Vd{4};
1857 let Inst{19-16} = Vn{3-0};
1858 let Inst{7} = Vn{4};
1859 let Inst{2-0} = Vm{2-0};
1860 let Inst{5} = lane{1};
1861 let Inst{3} = lane{0};
1864 // Same as N3V except it doesn't have a data type suffix.
1865 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1867 dag oops, dag iops, Format f, InstrItinClass itin,
1868 string opc, string asm, string cstr, list<dag> pattern>
1869 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1870 let Inst{24} = op24;
1871 let Inst{23} = op23;
1872 let Inst{21-20} = op21_20;
1873 let Inst{11-8} = op11_8;
1877 // Instruction operands.
1882 let Inst{15-12} = Vd{3-0};
1883 let Inst{22} = Vd{4};
1884 let Inst{19-16} = Vn{3-0};
1885 let Inst{7} = Vn{4};
1886 let Inst{3-0} = Vm{3-0};
1887 let Inst{5} = Vm{4};
1890 // NEON VMOVs between scalar and core registers.
1891 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1892 dag oops, dag iops, Format f, InstrItinClass itin,
1893 string opc, string dt, string asm, list<dag> pattern>
1894 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
1896 let Inst{27-20} = opcod1;
1897 let Inst{11-8} = opcod2;
1898 let Inst{6-5} = opcod3;
1900 // A8.6.303, A8.6.328, A8.6.329
1901 let Inst{3-0} = 0b0000;
1903 let OutOperandList = oops;
1904 let InOperandList = !con(iops, (ins pred:$p));
1905 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1906 let Pattern = pattern;
1907 list<Predicate> Predicates = [HasNEON];
1909 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
1916 let Inst{31-28} = p{3-0};
1918 let Inst{19-16} = V{3-0};
1919 let Inst{15-12} = R{3-0};
1921 class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1922 dag oops, dag iops, InstrItinClass itin,
1923 string opc, string dt, string asm, list<dag> pattern>
1924 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
1925 opc, dt, asm, pattern>;
1926 class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1927 dag oops, dag iops, InstrItinClass itin,
1928 string opc, string dt, string asm, list<dag> pattern>
1929 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
1930 opc, dt, asm, pattern>;
1931 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1932 dag oops, dag iops, InstrItinClass itin,
1933 string opc, string dt, string asm, list<dag> pattern>
1934 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1935 opc, dt, asm, pattern>;
1937 // Vector Duplicate Lane (from scalar to all elements)
1938 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1939 InstrItinClass itin, string opc, string dt, string asm,
1941 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1942 let Inst{24-23} = 0b11;
1943 let Inst{21-20} = 0b11;
1944 let Inst{19-16} = op19_16;
1945 let Inst{11-7} = 0b11000;
1953 let Inst{22} = Vd{4};
1954 let Inst{15-12} = Vd{3-0};
1955 let Inst{5} = Vm{4};
1956 let Inst{3-0} = Vm{3-0};
1959 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1960 // for single-precision FP.
1961 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1962 list<Predicate> Predicates = [HasNEON,UseNEONForFP];