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 def CondCodeOperand : AsmOperandClass {
135 let Name = "CondCode";
136 let SuperClasses = [];
139 def CCOutOperand : AsmOperandClass {
141 let SuperClasses = [];
144 def MemBarrierOptOperand : AsmOperandClass {
145 let Name = "MemBarrierOpt";
146 let SuperClasses = [];
147 let ParserMethod = "parseMemBarrierOptOperand";
150 def ProcIFlagsOperand : AsmOperandClass {
151 let Name = "ProcIFlags";
152 let SuperClasses = [];
153 let ParserMethod = "parseProcIFlagsOperand";
156 def MSRMaskOperand : AsmOperandClass {
157 let Name = "MSRMask";
158 let SuperClasses = [];
159 let ParserMethod = "parseMSRMaskOperand";
162 // ARM imod and iflag operands, used only by the CPS instruction.
163 def imod_op : Operand<i32> {
164 let PrintMethod = "printCPSIMod";
167 def iflags_op : Operand<i32> {
168 let PrintMethod = "printCPSIFlag";
169 let ParserMatchClass = ProcIFlagsOperand;
172 // ARM Predicate operand. Default to 14 = always (AL). Second part is CC
173 // register whose default is 0 (no register).
174 def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
175 (ops (i32 14), (i32 zero_reg))> {
176 let PrintMethod = "printPredicateOperand";
177 let ParserMatchClass = CondCodeOperand;
180 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
181 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
182 let EncoderMethod = "getCCOutOpValue";
183 let PrintMethod = "printSBitModifierOperand";
184 let ParserMatchClass = CCOutOperand;
187 // Same as cc_out except it defaults to setting CPSR.
188 def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
189 let EncoderMethod = "getCCOutOpValue";
190 let PrintMethod = "printSBitModifierOperand";
191 let ParserMatchClass = CCOutOperand;
194 // ARM special operands for disassembly only.
196 def SetEndAsmOperand : AsmOperandClass {
197 let Name = "SetEndImm";
198 let ParserMethod = "parseSetEndImm";
200 def setend_op : Operand<i32> {
201 let PrintMethod = "printSetendOperand";
202 let ParserMatchClass = SetEndAsmOperand;
205 def msr_mask : Operand<i32> {
206 let PrintMethod = "printMSRMaskOperand";
207 let ParserMatchClass = MSRMaskOperand;
210 // Shift Right Immediate - A shift right immediate is encoded differently from
211 // other shift immediates. The imm6 field is encoded like so:
214 // 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
215 // 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
216 // 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
217 // 64 64 - <imm> is encoded in imm6<5:0>
218 def shr_imm8 : Operand<i32> {
219 let EncoderMethod = "getShiftRight8Imm";
221 def shr_imm16 : Operand<i32> {
222 let EncoderMethod = "getShiftRight16Imm";
224 def shr_imm32 : Operand<i32> {
225 let EncoderMethod = "getShiftRight32Imm";
227 def shr_imm64 : Operand<i32> {
228 let EncoderMethod = "getShiftRight64Imm";
231 //===----------------------------------------------------------------------===//
232 // ARM Instruction templates.
235 class InstTemplate<AddrMode am, int sz, IndexMode im,
236 Format f, Domain d, string cstr, InstrItinClass itin>
238 let Namespace = "ARM";
243 bits<2> IndexModeBits = IM.Value;
245 bits<6> Form = F.Value;
247 bit isUnaryDataProc = 0;
248 bit canXformTo16Bit = 0;
250 // If this is a pseudo instruction, mark it isCodeGenOnly.
251 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
253 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
254 let TSFlags{4-0} = AM.Value;
255 let TSFlags{6-5} = IndexModeBits;
256 let TSFlags{12-7} = Form;
257 let TSFlags{13} = isUnaryDataProc;
258 let TSFlags{14} = canXformTo16Bit;
259 let TSFlags{17-15} = D.Value;
261 let Constraints = cstr;
262 let Itinerary = itin;
269 class InstARM<AddrMode am, int sz, IndexMode im,
270 Format f, Domain d, string cstr, InstrItinClass itin>
271 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
272 let DecoderNamespace = "ARM";
275 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
276 // on by adding flavors to specific instructions.
277 class InstThumb<AddrMode am, int sz, IndexMode im,
278 Format f, Domain d, string cstr, InstrItinClass itin>
279 : InstTemplate<am, sz, im, f, d, cstr, itin> {
280 let DecoderNamespace = "Thumb";
283 class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
284 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
285 GenericDomain, "", itin> {
286 let OutOperandList = oops;
287 let InOperandList = iops;
288 let Pattern = pattern;
289 let isCodeGenOnly = 1;
293 // PseudoInst that's ARM-mode only.
294 class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
296 : PseudoInst<oops, iops, itin, pattern> {
298 list<Predicate> Predicates = [IsARM];
301 // PseudoInst that's Thumb-mode only.
302 class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
304 : PseudoInst<oops, iops, itin, pattern> {
306 list<Predicate> Predicates = [IsThumb];
309 // PseudoInst that's Thumb2-mode only.
310 class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
312 : PseudoInst<oops, iops, itin, pattern> {
314 list<Predicate> Predicates = [IsThumb2];
317 class ARMPseudoExpand<dag oops, dag iops, int sz,
318 InstrItinClass itin, list<dag> pattern,
320 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
321 PseudoInstExpansion<Result>;
323 class tPseudoExpand<dag oops, dag iops, int sz,
324 InstrItinClass itin, list<dag> pattern,
326 : tPseudoInst<oops, iops, sz, itin, pattern>,
327 PseudoInstExpansion<Result>;
329 class t2PseudoExpand<dag oops, dag iops, int sz,
330 InstrItinClass itin, list<dag> pattern,
332 : t2PseudoInst<oops, iops, sz, itin, pattern>,
333 PseudoInstExpansion<Result>;
335 // Almost all ARM instructions are predicable.
336 class I<dag oops, dag iops, AddrMode am, int sz,
337 IndexMode im, Format f, InstrItinClass itin,
338 string opc, string asm, string cstr,
340 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
343 let OutOperandList = oops;
344 let InOperandList = !con(iops, (ins pred:$p));
345 let AsmString = !strconcat(opc, "${p}", asm);
346 let Pattern = pattern;
347 list<Predicate> Predicates = [IsARM];
350 // A few are not predicable
351 class InoP<dag oops, dag iops, AddrMode am, int sz,
352 IndexMode im, Format f, InstrItinClass itin,
353 string opc, string asm, string cstr,
355 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
356 let OutOperandList = oops;
357 let InOperandList = iops;
358 let AsmString = !strconcat(opc, asm);
359 let Pattern = pattern;
360 let isPredicable = 0;
361 list<Predicate> Predicates = [IsARM];
364 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
365 // operand since by default it's a zero register. It will become an implicit def
366 // once it's "flipped".
367 class sI<dag oops, dag iops, AddrMode am, int sz,
368 IndexMode im, Format f, InstrItinClass itin,
369 string opc, string asm, string cstr,
371 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
372 bits<4> p; // Predicate operand
373 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
377 let OutOperandList = oops;
378 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
379 let AsmString = !strconcat(opc, "${s}${p}", asm);
380 let Pattern = pattern;
381 list<Predicate> Predicates = [IsARM];
385 class XI<dag oops, dag iops, AddrMode am, int sz,
386 IndexMode im, Format f, InstrItinClass itin,
387 string asm, string cstr, list<dag> pattern>
388 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
389 let OutOperandList = oops;
390 let InOperandList = iops;
392 let Pattern = pattern;
393 list<Predicate> Predicates = [IsARM];
396 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
397 string opc, string asm, list<dag> pattern>
398 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
399 opc, asm, "", pattern>;
400 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
401 string opc, string asm, list<dag> pattern>
402 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
403 opc, asm, "", pattern>;
404 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
405 string asm, list<dag> pattern>
406 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
408 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
409 string opc, string asm, list<dag> pattern>
410 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
411 opc, asm, "", pattern>;
413 // Ctrl flow instructions
414 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
415 string opc, string asm, list<dag> pattern>
416 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
417 opc, asm, "", pattern> {
418 let Inst{27-24} = opcod;
420 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
421 string asm, list<dag> pattern>
422 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
424 let Inst{27-24} = opcod;
427 // BR_JT instructions
428 class JTI<dag oops, dag iops, InstrItinClass itin,
429 string asm, list<dag> pattern>
430 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
433 // Atomic load/store instructions
434 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
435 string opc, string asm, list<dag> pattern>
436 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
437 opc, asm, "", pattern> {
440 let Inst{27-23} = 0b00011;
441 let Inst{22-21} = opcod;
443 let Inst{19-16} = Rn;
444 let Inst{15-12} = Rt;
445 let Inst{11-0} = 0b111110011111;
447 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
448 string opc, string asm, list<dag> pattern>
449 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
450 opc, asm, "", pattern> {
454 let Inst{27-23} = 0b00011;
455 let Inst{22-21} = opcod;
457 let Inst{19-16} = addr;
458 let Inst{15-12} = Rd;
459 let Inst{11-4} = 0b11111001;
462 class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
463 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, [$Rn]", pattern> {
467 let Inst{27-23} = 0b00010;
469 let Inst{21-20} = 0b00;
470 let Inst{19-16} = Rn;
471 let Inst{15-12} = Rt;
472 let Inst{11-4} = 0b00001001;
476 // addrmode1 instructions
477 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
478 string opc, string asm, list<dag> pattern>
479 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
480 opc, asm, "", pattern> {
481 let Inst{24-21} = opcod;
482 let Inst{27-26} = 0b00;
484 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
485 string opc, string asm, list<dag> pattern>
486 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
487 opc, asm, "", pattern> {
488 let Inst{24-21} = opcod;
489 let Inst{27-26} = 0b00;
491 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
492 string asm, list<dag> pattern>
493 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
495 let Inst{24-21} = opcod;
496 let Inst{27-26} = 0b00;
501 // LDR/LDRB/STR/STRB/...
502 class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
503 Format f, InstrItinClass itin, string opc, string asm,
505 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
507 let Inst{27-25} = op;
508 let Inst{24} = 1; // 24 == P
510 let Inst{22} = isByte;
511 let Inst{21} = 0; // 21 == W
514 // Indexed load/stores
515 class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
516 IndexMode im, Format f, InstrItinClass itin, string opc,
517 string asm, string cstr, list<dag> pattern>
518 : I<oops, iops, AddrMode2, 4, im, f, itin,
519 opc, asm, cstr, pattern> {
521 let Inst{27-26} = 0b01;
522 let Inst{24} = isPre; // P bit
523 let Inst{22} = isByte; // B bit
524 let Inst{21} = isPre; // W bit
525 let Inst{20} = isLd; // L bit
526 let Inst{15-12} = Rt;
528 class AI2stridx<bit isByte, bit isPre, dag oops, dag iops,
529 IndexMode im, Format f, InstrItinClass itin, string opc,
530 string asm, string cstr, list<dag> pattern>
531 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
533 // AM2 store w/ two operands: (GPR, am2offset)
534 // {13} 1 == Rm, 0 == imm12
539 let Inst{25} = offset{13};
540 let Inst{23} = offset{12};
541 let Inst{19-16} = Rn;
542 let Inst{11-0} = offset{11-0};
544 // FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
545 // but for now use this class for STRT and STRBT.
546 class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
547 IndexMode im, Format f, InstrItinClass itin, string opc,
548 string asm, string cstr, list<dag> pattern>
549 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
551 // AM2 store w/ two operands: (GPR, am2offset)
553 // {13} 1 == Rm, 0 == imm12
557 let Inst{25} = addr{13};
558 let Inst{23} = addr{12};
559 let Inst{19-16} = addr{17-14};
560 let Inst{11-0} = addr{11-0};
563 // addrmode3 instructions
564 class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
565 InstrItinClass itin, string opc, string asm, list<dag> pattern>
566 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
567 opc, asm, "", pattern> {
570 let Inst{27-25} = 0b000;
571 let Inst{24} = 1; // P bit
572 let Inst{23} = addr{8}; // U bit
573 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
574 let Inst{21} = 0; // W bit
575 let Inst{20} = op20; // L bit
576 let Inst{19-16} = addr{12-9}; // Rn
577 let Inst{15-12} = Rt; // Rt
578 let Inst{11-8} = addr{7-4}; // imm7_4/zero
580 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
583 class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
584 IndexMode im, Format f, InstrItinClass itin, string opc,
585 string asm, string cstr, list<dag> pattern>
586 : I<oops, iops, AddrMode3, 4, im, f, itin,
587 opc, asm, cstr, pattern> {
589 let Inst{27-25} = 0b000;
590 let Inst{24} = isPre; // P bit
591 let Inst{21} = isPre; // W bit
592 let Inst{20} = op20; // L bit
593 let Inst{15-12} = Rt; // Rt
597 // FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
598 // but for now use this class for LDRSBT, LDRHT, LDSHT.
599 class AI3ldstidxT<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
600 IndexMode im, Format f, InstrItinClass itin, string opc,
601 string asm, string cstr, list<dag> pattern>
602 : I<oops, iops, AddrMode3, 4, im, f, itin,
603 opc, asm, cstr, pattern> {
604 // {13} 1 == imm8, 0 == Rm
611 let Inst{27-25} = 0b000;
612 let Inst{24} = isPre; // P bit
613 let Inst{23} = addr{8}; // U bit
614 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
615 let Inst{20} = op20; // L bit
616 let Inst{19-16} = addr{12-9}; // Rn
617 let Inst{15-12} = Rt; // Rt
618 let Inst{11-8} = addr{7-4}; // imm7_4/zero
620 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
621 let AsmMatchConverter = "CvtLdWriteBackRegAddrMode3";
624 class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
625 IndexMode im, Format f, InstrItinClass itin, string opc,
626 string asm, string cstr, list<dag> pattern>
627 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
629 // AM3 store w/ two operands: (GPR, am3offset)
633 let Inst{27-25} = 0b000;
634 let Inst{23} = offset{8};
635 let Inst{22} = offset{9};
636 let Inst{19-16} = Rn;
637 let Inst{15-12} = Rt; // Rt
638 let Inst{11-8} = offset{7-4}; // imm7_4/zero
640 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
644 class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
645 string opc, string asm, list<dag> pattern>
646 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
647 opc, asm, "", pattern> {
650 let Inst{27-25} = 0b000;
651 let Inst{24} = 1; // P bit
652 let Inst{23} = addr{8}; // U bit
653 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
654 let Inst{21} = 0; // W bit
655 let Inst{20} = 0; // L bit
656 let Inst{19-16} = addr{12-9}; // Rn
657 let Inst{15-12} = Rt; // Rt
658 let Inst{11-8} = addr{7-4}; // imm7_4/zero
660 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
663 // Pre-indexed stores
664 class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
665 string opc, string asm, string cstr, list<dag> pattern>
666 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
667 opc, asm, cstr, pattern> {
669 let Inst{5} = 1; // H bit
670 let Inst{6} = 0; // S bit
672 let Inst{20} = 0; // L bit
673 let Inst{21} = 1; // W bit
674 let Inst{24} = 1; // P bit
675 let Inst{27-25} = 0b000;
677 class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
678 string opc, string asm, string cstr, list<dag> pattern>
679 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
680 opc, asm, cstr, pattern> {
682 let Inst{5} = 1; // H bit
683 let Inst{6} = 1; // S bit
685 let Inst{20} = 0; // L bit
686 let Inst{21} = 1; // W bit
687 let Inst{24} = 1; // P bit
688 let Inst{27-25} = 0b000;
691 // Post-indexed stores
692 class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
693 string opc, string asm, string cstr, list<dag> pattern>
694 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
695 opc, asm, cstr,pattern> {
696 // {13} 1 == imm8, 0 == Rm
703 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
705 let Inst{5} = 1; // H bit
706 let Inst{6} = 0; // S bit
708 let Inst{11-8} = addr{7-4}; // imm7_4/zero
709 let Inst{15-12} = Rt; // Rt
710 let Inst{19-16} = addr{12-9}; // Rn
711 let Inst{20} = 0; // L bit
712 let Inst{21} = 0; // W bit
713 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
714 let Inst{23} = addr{8}; // U bit
715 let Inst{24} = 0; // P bit
716 let Inst{27-25} = 0b000;
718 class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
719 string opc, string asm, string cstr, list<dag> pattern>
720 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
721 opc, asm, cstr, pattern> {
723 let Inst{5} = 1; // H bit
724 let Inst{6} = 1; // S bit
726 let Inst{20} = 0; // L bit
727 let Inst{21} = 0; // W bit
728 let Inst{24} = 0; // P bit
729 let Inst{27-25} = 0b000;
732 // addrmode4 instructions
733 class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
734 string asm, string cstr, list<dag> pattern>
735 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
740 let Inst{27-25} = 0b100;
741 let Inst{22} = 0; // S bit
742 let Inst{19-16} = Rn;
743 let Inst{15-0} = regs;
746 // Unsigned multiply, multiply-accumulate instructions.
747 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
748 string opc, string asm, list<dag> pattern>
749 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
750 opc, asm, "", pattern> {
751 let Inst{7-4} = 0b1001;
752 let Inst{20} = 0; // S bit
753 let Inst{27-21} = opcod;
755 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
756 string opc, string asm, list<dag> pattern>
757 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
758 opc, asm, "", pattern> {
759 let Inst{7-4} = 0b1001;
760 let Inst{27-21} = opcod;
763 // Most significant word multiply
764 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
765 InstrItinClass itin, string opc, string asm, list<dag> pattern>
766 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
767 opc, asm, "", pattern> {
771 let Inst{7-4} = opc7_4;
773 let Inst{27-21} = opcod;
774 let Inst{19-16} = Rd;
778 // MSW multiple w/ Ra operand
779 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
780 InstrItinClass itin, string opc, string asm, list<dag> pattern>
781 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
783 let Inst{15-12} = Ra;
786 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
787 class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
788 InstrItinClass itin, string opc, string asm, list<dag> pattern>
789 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
790 opc, asm, "", pattern> {
796 let Inst{27-21} = opcod;
797 let Inst{6-5} = bit6_5;
801 class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
802 InstrItinClass itin, string opc, string asm, list<dag> pattern>
803 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
805 let Inst{19-16} = Rd;
808 // AMulxyI with Ra operand
809 class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
810 InstrItinClass itin, string opc, string asm, list<dag> pattern>
811 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
813 let Inst{15-12} = Ra;
816 class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
817 InstrItinClass itin, string opc, string asm, list<dag> pattern>
818 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
821 let Inst{19-16} = RdHi;
822 let Inst{15-12} = RdLo;
825 // Extend instructions.
826 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
827 string opc, string asm, list<dag> pattern>
828 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
829 opc, asm, "", pattern> {
830 // All AExtI instructions have Rd and Rm register operands.
833 let Inst{15-12} = Rd;
835 let Inst{7-4} = 0b0111;
836 let Inst{9-8} = 0b00;
837 let Inst{27-20} = opcod;
840 // Misc Arithmetic instructions.
841 class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
842 InstrItinClass itin, string opc, string asm, list<dag> pattern>
843 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
844 opc, asm, "", pattern> {
847 let Inst{27-20} = opcod;
848 let Inst{19-16} = 0b1111;
849 let Inst{15-12} = Rd;
850 let Inst{11-8} = 0b1111;
851 let Inst{7-4} = opc7_4;
856 def PKHLSLAsmOperand : AsmOperandClass {
857 let Name = "PKHLSLImm";
858 let ParserMethod = "parsePKHLSLImm";
860 def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
861 let PrintMethod = "printPKHLSLShiftImm";
862 let ParserMatchClass = PKHLSLAsmOperand;
864 def PKHASRAsmOperand : AsmOperandClass {
865 let Name = "PKHASRImm";
866 let ParserMethod = "parsePKHASRImm";
868 def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
869 let PrintMethod = "printPKHASRShiftImm";
870 let ParserMatchClass = PKHASRAsmOperand;
873 class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
874 string opc, string asm, list<dag> pattern>
875 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
876 opc, asm, "", pattern> {
881 let Inst{27-20} = opcod;
882 let Inst{19-16} = Rn;
883 let Inst{15-12} = Rd;
886 let Inst{5-4} = 0b01;
890 //===----------------------------------------------------------------------===//
892 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
893 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
894 list<Predicate> Predicates = [IsARM];
896 class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
897 list<Predicate> Predicates = [IsARM, HasV5T];
899 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
900 list<Predicate> Predicates = [IsARM, HasV5TE];
902 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
903 list<Predicate> Predicates = [IsARM, HasV6];
906 //===----------------------------------------------------------------------===//
907 // Thumb Instruction Format Definitions.
910 class ThumbI<dag oops, dag iops, AddrMode am, int sz,
911 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
912 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
913 let OutOperandList = oops;
914 let InOperandList = iops;
916 let Pattern = pattern;
917 list<Predicate> Predicates = [IsThumb];
920 // TI - Thumb instruction.
921 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
922 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
924 // Two-address instructions
925 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
927 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
930 // tBL, tBX 32-bit instructions
931 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
932 dag oops, dag iops, InstrItinClass itin, string asm,
934 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
936 let Inst{31-27} = opcod1;
937 let Inst{15-14} = opcod2;
938 let Inst{12} = opcod3;
941 // BR_JT instructions
942 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
944 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
947 class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
948 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
949 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
950 let OutOperandList = oops;
951 let InOperandList = iops;
953 let Pattern = pattern;
954 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
957 class T1I<dag oops, dag iops, InstrItinClass itin,
958 string asm, list<dag> pattern>
959 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
960 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
961 string asm, list<dag> pattern>
962 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
964 // Two-address instructions
965 class T1It<dag oops, dag iops, InstrItinClass itin,
966 string asm, string cstr, list<dag> pattern>
967 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
970 // Thumb1 instruction that can either be predicated or set CPSR.
971 class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
973 string opc, string asm, string cstr, list<dag> pattern>
974 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
975 let OutOperandList = !con(oops, (outs s_cc_out:$s));
976 let InOperandList = !con(iops, (ins pred:$p));
977 let AsmString = !strconcat(opc, "${s}${p}", asm);
978 let Pattern = pattern;
979 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
982 class T1sI<dag oops, dag iops, InstrItinClass itin,
983 string opc, string asm, list<dag> pattern>
984 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
986 // Two-address instructions
987 class T1sIt<dag oops, dag iops, InstrItinClass itin,
988 string opc, string asm, list<dag> pattern>
989 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
990 "$Rn = $Rdn", pattern>;
992 // Thumb1 instruction that can be predicated.
993 class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
995 string opc, string asm, string cstr, list<dag> pattern>
996 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
997 let OutOperandList = oops;
998 let InOperandList = !con(iops, (ins pred:$p));
999 let AsmString = !strconcat(opc, "${p}", asm);
1000 let Pattern = pattern;
1001 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1004 class T1pI<dag oops, dag iops, InstrItinClass itin,
1005 string opc, string asm, list<dag> pattern>
1006 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
1008 // Two-address instructions
1009 class T1pIt<dag oops, dag iops, InstrItinClass itin,
1010 string opc, string asm, list<dag> pattern>
1011 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
1012 "$Rn = $Rdn", pattern>;
1014 class T1pIs<dag oops, dag iops,
1015 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1016 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
1018 class Encoding16 : Encoding {
1019 let Inst{31-16} = 0x0000;
1022 // A6.2 16-bit Thumb instruction encoding
1023 class T1Encoding<bits<6> opcode> : Encoding16 {
1024 let Inst{15-10} = opcode;
1027 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
1028 class T1General<bits<5> opcode> : Encoding16 {
1029 let Inst{15-14} = 0b00;
1030 let Inst{13-9} = opcode;
1033 // A6.2.2 Data-processing encoding.
1034 class T1DataProcessing<bits<4> opcode> : Encoding16 {
1035 let Inst{15-10} = 0b010000;
1036 let Inst{9-6} = opcode;
1039 // A6.2.3 Special data instructions and branch and exchange encoding.
1040 class T1Special<bits<4> opcode> : Encoding16 {
1041 let Inst{15-10} = 0b010001;
1042 let Inst{9-6} = opcode;
1045 // A6.2.4 Load/store single data item encoding.
1046 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
1047 let Inst{15-12} = opA;
1048 let Inst{11-9} = opB;
1050 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1052 class T1BranchCond<bits<4> opcode> : Encoding16 {
1053 let Inst{15-12} = opcode;
1056 // Helper classes to encode Thumb1 loads and stores. For immediates, the
1057 // following bits are used for "opA" (see A6.2.4):
1059 // 0b0110 => Immediate, 4 bytes
1060 // 0b1000 => Immediate, 2 bytes
1061 // 0b0111 => Immediate, 1 byte
1062 class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1063 InstrItinClass itin, string opc, string asm,
1065 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1066 T1LoadStore<0b0101, opcode> {
1069 let Inst{8-6} = addr{5-3}; // Rm
1070 let Inst{5-3} = addr{2-0}; // Rn
1073 class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1074 InstrItinClass itin, string opc, string asm,
1076 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1077 T1LoadStore<opA, {opB,?,?}> {
1080 let Inst{10-6} = addr{7-3}; // imm5
1081 let Inst{5-3} = addr{2-0}; // Rn
1085 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1086 class T1Misc<bits<7> opcode> : Encoding16 {
1087 let Inst{15-12} = 0b1011;
1088 let Inst{11-5} = opcode;
1091 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1092 class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
1093 InstrItinClass itin,
1094 string opc, string asm, string cstr, list<dag> pattern>
1095 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1096 let OutOperandList = oops;
1097 let InOperandList = !con(iops, (ins pred:$p));
1098 let AsmString = !strconcat(opc, "${p}", asm);
1099 let Pattern = pattern;
1100 list<Predicate> Predicates = [IsThumb2];
1101 let DecoderNamespace = "Thumb2";
1104 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1105 // input operand since by default it's a zero register. It will become an
1106 // implicit def once it's "flipped".
1108 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1110 class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
1111 InstrItinClass itin,
1112 string opc, string asm, string cstr, list<dag> pattern>
1113 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1114 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1117 let OutOperandList = oops;
1118 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1119 let AsmString = !strconcat(opc, "${s}${p}", asm);
1120 let Pattern = pattern;
1121 list<Predicate> Predicates = [IsThumb2];
1122 let DecoderNamespace = "Thumb2";
1126 class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
1127 InstrItinClass itin,
1128 string asm, string cstr, list<dag> pattern>
1129 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1130 let OutOperandList = oops;
1131 let InOperandList = iops;
1132 let AsmString = asm;
1133 let Pattern = pattern;
1134 list<Predicate> Predicates = [IsThumb2];
1135 let DecoderNamespace = "Thumb2";
1138 class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
1139 InstrItinClass itin,
1140 string asm, string cstr, list<dag> pattern>
1141 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1142 let OutOperandList = oops;
1143 let InOperandList = iops;
1144 let AsmString = asm;
1145 let Pattern = pattern;
1146 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1147 let DecoderNamespace = "Thumb";
1150 class T2I<dag oops, dag iops, InstrItinClass itin,
1151 string opc, string asm, list<dag> pattern>
1152 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1153 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1154 string opc, string asm, list<dag> pattern>
1155 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
1156 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1157 string opc, string asm, list<dag> pattern>
1158 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
1159 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1160 string opc, string asm, list<dag> pattern>
1161 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
1162 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1163 string opc, string asm, list<dag> pattern>
1164 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
1165 class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1166 string opc, string asm, list<dag> pattern>
1167 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
1172 let Inst{31-25} = 0b1110100;
1174 let Inst{23} = addr{8};
1177 let Inst{20} = isLoad;
1178 let Inst{19-16} = addr{12-9};
1179 let Inst{15-12} = Rt{3-0};
1180 let Inst{11-8} = Rt2{3-0};
1181 let Inst{7-0} = addr{7-0};
1184 class T2sI<dag oops, dag iops, InstrItinClass itin,
1185 string opc, string asm, list<dag> pattern>
1186 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1188 class T2XI<dag oops, dag iops, InstrItinClass itin,
1189 string asm, list<dag> pattern>
1190 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
1191 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1192 string asm, list<dag> pattern>
1193 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
1195 // Move to/from coprocessor instructions
1196 class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
1197 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
1198 let Inst{31-28} = opc;
1201 // Two-address instructions
1202 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1203 string asm, string cstr, list<dag> pattern>
1204 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
1206 // T2Iidxldst - Thumb2 indexed load / store instructions.
1207 class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1209 AddrMode am, IndexMode im, InstrItinClass itin,
1210 string opc, string asm, string cstr, list<dag> pattern>
1211 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1212 let OutOperandList = oops;
1213 let InOperandList = !con(iops, (ins pred:$p));
1214 let AsmString = !strconcat(opc, "${p}", asm);
1215 let Pattern = pattern;
1216 list<Predicate> Predicates = [IsThumb2];
1217 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;
1225 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1226 let Inst{10} = pre; // The P bit.
1227 let Inst{8} = 1; // The W bit.
1230 let Inst{7-0} = addr{7-0};
1231 let Inst{9} = addr{8}; // Sign bit
1235 let Inst{15-12} = Rt{3-0};
1236 let Inst{19-16} = Rn{3-0};
1239 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1240 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1241 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
1244 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1245 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1246 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1249 // T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1250 class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1251 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1254 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1255 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1256 list<Predicate> Predicates = [IsThumb2];
1259 //===----------------------------------------------------------------------===//
1261 //===----------------------------------------------------------------------===//
1262 // ARM VFP Instruction templates.
1265 // Almost all VFP instructions are predicable.
1266 class VFPI<dag oops, dag iops, AddrMode am, int sz,
1267 IndexMode im, Format f, InstrItinClass itin,
1268 string opc, string asm, string cstr, list<dag> pattern>
1269 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1271 let Inst{31-28} = p;
1272 let OutOperandList = oops;
1273 let InOperandList = !con(iops, (ins pred:$p));
1274 let AsmString = !strconcat(opc, "${p}", asm);
1275 let Pattern = pattern;
1276 let PostEncoderMethod = "VFPThumb2PostEncoder";
1277 list<Predicate> Predicates = [HasVFP2];
1281 class VFPXI<dag oops, dag iops, AddrMode am, int sz,
1282 IndexMode im, Format f, InstrItinClass itin,
1283 string asm, string cstr, list<dag> pattern>
1284 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1286 let Inst{31-28} = p;
1287 let OutOperandList = oops;
1288 let InOperandList = iops;
1289 let AsmString = asm;
1290 let Pattern = pattern;
1291 let PostEncoderMethod = "VFPThumb2PostEncoder";
1292 list<Predicate> Predicates = [HasVFP2];
1295 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1296 string opc, string asm, list<dag> pattern>
1297 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
1298 opc, asm, "", pattern> {
1299 let PostEncoderMethod = "VFPThumb2PostEncoder";
1302 // ARM VFP addrmode5 loads and stores
1303 class ADI5<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} = Dd{4};
1315 let Inst{19-16} = addr{12-9}; // Rn
1316 let Inst{15-12} = Dd{3-0};
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} = 1; // Double precision
1325 // Loads & stores operate on both NEON and VFP pipelines.
1326 let D = VFPNeonDomain;
1329 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1330 InstrItinClass itin,
1331 string opc, string asm, list<dag> pattern>
1332 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1333 VFPLdStFrm, itin, opc, asm, "", pattern> {
1334 // Instruction operands.
1338 // Encode instruction operands.
1339 let Inst{23} = addr{8}; // U (add = (U == '1'))
1340 let Inst{22} = Sd{0};
1341 let Inst{19-16} = addr{12-9}; // Rn
1342 let Inst{15-12} = Sd{4-1};
1343 let Inst{7-0} = addr{7-0}; // imm8
1345 // TODO: Mark the instructions with the appropriate subtarget info.
1346 let Inst{27-24} = opcod1;
1347 let Inst{21-20} = opcod2;
1348 let Inst{11-9} = 0b101;
1349 let Inst{8} = 0; // Single precision
1351 // Loads & stores operate on both NEON and VFP pipelines.
1352 let D = VFPNeonDomain;
1355 // VFP Load / store multiple pseudo instructions.
1356 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1358 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
1360 let OutOperandList = oops;
1361 let InOperandList = !con(iops, (ins pred:$p));
1362 let Pattern = pattern;
1363 list<Predicate> Predicates = [HasVFP2];
1366 // Load / store multiple
1367 class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1368 string asm, string cstr, list<dag> pattern>
1369 : VFPXI<oops, iops, AddrMode4, 4, im,
1370 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1371 // Instruction operands.
1375 // Encode instruction operands.
1376 let Inst{19-16} = Rn;
1377 let Inst{22} = regs{12};
1378 let Inst{15-12} = regs{11-8};
1379 let Inst{7-0} = regs{7-0};
1381 // TODO: Mark the instructions with the appropriate subtarget info.
1382 let Inst{27-25} = 0b110;
1383 let Inst{11-9} = 0b101;
1384 let Inst{8} = 1; // Double precision
1387 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1388 string asm, string cstr, list<dag> pattern>
1389 : VFPXI<oops, iops, AddrMode4, 4, im,
1390 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1391 // Instruction operands.
1395 // Encode instruction operands.
1396 let Inst{19-16} = Rn;
1397 let Inst{22} = regs{8};
1398 let Inst{15-12} = regs{12-9};
1399 let Inst{7-0} = regs{7-0};
1401 // TODO: Mark the instructions with the appropriate subtarget info.
1402 let Inst{27-25} = 0b110;
1403 let Inst{11-9} = 0b101;
1404 let Inst{8} = 0; // Single precision
1407 // Double precision, unary
1408 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1409 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1410 string asm, list<dag> pattern>
1411 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1412 // Instruction operands.
1416 // Encode instruction operands.
1417 let Inst{3-0} = Dm{3-0};
1418 let Inst{5} = Dm{4};
1419 let Inst{15-12} = Dd{3-0};
1420 let Inst{22} = Dd{4};
1422 let Inst{27-23} = opcod1;
1423 let Inst{21-20} = opcod2;
1424 let Inst{19-16} = opcod3;
1425 let Inst{11-9} = 0b101;
1426 let Inst{8} = 1; // Double precision
1427 let Inst{7-6} = opcod4;
1428 let Inst{4} = opcod5;
1431 // Double precision, binary
1432 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1433 dag iops, InstrItinClass itin, string opc, string asm,
1435 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1436 // Instruction operands.
1441 // Encode instruction operands.
1442 let Inst{3-0} = Dm{3-0};
1443 let Inst{5} = Dm{4};
1444 let Inst{19-16} = Dn{3-0};
1445 let Inst{7} = Dn{4};
1446 let Inst{15-12} = Dd{3-0};
1447 let Inst{22} = Dd{4};
1449 let Inst{27-23} = opcod1;
1450 let Inst{21-20} = opcod2;
1451 let Inst{11-9} = 0b101;
1452 let Inst{8} = 1; // Double precision
1457 // Single precision, unary
1458 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1459 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1460 string asm, list<dag> pattern>
1461 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1462 // Instruction operands.
1466 // Encode instruction operands.
1467 let Inst{3-0} = Sm{4-1};
1468 let Inst{5} = Sm{0};
1469 let Inst{15-12} = Sd{4-1};
1470 let Inst{22} = Sd{0};
1472 let Inst{27-23} = opcod1;
1473 let Inst{21-20} = opcod2;
1474 let Inst{19-16} = opcod3;
1475 let Inst{11-9} = 0b101;
1476 let Inst{8} = 0; // Single precision
1477 let Inst{7-6} = opcod4;
1478 let Inst{4} = opcod5;
1481 // Single precision unary, if no NEON. Same as ASuI except not available if
1483 class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1484 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1485 string asm, list<dag> pattern>
1486 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1488 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1491 // Single precision, binary
1492 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1493 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1494 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1495 // Instruction operands.
1500 // Encode instruction operands.
1501 let Inst{3-0} = Sm{4-1};
1502 let Inst{5} = Sm{0};
1503 let Inst{19-16} = Sn{4-1};
1504 let Inst{7} = Sn{0};
1505 let Inst{15-12} = Sd{4-1};
1506 let Inst{22} = Sd{0};
1508 let Inst{27-23} = opcod1;
1509 let Inst{21-20} = opcod2;
1510 let Inst{11-9} = 0b101;
1511 let Inst{8} = 0; // Single precision
1516 // Single precision binary, if no NEON. Same as ASbI except not available if
1518 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1519 dag iops, InstrItinClass itin, string opc, string asm,
1521 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1522 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1524 // Instruction operands.
1529 // Encode instruction operands.
1530 let Inst{3-0} = Sm{4-1};
1531 let Inst{5} = Sm{0};
1532 let Inst{19-16} = Sn{4-1};
1533 let Inst{7} = Sn{0};
1534 let Inst{15-12} = Sd{4-1};
1535 let Inst{22} = Sd{0};
1538 // VFP conversion instructions
1539 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1540 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1542 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1543 let Inst{27-23} = opcod1;
1544 let Inst{21-20} = opcod2;
1545 let Inst{19-16} = opcod3;
1546 let Inst{11-8} = opcod4;
1551 // VFP conversion between floating-point and fixed-point
1552 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1553 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1555 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1556 // size (fixed-point number): sx == 0 ? 16 : 32
1557 let Inst{7} = op5; // sx
1560 // VFP conversion instructions, if no NEON
1561 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1562 dag oops, dag iops, InstrItinClass itin,
1563 string opc, string asm, list<dag> pattern>
1564 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1566 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1569 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1570 InstrItinClass itin,
1571 string opc, string asm, list<dag> pattern>
1572 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1573 let Inst{27-20} = opcod1;
1574 let Inst{11-8} = opcod2;
1578 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1579 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1580 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1582 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1583 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1584 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1586 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1587 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1588 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1590 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1591 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1592 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1594 //===----------------------------------------------------------------------===//
1596 //===----------------------------------------------------------------------===//
1597 // ARM NEON Instruction templates.
1600 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1601 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1603 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1604 let OutOperandList = oops;
1605 let InOperandList = !con(iops, (ins pred:$p));
1606 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1607 let Pattern = pattern;
1608 list<Predicate> Predicates = [HasNEON];
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];
1623 class NLdSt<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 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1628 let Inst{31-24} = 0b11110100;
1629 let Inst{23} = op23;
1630 let Inst{21-20} = op21_20;
1631 let Inst{11-8} = op11_8;
1632 let Inst{7-4} = op7_4;
1634 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
1640 let Inst{22} = Vd{4};
1641 let Inst{15-12} = Vd{3-0};
1642 let Inst{19-16} = Rn{3-0};
1643 let Inst{3-0} = Rm{3-0};
1646 class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1647 dag oops, dag iops, InstrItinClass itin,
1648 string opc, string dt, string asm, string cstr, list<dag> pattern>
1649 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1650 dt, asm, cstr, pattern> {
1654 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1655 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1657 let OutOperandList = oops;
1658 let InOperandList = !con(iops, (ins pred:$p));
1659 list<Predicate> Predicates = [HasNEON];
1662 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1664 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1666 let OutOperandList = oops;
1667 let InOperandList = !con(iops, (ins pred:$p));
1668 let Pattern = pattern;
1669 list<Predicate> Predicates = [HasNEON];
1672 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1673 string opc, string dt, string asm, string cstr, list<dag> pattern>
1674 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1676 let Inst{31-25} = 0b1111001;
1677 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1680 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1681 string opc, string asm, string cstr, list<dag> pattern>
1682 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1684 let Inst{31-25} = 0b1111001;
1685 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1688 // NEON "one register and a modified immediate" format.
1689 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1691 dag oops, dag iops, InstrItinClass itin,
1692 string opc, string dt, string asm, string cstr,
1694 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1695 let Inst{23} = op23;
1696 let Inst{21-19} = op21_19;
1697 let Inst{11-8} = op11_8;
1703 // Instruction operands.
1707 let Inst{15-12} = Vd{3-0};
1708 let Inst{22} = Vd{4};
1709 let Inst{24} = SIMM{7};
1710 let Inst{18-16} = SIMM{6-4};
1711 let Inst{3-0} = SIMM{3-0};
1714 // NEON 2 vector register format.
1715 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1716 bits<5> op11_7, bit op6, bit op4,
1717 dag oops, dag iops, InstrItinClass itin,
1718 string opc, string dt, string asm, string cstr, list<dag> pattern>
1719 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1720 let Inst{24-23} = op24_23;
1721 let Inst{21-20} = op21_20;
1722 let Inst{19-18} = op19_18;
1723 let Inst{17-16} = op17_16;
1724 let Inst{11-7} = op11_7;
1728 // Instruction operands.
1732 let Inst{15-12} = Vd{3-0};
1733 let Inst{22} = Vd{4};
1734 let Inst{3-0} = Vm{3-0};
1735 let Inst{5} = Vm{4};
1738 // Same as N2V except it doesn't have a datatype suffix.
1739 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1740 bits<5> op11_7, bit op6, bit op4,
1741 dag oops, dag iops, InstrItinClass itin,
1742 string opc, string asm, string cstr, list<dag> pattern>
1743 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1744 let Inst{24-23} = op24_23;
1745 let Inst{21-20} = op21_20;
1746 let Inst{19-18} = op19_18;
1747 let Inst{17-16} = op17_16;
1748 let Inst{11-7} = op11_7;
1752 // Instruction operands.
1756 let Inst{15-12} = Vd{3-0};
1757 let Inst{22} = Vd{4};
1758 let Inst{3-0} = Vm{3-0};
1759 let Inst{5} = Vm{4};
1762 // NEON 2 vector register with immediate.
1763 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1764 dag oops, dag iops, Format f, InstrItinClass itin,
1765 string opc, string dt, string asm, string cstr, list<dag> pattern>
1766 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1767 let Inst{24} = op24;
1768 let Inst{23} = op23;
1769 let Inst{11-8} = op11_8;
1774 // Instruction operands.
1779 let Inst{15-12} = Vd{3-0};
1780 let Inst{22} = Vd{4};
1781 let Inst{3-0} = Vm{3-0};
1782 let Inst{5} = Vm{4};
1783 let Inst{21-16} = SIMM{5-0};
1786 // NEON 3 vector register format.
1788 class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1789 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1790 string opc, string dt, string asm, string cstr,
1792 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1793 let Inst{24} = op24;
1794 let Inst{23} = op23;
1795 let Inst{21-20} = op21_20;
1796 let Inst{11-8} = op11_8;
1801 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1802 dag oops, dag iops, Format f, InstrItinClass itin,
1803 string opc, string dt, string asm, string cstr, list<dag> pattern>
1804 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1805 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1807 // Instruction operands.
1812 let Inst{15-12} = Vd{3-0};
1813 let Inst{22} = Vd{4};
1814 let Inst{19-16} = Vn{3-0};
1815 let Inst{7} = Vn{4};
1816 let Inst{3-0} = Vm{3-0};
1817 let Inst{5} = Vm{4};
1820 class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1821 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1822 string opc, string dt, string asm, string cstr,
1824 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1825 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1827 // Instruction operands.
1833 let Inst{15-12} = Vd{3-0};
1834 let Inst{22} = Vd{4};
1835 let Inst{19-16} = Vn{3-0};
1836 let Inst{7} = Vn{4};
1837 let Inst{3-0} = Vm{3-0};
1841 class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1842 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1843 string opc, string dt, string asm, string cstr,
1845 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1846 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1848 // Instruction operands.
1854 let Inst{15-12} = Vd{3-0};
1855 let Inst{22} = Vd{4};
1856 let Inst{19-16} = Vn{3-0};
1857 let Inst{7} = Vn{4};
1858 let Inst{2-0} = Vm{2-0};
1859 let Inst{5} = lane{1};
1860 let Inst{3} = lane{0};
1863 // Same as N3V except it doesn't have a data type suffix.
1864 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1866 dag oops, dag iops, Format f, InstrItinClass itin,
1867 string opc, string asm, string cstr, list<dag> pattern>
1868 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1869 let Inst{24} = op24;
1870 let Inst{23} = op23;
1871 let Inst{21-20} = op21_20;
1872 let Inst{11-8} = op11_8;
1876 // Instruction operands.
1881 let Inst{15-12} = Vd{3-0};
1882 let Inst{22} = Vd{4};
1883 let Inst{19-16} = Vn{3-0};
1884 let Inst{7} = Vn{4};
1885 let Inst{3-0} = Vm{3-0};
1886 let Inst{5} = Vm{4};
1889 // NEON VMOVs between scalar and core registers.
1890 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1891 dag oops, dag iops, Format f, InstrItinClass itin,
1892 string opc, string dt, string asm, list<dag> pattern>
1893 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
1895 let Inst{27-20} = opcod1;
1896 let Inst{11-8} = opcod2;
1897 let Inst{6-5} = opcod3;
1899 // A8.6.303, A8.6.328, A8.6.329
1900 let Inst{3-0} = 0b0000;
1902 let OutOperandList = oops;
1903 let InOperandList = !con(iops, (ins pred:$p));
1904 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1905 let Pattern = pattern;
1906 list<Predicate> Predicates = [HasNEON];
1908 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
1915 let Inst{31-28} = p{3-0};
1917 let Inst{19-16} = V{3-0};
1918 let Inst{15-12} = R{3-0};
1920 class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1921 dag oops, dag iops, InstrItinClass itin,
1922 string opc, string dt, string asm, list<dag> pattern>
1923 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
1924 opc, dt, asm, pattern>;
1925 class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1926 dag oops, dag iops, InstrItinClass itin,
1927 string opc, string dt, string asm, list<dag> pattern>
1928 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
1929 opc, dt, asm, pattern>;
1930 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1931 dag oops, dag iops, InstrItinClass itin,
1932 string opc, string dt, string asm, list<dag> pattern>
1933 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1934 opc, dt, asm, pattern>;
1936 // Vector Duplicate Lane (from scalar to all elements)
1937 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1938 InstrItinClass itin, string opc, string dt, string asm,
1940 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1941 let Inst{24-23} = 0b11;
1942 let Inst{21-20} = 0b11;
1943 let Inst{19-16} = op19_16;
1944 let Inst{11-7} = 0b11000;
1952 let Inst{22} = Vd{4};
1953 let Inst{15-12} = Vd{3-0};
1954 let Inst{5} = Vm{4};
1955 let Inst{3-0} = Vm{3-0};
1958 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1959 // for single-precision FP.
1960 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1961 list<Predicate> Predicates = [HasNEON,UseNEONForFP];