1 //===- ARMInstrFormats.td - ARM Instruction Formats ----------*- tablegen -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 // ARM Instruction Format Definitions.
15 // Format specifies the encoding used by the instruction. This is part of the
16 // ad-hoc solution used to emit machine instruction encodings by our machine
18 class Format<bits<6> val> {
22 def Pseudo : Format<0>;
23 def MulFrm : Format<1>;
24 def BrFrm : Format<2>;
25 def BrMiscFrm : Format<3>;
27 def DPFrm : Format<4>;
28 def DPSoRegFrm : Format<5>;
30 def LdFrm : Format<6>;
31 def StFrm : Format<7>;
32 def LdMiscFrm : Format<8>;
33 def StMiscFrm : Format<9>;
34 def LdStMulFrm : Format<10>;
36 def LdStExFrm : Format<11>;
38 def ArithMiscFrm : Format<12>;
39 def SatFrm : Format<13>;
40 def ExtFrm : Format<14>;
42 def VFPUnaryFrm : Format<15>;
43 def VFPBinaryFrm : Format<16>;
44 def VFPConv1Frm : Format<17>;
45 def VFPConv2Frm : Format<18>;
46 def VFPConv3Frm : Format<19>;
47 def VFPConv4Frm : Format<20>;
48 def VFPConv5Frm : Format<21>;
49 def VFPLdStFrm : Format<22>;
50 def VFPLdStMulFrm : Format<23>;
51 def VFPMiscFrm : Format<24>;
53 def ThumbFrm : Format<25>;
54 def MiscFrm : Format<26>;
56 def NGetLnFrm : Format<27>;
57 def NSetLnFrm : Format<28>;
58 def NDupFrm : Format<29>;
59 def NLdStFrm : Format<30>;
60 def N1RegModImmFrm: Format<31>;
61 def N2RegFrm : Format<32>;
62 def NVCVTFrm : Format<33>;
63 def NVDupLnFrm : Format<34>;
64 def N2RegVShLFrm : Format<35>;
65 def N2RegVShRFrm : Format<36>;
66 def N3RegFrm : Format<37>;
67 def N3RegVShFrm : Format<38>;
68 def NVExtFrm : Format<39>;
69 def NVMulSLFrm : Format<40>;
70 def NVTBLFrm : Format<41>;
74 // The instruction has an Rn register operand.
75 // UnaryDP - Indicates this is a unary data processing instruction, i.e.
76 // it doesn't have a Rn operand.
77 class UnaryDP { bit isUnaryDataProc = 1; }
79 // Xform16Bit - Indicates this Thumb2 instruction may be transformed into
80 // a 16-bit Thumb instruction if certain conditions are met.
81 class Xform16Bit { bit canXformTo16Bit = 1; }
83 //===----------------------------------------------------------------------===//
84 // ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
87 // FIXME: Once the JIT is MC-ized, these can go away.
89 class AddrMode<bits<5> val> {
92 def AddrModeNone : AddrMode<0>;
93 def AddrMode1 : AddrMode<1>;
94 def AddrMode2 : AddrMode<2>;
95 def AddrMode3 : AddrMode<3>;
96 def AddrMode4 : AddrMode<4>;
97 def AddrMode5 : AddrMode<5>;
98 def AddrMode6 : AddrMode<6>;
99 def AddrModeT1_1 : AddrMode<7>;
100 def AddrModeT1_2 : AddrMode<8>;
101 def AddrModeT1_4 : AddrMode<9>;
102 def AddrModeT1_s : AddrMode<10>;
103 def AddrModeT2_i12 : AddrMode<11>;
104 def AddrModeT2_i8 : AddrMode<12>;
105 def AddrModeT2_so : AddrMode<13>;
106 def AddrModeT2_pc : AddrMode<14>;
107 def AddrModeT2_i8s4 : AddrMode<15>;
108 def AddrMode_i12 : AddrMode<16>;
110 // Load / store index mode.
111 class IndexMode<bits<2> val> {
114 def IndexModeNone : IndexMode<0>;
115 def IndexModePre : IndexMode<1>;
116 def IndexModePost : IndexMode<2>;
117 def IndexModeUpd : IndexMode<3>;
119 // Instruction execution domain.
120 class Domain<bits<3> val> {
123 def GenericDomain : Domain<0>;
124 def VFPDomain : Domain<1>; // Instructions in VFP domain only
125 def NeonDomain : Domain<2>; // Instructions in Neon domain only
126 def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
127 def VFPNeonA8Domain : Domain<5>; // Instructions in VFP & Neon under A8
129 //===----------------------------------------------------------------------===//
130 // ARM special operands.
133 def CondCodeOperand : AsmOperandClass {
134 let Name = "CondCode";
135 let SuperClasses = [];
138 def CCOutOperand : AsmOperandClass {
140 let SuperClasses = [];
143 def MemBarrierOptOperand : AsmOperandClass {
144 let Name = "MemBarrierOpt";
145 let SuperClasses = [];
146 let ParserMethod = "tryParseMemBarrierOptOperand";
149 def ProcIFlagsOperand : AsmOperandClass {
150 let Name = "ProcIFlags";
151 let SuperClasses = [];
152 let ParserMethod = "tryParseProcIFlagsOperand";
155 def MSRMaskOperand : AsmOperandClass {
156 let Name = "MSRMask";
157 let SuperClasses = [];
158 let ParserMethod = "tryParseMSRMaskOperand";
161 // ARM imod and iflag operands, used only by the CPS instruction.
162 def imod_op : Operand<i32> {
163 let PrintMethod = "printCPSIMod";
166 def iflags_op : Operand<i32> {
167 let PrintMethod = "printCPSIFlag";
168 let ParserMatchClass = ProcIFlagsOperand;
171 // ARM Predicate operand. Default to 14 = always (AL). Second part is CC
172 // register whose default is 0 (no register).
173 def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
174 (ops (i32 14), (i32 zero_reg))> {
175 let PrintMethod = "printPredicateOperand";
176 let ParserMatchClass = CondCodeOperand;
179 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
180 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
181 let EncoderMethod = "getCCOutOpValue";
182 let PrintMethod = "printSBitModifierOperand";
183 let ParserMatchClass = CCOutOperand;
186 // Same as cc_out except it defaults to setting CPSR.
187 def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
188 let EncoderMethod = "getCCOutOpValue";
189 let PrintMethod = "printSBitModifierOperand";
190 let ParserMatchClass = CCOutOperand;
193 // ARM special operands for disassembly only.
195 def setend_op : Operand<i32> {
196 let PrintMethod = "printSetendOperand";
199 def msr_mask : Operand<i32> {
200 let PrintMethod = "printMSRMaskOperand";
201 let ParserMatchClass = MSRMaskOperand;
204 // Shift Right Immediate - A shift right immediate is encoded differently from
205 // other shift immediates. The imm6 field is encoded like so:
208 // 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
209 // 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
210 // 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
211 // 64 64 - <imm> is encoded in imm6<5:0>
212 def shr_imm8 : Operand<i32> {
213 let EncoderMethod = "getShiftRight8Imm";
215 def shr_imm16 : Operand<i32> {
216 let EncoderMethod = "getShiftRight16Imm";
218 def shr_imm32 : Operand<i32> {
219 let EncoderMethod = "getShiftRight32Imm";
221 def shr_imm64 : Operand<i32> {
222 let EncoderMethod = "getShiftRight64Imm";
225 //===----------------------------------------------------------------------===//
226 // ARM Instruction templates.
229 class InstTemplate<AddrMode am, int sz, IndexMode im,
230 Format f, Domain d, string cstr, InstrItinClass itin>
232 let Namespace = "ARM";
237 bits<2> IndexModeBits = IM.Value;
239 bits<6> Form = F.Value;
241 bit isUnaryDataProc = 0;
242 bit canXformTo16Bit = 0;
244 // If this is a pseudo instruction, mark it isCodeGenOnly.
245 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
247 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
248 let TSFlags{4-0} = AM.Value;
249 let TSFlags{6-5} = IndexModeBits;
250 let TSFlags{12-7} = Form;
251 let TSFlags{13} = isUnaryDataProc;
252 let TSFlags{14} = canXformTo16Bit;
253 let TSFlags{17-15} = D.Value;
255 let Constraints = cstr;
256 let Itinerary = itin;
263 class InstARM<AddrMode am, int sz, IndexMode im,
264 Format f, Domain d, string cstr, InstrItinClass itin>
265 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
266 let DecoderNamespace = "ARM";
269 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
270 // on by adding flavors to specific instructions.
271 class InstThumb<AddrMode am, int sz, IndexMode im,
272 Format f, Domain d, string cstr, InstrItinClass itin>
273 : InstTemplate<am, sz, im, f, d, cstr, itin> {
274 let DecoderNamespace = "Thumb";
277 class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
278 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
279 GenericDomain, "", itin> {
280 let OutOperandList = oops;
281 let InOperandList = iops;
282 let Pattern = pattern;
283 let isCodeGenOnly = 1;
287 // PseudoInst that's ARM-mode only.
288 class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
290 : PseudoInst<oops, iops, itin, pattern> {
292 list<Predicate> Predicates = [IsARM];
295 // PseudoInst that's Thumb-mode only.
296 class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
298 : PseudoInst<oops, iops, itin, pattern> {
300 list<Predicate> Predicates = [IsThumb];
303 // PseudoInst that's Thumb2-mode only.
304 class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
306 : PseudoInst<oops, iops, itin, pattern> {
308 list<Predicate> Predicates = [IsThumb2];
311 class ARMPseudoExpand<dag oops, dag iops, int sz,
312 InstrItinClass itin, list<dag> pattern,
314 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
315 PseudoInstExpansion<Result>;
317 class tPseudoExpand<dag oops, dag iops, int sz,
318 InstrItinClass itin, list<dag> pattern,
320 : tPseudoInst<oops, iops, sz, itin, pattern>,
321 PseudoInstExpansion<Result>;
323 class t2PseudoExpand<dag oops, dag iops, int sz,
324 InstrItinClass itin, list<dag> pattern,
326 : t2PseudoInst<oops, iops, sz, itin, pattern>,
327 PseudoInstExpansion<Result>;
329 // Almost all ARM instructions are predicable.
330 class I<dag oops, dag iops, AddrMode am, int sz,
331 IndexMode im, Format f, InstrItinClass itin,
332 string opc, string asm, string cstr,
334 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
337 let OutOperandList = oops;
338 let InOperandList = !con(iops, (ins pred:$p));
339 let AsmString = !strconcat(opc, "${p}", asm);
340 let Pattern = pattern;
341 list<Predicate> Predicates = [IsARM];
344 // A few are not predicable
345 class InoP<dag oops, dag iops, AddrMode am, int sz,
346 IndexMode im, Format f, InstrItinClass itin,
347 string opc, string asm, string cstr,
349 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
350 let OutOperandList = oops;
351 let InOperandList = iops;
352 let AsmString = !strconcat(opc, asm);
353 let Pattern = pattern;
354 let isPredicable = 0;
355 list<Predicate> Predicates = [IsARM];
358 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
359 // operand since by default it's a zero register. It will become an implicit def
360 // once it's "flipped".
361 class sI<dag oops, dag iops, AddrMode am, int sz,
362 IndexMode im, Format f, InstrItinClass itin,
363 string opc, string asm, string cstr,
365 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
366 bits<4> p; // Predicate operand
367 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
371 let OutOperandList = oops;
372 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
373 let AsmString = !strconcat(opc, "${s}${p}", asm);
374 let Pattern = pattern;
375 list<Predicate> Predicates = [IsARM];
379 class XI<dag oops, dag iops, AddrMode am, int sz,
380 IndexMode im, Format f, InstrItinClass itin,
381 string asm, string cstr, list<dag> pattern>
382 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
383 let OutOperandList = oops;
384 let InOperandList = iops;
386 let Pattern = pattern;
387 list<Predicate> Predicates = [IsARM];
390 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
391 string opc, string asm, list<dag> pattern>
392 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
393 opc, asm, "", pattern>;
394 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
395 string opc, string asm, list<dag> pattern>
396 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
397 opc, asm, "", pattern>;
398 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
399 string asm, list<dag> pattern>
400 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
402 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
403 string opc, string asm, list<dag> pattern>
404 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
405 opc, asm, "", pattern>;
407 // Ctrl flow instructions
408 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
409 string opc, string asm, list<dag> pattern>
410 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
411 opc, asm, "", pattern> {
412 let Inst{27-24} = opcod;
414 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
415 string asm, list<dag> pattern>
416 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
418 let Inst{27-24} = opcod;
421 // BR_JT instructions
422 class JTI<dag oops, dag iops, InstrItinClass itin,
423 string asm, list<dag> pattern>
424 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
427 // Atomic load/store instructions
428 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
429 string opc, string asm, list<dag> pattern>
430 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
431 opc, asm, "", pattern> {
434 let Inst{27-23} = 0b00011;
435 let Inst{22-21} = opcod;
437 let Inst{19-16} = Rn;
438 let Inst{15-12} = Rt;
439 let Inst{11-0} = 0b111110011111;
441 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
442 string opc, string asm, list<dag> pattern>
443 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
444 opc, asm, "", pattern> {
448 let Inst{27-23} = 0b00011;
449 let Inst{22-21} = opcod;
451 let Inst{19-16} = addr;
452 let Inst{15-12} = Rd;
453 let Inst{11-4} = 0b11111001;
456 class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
457 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, [$Rn]", pattern> {
461 let Inst{27-23} = 0b00010;
463 let Inst{21-20} = 0b00;
464 let Inst{19-16} = Rn;
465 let Inst{15-12} = Rt;
466 let Inst{11-4} = 0b00001001;
470 // addrmode1 instructions
471 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
472 string opc, string asm, list<dag> pattern>
473 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
474 opc, asm, "", pattern> {
475 let Inst{24-21} = opcod;
476 let Inst{27-26} = 0b00;
478 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
479 string opc, string asm, list<dag> pattern>
480 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
481 opc, asm, "", pattern> {
482 let Inst{24-21} = opcod;
483 let Inst{27-26} = 0b00;
485 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
486 string asm, list<dag> pattern>
487 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
489 let Inst{24-21} = opcod;
490 let Inst{27-26} = 0b00;
495 // LDR/LDRB/STR/STRB/...
496 class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
497 Format f, InstrItinClass itin, string opc, string asm,
499 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
501 let Inst{27-25} = op;
502 let Inst{24} = 1; // 24 == P
504 let Inst{22} = isByte;
505 let Inst{21} = 0; // 21 == W
508 // Indexed load/stores
509 class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
510 IndexMode im, Format f, InstrItinClass itin, string opc,
511 string asm, string cstr, list<dag> pattern>
512 : I<oops, iops, AddrMode2, 4, im, f, itin,
513 opc, asm, cstr, pattern> {
515 let Inst{27-26} = 0b01;
516 let Inst{24} = isPre; // P bit
517 let Inst{22} = isByte; // B bit
518 let Inst{21} = isPre; // W bit
519 let Inst{20} = isLd; // L bit
520 let Inst{15-12} = Rt;
522 class AI2stridx<bit isByte, bit isPre, dag oops, dag iops,
523 IndexMode im, Format f, InstrItinClass itin, string opc,
524 string asm, string cstr, list<dag> pattern>
525 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
527 // AM2 store w/ two operands: (GPR, am2offset)
528 // {13} 1 == Rm, 0 == imm12
533 let Inst{25} = offset{13};
534 let Inst{23} = offset{12};
535 let Inst{19-16} = Rn;
536 let Inst{11-0} = offset{11-0};
538 // FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
539 // but for now use this class for STRT and STRBT.
540 class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
541 IndexMode im, Format f, InstrItinClass itin, string opc,
542 string asm, string cstr, list<dag> pattern>
543 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
545 // AM2 store w/ two operands: (GPR, am2offset)
547 // {13} 1 == Rm, 0 == imm12
551 let Inst{25} = addr{13};
552 let Inst{23} = addr{12};
553 let Inst{19-16} = addr{17-14};
554 let Inst{11-0} = addr{11-0};
557 // addrmode3 instructions
558 class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
559 InstrItinClass itin, string opc, string asm, list<dag> pattern>
560 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
561 opc, asm, "", pattern> {
564 let Inst{27-25} = 0b000;
565 let Inst{24} = 1; // P bit
566 let Inst{23} = addr{8}; // U bit
567 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
568 let Inst{21} = 0; // W bit
569 let Inst{20} = op20; // L bit
570 let Inst{19-16} = addr{12-9}; // Rn
571 let Inst{15-12} = Rt; // Rt
572 let Inst{11-8} = addr{7-4}; // imm7_4/zero
574 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
577 class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
578 IndexMode im, Format f, InstrItinClass itin, string opc,
579 string asm, string cstr, list<dag> pattern>
580 : I<oops, iops, AddrMode3, 4, im, f, itin,
581 opc, asm, cstr, pattern> {
583 let Inst{27-25} = 0b000;
584 let Inst{24} = isPre; // P bit
585 let Inst{21} = isPre; // W bit
586 let Inst{20} = op20; // L bit
587 let Inst{15-12} = Rt; // Rt
591 // FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
592 // but for now use this class for LDRSBT, LDRHT, LDSHT.
593 class AI3ldstidxT<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
594 IndexMode im, Format f, InstrItinClass itin, string opc,
595 string asm, string cstr, list<dag> pattern>
596 : I<oops, iops, AddrMode3, 4, im, f, itin,
597 opc, asm, cstr, pattern> {
598 // {13} 1 == imm8, 0 == Rm
605 let Inst{27-25} = 0b000;
606 let Inst{24} = isPre; // P bit
607 let Inst{23} = addr{8}; // U bit
608 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
609 let Inst{20} = op20; // L bit
610 let Inst{19-16} = addr{12-9}; // Rn
611 let Inst{15-12} = Rt; // Rt
612 let Inst{11-8} = addr{7-4}; // imm7_4/zero
614 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
615 let AsmMatchConverter = "CvtLdWriteBackRegAddrMode3";
618 class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
619 IndexMode im, Format f, InstrItinClass itin, string opc,
620 string asm, string cstr, list<dag> pattern>
621 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
623 // AM3 store w/ two operands: (GPR, am3offset)
627 let Inst{27-25} = 0b000;
628 let Inst{23} = offset{8};
629 let Inst{22} = offset{9};
630 let Inst{19-16} = Rn;
631 let Inst{15-12} = Rt; // Rt
632 let Inst{11-8} = offset{7-4}; // imm7_4/zero
634 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
638 class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
639 string opc, string asm, list<dag> pattern>
640 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
641 opc, asm, "", pattern> {
644 let Inst{27-25} = 0b000;
645 let Inst{24} = 1; // P bit
646 let Inst{23} = addr{8}; // U bit
647 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
648 let Inst{21} = 0; // W bit
649 let Inst{20} = 0; // L bit
650 let Inst{19-16} = addr{12-9}; // Rn
651 let Inst{15-12} = Rt; // Rt
652 let Inst{11-8} = addr{7-4}; // imm7_4/zero
654 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
657 // Pre-indexed stores
658 class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
659 string opc, string asm, string cstr, list<dag> pattern>
660 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
661 opc, asm, cstr, pattern> {
663 let Inst{5} = 1; // H bit
664 let Inst{6} = 0; // S bit
666 let Inst{20} = 0; // L bit
667 let Inst{21} = 1; // W bit
668 let Inst{24} = 1; // P bit
669 let Inst{27-25} = 0b000;
671 class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
672 string opc, string asm, string cstr, list<dag> pattern>
673 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
674 opc, asm, cstr, pattern> {
676 let Inst{5} = 1; // H bit
677 let Inst{6} = 1; // S bit
679 let Inst{20} = 0; // L bit
680 let Inst{21} = 1; // W bit
681 let Inst{24} = 1; // P bit
682 let Inst{27-25} = 0b000;
685 // Post-indexed stores
686 class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
687 string opc, string asm, string cstr, list<dag> pattern>
688 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
689 opc, asm, cstr,pattern> {
690 // {13} 1 == imm8, 0 == Rm
697 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
699 let Inst{5} = 1; // H bit
700 let Inst{6} = 0; // S bit
702 let Inst{11-8} = addr{7-4}; // imm7_4/zero
703 let Inst{15-12} = Rt; // Rt
704 let Inst{19-16} = addr{12-9}; // Rn
705 let Inst{20} = 0; // L bit
706 let Inst{21} = 0; // W bit
707 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
708 let Inst{23} = addr{8}; // U bit
709 let Inst{24} = 0; // P bit
710 let Inst{27-25} = 0b000;
712 class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
713 string opc, string asm, string cstr, list<dag> pattern>
714 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
715 opc, asm, cstr, pattern> {
717 let Inst{5} = 1; // H bit
718 let Inst{6} = 1; // S bit
720 let Inst{20} = 0; // L bit
721 let Inst{21} = 0; // W bit
722 let Inst{24} = 0; // P bit
723 let Inst{27-25} = 0b000;
726 // addrmode4 instructions
727 class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
728 string asm, string cstr, list<dag> pattern>
729 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
734 let Inst{27-25} = 0b100;
735 let Inst{22} = 0; // S bit
736 let Inst{19-16} = Rn;
737 let Inst{15-0} = regs;
740 // Unsigned multiply, multiply-accumulate instructions.
741 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
742 string opc, string asm, list<dag> pattern>
743 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
744 opc, asm, "", pattern> {
745 let Inst{7-4} = 0b1001;
746 let Inst{20} = 0; // S bit
747 let Inst{27-21} = opcod;
749 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
750 string opc, string asm, list<dag> pattern>
751 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
752 opc, asm, "", pattern> {
753 let Inst{7-4} = 0b1001;
754 let Inst{27-21} = opcod;
757 // Most significant word multiply
758 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
759 InstrItinClass itin, string opc, string asm, list<dag> pattern>
760 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
761 opc, asm, "", pattern> {
765 let Inst{7-4} = opc7_4;
767 let Inst{27-21} = opcod;
768 let Inst{19-16} = Rd;
772 // MSW multiple w/ Ra operand
773 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
774 InstrItinClass itin, string opc, string asm, list<dag> pattern>
775 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
777 let Inst{15-12} = Ra;
780 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
781 class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
782 InstrItinClass itin, string opc, string asm, list<dag> pattern>
783 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
784 opc, asm, "", pattern> {
790 let Inst{27-21} = opcod;
791 let Inst{6-5} = bit6_5;
795 class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
796 InstrItinClass itin, string opc, string asm, list<dag> pattern>
797 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
799 let Inst{19-16} = Rd;
802 // AMulxyI with Ra operand
803 class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
804 InstrItinClass itin, string opc, string asm, list<dag> pattern>
805 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
807 let Inst{15-12} = Ra;
810 class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
811 InstrItinClass itin, string opc, string asm, list<dag> pattern>
812 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
815 let Inst{19-16} = RdHi;
816 let Inst{15-12} = RdLo;
819 // Extend instructions.
820 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
821 string opc, string asm, list<dag> pattern>
822 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
823 opc, asm, "", pattern> {
824 // All AExtI instructions have Rd and Rm register operands.
827 let Inst{15-12} = Rd;
829 let Inst{7-4} = 0b0111;
830 let Inst{9-8} = 0b00;
831 let Inst{27-20} = opcod;
834 // Misc Arithmetic instructions.
835 class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
836 InstrItinClass itin, string opc, string asm, list<dag> pattern>
837 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
838 opc, asm, "", pattern> {
841 let Inst{27-20} = opcod;
842 let Inst{19-16} = 0b1111;
843 let Inst{15-12} = Rd;
844 let Inst{11-8} = 0b1111;
845 let Inst{7-4} = opc7_4;
850 def PKHLSLAsmOperand : AsmOperandClass {
851 let Name = "PKHLSLImm";
852 let ParserMethod = "parsePKHLSLImm";
854 def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
855 let PrintMethod = "printPKHLSLShiftImm";
856 let ParserMatchClass = PKHLSLAsmOperand;
858 def PKHASRAsmOperand : AsmOperandClass {
859 let Name = "PKHASRImm";
860 let ParserMethod = "parsePKHASRImm";
862 def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
863 let PrintMethod = "printPKHASRShiftImm";
864 let ParserMatchClass = PKHASRAsmOperand;
867 class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
868 string opc, string asm, list<dag> pattern>
869 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
870 opc, asm, "", pattern> {
875 let Inst{27-20} = opcod;
876 let Inst{19-16} = Rn;
877 let Inst{15-12} = Rd;
880 let Inst{5-4} = 0b01;
884 //===----------------------------------------------------------------------===//
886 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
887 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
888 list<Predicate> Predicates = [IsARM];
890 class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
891 list<Predicate> Predicates = [IsARM, HasV5T];
893 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
894 list<Predicate> Predicates = [IsARM, HasV5TE];
896 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
897 list<Predicate> Predicates = [IsARM, HasV6];
900 //===----------------------------------------------------------------------===//
901 // Thumb Instruction Format Definitions.
904 class ThumbI<dag oops, dag iops, AddrMode am, int sz,
905 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
906 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
907 let OutOperandList = oops;
908 let InOperandList = iops;
910 let Pattern = pattern;
911 list<Predicate> Predicates = [IsThumb];
914 // TI - Thumb instruction.
915 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
916 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
918 // Two-address instructions
919 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
921 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
924 // tBL, tBX 32-bit instructions
925 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
926 dag oops, dag iops, InstrItinClass itin, string asm,
928 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
930 let Inst{31-27} = opcod1;
931 let Inst{15-14} = opcod2;
932 let Inst{12} = opcod3;
935 // BR_JT instructions
936 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
938 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
941 class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
942 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
943 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
944 let OutOperandList = oops;
945 let InOperandList = iops;
947 let Pattern = pattern;
948 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
951 class T1I<dag oops, dag iops, InstrItinClass itin,
952 string asm, list<dag> pattern>
953 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
954 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
955 string asm, list<dag> pattern>
956 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
958 // Two-address instructions
959 class T1It<dag oops, dag iops, InstrItinClass itin,
960 string asm, string cstr, list<dag> pattern>
961 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
964 // Thumb1 instruction that can either be predicated or set CPSR.
965 class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
967 string opc, string asm, string cstr, list<dag> pattern>
968 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
969 let OutOperandList = !con(oops, (outs s_cc_out:$s));
970 let InOperandList = !con(iops, (ins pred:$p));
971 let AsmString = !strconcat(opc, "${s}${p}", asm);
972 let Pattern = pattern;
973 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
976 class T1sI<dag oops, dag iops, InstrItinClass itin,
977 string opc, string asm, list<dag> pattern>
978 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
980 // Two-address instructions
981 class T1sIt<dag oops, dag iops, InstrItinClass itin,
982 string opc, string asm, list<dag> pattern>
983 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
984 "$Rn = $Rdn", pattern>;
986 // Thumb1 instruction that can be predicated.
987 class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
989 string opc, string asm, string cstr, list<dag> pattern>
990 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
991 let OutOperandList = oops;
992 let InOperandList = !con(iops, (ins pred:$p));
993 let AsmString = !strconcat(opc, "${p}", asm);
994 let Pattern = pattern;
995 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
998 class T1pI<dag oops, dag iops, InstrItinClass itin,
999 string opc, string asm, list<dag> pattern>
1000 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
1002 // Two-address instructions
1003 class T1pIt<dag oops, dag iops, InstrItinClass itin,
1004 string opc, string asm, list<dag> pattern>
1005 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
1006 "$Rn = $Rdn", pattern>;
1008 class T1pIs<dag oops, dag iops,
1009 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1010 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
1012 class Encoding16 : Encoding {
1013 let Inst{31-16} = 0x0000;
1016 // A6.2 16-bit Thumb instruction encoding
1017 class T1Encoding<bits<6> opcode> : Encoding16 {
1018 let Inst{15-10} = opcode;
1021 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
1022 class T1General<bits<5> opcode> : Encoding16 {
1023 let Inst{15-14} = 0b00;
1024 let Inst{13-9} = opcode;
1027 // A6.2.2 Data-processing encoding.
1028 class T1DataProcessing<bits<4> opcode> : Encoding16 {
1029 let Inst{15-10} = 0b010000;
1030 let Inst{9-6} = opcode;
1033 // A6.2.3 Special data instructions and branch and exchange encoding.
1034 class T1Special<bits<4> opcode> : Encoding16 {
1035 let Inst{15-10} = 0b010001;
1036 let Inst{9-6} = opcode;
1039 // A6.2.4 Load/store single data item encoding.
1040 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
1041 let Inst{15-12} = opA;
1042 let Inst{11-9} = opB;
1044 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1046 class T1BranchCond<bits<4> opcode> : Encoding16 {
1047 let Inst{15-12} = opcode;
1050 // Helper classes to encode Thumb1 loads and stores. For immediates, the
1051 // following bits are used for "opA" (see A6.2.4):
1053 // 0b0110 => Immediate, 4 bytes
1054 // 0b1000 => Immediate, 2 bytes
1055 // 0b0111 => Immediate, 1 byte
1056 class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1057 InstrItinClass itin, string opc, string asm,
1059 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1060 T1LoadStore<0b0101, opcode> {
1063 let Inst{8-6} = addr{5-3}; // Rm
1064 let Inst{5-3} = addr{2-0}; // Rn
1067 class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1068 InstrItinClass itin, string opc, string asm,
1070 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1071 T1LoadStore<opA, {opB,?,?}> {
1074 let Inst{10-6} = addr{7-3}; // imm5
1075 let Inst{5-3} = addr{2-0}; // Rn
1079 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1080 class T1Misc<bits<7> opcode> : Encoding16 {
1081 let Inst{15-12} = 0b1011;
1082 let Inst{11-5} = opcode;
1085 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1086 class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
1087 InstrItinClass itin,
1088 string opc, string asm, string cstr, list<dag> pattern>
1089 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1090 let OutOperandList = oops;
1091 let InOperandList = !con(iops, (ins pred:$p));
1092 let AsmString = !strconcat(opc, "${p}", asm);
1093 let Pattern = pattern;
1094 list<Predicate> Predicates = [IsThumb2];
1095 let DecoderNamespace = "Thumb2";
1098 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1099 // input operand since by default it's a zero register. It will become an
1100 // implicit def once it's "flipped".
1102 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1104 class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
1105 InstrItinClass itin,
1106 string opc, string asm, string cstr, list<dag> pattern>
1107 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1108 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1111 let OutOperandList = oops;
1112 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1113 let AsmString = !strconcat(opc, "${s}${p}", asm);
1114 let Pattern = pattern;
1115 list<Predicate> Predicates = [IsThumb2];
1116 let DecoderNamespace = "Thumb2";
1120 class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
1121 InstrItinClass itin,
1122 string asm, string cstr, list<dag> pattern>
1123 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1124 let OutOperandList = oops;
1125 let InOperandList = iops;
1126 let AsmString = asm;
1127 let Pattern = pattern;
1128 list<Predicate> Predicates = [IsThumb2];
1129 let DecoderNamespace = "Thumb2";
1132 class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
1133 InstrItinClass itin,
1134 string asm, string cstr, list<dag> pattern>
1135 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1136 let OutOperandList = oops;
1137 let InOperandList = iops;
1138 let AsmString = asm;
1139 let Pattern = pattern;
1140 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1141 let DecoderNamespace = "Thumb";
1144 class T2I<dag oops, dag iops, InstrItinClass itin,
1145 string opc, string asm, list<dag> pattern>
1146 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1147 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1148 string opc, string asm, list<dag> pattern>
1149 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
1150 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1151 string opc, string asm, list<dag> pattern>
1152 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
1153 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1154 string opc, string asm, list<dag> pattern>
1155 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
1156 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1157 string opc, string asm, list<dag> pattern>
1158 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
1159 class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1160 string opc, string asm, list<dag> pattern>
1161 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
1166 let Inst{31-25} = 0b1110100;
1168 let Inst{23} = addr{8};
1171 let Inst{20} = isLoad;
1172 let Inst{19-16} = addr{12-9};
1173 let Inst{15-12} = Rt{3-0};
1174 let Inst{11-8} = Rt2{3-0};
1175 let Inst{7-0} = addr{7-0};
1178 class T2sI<dag oops, dag iops, InstrItinClass itin,
1179 string opc, string asm, list<dag> pattern>
1180 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1182 class T2XI<dag oops, dag iops, InstrItinClass itin,
1183 string asm, list<dag> pattern>
1184 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
1185 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1186 string asm, list<dag> pattern>
1187 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
1189 // Move to/from coprocessor instructions
1190 class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
1191 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
1192 let Inst{31-28} = opc;
1195 // Two-address instructions
1196 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1197 string asm, string cstr, list<dag> pattern>
1198 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
1200 // T2Iidxldst - Thumb2 indexed load / store instructions.
1201 class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1203 AddrMode am, IndexMode im, InstrItinClass itin,
1204 string opc, string asm, string cstr, list<dag> pattern>
1205 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1206 let OutOperandList = oops;
1207 let InOperandList = !con(iops, (ins pred:$p));
1208 let AsmString = !strconcat(opc, "${p}", asm);
1209 let Pattern = pattern;
1210 list<Predicate> Predicates = [IsThumb2];
1211 let DecoderNamespace = "Thumb2";
1212 let Inst{31-27} = 0b11111;
1213 let Inst{26-25} = 0b00;
1214 let Inst{24} = signed;
1216 let Inst{22-21} = opcod;
1217 let Inst{20} = load;
1219 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1220 let Inst{10} = pre; // The P bit.
1221 let Inst{8} = 1; // The W bit.
1224 let Inst{7-0} = addr{7-0};
1225 let Inst{9} = addr{8}; // Sign bit
1229 let Inst{15-12} = Rt{3-0};
1230 let Inst{19-16} = Rn{3-0};
1233 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1234 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1235 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
1238 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1239 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1240 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1243 // T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1244 class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1245 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1248 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1249 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1250 list<Predicate> Predicates = [IsThumb2];
1253 //===----------------------------------------------------------------------===//
1255 //===----------------------------------------------------------------------===//
1256 // ARM VFP Instruction templates.
1259 // Almost all VFP instructions are predicable.
1260 class VFPI<dag oops, dag iops, AddrMode am, int sz,
1261 IndexMode im, Format f, InstrItinClass itin,
1262 string opc, string asm, string cstr, list<dag> pattern>
1263 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1265 let Inst{31-28} = p;
1266 let OutOperandList = oops;
1267 let InOperandList = !con(iops, (ins pred:$p));
1268 let AsmString = !strconcat(opc, "${p}", asm);
1269 let Pattern = pattern;
1270 let PostEncoderMethod = "VFPThumb2PostEncoder";
1271 list<Predicate> Predicates = [HasVFP2];
1275 class VFPXI<dag oops, dag iops, AddrMode am, int sz,
1276 IndexMode im, Format f, InstrItinClass itin,
1277 string asm, string cstr, list<dag> pattern>
1278 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1280 let Inst{31-28} = p;
1281 let OutOperandList = oops;
1282 let InOperandList = iops;
1283 let AsmString = asm;
1284 let Pattern = pattern;
1285 let PostEncoderMethod = "VFPThumb2PostEncoder";
1286 list<Predicate> Predicates = [HasVFP2];
1289 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1290 string opc, string asm, list<dag> pattern>
1291 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
1292 opc, asm, "", pattern> {
1293 let PostEncoderMethod = "VFPThumb2PostEncoder";
1296 // ARM VFP addrmode5 loads and stores
1297 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1298 InstrItinClass itin,
1299 string opc, string asm, list<dag> pattern>
1300 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1301 VFPLdStFrm, itin, opc, asm, "", pattern> {
1302 // Instruction operands.
1306 // Encode instruction operands.
1307 let Inst{23} = addr{8}; // U (add = (U == '1'))
1308 let Inst{22} = Dd{4};
1309 let Inst{19-16} = addr{12-9}; // Rn
1310 let Inst{15-12} = Dd{3-0};
1311 let Inst{7-0} = addr{7-0}; // imm8
1313 // TODO: Mark the instructions with the appropriate subtarget info.
1314 let Inst{27-24} = opcod1;
1315 let Inst{21-20} = opcod2;
1316 let Inst{11-9} = 0b101;
1317 let Inst{8} = 1; // Double precision
1319 // Loads & stores operate on both NEON and VFP pipelines.
1320 let D = VFPNeonDomain;
1323 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1324 InstrItinClass itin,
1325 string opc, string asm, list<dag> pattern>
1326 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1327 VFPLdStFrm, itin, opc, asm, "", pattern> {
1328 // Instruction operands.
1332 // Encode instruction operands.
1333 let Inst{23} = addr{8}; // U (add = (U == '1'))
1334 let Inst{22} = Sd{0};
1335 let Inst{19-16} = addr{12-9}; // Rn
1336 let Inst{15-12} = Sd{4-1};
1337 let Inst{7-0} = addr{7-0}; // imm8
1339 // TODO: Mark the instructions with the appropriate subtarget info.
1340 let Inst{27-24} = opcod1;
1341 let Inst{21-20} = opcod2;
1342 let Inst{11-9} = 0b101;
1343 let Inst{8} = 0; // Single precision
1345 // Loads & stores operate on both NEON and VFP pipelines.
1346 let D = VFPNeonDomain;
1349 // VFP Load / store multiple pseudo instructions.
1350 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1352 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
1354 let OutOperandList = oops;
1355 let InOperandList = !con(iops, (ins pred:$p));
1356 let Pattern = pattern;
1357 list<Predicate> Predicates = [HasVFP2];
1360 // Load / store multiple
1361 class AXDI4<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{12};
1372 let Inst{15-12} = regs{11-8};
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} = 1; // Double precision
1381 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1382 string asm, string cstr, list<dag> pattern>
1383 : VFPXI<oops, iops, AddrMode4, 4, im,
1384 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1385 // Instruction operands.
1389 // Encode instruction operands.
1390 let Inst{19-16} = Rn;
1391 let Inst{22} = regs{8};
1392 let Inst{15-12} = regs{12-9};
1393 let Inst{7-0} = regs{7-0};
1395 // TODO: Mark the instructions with the appropriate subtarget info.
1396 let Inst{27-25} = 0b110;
1397 let Inst{11-9} = 0b101;
1398 let Inst{8} = 0; // Single precision
1401 // Double precision, unary
1402 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1403 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1404 string asm, list<dag> pattern>
1405 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1406 // Instruction operands.
1410 // Encode instruction operands.
1411 let Inst{3-0} = Dm{3-0};
1412 let Inst{5} = Dm{4};
1413 let Inst{15-12} = Dd{3-0};
1414 let Inst{22} = Dd{4};
1416 let Inst{27-23} = opcod1;
1417 let Inst{21-20} = opcod2;
1418 let Inst{19-16} = opcod3;
1419 let Inst{11-9} = 0b101;
1420 let Inst{8} = 1; // Double precision
1421 let Inst{7-6} = opcod4;
1422 let Inst{4} = opcod5;
1425 // Double precision, binary
1426 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1427 dag iops, InstrItinClass itin, string opc, string asm,
1429 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1430 // Instruction operands.
1435 // Encode instruction operands.
1436 let Inst{3-0} = Dm{3-0};
1437 let Inst{5} = Dm{4};
1438 let Inst{19-16} = Dn{3-0};
1439 let Inst{7} = Dn{4};
1440 let Inst{15-12} = Dd{3-0};
1441 let Inst{22} = Dd{4};
1443 let Inst{27-23} = opcod1;
1444 let Inst{21-20} = opcod2;
1445 let Inst{11-9} = 0b101;
1446 let Inst{8} = 1; // Double precision
1451 // Single precision, unary
1452 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1453 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1454 string asm, list<dag> pattern>
1455 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1456 // Instruction operands.
1460 // Encode instruction operands.
1461 let Inst{3-0} = Sm{4-1};
1462 let Inst{5} = Sm{0};
1463 let Inst{15-12} = Sd{4-1};
1464 let Inst{22} = Sd{0};
1466 let Inst{27-23} = opcod1;
1467 let Inst{21-20} = opcod2;
1468 let Inst{19-16} = opcod3;
1469 let Inst{11-9} = 0b101;
1470 let Inst{8} = 0; // Single precision
1471 let Inst{7-6} = opcod4;
1472 let Inst{4} = opcod5;
1475 // Single precision unary, if no NEON. Same as ASuI except not available if
1477 class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1478 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1479 string asm, list<dag> pattern>
1480 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1482 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1485 // Single precision, binary
1486 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1487 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1488 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1489 // Instruction operands.
1494 // Encode instruction operands.
1495 let Inst{3-0} = Sm{4-1};
1496 let Inst{5} = Sm{0};
1497 let Inst{19-16} = Sn{4-1};
1498 let Inst{7} = Sn{0};
1499 let Inst{15-12} = Sd{4-1};
1500 let Inst{22} = Sd{0};
1502 let Inst{27-23} = opcod1;
1503 let Inst{21-20} = opcod2;
1504 let Inst{11-9} = 0b101;
1505 let Inst{8} = 0; // Single precision
1510 // Single precision binary, if no NEON. Same as ASbI except not available if
1512 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1513 dag iops, InstrItinClass itin, string opc, string asm,
1515 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1516 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1518 // Instruction operands.
1523 // Encode instruction operands.
1524 let Inst{3-0} = Sm{4-1};
1525 let Inst{5} = Sm{0};
1526 let Inst{19-16} = Sn{4-1};
1527 let Inst{7} = Sn{0};
1528 let Inst{15-12} = Sd{4-1};
1529 let Inst{22} = Sd{0};
1532 // VFP conversion instructions
1533 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1534 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1536 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1537 let Inst{27-23} = opcod1;
1538 let Inst{21-20} = opcod2;
1539 let Inst{19-16} = opcod3;
1540 let Inst{11-8} = opcod4;
1545 // VFP conversion between floating-point and fixed-point
1546 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1547 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1549 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1550 // size (fixed-point number): sx == 0 ? 16 : 32
1551 let Inst{7} = op5; // sx
1554 // VFP conversion instructions, if no NEON
1555 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1556 dag oops, dag iops, InstrItinClass itin,
1557 string opc, string asm, list<dag> pattern>
1558 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1560 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1563 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1564 InstrItinClass itin,
1565 string opc, string asm, list<dag> pattern>
1566 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1567 let Inst{27-20} = opcod1;
1568 let Inst{11-8} = opcod2;
1572 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1573 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1574 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1576 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1577 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1578 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1580 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1581 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1582 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1584 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1585 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1586 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1588 //===----------------------------------------------------------------------===//
1590 //===----------------------------------------------------------------------===//
1591 // ARM NEON Instruction templates.
1594 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1595 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1597 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1598 let OutOperandList = oops;
1599 let InOperandList = !con(iops, (ins pred:$p));
1600 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1601 let Pattern = pattern;
1602 list<Predicate> Predicates = [HasNEON];
1605 // Same as NeonI except it does not have a "data type" specifier.
1606 class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1607 InstrItinClass itin, string opc, string asm, string cstr,
1609 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1610 let OutOperandList = oops;
1611 let InOperandList = !con(iops, (ins pred:$p));
1612 let AsmString = !strconcat(opc, "${p}", "\t", asm);
1613 let Pattern = pattern;
1614 list<Predicate> Predicates = [HasNEON];
1617 class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1618 dag oops, dag iops, InstrItinClass itin,
1619 string opc, string dt, string asm, string cstr, list<dag> pattern>
1620 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1622 let Inst{31-24} = 0b11110100;
1623 let Inst{23} = op23;
1624 let Inst{21-20} = op21_20;
1625 let Inst{11-8} = op11_8;
1626 let Inst{7-4} = op7_4;
1628 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
1634 let Inst{22} = Vd{4};
1635 let Inst{15-12} = Vd{3-0};
1636 let Inst{19-16} = Rn{3-0};
1637 let Inst{3-0} = Rm{3-0};
1640 class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1641 dag oops, dag iops, InstrItinClass itin,
1642 string opc, string dt, string asm, string cstr, list<dag> pattern>
1643 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1644 dt, asm, cstr, pattern> {
1648 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1649 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1651 let OutOperandList = oops;
1652 let InOperandList = !con(iops, (ins pred:$p));
1653 list<Predicate> Predicates = [HasNEON];
1656 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1658 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1660 let OutOperandList = oops;
1661 let InOperandList = !con(iops, (ins pred:$p));
1662 let Pattern = pattern;
1663 list<Predicate> Predicates = [HasNEON];
1666 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1667 string opc, string dt, string asm, string cstr, list<dag> pattern>
1668 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1670 let Inst{31-25} = 0b1111001;
1671 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1674 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1675 string opc, string asm, string cstr, list<dag> pattern>
1676 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1678 let Inst{31-25} = 0b1111001;
1679 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1682 // NEON "one register and a modified immediate" format.
1683 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1685 dag oops, dag iops, InstrItinClass itin,
1686 string opc, string dt, string asm, string cstr,
1688 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1689 let Inst{23} = op23;
1690 let Inst{21-19} = op21_19;
1691 let Inst{11-8} = op11_8;
1697 // Instruction operands.
1701 let Inst{15-12} = Vd{3-0};
1702 let Inst{22} = Vd{4};
1703 let Inst{24} = SIMM{7};
1704 let Inst{18-16} = SIMM{6-4};
1705 let Inst{3-0} = SIMM{3-0};
1708 // NEON 2 vector register format.
1709 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1710 bits<5> op11_7, bit op6, bit op4,
1711 dag oops, dag iops, InstrItinClass itin,
1712 string opc, string dt, string asm, string cstr, list<dag> pattern>
1713 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1714 let Inst{24-23} = op24_23;
1715 let Inst{21-20} = op21_20;
1716 let Inst{19-18} = op19_18;
1717 let Inst{17-16} = op17_16;
1718 let Inst{11-7} = op11_7;
1722 // Instruction operands.
1726 let Inst{15-12} = Vd{3-0};
1727 let Inst{22} = Vd{4};
1728 let Inst{3-0} = Vm{3-0};
1729 let Inst{5} = Vm{4};
1732 // Same as N2V except it doesn't have a datatype suffix.
1733 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1734 bits<5> op11_7, bit op6, bit op4,
1735 dag oops, dag iops, InstrItinClass itin,
1736 string opc, string asm, string cstr, list<dag> pattern>
1737 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1738 let Inst{24-23} = op24_23;
1739 let Inst{21-20} = op21_20;
1740 let Inst{19-18} = op19_18;
1741 let Inst{17-16} = op17_16;
1742 let Inst{11-7} = op11_7;
1746 // Instruction operands.
1750 let Inst{15-12} = Vd{3-0};
1751 let Inst{22} = Vd{4};
1752 let Inst{3-0} = Vm{3-0};
1753 let Inst{5} = Vm{4};
1756 // NEON 2 vector register with immediate.
1757 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1758 dag oops, dag iops, Format f, InstrItinClass itin,
1759 string opc, string dt, string asm, string cstr, list<dag> pattern>
1760 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1761 let Inst{24} = op24;
1762 let Inst{23} = op23;
1763 let Inst{11-8} = op11_8;
1768 // Instruction operands.
1773 let Inst{15-12} = Vd{3-0};
1774 let Inst{22} = Vd{4};
1775 let Inst{3-0} = Vm{3-0};
1776 let Inst{5} = Vm{4};
1777 let Inst{21-16} = SIMM{5-0};
1780 // NEON 3 vector register format.
1782 class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1783 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1784 string opc, string dt, string asm, string cstr,
1786 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1787 let Inst{24} = op24;
1788 let Inst{23} = op23;
1789 let Inst{21-20} = op21_20;
1790 let Inst{11-8} = op11_8;
1795 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1796 dag oops, dag iops, Format f, InstrItinClass itin,
1797 string opc, string dt, string asm, string cstr, list<dag> pattern>
1798 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1799 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1801 // Instruction operands.
1806 let Inst{15-12} = Vd{3-0};
1807 let Inst{22} = Vd{4};
1808 let Inst{19-16} = Vn{3-0};
1809 let Inst{7} = Vn{4};
1810 let Inst{3-0} = Vm{3-0};
1811 let Inst{5} = Vm{4};
1814 class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1815 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1816 string opc, string dt, string asm, string cstr,
1818 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1819 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1821 // Instruction operands.
1827 let Inst{15-12} = Vd{3-0};
1828 let Inst{22} = Vd{4};
1829 let Inst{19-16} = Vn{3-0};
1830 let Inst{7} = Vn{4};
1831 let Inst{3-0} = Vm{3-0};
1835 class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1836 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1837 string opc, string dt, string asm, string cstr,
1839 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1840 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1842 // Instruction operands.
1848 let Inst{15-12} = Vd{3-0};
1849 let Inst{22} = Vd{4};
1850 let Inst{19-16} = Vn{3-0};
1851 let Inst{7} = Vn{4};
1852 let Inst{2-0} = Vm{2-0};
1853 let Inst{5} = lane{1};
1854 let Inst{3} = lane{0};
1857 // Same as N3V except it doesn't have a data type suffix.
1858 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1860 dag oops, dag iops, Format f, InstrItinClass itin,
1861 string opc, string asm, string cstr, list<dag> pattern>
1862 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1863 let Inst{24} = op24;
1864 let Inst{23} = op23;
1865 let Inst{21-20} = op21_20;
1866 let Inst{11-8} = op11_8;
1870 // Instruction operands.
1875 let Inst{15-12} = Vd{3-0};
1876 let Inst{22} = Vd{4};
1877 let Inst{19-16} = Vn{3-0};
1878 let Inst{7} = Vn{4};
1879 let Inst{3-0} = Vm{3-0};
1880 let Inst{5} = Vm{4};
1883 // NEON VMOVs between scalar and core registers.
1884 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1885 dag oops, dag iops, Format f, InstrItinClass itin,
1886 string opc, string dt, string asm, list<dag> pattern>
1887 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
1889 let Inst{27-20} = opcod1;
1890 let Inst{11-8} = opcod2;
1891 let Inst{6-5} = opcod3;
1893 // A8.6.303, A8.6.328, A8.6.329
1894 let Inst{3-0} = 0b0000;
1896 let OutOperandList = oops;
1897 let InOperandList = !con(iops, (ins pred:$p));
1898 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1899 let Pattern = pattern;
1900 list<Predicate> Predicates = [HasNEON];
1902 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
1909 let Inst{31-28} = p{3-0};
1911 let Inst{19-16} = V{3-0};
1912 let Inst{15-12} = R{3-0};
1914 class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1915 dag oops, dag iops, InstrItinClass itin,
1916 string opc, string dt, string asm, list<dag> pattern>
1917 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
1918 opc, dt, asm, pattern>;
1919 class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1920 dag oops, dag iops, InstrItinClass itin,
1921 string opc, string dt, string asm, list<dag> pattern>
1922 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
1923 opc, dt, asm, pattern>;
1924 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1925 dag oops, dag iops, InstrItinClass itin,
1926 string opc, string dt, string asm, list<dag> pattern>
1927 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1928 opc, dt, asm, pattern>;
1930 // Vector Duplicate Lane (from scalar to all elements)
1931 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1932 InstrItinClass itin, string opc, string dt, string asm,
1934 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1935 let Inst{24-23} = 0b11;
1936 let Inst{21-20} = 0b11;
1937 let Inst{19-16} = op19_16;
1938 let Inst{11-7} = 0b11000;
1946 let Inst{22} = Vd{4};
1947 let Inst{15-12} = Vd{3-0};
1948 let Inst{5} = Vm{4};
1949 let Inst{3-0} = Vm{3-0};
1952 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1953 // for single-precision FP.
1954 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1955 list<Predicate> Predicates = [HasNEON,UseNEONForFP];