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;
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 Instruction templates.
225 class InstTemplate<AddrMode am, int sz, IndexMode im,
226 Format f, Domain d, string cstr, InstrItinClass itin>
228 let Namespace = "ARM";
233 bits<2> IndexModeBits = IM.Value;
235 bits<6> Form = F.Value;
237 bit isUnaryDataProc = 0;
238 bit canXformTo16Bit = 0;
240 // If this is a pseudo instruction, mark it isCodeGenOnly.
241 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
243 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
244 let TSFlags{4-0} = AM.Value;
245 let TSFlags{6-5} = IndexModeBits;
246 let TSFlags{12-7} = Form;
247 let TSFlags{13} = isUnaryDataProc;
248 let TSFlags{14} = canXformTo16Bit;
249 let TSFlags{17-15} = D.Value;
251 let Constraints = cstr;
252 let Itinerary = itin;
259 class InstARM<AddrMode am, int sz, IndexMode im,
260 Format f, Domain d, string cstr, InstrItinClass itin>
261 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
262 let DecoderNamespace = "ARM";
265 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
266 // on by adding flavors to specific instructions.
267 class InstThumb<AddrMode am, int sz, IndexMode im,
268 Format f, Domain d, string cstr, InstrItinClass itin>
269 : InstTemplate<am, sz, im, f, d, cstr, itin> {
270 let DecoderNamespace = "Thumb";
273 class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
274 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
275 GenericDomain, "", itin> {
276 let OutOperandList = oops;
277 let InOperandList = iops;
278 let Pattern = pattern;
279 let isCodeGenOnly = 1;
283 // PseudoInst that's ARM-mode only.
284 class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
286 : PseudoInst<oops, iops, itin, pattern> {
288 list<Predicate> Predicates = [IsARM];
291 // PseudoInst that's Thumb-mode only.
292 class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
294 : PseudoInst<oops, iops, itin, pattern> {
296 list<Predicate> Predicates = [IsThumb];
299 // PseudoInst that's Thumb2-mode only.
300 class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
302 : PseudoInst<oops, iops, itin, pattern> {
304 list<Predicate> Predicates = [IsThumb2];
307 class ARMPseudoExpand<dag oops, dag iops, int sz,
308 InstrItinClass itin, list<dag> pattern,
310 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
311 PseudoInstExpansion<Result>;
313 class tPseudoExpand<dag oops, dag iops, int sz,
314 InstrItinClass itin, list<dag> pattern,
316 : tPseudoInst<oops, iops, sz, itin, pattern>,
317 PseudoInstExpansion<Result>;
319 class t2PseudoExpand<dag oops, dag iops, int sz,
320 InstrItinClass itin, list<dag> pattern,
322 : t2PseudoInst<oops, iops, sz, itin, pattern>,
323 PseudoInstExpansion<Result>;
325 // Almost all ARM instructions are predicable.
326 class I<dag oops, dag iops, AddrMode am, int sz,
327 IndexMode im, Format f, InstrItinClass itin,
328 string opc, string asm, string cstr,
330 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
333 let OutOperandList = oops;
334 let InOperandList = !con(iops, (ins pred:$p));
335 let AsmString = !strconcat(opc, "${p}", asm);
336 let Pattern = pattern;
337 list<Predicate> Predicates = [IsARM];
340 // A few are not predicable
341 class InoP<dag oops, dag iops, AddrMode am, int sz,
342 IndexMode im, Format f, InstrItinClass itin,
343 string opc, string asm, string cstr,
345 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
346 let OutOperandList = oops;
347 let InOperandList = iops;
348 let AsmString = !strconcat(opc, asm);
349 let Pattern = pattern;
350 let isPredicable = 0;
351 list<Predicate> Predicates = [IsARM];
354 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
355 // operand since by default it's a zero register. It will become an implicit def
356 // once it's "flipped".
357 class sI<dag oops, dag iops, AddrMode am, int sz,
358 IndexMode im, Format f, InstrItinClass itin,
359 string opc, string asm, string cstr,
361 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
362 bits<4> p; // Predicate operand
363 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
367 let OutOperandList = oops;
368 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
369 let AsmString = !strconcat(opc, "${s}${p}", asm);
370 let Pattern = pattern;
371 list<Predicate> Predicates = [IsARM];
375 class XI<dag oops, dag iops, AddrMode am, int sz,
376 IndexMode im, Format f, InstrItinClass itin,
377 string asm, string cstr, list<dag> pattern>
378 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
379 let OutOperandList = oops;
380 let InOperandList = iops;
382 let Pattern = pattern;
383 list<Predicate> Predicates = [IsARM];
386 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
387 string opc, string asm, list<dag> pattern>
388 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
389 opc, asm, "", pattern>;
390 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
391 string opc, string asm, list<dag> pattern>
392 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
393 opc, asm, "", pattern>;
394 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
395 string asm, list<dag> pattern>
396 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
398 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
399 string opc, string asm, list<dag> pattern>
400 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
401 opc, asm, "", pattern>;
403 // Ctrl flow instructions
404 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
405 string opc, string asm, list<dag> pattern>
406 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
407 opc, asm, "", pattern> {
408 let Inst{27-24} = opcod;
410 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
411 string asm, list<dag> pattern>
412 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
414 let Inst{27-24} = opcod;
417 // BR_JT instructions
418 class JTI<dag oops, dag iops, InstrItinClass itin,
419 string asm, list<dag> pattern>
420 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
423 // Atomic load/store instructions
424 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
425 string opc, string asm, list<dag> pattern>
426 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
427 opc, asm, "", pattern> {
430 let Inst{27-23} = 0b00011;
431 let Inst{22-21} = opcod;
433 let Inst{19-16} = addr;
434 let Inst{15-12} = Rt;
435 let Inst{11-0} = 0b111110011111;
437 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
438 string opc, string asm, list<dag> pattern>
439 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
440 opc, asm, "", pattern> {
444 let Inst{27-23} = 0b00011;
445 let Inst{22-21} = opcod;
447 let Inst{19-16} = addr;
448 let Inst{15-12} = Rd;
449 let Inst{11-4} = 0b11111001;
452 class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
453 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
457 let Inst{27-23} = 0b00010;
459 let Inst{21-20} = 0b00;
460 let Inst{19-16} = addr;
461 let Inst{15-12} = Rt;
462 let Inst{11-4} = 0b00001001;
466 // addrmode1 instructions
467 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
468 string opc, string asm, list<dag> pattern>
469 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
470 opc, asm, "", pattern> {
471 let Inst{24-21} = opcod;
472 let Inst{27-26} = 0b00;
474 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
475 string opc, string asm, list<dag> pattern>
476 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
477 opc, asm, "", pattern> {
478 let Inst{24-21} = opcod;
479 let Inst{27-26} = 0b00;
481 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
482 string asm, list<dag> pattern>
483 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
485 let Inst{24-21} = opcod;
486 let Inst{27-26} = 0b00;
491 // LDR/LDRB/STR/STRB/...
492 class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
493 Format f, InstrItinClass itin, string opc, string asm,
495 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
497 let Inst{27-25} = op;
498 let Inst{24} = 1; // 24 == P
500 let Inst{22} = isByte;
501 let Inst{21} = 0; // 21 == W
504 // Indexed load/stores
505 class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
506 IndexMode im, Format f, InstrItinClass itin, string opc,
507 string asm, string cstr, list<dag> pattern>
508 : I<oops, iops, AddrMode2, 4, im, f, itin,
509 opc, asm, cstr, pattern> {
511 let Inst{27-26} = 0b01;
512 let Inst{24} = isPre; // P bit
513 let Inst{22} = isByte; // B bit
514 let Inst{21} = isPre; // W bit
515 let Inst{20} = isLd; // L bit
516 let Inst{15-12} = Rt;
518 class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
519 IndexMode im, Format f, InstrItinClass itin, string opc,
520 string asm, string cstr, list<dag> pattern>
521 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
523 // AM2 store w/ two operands: (GPR, am2offset)
529 let Inst{23} = offset{12};
530 let Inst{19-16} = Rn;
531 let Inst{11-5} = offset{11-5};
533 let Inst{3-0} = offset{3-0};
536 class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
537 IndexMode im, Format f, InstrItinClass itin, string opc,
538 string asm, string cstr, list<dag> pattern>
539 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
541 // AM2 store w/ two operands: (GPR, am2offset)
547 let Inst{23} = offset{12};
548 let Inst{19-16} = Rn;
549 let Inst{11-0} = offset{11-0};
553 // FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
554 // but for now use this class for STRT and STRBT.
555 class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
556 IndexMode im, Format f, InstrItinClass itin, string opc,
557 string asm, string cstr, list<dag> pattern>
558 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
560 // AM2 store w/ two operands: (GPR, am2offset)
562 // {13} 1 == Rm, 0 == imm12
566 let Inst{25} = addr{13};
567 let Inst{23} = addr{12};
568 let Inst{19-16} = addr{17-14};
569 let Inst{11-0} = addr{11-0};
572 // addrmode3 instructions
573 class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
574 InstrItinClass itin, string opc, string asm, list<dag> pattern>
575 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
576 opc, asm, "", pattern> {
579 let Inst{27-25} = 0b000;
580 let Inst{24} = 1; // P bit
581 let Inst{23} = addr{8}; // U bit
582 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
583 let Inst{21} = 0; // W bit
584 let Inst{20} = op20; // L bit
585 let Inst{19-16} = addr{12-9}; // Rn
586 let Inst{15-12} = Rt; // Rt
587 let Inst{11-8} = addr{7-4}; // imm7_4/zero
589 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
591 let DecoderMethod = "DecodeAddrMode3Instruction";
594 class AI3ldstidx<bits<4> op, bit op20, bit isPre, dag oops, dag iops,
595 IndexMode im, Format f, InstrItinClass itin, string opc,
596 string asm, string cstr, list<dag> pattern>
597 : I<oops, iops, AddrMode3, 4, im, f, itin,
598 opc, asm, cstr, pattern> {
600 let Inst{27-25} = 0b000;
601 let Inst{24} = isPre; // P bit
602 let Inst{21} = isPre; // W bit
603 let Inst{20} = op20; // L bit
604 let Inst{15-12} = Rt; // Rt
608 // FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
609 // but for now use this class for LDRSBT, LDRHT, LDSHT.
610 class AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
611 IndexMode im, Format f, InstrItinClass itin, string opc,
612 string asm, string cstr, list<dag> pattern>
613 : I<oops, iops, AddrMode3, 4, im, f, itin, opc, asm, cstr, pattern> {
614 // {13} 1 == imm8, 0 == Rm
621 let Inst{27-25} = 0b000;
622 let Inst{24} = 0; // P bit
624 let Inst{20} = isLoad; // L bit
625 let Inst{19-16} = addr; // Rn
626 let Inst{15-12} = Rt; // Rt
630 class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
631 IndexMode im, Format f, InstrItinClass itin, string opc,
632 string asm, string cstr, list<dag> pattern>
633 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
635 // AM3 store w/ two operands: (GPR, am3offset)
639 let Inst{27-25} = 0b000;
640 let Inst{23} = offset{8};
641 let Inst{22} = offset{9};
642 let Inst{19-16} = Rn;
643 let Inst{15-12} = Rt; // Rt
644 let Inst{11-8} = offset{7-4}; // imm7_4/zero
646 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
650 class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
651 string opc, string asm, list<dag> pattern>
652 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
653 opc, asm, "", pattern> {
656 let Inst{27-25} = 0b000;
657 let Inst{24} = 1; // P bit
658 let Inst{23} = addr{8}; // U bit
659 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
660 let Inst{21} = 0; // W bit
661 let Inst{20} = 0; // L bit
662 let Inst{19-16} = addr{12-9}; // Rn
663 let Inst{15-12} = Rt; // Rt
664 let Inst{11-8} = addr{7-4}; // imm7_4/zero
666 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
669 // Pre-indexed stores
670 class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
671 string opc, string asm, string cstr, list<dag> pattern>
672 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
673 opc, asm, cstr, pattern> {
675 let Inst{5} = 1; // H bit
676 let Inst{6} = 0; // S bit
678 let Inst{20} = 0; // L bit
679 let Inst{21} = 1; // W bit
680 let Inst{24} = 1; // P bit
681 let Inst{27-25} = 0b000;
683 // addrmode4 instructions
684 class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
685 string asm, string cstr, list<dag> pattern>
686 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
691 let Inst{27-25} = 0b100;
692 let Inst{22} = 0; // S bit
693 let Inst{19-16} = Rn;
694 let Inst{15-0} = regs;
697 // Unsigned multiply, multiply-accumulate instructions.
698 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
699 string opc, string asm, list<dag> pattern>
700 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
701 opc, asm, "", pattern> {
702 let Inst{7-4} = 0b1001;
703 let Inst{20} = 0; // S bit
704 let Inst{27-21} = opcod;
706 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
707 string opc, string asm, list<dag> pattern>
708 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
709 opc, asm, "", pattern> {
710 let Inst{7-4} = 0b1001;
711 let Inst{27-21} = opcod;
714 // Most significant word multiply
715 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
716 InstrItinClass itin, string opc, string asm, list<dag> pattern>
717 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
718 opc, asm, "", pattern> {
722 let Inst{7-4} = opc7_4;
724 let Inst{27-21} = opcod;
725 let Inst{19-16} = Rd;
729 // MSW multiple w/ Ra operand
730 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
731 InstrItinClass itin, string opc, string asm, list<dag> pattern>
732 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
734 let Inst{15-12} = Ra;
737 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
738 class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
739 InstrItinClass itin, string opc, string asm, list<dag> pattern>
740 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
741 opc, asm, "", pattern> {
747 let Inst{27-21} = opcod;
748 let Inst{6-5} = bit6_5;
752 class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
753 InstrItinClass itin, string opc, string asm, list<dag> pattern>
754 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
756 let Inst{19-16} = Rd;
759 // AMulxyI with Ra operand
760 class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
761 InstrItinClass itin, string opc, string asm, list<dag> pattern>
762 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
764 let Inst{15-12} = Ra;
767 class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
768 InstrItinClass itin, string opc, string asm, list<dag> pattern>
769 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
772 let Inst{19-16} = RdHi;
773 let Inst{15-12} = RdLo;
776 // Extend instructions.
777 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
778 string opc, string asm, list<dag> pattern>
779 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
780 opc, asm, "", pattern> {
781 // All AExtI instructions have Rd and Rm register operands.
784 let Inst{15-12} = Rd;
786 let Inst{7-4} = 0b0111;
787 let Inst{9-8} = 0b00;
788 let Inst{27-20} = opcod;
791 // Misc Arithmetic instructions.
792 class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
793 InstrItinClass itin, string opc, string asm, list<dag> pattern>
794 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
795 opc, asm, "", pattern> {
798 let Inst{27-20} = opcod;
799 let Inst{19-16} = 0b1111;
800 let Inst{15-12} = Rd;
801 let Inst{11-8} = 0b1111;
802 let Inst{7-4} = opc7_4;
807 def PKHLSLAsmOperand : AsmOperandClass {
808 let Name = "PKHLSLImm";
809 let ParserMethod = "parsePKHLSLImm";
811 def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
812 let PrintMethod = "printPKHLSLShiftImm";
813 let ParserMatchClass = PKHLSLAsmOperand;
815 def PKHASRAsmOperand : AsmOperandClass {
816 let Name = "PKHASRImm";
817 let ParserMethod = "parsePKHASRImm";
819 def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
820 let PrintMethod = "printPKHASRShiftImm";
821 let ParserMatchClass = PKHASRAsmOperand;
824 class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
825 string opc, string asm, list<dag> pattern>
826 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
827 opc, asm, "", pattern> {
832 let Inst{27-20} = opcod;
833 let Inst{19-16} = Rn;
834 let Inst{15-12} = Rd;
837 let Inst{5-4} = 0b01;
841 //===----------------------------------------------------------------------===//
843 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
844 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
845 list<Predicate> Predicates = [IsARM];
847 class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
848 list<Predicate> Predicates = [IsARM, HasV5T];
850 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
851 list<Predicate> Predicates = [IsARM, HasV5TE];
853 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
854 list<Predicate> Predicates = [IsARM, HasV6];
857 //===----------------------------------------------------------------------===//
858 // Thumb Instruction Format Definitions.
861 class ThumbI<dag oops, dag iops, AddrMode am, int sz,
862 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
863 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
864 let OutOperandList = oops;
865 let InOperandList = iops;
867 let Pattern = pattern;
868 list<Predicate> Predicates = [IsThumb];
871 // TI - Thumb instruction.
872 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
873 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
875 // Two-address instructions
876 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
878 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
881 // tBL, tBX 32-bit instructions
882 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
883 dag oops, dag iops, InstrItinClass itin, string asm,
885 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
887 let Inst{31-27} = opcod1;
888 let Inst{15-14} = opcod2;
889 let Inst{12} = opcod3;
892 // BR_JT instructions
893 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
895 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
898 class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
899 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
900 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
901 let OutOperandList = oops;
902 let InOperandList = iops;
904 let Pattern = pattern;
905 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
908 class T1I<dag oops, dag iops, InstrItinClass itin,
909 string asm, list<dag> pattern>
910 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
911 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
912 string asm, list<dag> pattern>
913 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
915 // Two-address instructions
916 class T1It<dag oops, dag iops, InstrItinClass itin,
917 string asm, string cstr, list<dag> pattern>
918 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
921 // Thumb1 instruction that can either be predicated or set CPSR.
922 class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
924 string opc, string asm, string cstr, list<dag> pattern>
925 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
926 let OutOperandList = !con(oops, (outs s_cc_out:$s));
927 let InOperandList = !con(iops, (ins pred:$p));
928 let AsmString = !strconcat(opc, "${s}${p}", asm);
929 let Pattern = pattern;
930 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
933 class T1sI<dag oops, dag iops, InstrItinClass itin,
934 string opc, string asm, list<dag> pattern>
935 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
937 // Two-address instructions
938 class T1sIt<dag oops, dag iops, InstrItinClass itin,
939 string opc, string asm, list<dag> pattern>
940 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
941 "$Rn = $Rdn", pattern>;
943 // Thumb1 instruction that can be predicated.
944 class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
946 string opc, string asm, string cstr, list<dag> pattern>
947 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
948 let OutOperandList = oops;
949 let InOperandList = !con(iops, (ins pred:$p));
950 let AsmString = !strconcat(opc, "${p}", asm);
951 let Pattern = pattern;
952 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
955 class T1pI<dag oops, dag iops, InstrItinClass itin,
956 string opc, string asm, list<dag> pattern>
957 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
959 // Two-address instructions
960 class T1pIt<dag oops, dag iops, InstrItinClass itin,
961 string opc, string asm, list<dag> pattern>
962 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
963 "$Rn = $Rdn", pattern>;
965 class T1pIs<dag oops, dag iops,
966 InstrItinClass itin, string opc, string asm, list<dag> pattern>
967 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
969 class Encoding16 : Encoding {
970 let Inst{31-16} = 0x0000;
973 // A6.2 16-bit Thumb instruction encoding
974 class T1Encoding<bits<6> opcode> : Encoding16 {
975 let Inst{15-10} = opcode;
978 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
979 class T1General<bits<5> opcode> : Encoding16 {
980 let Inst{15-14} = 0b00;
981 let Inst{13-9} = opcode;
984 // A6.2.2 Data-processing encoding.
985 class T1DataProcessing<bits<4> opcode> : Encoding16 {
986 let Inst{15-10} = 0b010000;
987 let Inst{9-6} = opcode;
990 // A6.2.3 Special data instructions and branch and exchange encoding.
991 class T1Special<bits<4> opcode> : Encoding16 {
992 let Inst{15-10} = 0b010001;
993 let Inst{9-6} = opcode;
996 // A6.2.4 Load/store single data item encoding.
997 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
998 let Inst{15-12} = opA;
999 let Inst{11-9} = opB;
1001 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1003 class T1BranchCond<bits<4> opcode> : Encoding16 {
1004 let Inst{15-12} = opcode;
1007 // Helper classes to encode Thumb1 loads and stores. For immediates, the
1008 // following bits are used for "opA" (see A6.2.4):
1010 // 0b0110 => Immediate, 4 bytes
1011 // 0b1000 => Immediate, 2 bytes
1012 // 0b0111 => Immediate, 1 byte
1013 class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1014 InstrItinClass itin, string opc, string asm,
1016 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1017 T1LoadStore<0b0101, opcode> {
1020 let Inst{8-6} = addr{5-3}; // Rm
1021 let Inst{5-3} = addr{2-0}; // Rn
1024 class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1025 InstrItinClass itin, string opc, string asm,
1027 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1028 T1LoadStore<opA, {opB,?,?}> {
1031 let Inst{10-6} = addr{7-3}; // imm5
1032 let Inst{5-3} = addr{2-0}; // Rn
1036 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1037 class T1Misc<bits<7> opcode> : Encoding16 {
1038 let Inst{15-12} = 0b1011;
1039 let Inst{11-5} = opcode;
1042 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1043 class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
1044 InstrItinClass itin,
1045 string opc, string asm, string cstr, list<dag> pattern>
1046 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1047 let OutOperandList = oops;
1048 let InOperandList = !con(iops, (ins pred:$p));
1049 let AsmString = !strconcat(opc, "${p}", asm);
1050 let Pattern = pattern;
1051 list<Predicate> Predicates = [IsThumb2];
1052 let DecoderNamespace = "Thumb2";
1055 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1056 // input operand since by default it's a zero register. It will become an
1057 // implicit def once it's "flipped".
1059 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1061 class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
1062 InstrItinClass itin,
1063 string opc, string asm, string cstr, list<dag> pattern>
1064 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1065 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1068 let OutOperandList = oops;
1069 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1070 let AsmString = !strconcat(opc, "${s}${p}", asm);
1071 let Pattern = pattern;
1072 list<Predicate> Predicates = [IsThumb2];
1073 let DecoderNamespace = "Thumb2";
1077 class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
1078 InstrItinClass itin,
1079 string asm, string cstr, list<dag> pattern>
1080 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1081 let OutOperandList = oops;
1082 let InOperandList = iops;
1083 let AsmString = asm;
1084 let Pattern = pattern;
1085 list<Predicate> Predicates = [IsThumb2];
1086 let DecoderNamespace = "Thumb2";
1089 class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
1090 InstrItinClass itin,
1091 string asm, string cstr, list<dag> pattern>
1092 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1093 let OutOperandList = oops;
1094 let InOperandList = iops;
1095 let AsmString = asm;
1096 let Pattern = pattern;
1097 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1098 let DecoderNamespace = "Thumb";
1101 class T2I<dag oops, dag iops, InstrItinClass itin,
1102 string opc, string asm, list<dag> pattern>
1103 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1104 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1105 string opc, string asm, list<dag> pattern>
1106 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
1107 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1108 string opc, string asm, list<dag> pattern>
1109 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
1110 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1111 string opc, string asm, list<dag> pattern>
1112 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
1113 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1114 string opc, string asm, list<dag> pattern>
1115 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
1116 class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1117 string opc, string asm, list<dag> pattern>
1118 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
1123 let Inst{31-25} = 0b1110100;
1125 let Inst{23} = addr{8};
1128 let Inst{20} = isLoad;
1129 let Inst{19-16} = addr{12-9};
1130 let Inst{15-12} = Rt{3-0};
1131 let Inst{11-8} = Rt2{3-0};
1132 let Inst{7-0} = addr{7-0};
1135 class T2Ii8s4Tied<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1136 string opc, string asm, list<dag> pattern>
1137 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "$base = $wb",
1143 let Inst{31-25} = 0b1110100;
1145 let Inst{23} = imm{8};
1148 let Inst{20} = isLoad;
1149 let Inst{19-16} = base{3-0};
1150 let Inst{15-12} = Rt{3-0};
1151 let Inst{11-8} = Rt2{3-0};
1152 let Inst{7-0} = imm{7-0};
1156 class T2sI<dag oops, dag iops, InstrItinClass itin,
1157 string opc, string asm, list<dag> pattern>
1158 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1160 class T2XI<dag oops, dag iops, InstrItinClass itin,
1161 string asm, list<dag> pattern>
1162 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
1163 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1164 string asm, list<dag> pattern>
1165 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
1167 // Move to/from coprocessor instructions
1168 class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
1169 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
1170 let Inst{31-28} = opc;
1173 // Two-address instructions
1174 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1175 string asm, string cstr, list<dag> pattern>
1176 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
1178 // T2Iidxldst - Thumb2 indexed load / store instructions.
1179 class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1181 AddrMode am, IndexMode im, InstrItinClass itin,
1182 string opc, string asm, string cstr, list<dag> pattern>
1183 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1184 let OutOperandList = oops;
1185 let InOperandList = !con(iops, (ins pred:$p));
1186 let AsmString = !strconcat(opc, "${p}", asm);
1187 let Pattern = pattern;
1188 list<Predicate> Predicates = [IsThumb2];
1189 let DecoderNamespace = "Thumb2";
1190 let Inst{31-27} = 0b11111;
1191 let Inst{26-25} = 0b00;
1192 let Inst{24} = signed;
1194 let Inst{22-21} = opcod;
1195 let Inst{20} = load;
1197 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1198 let Inst{10} = pre; // The P bit.
1199 let Inst{8} = 1; // The W bit.
1202 let Inst{7-0} = addr{7-0};
1203 let Inst{9} = addr{8}; // Sign bit
1207 let Inst{15-12} = Rt{3-0};
1208 let Inst{19-16} = Rn{3-0};
1211 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1212 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1213 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
1216 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1217 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1218 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1221 // T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1222 class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1223 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1226 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1227 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1228 list<Predicate> Predicates = [IsThumb2];
1231 //===----------------------------------------------------------------------===//
1233 //===----------------------------------------------------------------------===//
1234 // ARM VFP Instruction templates.
1237 // Almost all VFP instructions are predicable.
1238 class VFPI<dag oops, dag iops, AddrMode am, int sz,
1239 IndexMode im, Format f, InstrItinClass itin,
1240 string opc, string asm, string cstr, list<dag> pattern>
1241 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1243 let Inst{31-28} = p;
1244 let OutOperandList = oops;
1245 let InOperandList = !con(iops, (ins pred:$p));
1246 let AsmString = !strconcat(opc, "${p}", asm);
1247 let Pattern = pattern;
1248 let PostEncoderMethod = "VFPThumb2PostEncoder";
1249 let DecoderNamespace = "VFP";
1250 list<Predicate> Predicates = [HasVFP2];
1254 class VFPXI<dag oops, dag iops, AddrMode am, int sz,
1255 IndexMode im, Format f, InstrItinClass itin,
1256 string asm, string cstr, list<dag> pattern>
1257 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1259 let Inst{31-28} = p;
1260 let OutOperandList = oops;
1261 let InOperandList = iops;
1262 let AsmString = asm;
1263 let Pattern = pattern;
1264 let PostEncoderMethod = "VFPThumb2PostEncoder";
1265 let DecoderNamespace = "VFP";
1266 list<Predicate> Predicates = [HasVFP2];
1269 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1270 string opc, string asm, list<dag> pattern>
1271 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
1272 opc, asm, "", pattern> {
1273 let PostEncoderMethod = "VFPThumb2PostEncoder";
1276 // ARM VFP addrmode5 loads and stores
1277 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1278 InstrItinClass itin,
1279 string opc, string asm, list<dag> pattern>
1280 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1281 VFPLdStFrm, itin, opc, asm, "", pattern> {
1282 // Instruction operands.
1286 // Encode instruction operands.
1287 let Inst{23} = addr{8}; // U (add = (U == '1'))
1288 let Inst{22} = Dd{4};
1289 let Inst{19-16} = addr{12-9}; // Rn
1290 let Inst{15-12} = Dd{3-0};
1291 let Inst{7-0} = addr{7-0}; // imm8
1293 // TODO: Mark the instructions with the appropriate subtarget info.
1294 let Inst{27-24} = opcod1;
1295 let Inst{21-20} = opcod2;
1296 let Inst{11-9} = 0b101;
1297 let Inst{8} = 1; // Double precision
1299 // Loads & stores operate on both NEON and VFP pipelines.
1300 let D = VFPNeonDomain;
1303 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1304 InstrItinClass itin,
1305 string opc, string asm, list<dag> pattern>
1306 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1307 VFPLdStFrm, itin, opc, asm, "", pattern> {
1308 // Instruction operands.
1312 // Encode instruction operands.
1313 let Inst{23} = addr{8}; // U (add = (U == '1'))
1314 let Inst{22} = Sd{0};
1315 let Inst{19-16} = addr{12-9}; // Rn
1316 let Inst{15-12} = Sd{4-1};
1317 let Inst{7-0} = addr{7-0}; // imm8
1319 // TODO: Mark the instructions with the appropriate subtarget info.
1320 let Inst{27-24} = opcod1;
1321 let Inst{21-20} = opcod2;
1322 let Inst{11-9} = 0b101;
1323 let Inst{8} = 0; // Single precision
1325 // Loads & stores operate on both NEON and VFP pipelines.
1326 let D = VFPNeonDomain;
1329 // VFP Load / store multiple pseudo instructions.
1330 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1332 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
1334 let OutOperandList = oops;
1335 let InOperandList = !con(iops, (ins pred:$p));
1336 let Pattern = pattern;
1337 list<Predicate> Predicates = [HasVFP2];
1340 // Load / store multiple
1341 class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1342 string asm, string cstr, list<dag> pattern>
1343 : VFPXI<oops, iops, AddrMode4, 4, im,
1344 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1345 // Instruction operands.
1349 // Encode instruction operands.
1350 let Inst{19-16} = Rn;
1351 let Inst{22} = regs{12};
1352 let Inst{15-12} = regs{11-8};
1353 let Inst{7-0} = regs{7-0};
1355 // TODO: Mark the instructions with the appropriate subtarget info.
1356 let Inst{27-25} = 0b110;
1357 let Inst{11-9} = 0b101;
1358 let Inst{8} = 1; // Double precision
1361 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1362 string asm, string cstr, list<dag> pattern>
1363 : VFPXI<oops, iops, AddrMode4, 4, im,
1364 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1365 // Instruction operands.
1369 // Encode instruction operands.
1370 let Inst{19-16} = Rn;
1371 let Inst{22} = regs{8};
1372 let Inst{15-12} = regs{12-9};
1373 let Inst{7-0} = regs{7-0};
1375 // TODO: Mark the instructions with the appropriate subtarget info.
1376 let Inst{27-25} = 0b110;
1377 let Inst{11-9} = 0b101;
1378 let Inst{8} = 0; // Single precision
1381 // Double precision, unary
1382 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1383 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1384 string asm, list<dag> pattern>
1385 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1386 // Instruction operands.
1390 // Encode instruction operands.
1391 let Inst{3-0} = Dm{3-0};
1392 let Inst{5} = Dm{4};
1393 let Inst{15-12} = Dd{3-0};
1394 let Inst{22} = Dd{4};
1396 let Inst{27-23} = opcod1;
1397 let Inst{21-20} = opcod2;
1398 let Inst{19-16} = opcod3;
1399 let Inst{11-9} = 0b101;
1400 let Inst{8} = 1; // Double precision
1401 let Inst{7-6} = opcod4;
1402 let Inst{4} = opcod5;
1405 // Double precision, binary
1406 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1407 dag iops, InstrItinClass itin, string opc, string asm,
1409 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1410 // Instruction operands.
1415 // Encode instruction operands.
1416 let Inst{3-0} = Dm{3-0};
1417 let Inst{5} = Dm{4};
1418 let Inst{19-16} = Dn{3-0};
1419 let Inst{7} = Dn{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{11-9} = 0b101;
1426 let Inst{8} = 1; // Double precision
1431 // Single precision, unary
1432 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1433 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1434 string asm, list<dag> pattern>
1435 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1436 // Instruction operands.
1440 // Encode instruction operands.
1441 let Inst{3-0} = Sm{4-1};
1442 let Inst{5} = Sm{0};
1443 let Inst{15-12} = Sd{4-1};
1444 let Inst{22} = Sd{0};
1446 let Inst{27-23} = opcod1;
1447 let Inst{21-20} = opcod2;
1448 let Inst{19-16} = opcod3;
1449 let Inst{11-9} = 0b101;
1450 let Inst{8} = 0; // Single precision
1451 let Inst{7-6} = opcod4;
1452 let Inst{4} = opcod5;
1455 // Single precision unary, if no NEON. Same as ASuI except not available if
1457 class ASuIn<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 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1462 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1465 // Single precision, binary
1466 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1467 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1468 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1469 // Instruction operands.
1474 // Encode instruction operands.
1475 let Inst{3-0} = Sm{4-1};
1476 let Inst{5} = Sm{0};
1477 let Inst{19-16} = Sn{4-1};
1478 let Inst{7} = Sn{0};
1479 let Inst{15-12} = Sd{4-1};
1480 let Inst{22} = Sd{0};
1482 let Inst{27-23} = opcod1;
1483 let Inst{21-20} = opcod2;
1484 let Inst{11-9} = 0b101;
1485 let Inst{8} = 0; // Single precision
1490 // Single precision binary, if no NEON. Same as ASbI except not available if
1492 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1493 dag iops, InstrItinClass itin, string opc, string asm,
1495 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1496 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1498 // Instruction operands.
1503 // Encode instruction operands.
1504 let Inst{3-0} = Sm{4-1};
1505 let Inst{5} = Sm{0};
1506 let Inst{19-16} = Sn{4-1};
1507 let Inst{7} = Sn{0};
1508 let Inst{15-12} = Sd{4-1};
1509 let Inst{22} = Sd{0};
1512 // VFP conversion instructions
1513 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1514 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1516 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1517 let Inst{27-23} = opcod1;
1518 let Inst{21-20} = opcod2;
1519 let Inst{19-16} = opcod3;
1520 let Inst{11-8} = opcod4;
1525 // VFP conversion between floating-point and fixed-point
1526 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1527 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1529 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1530 // size (fixed-point number): sx == 0 ? 16 : 32
1531 let Inst{7} = op5; // sx
1534 // VFP conversion instructions, if no NEON
1535 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1536 dag oops, dag iops, InstrItinClass itin,
1537 string opc, string asm, list<dag> pattern>
1538 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1540 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1543 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1544 InstrItinClass itin,
1545 string opc, string asm, list<dag> pattern>
1546 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1547 let Inst{27-20} = opcod1;
1548 let Inst{11-8} = opcod2;
1552 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1553 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1554 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1556 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1557 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1558 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1560 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1561 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1562 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1564 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1565 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1566 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1568 //===----------------------------------------------------------------------===//
1570 //===----------------------------------------------------------------------===//
1571 // ARM NEON Instruction templates.
1574 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1575 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1577 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1578 let OutOperandList = oops;
1579 let InOperandList = !con(iops, (ins pred:$p));
1580 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1581 let Pattern = pattern;
1582 list<Predicate> Predicates = [HasNEON];
1583 let DecoderNamespace = "NEONData";
1586 // Same as NeonI except it does not have a "data type" specifier.
1587 class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1588 InstrItinClass itin, string opc, string asm, string cstr,
1590 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1591 let OutOperandList = oops;
1592 let InOperandList = !con(iops, (ins pred:$p));
1593 let AsmString = !strconcat(opc, "${p}", "\t", asm);
1594 let Pattern = pattern;
1595 list<Predicate> Predicates = [HasNEON];
1596 let DecoderNamespace = "NEONData";
1599 class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1600 dag oops, dag iops, InstrItinClass itin,
1601 string opc, string dt, string asm, string cstr, list<dag> pattern>
1602 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1604 let Inst{31-24} = 0b11110100;
1605 let Inst{23} = op23;
1606 let Inst{21-20} = op21_20;
1607 let Inst{11-8} = op11_8;
1608 let Inst{7-4} = op7_4;
1610 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
1611 let DecoderNamespace = "NEONLoadStore";
1617 let Inst{22} = Vd{4};
1618 let Inst{15-12} = Vd{3-0};
1619 let Inst{19-16} = Rn{3-0};
1620 let Inst{3-0} = Rm{3-0};
1623 class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1624 dag oops, dag iops, InstrItinClass itin,
1625 string opc, string dt, string asm, string cstr, list<dag> pattern>
1626 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1627 dt, asm, cstr, pattern> {
1631 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1632 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1634 let OutOperandList = oops;
1635 let InOperandList = !con(iops, (ins pred:$p));
1636 list<Predicate> Predicates = [HasNEON];
1639 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1641 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1643 let OutOperandList = oops;
1644 let InOperandList = !con(iops, (ins pred:$p));
1645 let Pattern = pattern;
1646 list<Predicate> Predicates = [HasNEON];
1649 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1650 string opc, string dt, string asm, string cstr, list<dag> pattern>
1651 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1653 let Inst{31-25} = 0b1111001;
1654 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1657 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1658 string opc, string asm, string cstr, list<dag> pattern>
1659 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1661 let Inst{31-25} = 0b1111001;
1662 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1665 // NEON "one register and a modified immediate" format.
1666 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1668 dag oops, dag iops, InstrItinClass itin,
1669 string opc, string dt, string asm, string cstr,
1671 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1672 let Inst{23} = op23;
1673 let Inst{21-19} = op21_19;
1674 let Inst{11-8} = op11_8;
1680 // Instruction operands.
1684 let Inst{15-12} = Vd{3-0};
1685 let Inst{22} = Vd{4};
1686 let Inst{24} = SIMM{7};
1687 let Inst{18-16} = SIMM{6-4};
1688 let Inst{3-0} = SIMM{3-0};
1689 let DecoderMethod = "DecodeNEONModImmInstruction";
1692 // NEON 2 vector register format.
1693 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1694 bits<5> op11_7, bit op6, bit op4,
1695 dag oops, dag iops, InstrItinClass itin,
1696 string opc, string dt, string asm, string cstr, list<dag> pattern>
1697 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1698 let Inst{24-23} = op24_23;
1699 let Inst{21-20} = op21_20;
1700 let Inst{19-18} = op19_18;
1701 let Inst{17-16} = op17_16;
1702 let Inst{11-7} = op11_7;
1706 // Instruction operands.
1710 let Inst{15-12} = Vd{3-0};
1711 let Inst{22} = Vd{4};
1712 let Inst{3-0} = Vm{3-0};
1713 let Inst{5} = Vm{4};
1716 // Same as N2V except it doesn't have a datatype suffix.
1717 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1718 bits<5> op11_7, bit op6, bit op4,
1719 dag oops, dag iops, InstrItinClass itin,
1720 string opc, string asm, string cstr, list<dag> pattern>
1721 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1722 let Inst{24-23} = op24_23;
1723 let Inst{21-20} = op21_20;
1724 let Inst{19-18} = op19_18;
1725 let Inst{17-16} = op17_16;
1726 let Inst{11-7} = op11_7;
1730 // Instruction operands.
1734 let Inst{15-12} = Vd{3-0};
1735 let Inst{22} = Vd{4};
1736 let Inst{3-0} = Vm{3-0};
1737 let Inst{5} = Vm{4};
1740 // NEON 2 vector register with immediate.
1741 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1742 dag oops, dag iops, Format f, InstrItinClass itin,
1743 string opc, string dt, string asm, string cstr, list<dag> pattern>
1744 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1745 let Inst{24} = op24;
1746 let Inst{23} = op23;
1747 let Inst{11-8} = op11_8;
1752 // 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};
1761 let Inst{21-16} = SIMM{5-0};
1764 // NEON 3 vector register format.
1766 class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1767 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1768 string opc, string dt, string asm, string cstr,
1770 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1771 let Inst{24} = op24;
1772 let Inst{23} = op23;
1773 let Inst{21-20} = op21_20;
1774 let Inst{11-8} = op11_8;
1779 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1780 dag oops, dag iops, Format f, InstrItinClass itin,
1781 string opc, string dt, string asm, string cstr, list<dag> pattern>
1782 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1783 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1785 // Instruction operands.
1790 let Inst{15-12} = Vd{3-0};
1791 let Inst{22} = Vd{4};
1792 let Inst{19-16} = Vn{3-0};
1793 let Inst{7} = Vn{4};
1794 let Inst{3-0} = Vm{3-0};
1795 let Inst{5} = Vm{4};
1798 class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1799 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1800 string opc, string dt, string asm, string cstr,
1802 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1803 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1805 // Instruction operands.
1811 let Inst{15-12} = Vd{3-0};
1812 let Inst{22} = Vd{4};
1813 let Inst{19-16} = Vn{3-0};
1814 let Inst{7} = Vn{4};
1815 let Inst{3-0} = Vm{3-0};
1819 class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1820 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1821 string opc, string dt, string asm, string cstr,
1823 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1824 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1826 // Instruction operands.
1832 let Inst{15-12} = Vd{3-0};
1833 let Inst{22} = Vd{4};
1834 let Inst{19-16} = Vn{3-0};
1835 let Inst{7} = Vn{4};
1836 let Inst{2-0} = Vm{2-0};
1837 let Inst{5} = lane{1};
1838 let Inst{3} = lane{0};
1841 // Same as N3V except it doesn't have a data type suffix.
1842 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1844 dag oops, dag iops, Format f, InstrItinClass itin,
1845 string opc, string asm, string cstr, list<dag> pattern>
1846 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1847 let Inst{24} = op24;
1848 let Inst{23} = op23;
1849 let Inst{21-20} = op21_20;
1850 let Inst{11-8} = op11_8;
1854 // 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{3-0} = Vm{3-0};
1864 let Inst{5} = Vm{4};
1867 // NEON VMOVs between scalar and core registers.
1868 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1869 dag oops, dag iops, Format f, InstrItinClass itin,
1870 string opc, string dt, string asm, list<dag> pattern>
1871 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
1873 let Inst{27-20} = opcod1;
1874 let Inst{11-8} = opcod2;
1875 let Inst{6-5} = opcod3;
1877 // A8.6.303, A8.6.328, A8.6.329
1878 let Inst{3-0} = 0b0000;
1880 let OutOperandList = oops;
1881 let InOperandList = !con(iops, (ins pred:$p));
1882 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1883 let Pattern = pattern;
1884 list<Predicate> Predicates = [HasNEON];
1886 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
1887 let DecoderNamespace = "NEONDup";
1894 let Inst{31-28} = p{3-0};
1896 let Inst{19-16} = V{3-0};
1897 let Inst{15-12} = R{3-0};
1899 class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1900 dag oops, dag iops, InstrItinClass itin,
1901 string opc, string dt, string asm, list<dag> pattern>
1902 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
1903 opc, dt, asm, pattern>;
1904 class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1905 dag oops, dag iops, InstrItinClass itin,
1906 string opc, string dt, string asm, list<dag> pattern>
1907 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
1908 opc, dt, asm, pattern>;
1909 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1910 dag oops, dag iops, InstrItinClass itin,
1911 string opc, string dt, string asm, list<dag> pattern>
1912 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1913 opc, dt, asm, pattern>;
1915 // Vector Duplicate Lane (from scalar to all elements)
1916 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1917 InstrItinClass itin, string opc, string dt, string asm,
1919 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1920 let Inst{24-23} = 0b11;
1921 let Inst{21-20} = 0b11;
1922 let Inst{19-16} = op19_16;
1923 let Inst{11-7} = 0b11000;
1931 let Inst{22} = Vd{4};
1932 let Inst{15-12} = Vd{3-0};
1933 let Inst{5} = Vm{4};
1934 let Inst{3-0} = Vm{3-0};
1937 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1938 // for single-precision FP.
1939 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1940 list<Predicate> Predicates = [HasNEON,UseNEONForFP];