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, i32imm),
152 (ops (i32 14), (i32 zero_reg))> {
153 let PrintMethod = "printPredicateOperand";
154 let ParserMatchClass = CondCodeOperand;
155 let DecoderMethod = "DecodePredicateOperand";
158 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
159 def CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
160 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
161 let EncoderMethod = "getCCOutOpValue";
162 let PrintMethod = "printSBitModifierOperand";
163 let ParserMatchClass = CCOutOperand;
164 let DecoderMethod = "DecodeCCOutOperand";
167 // Same as cc_out except it defaults to setting CPSR.
168 def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
169 let EncoderMethod = "getCCOutOpValue";
170 let PrintMethod = "printSBitModifierOperand";
171 let ParserMatchClass = CCOutOperand;
172 let DecoderMethod = "DecodeCCOutOperand";
175 // ARM special operands for disassembly only.
177 def SetEndAsmOperand : AsmOperandClass {
178 let Name = "SetEndImm";
179 let ParserMethod = "parseSetEndImm";
181 def setend_op : Operand<i32> {
182 let PrintMethod = "printSetendOperand";
183 let ParserMatchClass = SetEndAsmOperand;
186 def MSRMaskOperand : AsmOperandClass {
187 let Name = "MSRMask";
188 let ParserMethod = "parseMSRMaskOperand";
190 def msr_mask : Operand<i32> {
191 let PrintMethod = "printMSRMaskOperand";
192 let DecoderMethod = "DecodeMSRMask";
193 let ParserMatchClass = MSRMaskOperand;
196 // Shift Right Immediate - A shift right immediate is encoded differently from
197 // other shift immediates. The imm6 field is encoded like so:
200 // 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
201 // 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
202 // 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
203 // 64 64 - <imm> is encoded in imm6<5:0>
204 def shr_imm8 : Operand<i32> {
205 let EncoderMethod = "getShiftRight8Imm";
206 let DecoderMethod = "DecodeShiftRight8Imm";
208 def shr_imm16 : Operand<i32> {
209 let EncoderMethod = "getShiftRight16Imm";
210 let DecoderMethod = "DecodeShiftRight16Imm";
212 def shr_imm32 : Operand<i32> {
213 let EncoderMethod = "getShiftRight32Imm";
214 let DecoderMethod = "DecodeShiftRight32Imm";
216 def shr_imm64 : Operand<i32> {
217 let EncoderMethod = "getShiftRight64Imm";
218 let DecoderMethod = "DecodeShiftRight64Imm";
221 //===----------------------------------------------------------------------===//
222 // ARM Assembler alias templates.
224 class ARMInstAlias<string Asm, dag Result, bit Emit = 0b1>
225 : InstAlias<Asm, Result, Emit>, Requires<[IsARM]>;
226 class tInstAlias<string Asm, dag Result, bit Emit = 0b1>
227 : InstAlias<Asm, Result, Emit>, Requires<[IsThumb]>;
228 class t2InstAlias<string Asm, dag Result, bit Emit = 0b1>
229 : InstAlias<Asm, Result, Emit>, Requires<[IsThumb2]>;
230 class VFP2InstAlias<string Asm, dag Result, bit Emit = 0b1>
231 : InstAlias<Asm, Result, Emit>, Requires<[HasVFP2]>;
232 class VFP3InstAlias<string Asm, dag Result, bit Emit = 0b1>
233 : InstAlias<Asm, Result, Emit>, Requires<[HasVFP3]>;
235 //===----------------------------------------------------------------------===//
236 // ARM Instruction templates.
240 class InstTemplate<AddrMode am, int sz, IndexMode im,
241 Format f, Domain d, string cstr, InstrItinClass itin>
243 let Namespace = "ARM";
248 bits<2> IndexModeBits = IM.Value;
250 bits<6> Form = F.Value;
252 bit isUnaryDataProc = 0;
253 bit canXformTo16Bit = 0;
254 // The instruction is a 16-bit flag setting Thumb instruction. Used
255 // by the parser to determine whether to require the 'S' suffix on the
256 // mnemonic (when not in an IT block) or preclude it (when in an IT block).
257 bit thumbArithFlagSetting = 0;
259 // If this is a pseudo instruction, mark it isCodeGenOnly.
260 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
262 // The layout of TSFlags should be kept in sync with ARMBaseInfo.h.
263 let TSFlags{4-0} = AM.Value;
264 let TSFlags{6-5} = IndexModeBits;
265 let TSFlags{12-7} = Form;
266 let TSFlags{13} = isUnaryDataProc;
267 let TSFlags{14} = canXformTo16Bit;
268 let TSFlags{17-15} = D.Value;
269 let TSFlags{18} = thumbArithFlagSetting;
271 let Constraints = cstr;
272 let Itinerary = itin;
279 class InstARM<AddrMode am, int sz, IndexMode im,
280 Format f, Domain d, string cstr, InstrItinClass itin>
281 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
282 let DecoderNamespace = "ARM";
285 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
286 // on by adding flavors to specific instructions.
287 class InstThumb<AddrMode am, int sz, IndexMode im,
288 Format f, Domain d, string cstr, InstrItinClass itin>
289 : InstTemplate<am, sz, im, f, d, cstr, itin> {
290 let DecoderNamespace = "Thumb";
293 class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
294 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
295 GenericDomain, "", itin> {
296 let OutOperandList = oops;
297 let InOperandList = iops;
298 let Pattern = pattern;
299 let isCodeGenOnly = 1;
303 // PseudoInst that's ARM-mode only.
304 class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
306 : PseudoInst<oops, iops, itin, pattern> {
308 list<Predicate> Predicates = [IsARM];
311 // PseudoInst that's Thumb-mode only.
312 class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
314 : PseudoInst<oops, iops, itin, pattern> {
316 list<Predicate> Predicates = [IsThumb];
319 // PseudoInst that's Thumb2-mode only.
320 class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
322 : PseudoInst<oops, iops, itin, pattern> {
324 list<Predicate> Predicates = [IsThumb2];
327 class ARMPseudoExpand<dag oops, dag iops, int sz,
328 InstrItinClass itin, list<dag> pattern,
330 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
331 PseudoInstExpansion<Result>;
333 class tPseudoExpand<dag oops, dag iops, int sz,
334 InstrItinClass itin, list<dag> pattern,
336 : tPseudoInst<oops, iops, sz, itin, pattern>,
337 PseudoInstExpansion<Result>;
339 class t2PseudoExpand<dag oops, dag iops, int sz,
340 InstrItinClass itin, list<dag> pattern,
342 : t2PseudoInst<oops, iops, sz, itin, pattern>,
343 PseudoInstExpansion<Result>;
345 // Almost all ARM instructions are predicable.
346 class I<dag oops, dag iops, AddrMode am, int sz,
347 IndexMode im, Format f, InstrItinClass itin,
348 string opc, string asm, string cstr,
350 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
353 let OutOperandList = oops;
354 let InOperandList = !con(iops, (ins pred:$p));
355 let AsmString = !strconcat(opc, "${p}", asm);
356 let Pattern = pattern;
357 list<Predicate> Predicates = [IsARM];
360 // A few are not predicable
361 class InoP<dag oops, dag iops, AddrMode am, int sz,
362 IndexMode im, Format f, InstrItinClass itin,
363 string opc, string asm, string cstr,
365 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
366 let OutOperandList = oops;
367 let InOperandList = iops;
368 let AsmString = !strconcat(opc, asm);
369 let Pattern = pattern;
370 let isPredicable = 0;
371 list<Predicate> Predicates = [IsARM];
374 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
375 // operand since by default it's a zero register. It will become an implicit def
376 // once it's "flipped".
377 class sI<dag oops, dag iops, AddrMode am, int sz,
378 IndexMode im, Format f, InstrItinClass itin,
379 string opc, string asm, string cstr,
381 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
382 bits<4> p; // Predicate operand
383 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
387 let OutOperandList = oops;
388 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
389 let AsmString = !strconcat(opc, "${s}${p}", asm);
390 let Pattern = pattern;
391 list<Predicate> Predicates = [IsARM];
395 class XI<dag oops, dag iops, AddrMode am, int sz,
396 IndexMode im, Format f, InstrItinClass itin,
397 string asm, string cstr, list<dag> pattern>
398 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
399 let OutOperandList = oops;
400 let InOperandList = iops;
402 let Pattern = pattern;
403 list<Predicate> Predicates = [IsARM];
406 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
407 string opc, string asm, list<dag> pattern>
408 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
409 opc, asm, "", pattern>;
410 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
411 string opc, string asm, list<dag> pattern>
412 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
413 opc, asm, "", pattern>;
414 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
415 string asm, list<dag> pattern>
416 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
418 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
419 string opc, string asm, list<dag> pattern>
420 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
421 opc, asm, "", pattern>;
423 // Ctrl flow instructions
424 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
425 string opc, string asm, list<dag> pattern>
426 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
427 opc, asm, "", pattern> {
428 let Inst{27-24} = opcod;
430 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
431 string asm, list<dag> pattern>
432 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
434 let Inst{27-24} = opcod;
437 // BR_JT instructions
438 class JTI<dag oops, dag iops, InstrItinClass itin,
439 string asm, list<dag> pattern>
440 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
443 // Atomic load/store instructions
444 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
445 string opc, string asm, list<dag> pattern>
446 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
447 opc, asm, "", pattern> {
450 let Inst{27-23} = 0b00011;
451 let Inst{22-21} = opcod;
453 let Inst{19-16} = addr;
454 let Inst{15-12} = Rt;
455 let Inst{11-0} = 0b111110011111;
457 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
458 string opc, string asm, list<dag> pattern>
459 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
460 opc, asm, "", pattern> {
464 let Inst{27-23} = 0b00011;
465 let Inst{22-21} = opcod;
467 let Inst{19-16} = addr;
468 let Inst{15-12} = Rd;
469 let Inst{11-4} = 0b11111001;
472 class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
473 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
477 let Inst{27-23} = 0b00010;
479 let Inst{21-20} = 0b00;
480 let Inst{19-16} = addr;
481 let Inst{15-12} = Rt;
482 let Inst{11-4} = 0b00001001;
485 let DecoderMethod = "DecodeSwap";
488 // addrmode1 instructions
489 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
490 string opc, string asm, list<dag> pattern>
491 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
492 opc, asm, "", pattern> {
493 let Inst{24-21} = opcod;
494 let Inst{27-26} = 0b00;
496 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
497 string opc, string asm, list<dag> pattern>
498 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
499 opc, asm, "", pattern> {
500 let Inst{24-21} = opcod;
501 let Inst{27-26} = 0b00;
503 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
504 string asm, list<dag> pattern>
505 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
507 let Inst{24-21} = opcod;
508 let Inst{27-26} = 0b00;
513 // LDR/LDRB/STR/STRB/...
514 class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
515 Format f, InstrItinClass itin, string opc, string asm,
517 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
519 let Inst{27-25} = op;
520 let Inst{24} = 1; // 24 == P
522 let Inst{22} = isByte;
523 let Inst{21} = 0; // 21 == W
526 // Indexed load/stores
527 class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
528 IndexMode im, Format f, InstrItinClass itin, string opc,
529 string asm, string cstr, list<dag> pattern>
530 : I<oops, iops, AddrMode2, 4, im, f, itin,
531 opc, asm, cstr, pattern> {
533 let Inst{27-26} = 0b01;
534 let Inst{24} = isPre; // P bit
535 let Inst{22} = isByte; // B bit
536 let Inst{21} = isPre; // W bit
537 let Inst{20} = isLd; // L bit
538 let Inst{15-12} = Rt;
540 class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
541 IndexMode im, Format f, InstrItinClass itin, string opc,
542 string asm, string cstr, list<dag> pattern>
543 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
545 // AM2 store w/ two operands: (GPR, am2offset)
551 let Inst{23} = offset{12};
552 let Inst{19-16} = Rn;
553 let Inst{11-5} = offset{11-5};
555 let Inst{3-0} = offset{3-0};
558 class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
559 IndexMode im, Format f, InstrItinClass itin, string opc,
560 string asm, string cstr, list<dag> pattern>
561 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
563 // AM2 store w/ two operands: (GPR, am2offset)
569 let Inst{23} = offset{12};
570 let Inst{19-16} = Rn;
571 let Inst{11-0} = offset{11-0};
575 // FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
576 // but for now use this class for STRT and STRBT.
577 class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
578 IndexMode im, Format f, InstrItinClass itin, string opc,
579 string asm, string cstr, list<dag> pattern>
580 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
582 // AM2 store w/ two operands: (GPR, am2offset)
584 // {13} 1 == Rm, 0 == imm12
588 let Inst{25} = addr{13};
589 let Inst{23} = addr{12};
590 let Inst{19-16} = addr{17-14};
591 let Inst{11-0} = addr{11-0};
594 // addrmode3 instructions
595 class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
596 InstrItinClass itin, string opc, string asm, list<dag> pattern>
597 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
598 opc, asm, "", pattern> {
601 let Inst{27-25} = 0b000;
602 let Inst{24} = 1; // P bit
603 let Inst{23} = addr{8}; // U bit
604 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
605 let Inst{21} = 0; // W bit
606 let Inst{20} = op20; // L bit
607 let Inst{19-16} = addr{12-9}; // Rn
608 let Inst{15-12} = Rt; // Rt
609 let Inst{11-8} = addr{7-4}; // imm7_4/zero
611 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
613 let DecoderMethod = "DecodeAddrMode3Instruction";
616 class AI3ldstidx<bits<4> op, bit op20, bit isPre, dag oops, dag iops,
617 IndexMode im, Format f, InstrItinClass itin, string opc,
618 string asm, string cstr, list<dag> pattern>
619 : I<oops, iops, AddrMode3, 4, im, f, itin,
620 opc, asm, cstr, pattern> {
622 let Inst{27-25} = 0b000;
623 let Inst{24} = isPre; // P bit
624 let Inst{21} = isPre; // W bit
625 let Inst{20} = op20; // L bit
626 let Inst{15-12} = Rt; // Rt
630 // FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
631 // but for now use this class for LDRSBT, LDRHT, LDSHT.
632 class AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
633 IndexMode im, Format f, InstrItinClass itin, string opc,
634 string asm, string cstr, list<dag> pattern>
635 : I<oops, iops, AddrMode3, 4, im, f, itin, opc, asm, cstr, pattern> {
636 // {13} 1 == imm8, 0 == Rm
643 let Inst{27-25} = 0b000;
644 let Inst{24} = 0; // P bit
646 let Inst{20} = isLoad; // L bit
647 let Inst{19-16} = addr; // Rn
648 let Inst{15-12} = Rt; // Rt
653 class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
654 string opc, string asm, list<dag> pattern>
655 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
656 opc, asm, "", pattern> {
659 let Inst{27-25} = 0b000;
660 let Inst{24} = 1; // P bit
661 let Inst{23} = addr{8}; // U bit
662 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
663 let Inst{21} = 0; // W bit
664 let Inst{20} = 0; // L bit
665 let Inst{19-16} = addr{12-9}; // Rn
666 let Inst{15-12} = Rt; // Rt
667 let Inst{11-8} = addr{7-4}; // imm7_4/zero
669 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
670 let DecoderMethod = "DecodeAddrMode3Instruction";
673 // addrmode4 instructions
674 class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
675 string asm, string cstr, list<dag> pattern>
676 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
681 let Inst{27-25} = 0b100;
682 let Inst{22} = 0; // S bit
683 let Inst{19-16} = Rn;
684 let Inst{15-0} = regs;
687 // Unsigned multiply, multiply-accumulate instructions.
688 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
689 string opc, string asm, list<dag> pattern>
690 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
691 opc, asm, "", pattern> {
692 let Inst{7-4} = 0b1001;
693 let Inst{20} = 0; // S bit
694 let Inst{27-21} = opcod;
696 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
697 string opc, string asm, list<dag> pattern>
698 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
699 opc, asm, "", pattern> {
700 let Inst{7-4} = 0b1001;
701 let Inst{27-21} = opcod;
704 // Most significant word multiply
705 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
706 InstrItinClass itin, string opc, string asm, list<dag> pattern>
707 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
708 opc, asm, "", pattern> {
712 let Inst{7-4} = opc7_4;
714 let Inst{27-21} = opcod;
715 let Inst{19-16} = Rd;
719 // MSW multiple w/ Ra operand
720 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
721 InstrItinClass itin, string opc, string asm, list<dag> pattern>
722 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
724 let Inst{15-12} = Ra;
727 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
728 class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
729 InstrItinClass itin, string opc, string asm, list<dag> pattern>
730 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
731 opc, asm, "", pattern> {
737 let Inst{27-21} = opcod;
738 let Inst{6-5} = bit6_5;
742 class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
743 InstrItinClass itin, string opc, string asm, list<dag> pattern>
744 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
746 let Inst{19-16} = Rd;
749 // AMulxyI with Ra operand
750 class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
751 InstrItinClass itin, string opc, string asm, list<dag> pattern>
752 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
754 let Inst{15-12} = Ra;
757 class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
758 InstrItinClass itin, string opc, string asm, list<dag> pattern>
759 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
762 let Inst{19-16} = RdHi;
763 let Inst{15-12} = RdLo;
766 // Extend instructions.
767 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
768 string opc, string asm, list<dag> pattern>
769 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
770 opc, asm, "", pattern> {
771 // All AExtI instructions have Rd and Rm register operands.
774 let Inst{15-12} = Rd;
776 let Inst{7-4} = 0b0111;
777 let Inst{9-8} = 0b00;
778 let Inst{27-20} = opcod;
781 // Misc Arithmetic instructions.
782 class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
783 InstrItinClass itin, string opc, string asm, list<dag> pattern>
784 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
785 opc, asm, "", pattern> {
788 let Inst{27-20} = opcod;
789 let Inst{19-16} = 0b1111;
790 let Inst{15-12} = Rd;
791 let Inst{11-8} = 0b1111;
792 let Inst{7-4} = opc7_4;
797 def PKHLSLAsmOperand : AsmOperandClass {
798 let Name = "PKHLSLImm";
799 let ParserMethod = "parsePKHLSLImm";
801 def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
802 let PrintMethod = "printPKHLSLShiftImm";
803 let ParserMatchClass = PKHLSLAsmOperand;
805 def PKHASRAsmOperand : AsmOperandClass {
806 let Name = "PKHASRImm";
807 let ParserMethod = "parsePKHASRImm";
809 def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
810 let PrintMethod = "printPKHASRShiftImm";
811 let ParserMatchClass = PKHASRAsmOperand;
814 class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
815 string opc, string asm, list<dag> pattern>
816 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
817 opc, asm, "", pattern> {
822 let Inst{27-20} = opcod;
823 let Inst{19-16} = Rn;
824 let Inst{15-12} = Rd;
827 let Inst{5-4} = 0b01;
831 //===----------------------------------------------------------------------===//
833 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
834 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
835 list<Predicate> Predicates = [IsARM];
837 class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
838 list<Predicate> Predicates = [IsARM, HasV5T];
840 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
841 list<Predicate> Predicates = [IsARM, HasV5TE];
843 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
844 list<Predicate> Predicates = [IsARM, HasV6];
847 //===----------------------------------------------------------------------===//
848 // Thumb Instruction Format Definitions.
851 class ThumbI<dag oops, dag iops, AddrMode am, int sz,
852 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
853 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
854 let OutOperandList = oops;
855 let InOperandList = iops;
857 let Pattern = pattern;
858 list<Predicate> Predicates = [IsThumb];
861 // TI - Thumb instruction.
862 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
863 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
865 // Two-address instructions
866 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
868 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
871 // tBL, tBX 32-bit instructions
872 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
873 dag oops, dag iops, InstrItinClass itin, string asm,
875 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
877 let Inst{31-27} = opcod1;
878 let Inst{15-14} = opcod2;
879 let Inst{12} = opcod3;
882 // BR_JT instructions
883 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
885 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
888 class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
889 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
890 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
891 let OutOperandList = oops;
892 let InOperandList = iops;
894 let Pattern = pattern;
895 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
898 class T1I<dag oops, dag iops, InstrItinClass itin,
899 string asm, list<dag> pattern>
900 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
901 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
902 string asm, list<dag> pattern>
903 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
905 // Two-address instructions
906 class T1It<dag oops, dag iops, InstrItinClass itin,
907 string asm, string cstr, list<dag> pattern>
908 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
911 // Thumb1 instruction that can either be predicated or set CPSR.
912 class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
914 string opc, string asm, string cstr, list<dag> pattern>
915 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
916 let OutOperandList = !con(oops, (outs s_cc_out:$s));
917 let InOperandList = !con(iops, (ins pred:$p));
918 let AsmString = !strconcat(opc, "${s}${p}", asm);
919 let Pattern = pattern;
920 let thumbArithFlagSetting = 1;
921 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
922 let DecoderNamespace = "ThumbSBit";
925 class T1sI<dag oops, dag iops, InstrItinClass itin,
926 string opc, string asm, list<dag> pattern>
927 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
929 // Two-address instructions
930 class T1sIt<dag oops, dag iops, InstrItinClass itin,
931 string opc, string asm, list<dag> pattern>
932 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
933 "$Rn = $Rdn", pattern>;
935 // Thumb1 instruction that can be predicated.
936 class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
938 string opc, string asm, string cstr, list<dag> pattern>
939 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
940 let OutOperandList = oops;
941 let InOperandList = !con(iops, (ins pred:$p));
942 let AsmString = !strconcat(opc, "${p}", asm);
943 let Pattern = pattern;
944 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
947 class T1pI<dag oops, dag iops, InstrItinClass itin,
948 string opc, string asm, list<dag> pattern>
949 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
951 // Two-address instructions
952 class T1pIt<dag oops, dag iops, InstrItinClass itin,
953 string opc, string asm, list<dag> pattern>
954 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
955 "$Rn = $Rdn", pattern>;
957 class T1pIs<dag oops, dag iops,
958 InstrItinClass itin, string opc, string asm, list<dag> pattern>
959 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
961 class Encoding16 : Encoding {
962 let Inst{31-16} = 0x0000;
965 // A6.2 16-bit Thumb instruction encoding
966 class T1Encoding<bits<6> opcode> : Encoding16 {
967 let Inst{15-10} = opcode;
970 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
971 class T1General<bits<5> opcode> : Encoding16 {
972 let Inst{15-14} = 0b00;
973 let Inst{13-9} = opcode;
976 // A6.2.2 Data-processing encoding.
977 class T1DataProcessing<bits<4> opcode> : Encoding16 {
978 let Inst{15-10} = 0b010000;
979 let Inst{9-6} = opcode;
982 // A6.2.3 Special data instructions and branch and exchange encoding.
983 class T1Special<bits<4> opcode> : Encoding16 {
984 let Inst{15-10} = 0b010001;
985 let Inst{9-6} = opcode;
988 // A6.2.4 Load/store single data item encoding.
989 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
990 let Inst{15-12} = opA;
991 let Inst{11-9} = opB;
993 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
995 class T1BranchCond<bits<4> opcode> : Encoding16 {
996 let Inst{15-12} = opcode;
999 // Helper classes to encode Thumb1 loads and stores. For immediates, the
1000 // following bits are used for "opA" (see A6.2.4):
1002 // 0b0110 => Immediate, 4 bytes
1003 // 0b1000 => Immediate, 2 bytes
1004 // 0b0111 => Immediate, 1 byte
1005 class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1006 InstrItinClass itin, string opc, string asm,
1008 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1009 T1LoadStore<0b0101, opcode> {
1012 let Inst{8-6} = addr{5-3}; // Rm
1013 let Inst{5-3} = addr{2-0}; // Rn
1016 class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1017 InstrItinClass itin, string opc, string asm,
1019 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1020 T1LoadStore<opA, {opB,?,?}> {
1023 let Inst{10-6} = addr{7-3}; // imm5
1024 let Inst{5-3} = addr{2-0}; // Rn
1028 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1029 class T1Misc<bits<7> opcode> : Encoding16 {
1030 let Inst{15-12} = 0b1011;
1031 let Inst{11-5} = opcode;
1034 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1035 class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
1036 InstrItinClass itin,
1037 string opc, string asm, string cstr, list<dag> pattern>
1038 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1039 let OutOperandList = oops;
1040 let InOperandList = !con(iops, (ins pred:$p));
1041 let AsmString = !strconcat(opc, "${p}", asm);
1042 let Pattern = pattern;
1043 list<Predicate> Predicates = [IsThumb2];
1044 let DecoderNamespace = "Thumb2";
1047 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1048 // input operand since by default it's a zero register. It will become an
1049 // implicit def once it's "flipped".
1051 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1053 class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
1054 InstrItinClass itin,
1055 string opc, string asm, string cstr, list<dag> pattern>
1056 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1057 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1060 let OutOperandList = oops;
1061 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1062 let AsmString = !strconcat(opc, "${s}${p}", asm);
1063 let Pattern = pattern;
1064 list<Predicate> Predicates = [IsThumb2];
1065 let DecoderNamespace = "Thumb2";
1069 class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
1070 InstrItinClass itin,
1071 string asm, string cstr, list<dag> pattern>
1072 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1073 let OutOperandList = oops;
1074 let InOperandList = iops;
1075 let AsmString = asm;
1076 let Pattern = pattern;
1077 list<Predicate> Predicates = [IsThumb2];
1078 let DecoderNamespace = "Thumb2";
1081 class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
1082 InstrItinClass itin,
1083 string asm, string cstr, list<dag> pattern>
1084 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1085 let OutOperandList = oops;
1086 let InOperandList = iops;
1087 let AsmString = asm;
1088 let Pattern = pattern;
1089 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1090 let DecoderNamespace = "Thumb";
1093 class T2I<dag oops, dag iops, InstrItinClass itin,
1094 string opc, string asm, list<dag> pattern>
1095 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1096 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1097 string opc, string asm, list<dag> pattern>
1098 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
1099 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1100 string opc, string asm, list<dag> pattern>
1101 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
1102 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1103 string opc, string asm, list<dag> pattern>
1104 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
1105 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1106 string opc, string asm, list<dag> pattern>
1107 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
1108 class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1109 string opc, string asm, string cstr, list<dag> pattern>
1110 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, cstr,
1115 let Inst{31-25} = 0b1110100;
1117 let Inst{23} = addr{8};
1120 let Inst{20} = isLoad;
1121 let Inst{19-16} = addr{12-9};
1122 let Inst{15-12} = Rt{3-0};
1123 let Inst{11-8} = Rt2{3-0};
1124 let Inst{7-0} = addr{7-0};
1126 class T2Ii8s4post<bit P, bit W, bit isLoad, dag oops, dag iops,
1127 InstrItinClass itin, string opc, string asm, string cstr,
1129 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, cstr,
1135 let Inst{31-25} = 0b1110100;
1137 let Inst{23} = imm{8};
1140 let Inst{20} = isLoad;
1141 let Inst{19-16} = addr;
1142 let Inst{15-12} = Rt{3-0};
1143 let Inst{11-8} = Rt2{3-0};
1144 let Inst{7-0} = imm{7-0};
1147 class T2sI<dag oops, dag iops, InstrItinClass itin,
1148 string opc, string asm, list<dag> pattern>
1149 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1151 class T2XI<dag oops, dag iops, InstrItinClass itin,
1152 string asm, list<dag> pattern>
1153 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
1154 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1155 string asm, list<dag> pattern>
1156 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
1158 // Move to/from coprocessor instructions
1159 class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
1160 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
1161 let Inst{31-28} = opc;
1164 // Two-address instructions
1165 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1166 string asm, string cstr, list<dag> pattern>
1167 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
1169 // T2Ipreldst - Thumb2 pre-indexed load / store instructions.
1170 class T2Ipreldst<bit signed, bits<2> opcod, bit load, bit pre,
1172 AddrMode am, IndexMode im, InstrItinClass itin,
1173 string opc, string asm, string cstr, list<dag> pattern>
1174 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1175 let OutOperandList = oops;
1176 let InOperandList = !con(iops, (ins pred:$p));
1177 let AsmString = !strconcat(opc, "${p}", asm);
1178 let Pattern = pattern;
1179 list<Predicate> Predicates = [IsThumb2];
1180 let DecoderNamespace = "Thumb2";
1184 let Inst{31-27} = 0b11111;
1185 let Inst{26-25} = 0b00;
1186 let Inst{24} = signed;
1188 let Inst{22-21} = opcod;
1189 let Inst{20} = load;
1190 let Inst{19-16} = addr{12-9};
1191 let Inst{15-12} = Rt{3-0};
1193 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1194 let Inst{10} = pre; // The P bit.
1195 let Inst{9} = addr{8}; // Sign bit
1196 let Inst{8} = 1; // The W bit.
1197 let Inst{7-0} = addr{7-0};
1199 let DecoderMethod = "DecodeT2LdStPre";
1202 // T2Ipostldst - Thumb2 post-indexed load / store instructions.
1203 class T2Ipostldst<bit signed, bits<2> opcod, bit load, bit pre,
1205 AddrMode am, IndexMode im, InstrItinClass itin,
1206 string opc, string asm, string cstr, list<dag> pattern>
1207 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1208 let OutOperandList = oops;
1209 let InOperandList = !con(iops, (ins pred:$p));
1210 let AsmString = !strconcat(opc, "${p}", asm);
1211 let Pattern = pattern;
1212 list<Predicate> Predicates = [IsThumb2];
1213 let DecoderNamespace = "Thumb2";
1218 let Inst{31-27} = 0b11111;
1219 let Inst{26-25} = 0b00;
1220 let Inst{24} = signed;
1222 let Inst{22-21} = opcod;
1223 let Inst{20} = load;
1224 let Inst{19-16} = Rn;
1225 let Inst{15-12} = Rt{3-0};
1227 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1228 let Inst{10} = pre; // The P bit.
1229 let Inst{9} = offset{8}; // Sign bit
1230 let Inst{8} = 1; // The W bit.
1231 let Inst{7-0} = offset{7-0};
1233 let DecoderMethod = "DecodeT2LdStPre";
1236 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1237 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1238 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
1241 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1242 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1243 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1246 // T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1247 class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1248 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1251 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1252 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1253 list<Predicate> Predicates = [IsThumb2];
1256 //===----------------------------------------------------------------------===//
1258 //===----------------------------------------------------------------------===//
1259 // ARM VFP Instruction templates.
1262 // Almost all VFP instructions are predicable.
1263 class VFPI<dag oops, dag iops, AddrMode am, int sz,
1264 IndexMode im, Format f, InstrItinClass itin,
1265 string opc, string asm, string cstr, list<dag> pattern>
1266 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1268 let Inst{31-28} = p;
1269 let OutOperandList = oops;
1270 let InOperandList = !con(iops, (ins pred:$p));
1271 let AsmString = !strconcat(opc, "${p}", asm);
1272 let Pattern = pattern;
1273 let PostEncoderMethod = "VFPThumb2PostEncoder";
1274 let DecoderNamespace = "VFP";
1275 list<Predicate> Predicates = [HasVFP2];
1279 class VFPXI<dag oops, dag iops, AddrMode am, int sz,
1280 IndexMode im, Format f, InstrItinClass itin,
1281 string asm, string cstr, list<dag> pattern>
1282 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1284 let Inst{31-28} = p;
1285 let OutOperandList = oops;
1286 let InOperandList = iops;
1287 let AsmString = asm;
1288 let Pattern = pattern;
1289 let PostEncoderMethod = "VFPThumb2PostEncoder";
1290 let DecoderNamespace = "VFP";
1291 list<Predicate> Predicates = [HasVFP2];
1294 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1295 string opc, string asm, list<dag> pattern>
1296 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
1297 opc, asm, "", pattern> {
1298 let PostEncoderMethod = "VFPThumb2PostEncoder";
1301 // ARM VFP addrmode5 loads and stores
1302 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1303 InstrItinClass itin,
1304 string opc, string asm, list<dag> pattern>
1305 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1306 VFPLdStFrm, itin, opc, asm, "", pattern> {
1307 // Instruction operands.
1311 // Encode instruction operands.
1312 let Inst{23} = addr{8}; // U (add = (U == '1'))
1313 let Inst{22} = Dd{4};
1314 let Inst{19-16} = addr{12-9}; // Rn
1315 let Inst{15-12} = Dd{3-0};
1316 let Inst{7-0} = addr{7-0}; // imm8
1318 // TODO: Mark the instructions with the appropriate subtarget info.
1319 let Inst{27-24} = opcod1;
1320 let Inst{21-20} = opcod2;
1321 let Inst{11-9} = 0b101;
1322 let Inst{8} = 1; // Double precision
1324 // Loads & stores operate on both NEON and VFP pipelines.
1325 let D = VFPNeonDomain;
1328 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1329 InstrItinClass itin,
1330 string opc, string asm, list<dag> pattern>
1331 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1332 VFPLdStFrm, itin, opc, asm, "", pattern> {
1333 // Instruction operands.
1337 // Encode instruction operands.
1338 let Inst{23} = addr{8}; // U (add = (U == '1'))
1339 let Inst{22} = Sd{0};
1340 let Inst{19-16} = addr{12-9}; // Rn
1341 let Inst{15-12} = Sd{4-1};
1342 let Inst{7-0} = addr{7-0}; // imm8
1344 // TODO: Mark the instructions with the appropriate subtarget info.
1345 let Inst{27-24} = opcod1;
1346 let Inst{21-20} = opcod2;
1347 let Inst{11-9} = 0b101;
1348 let Inst{8} = 0; // Single precision
1350 // Loads & stores operate on both NEON and VFP pipelines.
1351 let D = VFPNeonDomain;
1354 // VFP Load / store multiple pseudo instructions.
1355 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1357 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
1359 let OutOperandList = oops;
1360 let InOperandList = !con(iops, (ins pred:$p));
1361 let Pattern = pattern;
1362 list<Predicate> Predicates = [HasVFP2];
1365 // Load / store multiple
1366 class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1367 string asm, string cstr, list<dag> pattern>
1368 : VFPXI<oops, iops, AddrMode4, 4, im,
1369 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1370 // Instruction operands.
1374 // Encode instruction operands.
1375 let Inst{19-16} = Rn;
1376 let Inst{22} = regs{12};
1377 let Inst{15-12} = regs{11-8};
1378 let Inst{7-0} = regs{7-0};
1380 // TODO: Mark the instructions with the appropriate subtarget info.
1381 let Inst{27-25} = 0b110;
1382 let Inst{11-9} = 0b101;
1383 let Inst{8} = 1; // Double precision
1386 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1387 string asm, string cstr, list<dag> pattern>
1388 : VFPXI<oops, iops, AddrMode4, 4, im,
1389 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1390 // Instruction operands.
1394 // Encode instruction operands.
1395 let Inst{19-16} = Rn;
1396 let Inst{22} = regs{8};
1397 let Inst{15-12} = regs{12-9};
1398 let Inst{7-0} = regs{7-0};
1400 // TODO: Mark the instructions with the appropriate subtarget info.
1401 let Inst{27-25} = 0b110;
1402 let Inst{11-9} = 0b101;
1403 let Inst{8} = 0; // Single precision
1406 // Double precision, unary
1407 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1408 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1409 string asm, list<dag> pattern>
1410 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1411 // Instruction operands.
1415 // Encode instruction operands.
1416 let Inst{3-0} = Dm{3-0};
1417 let Inst{5} = Dm{4};
1418 let Inst{15-12} = Dd{3-0};
1419 let Inst{22} = Dd{4};
1421 let Inst{27-23} = opcod1;
1422 let Inst{21-20} = opcod2;
1423 let Inst{19-16} = opcod3;
1424 let Inst{11-9} = 0b101;
1425 let Inst{8} = 1; // Double precision
1426 let Inst{7-6} = opcod4;
1427 let Inst{4} = opcod5;
1430 // Double precision, binary
1431 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1432 dag iops, InstrItinClass itin, string opc, string asm,
1434 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1435 // Instruction operands.
1440 // Encode instruction operands.
1441 let Inst{3-0} = Dm{3-0};
1442 let Inst{5} = Dm{4};
1443 let Inst{19-16} = Dn{3-0};
1444 let Inst{7} = Dn{4};
1445 let Inst{15-12} = Dd{3-0};
1446 let Inst{22} = Dd{4};
1448 let Inst{27-23} = opcod1;
1449 let Inst{21-20} = opcod2;
1450 let Inst{11-9} = 0b101;
1451 let Inst{8} = 1; // Double precision
1456 // Single precision, unary
1457 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1458 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1459 string asm, list<dag> pattern>
1460 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1461 // Instruction operands.
1465 // Encode instruction operands.
1466 let Inst{3-0} = Sm{4-1};
1467 let Inst{5} = Sm{0};
1468 let Inst{15-12} = Sd{4-1};
1469 let Inst{22} = Sd{0};
1471 let Inst{27-23} = opcod1;
1472 let Inst{21-20} = opcod2;
1473 let Inst{19-16} = opcod3;
1474 let Inst{11-9} = 0b101;
1475 let Inst{8} = 0; // Single precision
1476 let Inst{7-6} = opcod4;
1477 let Inst{4} = opcod5;
1480 // Single precision unary, if no NEON. Same as ASuI except not available if
1482 class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1483 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1484 string asm, list<dag> pattern>
1485 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1487 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1490 // Single precision, binary
1491 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1492 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1493 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1494 // Instruction operands.
1499 // Encode instruction operands.
1500 let Inst{3-0} = Sm{4-1};
1501 let Inst{5} = Sm{0};
1502 let Inst{19-16} = Sn{4-1};
1503 let Inst{7} = Sn{0};
1504 let Inst{15-12} = Sd{4-1};
1505 let Inst{22} = Sd{0};
1507 let Inst{27-23} = opcod1;
1508 let Inst{21-20} = opcod2;
1509 let Inst{11-9} = 0b101;
1510 let Inst{8} = 0; // Single precision
1515 // Single precision binary, if no NEON. Same as ASbI except not available if
1517 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1518 dag iops, InstrItinClass itin, string opc, string asm,
1520 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1521 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1523 // Instruction operands.
1528 // Encode instruction operands.
1529 let Inst{3-0} = Sm{4-1};
1530 let Inst{5} = Sm{0};
1531 let Inst{19-16} = Sn{4-1};
1532 let Inst{7} = Sn{0};
1533 let Inst{15-12} = Sd{4-1};
1534 let Inst{22} = Sd{0};
1537 // VFP conversion instructions
1538 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1539 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1541 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1542 let Inst{27-23} = opcod1;
1543 let Inst{21-20} = opcod2;
1544 let Inst{19-16} = opcod3;
1545 let Inst{11-8} = opcod4;
1550 // VFP conversion between floating-point and fixed-point
1551 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1552 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1554 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1555 // size (fixed-point number): sx == 0 ? 16 : 32
1556 let Inst{7} = op5; // sx
1559 // VFP conversion instructions, if no NEON
1560 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1561 dag oops, dag iops, InstrItinClass itin,
1562 string opc, string asm, list<dag> pattern>
1563 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1565 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1568 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1569 InstrItinClass itin,
1570 string opc, string asm, list<dag> pattern>
1571 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1572 let Inst{27-20} = opcod1;
1573 let Inst{11-8} = opcod2;
1577 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1578 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1579 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1581 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1582 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1583 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1585 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1586 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1587 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1589 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1590 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1591 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1593 //===----------------------------------------------------------------------===//
1595 //===----------------------------------------------------------------------===//
1596 // ARM NEON Instruction templates.
1599 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1600 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1602 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1603 let OutOperandList = oops;
1604 let InOperandList = !con(iops, (ins pred:$p));
1605 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1606 let Pattern = pattern;
1607 list<Predicate> Predicates = [HasNEON];
1608 let DecoderNamespace = "NEON";
1611 // Same as NeonI except it does not have a "data type" specifier.
1612 class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1613 InstrItinClass itin, string opc, string asm, string cstr,
1615 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1616 let OutOperandList = oops;
1617 let InOperandList = !con(iops, (ins pred:$p));
1618 let AsmString = !strconcat(opc, "${p}", "\t", asm);
1619 let Pattern = pattern;
1620 list<Predicate> Predicates = [HasNEON];
1621 let DecoderNamespace = "NEON";
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";
1636 let DecoderNamespace = "NEONLoadStore";
1642 let Inst{22} = Vd{4};
1643 let Inst{15-12} = Vd{3-0};
1644 let Inst{19-16} = Rn{3-0};
1645 let Inst{3-0} = Rm{3-0};
1648 class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1649 dag oops, dag iops, InstrItinClass itin,
1650 string opc, string dt, string asm, string cstr, list<dag> pattern>
1651 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1652 dt, asm, cstr, pattern> {
1656 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1657 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1659 let OutOperandList = oops;
1660 let InOperandList = !con(iops, (ins pred:$p));
1661 list<Predicate> Predicates = [HasNEON];
1664 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1666 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1668 let OutOperandList = oops;
1669 let InOperandList = !con(iops, (ins pred:$p));
1670 let Pattern = pattern;
1671 list<Predicate> Predicates = [HasNEON];
1674 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1675 string opc, string dt, string asm, string cstr, list<dag> pattern>
1676 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1678 let Inst{31-25} = 0b1111001;
1679 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1680 let DecoderNamespace = "NEONData";
1683 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1684 string opc, string asm, string cstr, list<dag> pattern>
1685 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1687 let Inst{31-25} = 0b1111001;
1688 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1689 let DecoderNamespace = "NEONData";
1692 // NEON "one register and a modified immediate" format.
1693 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1695 dag oops, dag iops, InstrItinClass itin,
1696 string opc, string dt, string asm, string cstr,
1698 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1699 let Inst{23} = op23;
1700 let Inst{21-19} = op21_19;
1701 let Inst{11-8} = op11_8;
1707 // Instruction operands.
1711 let Inst{15-12} = Vd{3-0};
1712 let Inst{22} = Vd{4};
1713 let Inst{24} = SIMM{7};
1714 let Inst{18-16} = SIMM{6-4};
1715 let Inst{3-0} = SIMM{3-0};
1716 let DecoderMethod = "DecodeNEONModImmInstruction";
1719 // NEON 2 vector register format.
1720 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1721 bits<5> op11_7, bit op6, bit op4,
1722 dag oops, dag iops, InstrItinClass itin,
1723 string opc, string dt, string asm, string cstr, list<dag> pattern>
1724 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1725 let Inst{24-23} = op24_23;
1726 let Inst{21-20} = op21_20;
1727 let Inst{19-18} = op19_18;
1728 let Inst{17-16} = op17_16;
1729 let Inst{11-7} = op11_7;
1733 // Instruction operands.
1737 let Inst{15-12} = Vd{3-0};
1738 let Inst{22} = Vd{4};
1739 let Inst{3-0} = Vm{3-0};
1740 let Inst{5} = Vm{4};
1743 // Same as N2V except it doesn't have a datatype suffix.
1744 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1745 bits<5> op11_7, bit op6, bit op4,
1746 dag oops, dag iops, InstrItinClass itin,
1747 string opc, string asm, string cstr, list<dag> pattern>
1748 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1749 let Inst{24-23} = op24_23;
1750 let Inst{21-20} = op21_20;
1751 let Inst{19-18} = op19_18;
1752 let Inst{17-16} = op17_16;
1753 let Inst{11-7} = op11_7;
1757 // Instruction operands.
1761 let Inst{15-12} = Vd{3-0};
1762 let Inst{22} = Vd{4};
1763 let Inst{3-0} = Vm{3-0};
1764 let Inst{5} = Vm{4};
1767 // NEON 2 vector register with immediate.
1768 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1769 dag oops, dag iops, Format f, InstrItinClass itin,
1770 string opc, string dt, string asm, string cstr, list<dag> pattern>
1771 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1772 let Inst{24} = op24;
1773 let Inst{23} = op23;
1774 let Inst{11-8} = op11_8;
1779 // Instruction operands.
1784 let Inst{15-12} = Vd{3-0};
1785 let Inst{22} = Vd{4};
1786 let Inst{3-0} = Vm{3-0};
1787 let Inst{5} = Vm{4};
1788 let Inst{21-16} = SIMM{5-0};
1791 // NEON 3 vector register format.
1793 class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1794 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1795 string opc, string dt, string asm, string cstr,
1797 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1798 let Inst{24} = op24;
1799 let Inst{23} = op23;
1800 let Inst{21-20} = op21_20;
1801 let Inst{11-8} = op11_8;
1806 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1807 dag oops, dag iops, Format f, InstrItinClass itin,
1808 string opc, string dt, string asm, string cstr, list<dag> pattern>
1809 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1810 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1812 // Instruction operands.
1817 let Inst{15-12} = Vd{3-0};
1818 let Inst{22} = Vd{4};
1819 let Inst{19-16} = Vn{3-0};
1820 let Inst{7} = Vn{4};
1821 let Inst{3-0} = Vm{3-0};
1822 let Inst{5} = Vm{4};
1825 class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1826 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1827 string opc, string dt, string asm, string cstr,
1829 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1830 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1832 // Instruction operands.
1838 let Inst{15-12} = Vd{3-0};
1839 let Inst{22} = Vd{4};
1840 let Inst{19-16} = Vn{3-0};
1841 let Inst{7} = Vn{4};
1842 let Inst{3-0} = Vm{3-0};
1846 class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1847 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1848 string opc, string dt, string asm, string cstr,
1850 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1851 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1853 // Instruction operands.
1859 let Inst{15-12} = Vd{3-0};
1860 let Inst{22} = Vd{4};
1861 let Inst{19-16} = Vn{3-0};
1862 let Inst{7} = Vn{4};
1863 let Inst{2-0} = Vm{2-0};
1864 let Inst{5} = lane{1};
1865 let Inst{3} = lane{0};
1868 // Same as N3V except it doesn't have a data type suffix.
1869 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1871 dag oops, dag iops, Format f, InstrItinClass itin,
1872 string opc, string asm, string cstr, list<dag> pattern>
1873 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1874 let Inst{24} = op24;
1875 let Inst{23} = op23;
1876 let Inst{21-20} = op21_20;
1877 let Inst{11-8} = op11_8;
1881 // Instruction operands.
1886 let Inst{15-12} = Vd{3-0};
1887 let Inst{22} = Vd{4};
1888 let Inst{19-16} = Vn{3-0};
1889 let Inst{7} = Vn{4};
1890 let Inst{3-0} = Vm{3-0};
1891 let Inst{5} = Vm{4};
1894 // NEON VMOVs between scalar and core registers.
1895 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1896 dag oops, dag iops, Format f, InstrItinClass itin,
1897 string opc, string dt, string asm, list<dag> pattern>
1898 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
1900 let Inst{27-20} = opcod1;
1901 let Inst{11-8} = opcod2;
1902 let Inst{6-5} = opcod3;
1904 // A8.6.303, A8.6.328, A8.6.329
1905 let Inst{3-0} = 0b0000;
1907 let OutOperandList = oops;
1908 let InOperandList = !con(iops, (ins pred:$p));
1909 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1910 let Pattern = pattern;
1911 list<Predicate> Predicates = [HasNEON];
1913 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
1914 let DecoderNamespace = "NEONDup";
1921 let Inst{31-28} = p{3-0};
1923 let Inst{19-16} = V{3-0};
1924 let Inst{15-12} = R{3-0};
1926 class NVGetLane<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, NGetLnFrm, itin,
1930 opc, dt, asm, pattern>;
1931 class NVSetLane<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, NSetLnFrm, itin,
1935 opc, dt, asm, pattern>;
1936 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1937 dag oops, dag iops, InstrItinClass itin,
1938 string opc, string dt, string asm, list<dag> pattern>
1939 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1940 opc, dt, asm, pattern>;
1942 // Vector Duplicate Lane (from scalar to all elements)
1943 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1944 InstrItinClass itin, string opc, string dt, string asm,
1946 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1947 let Inst{24-23} = 0b11;
1948 let Inst{21-20} = 0b11;
1949 let Inst{19-16} = op19_16;
1950 let Inst{11-7} = 0b11000;
1957 let Inst{22} = Vd{4};
1958 let Inst{15-12} = Vd{3-0};
1959 let Inst{5} = Vm{4};
1960 let Inst{3-0} = Vm{3-0};
1963 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1964 // for single-precision FP.
1965 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1966 list<Predicate> Predicates = [HasNEON,UseNEONForFP];