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>;
109 class SizeFlagVal<bits<3> val> {
112 def SizeInvalid : SizeFlagVal<0>; // Unset.
113 def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
114 def Size8Bytes : SizeFlagVal<2>;
115 def Size4Bytes : SizeFlagVal<3>;
116 def Size2Bytes : SizeFlagVal<4>;
118 // Load / store index mode.
119 class IndexMode<bits<2> val> {
122 def IndexModeNone : IndexMode<0>;
123 def IndexModePre : IndexMode<1>;
124 def IndexModePost : IndexMode<2>;
125 def IndexModeUpd : IndexMode<3>;
127 // Instruction execution domain.
128 class Domain<bits<2> val> {
131 def GenericDomain : Domain<0>;
132 def VFPDomain : Domain<1>; // Instructions in VFP domain only
133 def NeonDomain : Domain<2>; // Instructions in Neon domain only
134 def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
136 //===----------------------------------------------------------------------===//
138 // ARM special operands.
141 def CondCodeOperand : AsmOperandClass {
142 let Name = "CondCode";
143 let SuperClasses = [];
146 // ARM Predicate operand. Default to 14 = always (AL). Second part is CC
147 // register whose default is 0 (no register).
148 def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
149 (ops (i32 14), (i32 zero_reg))> {
150 let PrintMethod = "printPredicateOperand";
151 let ParserMatchClass = CondCodeOperand;
154 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
155 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
156 string EncoderMethod = "getCCOutOpValue";
157 let PrintMethod = "printSBitModifierOperand";
160 // Same as cc_out except it defaults to setting CPSR.
161 def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
162 string EncoderMethod = "getCCOutOpValue";
163 let PrintMethod = "printSBitModifierOperand";
166 // ARM special operands for disassembly only.
168 def setend_op : Operand<i32> {
169 let PrintMethod = "printSetendOperand";
172 def cps_opt : Operand<i32> {
173 let PrintMethod = "printCPSOptionOperand";
176 def msr_mask : Operand<i32> {
177 let PrintMethod = "printMSRMaskOperand";
180 // A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
181 // The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
182 def neg_zero : Operand<i32> {
183 let PrintMethod = "printNegZeroOperand";
186 //===----------------------------------------------------------------------===//
188 // ARM Instruction templates.
191 class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
192 Format f, Domain d, string cstr, InstrItinClass itin>
194 let Namespace = "ARM";
199 bits<2> IndexModeBits = IM.Value;
201 bits<6> Form = F.Value;
203 bit isUnaryDataProc = 0;
204 bit canXformTo16Bit = 0;
206 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
207 let TSFlags{4-0} = AM.Value;
208 let TSFlags{7-5} = SZ.Value;
209 let TSFlags{9-8} = IndexModeBits;
210 let TSFlags{15-10} = Form;
211 let TSFlags{16} = isUnaryDataProc;
212 let TSFlags{17} = canXformTo16Bit;
213 let TSFlags{19-18} = D.Value;
215 let Constraints = cstr;
216 let Itinerary = itin;
223 class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
224 Format f, Domain d, string cstr, InstrItinClass itin>
225 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
227 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
228 // on by adding flavors to specific instructions.
229 class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
230 Format f, Domain d, string cstr, InstrItinClass itin>
231 : InstTemplate<am, sz, im, f, d, cstr, itin>;
233 class PseudoInst<dag oops, dag iops, InstrItinClass itin,
234 string asm, list<dag> pattern>
235 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
237 let OutOperandList = oops;
238 let InOperandList = iops;
240 let Pattern = pattern;
243 // Almost all ARM instructions are predicable.
244 class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
245 IndexMode im, Format f, InstrItinClass itin,
246 string opc, string asm, string cstr,
248 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
251 let OutOperandList = oops;
252 let InOperandList = !con(iops, (ins pred:$p));
253 let AsmString = !strconcat(opc, "${p}", asm);
254 let Pattern = pattern;
255 list<Predicate> Predicates = [IsARM];
258 // A few are not predicable
259 class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
260 IndexMode im, Format f, InstrItinClass itin,
261 string opc, string asm, string cstr,
263 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
264 let OutOperandList = oops;
265 let InOperandList = iops;
266 let AsmString = !strconcat(opc, asm);
267 let Pattern = pattern;
268 let isPredicable = 0;
269 list<Predicate> Predicates = [IsARM];
272 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
273 // operand since by default it's a zero register. It will become an implicit def
274 // once it's "flipped".
275 class sI<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 bits<4> p; // Predicate operand
281 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
285 let OutOperandList = oops;
286 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
287 let AsmString = !strconcat(opc, "${s}${p}", asm);
288 let Pattern = pattern;
289 list<Predicate> Predicates = [IsARM];
293 class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
294 IndexMode im, Format f, InstrItinClass itin,
295 string asm, string cstr, list<dag> pattern>
296 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
297 let OutOperandList = oops;
298 let InOperandList = iops;
300 let Pattern = pattern;
301 list<Predicate> Predicates = [IsARM];
304 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
305 string opc, string asm, list<dag> pattern>
306 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
307 opc, asm, "", pattern>;
308 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
309 string opc, string asm, list<dag> pattern>
310 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
311 opc, asm, "", pattern>;
312 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
313 string asm, list<dag> pattern>
314 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
316 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
317 string opc, string asm, list<dag> pattern>
318 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
319 opc, asm, "", pattern>;
321 // Ctrl flow instructions
322 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
323 string opc, string asm, list<dag> pattern>
324 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
325 opc, asm, "", pattern> {
326 let Inst{27-24} = opcod;
328 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
329 string asm, list<dag> pattern>
330 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
332 let Inst{27-24} = opcod;
334 class ABXIx2<dag oops, dag iops, InstrItinClass itin,
335 string asm, list<dag> pattern>
336 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
339 // BR_JT instructions
340 class JTI<dag oops, dag iops, InstrItinClass itin,
341 string asm, list<dag> pattern>
342 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
345 // Atomic load/store instructions
346 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
347 string opc, string asm, list<dag> pattern>
348 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
349 opc, asm, "", pattern> {
350 let Inst{27-23} = 0b00011;
351 let Inst{22-21} = opcod;
353 let Inst{11-0} = 0b111110011111;
355 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
356 string opc, string asm, list<dag> pattern>
357 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
358 opc, asm, "", pattern> {
359 let Inst{27-23} = 0b00011;
360 let Inst{22-21} = opcod;
362 let Inst{11-4} = 0b11111001;
365 // addrmode1 instructions
366 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
367 string opc, string asm, list<dag> pattern>
368 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
369 opc, asm, "", pattern> {
370 let Inst{24-21} = opcod;
371 let Inst{27-26} = 0b00;
373 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
374 string opc, string asm, list<dag> pattern>
375 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
376 opc, asm, "", pattern> {
377 let Inst{24-21} = opcod;
378 let Inst{27-26} = 0b00;
380 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
381 string asm, list<dag> pattern>
382 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
384 let Inst{24-21} = opcod;
385 let Inst{27-26} = 0b00;
387 class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
388 string opc, string asm, list<dag> pattern>
389 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
390 opc, asm, "", pattern>;
393 // addrmode2 loads and stores
394 class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
395 string opc, string asm, list<dag> pattern>
396 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
397 opc, asm, "", pattern> {
398 let Inst{27-26} = 0b01;
402 class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
403 string opc, string asm, list<dag> pattern>
404 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
405 opc, asm, "", pattern> {
406 let Inst{20} = 1; // L bit
407 let Inst{21} = 0; // W bit
408 let Inst{22} = 0; // B bit
409 let Inst{24} = 1; // P bit
410 let Inst{27-26} = 0b01;
412 class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
413 string asm, list<dag> pattern>
414 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
416 let Inst{20} = 1; // L bit
417 let Inst{21} = 0; // W bit
418 let Inst{22} = 0; // B bit
419 let Inst{24} = 1; // P bit
420 let Inst{27-26} = 0b01;
422 class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
423 string opc, string asm, list<dag> pattern>
424 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
425 opc, asm, "", pattern> {
426 let Inst{20} = 1; // L bit
427 let Inst{21} = 0; // W bit
428 let Inst{22} = 1; // B bit
429 let Inst{24} = 1; // P bit
430 let Inst{27-26} = 0b01;
432 class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
433 string asm, list<dag> pattern>
434 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
436 let Inst{20} = 1; // L bit
437 let Inst{21} = 0; // W bit
438 let Inst{22} = 1; // B bit
439 let Inst{24} = 1; // P bit
440 let Inst{27-26} = 0b01;
444 class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
445 string opc, string asm, list<dag> pattern>
446 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
447 opc, asm, "", pattern> {
448 let Inst{20} = 0; // L bit
449 let Inst{21} = 0; // W bit
450 let Inst{22} = 0; // B bit
451 let Inst{24} = 1; // P bit
452 let Inst{27-26} = 0b01;
454 class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
455 string asm, list<dag> pattern>
456 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
458 let Inst{20} = 0; // L bit
459 let Inst{21} = 0; // W bit
460 let Inst{22} = 0; // B bit
461 let Inst{24} = 1; // P bit
462 let Inst{27-26} = 0b01;
464 class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
465 string opc, string asm, list<dag> pattern>
466 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
467 opc, asm, "", pattern> {
468 let Inst{20} = 0; // L bit
469 let Inst{21} = 0; // W bit
470 let Inst{22} = 1; // B bit
471 let Inst{24} = 1; // P bit
472 let Inst{27-26} = 0b01;
474 class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
475 string asm, list<dag> pattern>
476 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
478 let Inst{20} = 0; // L bit
479 let Inst{21} = 0; // W bit
480 let Inst{22} = 1; // B bit
481 let Inst{24} = 1; // P bit
482 let Inst{27-26} = 0b01;
486 class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
487 string opc, string asm, string cstr, list<dag> pattern>
488 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
489 opc, asm, cstr, pattern> {
490 let Inst{20} = 1; // L bit
491 let Inst{21} = 1; // W bit
492 let Inst{22} = 0; // B bit
493 let Inst{24} = 1; // P bit
494 let Inst{27-26} = 0b01;
496 class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
497 string opc, string asm, string cstr, list<dag> pattern>
498 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
499 opc, asm, cstr, pattern> {
500 let Inst{20} = 1; // L bit
501 let Inst{21} = 1; // W bit
502 let Inst{22} = 1; // B bit
503 let Inst{24} = 1; // P bit
504 let Inst{27-26} = 0b01;
507 // Pre-indexed stores
508 class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
509 string opc, string asm, string cstr, list<dag> pattern>
510 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
511 opc, asm, cstr, pattern> {
512 let Inst{20} = 0; // L bit
513 let Inst{21} = 1; // W bit
514 let Inst{22} = 0; // B bit
515 let Inst{24} = 1; // P bit
516 let Inst{27-26} = 0b01;
518 class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
519 string opc, string asm, string cstr, list<dag> pattern>
520 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
521 opc, asm, cstr, pattern> {
522 let Inst{20} = 0; // L bit
523 let Inst{21} = 1; // W bit
524 let Inst{22} = 1; // B bit
525 let Inst{24} = 1; // P bit
526 let Inst{27-26} = 0b01;
529 // Post-indexed loads
530 class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
531 string opc, string asm, string cstr, list<dag> pattern>
532 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
533 opc, asm, cstr,pattern> {
534 let Inst{20} = 1; // L bit
535 let Inst{21} = 0; // W bit
536 let Inst{22} = 0; // B bit
537 let Inst{24} = 0; // P bit
538 let Inst{27-26} = 0b01;
540 class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
541 string opc, string asm, string cstr, list<dag> pattern>
542 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
543 opc, asm, cstr,pattern> {
544 let Inst{20} = 1; // L bit
545 let Inst{21} = 0; // W bit
546 let Inst{22} = 1; // B bit
547 let Inst{24} = 0; // P bit
548 let Inst{27-26} = 0b01;
551 // Post-indexed stores
552 class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
553 string opc, string asm, string cstr, list<dag> pattern>
554 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
555 opc, asm, cstr,pattern> {
556 let Inst{20} = 0; // L bit
557 let Inst{21} = 0; // W bit
558 let Inst{22} = 0; // B bit
559 let Inst{24} = 0; // P bit
560 let Inst{27-26} = 0b01;
562 class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
563 string opc, string asm, string cstr, list<dag> pattern>
564 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
565 opc, asm, cstr,pattern> {
566 let Inst{20} = 0; // L bit
567 let Inst{21} = 0; // W bit
568 let Inst{22} = 1; // B bit
569 let Inst{24} = 0; // P bit
570 let Inst{27-26} = 0b01;
573 // addrmode3 instructions
574 class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
575 string opc, string asm, list<dag> pattern>
576 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
577 opc, asm, "", pattern>;
578 class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
579 string asm, list<dag> pattern>
580 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
584 class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
585 string opc, string asm, list<dag> pattern>
586 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
587 opc, asm, "", pattern> {
589 let Inst{5} = 1; // H bit
590 let Inst{6} = 0; // S bit
592 let Inst{20} = 1; // L bit
593 let Inst{21} = 0; // W bit
594 let Inst{24} = 1; // P bit
595 let Inst{27-25} = 0b000;
597 class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
598 string asm, list<dag> pattern>
599 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
602 let Inst{5} = 1; // H bit
603 let Inst{6} = 0; // S bit
605 let Inst{20} = 1; // L bit
606 let Inst{21} = 0; // W bit
607 let Inst{24} = 1; // P bit
609 class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
610 string opc, string asm, list<dag> pattern>
611 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
612 opc, asm, "", pattern> {
614 let Inst{5} = 1; // H bit
615 let Inst{6} = 1; // S bit
617 let Inst{20} = 1; // L bit
618 let Inst{21} = 0; // W bit
619 let Inst{24} = 1; // P bit
620 let Inst{27-25} = 0b000;
622 class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
623 string asm, list<dag> pattern>
624 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
627 let Inst{5} = 1; // H bit
628 let Inst{6} = 1; // S bit
630 let Inst{20} = 1; // L bit
631 let Inst{21} = 0; // W bit
632 let Inst{24} = 1; // P bit
634 class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
635 string opc, string asm, list<dag> pattern>
636 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
637 opc, asm, "", pattern> {
639 let Inst{5} = 0; // H bit
640 let Inst{6} = 1; // S bit
642 let Inst{20} = 1; // L bit
643 let Inst{21} = 0; // W bit
644 let Inst{24} = 1; // P bit
645 let Inst{27-25} = 0b000;
647 class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
648 string asm, list<dag> pattern>
649 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
652 let Inst{5} = 0; // H bit
653 let Inst{6} = 1; // S bit
655 let Inst{20} = 1; // L bit
656 let Inst{21} = 0; // W bit
657 let Inst{24} = 1; // P bit
659 class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
660 string opc, string asm, list<dag> pattern>
661 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
662 opc, asm, "", pattern> {
664 let Inst{5} = 0; // H bit
665 let Inst{6} = 1; // S bit
667 let Inst{20} = 0; // L bit
668 let Inst{21} = 0; // W bit
669 let Inst{24} = 1; // P bit
670 let Inst{27-25} = 0b000;
674 class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
675 string opc, string asm, list<dag> pattern>
676 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
677 opc, asm, "", pattern> {
679 let Inst{5} = 1; // H bit
680 let Inst{6} = 0; // S bit
682 let Inst{20} = 0; // L bit
683 let Inst{21} = 0; // W bit
684 let Inst{24} = 1; // P bit
685 let Inst{27-25} = 0b000;
687 class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
688 string asm, list<dag> pattern>
689 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
692 let Inst{5} = 1; // H bit
693 let Inst{6} = 0; // S bit
695 let Inst{20} = 0; // L bit
696 let Inst{21} = 0; // W bit
697 let Inst{24} = 1; // P bit
699 class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
700 string opc, string asm, list<dag> pattern>
701 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
702 opc, asm, "", pattern> {
704 let Inst{5} = 1; // H bit
705 let Inst{6} = 1; // S bit
707 let Inst{20} = 0; // L bit
708 let Inst{21} = 0; // W bit
709 let Inst{24} = 1; // P bit
710 let Inst{27-25} = 0b000;
714 class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
715 string opc, string asm, string cstr, list<dag> pattern>
716 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
717 opc, asm, cstr, pattern> {
719 let Inst{5} = 1; // H bit
720 let Inst{6} = 0; // S bit
722 let Inst{20} = 1; // L bit
723 let Inst{21} = 1; // W bit
724 let Inst{24} = 1; // P bit
725 let Inst{27-25} = 0b000;
727 class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
728 string opc, string asm, string cstr, list<dag> pattern>
729 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
730 opc, asm, cstr, pattern> {
732 let Inst{5} = 1; // H bit
733 let Inst{6} = 1; // S bit
735 let Inst{20} = 1; // L bit
736 let Inst{21} = 1; // W bit
737 let Inst{24} = 1; // P bit
738 let Inst{27-25} = 0b000;
740 class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
741 string opc, string asm, string cstr, list<dag> pattern>
742 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
743 opc, asm, cstr, pattern> {
745 let Inst{5} = 0; // H bit
746 let Inst{6} = 1; // S bit
748 let Inst{20} = 1; // L bit
749 let Inst{21} = 1; // W bit
750 let Inst{24} = 1; // P bit
751 let Inst{27-25} = 0b000;
753 class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
754 string opc, string asm, string cstr, list<dag> pattern>
755 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
756 opc, asm, cstr, pattern> {
758 let Inst{5} = 0; // H bit
759 let Inst{6} = 1; // S bit
761 let Inst{20} = 0; // L bit
762 let Inst{21} = 1; // W bit
763 let Inst{24} = 1; // P bit
764 let Inst{27-25} = 0b000;
768 // Pre-indexed stores
769 class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
770 string opc, string asm, string cstr, list<dag> pattern>
771 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
772 opc, asm, cstr, pattern> {
774 let Inst{5} = 1; // H bit
775 let Inst{6} = 0; // S bit
777 let Inst{20} = 0; // L bit
778 let Inst{21} = 1; // W bit
779 let Inst{24} = 1; // P bit
780 let Inst{27-25} = 0b000;
782 class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
783 string opc, string asm, string cstr, list<dag> pattern>
784 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
785 opc, asm, cstr, pattern> {
787 let Inst{5} = 1; // H bit
788 let Inst{6} = 1; // S bit
790 let Inst{20} = 0; // L bit
791 let Inst{21} = 1; // W bit
792 let Inst{24} = 1; // P bit
793 let Inst{27-25} = 0b000;
796 // Post-indexed loads
797 class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
798 string opc, string asm, string cstr, list<dag> pattern>
799 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
800 opc, asm, cstr,pattern> {
802 let Inst{5} = 1; // H bit
803 let Inst{6} = 0; // S bit
805 let Inst{20} = 1; // L bit
806 let Inst{21} = 0; // W bit
807 let Inst{24} = 0; // P bit
808 let Inst{27-25} = 0b000;
810 class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
811 string opc, string asm, string cstr, list<dag> pattern>
812 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
813 opc, asm, cstr,pattern> {
815 let Inst{5} = 1; // H bit
816 let Inst{6} = 1; // S bit
818 let Inst{20} = 1; // L bit
819 let Inst{21} = 0; // W bit
820 let Inst{24} = 0; // P bit
821 let Inst{27-25} = 0b000;
823 class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
824 string opc, string asm, string cstr, list<dag> pattern>
825 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
826 opc, asm, cstr,pattern> {
828 let Inst{5} = 0; // H bit
829 let Inst{6} = 1; // S bit
831 let Inst{20} = 1; // L bit
832 let Inst{21} = 0; // W bit
833 let Inst{24} = 0; // P bit
834 let Inst{27-25} = 0b000;
836 class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
837 string opc, string asm, string cstr, list<dag> pattern>
838 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
839 opc, asm, cstr, pattern> {
841 let Inst{5} = 0; // H bit
842 let Inst{6} = 1; // S bit
844 let Inst{20} = 0; // L bit
845 let Inst{21} = 0; // W bit
846 let Inst{24} = 0; // P bit
847 let Inst{27-25} = 0b000;
850 // Post-indexed stores
851 class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
852 string opc, string asm, string cstr, list<dag> pattern>
853 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
854 opc, asm, cstr,pattern> {
856 let Inst{5} = 1; // H bit
857 let Inst{6} = 0; // S bit
859 let Inst{20} = 0; // L bit
860 let Inst{21} = 0; // W bit
861 let Inst{24} = 0; // P bit
862 let Inst{27-25} = 0b000;
864 class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
865 string opc, string asm, string cstr, list<dag> pattern>
866 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
867 opc, asm, cstr, pattern> {
869 let Inst{5} = 1; // H bit
870 let Inst{6} = 1; // S bit
872 let Inst{20} = 0; // L bit
873 let Inst{21} = 0; // W bit
874 let Inst{24} = 0; // P bit
875 let Inst{27-25} = 0b000;
878 // addrmode4 instructions
879 class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
880 string asm, string cstr, list<dag> pattern>
881 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
882 asm, cstr, pattern> {
883 let Inst{20} = 1; // L bit
884 let Inst{22} = 0; // S bit
885 let Inst{27-25} = 0b100;
887 class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
888 string asm, string cstr, list<dag> pattern>
889 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
890 asm, cstr, pattern> {
891 let Inst{20} = 0; // L bit
892 let Inst{22} = 0; // S bit
893 let Inst{27-25} = 0b100;
896 // Unsigned multiply, multiply-accumulate instructions.
897 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
898 string opc, string asm, list<dag> pattern>
899 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
900 opc, asm, "", pattern> {
901 let Inst{7-4} = 0b1001;
902 let Inst{20} = 0; // S bit
903 let Inst{27-21} = opcod;
905 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
906 string opc, string asm, list<dag> pattern>
907 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
908 opc, asm, "", pattern> {
909 let Inst{7-4} = 0b1001;
910 let Inst{27-21} = opcod;
913 // Most significant word multiply
914 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
915 InstrItinClass itin, string opc, string asm, list<dag> pattern>
916 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
917 opc, asm, "", pattern> {
921 let Inst{7-4} = opc7_4;
923 let Inst{27-21} = opcod;
924 let Inst{19-16} = Rd;
928 // MSW multiple w/ Ra operand
929 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
930 InstrItinClass itin, string opc, string asm, list<dag> pattern>
931 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
933 let Inst{15-12} = Ra;
936 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
937 class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
938 string opc, string asm, list<dag> pattern>
939 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
940 opc, asm, "", pattern> {
944 let Inst{27-21} = opcod;
947 // Extend instructions.
948 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
949 string opc, string asm, list<dag> pattern>
950 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
951 opc, asm, "", pattern> {
952 // All AExtI instructions have Rd and Rm register operands.
955 let Inst{15-12} = Rd;
957 let Inst{7-4} = 0b0111;
958 let Inst{9-8} = 0b00;
959 let Inst{27-20} = opcod;
962 // Misc Arithmetic instructions.
963 class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
964 string opc, string asm, list<dag> pattern>
965 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
966 opc, asm, "", pattern> {
967 let Inst{27-20} = opcod;
970 //===----------------------------------------------------------------------===//
972 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
973 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
974 list<Predicate> Predicates = [IsARM];
976 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
977 list<Predicate> Predicates = [IsARM, HasV5TE];
979 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
980 list<Predicate> Predicates = [IsARM, HasV6];
983 //===----------------------------------------------------------------------===//
985 // Thumb Instruction Format Definitions.
988 // TI - Thumb instruction.
990 class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
991 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
992 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
993 let OutOperandList = oops;
994 let InOperandList = iops;
996 let Pattern = pattern;
997 list<Predicate> Predicates = [IsThumb];
1000 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1001 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1003 // Two-address instructions
1004 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
1006 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
1009 // tBL, tBX 32-bit instructions
1010 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
1011 dag oops, dag iops, InstrItinClass itin, string asm,
1013 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
1015 let Inst{31-27} = opcod1;
1016 let Inst{15-14} = opcod2;
1017 let Inst{12} = opcod3;
1020 // BR_JT instructions
1021 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1023 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
1026 class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1027 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
1028 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1029 let OutOperandList = oops;
1030 let InOperandList = iops;
1031 let AsmString = asm;
1032 let Pattern = pattern;
1033 list<Predicate> Predicates = [IsThumb1Only];
1036 class T1I<dag oops, dag iops, InstrItinClass itin,
1037 string asm, list<dag> pattern>
1038 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1039 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1040 string asm, list<dag> pattern>
1041 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1042 class T1JTI<dag oops, dag iops, InstrItinClass itin,
1043 string asm, list<dag> pattern>
1044 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
1046 // Two-address instructions
1047 class T1It<dag oops, dag iops, InstrItinClass itin,
1048 string asm, string cstr, list<dag> pattern>
1049 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
1050 asm, cstr, pattern>;
1052 // Thumb1 instruction that can either be predicated or set CPSR.
1053 class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1054 InstrItinClass itin,
1055 string opc, string asm, string cstr, list<dag> pattern>
1056 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1057 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1058 let InOperandList = !con(iops, (ins pred:$p));
1059 let AsmString = !strconcat(opc, "${s}${p}", asm);
1060 let Pattern = pattern;
1061 list<Predicate> Predicates = [IsThumb1Only];
1064 class T1sI<dag oops, dag iops, InstrItinClass itin,
1065 string opc, string asm, list<dag> pattern>
1066 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
1068 // Two-address instructions
1069 class T1sIt<dag oops, dag iops, InstrItinClass itin,
1070 string opc, string asm, list<dag> pattern>
1071 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
1072 "$lhs = $dst", pattern>;
1074 // Thumb1 instruction that can be predicated.
1075 class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1076 InstrItinClass itin,
1077 string opc, string asm, string cstr, list<dag> pattern>
1078 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1079 let OutOperandList = oops;
1080 let InOperandList = !con(iops, (ins pred:$p));
1081 let AsmString = !strconcat(opc, "${p}", asm);
1082 let Pattern = pattern;
1083 list<Predicate> Predicates = [IsThumb1Only];
1086 class T1pI<dag oops, dag iops, InstrItinClass itin,
1087 string opc, string asm, list<dag> pattern>
1088 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
1090 // Two-address instructions
1091 class T1pIt<dag oops, dag iops, InstrItinClass itin,
1092 string opc, string asm, list<dag> pattern>
1093 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
1094 "$lhs = $dst", pattern>;
1096 class T1pI1<dag oops, dag iops, InstrItinClass itin,
1097 string opc, string asm, list<dag> pattern>
1098 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1099 class T1pI2<dag oops, dag iops, InstrItinClass itin,
1100 string opc, string asm, list<dag> pattern>
1101 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1102 class T1pI4<dag oops, dag iops, InstrItinClass itin,
1103 string opc, string asm, list<dag> pattern>
1104 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1105 class T1pIs<dag oops, dag iops,
1106 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1107 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
1109 class Encoding16 : Encoding {
1110 let Inst{31-16} = 0x0000;
1113 // A6.2 16-bit Thumb instruction encoding
1114 class T1Encoding<bits<6> opcode> : Encoding16 {
1115 let Inst{15-10} = opcode;
1118 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
1119 class T1General<bits<5> opcode> : Encoding16 {
1120 let Inst{15-14} = 0b00;
1121 let Inst{13-9} = opcode;
1124 // A6.2.2 Data-processing encoding.
1125 class T1DataProcessing<bits<4> opcode> : Encoding16 {
1126 let Inst{15-10} = 0b010000;
1127 let Inst{9-6} = opcode;
1130 // A6.2.3 Special data instructions and branch and exchange encoding.
1131 class T1Special<bits<4> opcode> : Encoding16 {
1132 let Inst{15-10} = 0b010001;
1133 let Inst{9-6} = opcode;
1136 // A6.2.4 Load/store single data item encoding.
1137 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
1138 let Inst{15-12} = opA;
1139 let Inst{11-9} = opB;
1141 class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1142 class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1143 class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1144 class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1145 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1147 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1148 class T1Misc<bits<7> opcode> : Encoding16 {
1149 let Inst{15-12} = 0b1011;
1150 let Inst{11-5} = opcode;
1153 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1154 class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1155 InstrItinClass itin,
1156 string opc, string asm, string cstr, list<dag> pattern>
1157 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1158 let OutOperandList = oops;
1159 let InOperandList = !con(iops, (ins pred:$p));
1160 let AsmString = !strconcat(opc, "${p}", asm);
1161 let Pattern = pattern;
1162 list<Predicate> Predicates = [IsThumb2];
1165 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1166 // input operand since by default it's a zero register. It will become an
1167 // implicit def once it's "flipped".
1169 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1171 class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1172 InstrItinClass itin,
1173 string opc, string asm, string cstr, list<dag> pattern>
1174 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1175 let OutOperandList = oops;
1176 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1177 let AsmString = !strconcat(opc, "${s}${p}", asm);
1178 let Pattern = pattern;
1179 list<Predicate> Predicates = [IsThumb2];
1183 class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1184 InstrItinClass itin,
1185 string asm, string cstr, list<dag> pattern>
1186 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1187 let OutOperandList = oops;
1188 let InOperandList = iops;
1189 let AsmString = asm;
1190 let Pattern = pattern;
1191 list<Predicate> Predicates = [IsThumb2];
1194 class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1195 InstrItinClass itin,
1196 string asm, string cstr, list<dag> pattern>
1197 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1198 let OutOperandList = oops;
1199 let InOperandList = iops;
1200 let AsmString = asm;
1201 let Pattern = pattern;
1202 list<Predicate> Predicates = [IsThumb1Only];
1205 class T2I<dag oops, dag iops, InstrItinClass itin,
1206 string opc, string asm, list<dag> pattern>
1207 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1208 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1209 string opc, string asm, list<dag> pattern>
1210 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
1211 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1212 string opc, string asm, list<dag> pattern>
1213 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1214 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1215 string opc, string asm, list<dag> pattern>
1216 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1217 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1218 string opc, string asm, list<dag> pattern>
1219 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
1220 class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
1221 string opc, string asm, list<dag> pattern>
1222 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1224 let Inst{31-27} = 0b11101;
1225 let Inst{26-25} = 0b00;
1227 let Inst{23} = ?; // The U bit.
1230 let Inst{20} = load;
1233 class T2sI<dag oops, dag iops, InstrItinClass itin,
1234 string opc, string asm, list<dag> pattern>
1235 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1237 class T2XI<dag oops, dag iops, InstrItinClass itin,
1238 string asm, list<dag> pattern>
1239 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1240 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1241 string asm, list<dag> pattern>
1242 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
1244 class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1245 string opc, string asm, list<dag> pattern>
1246 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1248 // Two-address instructions
1249 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1250 string asm, string cstr, list<dag> pattern>
1251 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
1253 // T2Iidxldst - Thumb2 indexed load / store instructions.
1254 class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1256 AddrMode am, IndexMode im, InstrItinClass itin,
1257 string opc, string asm, string cstr, list<dag> pattern>
1258 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
1259 let OutOperandList = oops;
1260 let InOperandList = !con(iops, (ins pred:$p));
1261 let AsmString = !strconcat(opc, "${p}", asm);
1262 let Pattern = pattern;
1263 list<Predicate> Predicates = [IsThumb2];
1264 let Inst{31-27} = 0b11111;
1265 let Inst{26-25} = 0b00;
1266 let Inst{24} = signed;
1268 let Inst{22-21} = opcod;
1269 let Inst{20} = load;
1271 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1272 let Inst{10} = pre; // The P bit.
1273 let Inst{8} = 1; // The W bit.
1276 // Helper class for disassembly only
1277 // A6.3.16 & A6.3.17
1278 // T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1279 class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1280 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1281 : T2I<oops, iops, itin, opc, asm, pattern> {
1282 let Inst{31-27} = 0b11111;
1283 let Inst{26-24} = 0b011;
1284 let Inst{23} = long;
1285 let Inst{22-20} = op22_20;
1286 let Inst{7-4} = op7_4;
1289 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1290 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1291 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1294 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1295 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1296 list<Predicate> Predicates = [IsThumb1Only];
1299 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1300 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1301 list<Predicate> Predicates = [IsThumb2];
1304 //===----------------------------------------------------------------------===//
1306 //===----------------------------------------------------------------------===//
1307 // ARM VFP Instruction templates.
1310 // Almost all VFP instructions are predicable.
1311 class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1312 IndexMode im, Format f, InstrItinClass itin,
1313 string opc, string asm, string cstr, list<dag> pattern>
1314 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1316 let Inst{31-28} = p;
1317 let OutOperandList = oops;
1318 let InOperandList = !con(iops, (ins pred:$p));
1319 let AsmString = !strconcat(opc, "${p}", asm);
1320 let Pattern = pattern;
1321 list<Predicate> Predicates = [HasVFP2];
1325 class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1326 IndexMode im, Format f, InstrItinClass itin,
1327 string asm, string cstr, list<dag> pattern>
1328 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1329 let OutOperandList = oops;
1330 let InOperandList = iops;
1331 let AsmString = asm;
1332 let Pattern = pattern;
1333 list<Predicate> Predicates = [HasVFP2];
1336 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1337 string opc, string asm, list<dag> pattern>
1338 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1339 opc, asm, "", pattern>;
1341 // ARM VFP addrmode5 loads and stores
1342 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1343 InstrItinClass itin,
1344 string opc, string asm, list<dag> pattern>
1345 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
1346 VFPLdStFrm, itin, opc, asm, "", pattern> {
1347 // TODO: Mark the instructions with the appropriate subtarget info.
1348 let Inst{27-24} = opcod1;
1349 let Inst{21-20} = opcod2;
1350 let Inst{11-9} = 0b101;
1351 let Inst{8} = 1; // Double precision
1353 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1354 let D = VFPNeonDomain;
1357 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1358 InstrItinClass itin,
1359 string opc, string asm, list<dag> pattern>
1360 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
1361 VFPLdStFrm, itin, opc, asm, "", pattern> {
1362 // TODO: Mark the instructions with the appropriate subtarget info.
1363 let Inst{27-24} = opcod1;
1364 let Inst{21-20} = opcod2;
1365 let Inst{11-9} = 0b101;
1366 let Inst{8} = 0; // Single precision
1369 // VFP Load / store multiple pseudo instructions.
1370 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1372 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1374 let OutOperandList = oops;
1375 let InOperandList = !con(iops, (ins pred:$p));
1376 let Pattern = pattern;
1377 list<Predicate> Predicates = [HasVFP2];
1380 // Load / store multiple
1381 class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1382 string asm, string cstr, list<dag> pattern>
1383 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
1384 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1385 // TODO: Mark the instructions with the appropriate subtarget info.
1386 let Inst{27-25} = 0b110;
1387 let Inst{11-9} = 0b101;
1388 let Inst{8} = 1; // Double precision
1390 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1391 let D = VFPNeonDomain;
1394 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1395 string asm, string cstr, list<dag> pattern>
1396 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
1397 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1398 // TODO: Mark the instructions with the appropriate subtarget info.
1399 let Inst{27-25} = 0b110;
1400 let Inst{11-9} = 0b101;
1401 let Inst{8} = 0; // Single precision
1404 // Double precision, unary
1405 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1406 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1407 string asm, list<dag> pattern>
1408 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1409 let Inst{27-23} = opcod1;
1410 let Inst{21-20} = opcod2;
1411 let Inst{19-16} = opcod3;
1412 let Inst{11-9} = 0b101;
1413 let Inst{8} = 1; // Double precision
1414 let Inst{7-6} = opcod4;
1415 let Inst{4} = opcod5;
1418 // Double precision, binary
1419 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1420 dag iops, InstrItinClass itin, string opc, string asm,
1422 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1423 let Inst{27-23} = opcod1;
1424 let Inst{21-20} = opcod2;
1425 let Inst{11-9} = 0b101;
1426 let Inst{8} = 1; // Double precision
1431 // Double precision, binary, VML[AS] (for additional predicate)
1432 class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1433 dag iops, InstrItinClass itin, string opc, string asm,
1435 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1436 let Inst{27-23} = opcod1;
1437 let Inst{21-20} = opcod2;
1438 let Inst{11-9} = 0b101;
1439 let Inst{8} = 1; // Double precision
1442 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1445 // Single precision, unary
1446 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1447 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1448 string asm, list<dag> pattern>
1449 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1450 let Inst{27-23} = opcod1;
1451 let Inst{21-20} = opcod2;
1452 let Inst{19-16} = opcod3;
1453 let Inst{11-9} = 0b101;
1454 let Inst{8} = 0; // Single precision
1455 let Inst{7-6} = opcod4;
1456 let Inst{4} = opcod5;
1459 // Single precision unary, if no NEON
1460 // Same as ASuI except not available if NEON is enabled
1461 class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1462 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1463 string asm, list<dag> pattern>
1464 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1466 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1469 // Single precision, binary
1470 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1471 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1472 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1473 let Inst{27-23} = opcod1;
1474 let Inst{21-20} = opcod2;
1475 let Inst{11-9} = 0b101;
1476 let Inst{8} = 0; // Single precision
1481 // Single precision binary, if no NEON
1482 // Same as ASbI except not available if NEON is enabled
1483 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1484 dag iops, InstrItinClass itin, string opc, string asm,
1486 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1487 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1490 // VFP conversion instructions
1491 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1492 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1494 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1495 let Inst{27-23} = opcod1;
1496 let Inst{21-20} = opcod2;
1497 let Inst{19-16} = opcod3;
1498 let Inst{11-8} = opcod4;
1503 // VFP conversion between floating-point and fixed-point
1504 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1505 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1507 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1508 // size (fixed-point number): sx == 0 ? 16 : 32
1509 let Inst{7} = op5; // sx
1512 // VFP conversion instructions, if no NEON
1513 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1514 dag oops, dag iops, InstrItinClass itin,
1515 string opc, string asm, list<dag> pattern>
1516 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1518 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1521 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1522 InstrItinClass itin,
1523 string opc, string asm, list<dag> pattern>
1524 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1525 let Inst{27-20} = opcod1;
1526 let Inst{11-8} = opcod2;
1530 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1531 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1532 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1534 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1535 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1536 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1538 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1539 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1540 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1542 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1543 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1544 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1546 //===----------------------------------------------------------------------===//
1548 //===----------------------------------------------------------------------===//
1549 // ARM NEON Instruction templates.
1552 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1553 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1555 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
1556 let OutOperandList = oops;
1557 let InOperandList = !con(iops, (ins pred:$p));
1558 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1559 let Pattern = pattern;
1560 list<Predicate> Predicates = [HasNEON];
1563 // Same as NeonI except it does not have a "data type" specifier.
1564 class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1565 InstrItinClass itin, string opc, string asm, string cstr,
1567 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
1568 let OutOperandList = oops;
1569 let InOperandList = !con(iops, (ins pred:$p));
1570 let AsmString = !strconcat(opc, "${p}", "\t", asm);
1571 let Pattern = pattern;
1572 list<Predicate> Predicates = [HasNEON];
1575 class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1576 dag oops, dag iops, InstrItinClass itin,
1577 string opc, string dt, string asm, string cstr, list<dag> pattern>
1578 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1580 let Inst{31-24} = 0b11110100;
1581 let Inst{23} = op23;
1582 let Inst{21-20} = op21_20;
1583 let Inst{11-8} = op11_8;
1584 let Inst{7-4} = op7_4;
1587 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1588 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1590 let OutOperandList = oops;
1591 let InOperandList = !con(iops, (ins pred:$p));
1592 list<Predicate> Predicates = [HasNEON];
1595 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1597 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1599 let OutOperandList = oops;
1600 let InOperandList = !con(iops, (ins pred:$p));
1601 let Pattern = pattern;
1602 list<Predicate> Predicates = [HasNEON];
1605 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1606 string opc, string dt, string asm, string cstr, list<dag> pattern>
1607 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1609 let Inst{31-25} = 0b1111001;
1612 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1613 string opc, string asm, string cstr, list<dag> pattern>
1614 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1616 let Inst{31-25} = 0b1111001;
1619 // NEON "one register and a modified immediate" format.
1620 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1622 dag oops, dag iops, InstrItinClass itin,
1623 string opc, string dt, string asm, string cstr,
1625 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1626 let Inst{23} = op23;
1627 let Inst{21-19} = op21_19;
1628 let Inst{11-8} = op11_8;
1635 // NEON 2 vector register format.
1636 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1637 bits<5> op11_7, bit op6, bit op4,
1638 dag oops, dag iops, InstrItinClass itin,
1639 string opc, string dt, string asm, string cstr, list<dag> pattern>
1640 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1641 let Inst{24-23} = op24_23;
1642 let Inst{21-20} = op21_20;
1643 let Inst{19-18} = op19_18;
1644 let Inst{17-16} = op17_16;
1645 let Inst{11-7} = op11_7;
1650 // Same as N2V except it doesn't have a datatype suffix.
1651 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1652 bits<5> op11_7, bit op6, bit op4,
1653 dag oops, dag iops, InstrItinClass itin,
1654 string opc, string asm, string cstr, list<dag> pattern>
1655 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1656 let Inst{24-23} = op24_23;
1657 let Inst{21-20} = op21_20;
1658 let Inst{19-18} = op19_18;
1659 let Inst{17-16} = op17_16;
1660 let Inst{11-7} = op11_7;
1665 // NEON 2 vector register with immediate.
1666 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1667 dag oops, dag iops, Format f, InstrItinClass itin,
1668 string opc, string dt, string asm, string cstr, list<dag> pattern>
1669 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1670 let Inst{24} = op24;
1671 let Inst{23} = op23;
1672 let Inst{11-8} = op11_8;
1678 // NEON 3 vector register format.
1679 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1680 dag oops, dag iops, Format f, InstrItinClass itin,
1681 string opc, string dt, string asm, string cstr, list<dag> pattern>
1682 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1683 let Inst{24} = op24;
1684 let Inst{23} = op23;
1685 let Inst{21-20} = op21_20;
1686 let Inst{11-8} = op11_8;
1690 // Instruction operands.
1695 let Inst{15-12} = Vd{3-0};
1696 let Inst{22} = Vd{4};
1697 let Inst{19-16} = Vn{3-0};
1698 let Inst{7} = Vn{4};
1699 let Inst{3-0} = Vm{3-0};
1700 let Inst{5} = Vm{4};
1703 // Same as N3V except it doesn't have a data type suffix.
1704 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1706 dag oops, dag iops, Format f, InstrItinClass itin,
1707 string opc, string asm, string cstr, list<dag> pattern>
1708 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1709 let Inst{24} = op24;
1710 let Inst{23} = op23;
1711 let Inst{21-20} = op21_20;
1712 let Inst{11-8} = op11_8;
1717 // NEON VMOVs between scalar and core registers.
1718 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1719 dag oops, dag iops, Format f, InstrItinClass itin,
1720 string opc, string dt, string asm, list<dag> pattern>
1721 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
1723 let Inst{27-20} = opcod1;
1724 let Inst{11-8} = opcod2;
1725 let Inst{6-5} = opcod3;
1728 let OutOperandList = oops;
1729 let InOperandList = !con(iops, (ins pred:$p));
1730 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1731 let Pattern = pattern;
1732 list<Predicate> Predicates = [HasNEON];
1734 class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1735 dag oops, dag iops, InstrItinClass itin,
1736 string opc, string dt, string asm, list<dag> pattern>
1737 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
1738 opc, dt, asm, pattern>;
1739 class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1740 dag oops, dag iops, InstrItinClass itin,
1741 string opc, string dt, string asm, list<dag> pattern>
1742 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
1743 opc, dt, asm, pattern>;
1744 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1745 dag oops, dag iops, InstrItinClass itin,
1746 string opc, string dt, string asm, list<dag> pattern>
1747 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1748 opc, dt, asm, pattern>;
1750 // Vector Duplicate Lane (from scalar to all elements)
1751 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1752 InstrItinClass itin, string opc, string dt, string asm,
1754 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1755 let Inst{24-23} = 0b11;
1756 let Inst{21-20} = 0b11;
1757 let Inst{19-16} = op19_16;
1758 let Inst{11-7} = 0b11000;
1763 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1764 // for single-precision FP.
1765 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1766 list<Predicate> Predicates = [HasNEON,UseNEONForFP];