1 //===- ARMInstrFormats.td - ARM Instruction Formats ----------*- tablegen -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 // ARM Instruction Format Definitions.
15 // Format specifies the encoding used by the instruction. This is part of the
16 // ad-hoc solution used to emit machine instruction encodings by our machine
18 class Format<bits<6> val> {
22 def Pseudo : Format<0>;
23 def MulFrm : Format<1>;
24 def BrFrm : Format<2>;
25 def BrMiscFrm : Format<3>;
27 def DPFrm : Format<4>;
28 def DPSoRegRegFrm : Format<5>;
30 def LdFrm : Format<6>;
31 def StFrm : Format<7>;
32 def LdMiscFrm : Format<8>;
33 def StMiscFrm : Format<9>;
34 def LdStMulFrm : Format<10>;
36 def LdStExFrm : Format<11>;
38 def ArithMiscFrm : Format<12>;
39 def SatFrm : Format<13>;
40 def ExtFrm : Format<14>;
42 def VFPUnaryFrm : Format<15>;
43 def VFPBinaryFrm : Format<16>;
44 def VFPConv1Frm : Format<17>;
45 def VFPConv2Frm : Format<18>;
46 def VFPConv3Frm : Format<19>;
47 def VFPConv4Frm : Format<20>;
48 def VFPConv5Frm : Format<21>;
49 def VFPLdStFrm : Format<22>;
50 def VFPLdStMulFrm : Format<23>;
51 def VFPMiscFrm : Format<24>;
53 def ThumbFrm : Format<25>;
54 def MiscFrm : Format<26>;
56 def NGetLnFrm : Format<27>;
57 def NSetLnFrm : Format<28>;
58 def NDupFrm : Format<29>;
59 def NLdStFrm : Format<30>;
60 def N1RegModImmFrm: Format<31>;
61 def N2RegFrm : Format<32>;
62 def NVCVTFrm : Format<33>;
63 def NVDupLnFrm : Format<34>;
64 def N2RegVShLFrm : Format<35>;
65 def N2RegVShRFrm : Format<36>;
66 def N3RegFrm : Format<37>;
67 def N3RegVShFrm : Format<38>;
68 def NVExtFrm : Format<39>;
69 def NVMulSLFrm : Format<40>;
70 def NVTBLFrm : Format<41>;
71 def DPSoRegImmFrm : Format<42>;
75 // The instruction has an Rn register operand.
76 // UnaryDP - Indicates this is a unary data processing instruction, i.e.
77 // it doesn't have a Rn operand.
78 class UnaryDP { bit isUnaryDataProc = 1; }
80 // Xform16Bit - Indicates this Thumb2 instruction may be transformed into
81 // a 16-bit Thumb instruction if certain conditions are met.
82 class Xform16Bit { bit canXformTo16Bit = 1; }
84 //===----------------------------------------------------------------------===//
85 // ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
88 // FIXME: Once the JIT is MC-ized, these can go away.
90 class AddrMode<bits<5> val> {
93 def AddrModeNone : AddrMode<0>;
94 def AddrMode1 : AddrMode<1>;
95 def AddrMode2 : AddrMode<2>;
96 def AddrMode3 : AddrMode<3>;
97 def AddrMode4 : AddrMode<4>;
98 def AddrMode5 : AddrMode<5>;
99 def AddrMode6 : AddrMode<6>;
100 def AddrModeT1_1 : AddrMode<7>;
101 def AddrModeT1_2 : AddrMode<8>;
102 def AddrModeT1_4 : AddrMode<9>;
103 def AddrModeT1_s : AddrMode<10>;
104 def AddrModeT2_i12 : AddrMode<11>;
105 def AddrModeT2_i8 : AddrMode<12>;
106 def AddrModeT2_so : AddrMode<13>;
107 def AddrModeT2_pc : AddrMode<14>;
108 def AddrModeT2_i8s4 : AddrMode<15>;
109 def AddrMode_i12 : AddrMode<16>;
111 // Load / store index mode.
112 class IndexMode<bits<2> val> {
115 def IndexModeNone : IndexMode<0>;
116 def IndexModePre : IndexMode<1>;
117 def IndexModePost : IndexMode<2>;
118 def IndexModeUpd : IndexMode<3>;
120 // Instruction execution domain.
121 class Domain<bits<3> val> {
124 def GenericDomain : Domain<0>;
125 def VFPDomain : Domain<1>; // Instructions in VFP domain only
126 def NeonDomain : Domain<2>; // Instructions in Neon domain only
127 def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
128 def VFPNeonA8Domain : Domain<5>; // Instructions in VFP & Neon under A8
130 //===----------------------------------------------------------------------===//
131 // ARM special operands.
134 // ARM imod and iflag operands, used only by the CPS instruction.
135 def imod_op : Operand<i32> {
136 let PrintMethod = "printCPSIMod";
137 let DecoderMethod = "DecodeCPSIMod";
140 def ProcIFlagsOperand : AsmOperandClass {
141 let Name = "ProcIFlags";
142 let ParserMethod = "parseProcIFlagsOperand";
144 def iflags_op : Operand<i32> {
145 let PrintMethod = "printCPSIFlag";
146 let ParserMatchClass = ProcIFlagsOperand;
149 // ARM Predicate operand. Default to 14 = always (AL). Second part is CC
150 // register whose default is 0 (no register).
151 def CondCodeOperand : AsmOperandClass { let Name = "CondCode"; }
152 def pred : PredicateOperand<OtherVT, (ops i32imm, i32imm),
153 (ops (i32 14), (i32 zero_reg))> {
154 let PrintMethod = "printPredicateOperand";
155 let ParserMatchClass = CondCodeOperand;
156 let DecoderMethod = "DecodePredicateOperand";
159 // Conditional code result for instructions whose 's' bit is set, e.g. subs.
160 def CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
161 def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
162 let EncoderMethod = "getCCOutOpValue";
163 let PrintMethod = "printSBitModifierOperand";
164 let ParserMatchClass = CCOutOperand;
165 let DecoderMethod = "DecodeCCOutOperand";
168 // Same as cc_out except it defaults to setting CPSR.
169 def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
170 let EncoderMethod = "getCCOutOpValue";
171 let PrintMethod = "printSBitModifierOperand";
172 let ParserMatchClass = CCOutOperand;
173 let DecoderMethod = "DecodeCCOutOperand";
176 // ARM special operands for disassembly only.
178 def SetEndAsmOperand : AsmOperandClass {
179 let Name = "SetEndImm";
180 let ParserMethod = "parseSetEndImm";
182 def setend_op : Operand<i32> {
183 let PrintMethod = "printSetendOperand";
184 let ParserMatchClass = SetEndAsmOperand;
187 def MSRMaskOperand : AsmOperandClass {
188 let Name = "MSRMask";
189 let ParserMethod = "parseMSRMaskOperand";
191 def msr_mask : Operand<i32> {
192 let PrintMethod = "printMSRMaskOperand";
193 let DecoderMethod = "DecodeMSRMask";
194 let ParserMatchClass = MSRMaskOperand;
197 // Shift Right Immediate - A shift right immediate is encoded differently from
198 // other shift immediates. The imm6 field is encoded like so:
201 // 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
202 // 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
203 // 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
204 // 64 64 - <imm> is encoded in imm6<5:0>
205 def shr_imm8 : Operand<i32> {
206 let EncoderMethod = "getShiftRight8Imm";
207 let DecoderMethod = "DecodeShiftRight8Imm";
209 def shr_imm16 : Operand<i32> {
210 let EncoderMethod = "getShiftRight16Imm";
211 let DecoderMethod = "DecodeShiftRight16Imm";
213 def shr_imm32 : Operand<i32> {
214 let EncoderMethod = "getShiftRight32Imm";
215 let DecoderMethod = "DecodeShiftRight32Imm";
217 def shr_imm64 : Operand<i32> {
218 let EncoderMethod = "getShiftRight64Imm";
219 let DecoderMethod = "DecodeShiftRight64Imm";
222 //===----------------------------------------------------------------------===//
223 // ARM Assembler alias templates.
225 class ARMInstAlias<string Asm, dag Result, bit Emit = 0b1>
226 : InstAlias<Asm, Result, Emit>, Requires<[IsARM]>;
227 class tInstAlias<string Asm, dag Result, bit Emit = 0b1>
228 : InstAlias<Asm, Result, Emit>, Requires<[IsThumb]>;
229 class t2InstAlias<string Asm, dag Result, bit Emit = 0b1>
230 : InstAlias<Asm, Result, Emit>, Requires<[IsThumb2]>;
232 //===----------------------------------------------------------------------===//
233 // ARM Instruction templates.
237 class InstTemplate<AddrMode am, int sz, IndexMode im,
238 Format f, Domain d, string cstr, InstrItinClass itin>
240 let Namespace = "ARM";
245 bits<2> IndexModeBits = IM.Value;
247 bits<6> Form = F.Value;
249 bit isUnaryDataProc = 0;
250 bit canXformTo16Bit = 0;
251 // The instruction is a 16-bit flag setting Thumb instruction. Used
252 // by the parser to determine whether to require the 'S' suffix on the
253 // mnemonic (when not in an IT block) or preclude it (when in an IT block).
254 bit thumbArithFlagSetting = 0;
256 // If this is a pseudo instruction, mark it isCodeGenOnly.
257 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
259 // The layout of TSFlags should be kept in sync with ARMBaseInfo.h.
260 let TSFlags{4-0} = AM.Value;
261 let TSFlags{6-5} = IndexModeBits;
262 let TSFlags{12-7} = Form;
263 let TSFlags{13} = isUnaryDataProc;
264 let TSFlags{14} = canXformTo16Bit;
265 let TSFlags{17-15} = D.Value;
266 let TSFlags{18} = thumbArithFlagSetting;
268 let Constraints = cstr;
269 let Itinerary = itin;
276 class InstARM<AddrMode am, int sz, IndexMode im,
277 Format f, Domain d, string cstr, InstrItinClass itin>
278 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
279 let DecoderNamespace = "ARM";
282 // This Encoding-less class is used by Thumb1 to specify the encoding bits later
283 // on by adding flavors to specific instructions.
284 class InstThumb<AddrMode am, int sz, IndexMode im,
285 Format f, Domain d, string cstr, InstrItinClass itin>
286 : InstTemplate<am, sz, im, f, d, cstr, itin> {
287 let DecoderNamespace = "Thumb";
290 class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
291 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
292 GenericDomain, "", itin> {
293 let OutOperandList = oops;
294 let InOperandList = iops;
295 let Pattern = pattern;
296 let isCodeGenOnly = 1;
300 // PseudoInst that's ARM-mode only.
301 class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
303 : PseudoInst<oops, iops, itin, pattern> {
305 list<Predicate> Predicates = [IsARM];
308 // PseudoInst that's Thumb-mode only.
309 class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
311 : PseudoInst<oops, iops, itin, pattern> {
313 list<Predicate> Predicates = [IsThumb];
316 // PseudoInst that's Thumb2-mode only.
317 class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
319 : PseudoInst<oops, iops, itin, pattern> {
321 list<Predicate> Predicates = [IsThumb2];
324 class ARMPseudoExpand<dag oops, dag iops, int sz,
325 InstrItinClass itin, list<dag> pattern,
327 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
328 PseudoInstExpansion<Result>;
330 class tPseudoExpand<dag oops, dag iops, int sz,
331 InstrItinClass itin, list<dag> pattern,
333 : tPseudoInst<oops, iops, sz, itin, pattern>,
334 PseudoInstExpansion<Result>;
336 class t2PseudoExpand<dag oops, dag iops, int sz,
337 InstrItinClass itin, list<dag> pattern,
339 : t2PseudoInst<oops, iops, sz, itin, pattern>,
340 PseudoInstExpansion<Result>;
342 // Almost all ARM instructions are predicable.
343 class I<dag oops, dag iops, AddrMode am, int sz,
344 IndexMode im, Format f, InstrItinClass itin,
345 string opc, string asm, string cstr,
347 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
350 let OutOperandList = oops;
351 let InOperandList = !con(iops, (ins pred:$p));
352 let AsmString = !strconcat(opc, "${p}", asm);
353 let Pattern = pattern;
354 list<Predicate> Predicates = [IsARM];
357 // A few are not predicable
358 class InoP<dag oops, dag iops, AddrMode am, int sz,
359 IndexMode im, Format f, InstrItinClass itin,
360 string opc, string asm, string cstr,
362 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
363 let OutOperandList = oops;
364 let InOperandList = iops;
365 let AsmString = !strconcat(opc, asm);
366 let Pattern = pattern;
367 let isPredicable = 0;
368 list<Predicate> Predicates = [IsARM];
371 // Same as I except it can optionally modify CPSR. Note it's modeled as an input
372 // operand since by default it's a zero register. It will become an implicit def
373 // once it's "flipped".
374 class sI<dag oops, dag iops, AddrMode am, int sz,
375 IndexMode im, Format f, InstrItinClass itin,
376 string opc, string asm, string cstr,
378 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
379 bits<4> p; // Predicate operand
380 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
384 let OutOperandList = oops;
385 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
386 let AsmString = !strconcat(opc, "${s}${p}", asm);
387 let Pattern = pattern;
388 list<Predicate> Predicates = [IsARM];
392 class XI<dag oops, dag iops, AddrMode am, int sz,
393 IndexMode im, Format f, InstrItinClass itin,
394 string asm, string cstr, list<dag> pattern>
395 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
396 let OutOperandList = oops;
397 let InOperandList = iops;
399 let Pattern = pattern;
400 list<Predicate> Predicates = [IsARM];
403 class AI<dag oops, dag iops, Format f, InstrItinClass itin,
404 string opc, string asm, list<dag> pattern>
405 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
406 opc, asm, "", pattern>;
407 class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
408 string opc, string asm, list<dag> pattern>
409 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
410 opc, asm, "", pattern>;
411 class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
412 string asm, list<dag> pattern>
413 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
415 class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
416 string opc, string asm, list<dag> pattern>
417 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
418 opc, asm, "", pattern>;
420 // Ctrl flow instructions
421 class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
422 string opc, string asm, list<dag> pattern>
423 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
424 opc, asm, "", pattern> {
425 let Inst{27-24} = opcod;
427 class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
428 string asm, list<dag> pattern>
429 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
431 let Inst{27-24} = opcod;
434 // BR_JT instructions
435 class JTI<dag oops, dag iops, InstrItinClass itin,
436 string asm, list<dag> pattern>
437 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
440 // Atomic load/store instructions
441 class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
442 string opc, string asm, list<dag> pattern>
443 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
444 opc, asm, "", pattern> {
447 let Inst{27-23} = 0b00011;
448 let Inst{22-21} = opcod;
450 let Inst{19-16} = addr;
451 let Inst{15-12} = Rt;
452 let Inst{11-0} = 0b111110011111;
454 class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
455 string opc, string asm, list<dag> pattern>
456 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
457 opc, asm, "", pattern> {
461 let Inst{27-23} = 0b00011;
462 let Inst{22-21} = opcod;
464 let Inst{19-16} = addr;
465 let Inst{15-12} = Rd;
466 let Inst{11-4} = 0b11111001;
469 class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
470 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
474 let Inst{27-23} = 0b00010;
476 let Inst{21-20} = 0b00;
477 let Inst{19-16} = addr;
478 let Inst{15-12} = Rt;
479 let Inst{11-4} = 0b00001001;
483 // addrmode1 instructions
484 class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
485 string opc, string asm, list<dag> pattern>
486 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
487 opc, asm, "", pattern> {
488 let Inst{24-21} = opcod;
489 let Inst{27-26} = 0b00;
491 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
492 string opc, string asm, list<dag> pattern>
493 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
494 opc, asm, "", pattern> {
495 let Inst{24-21} = opcod;
496 let Inst{27-26} = 0b00;
498 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
499 string asm, list<dag> pattern>
500 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
502 let Inst{24-21} = opcod;
503 let Inst{27-26} = 0b00;
508 // LDR/LDRB/STR/STRB/...
509 class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
510 Format f, InstrItinClass itin, string opc, string asm,
512 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
514 let Inst{27-25} = op;
515 let Inst{24} = 1; // 24 == P
517 let Inst{22} = isByte;
518 let Inst{21} = 0; // 21 == W
521 // Indexed load/stores
522 class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
523 IndexMode im, Format f, InstrItinClass itin, string opc,
524 string asm, string cstr, list<dag> pattern>
525 : I<oops, iops, AddrMode2, 4, im, f, itin,
526 opc, asm, cstr, pattern> {
528 let Inst{27-26} = 0b01;
529 let Inst{24} = isPre; // P bit
530 let Inst{22} = isByte; // B bit
531 let Inst{21} = isPre; // W bit
532 let Inst{20} = isLd; // L bit
533 let Inst{15-12} = Rt;
535 class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
536 IndexMode im, Format f, InstrItinClass itin, string opc,
537 string asm, string cstr, list<dag> pattern>
538 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
540 // AM2 store w/ two operands: (GPR, am2offset)
546 let Inst{23} = offset{12};
547 let Inst{19-16} = Rn;
548 let Inst{11-5} = offset{11-5};
550 let Inst{3-0} = offset{3-0};
553 class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
554 IndexMode im, Format f, InstrItinClass itin, string opc,
555 string asm, string cstr, list<dag> pattern>
556 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
558 // AM2 store w/ two operands: (GPR, am2offset)
564 let Inst{23} = offset{12};
565 let Inst{19-16} = Rn;
566 let Inst{11-0} = offset{11-0};
570 // FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
571 // but for now use this class for STRT and STRBT.
572 class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
573 IndexMode im, Format f, InstrItinClass itin, string opc,
574 string asm, string cstr, list<dag> pattern>
575 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
577 // AM2 store w/ two operands: (GPR, am2offset)
579 // {13} 1 == Rm, 0 == imm12
583 let Inst{25} = addr{13};
584 let Inst{23} = addr{12};
585 let Inst{19-16} = addr{17-14};
586 let Inst{11-0} = addr{11-0};
589 // addrmode3 instructions
590 class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
591 InstrItinClass itin, string opc, string asm, list<dag> pattern>
592 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
593 opc, asm, "", pattern> {
596 let Inst{27-25} = 0b000;
597 let Inst{24} = 1; // P bit
598 let Inst{23} = addr{8}; // U bit
599 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
600 let Inst{21} = 0; // W bit
601 let Inst{20} = op20; // L bit
602 let Inst{19-16} = addr{12-9}; // Rn
603 let Inst{15-12} = Rt; // Rt
604 let Inst{11-8} = addr{7-4}; // imm7_4/zero
606 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
608 let DecoderMethod = "DecodeAddrMode3Instruction";
611 class AI3ldstidx<bits<4> op, bit op20, bit isPre, dag oops, dag iops,
612 IndexMode im, Format f, InstrItinClass itin, string opc,
613 string asm, string cstr, list<dag> pattern>
614 : I<oops, iops, AddrMode3, 4, im, f, itin,
615 opc, asm, cstr, pattern> {
617 let Inst{27-25} = 0b000;
618 let Inst{24} = isPre; // P bit
619 let Inst{21} = isPre; // W bit
620 let Inst{20} = op20; // L bit
621 let Inst{15-12} = Rt; // Rt
625 // FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
626 // but for now use this class for LDRSBT, LDRHT, LDSHT.
627 class AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
628 IndexMode im, Format f, InstrItinClass itin, string opc,
629 string asm, string cstr, list<dag> pattern>
630 : I<oops, iops, AddrMode3, 4, im, f, itin, opc, asm, cstr, pattern> {
631 // {13} 1 == imm8, 0 == Rm
638 let Inst{27-25} = 0b000;
639 let Inst{24} = 0; // P bit
641 let Inst{20} = isLoad; // L bit
642 let Inst{19-16} = addr; // Rn
643 let Inst{15-12} = Rt; // Rt
648 class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
649 string opc, string asm, list<dag> pattern>
650 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
651 opc, asm, "", pattern> {
654 let Inst{27-25} = 0b000;
655 let Inst{24} = 1; // P bit
656 let Inst{23} = addr{8}; // U bit
657 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
658 let Inst{21} = 0; // W bit
659 let Inst{20} = 0; // L bit
660 let Inst{19-16} = addr{12-9}; // Rn
661 let Inst{15-12} = Rt; // Rt
662 let Inst{11-8} = addr{7-4}; // imm7_4/zero
664 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
665 let DecoderMethod = "DecodeAddrMode3Instruction";
668 // addrmode4 instructions
669 class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
670 string asm, string cstr, list<dag> pattern>
671 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
676 let Inst{27-25} = 0b100;
677 let Inst{22} = 0; // S bit
678 let Inst{19-16} = Rn;
679 let Inst{15-0} = regs;
682 // Unsigned multiply, multiply-accumulate instructions.
683 class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
684 string opc, string asm, list<dag> pattern>
685 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
686 opc, asm, "", pattern> {
687 let Inst{7-4} = 0b1001;
688 let Inst{20} = 0; // S bit
689 let Inst{27-21} = opcod;
691 class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
692 string opc, string asm, list<dag> pattern>
693 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
694 opc, asm, "", pattern> {
695 let Inst{7-4} = 0b1001;
696 let Inst{27-21} = opcod;
699 // Most significant word multiply
700 class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
701 InstrItinClass itin, string opc, string asm, list<dag> pattern>
702 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
703 opc, asm, "", pattern> {
707 let Inst{7-4} = opc7_4;
709 let Inst{27-21} = opcod;
710 let Inst{19-16} = Rd;
714 // MSW multiple w/ Ra operand
715 class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
716 InstrItinClass itin, string opc, string asm, list<dag> pattern>
717 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
719 let Inst{15-12} = Ra;
722 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
723 class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
724 InstrItinClass itin, string opc, string asm, list<dag> pattern>
725 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
726 opc, asm, "", pattern> {
732 let Inst{27-21} = opcod;
733 let Inst{6-5} = bit6_5;
737 class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
738 InstrItinClass itin, string opc, string asm, list<dag> pattern>
739 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
741 let Inst{19-16} = Rd;
744 // AMulxyI with Ra operand
745 class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
746 InstrItinClass itin, string opc, string asm, list<dag> pattern>
747 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
749 let Inst{15-12} = Ra;
752 class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
753 InstrItinClass itin, string opc, string asm, list<dag> pattern>
754 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
757 let Inst{19-16} = RdHi;
758 let Inst{15-12} = RdLo;
761 // Extend instructions.
762 class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
763 string opc, string asm, list<dag> pattern>
764 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
765 opc, asm, "", pattern> {
766 // All AExtI instructions have Rd and Rm register operands.
769 let Inst{15-12} = Rd;
771 let Inst{7-4} = 0b0111;
772 let Inst{9-8} = 0b00;
773 let Inst{27-20} = opcod;
776 // Misc Arithmetic instructions.
777 class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
778 InstrItinClass itin, string opc, string asm, list<dag> pattern>
779 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
780 opc, asm, "", pattern> {
783 let Inst{27-20} = opcod;
784 let Inst{19-16} = 0b1111;
785 let Inst{15-12} = Rd;
786 let Inst{11-8} = 0b1111;
787 let Inst{7-4} = opc7_4;
792 def PKHLSLAsmOperand : AsmOperandClass {
793 let Name = "PKHLSLImm";
794 let ParserMethod = "parsePKHLSLImm";
796 def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
797 let PrintMethod = "printPKHLSLShiftImm";
798 let ParserMatchClass = PKHLSLAsmOperand;
800 def PKHASRAsmOperand : AsmOperandClass {
801 let Name = "PKHASRImm";
802 let ParserMethod = "parsePKHASRImm";
804 def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
805 let PrintMethod = "printPKHASRShiftImm";
806 let ParserMatchClass = PKHASRAsmOperand;
809 class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
810 string opc, string asm, list<dag> pattern>
811 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
812 opc, asm, "", pattern> {
817 let Inst{27-20} = opcod;
818 let Inst{19-16} = Rn;
819 let Inst{15-12} = Rd;
822 let Inst{5-4} = 0b01;
826 //===----------------------------------------------------------------------===//
828 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
829 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
830 list<Predicate> Predicates = [IsARM];
832 class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
833 list<Predicate> Predicates = [IsARM, HasV5T];
835 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
836 list<Predicate> Predicates = [IsARM, HasV5TE];
838 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
839 list<Predicate> Predicates = [IsARM, HasV6];
842 //===----------------------------------------------------------------------===//
843 // Thumb Instruction Format Definitions.
846 class ThumbI<dag oops, dag iops, AddrMode am, int sz,
847 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
848 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
849 let OutOperandList = oops;
850 let InOperandList = iops;
852 let Pattern = pattern;
853 list<Predicate> Predicates = [IsThumb];
856 // TI - Thumb instruction.
857 class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
858 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
860 // Two-address instructions
861 class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
863 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
866 // tBL, tBX 32-bit instructions
867 class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
868 dag oops, dag iops, InstrItinClass itin, string asm,
870 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
872 let Inst{31-27} = opcod1;
873 let Inst{15-14} = opcod2;
874 let Inst{12} = opcod3;
877 // BR_JT instructions
878 class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
880 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
883 class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
884 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
885 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
886 let OutOperandList = oops;
887 let InOperandList = iops;
889 let Pattern = pattern;
890 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
893 class T1I<dag oops, dag iops, InstrItinClass itin,
894 string asm, list<dag> pattern>
895 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
896 class T1Ix2<dag oops, dag iops, InstrItinClass itin,
897 string asm, list<dag> pattern>
898 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
900 // Two-address instructions
901 class T1It<dag oops, dag iops, InstrItinClass itin,
902 string asm, string cstr, list<dag> pattern>
903 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
906 // Thumb1 instruction that can either be predicated or set CPSR.
907 class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
909 string opc, string asm, string cstr, list<dag> pattern>
910 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
911 let OutOperandList = !con(oops, (outs s_cc_out:$s));
912 let InOperandList = !con(iops, (ins pred:$p));
913 let AsmString = !strconcat(opc, "${s}${p}", asm);
914 let Pattern = pattern;
915 let thumbArithFlagSetting = 1;
916 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
917 let DecoderNamespace = "ThumbSBit";
920 class T1sI<dag oops, dag iops, InstrItinClass itin,
921 string opc, string asm, list<dag> pattern>
922 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
924 // Two-address instructions
925 class T1sIt<dag oops, dag iops, InstrItinClass itin,
926 string opc, string asm, list<dag> pattern>
927 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
928 "$Rn = $Rdn", pattern>;
930 // Thumb1 instruction that can be predicated.
931 class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
933 string opc, string asm, string cstr, list<dag> pattern>
934 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
935 let OutOperandList = oops;
936 let InOperandList = !con(iops, (ins pred:$p));
937 let AsmString = !strconcat(opc, "${p}", asm);
938 let Pattern = pattern;
939 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
942 class T1pI<dag oops, dag iops, InstrItinClass itin,
943 string opc, string asm, list<dag> pattern>
944 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
946 // Two-address instructions
947 class T1pIt<dag oops, dag iops, InstrItinClass itin,
948 string opc, string asm, list<dag> pattern>
949 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
950 "$Rn = $Rdn", pattern>;
952 class T1pIs<dag oops, dag iops,
953 InstrItinClass itin, string opc, string asm, list<dag> pattern>
954 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
956 class Encoding16 : Encoding {
957 let Inst{31-16} = 0x0000;
960 // A6.2 16-bit Thumb instruction encoding
961 class T1Encoding<bits<6> opcode> : Encoding16 {
962 let Inst{15-10} = opcode;
965 // A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
966 class T1General<bits<5> opcode> : Encoding16 {
967 let Inst{15-14} = 0b00;
968 let Inst{13-9} = opcode;
971 // A6.2.2 Data-processing encoding.
972 class T1DataProcessing<bits<4> opcode> : Encoding16 {
973 let Inst{15-10} = 0b010000;
974 let Inst{9-6} = opcode;
977 // A6.2.3 Special data instructions and branch and exchange encoding.
978 class T1Special<bits<4> opcode> : Encoding16 {
979 let Inst{15-10} = 0b010001;
980 let Inst{9-6} = opcode;
983 // A6.2.4 Load/store single data item encoding.
984 class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
985 let Inst{15-12} = opA;
986 let Inst{11-9} = opB;
988 class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
990 class T1BranchCond<bits<4> opcode> : Encoding16 {
991 let Inst{15-12} = opcode;
994 // Helper classes to encode Thumb1 loads and stores. For immediates, the
995 // following bits are used for "opA" (see A6.2.4):
997 // 0b0110 => Immediate, 4 bytes
998 // 0b1000 => Immediate, 2 bytes
999 // 0b0111 => Immediate, 1 byte
1000 class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1001 InstrItinClass itin, string opc, string asm,
1003 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1004 T1LoadStore<0b0101, opcode> {
1007 let Inst{8-6} = addr{5-3}; // Rm
1008 let Inst{5-3} = addr{2-0}; // Rn
1011 class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1012 InstrItinClass itin, string opc, string asm,
1014 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1015 T1LoadStore<opA, {opB,?,?}> {
1018 let Inst{10-6} = addr{7-3}; // imm5
1019 let Inst{5-3} = addr{2-0}; // Rn
1023 // A6.2.5 Miscellaneous 16-bit instructions encoding.
1024 class T1Misc<bits<7> opcode> : Encoding16 {
1025 let Inst{15-12} = 0b1011;
1026 let Inst{11-5} = opcode;
1029 // Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1030 class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
1031 InstrItinClass itin,
1032 string opc, string asm, string cstr, list<dag> pattern>
1033 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1034 let OutOperandList = oops;
1035 let InOperandList = !con(iops, (ins pred:$p));
1036 let AsmString = !strconcat(opc, "${p}", asm);
1037 let Pattern = pattern;
1038 list<Predicate> Predicates = [IsThumb2];
1039 let DecoderNamespace = "Thumb2";
1042 // Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1043 // input operand since by default it's a zero register. It will become an
1044 // implicit def once it's "flipped".
1046 // FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1048 class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
1049 InstrItinClass itin,
1050 string opc, string asm, string cstr, list<dag> pattern>
1051 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1052 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1055 let OutOperandList = oops;
1056 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1057 let AsmString = !strconcat(opc, "${s}${p}", asm);
1058 let Pattern = pattern;
1059 list<Predicate> Predicates = [IsThumb2];
1060 let DecoderNamespace = "Thumb2";
1064 class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
1065 InstrItinClass itin,
1066 string asm, string cstr, list<dag> pattern>
1067 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1068 let OutOperandList = oops;
1069 let InOperandList = iops;
1070 let AsmString = asm;
1071 let Pattern = pattern;
1072 list<Predicate> Predicates = [IsThumb2];
1073 let DecoderNamespace = "Thumb2";
1076 class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
1077 InstrItinClass itin,
1078 string asm, string cstr, list<dag> pattern>
1079 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1080 let OutOperandList = oops;
1081 let InOperandList = iops;
1082 let AsmString = asm;
1083 let Pattern = pattern;
1084 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1085 let DecoderNamespace = "Thumb";
1088 class T2I<dag oops, dag iops, InstrItinClass itin,
1089 string opc, string asm, list<dag> pattern>
1090 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1091 class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1092 string opc, string asm, list<dag> pattern>
1093 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
1094 class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1095 string opc, string asm, list<dag> pattern>
1096 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
1097 class T2Iso<dag oops, dag iops, InstrItinClass itin,
1098 string opc, string asm, list<dag> pattern>
1099 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
1100 class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1101 string opc, string asm, list<dag> pattern>
1102 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
1103 class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1104 string opc, string asm, list<dag> pattern>
1105 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
1110 let Inst{31-25} = 0b1110100;
1112 let Inst{23} = addr{8};
1115 let Inst{20} = isLoad;
1116 let Inst{19-16} = addr{12-9};
1117 let Inst{15-12} = Rt{3-0};
1118 let Inst{11-8} = Rt2{3-0};
1119 let Inst{7-0} = addr{7-0};
1122 class T2Ii8s4Tied<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1123 string opc, string asm, list<dag> pattern>
1124 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "$base = $wb",
1130 let Inst{31-25} = 0b1110100;
1132 let Inst{23} = imm{8};
1135 let Inst{20} = isLoad;
1136 let Inst{19-16} = base{3-0};
1137 let Inst{15-12} = Rt{3-0};
1138 let Inst{11-8} = Rt2{3-0};
1139 let Inst{7-0} = imm{7-0};
1143 class T2sI<dag oops, dag iops, InstrItinClass itin,
1144 string opc, string asm, list<dag> pattern>
1145 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1147 class T2XI<dag oops, dag iops, InstrItinClass itin,
1148 string asm, list<dag> pattern>
1149 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
1150 class T2JTI<dag oops, dag iops, InstrItinClass itin,
1151 string asm, list<dag> pattern>
1152 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
1154 // Move to/from coprocessor instructions
1155 class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
1156 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
1157 let Inst{31-28} = opc;
1160 // Two-address instructions
1161 class T2XIt<dag oops, dag iops, InstrItinClass itin,
1162 string asm, string cstr, list<dag> pattern>
1163 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
1165 // T2Iidxldst - Thumb2 indexed load / store instructions.
1166 class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1168 AddrMode am, IndexMode im, InstrItinClass itin,
1169 string opc, string asm, string cstr, list<dag> pattern>
1170 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1171 let OutOperandList = oops;
1172 let InOperandList = !con(iops, (ins pred:$p));
1173 let AsmString = !strconcat(opc, "${p}", asm);
1174 let Pattern = pattern;
1175 list<Predicate> Predicates = [IsThumb2];
1176 let DecoderNamespace = "Thumb2";
1177 let Inst{31-27} = 0b11111;
1178 let Inst{26-25} = 0b00;
1179 let Inst{24} = signed;
1181 let Inst{22-21} = opcod;
1182 let Inst{20} = load;
1184 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1185 let Inst{10} = pre; // The P bit.
1186 let Inst{8} = 1; // The W bit.
1189 let Inst{7-0} = addr{7-0};
1190 let Inst{9} = addr{8}; // Sign bit
1194 let Inst{15-12} = Rt{3-0};
1195 let Inst{19-16} = Rn{3-0};
1198 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1199 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1200 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
1203 // T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1204 class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1205 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1208 // T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1209 class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1210 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1213 // T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1214 class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1215 list<Predicate> Predicates = [IsThumb2];
1218 //===----------------------------------------------------------------------===//
1220 //===----------------------------------------------------------------------===//
1221 // ARM VFP Instruction templates.
1224 // Almost all VFP instructions are predicable.
1225 class VFPI<dag oops, dag iops, AddrMode am, int sz,
1226 IndexMode im, Format f, InstrItinClass itin,
1227 string opc, string asm, string cstr, list<dag> pattern>
1228 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1230 let Inst{31-28} = p;
1231 let OutOperandList = oops;
1232 let InOperandList = !con(iops, (ins pred:$p));
1233 let AsmString = !strconcat(opc, "${p}", asm);
1234 let Pattern = pattern;
1235 let PostEncoderMethod = "VFPThumb2PostEncoder";
1236 let DecoderNamespace = "VFP";
1237 list<Predicate> Predicates = [HasVFP2];
1241 class VFPXI<dag oops, dag iops, AddrMode am, int sz,
1242 IndexMode im, Format f, InstrItinClass itin,
1243 string asm, string cstr, list<dag> pattern>
1244 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1246 let Inst{31-28} = p;
1247 let OutOperandList = oops;
1248 let InOperandList = iops;
1249 let AsmString = asm;
1250 let Pattern = pattern;
1251 let PostEncoderMethod = "VFPThumb2PostEncoder";
1252 let DecoderNamespace = "VFP";
1253 list<Predicate> Predicates = [HasVFP2];
1256 class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1257 string opc, string asm, list<dag> pattern>
1258 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
1259 opc, asm, "", pattern> {
1260 let PostEncoderMethod = "VFPThumb2PostEncoder";
1263 // ARM VFP addrmode5 loads and stores
1264 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1265 InstrItinClass itin,
1266 string opc, string asm, list<dag> pattern>
1267 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1268 VFPLdStFrm, itin, opc, asm, "", pattern> {
1269 // Instruction operands.
1273 // Encode instruction operands.
1274 let Inst{23} = addr{8}; // U (add = (U == '1'))
1275 let Inst{22} = Dd{4};
1276 let Inst{19-16} = addr{12-9}; // Rn
1277 let Inst{15-12} = Dd{3-0};
1278 let Inst{7-0} = addr{7-0}; // imm8
1280 // TODO: Mark the instructions with the appropriate subtarget info.
1281 let Inst{27-24} = opcod1;
1282 let Inst{21-20} = opcod2;
1283 let Inst{11-9} = 0b101;
1284 let Inst{8} = 1; // Double precision
1286 // Loads & stores operate on both NEON and VFP pipelines.
1287 let D = VFPNeonDomain;
1290 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1291 InstrItinClass itin,
1292 string opc, string asm, list<dag> pattern>
1293 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1294 VFPLdStFrm, itin, opc, asm, "", pattern> {
1295 // Instruction operands.
1299 // Encode instruction operands.
1300 let Inst{23} = addr{8}; // U (add = (U == '1'))
1301 let Inst{22} = Sd{0};
1302 let Inst{19-16} = addr{12-9}; // Rn
1303 let Inst{15-12} = Sd{4-1};
1304 let Inst{7-0} = addr{7-0}; // imm8
1306 // TODO: Mark the instructions with the appropriate subtarget info.
1307 let Inst{27-24} = opcod1;
1308 let Inst{21-20} = opcod2;
1309 let Inst{11-9} = 0b101;
1310 let Inst{8} = 0; // Single precision
1312 // Loads & stores operate on both NEON and VFP pipelines.
1313 let D = VFPNeonDomain;
1316 // VFP Load / store multiple pseudo instructions.
1317 class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1319 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
1321 let OutOperandList = oops;
1322 let InOperandList = !con(iops, (ins pred:$p));
1323 let Pattern = pattern;
1324 list<Predicate> Predicates = [HasVFP2];
1327 // Load / store multiple
1328 class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1329 string asm, string cstr, list<dag> pattern>
1330 : VFPXI<oops, iops, AddrMode4, 4, im,
1331 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1332 // Instruction operands.
1336 // Encode instruction operands.
1337 let Inst{19-16} = Rn;
1338 let Inst{22} = regs{12};
1339 let Inst{15-12} = regs{11-8};
1340 let Inst{7-0} = regs{7-0};
1342 // TODO: Mark the instructions with the appropriate subtarget info.
1343 let Inst{27-25} = 0b110;
1344 let Inst{11-9} = 0b101;
1345 let Inst{8} = 1; // Double precision
1348 class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1349 string asm, string cstr, list<dag> pattern>
1350 : VFPXI<oops, iops, AddrMode4, 4, im,
1351 VFPLdStMulFrm, itin, asm, cstr, pattern> {
1352 // Instruction operands.
1356 // Encode instruction operands.
1357 let Inst{19-16} = Rn;
1358 let Inst{22} = regs{8};
1359 let Inst{15-12} = regs{12-9};
1360 let Inst{7-0} = regs{7-0};
1362 // TODO: Mark the instructions with the appropriate subtarget info.
1363 let Inst{27-25} = 0b110;
1364 let Inst{11-9} = 0b101;
1365 let Inst{8} = 0; // Single precision
1368 // Double precision, unary
1369 class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1370 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1371 string asm, list<dag> pattern>
1372 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1373 // Instruction operands.
1377 // Encode instruction operands.
1378 let Inst{3-0} = Dm{3-0};
1379 let Inst{5} = Dm{4};
1380 let Inst{15-12} = Dd{3-0};
1381 let Inst{22} = Dd{4};
1383 let Inst{27-23} = opcod1;
1384 let Inst{21-20} = opcod2;
1385 let Inst{19-16} = opcod3;
1386 let Inst{11-9} = 0b101;
1387 let Inst{8} = 1; // Double precision
1388 let Inst{7-6} = opcod4;
1389 let Inst{4} = opcod5;
1392 // Double precision, binary
1393 class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1394 dag iops, InstrItinClass itin, string opc, string asm,
1396 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1397 // Instruction operands.
1402 // Encode instruction operands.
1403 let Inst{3-0} = Dm{3-0};
1404 let Inst{5} = Dm{4};
1405 let Inst{19-16} = Dn{3-0};
1406 let Inst{7} = Dn{4};
1407 let Inst{15-12} = Dd{3-0};
1408 let Inst{22} = Dd{4};
1410 let Inst{27-23} = opcod1;
1411 let Inst{21-20} = opcod2;
1412 let Inst{11-9} = 0b101;
1413 let Inst{8} = 1; // Double precision
1418 // Single precision, unary
1419 class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1420 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1421 string asm, list<dag> pattern>
1422 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1423 // Instruction operands.
1427 // Encode instruction operands.
1428 let Inst{3-0} = Sm{4-1};
1429 let Inst{5} = Sm{0};
1430 let Inst{15-12} = Sd{4-1};
1431 let Inst{22} = Sd{0};
1433 let Inst{27-23} = opcod1;
1434 let Inst{21-20} = opcod2;
1435 let Inst{19-16} = opcod3;
1436 let Inst{11-9} = 0b101;
1437 let Inst{8} = 0; // Single precision
1438 let Inst{7-6} = opcod4;
1439 let Inst{4} = opcod5;
1442 // Single precision unary, if no NEON. Same as ASuI except not available if
1444 class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1445 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1446 string asm, list<dag> pattern>
1447 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1449 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1452 // Single precision, binary
1453 class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1454 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1455 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1456 // Instruction operands.
1461 // Encode instruction operands.
1462 let Inst{3-0} = Sm{4-1};
1463 let Inst{5} = Sm{0};
1464 let Inst{19-16} = Sn{4-1};
1465 let Inst{7} = Sn{0};
1466 let Inst{15-12} = Sd{4-1};
1467 let Inst{22} = Sd{0};
1469 let Inst{27-23} = opcod1;
1470 let Inst{21-20} = opcod2;
1471 let Inst{11-9} = 0b101;
1472 let Inst{8} = 0; // Single precision
1477 // Single precision binary, if no NEON. Same as ASbI except not available if
1479 class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1480 dag iops, InstrItinClass itin, string opc, string asm,
1482 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1483 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1485 // Instruction operands.
1490 // Encode instruction operands.
1491 let Inst{3-0} = Sm{4-1};
1492 let Inst{5} = Sm{0};
1493 let Inst{19-16} = Sn{4-1};
1494 let Inst{7} = Sn{0};
1495 let Inst{15-12} = Sd{4-1};
1496 let Inst{22} = Sd{0};
1499 // VFP conversion instructions
1500 class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1501 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1503 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1504 let Inst{27-23} = opcod1;
1505 let Inst{21-20} = opcod2;
1506 let Inst{19-16} = opcod3;
1507 let Inst{11-8} = opcod4;
1512 // VFP conversion between floating-point and fixed-point
1513 class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1514 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1516 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1517 // size (fixed-point number): sx == 0 ? 16 : 32
1518 let Inst{7} = op5; // sx
1521 // VFP conversion instructions, if no NEON
1522 class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1523 dag oops, dag iops, InstrItinClass itin,
1524 string opc, string asm, list<dag> pattern>
1525 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1527 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1530 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1531 InstrItinClass itin,
1532 string opc, string asm, list<dag> pattern>
1533 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1534 let Inst{27-20} = opcod1;
1535 let Inst{11-8} = opcod2;
1539 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1540 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1541 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
1543 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1544 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1545 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
1547 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1548 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1549 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
1551 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1552 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1553 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
1555 //===----------------------------------------------------------------------===//
1557 //===----------------------------------------------------------------------===//
1558 // ARM NEON Instruction templates.
1561 class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1562 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1564 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1565 let OutOperandList = oops;
1566 let InOperandList = !con(iops, (ins pred:$p));
1567 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1568 let Pattern = pattern;
1569 list<Predicate> Predicates = [HasNEON];
1570 let DecoderNamespace = "NEON";
1573 // Same as NeonI except it does not have a "data type" specifier.
1574 class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1575 InstrItinClass itin, string opc, string asm, string cstr,
1577 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1578 let OutOperandList = oops;
1579 let InOperandList = !con(iops, (ins pred:$p));
1580 let AsmString = !strconcat(opc, "${p}", "\t", asm);
1581 let Pattern = pattern;
1582 list<Predicate> Predicates = [HasNEON];
1583 let DecoderNamespace = "NEON";
1586 class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1587 dag oops, dag iops, InstrItinClass itin,
1588 string opc, string dt, string asm, string cstr, list<dag> pattern>
1589 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1591 let Inst{31-24} = 0b11110100;
1592 let Inst{23} = op23;
1593 let Inst{21-20} = op21_20;
1594 let Inst{11-8} = op11_8;
1595 let Inst{7-4} = op7_4;
1597 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
1598 let DecoderNamespace = "NEONLoadStore";
1604 let Inst{22} = Vd{4};
1605 let Inst{15-12} = Vd{3-0};
1606 let Inst{19-16} = Rn{3-0};
1607 let Inst{3-0} = Rm{3-0};
1610 class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1611 dag oops, dag iops, InstrItinClass itin,
1612 string opc, string dt, string asm, string cstr, list<dag> pattern>
1613 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1614 dt, asm, cstr, pattern> {
1618 class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1619 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1621 let OutOperandList = oops;
1622 let InOperandList = !con(iops, (ins pred:$p));
1623 list<Predicate> Predicates = [HasNEON];
1626 class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1628 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
1630 let OutOperandList = oops;
1631 let InOperandList = !con(iops, (ins pred:$p));
1632 let Pattern = pattern;
1633 list<Predicate> Predicates = [HasNEON];
1636 class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
1637 string opc, string dt, string asm, string cstr, list<dag> pattern>
1638 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1640 let Inst{31-25} = 0b1111001;
1641 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1642 let DecoderNamespace = "NEONData";
1645 class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
1646 string opc, string asm, string cstr, list<dag> pattern>
1647 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
1649 let Inst{31-25} = 0b1111001;
1650 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
1651 let DecoderNamespace = "NEONData";
1654 // NEON "one register and a modified immediate" format.
1655 class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1657 dag oops, dag iops, InstrItinClass itin,
1658 string opc, string dt, string asm, string cstr,
1660 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
1661 let Inst{23} = op23;
1662 let Inst{21-19} = op21_19;
1663 let Inst{11-8} = op11_8;
1669 // Instruction operands.
1673 let Inst{15-12} = Vd{3-0};
1674 let Inst{22} = Vd{4};
1675 let Inst{24} = SIMM{7};
1676 let Inst{18-16} = SIMM{6-4};
1677 let Inst{3-0} = SIMM{3-0};
1678 let DecoderMethod = "DecodeNEONModImmInstruction";
1681 // NEON 2 vector register format.
1682 class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1683 bits<5> op11_7, bit op6, bit op4,
1684 dag oops, dag iops, InstrItinClass itin,
1685 string opc, string dt, string asm, string cstr, list<dag> pattern>
1686 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
1687 let Inst{24-23} = op24_23;
1688 let Inst{21-20} = op21_20;
1689 let Inst{19-18} = op19_18;
1690 let Inst{17-16} = op17_16;
1691 let Inst{11-7} = op11_7;
1695 // Instruction operands.
1699 let Inst{15-12} = Vd{3-0};
1700 let Inst{22} = Vd{4};
1701 let Inst{3-0} = Vm{3-0};
1702 let Inst{5} = Vm{4};
1705 // Same as N2V except it doesn't have a datatype suffix.
1706 class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1707 bits<5> op11_7, bit op6, bit op4,
1708 dag oops, dag iops, InstrItinClass itin,
1709 string opc, string asm, string cstr, list<dag> pattern>
1710 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
1711 let Inst{24-23} = op24_23;
1712 let Inst{21-20} = op21_20;
1713 let Inst{19-18} = op19_18;
1714 let Inst{17-16} = op17_16;
1715 let Inst{11-7} = op11_7;
1719 // Instruction operands.
1723 let Inst{15-12} = Vd{3-0};
1724 let Inst{22} = Vd{4};
1725 let Inst{3-0} = Vm{3-0};
1726 let Inst{5} = Vm{4};
1729 // NEON 2 vector register with immediate.
1730 class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
1731 dag oops, dag iops, Format f, InstrItinClass itin,
1732 string opc, string dt, string asm, string cstr, list<dag> pattern>
1733 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1734 let Inst{24} = op24;
1735 let Inst{23} = op23;
1736 let Inst{11-8} = op11_8;
1741 // Instruction operands.
1746 let Inst{15-12} = Vd{3-0};
1747 let Inst{22} = Vd{4};
1748 let Inst{3-0} = Vm{3-0};
1749 let Inst{5} = Vm{4};
1750 let Inst{21-16} = SIMM{5-0};
1753 // NEON 3 vector register format.
1755 class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1756 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1757 string opc, string dt, string asm, string cstr,
1759 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1760 let Inst{24} = op24;
1761 let Inst{23} = op23;
1762 let Inst{21-20} = op21_20;
1763 let Inst{11-8} = op11_8;
1768 class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1769 dag oops, dag iops, Format f, InstrItinClass itin,
1770 string opc, string dt, string asm, string cstr, list<dag> pattern>
1771 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1772 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
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 class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1788 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1789 string opc, string dt, string asm, string cstr,
1791 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1792 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1794 // Instruction operands.
1800 let Inst{15-12} = Vd{3-0};
1801 let Inst{22} = Vd{4};
1802 let Inst{19-16} = Vn{3-0};
1803 let Inst{7} = Vn{4};
1804 let Inst{3-0} = Vm{3-0};
1808 class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1809 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1810 string opc, string dt, string asm, string cstr,
1812 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1813 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1815 // Instruction operands.
1821 let Inst{15-12} = Vd{3-0};
1822 let Inst{22} = Vd{4};
1823 let Inst{19-16} = Vn{3-0};
1824 let Inst{7} = Vn{4};
1825 let Inst{2-0} = Vm{2-0};
1826 let Inst{5} = lane{1};
1827 let Inst{3} = lane{0};
1830 // Same as N3V except it doesn't have a data type suffix.
1831 class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1833 dag oops, dag iops, Format f, InstrItinClass itin,
1834 string opc, string asm, string cstr, list<dag> pattern>
1835 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
1836 let Inst{24} = op24;
1837 let Inst{23} = op23;
1838 let Inst{21-20} = op21_20;
1839 let Inst{11-8} = op11_8;
1843 // Instruction operands.
1848 let Inst{15-12} = Vd{3-0};
1849 let Inst{22} = Vd{4};
1850 let Inst{19-16} = Vn{3-0};
1851 let Inst{7} = Vn{4};
1852 let Inst{3-0} = Vm{3-0};
1853 let Inst{5} = Vm{4};
1856 // NEON VMOVs between scalar and core registers.
1857 class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1858 dag oops, dag iops, Format f, InstrItinClass itin,
1859 string opc, string dt, string asm, list<dag> pattern>
1860 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
1862 let Inst{27-20} = opcod1;
1863 let Inst{11-8} = opcod2;
1864 let Inst{6-5} = opcod3;
1866 // A8.6.303, A8.6.328, A8.6.329
1867 let Inst{3-0} = 0b0000;
1869 let OutOperandList = oops;
1870 let InOperandList = !con(iops, (ins pred:$p));
1871 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
1872 let Pattern = pattern;
1873 list<Predicate> Predicates = [HasNEON];
1875 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
1876 let DecoderNamespace = "NEONDup";
1883 let Inst{31-28} = p{3-0};
1885 let Inst{19-16} = V{3-0};
1886 let Inst{15-12} = R{3-0};
1888 class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1889 dag oops, dag iops, InstrItinClass itin,
1890 string opc, string dt, string asm, list<dag> pattern>
1891 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
1892 opc, dt, asm, pattern>;
1893 class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1894 dag oops, dag iops, InstrItinClass itin,
1895 string opc, string dt, string asm, list<dag> pattern>
1896 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
1897 opc, dt, asm, pattern>;
1898 class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1899 dag oops, dag iops, InstrItinClass itin,
1900 string opc, string dt, string asm, list<dag> pattern>
1901 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
1902 opc, dt, asm, pattern>;
1904 // Vector Duplicate Lane (from scalar to all elements)
1905 class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1906 InstrItinClass itin, string opc, string dt, string asm,
1908 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
1909 let Inst{24-23} = 0b11;
1910 let Inst{21-20} = 0b11;
1911 let Inst{19-16} = op19_16;
1912 let Inst{11-7} = 0b11000;
1920 let Inst{22} = Vd{4};
1921 let Inst{15-12} = Vd{3-0};
1922 let Inst{5} = Vm{4};
1923 let Inst{3-0} = Vm{3-0};
1926 // NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1927 // for single-precision FP.
1928 class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1929 list<Predicate> Predicates = [HasNEON,UseNEONForFP];