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 a 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.
88 class AddrMode<bits<5> val> {
91 def AddrModeNone : AddrMode<0>;
92 def AddrMode1 : AddrMode<1>;
93 def AddrMode2 : AddrMode<2>;
94 def AddrMode3 : AddrMode<3>;
95 def AddrMode4 : AddrMode<4>;
96 def AddrMode5 : AddrMode<5>;
97 def AddrMode6 : AddrMode<6>;
98 def AddrModeT1_1 : AddrMode<7>;
99 def AddrModeT1_2 : AddrMode<8>;
100 def AddrModeT1_4 : AddrMode<9>;
101 def AddrModeT1_s : AddrMode<10>;
102 def AddrModeT2_i12 : AddrMode<11>;
103 def AddrModeT2_i8 : AddrMode<12>;
104 def AddrModeT2_so : AddrMode<13>;
105 def AddrModeT2_pc : AddrMode<14>;
106 def AddrModeT2_i8s4 : AddrMode<15>;
107 def AddrMode_i12 : AddrMode<16>;
110 class SizeFlagVal<bits<3> val> {
113 def SizeInvalid : SizeFlagVal<0>; // Unset.
114 def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
115 def Size8Bytes : SizeFlagVal<2>;
116 def Size4Bytes : SizeFlagVal<3>;
117 def Size2Bytes : SizeFlagVal<4>;
119 // Load / store index mode.
120 class IndexMode<bits<2> val> {
123 def IndexModeNone : IndexMode<0>;
124 def IndexModePre : IndexMode<1>;
125 def IndexModePost : IndexMode<2>;
126 def IndexModeUpd : IndexMode<3>;
128 // Instruction execution domain.
129 class Domain<bits<2> val> {
132 def GenericDomain : Domain<0>;
133 def VFPDomain : Domain<1>; // Instructions in VFP domain only
134 def NeonDomain : Domain<2>; // Instructions in Neon domain only
135 def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
137 //===----------------------------------------------------------------------===//
139 // ARM special operands.
142 def CondCodeOperand : AsmOperandClass {
143 let Name = "CondCode";
144 let SuperClasses = [];
147 // ARM Predicate operand. Default to 14 = always (AL). Second part is CC
148 // register whose default is 0 (no register).
149 def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
150 (ops (i32 14), (i32 zero_reg))> {
151 let PrintMethod = "printPredicateOperand";
152 let ParserMatchClass = CondCodeOperand;
155 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
156 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
157 let EncoderMethod = "getCCOutOpValue";
158 let PrintMethod = "printSBitModifierOperand";
161 // Same as cc_out except it defaults to setting CPSR.
162 def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
163 let EncoderMethod = "getCCOutOpValue";
164 let PrintMethod = "printSBitModifierOperand";
167 // ARM special operands for disassembly only.
169 def setend_op : Operand<i32> {
170 let PrintMethod = "printSetendOperand";
173 def cps_opt : Operand<i32> {
174 let PrintMethod = "printCPSOptionOperand";
177 def msr_mask : Operand<i32> {
178 let PrintMethod = "printMSRMaskOperand";
181 // A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
182 // The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
183 def neg_zero : Operand<i32> {
184 let PrintMethod = "printNegZeroOperand";
187 //===----------------------------------------------------------------------===//
189 // ARM Instruction templates.
192 class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
193 Format f, Domain d, string cstr, InstrItinClass itin>
195 let Namespace = "ARM";
200 bits<2> IndexModeBits = IM.Value;
202 bits<6> Form = F.Value;
204 bit isUnaryDataProc = 0;
205 bit canXformTo16Bit = 0;
207 // If this is a pseudo instruction, mark it isCodeGenOnly.
208 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
210 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
211 let TSFlags{4-0} = AM.Value;
212 let TSFlags{7-5} = SZ.Value;
213 let TSFlags{9-8} = IndexModeBits;
214 let TSFlags{15-10} = Form;
215 let TSFlags{16} = isUnaryDataProc;
216 let TSFlags{17} = canXformTo16Bit;
217 let TSFlags{19-18} = D.Value;
219 let Constraints = cstr;
220 let Itinerary = itin;
227 class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
228 Format f, Domain d, string cstr, InstrItinClass itin>
229 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
231 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
232 // on by adding flavors to specific instructions.
233 class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
234 Format f, Domain d, string cstr, InstrItinClass itin>
235 : InstTemplate<am, sz, im, f, d, cstr, itin>;
237 class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
238 // FIXME: This really should derive from InstTemplate instead, as pseudos
239 // don't need encoding information. TableGen doesn't like that
240 // currently. Need to figure out why and fix it.
241 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
243 let OutOperandList = oops;
244 let InOperandList = iops;
245 let Pattern = pattern;
248 // PseudoInst that's ARM-mode only.
249 class ARMPseudoInst<dag oops, dag iops, InstrItinClass itin,
251 : PseudoInst<oops, iops, itin, pattern> {
252 // Default these to 4byte size, as they're almost always expanded to a
253 // single instruction. Any exceptions can override the SZ field value.
255 list<Predicate> Predicates = [IsARM];
259 // Almost all ARM instructions are predicable.
260 class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
261 IndexMode im, Format f, InstrItinClass itin,
262 string opc, string asm, string cstr,
264 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
267 let OutOperandList = oops;
268 let InOperandList = !con(iops, (ins pred:$p));
269 let AsmString = !strconcat(opc, "${p}", asm);
270 let Pattern = pattern;
271 list<Predicate> Predicates = [IsARM];
274 // A few are not predicable
275 class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
276 IndexMode im, Format f, InstrItinClass itin,
277 string opc, string asm, string cstr,
279 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
280 let OutOperandList = oops;
281 let InOperandList = iops;
282 let AsmString = !strconcat(opc, asm);
283 let Pattern = pattern;
284 let isPredicable = 0;
285 list<Predicate> Predicates = [IsARM];
288 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
289 // operand since by default it's a zero register. It will become an implicit def
290 // once it's "flipped".
291 class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
292 IndexMode im, Format f, InstrItinClass itin,
293 string opc, string asm, string cstr,
295 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
296 bits<4> p; // Predicate operand
297 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
301 let OutOperandList = oops;
302 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
303 let AsmString = !strconcat(opc, "${s}${p}", asm);
304 let Pattern = pattern;
305 list<Predicate> Predicates = [IsARM];
309 class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
310 IndexMode im, Format f, InstrItinClass itin,
311 string asm, string cstr, list<dag> pattern>
312 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
313 let OutOperandList = oops;
314 let InOperandList = iops;
316 let Pattern = pattern;
317 list<Predicate> Predicates = [IsARM];
320 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
321 string opc, string asm, list<dag> pattern>
322 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
323 opc, asm, "", pattern>;
324 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
325 string opc, string asm, list<dag> pattern>
326 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
327 opc, asm, "", pattern>;
328 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
329 string asm, list<dag> pattern>
330 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
332 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
333 string opc, string asm, list<dag> pattern>
334 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
335 opc, asm, "", pattern>;
337 // Ctrl flow instructions
338 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
339 string opc, string asm, list<dag> pattern>
340 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
341 opc, asm, "", pattern> {
342 let Inst{27-24} = opcod;
344 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
345 string asm, list<dag> pattern>
346 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
348 let Inst{27-24} = opcod;
350 class ABXIx2<dag oops, dag iops, InstrItinClass itin,
351 string asm, list<dag> pattern>
352 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
355 // BR_JT instructions
356 class JTI<dag oops, dag iops, InstrItinClass itin,
357 string asm, list<dag> pattern>
358 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
361 // Atomic load/store instructions
362 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
363 string opc, string asm, list<dag> pattern>
364 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
365 opc, asm, "", pattern> {
368 let Inst{27-23} = 0b00011;
369 let Inst{22-21} = opcod;
371 let Inst{19-16} = Rn;
372 let Inst{15-12} = Rt;
373 let Inst{11-0} = 0b111110011111;
375 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
376 string opc, string asm, list<dag> pattern>
377 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
378 opc, asm, "", pattern> {
382 let Inst{27-23} = 0b00011;
383 let Inst{22-21} = opcod;
385 let Inst{19-16} = Rn;
386 let Inst{15-12} = Rd;
387 let Inst{11-4} = 0b11111001;
390 class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
391 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, [$Rn]", pattern> {
395 let Inst{27-23} = 0b00010;
397 let Inst{21-20} = 0b00;
398 let Inst{19-16} = Rn;
399 let Inst{15-12} = Rt;
400 let Inst{11-4} = 0b00001001;
404 // addrmode1 instructions
405 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
406 string opc, string asm, list<dag> pattern>
407 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
408 opc, asm, "", pattern> {
409 let Inst{24-21} = opcod;
410 let Inst{27-26} = 0b00;
412 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
413 string opc, string asm, list<dag> pattern>
414 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
415 opc, asm, "", pattern> {
416 let Inst{24-21} = opcod;
417 let Inst{27-26} = 0b00;
419 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
420 string asm, list<dag> pattern>
421 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
423 let Inst{24-21} = opcod;
424 let Inst{27-26} = 0b00;
426 class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
427 string opc, string asm, list<dag> pattern>
428 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
429 opc, asm, "", pattern>;
435 class AIldst1<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
436 Format f, InstrItinClass itin, string opc, string asm,
438 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
440 let Inst{27-25} = op;
441 let Inst{24} = 1; // 24 == P
443 let Inst{22} = isByte;
444 let Inst{21} = 0; // 21 == W
447 // Indexed load/stores
448 class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
449 IndexMode im, Format f, InstrItinClass itin, string opc,
450 string asm, string cstr, list<dag> pattern>
451 : I<oops, iops, AddrMode2, Size4Bytes, im, f, itin,
452 opc, asm, cstr, pattern> {
454 let Inst{27-26} = 0b01;
455 let Inst{24} = isPre; // P bit
456 let Inst{22} = isByte; // B bit
457 let Inst{21} = isPre; // W bit
458 let Inst{20} = isLd; // L bit
459 let Inst{15-12} = Rt;
462 class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
463 string asm, list<dag> pattern>
464 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
466 let Inst{20} = 1; // L bit
467 let Inst{21} = 0; // W bit
468 let Inst{22} = 0; // B bit
469 let Inst{24} = 1; // P bit
470 let Inst{27-26} = 0b01;
472 class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
473 string asm, list<dag> pattern>
474 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
476 let Inst{20} = 1; // L bit
477 let Inst{21} = 0; // W bit
478 let Inst{22} = 1; // B bit
479 let Inst{24} = 1; // P bit
480 let Inst{27-26} = 0b01;
484 class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
485 string asm, list<dag> pattern>
486 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
488 let Inst{20} = 0; // L bit
489 let Inst{21} = 0; // W bit
490 let Inst{22} = 0; // B bit
491 let Inst{24} = 1; // P bit
492 let Inst{27-26} = 0b01;
494 class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
495 string asm, list<dag> pattern>
496 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
498 let Inst{20} = 0; // L bit
499 let Inst{21} = 0; // W bit
500 let Inst{22} = 1; // B bit
501 let Inst{24} = 1; // P bit
502 let Inst{27-26} = 0b01;
505 // addrmode3 instructions
506 class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
507 InstrItinClass itin, string opc, string asm, list<dag> pattern>
508 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
509 opc, asm, "", pattern> {
512 let Inst{27-25} = 0b000;
513 let Inst{24} = 1; // P bit
514 let Inst{23} = addr{8}; // U bit
515 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
516 let Inst{21} = 0; // W bit
517 let Inst{20} = op20; // L bit
518 let Inst{19-16} = addr{12-9}; // Rn
519 let Inst{15-12} = Rt; // Rt
520 let Inst{11-8} = addr{7-4}; // imm7_4/zero
522 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
526 class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
527 string opc, string asm, list<dag> pattern>
528 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
529 opc, asm, "", pattern> {
532 let Inst{27-25} = 0b000;
533 let Inst{24} = 1; // P bit
534 let Inst{23} = addr{8}; // U bit
535 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
536 let Inst{21} = 0; // W bit
537 let Inst{20} = 0; // L bit
538 let Inst{19-16} = addr{12-9}; // Rn
539 let Inst{15-12} = Rt; // Rt
540 let Inst{11-8} = addr{7-4}; // imm7_4/zero
541 let Inst{7-4} = 0b1011;
542 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
544 class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
545 string asm, list<dag> pattern>
546 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
549 let Inst{5} = 1; // H bit
550 let Inst{6} = 0; // S bit
552 let Inst{20} = 0; // L bit
553 let Inst{21} = 0; // W bit
554 let Inst{24} = 1; // P bit
556 class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
557 string opc, string asm, list<dag> pattern>
558 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
559 opc, asm, "", pattern> {
561 let Inst{5} = 1; // H bit
562 let Inst{6} = 1; // S bit
564 let Inst{20} = 0; // L bit
565 let Inst{21} = 0; // W bit
566 let Inst{24} = 1; // P bit
567 let Inst{27-25} = 0b000;
571 class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
572 string opc, string asm, string cstr, list<dag> pattern>
573 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
574 opc, asm, cstr, pattern> {
576 let Inst{5} = 1; // H bit
577 let Inst{6} = 0; // S bit
579 let Inst{20} = 1; // L bit
580 let Inst{21} = 1; // W bit
581 let Inst{24} = 1; // P bit
582 let Inst{27-25} = 0b000;
584 class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
585 string opc, string asm, string cstr, list<dag> pattern>
586 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
587 opc, asm, cstr, pattern> {
590 let Inst{27-25} = 0b000;
591 let Inst{24} = 1; // P bit
592 let Inst{23} = addr{8}; // U bit
593 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
594 let Inst{21} = 1; // W bit
595 let Inst{20} = 1; // L bit
596 let Inst{19-16} = addr{12-9}; // Rn
597 let Inst{15-12} = Rt; // Rt
598 let Inst{11-8} = addr{7-4}; // imm7_4/zero
599 let Inst{7-4} = 0b1111;
600 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
602 class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
603 string opc, string asm, string cstr, list<dag> pattern>
604 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
605 opc, asm, cstr, pattern> {
607 let Inst{5} = 0; // H bit
608 let Inst{6} = 1; // S bit
610 let Inst{20} = 1; // L bit
611 let Inst{21} = 1; // W bit
612 let Inst{24} = 1; // P bit
613 let Inst{27-25} = 0b000;
615 class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
616 string opc, string asm, string cstr, list<dag> pattern>
617 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
618 opc, asm, cstr, pattern> {
620 let Inst{5} = 0; // H bit
621 let Inst{6} = 1; // S bit
623 let Inst{20} = 0; // L bit
624 let Inst{21} = 1; // W bit
625 let Inst{24} = 1; // P bit
626 let Inst{27-25} = 0b000;
630 // Pre-indexed stores
631 class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
632 string opc, string asm, string cstr, list<dag> pattern>
633 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
634 opc, asm, cstr, pattern> {
636 let Inst{5} = 1; // H bit
637 let Inst{6} = 0; // S bit
639 let Inst{20} = 0; // L bit
640 let Inst{21} = 1; // W bit
641 let Inst{24} = 1; // P bit
642 let Inst{27-25} = 0b000;
644 class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
645 string opc, string asm, string cstr, list<dag> pattern>
646 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
647 opc, asm, cstr, pattern> {
649 let Inst{5} = 1; // H bit
650 let Inst{6} = 1; // S bit
652 let Inst{20} = 0; // L bit
653 let Inst{21} = 1; // W bit
654 let Inst{24} = 1; // P bit
655 let Inst{27-25} = 0b000;
658 // Post-indexed loads
659 class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
660 string opc, string asm, string cstr, list<dag> pattern>
661 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
662 opc, asm, cstr,pattern> {
666 let Inst{27-25} = 0b000;
667 let Inst{24} = 0; // P bit
668 let Inst{23} = offset{8}; // U bit
669 let Inst{22} = offset{9}; // 1 == imm8, 0 == Rm
670 let Inst{21} = 0; // W bit
671 let Inst{20} = 1; // L bit
672 let Inst{19-16} = Rn; // Rn
673 let Inst{15-12} = Rt; // Rt
674 let Inst{11-8} = offset{7-4}; // imm7_4/zero
675 let Inst{7-4} = 0b1011;
676 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
678 class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
679 string opc, string asm, string cstr, list<dag> pattern>
680 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
681 opc, asm, cstr,pattern> {
685 let Inst{27-25} = 0b000;
686 let Inst{24} = 0; // P bit
687 let Inst{23} = offset{8}; // U bit
688 let Inst{22} = offset{9}; // 1 == imm8, 0 == Rm
689 let Inst{21} = 0; // W bit
690 let Inst{20} = 1; // L bit
691 let Inst{19-16} = Rn; // Rn
692 let Inst{15-12} = Rt; // Rt
693 let Inst{11-8} = offset{7-4}; // imm7_4/zero
694 let Inst{7-4} = 0b1111;
695 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
697 class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
698 string opc, string asm, string cstr, list<dag> pattern>
699 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
700 opc, asm, cstr,pattern> {
702 let Inst{5} = 0; // H bit
703 let Inst{6} = 1; // S bit
705 let Inst{20} = 1; // L bit
706 let Inst{21} = 0; // W bit
707 let Inst{24} = 0; // P bit
708 let Inst{27-25} = 0b000;
710 class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
711 string opc, string asm, string cstr, list<dag> pattern>
712 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
713 opc, asm, cstr, pattern> {
715 let Inst{5} = 0; // H bit
716 let Inst{6} = 1; // S bit
718 let Inst{20} = 0; // L bit
719 let Inst{21} = 0; // W bit
720 let Inst{24} = 0; // P bit
721 let Inst{27-25} = 0b000;
724 // Post-indexed stores
725 class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
726 string opc, string asm, string cstr, list<dag> pattern>
727 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
728 opc, asm, cstr,pattern> {
730 let Inst{5} = 1; // H bit
731 let Inst{6} = 0; // S bit
733 let Inst{20} = 0; // L bit
734 let Inst{21} = 0; // W bit
735 let Inst{24} = 0; // P bit
736 let Inst{27-25} = 0b000;
738 class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
739 string opc, string asm, string cstr, list<dag> pattern>
740 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
741 opc, asm, cstr, pattern> {
743 let Inst{5} = 1; // H bit
744 let Inst{6} = 1; // S bit
746 let Inst{20} = 0; // L bit
747 let Inst{21} = 0; // W bit
748 let Inst{24} = 0; // P bit
749 let Inst{27-25} = 0b000;
752 // addrmode4 instructions
753 class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
754 string asm, string cstr, list<dag> pattern>
755 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin, asm, cstr, pattern> {
760 let Inst{27-25} = 0b100;
761 let Inst{22} = 0; // S bit
762 let Inst{19-16} = Rn;
763 let Inst{15-0} = regs;
766 // Unsigned multiply, multiply-accumulate instructions.
767 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
768 string opc, string asm, list<dag> pattern>
769 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
770 opc, asm, "", pattern> {
771 let Inst{7-4} = 0b1001;
772 let Inst{20} = 0; // S bit
773 let Inst{27-21} = opcod;
775 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
776 string opc, string asm, list<dag> pattern>
777 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
778 opc, asm, "", pattern> {
779 let Inst{7-4} = 0b1001;
780 let Inst{27-21} = opcod;
783 // Most significant word multiply
784 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
785 InstrItinClass itin, string opc, string asm, list<dag> pattern>
786 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
787 opc, asm, "", pattern> {
791 let Inst{7-4} = opc7_4;
793 let Inst{27-21} = opcod;
794 let Inst{19-16} = Rd;
798 // MSW multiple w/ Ra operand
799 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
800 InstrItinClass itin, string opc, string asm, list<dag> pattern>
801 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
803 let Inst{15-12} = Ra;
806 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
807 class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
808 InstrItinClass itin, string opc, string asm, list<dag> pattern>
809 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
810 opc, asm, "", pattern> {
816 let Inst{27-21} = opcod;
817 let Inst{6-5} = bit6_5;
821 class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
822 InstrItinClass itin, string opc, string asm, list<dag> pattern>
823 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
825 let Inst{19-16} = Rd;
828 // AMulxyI with Ra operand
829 class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
830 InstrItinClass itin, string opc, string asm, list<dag> pattern>
831 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
833 let Inst{15-12} = Ra;
836 class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
837 InstrItinClass itin, string opc, string asm, list<dag> pattern>
838 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
841 let Inst{19-16} = RdHi;
842 let Inst{15-12} = RdLo;
845 // Extend instructions.
846 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
847 string opc, string asm, list<dag> pattern>
848 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
849 opc, asm, "", pattern> {
850 // All AExtI instructions have Rd and Rm register operands.
853 let Inst{15-12} = Rd;
855 let Inst{7-4} = 0b0111;
856 let Inst{9-8} = 0b00;
857 let Inst{27-20} = opcod;
860 // Misc Arithmetic instructions.
861 class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
862 InstrItinClass itin, string opc, string asm, list<dag> pattern>
863 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
864 opc, asm, "", pattern> {
867 let Inst{27-20} = opcod;
868 let Inst{19-16} = 0b1111;
869 let Inst{15-12} = Rd;
870 let Inst{11-8} = 0b1111;
871 let Inst{7-4} = opc7_4;
876 class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
877 string opc, string asm, list<dag> pattern>
878 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
879 opc, asm, "", pattern> {
884 let Inst{27-20} = opcod;
885 let Inst{19-16} = Rn;
886 let Inst{15-12} = Rd;
887 let Inst{11-7} = sh{7-3};
889 let Inst{5-4} = 0b01;
893 //===----------------------------------------------------------------------===//
895 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
896 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
897 list<Predicate> Predicates = [IsARM];
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 //===----------------------------------------------------------------------===//
908 // Thumb Instruction Format Definitions.
911 // TI - Thumb instruction.
913 class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
914 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
915 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
916 let OutOperandList = oops;
917 let InOperandList = iops;
919 let Pattern = pattern;
920 list<Predicate> Predicates = [IsThumb];
923 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
924 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
926 // Two-address instructions
927 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
929 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
932 // tBL, tBX 32-bit instructions
933 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
934 dag oops, dag iops, InstrItinClass itin, string asm,
936 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
938 let Inst{31-27} = opcod1;
939 let Inst{15-14} = opcod2;
940 let Inst{12} = opcod3;
943 // BR_JT instructions
944 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
946 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
949 class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
950 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
951 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
952 let OutOperandList = oops;
953 let InOperandList = iops;
955 let Pattern = pattern;
956 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
959 class T1I<dag oops, dag iops, InstrItinClass itin,
960 string asm, list<dag> pattern>
961 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
962 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
963 string asm, list<dag> pattern>
964 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
965 class T1JTI<dag oops, dag iops, InstrItinClass itin,
966 string asm, list<dag> pattern>
967 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
969 // Two-address instructions
970 class T1It<dag oops, dag iops, InstrItinClass itin,
971 string asm, string cstr, list<dag> pattern>
972 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
975 // Thumb1 instruction that can either be predicated or set CPSR.
976 class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
978 string opc, string asm, string cstr, list<dag> pattern>
979 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
980 let OutOperandList = !con(oops, (outs s_cc_out:$s));
981 let InOperandList = !con(iops, (ins pred:$p));
982 let AsmString = !strconcat(opc, "${s}${p}", asm);
983 let Pattern = pattern;
984 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
987 class T1sI<dag oops, dag iops, InstrItinClass itin,
988 string opc, string asm, list<dag> pattern>
989 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
991 // Two-address instructions
992 class T1sIt<dag oops, dag iops, InstrItinClass itin,
993 string opc, string asm, list<dag> pattern>
994 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
995 "$lhs = $dst", pattern>;
997 // Thumb1 instruction that can be predicated.
998 class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1000 string opc, string asm, string cstr, list<dag> pattern>
1001 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1002 let OutOperandList = oops;
1003 let InOperandList = !con(iops, (ins pred:$p));
1004 let AsmString = !strconcat(opc, "${p}", asm);
1005 let Pattern = pattern;
1006 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1009 class T1pI<dag oops, dag iops, InstrItinClass itin,
1010 string opc, string asm, list<dag> pattern>
1011 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
1013 // Two-address instructions
1014 class T1pIt<dag oops, dag iops, InstrItinClass itin,
1015 string opc, string asm, list<dag> pattern>
1016 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
1017 "$lhs = $dst", pattern>;
1019 class T1pI1<dag oops, dag iops, InstrItinClass itin,
1020 string opc, string asm, list<dag> pattern>
1021 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1022 class T1pI2<dag oops, dag iops, InstrItinClass itin,
1023 string opc, string asm, list<dag> pattern>
1024 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1025 class T1pI4<dag oops, dag iops, InstrItinClass itin,
1026 string opc, string asm, list<dag> pattern>
1027 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1028 class T1pIs<dag oops, dag iops,
1029 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1030 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
1032 class Encoding16 : Encoding {
1033 let Inst{31-16} = 0x0000;
1036 // A6.2 16-bit Thumb instruction encoding
1037 class T1Encoding<bits<6> opcode> : Encoding16 {
1038 let Inst{15-10} = opcode;
1041 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
1042 class T1General<bits<5> opcode> : Encoding16 {
1043 let Inst{15-14} = 0b00;
1044 let Inst{13-9} = opcode;
1047 // A6.2.2 Data-processing encoding.
1048 class T1DataProcessing<bits<4> opcode> : Encoding16 {
1049 let Inst{15-10} = 0b010000;
1050 let Inst{9-6} = opcode;
1053 // A6.2.3 Special data instructions and branch and exchange encoding.
1054 class T1Special<bits<4> opcode> : Encoding16 {
1055 let Inst{15-10} = 0b010001;
1056 let Inst{9-6} = opcode;
1059 // A6.2.4 Load/store single data item encoding.
1060 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
1061 let Inst{15-12} = opA;
1062 let Inst{11-9} = opB;
1064 class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1065 class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1066 class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1067 class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1068 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1070 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1071 class T1Misc<bits<7> opcode> : Encoding16 {
1072 let Inst{15-12} = 0b1011;
1073 let Inst{11-5} = opcode;
1076 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1077 class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1078 InstrItinClass itin,
1079 string opc, string asm, string cstr, list<dag> pattern>
1080 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1081 let OutOperandList = oops;
1082 let InOperandList = !con(iops, (ins pred:$p));
1083 let AsmString = !strconcat(opc, "${p}", asm);
1084 let Pattern = pattern;
1085 list<Predicate> Predicates = [IsThumb2];
1088 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1089 // input operand since by default it's a zero register. It will become an
1090 // implicit def once it's "flipped".
1092 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1094 class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1095 InstrItinClass itin,
1096 string opc, string asm, string cstr, list<dag> pattern>
1097 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1098 let OutOperandList = oops;
1099 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1100 let AsmString = !strconcat(opc, "${s}${p}", asm);
1101 let Pattern = pattern;
1102 list<Predicate> Predicates = [IsThumb2];
1106 class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1107 InstrItinClass itin,
1108 string asm, string cstr, list<dag> pattern>
1109 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1110 let OutOperandList = oops;
1111 let InOperandList = iops;
1112 let AsmString = asm;
1113 let Pattern = pattern;
1114 list<Predicate> Predicates = [IsThumb2];
1117 class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1118 InstrItinClass itin,
1119 string asm, string cstr, list<dag> pattern>
1120 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1121 let OutOperandList = oops;
1122 let InOperandList = iops;
1123 let AsmString = asm;
1124 let Pattern = pattern;
1125 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1128 class T2I<dag oops, dag iops, InstrItinClass itin,
1129 string opc, string asm, list<dag> pattern>
1130 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1131 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1132 string opc, string asm, list<dag> pattern>
1133 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
1134 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1135 string opc, string asm, list<dag> pattern>
1136 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1137 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1138 string opc, string asm, list<dag> pattern>
1139 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1140 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1141 string opc, string asm, list<dag> pattern>
1142 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
1143 class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
1144 string opc, string asm, list<dag> pattern>
1145 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1147 let Inst{31-27} = 0b11101;
1148 let Inst{26-25} = 0b00;
1150 let Inst{23} = ?; // The U bit.
1153 let Inst{20} = load;
1156 class T2sI<dag oops, dag iops, InstrItinClass itin,
1157 string opc, string asm, list<dag> pattern>
1158 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1160 class T2XI<dag oops, dag iops, InstrItinClass itin,
1161 string asm, list<dag> pattern>
1162 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1163 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1164 string asm, list<dag> pattern>
1165 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
1167 class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1168 string opc, string asm, list<dag> pattern>
1169 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1171 // Two-address instructions
1172 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1173 string asm, string cstr, list<dag> pattern>
1174 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
1176 // T2Iidxldst - Thumb2 indexed load / store instructions.
1177 class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1179 AddrMode am, IndexMode im, InstrItinClass itin,
1180 string opc, string asm, string cstr, list<dag> pattern>
1181 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
1182 let OutOperandList = oops;
1183 let InOperandList = !con(iops, (ins pred:$p));
1184 let AsmString = !strconcat(opc, "${p}", asm);
1185 let Pattern = pattern;
1186 list<Predicate> Predicates = [IsThumb2];
1187 let Inst{31-27} = 0b11111;
1188 let Inst{26-25} = 0b00;
1189 let Inst{24} = signed;
1191 let Inst{22-21} = opcod;
1192 let Inst{20} = load;
1194 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1195 let Inst{10} = pre; // The P bit.
1196 let Inst{8} = 1; // The W bit.
1199 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1200 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1201 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
1204 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1205 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1206 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1209 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1210 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1211 list<Predicate> Predicates = [IsThumb2];
1214 //===----------------------------------------------------------------------===//
1216 //===----------------------------------------------------------------------===//
1217 // ARM VFP Instruction templates.
1220 // Almost all VFP instructions are predicable.
1221 class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1222 IndexMode im, Format f, InstrItinClass itin,
1223 string opc, string asm, string cstr, list<dag> pattern>
1224 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1226 let Inst{31-28} = p;
1227 let OutOperandList = oops;
1228 let InOperandList = !con(iops, (ins pred:$p));
1229 let AsmString = !strconcat(opc, "${p}", asm);
1230 let Pattern = pattern;
1231 list<Predicate> Predicates = [HasVFP2];
1235 class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1236 IndexMode im, Format f, InstrItinClass itin,
1237 string asm, string cstr, list<dag> pattern>
1238 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1240 let Inst{31-28} = p;
1241 let OutOperandList = oops;
1242 let InOperandList = iops;
1243 let AsmString = asm;
1244 let Pattern = pattern;
1245 list<Predicate> Predicates = [HasVFP2];
1248 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1249 string opc, string asm, list<dag> pattern>
1250 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1251 opc, asm, "", pattern>;
1253 // ARM VFP addrmode5 loads and stores
1254 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1255 InstrItinClass itin,
1256 string opc, string asm, list<dag> pattern>
1257 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
1258 VFPLdStFrm, itin, opc, asm, "", pattern> {
1259 // Instruction operands.
1263 // Encode instruction operands.
1264 let Inst{23} = addr{8}; // U (add = (U == '1'))
1265 let Inst{22} = Dd{4};
1266 let Inst{19-16} = addr{12-9}; // Rn
1267 let Inst{15-12} = Dd{3-0};
1268 let Inst{7-0} = addr{7-0}; // imm8
1270 // TODO: Mark the instructions with the appropriate subtarget info.
1271 let Inst{27-24} = opcod1;
1272 let Inst{21-20} = opcod2;
1273 let Inst{11-9} = 0b101;
1274 let Inst{8} = 1; // Double precision
1276 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1277 let D = VFPNeonDomain;
1280 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1281 InstrItinClass itin,
1282 string opc, string asm, list<dag> pattern>
1283 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
1284 VFPLdStFrm, itin, opc, asm, "", pattern> {
1285 // Instruction operands.
1289 // Encode instruction operands.
1290 let Inst{23} = addr{8}; // U (add = (U == '1'))
1291 let Inst{22} = Sd{0};
1292 let Inst{19-16} = addr{12-9}; // Rn
1293 let Inst{15-12} = Sd{4-1};
1294 let Inst{7-0} = addr{7-0}; // imm8
1296 // TODO: Mark the instructions with the appropriate subtarget info.
1297 let Inst{27-24} = opcod1;
1298 let Inst{21-20} = opcod2;
1299 let Inst{11-9} = 0b101;
1300 let Inst{8} = 0; // Single precision
1303 // VFP Load / store multiple pseudo instructions.
1304 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1306 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1308 let OutOperandList = oops;
1309 let InOperandList = !con(iops, (ins pred:$p));
1310 let Pattern = pattern;
1311 list<Predicate> Predicates = [HasVFP2];
1314 // Load / store multiple
1315 class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1316 string asm, string cstr, list<dag> pattern>
1317 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
1318 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1319 // Instruction operands.
1323 // Encode instruction operands.
1324 let Inst{19-16} = Rn;
1325 let Inst{22} = regs{12};
1326 let Inst{15-12} = regs{11-8};
1327 let Inst{7-0} = regs{7-0};
1329 // TODO: Mark the instructions with the appropriate subtarget info.
1330 let Inst{27-25} = 0b110;
1331 let Inst{11-9} = 0b101;
1332 let Inst{8} = 1; // Double precision
1334 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1335 let D = VFPNeonDomain;
1338 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1339 string asm, string cstr, list<dag> pattern>
1340 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
1341 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1342 // Instruction operands.
1346 // Encode instruction operands.
1347 let Inst{19-16} = Rn;
1348 let Inst{22} = regs{8};
1349 let Inst{15-12} = regs{12-9};
1350 let Inst{7-0} = regs{7-0};
1352 // TODO: Mark the instructions with the appropriate subtarget info.
1353 let Inst{27-25} = 0b110;
1354 let Inst{11-9} = 0b101;
1355 let Inst{8} = 0; // Single precision
1358 // Double precision, unary
1359 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1360 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1361 string asm, list<dag> pattern>
1362 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1363 // Instruction operands.
1367 // Encode instruction operands.
1368 let Inst{3-0} = Dm{3-0};
1369 let Inst{5} = Dm{4};
1370 let Inst{15-12} = Dd{3-0};
1371 let Inst{22} = Dd{4};
1373 let Inst{27-23} = opcod1;
1374 let Inst{21-20} = opcod2;
1375 let Inst{19-16} = opcod3;
1376 let Inst{11-9} = 0b101;
1377 let Inst{8} = 1; // Double precision
1378 let Inst{7-6} = opcod4;
1379 let Inst{4} = opcod5;
1382 // Double precision, binary
1383 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1384 dag iops, InstrItinClass itin, string opc, string asm,
1386 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1387 // Instruction operands.
1392 // Encode instruction operands.
1393 let Inst{3-0} = Dm{3-0};
1394 let Inst{5} = Dm{4};
1395 let Inst{19-16} = Dn{3-0};
1396 let Inst{7} = Dn{4};
1397 let Inst{15-12} = Dd{3-0};
1398 let Inst{22} = Dd{4};
1400 let Inst{27-23} = opcod1;
1401 let Inst{21-20} = opcod2;
1402 let Inst{11-9} = 0b101;
1403 let Inst{8} = 1; // Double precision
1408 // Single precision, unary
1409 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1410 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1411 string asm, list<dag> pattern>
1412 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1413 // Instruction operands.
1417 // Encode instruction operands.
1418 let Inst{3-0} = Sm{4-1};
1419 let Inst{5} = Sm{0};
1420 let Inst{15-12} = Sd{4-1};
1421 let Inst{22} = Sd{0};
1423 let Inst{27-23} = opcod1;
1424 let Inst{21-20} = opcod2;
1425 let Inst{19-16} = opcod3;
1426 let Inst{11-9} = 0b101;
1427 let Inst{8} = 0; // Single precision
1428 let Inst{7-6} = opcod4;
1429 let Inst{4} = opcod5;
1432 // Single precision unary, if no NEON
1433 // Same as ASuI except not available if NEON is enabled
1434 class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1435 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1436 string asm, list<dag> pattern>
1437 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1439 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1442 // Single precision, binary
1443 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1444 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1445 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1446 // Instruction operands.
1451 // Encode instruction operands.
1452 let Inst{3-0} = Sm{4-1};
1453 let Inst{5} = Sm{0};
1454 let Inst{19-16} = Sn{4-1};
1455 let Inst{7} = Sn{0};
1456 let Inst{15-12} = Sd{4-1};
1457 let Inst{22} = Sd{0};
1459 let Inst{27-23} = opcod1;
1460 let Inst{21-20} = opcod2;
1461 let Inst{11-9} = 0b101;
1462 let Inst{8} = 0; // Single precision
1467 // Single precision binary, if no NEON
1468 // Same as ASbI except not available if NEON is enabled
1469 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1470 dag iops, InstrItinClass itin, string opc, string asm,
1472 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1473 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1475 // Instruction operands.
1480 // Encode instruction operands.
1481 let Inst{3-0} = Sm{4-1};
1482 let Inst{5} = Sm{0};
1483 let Inst{19-16} = Sn{4-1};
1484 let Inst{7} = Sn{0};
1485 let Inst{15-12} = Sd{4-1};
1486 let Inst{22} = Sd{0};
1489 // VFP conversion instructions
1490 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1491 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1493 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1494 let Inst{27-23} = opcod1;
1495 let Inst{21-20} = opcod2;
1496 let Inst{19-16} = opcod3;
1497 let Inst{11-8} = opcod4;
1502 // VFP conversion between floating-point and fixed-point
1503 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1504 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1506 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1507 // size (fixed-point number): sx == 0 ? 16 : 32
1508 let Inst{7} = op5; // sx
1511 // VFP conversion instructions, if no NEON
1512 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1513 dag oops, dag iops, InstrItinClass itin,
1514 string opc, string asm, list<dag> pattern>
1515 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1517 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1520 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1521 InstrItinClass itin,
1522 string opc, string asm, list<dag> pattern>
1523 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1524 let Inst{27-20} = opcod1;
1525 let Inst{11-8} = opcod2;
1529 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1530 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1531 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1533 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1534 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1535 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1537 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1538 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1539 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1541 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1542 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1543 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1545 //===----------------------------------------------------------------------===//
1547 //===----------------------------------------------------------------------===//
1548 // ARM NEON Instruction templates.
1551 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1552 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1554 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
1555 let OutOperandList = oops;
1556 let InOperandList = !con(iops, (ins pred:$p));
1557 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1558 let Pattern = pattern;
1559 list<Predicate> Predicates = [HasNEON];
1562 // Same as NeonI except it does not have a "data type" specifier.
1563 class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1564 InstrItinClass itin, string opc, string asm, string cstr,
1566 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
1567 let OutOperandList = oops;
1568 let InOperandList = !con(iops, (ins pred:$p));
1569 let AsmString = !strconcat(opc, "${p}", "\t", asm);
1570 let Pattern = pattern;
1571 list<Predicate> Predicates = [HasNEON];
1574 class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1575 dag oops, dag iops, InstrItinClass itin,
1576 string opc, string dt, string asm, string cstr, list<dag> pattern>
1577 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1579 let Inst{31-24} = 0b11110100;
1580 let Inst{23} = op23;
1581 let Inst{21-20} = op21_20;
1582 let Inst{11-8} = op11_8;
1583 let Inst{7-4} = op7_4;
1585 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
1591 let Inst{22} = Vd{4};
1592 let Inst{15-12} = Vd{3-0};
1593 let Inst{19-16} = Rn{3-0};
1594 let Inst{3-0} = Rm{3-0};
1597 class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1598 dag oops, dag iops, InstrItinClass itin,
1599 string opc, string dt, string asm, string cstr, list<dag> pattern>
1600 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1601 dt, asm, cstr, pattern> {
1605 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1606 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1608 let OutOperandList = oops;
1609 let InOperandList = !con(iops, (ins pred:$p));
1610 list<Predicate> Predicates = [HasNEON];
1613 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1615 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1617 let OutOperandList = oops;
1618 let InOperandList = !con(iops, (ins pred:$p));
1619 let Pattern = pattern;
1620 list<Predicate> Predicates = [HasNEON];
1623 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1624 string opc, string dt, string asm, string cstr, list<dag> pattern>
1625 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1627 let Inst{31-25} = 0b1111001;
1628 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1631 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1632 string opc, string asm, string cstr, list<dag> pattern>
1633 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1635 let Inst{31-25} = 0b1111001;
1638 // NEON "one register and a modified immediate" format.
1639 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1641 dag oops, dag iops, InstrItinClass itin,
1642 string opc, string dt, string asm, string cstr,
1644 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1645 let Inst{23} = op23;
1646 let Inst{21-19} = op21_19;
1647 let Inst{11-8} = op11_8;
1653 // Instruction operands.
1657 let Inst{15-12} = Vd{3-0};
1658 let Inst{22} = Vd{4};
1659 let Inst{24} = SIMM{7};
1660 let Inst{18-16} = SIMM{6-4};
1661 let Inst{3-0} = SIMM{3-0};
1664 // NEON 2 vector register format.
1665 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1666 bits<5> op11_7, bit op6, bit op4,
1667 dag oops, dag iops, InstrItinClass itin,
1668 string opc, string dt, string asm, string cstr, list<dag> pattern>
1669 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1670 let Inst{24-23} = op24_23;
1671 let Inst{21-20} = op21_20;
1672 let Inst{19-18} = op19_18;
1673 let Inst{17-16} = op17_16;
1674 let Inst{11-7} = op11_7;
1678 // Instruction operands.
1682 let Inst{15-12} = Vd{3-0};
1683 let Inst{22} = Vd{4};
1684 let Inst{3-0} = Vm{3-0};
1685 let Inst{5} = Vm{4};
1688 // Same as N2V except it doesn't have a datatype suffix.
1689 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1690 bits<5> op11_7, bit op6, bit op4,
1691 dag oops, dag iops, InstrItinClass itin,
1692 string opc, string asm, string cstr, list<dag> pattern>
1693 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1694 let Inst{24-23} = op24_23;
1695 let Inst{21-20} = op21_20;
1696 let Inst{19-18} = op19_18;
1697 let Inst{17-16} = op17_16;
1698 let Inst{11-7} = op11_7;
1702 // Instruction operands.
1706 let Inst{15-12} = Vd{3-0};
1707 let Inst{22} = Vd{4};
1708 let Inst{3-0} = Vm{3-0};
1709 let Inst{5} = Vm{4};
1712 // NEON 2 vector register with immediate.
1713 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1714 dag oops, dag iops, Format f, InstrItinClass itin,
1715 string opc, string dt, string asm, string cstr, list<dag> pattern>
1716 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1717 let Inst{24} = op24;
1718 let Inst{23} = op23;
1719 let Inst{11-8} = op11_8;
1724 // Instruction operands.
1729 let Inst{15-12} = Vd{3-0};
1730 let Inst{22} = Vd{4};
1731 let Inst{3-0} = Vm{3-0};
1732 let Inst{5} = Vm{4};
1733 let Inst{21-16} = SIMM{5-0};
1736 // NEON 3 vector register format.
1737 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1738 dag oops, dag iops, Format f, InstrItinClass itin,
1739 string opc, string dt, string asm, string cstr, list<dag> pattern>
1740 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1741 let Inst{24} = op24;
1742 let Inst{23} = op23;
1743 let Inst{21-20} = op21_20;
1744 let Inst{11-8} = op11_8;
1748 // Instruction operands.
1753 let Inst{15-12} = Vd{3-0};
1754 let Inst{22} = Vd{4};
1755 let Inst{19-16} = Vn{3-0};
1756 let Inst{7} = Vn{4};
1757 let Inst{3-0} = Vm{3-0};
1758 let Inst{5} = Vm{4};
1761 // Same as N3V except it doesn't have a data type suffix.
1762 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1764 dag oops, dag iops, Format f, InstrItinClass itin,
1765 string opc, string asm, string cstr, list<dag> pattern>
1766 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1767 let Inst{24} = op24;
1768 let Inst{23} = op23;
1769 let Inst{21-20} = op21_20;
1770 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{19-16} = Vn{3-0};
1782 let Inst{7} = Vn{4};
1783 let Inst{3-0} = Vm{3-0};
1784 let Inst{5} = Vm{4};
1787 // NEON VMOVs between scalar and core registers.
1788 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1789 dag oops, dag iops, Format f, InstrItinClass itin,
1790 string opc, string dt, string asm, list<dag> pattern>
1791 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, NeonDomain,
1793 let Inst{27-20} = opcod1;
1794 let Inst{11-8} = opcod2;
1795 let Inst{6-5} = opcod3;
1798 let OutOperandList = oops;
1799 let InOperandList = !con(iops, (ins pred:$p));
1800 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1801 let Pattern = pattern;
1802 list<Predicate> Predicates = [HasNEON];
1804 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
1811 let Inst{31-28} = p{3-0};
1813 let Inst{19-16} = V{3-0};
1814 let Inst{15-12} = R{3-0};
1816 class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1817 dag oops, dag iops, InstrItinClass itin,
1818 string opc, string dt, string asm, list<dag> pattern>
1819 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
1820 opc, dt, asm, pattern>;
1821 class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1822 dag oops, dag iops, InstrItinClass itin,
1823 string opc, string dt, string asm, list<dag> pattern>
1824 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
1825 opc, dt, asm, pattern>;
1826 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1827 dag oops, dag iops, InstrItinClass itin,
1828 string opc, string dt, string asm, list<dag> pattern>
1829 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1830 opc, dt, asm, pattern>;
1832 // Vector Duplicate Lane (from scalar to all elements)
1833 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1834 InstrItinClass itin, string opc, string dt, string asm,
1836 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1837 let Inst{24-23} = 0b11;
1838 let Inst{21-20} = 0b11;
1839 let Inst{19-16} = op19_16;
1840 let Inst{11-7} = 0b11000;
1848 let Inst{22} = Vd{4};
1849 let Inst{15-12} = Vd{3-0};
1850 let Inst{5} = Vm{4};
1851 let Inst{3-0} = Vm{3-0};
1854 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1855 // for single-precision FP.
1856 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1857 list<Predicate> Predicates = [HasNEON,UseNEONForFP];