xref: /aosp_15_r20/external/llvm/lib/Target/ARM/ARMInstrFormats.td (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker//===-- ARMInstrFormats.td - ARM Instruction Formats -------*- tablegen -*-===//
2*9880d681SAndroid Build Coastguard Worker//
3*9880d681SAndroid Build Coastguard Worker//                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker//
5*9880d681SAndroid Build Coastguard Worker// This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker// License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker//
8*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
11*9880d681SAndroid Build Coastguard Worker//
12*9880d681SAndroid Build Coastguard Worker// ARM Instruction Format Definitions.
13*9880d681SAndroid Build Coastguard Worker//
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker// Format specifies the encoding used by the instruction.  This is part of the
16*9880d681SAndroid Build Coastguard Worker// ad-hoc solution used to emit machine instruction encodings by our machine
17*9880d681SAndroid Build Coastguard Worker// code emitter.
18*9880d681SAndroid Build Coastguard Workerclass Format<bits<6> val> {
19*9880d681SAndroid Build Coastguard Worker  bits<6> Value = val;
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Workerdef Pseudo        : Format<0>;
23*9880d681SAndroid Build Coastguard Workerdef MulFrm        : Format<1>;
24*9880d681SAndroid Build Coastguard Workerdef BrFrm         : Format<2>;
25*9880d681SAndroid Build Coastguard Workerdef BrMiscFrm     : Format<3>;
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdef DPFrm         : Format<4>;
28*9880d681SAndroid Build Coastguard Workerdef DPSoRegRegFrm    : Format<5>;
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdef LdFrm         : Format<6>;
31*9880d681SAndroid Build Coastguard Workerdef StFrm         : Format<7>;
32*9880d681SAndroid Build Coastguard Workerdef LdMiscFrm     : Format<8>;
33*9880d681SAndroid Build Coastguard Workerdef StMiscFrm     : Format<9>;
34*9880d681SAndroid Build Coastguard Workerdef LdStMulFrm    : Format<10>;
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Workerdef LdStExFrm     : Format<11>;
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerdef ArithMiscFrm  : Format<12>;
39*9880d681SAndroid Build Coastguard Workerdef SatFrm        : Format<13>;
40*9880d681SAndroid Build Coastguard Workerdef ExtFrm        : Format<14>;
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Workerdef VFPUnaryFrm   : Format<15>;
43*9880d681SAndroid Build Coastguard Workerdef VFPBinaryFrm  : Format<16>;
44*9880d681SAndroid Build Coastguard Workerdef VFPConv1Frm   : Format<17>;
45*9880d681SAndroid Build Coastguard Workerdef VFPConv2Frm   : Format<18>;
46*9880d681SAndroid Build Coastguard Workerdef VFPConv3Frm   : Format<19>;
47*9880d681SAndroid Build Coastguard Workerdef VFPConv4Frm   : Format<20>;
48*9880d681SAndroid Build Coastguard Workerdef VFPConv5Frm   : Format<21>;
49*9880d681SAndroid Build Coastguard Workerdef VFPLdStFrm    : Format<22>;
50*9880d681SAndroid Build Coastguard Workerdef VFPLdStMulFrm : Format<23>;
51*9880d681SAndroid Build Coastguard Workerdef VFPMiscFrm    : Format<24>;
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Workerdef ThumbFrm      : Format<25>;
54*9880d681SAndroid Build Coastguard Workerdef MiscFrm       : Format<26>;
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Workerdef NGetLnFrm     : Format<27>;
57*9880d681SAndroid Build Coastguard Workerdef NSetLnFrm     : Format<28>;
58*9880d681SAndroid Build Coastguard Workerdef NDupFrm       : Format<29>;
59*9880d681SAndroid Build Coastguard Workerdef NLdStFrm      : Format<30>;
60*9880d681SAndroid Build Coastguard Workerdef N1RegModImmFrm: Format<31>;
61*9880d681SAndroid Build Coastguard Workerdef N2RegFrm      : Format<32>;
62*9880d681SAndroid Build Coastguard Workerdef NVCVTFrm      : Format<33>;
63*9880d681SAndroid Build Coastguard Workerdef NVDupLnFrm    : Format<34>;
64*9880d681SAndroid Build Coastguard Workerdef N2RegVShLFrm  : Format<35>;
65*9880d681SAndroid Build Coastguard Workerdef N2RegVShRFrm  : Format<36>;
66*9880d681SAndroid Build Coastguard Workerdef N3RegFrm      : Format<37>;
67*9880d681SAndroid Build Coastguard Workerdef N3RegVShFrm   : Format<38>;
68*9880d681SAndroid Build Coastguard Workerdef NVExtFrm      : Format<39>;
69*9880d681SAndroid Build Coastguard Workerdef NVMulSLFrm    : Format<40>;
70*9880d681SAndroid Build Coastguard Workerdef NVTBLFrm      : Format<41>;
71*9880d681SAndroid Build Coastguard Workerdef DPSoRegImmFrm  : Format<42>;
72*9880d681SAndroid Build Coastguard Worker
73*9880d681SAndroid Build Coastguard Worker// Misc flags.
74*9880d681SAndroid Build Coastguard Worker
75*9880d681SAndroid Build Coastguard Worker// The instruction has an Rn register operand.
76*9880d681SAndroid Build Coastguard Worker// UnaryDP - Indicates this is a unary data processing instruction, i.e.
77*9880d681SAndroid Build Coastguard Worker// it doesn't have a Rn operand.
78*9880d681SAndroid Build Coastguard Workerclass UnaryDP    { bit isUnaryDataProc = 1; }
79*9880d681SAndroid Build Coastguard Worker
80*9880d681SAndroid Build Coastguard Worker// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
81*9880d681SAndroid Build Coastguard Worker// a 16-bit Thumb instruction if certain conditions are met.
82*9880d681SAndroid Build Coastguard Workerclass Xform16Bit { bit canXformTo16Bit = 1; }
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
85*9880d681SAndroid Build Coastguard Worker// ARM Instruction flags.  These need to match ARMBaseInstrInfo.h.
86*9880d681SAndroid Build Coastguard Worker//
87*9880d681SAndroid Build Coastguard Worker
88*9880d681SAndroid Build Coastguard Worker// FIXME: Once the JIT is MC-ized, these can go away.
89*9880d681SAndroid Build Coastguard Worker// Addressing mode.
90*9880d681SAndroid Build Coastguard Workerclass AddrMode<bits<5> val> {
91*9880d681SAndroid Build Coastguard Worker  bits<5> Value = val;
92*9880d681SAndroid Build Coastguard Worker}
93*9880d681SAndroid Build Coastguard Workerdef AddrModeNone    : AddrMode<0>;
94*9880d681SAndroid Build Coastguard Workerdef AddrMode1       : AddrMode<1>;
95*9880d681SAndroid Build Coastguard Workerdef AddrMode2       : AddrMode<2>;
96*9880d681SAndroid Build Coastguard Workerdef AddrMode3       : AddrMode<3>;
97*9880d681SAndroid Build Coastguard Workerdef AddrMode4       : AddrMode<4>;
98*9880d681SAndroid Build Coastguard Workerdef AddrMode5       : AddrMode<5>;
99*9880d681SAndroid Build Coastguard Workerdef AddrMode6       : AddrMode<6>;
100*9880d681SAndroid Build Coastguard Workerdef AddrModeT1_1    : AddrMode<7>;
101*9880d681SAndroid Build Coastguard Workerdef AddrModeT1_2    : AddrMode<8>;
102*9880d681SAndroid Build Coastguard Workerdef AddrModeT1_4    : AddrMode<9>;
103*9880d681SAndroid Build Coastguard Workerdef AddrModeT1_s    : AddrMode<10>;
104*9880d681SAndroid Build Coastguard Workerdef AddrModeT2_i12  : AddrMode<11>;
105*9880d681SAndroid Build Coastguard Workerdef AddrModeT2_i8   : AddrMode<12>;
106*9880d681SAndroid Build Coastguard Workerdef AddrModeT2_so   : AddrMode<13>;
107*9880d681SAndroid Build Coastguard Workerdef AddrModeT2_pc   : AddrMode<14>;
108*9880d681SAndroid Build Coastguard Workerdef AddrModeT2_i8s4 : AddrMode<15>;
109*9880d681SAndroid Build Coastguard Workerdef AddrMode_i12    : AddrMode<16>;
110*9880d681SAndroid Build Coastguard Worker
111*9880d681SAndroid Build Coastguard Worker// Load / store index mode.
112*9880d681SAndroid Build Coastguard Workerclass IndexMode<bits<2> val> {
113*9880d681SAndroid Build Coastguard Worker  bits<2> Value = val;
114*9880d681SAndroid Build Coastguard Worker}
115*9880d681SAndroid Build Coastguard Workerdef IndexModeNone : IndexMode<0>;
116*9880d681SAndroid Build Coastguard Workerdef IndexModePre  : IndexMode<1>;
117*9880d681SAndroid Build Coastguard Workerdef IndexModePost : IndexMode<2>;
118*9880d681SAndroid Build Coastguard Workerdef IndexModeUpd  : IndexMode<3>;
119*9880d681SAndroid Build Coastguard Worker
120*9880d681SAndroid Build Coastguard Worker// Instruction execution domain.
121*9880d681SAndroid Build Coastguard Workerclass Domain<bits<3> val> {
122*9880d681SAndroid Build Coastguard Worker  bits<3> Value = val;
123*9880d681SAndroid Build Coastguard Worker}
124*9880d681SAndroid Build Coastguard Workerdef GenericDomain : Domain<0>;
125*9880d681SAndroid Build Coastguard Workerdef VFPDomain     : Domain<1>; // Instructions in VFP domain only
126*9880d681SAndroid Build Coastguard Workerdef NeonDomain    : Domain<2>; // Instructions in Neon domain only
127*9880d681SAndroid Build Coastguard Workerdef VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
128*9880d681SAndroid Build Coastguard Workerdef VFPNeonA8Domain : Domain<5>; // Instructions in VFP & Neon under A8
129*9880d681SAndroid Build Coastguard Worker
130*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
131*9880d681SAndroid Build Coastguard Worker// ARM special operands.
132*9880d681SAndroid Build Coastguard Worker//
133*9880d681SAndroid Build Coastguard Worker
134*9880d681SAndroid Build Coastguard Worker// ARM imod and iflag operands, used only by the CPS instruction.
135*9880d681SAndroid Build Coastguard Workerdef imod_op : Operand<i32> {
136*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printCPSIMod";
137*9880d681SAndroid Build Coastguard Worker}
138*9880d681SAndroid Build Coastguard Worker
139*9880d681SAndroid Build Coastguard Workerdef ProcIFlagsOperand : AsmOperandClass {
140*9880d681SAndroid Build Coastguard Worker  let Name = "ProcIFlags";
141*9880d681SAndroid Build Coastguard Worker  let ParserMethod = "parseProcIFlagsOperand";
142*9880d681SAndroid Build Coastguard Worker}
143*9880d681SAndroid Build Coastguard Workerdef iflags_op : Operand<i32> {
144*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printCPSIFlag";
145*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = ProcIFlagsOperand;
146*9880d681SAndroid Build Coastguard Worker}
147*9880d681SAndroid Build Coastguard Worker
148*9880d681SAndroid Build Coastguard Worker// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
149*9880d681SAndroid Build Coastguard Worker// register whose default is 0 (no register).
150*9880d681SAndroid Build Coastguard Workerdef CondCodeOperand : AsmOperandClass { let Name = "CondCode"; }
151*9880d681SAndroid Build Coastguard Workerdef pred : PredicateOperand<OtherVT, (ops i32imm, i32imm),
152*9880d681SAndroid Build Coastguard Worker                                     (ops (i32 14), (i32 zero_reg))> {
153*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printPredicateOperand";
154*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = CondCodeOperand;
155*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodePredicateOperand";
156*9880d681SAndroid Build Coastguard Worker}
157*9880d681SAndroid Build Coastguard Worker
158*9880d681SAndroid Build Coastguard Worker// Selectable predicate operand for CMOV instructions. We can't use a normal
159*9880d681SAndroid Build Coastguard Worker// predicate because the default values interfere with instruction selection. In
160*9880d681SAndroid Build Coastguard Worker// all other respects it is identical though: pseudo-instruction expansion
161*9880d681SAndroid Build Coastguard Worker// relies on the MachineOperands being compatible.
162*9880d681SAndroid Build Coastguard Workerdef cmovpred : Operand<i32>, PredicateOp,
163*9880d681SAndroid Build Coastguard Worker               ComplexPattern<i32, 2, "SelectCMOVPred"> {
164*9880d681SAndroid Build Coastguard Worker  let MIOperandInfo = (ops i32imm, i32imm);
165*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printPredicateOperand";
166*9880d681SAndroid Build Coastguard Worker}
167*9880d681SAndroid Build Coastguard Worker
168*9880d681SAndroid Build Coastguard Worker// Conditional code result for instructions whose 's' bit is set, e.g. subs.
169*9880d681SAndroid Build Coastguard Workerdef CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
170*9880d681SAndroid Build Coastguard Workerdef cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
171*9880d681SAndroid Build Coastguard Worker  let EncoderMethod = "getCCOutOpValue";
172*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printSBitModifierOperand";
173*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = CCOutOperand;
174*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeCCOutOperand";
175*9880d681SAndroid Build Coastguard Worker}
176*9880d681SAndroid Build Coastguard Worker
177*9880d681SAndroid Build Coastguard Worker// Same as cc_out except it defaults to setting CPSR.
178*9880d681SAndroid Build Coastguard Workerdef s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
179*9880d681SAndroid Build Coastguard Worker  let EncoderMethod = "getCCOutOpValue";
180*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printSBitModifierOperand";
181*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = CCOutOperand;
182*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeCCOutOperand";
183*9880d681SAndroid Build Coastguard Worker}
184*9880d681SAndroid Build Coastguard Worker
185*9880d681SAndroid Build Coastguard Worker// ARM special operands for disassembly only.
186*9880d681SAndroid Build Coastguard Worker//
187*9880d681SAndroid Build Coastguard Workerdef SetEndAsmOperand : ImmAsmOperand {
188*9880d681SAndroid Build Coastguard Worker  let Name = "SetEndImm";
189*9880d681SAndroid Build Coastguard Worker  let ParserMethod = "parseSetEndImm";
190*9880d681SAndroid Build Coastguard Worker}
191*9880d681SAndroid Build Coastguard Workerdef setend_op : Operand<i32> {
192*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printSetendOperand";
193*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = SetEndAsmOperand;
194*9880d681SAndroid Build Coastguard Worker}
195*9880d681SAndroid Build Coastguard Worker
196*9880d681SAndroid Build Coastguard Workerdef MSRMaskOperand : AsmOperandClass {
197*9880d681SAndroid Build Coastguard Worker  let Name = "MSRMask";
198*9880d681SAndroid Build Coastguard Worker  let ParserMethod = "parseMSRMaskOperand";
199*9880d681SAndroid Build Coastguard Worker}
200*9880d681SAndroid Build Coastguard Workerdef msr_mask : Operand<i32> {
201*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printMSRMaskOperand";
202*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeMSRMask";
203*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = MSRMaskOperand;
204*9880d681SAndroid Build Coastguard Worker}
205*9880d681SAndroid Build Coastguard Worker
206*9880d681SAndroid Build Coastguard Workerdef BankedRegOperand : AsmOperandClass {
207*9880d681SAndroid Build Coastguard Worker  let Name = "BankedReg";
208*9880d681SAndroid Build Coastguard Worker  let ParserMethod = "parseBankedRegOperand";
209*9880d681SAndroid Build Coastguard Worker}
210*9880d681SAndroid Build Coastguard Workerdef banked_reg : Operand<i32> {
211*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printBankedRegOperand";
212*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeBankedReg";
213*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = BankedRegOperand;
214*9880d681SAndroid Build Coastguard Worker}
215*9880d681SAndroid Build Coastguard Worker
216*9880d681SAndroid Build Coastguard Worker// Shift Right Immediate - A shift right immediate is encoded differently from
217*9880d681SAndroid Build Coastguard Worker// other shift immediates. The imm6 field is encoded like so:
218*9880d681SAndroid Build Coastguard Worker//
219*9880d681SAndroid Build Coastguard Worker//    Offset    Encoding
220*9880d681SAndroid Build Coastguard Worker//     8        imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
221*9880d681SAndroid Build Coastguard Worker//     16       imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
222*9880d681SAndroid Build Coastguard Worker//     32       imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
223*9880d681SAndroid Build Coastguard Worker//     64       64 - <imm> is encoded in imm6<5:0>
224*9880d681SAndroid Build Coastguard Workerdef shr_imm8_asm_operand : ImmAsmOperand { let Name = "ShrImm8"; }
225*9880d681SAndroid Build Coastguard Workerdef shr_imm8  : Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 8; }]> {
226*9880d681SAndroid Build Coastguard Worker  let EncoderMethod = "getShiftRight8Imm";
227*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeShiftRight8Imm";
228*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = shr_imm8_asm_operand;
229*9880d681SAndroid Build Coastguard Worker}
230*9880d681SAndroid Build Coastguard Workerdef shr_imm16_asm_operand : ImmAsmOperand { let Name = "ShrImm16"; }
231*9880d681SAndroid Build Coastguard Workerdef shr_imm16 : Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 16; }]> {
232*9880d681SAndroid Build Coastguard Worker  let EncoderMethod = "getShiftRight16Imm";
233*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeShiftRight16Imm";
234*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = shr_imm16_asm_operand;
235*9880d681SAndroid Build Coastguard Worker}
236*9880d681SAndroid Build Coastguard Workerdef shr_imm32_asm_operand : ImmAsmOperand { let Name = "ShrImm32"; }
237*9880d681SAndroid Build Coastguard Workerdef shr_imm32 : Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]> {
238*9880d681SAndroid Build Coastguard Worker  let EncoderMethod = "getShiftRight32Imm";
239*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeShiftRight32Imm";
240*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = shr_imm32_asm_operand;
241*9880d681SAndroid Build Coastguard Worker}
242*9880d681SAndroid Build Coastguard Workerdef shr_imm64_asm_operand : ImmAsmOperand { let Name = "ShrImm64"; }
243*9880d681SAndroid Build Coastguard Workerdef shr_imm64 : Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 64; }]> {
244*9880d681SAndroid Build Coastguard Worker  let EncoderMethod = "getShiftRight64Imm";
245*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeShiftRight64Imm";
246*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = shr_imm64_asm_operand;
247*9880d681SAndroid Build Coastguard Worker}
248*9880d681SAndroid Build Coastguard Worker
249*9880d681SAndroid Build Coastguard Worker
250*9880d681SAndroid Build Coastguard Worker// ARM Assembler operand for ldr Rd, =expression which generates an offset
251*9880d681SAndroid Build Coastguard Worker// to a constant pool entry or a MOV depending on the value of expression
252*9880d681SAndroid Build Coastguard Workerdef const_pool_asm_operand : AsmOperandClass { let Name = "ConstPoolAsmImm"; }
253*9880d681SAndroid Build Coastguard Workerdef const_pool_asm_imm : Operand<i32> {
254*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = const_pool_asm_operand;
255*9880d681SAndroid Build Coastguard Worker}
256*9880d681SAndroid Build Coastguard Worker
257*9880d681SAndroid Build Coastguard Worker
258*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
259*9880d681SAndroid Build Coastguard Worker// ARM Assembler alias templates.
260*9880d681SAndroid Build Coastguard Worker//
261*9880d681SAndroid Build Coastguard Worker// Note: When EmitPriority == 1, the alias will be used for printing
262*9880d681SAndroid Build Coastguard Workerclass ARMInstAlias<string Asm, dag Result, bit EmitPriority = 0>
263*9880d681SAndroid Build Coastguard Worker      : InstAlias<Asm, Result, EmitPriority>, Requires<[IsARM]>;
264*9880d681SAndroid Build Coastguard Workerclass  tInstAlias<string Asm, dag Result, bit EmitPriority = 0>
265*9880d681SAndroid Build Coastguard Worker      : InstAlias<Asm, Result, EmitPriority>, Requires<[IsThumb]>;
266*9880d681SAndroid Build Coastguard Workerclass t2InstAlias<string Asm, dag Result, bit EmitPriority = 0>
267*9880d681SAndroid Build Coastguard Worker      : InstAlias<Asm, Result, EmitPriority>, Requires<[IsThumb2]>;
268*9880d681SAndroid Build Coastguard Workerclass VFP2InstAlias<string Asm, dag Result, bit EmitPriority = 0>
269*9880d681SAndroid Build Coastguard Worker      : InstAlias<Asm, Result, EmitPriority>, Requires<[HasVFP2]>;
270*9880d681SAndroid Build Coastguard Workerclass VFP2DPInstAlias<string Asm, dag Result, bit EmitPriority = 0>
271*9880d681SAndroid Build Coastguard Worker      : InstAlias<Asm, Result, EmitPriority>, Requires<[HasVFP2,HasDPVFP]>;
272*9880d681SAndroid Build Coastguard Workerclass VFP3InstAlias<string Asm, dag Result, bit EmitPriority = 0>
273*9880d681SAndroid Build Coastguard Worker      : InstAlias<Asm, Result, EmitPriority>, Requires<[HasVFP3]>;
274*9880d681SAndroid Build Coastguard Workerclass NEONInstAlias<string Asm, dag Result, bit EmitPriority = 0>
275*9880d681SAndroid Build Coastguard Worker      : InstAlias<Asm, Result, EmitPriority>, Requires<[HasNEON]>;
276*9880d681SAndroid Build Coastguard Worker
277*9880d681SAndroid Build Coastguard Worker
278*9880d681SAndroid Build Coastguard Workerclass VFP2MnemonicAlias<string src, string dst> : MnemonicAlias<src, dst>,
279*9880d681SAndroid Build Coastguard Worker          Requires<[HasVFP2]>;
280*9880d681SAndroid Build Coastguard Workerclass NEONMnemonicAlias<string src, string dst> : MnemonicAlias<src, dst>,
281*9880d681SAndroid Build Coastguard Worker          Requires<[HasNEON]>;
282*9880d681SAndroid Build Coastguard Worker
283*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
284*9880d681SAndroid Build Coastguard Worker// ARM Instruction templates.
285*9880d681SAndroid Build Coastguard Worker//
286*9880d681SAndroid Build Coastguard Worker
287*9880d681SAndroid Build Coastguard Worker
288*9880d681SAndroid Build Coastguard Workerclass InstTemplate<AddrMode am, int sz, IndexMode im,
289*9880d681SAndroid Build Coastguard Worker                   Format f, Domain d, string cstr, InstrItinClass itin>
290*9880d681SAndroid Build Coastguard Worker  : Instruction {
291*9880d681SAndroid Build Coastguard Worker  let Namespace = "ARM";
292*9880d681SAndroid Build Coastguard Worker
293*9880d681SAndroid Build Coastguard Worker  AddrMode AM = am;
294*9880d681SAndroid Build Coastguard Worker  int Size = sz;
295*9880d681SAndroid Build Coastguard Worker  IndexMode IM = im;
296*9880d681SAndroid Build Coastguard Worker  bits<2> IndexModeBits = IM.Value;
297*9880d681SAndroid Build Coastguard Worker  Format F = f;
298*9880d681SAndroid Build Coastguard Worker  bits<6> Form = F.Value;
299*9880d681SAndroid Build Coastguard Worker  Domain D = d;
300*9880d681SAndroid Build Coastguard Worker  bit isUnaryDataProc = 0;
301*9880d681SAndroid Build Coastguard Worker  bit canXformTo16Bit = 0;
302*9880d681SAndroid Build Coastguard Worker  // The instruction is a 16-bit flag setting Thumb instruction. Used
303*9880d681SAndroid Build Coastguard Worker  // by the parser to determine whether to require the 'S' suffix on the
304*9880d681SAndroid Build Coastguard Worker  // mnemonic (when not in an IT block) or preclude it (when in an IT block).
305*9880d681SAndroid Build Coastguard Worker  bit thumbArithFlagSetting = 0;
306*9880d681SAndroid Build Coastguard Worker
307*9880d681SAndroid Build Coastguard Worker  // If this is a pseudo instruction, mark it isCodeGenOnly.
308*9880d681SAndroid Build Coastguard Worker  let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
309*9880d681SAndroid Build Coastguard Worker
310*9880d681SAndroid Build Coastguard Worker  // The layout of TSFlags should be kept in sync with ARMBaseInfo.h.
311*9880d681SAndroid Build Coastguard Worker  let TSFlags{4-0}   = AM.Value;
312*9880d681SAndroid Build Coastguard Worker  let TSFlags{6-5}   = IndexModeBits;
313*9880d681SAndroid Build Coastguard Worker  let TSFlags{12-7} = Form;
314*9880d681SAndroid Build Coastguard Worker  let TSFlags{13}    = isUnaryDataProc;
315*9880d681SAndroid Build Coastguard Worker  let TSFlags{14}    = canXformTo16Bit;
316*9880d681SAndroid Build Coastguard Worker  let TSFlags{17-15} = D.Value;
317*9880d681SAndroid Build Coastguard Worker  let TSFlags{18}    = thumbArithFlagSetting;
318*9880d681SAndroid Build Coastguard Worker
319*9880d681SAndroid Build Coastguard Worker  let Constraints = cstr;
320*9880d681SAndroid Build Coastguard Worker  let Itinerary = itin;
321*9880d681SAndroid Build Coastguard Worker}
322*9880d681SAndroid Build Coastguard Worker
323*9880d681SAndroid Build Coastguard Workerclass Encoding {
324*9880d681SAndroid Build Coastguard Worker  field bits<32> Inst;
325*9880d681SAndroid Build Coastguard Worker  // Mask of bits that cause an encoding to be UNPREDICTABLE.
326*9880d681SAndroid Build Coastguard Worker  // If a bit is set, then if the corresponding bit in the
327*9880d681SAndroid Build Coastguard Worker  // target encoding differs from its value in the "Inst" field,
328*9880d681SAndroid Build Coastguard Worker  // the instruction is UNPREDICTABLE (SoftFail in abstract parlance).
329*9880d681SAndroid Build Coastguard Worker  field bits<32> Unpredictable = 0;
330*9880d681SAndroid Build Coastguard Worker  // SoftFail is the generic name for this field, but we alias it so
331*9880d681SAndroid Build Coastguard Worker  // as to make it more obvious what it means in ARM-land.
332*9880d681SAndroid Build Coastguard Worker  field bits<32> SoftFail = Unpredictable;
333*9880d681SAndroid Build Coastguard Worker}
334*9880d681SAndroid Build Coastguard Worker
335*9880d681SAndroid Build Coastguard Workerclass InstARM<AddrMode am, int sz, IndexMode im,
336*9880d681SAndroid Build Coastguard Worker              Format f, Domain d, string cstr, InstrItinClass itin>
337*9880d681SAndroid Build Coastguard Worker  : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
338*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "ARM";
339*9880d681SAndroid Build Coastguard Worker}
340*9880d681SAndroid Build Coastguard Worker
341*9880d681SAndroid Build Coastguard Worker// This Encoding-less class is used by Thumb1 to specify the encoding bits later
342*9880d681SAndroid Build Coastguard Worker// on by adding flavors to specific instructions.
343*9880d681SAndroid Build Coastguard Workerclass InstThumb<AddrMode am, int sz, IndexMode im,
344*9880d681SAndroid Build Coastguard Worker                Format f, Domain d, string cstr, InstrItinClass itin>
345*9880d681SAndroid Build Coastguard Worker  : InstTemplate<am, sz, im, f, d, cstr, itin> {
346*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "Thumb";
347*9880d681SAndroid Build Coastguard Worker}
348*9880d681SAndroid Build Coastguard Worker
349*9880d681SAndroid Build Coastguard Worker// Pseudo-instructions for alternate assembly syntax (never used by codegen).
350*9880d681SAndroid Build Coastguard Worker// These are aliases that require C++ handling to convert to the target
351*9880d681SAndroid Build Coastguard Worker// instruction, while InstAliases can be handled directly by tblgen.
352*9880d681SAndroid Build Coastguard Workerclass AsmPseudoInst<string asm, dag iops, dag oops = (outs)>
353*9880d681SAndroid Build Coastguard Worker  : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo, GenericDomain,
354*9880d681SAndroid Build Coastguard Worker                 "", NoItinerary> {
355*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
356*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
357*9880d681SAndroid Build Coastguard Worker  let Pattern = [];
358*9880d681SAndroid Build Coastguard Worker  let isCodeGenOnly = 0; // So we get asm matcher for it.
359*9880d681SAndroid Build Coastguard Worker  let AsmString = asm;
360*9880d681SAndroid Build Coastguard Worker  let isPseudo = 1;
361*9880d681SAndroid Build Coastguard Worker}
362*9880d681SAndroid Build Coastguard Worker
363*9880d681SAndroid Build Coastguard Workerclass ARMAsmPseudo<string asm, dag iops, dag oops = (outs)>
364*9880d681SAndroid Build Coastguard Worker  : AsmPseudoInst<asm, iops, oops>, Requires<[IsARM]>;
365*9880d681SAndroid Build Coastguard Workerclass tAsmPseudo<string asm, dag iops, dag oops = (outs)>
366*9880d681SAndroid Build Coastguard Worker  : AsmPseudoInst<asm, iops, oops>, Requires<[IsThumb]>;
367*9880d681SAndroid Build Coastguard Workerclass t2AsmPseudo<string asm, dag iops, dag oops = (outs)>
368*9880d681SAndroid Build Coastguard Worker  : AsmPseudoInst<asm, iops, oops>, Requires<[IsThumb2]>;
369*9880d681SAndroid Build Coastguard Workerclass VFP2AsmPseudo<string asm, dag iops, dag oops = (outs)>
370*9880d681SAndroid Build Coastguard Worker  : AsmPseudoInst<asm, iops, oops>, Requires<[HasVFP2]>;
371*9880d681SAndroid Build Coastguard Workerclass NEONAsmPseudo<string asm, dag iops, dag oops = (outs)>
372*9880d681SAndroid Build Coastguard Worker  : AsmPseudoInst<asm, iops, oops>, Requires<[HasNEON]>;
373*9880d681SAndroid Build Coastguard Worker
374*9880d681SAndroid Build Coastguard Worker// Pseudo instructions for the code generator.
375*9880d681SAndroid Build Coastguard Workerclass PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
376*9880d681SAndroid Build Coastguard Worker  : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
377*9880d681SAndroid Build Coastguard Worker                 GenericDomain, "", itin> {
378*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
379*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
380*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
381*9880d681SAndroid Build Coastguard Worker  let isCodeGenOnly = 1;
382*9880d681SAndroid Build Coastguard Worker  let isPseudo = 1;
383*9880d681SAndroid Build Coastguard Worker}
384*9880d681SAndroid Build Coastguard Worker
385*9880d681SAndroid Build Coastguard Worker// PseudoInst that's ARM-mode only.
386*9880d681SAndroid Build Coastguard Workerclass ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
387*9880d681SAndroid Build Coastguard Worker                    list<dag> pattern>
388*9880d681SAndroid Build Coastguard Worker  : PseudoInst<oops, iops, itin, pattern> {
389*9880d681SAndroid Build Coastguard Worker  let Size = sz;
390*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM];
391*9880d681SAndroid Build Coastguard Worker}
392*9880d681SAndroid Build Coastguard Worker
393*9880d681SAndroid Build Coastguard Worker// PseudoInst that's Thumb-mode only.
394*9880d681SAndroid Build Coastguard Workerclass tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
395*9880d681SAndroid Build Coastguard Worker                    list<dag> pattern>
396*9880d681SAndroid Build Coastguard Worker  : PseudoInst<oops, iops, itin, pattern> {
397*9880d681SAndroid Build Coastguard Worker  let Size = sz;
398*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb];
399*9880d681SAndroid Build Coastguard Worker}
400*9880d681SAndroid Build Coastguard Worker
401*9880d681SAndroid Build Coastguard Worker// PseudoInst that's Thumb2-mode only.
402*9880d681SAndroid Build Coastguard Workerclass t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
403*9880d681SAndroid Build Coastguard Worker                    list<dag> pattern>
404*9880d681SAndroid Build Coastguard Worker  : PseudoInst<oops, iops, itin, pattern> {
405*9880d681SAndroid Build Coastguard Worker  let Size = sz;
406*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb2];
407*9880d681SAndroid Build Coastguard Worker}
408*9880d681SAndroid Build Coastguard Worker
409*9880d681SAndroid Build Coastguard Workerclass ARMPseudoExpand<dag oops, dag iops, int sz,
410*9880d681SAndroid Build Coastguard Worker                      InstrItinClass itin, list<dag> pattern,
411*9880d681SAndroid Build Coastguard Worker                      dag Result>
412*9880d681SAndroid Build Coastguard Worker  : ARMPseudoInst<oops, iops, sz, itin, pattern>,
413*9880d681SAndroid Build Coastguard Worker    PseudoInstExpansion<Result>;
414*9880d681SAndroid Build Coastguard Worker
415*9880d681SAndroid Build Coastguard Workerclass tPseudoExpand<dag oops, dag iops, int sz,
416*9880d681SAndroid Build Coastguard Worker                    InstrItinClass itin, list<dag> pattern,
417*9880d681SAndroid Build Coastguard Worker                    dag Result>
418*9880d681SAndroid Build Coastguard Worker  : tPseudoInst<oops, iops, sz, itin, pattern>,
419*9880d681SAndroid Build Coastguard Worker    PseudoInstExpansion<Result>;
420*9880d681SAndroid Build Coastguard Worker
421*9880d681SAndroid Build Coastguard Workerclass t2PseudoExpand<dag oops, dag iops, int sz,
422*9880d681SAndroid Build Coastguard Worker                    InstrItinClass itin, list<dag> pattern,
423*9880d681SAndroid Build Coastguard Worker                    dag Result>
424*9880d681SAndroid Build Coastguard Worker  : t2PseudoInst<oops, iops, sz, itin, pattern>,
425*9880d681SAndroid Build Coastguard Worker    PseudoInstExpansion<Result>;
426*9880d681SAndroid Build Coastguard Worker
427*9880d681SAndroid Build Coastguard Worker// Almost all ARM instructions are predicable.
428*9880d681SAndroid Build Coastguard Workerclass I<dag oops, dag iops, AddrMode am, int sz,
429*9880d681SAndroid Build Coastguard Worker        IndexMode im, Format f, InstrItinClass itin,
430*9880d681SAndroid Build Coastguard Worker        string opc, string asm, string cstr,
431*9880d681SAndroid Build Coastguard Worker        list<dag> pattern>
432*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
433*9880d681SAndroid Build Coastguard Worker  bits<4> p;
434*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = p;
435*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
436*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
437*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", asm);
438*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
439*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM];
440*9880d681SAndroid Build Coastguard Worker}
441*9880d681SAndroid Build Coastguard Worker
442*9880d681SAndroid Build Coastguard Worker// A few are not predicable
443*9880d681SAndroid Build Coastguard Workerclass InoP<dag oops, dag iops, AddrMode am, int sz,
444*9880d681SAndroid Build Coastguard Worker           IndexMode im, Format f, InstrItinClass itin,
445*9880d681SAndroid Build Coastguard Worker           string opc, string asm, string cstr,
446*9880d681SAndroid Build Coastguard Worker           list<dag> pattern>
447*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
448*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
449*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
450*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, asm);
451*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
452*9880d681SAndroid Build Coastguard Worker  let isPredicable = 0;
453*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM];
454*9880d681SAndroid Build Coastguard Worker}
455*9880d681SAndroid Build Coastguard Worker
456*9880d681SAndroid Build Coastguard Worker// Same as I except it can optionally modify CPSR. Note it's modeled as an input
457*9880d681SAndroid Build Coastguard Worker// operand since by default it's a zero register. It will become an implicit def
458*9880d681SAndroid Build Coastguard Worker// once it's "flipped".
459*9880d681SAndroid Build Coastguard Workerclass sI<dag oops, dag iops, AddrMode am, int sz,
460*9880d681SAndroid Build Coastguard Worker         IndexMode im, Format f, InstrItinClass itin,
461*9880d681SAndroid Build Coastguard Worker         string opc, string asm, string cstr,
462*9880d681SAndroid Build Coastguard Worker         list<dag> pattern>
463*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
464*9880d681SAndroid Build Coastguard Worker  bits<4> p; // Predicate operand
465*9880d681SAndroid Build Coastguard Worker  bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
466*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = p;
467*9880d681SAndroid Build Coastguard Worker  let Inst{20} = s;
468*9880d681SAndroid Build Coastguard Worker
469*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
470*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
471*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${s}${p}", asm);
472*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
473*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM];
474*9880d681SAndroid Build Coastguard Worker}
475*9880d681SAndroid Build Coastguard Worker
476*9880d681SAndroid Build Coastguard Worker// Special cases
477*9880d681SAndroid Build Coastguard Workerclass XI<dag oops, dag iops, AddrMode am, int sz,
478*9880d681SAndroid Build Coastguard Worker         IndexMode im, Format f, InstrItinClass itin,
479*9880d681SAndroid Build Coastguard Worker         string asm, string cstr, list<dag> pattern>
480*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
481*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
482*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
483*9880d681SAndroid Build Coastguard Worker  let AsmString = asm;
484*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
485*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM];
486*9880d681SAndroid Build Coastguard Worker}
487*9880d681SAndroid Build Coastguard Worker
488*9880d681SAndroid Build Coastguard Workerclass AI<dag oops, dag iops, Format f, InstrItinClass itin,
489*9880d681SAndroid Build Coastguard Worker         string opc, string asm, list<dag> pattern>
490*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
491*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern>;
492*9880d681SAndroid Build Coastguard Workerclass AsI<dag oops, dag iops, Format f, InstrItinClass itin,
493*9880d681SAndroid Build Coastguard Worker          string opc, string asm, list<dag> pattern>
494*9880d681SAndroid Build Coastguard Worker  : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
495*9880d681SAndroid Build Coastguard Worker       opc, asm, "", pattern>;
496*9880d681SAndroid Build Coastguard Workerclass AXI<dag oops, dag iops, Format f, InstrItinClass itin,
497*9880d681SAndroid Build Coastguard Worker          string asm, list<dag> pattern>
498*9880d681SAndroid Build Coastguard Worker  : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
499*9880d681SAndroid Build Coastguard Worker       asm, "", pattern>;
500*9880d681SAndroid Build Coastguard Workerclass AXIM<dag oops, dag iops, AddrMode am, Format f, InstrItinClass itin,
501*9880d681SAndroid Build Coastguard Worker          string asm, list<dag> pattern>
502*9880d681SAndroid Build Coastguard Worker  : XI<oops, iops, am, 4, IndexModeNone, f, itin,
503*9880d681SAndroid Build Coastguard Worker       asm, "", pattern>;
504*9880d681SAndroid Build Coastguard Workerclass AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
505*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
506*9880d681SAndroid Build Coastguard Worker  : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
507*9880d681SAndroid Build Coastguard Worker         opc, asm, "", pattern>;
508*9880d681SAndroid Build Coastguard Worker
509*9880d681SAndroid Build Coastguard Worker// Ctrl flow instructions
510*9880d681SAndroid Build Coastguard Workerclass ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
511*9880d681SAndroid Build Coastguard Worker          string opc, string asm, list<dag> pattern>
512*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
513*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
514*9880d681SAndroid Build Coastguard Worker  let Inst{27-24} = opcod;
515*9880d681SAndroid Build Coastguard Worker}
516*9880d681SAndroid Build Coastguard Workerclass ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
517*9880d681SAndroid Build Coastguard Worker           string asm, list<dag> pattern>
518*9880d681SAndroid Build Coastguard Worker  : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
519*9880d681SAndroid Build Coastguard Worker       asm, "", pattern> {
520*9880d681SAndroid Build Coastguard Worker  let Inst{27-24} = opcod;
521*9880d681SAndroid Build Coastguard Worker}
522*9880d681SAndroid Build Coastguard Worker
523*9880d681SAndroid Build Coastguard Worker// BR_JT instructions
524*9880d681SAndroid Build Coastguard Workerclass JTI<dag oops, dag iops, InstrItinClass itin,
525*9880d681SAndroid Build Coastguard Worker          string asm, list<dag> pattern>
526*9880d681SAndroid Build Coastguard Worker  : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
527*9880d681SAndroid Build Coastguard Worker       asm, "", pattern>;
528*9880d681SAndroid Build Coastguard Worker
529*9880d681SAndroid Build Coastguard Workerclass AIldr_ex_or_acq<bits<2> opcod, bits<2> opcod2, dag oops, dag iops, InstrItinClass itin,
530*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
531*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
532*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
533*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
534*9880d681SAndroid Build Coastguard Worker  bits<4> addr;
535*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = 0b00011;
536*9880d681SAndroid Build Coastguard Worker  let Inst{22-21} = opcod;
537*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = 1;
538*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr;
539*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt;
540*9880d681SAndroid Build Coastguard Worker  let Inst{11-10} = 0b11;
541*9880d681SAndroid Build Coastguard Worker  let Inst{9-8}   = opcod2;
542*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = 0b10011111;
543*9880d681SAndroid Build Coastguard Worker}
544*9880d681SAndroid Build Coastguard Workerclass AIstr_ex_or_rel<bits<2> opcod, bits<2> opcod2, dag oops, dag iops, InstrItinClass itin,
545*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
546*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
547*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
548*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
549*9880d681SAndroid Build Coastguard Worker  bits<4> addr;
550*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = 0b00011;
551*9880d681SAndroid Build Coastguard Worker  let Inst{22-21} = opcod;
552*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = 0;
553*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr;
554*9880d681SAndroid Build Coastguard Worker  let Inst{11-10} = 0b11;
555*9880d681SAndroid Build Coastguard Worker  let Inst{9-8}   = opcod2;
556*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = 0b1001;
557*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Rt;
558*9880d681SAndroid Build Coastguard Worker}
559*9880d681SAndroid Build Coastguard Worker// Atomic load/store instructions
560*9880d681SAndroid Build Coastguard Workerclass AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
561*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
562*9880d681SAndroid Build Coastguard Worker  : AIldr_ex_or_acq<opcod, 0b11, oops, iops, itin, opc, asm, pattern>;
563*9880d681SAndroid Build Coastguard Worker
564*9880d681SAndroid Build Coastguard Workerclass AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
565*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
566*9880d681SAndroid Build Coastguard Worker  : AIstr_ex_or_rel<opcod, 0b11, oops, iops, itin, opc, asm, pattern> {
567*9880d681SAndroid Build Coastguard Worker  bits<4> Rd;
568*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rd;
569*9880d681SAndroid Build Coastguard Worker}
570*9880d681SAndroid Build Coastguard Worker
571*9880d681SAndroid Build Coastguard Worker// Exclusive load/store instructions
572*9880d681SAndroid Build Coastguard Worker
573*9880d681SAndroid Build Coastguard Workerclass AIldaex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
574*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
575*9880d681SAndroid Build Coastguard Worker  : AIldr_ex_or_acq<opcod, 0b10, oops, iops, itin, opc, asm, pattern>,
576*9880d681SAndroid Build Coastguard Worker    Requires<[IsARM, HasAcquireRelease, HasV7Clrex]>;
577*9880d681SAndroid Build Coastguard Worker
578*9880d681SAndroid Build Coastguard Workerclass AIstlex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
579*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
580*9880d681SAndroid Build Coastguard Worker  : AIstr_ex_or_rel<opcod, 0b10, oops, iops, itin, opc, asm, pattern>,
581*9880d681SAndroid Build Coastguard Worker    Requires<[IsARM, HasAcquireRelease, HasV7Clrex]> {
582*9880d681SAndroid Build Coastguard Worker  bits<4> Rd;
583*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rd;
584*9880d681SAndroid Build Coastguard Worker}
585*9880d681SAndroid Build Coastguard Worker
586*9880d681SAndroid Build Coastguard Workerclass AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
587*9880d681SAndroid Build Coastguard Worker  : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
588*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
589*9880d681SAndroid Build Coastguard Worker  bits<4> Rt2;
590*9880d681SAndroid Build Coastguard Worker  bits<4> addr;
591*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = 0b00010;
592*9880d681SAndroid Build Coastguard Worker  let Inst{22} = b;
593*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = 0b00;
594*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr;
595*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt;
596*9880d681SAndroid Build Coastguard Worker  let Inst{11-4} = 0b00001001;
597*9880d681SAndroid Build Coastguard Worker  let Inst{3-0} = Rt2;
598*9880d681SAndroid Build Coastguard Worker
599*9880d681SAndroid Build Coastguard Worker  let Unpredictable{11-8} = 0b1111;
600*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeSwap";
601*9880d681SAndroid Build Coastguard Worker}
602*9880d681SAndroid Build Coastguard Worker// Acquire/Release load/store instructions
603*9880d681SAndroid Build Coastguard Workerclass AIldracq<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
604*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
605*9880d681SAndroid Build Coastguard Worker  : AIldr_ex_or_acq<opcod, 0b00, oops, iops, itin, opc, asm, pattern>,
606*9880d681SAndroid Build Coastguard Worker    Requires<[IsARM, HasAcquireRelease]>;
607*9880d681SAndroid Build Coastguard Worker
608*9880d681SAndroid Build Coastguard Workerclass AIstrrel<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
609*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
610*9880d681SAndroid Build Coastguard Worker  : AIstr_ex_or_rel<opcod, 0b00, oops, iops, itin, opc, asm, pattern>,
611*9880d681SAndroid Build Coastguard Worker    Requires<[IsARM, HasAcquireRelease]> {
612*9880d681SAndroid Build Coastguard Worker  let Inst{15-12}   = 0b1111;
613*9880d681SAndroid Build Coastguard Worker}
614*9880d681SAndroid Build Coastguard Worker
615*9880d681SAndroid Build Coastguard Worker// addrmode1 instructions
616*9880d681SAndroid Build Coastguard Workerclass AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
617*9880d681SAndroid Build Coastguard Worker          string opc, string asm, list<dag> pattern>
618*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
619*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
620*9880d681SAndroid Build Coastguard Worker  let Inst{24-21} = opcod;
621*9880d681SAndroid Build Coastguard Worker  let Inst{27-26} = 0b00;
622*9880d681SAndroid Build Coastguard Worker}
623*9880d681SAndroid Build Coastguard Workerclass AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
624*9880d681SAndroid Build Coastguard Worker           string opc, string asm, list<dag> pattern>
625*9880d681SAndroid Build Coastguard Worker  : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
626*9880d681SAndroid Build Coastguard Worker       opc, asm, "", pattern> {
627*9880d681SAndroid Build Coastguard Worker  let Inst{24-21} = opcod;
628*9880d681SAndroid Build Coastguard Worker  let Inst{27-26} = 0b00;
629*9880d681SAndroid Build Coastguard Worker}
630*9880d681SAndroid Build Coastguard Workerclass AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
631*9880d681SAndroid Build Coastguard Worker           string asm, list<dag> pattern>
632*9880d681SAndroid Build Coastguard Worker  : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
633*9880d681SAndroid Build Coastguard Worker       asm, "", pattern> {
634*9880d681SAndroid Build Coastguard Worker  let Inst{24-21} = opcod;
635*9880d681SAndroid Build Coastguard Worker  let Inst{27-26} = 0b00;
636*9880d681SAndroid Build Coastguard Worker}
637*9880d681SAndroid Build Coastguard Worker
638*9880d681SAndroid Build Coastguard Worker// loads
639*9880d681SAndroid Build Coastguard Worker
640*9880d681SAndroid Build Coastguard Worker// LDR/LDRB/STR/STRB/...
641*9880d681SAndroid Build Coastguard Workerclass AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
642*9880d681SAndroid Build Coastguard Worker             Format f, InstrItinClass itin, string opc, string asm,
643*9880d681SAndroid Build Coastguard Worker             list<dag> pattern>
644*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
645*9880d681SAndroid Build Coastguard Worker      "", pattern> {
646*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = op;
647*9880d681SAndroid Build Coastguard Worker  let Inst{24} = 1;  // 24 == P
648*9880d681SAndroid Build Coastguard Worker  // 23 == U
649*9880d681SAndroid Build Coastguard Worker  let Inst{22} = isByte;
650*9880d681SAndroid Build Coastguard Worker  let Inst{21} = 0;  // 21 == W
651*9880d681SAndroid Build Coastguard Worker  let Inst{20} = isLd;
652*9880d681SAndroid Build Coastguard Worker}
653*9880d681SAndroid Build Coastguard Worker// Indexed load/stores
654*9880d681SAndroid Build Coastguard Workerclass AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
655*9880d681SAndroid Build Coastguard Worker                IndexMode im, Format f, InstrItinClass itin, string opc,
656*9880d681SAndroid Build Coastguard Worker                string asm, string cstr, list<dag> pattern>
657*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrMode2, 4, im, f, itin,
658*9880d681SAndroid Build Coastguard Worker      opc, asm, cstr, pattern> {
659*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
660*9880d681SAndroid Build Coastguard Worker  let Inst{27-26} = 0b01;
661*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = isPre; // P bit
662*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = isByte; // B bit
663*9880d681SAndroid Build Coastguard Worker  let Inst{21}    = isPre; // W bit
664*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = isLd; // L bit
665*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt;
666*9880d681SAndroid Build Coastguard Worker}
667*9880d681SAndroid Build Coastguard Workerclass AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
668*9880d681SAndroid Build Coastguard Worker                IndexMode im, Format f, InstrItinClass itin, string opc,
669*9880d681SAndroid Build Coastguard Worker                string asm, string cstr, list<dag> pattern>
670*9880d681SAndroid Build Coastguard Worker  : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
671*9880d681SAndroid Build Coastguard Worker               pattern> {
672*9880d681SAndroid Build Coastguard Worker  // AM2 store w/ two operands: (GPR, am2offset)
673*9880d681SAndroid Build Coastguard Worker  // {12}     isAdd
674*9880d681SAndroid Build Coastguard Worker  // {11-0}   imm12/Rm
675*9880d681SAndroid Build Coastguard Worker  bits<14> offset;
676*9880d681SAndroid Build Coastguard Worker  bits<4> Rn;
677*9880d681SAndroid Build Coastguard Worker  let Inst{25} = 1;
678*9880d681SAndroid Build Coastguard Worker  let Inst{23} = offset{12};
679*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn;
680*9880d681SAndroid Build Coastguard Worker  let Inst{11-5} = offset{11-5};
681*9880d681SAndroid Build Coastguard Worker  let Inst{4} = 0;
682*9880d681SAndroid Build Coastguard Worker  let Inst{3-0} = offset{3-0};
683*9880d681SAndroid Build Coastguard Worker}
684*9880d681SAndroid Build Coastguard Worker
685*9880d681SAndroid Build Coastguard Workerclass AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
686*9880d681SAndroid Build Coastguard Worker                IndexMode im, Format f, InstrItinClass itin, string opc,
687*9880d681SAndroid Build Coastguard Worker                string asm, string cstr, list<dag> pattern>
688*9880d681SAndroid Build Coastguard Worker  : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
689*9880d681SAndroid Build Coastguard Worker               pattern> {
690*9880d681SAndroid Build Coastguard Worker  // AM2 store w/ two operands: (GPR, am2offset)
691*9880d681SAndroid Build Coastguard Worker  // {12}     isAdd
692*9880d681SAndroid Build Coastguard Worker  // {11-0}   imm12/Rm
693*9880d681SAndroid Build Coastguard Worker  bits<14> offset;
694*9880d681SAndroid Build Coastguard Worker  bits<4> Rn;
695*9880d681SAndroid Build Coastguard Worker  let Inst{25} = 0;
696*9880d681SAndroid Build Coastguard Worker  let Inst{23} = offset{12};
697*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn;
698*9880d681SAndroid Build Coastguard Worker  let Inst{11-0} = offset{11-0};
699*9880d681SAndroid Build Coastguard Worker}
700*9880d681SAndroid Build Coastguard Worker
701*9880d681SAndroid Build Coastguard Worker
702*9880d681SAndroid Build Coastguard Worker// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
703*9880d681SAndroid Build Coastguard Worker// but for now use this class for STRT and STRBT.
704*9880d681SAndroid Build Coastguard Workerclass AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
705*9880d681SAndroid Build Coastguard Worker                IndexMode im, Format f, InstrItinClass itin, string opc,
706*9880d681SAndroid Build Coastguard Worker                string asm, string cstr, list<dag> pattern>
707*9880d681SAndroid Build Coastguard Worker  : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
708*9880d681SAndroid Build Coastguard Worker               pattern> {
709*9880d681SAndroid Build Coastguard Worker  // AM2 store w/ two operands: (GPR, am2offset)
710*9880d681SAndroid Build Coastguard Worker  // {17-14}  Rn
711*9880d681SAndroid Build Coastguard Worker  // {13}     1 == Rm, 0 == imm12
712*9880d681SAndroid Build Coastguard Worker  // {12}     isAdd
713*9880d681SAndroid Build Coastguard Worker  // {11-0}   imm12/Rm
714*9880d681SAndroid Build Coastguard Worker  bits<18> addr;
715*9880d681SAndroid Build Coastguard Worker  let Inst{25} = addr{13};
716*9880d681SAndroid Build Coastguard Worker  let Inst{23} = addr{12};
717*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr{17-14};
718*9880d681SAndroid Build Coastguard Worker  let Inst{11-0} = addr{11-0};
719*9880d681SAndroid Build Coastguard Worker}
720*9880d681SAndroid Build Coastguard Worker
721*9880d681SAndroid Build Coastguard Worker// addrmode3 instructions
722*9880d681SAndroid Build Coastguard Workerclass AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
723*9880d681SAndroid Build Coastguard Worker            InstrItinClass itin, string opc, string asm, list<dag> pattern>
724*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
725*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
726*9880d681SAndroid Build Coastguard Worker  bits<14> addr;
727*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
728*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = 0b000;
729*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = 1;            // P bit
730*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = addr{8};      // U bit
731*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = addr{13};     // 1 == imm8, 0 == Rm
732*9880d681SAndroid Build Coastguard Worker  let Inst{21}    = 0;            // W bit
733*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = op20;         // L bit
734*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr{12-9};   // Rn
735*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt;           // Rt
736*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = addr{7-4};    // imm7_4/zero
737*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = op;
738*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = addr{3-0};    // imm3_0/Rm
739*9880d681SAndroid Build Coastguard Worker
740*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeAddrMode3Instruction";
741*9880d681SAndroid Build Coastguard Worker}
742*9880d681SAndroid Build Coastguard Worker
743*9880d681SAndroid Build Coastguard Workerclass AI3ldstidx<bits<4> op, bit op20, bit isPre, dag oops, dag iops,
744*9880d681SAndroid Build Coastguard Worker                IndexMode im, Format f, InstrItinClass itin, string opc,
745*9880d681SAndroid Build Coastguard Worker                string asm, string cstr, list<dag> pattern>
746*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrMode3, 4, im, f, itin,
747*9880d681SAndroid Build Coastguard Worker      opc, asm, cstr, pattern> {
748*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
749*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = 0b000;
750*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = isPre;        // P bit
751*9880d681SAndroid Build Coastguard Worker  let Inst{21}    = isPre;        // W bit
752*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = op20;         // L bit
753*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt;           // Rt
754*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = op;
755*9880d681SAndroid Build Coastguard Worker}
756*9880d681SAndroid Build Coastguard Worker
757*9880d681SAndroid Build Coastguard Worker// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
758*9880d681SAndroid Build Coastguard Worker// but for now use this class for LDRSBT, LDRHT, LDSHT.
759*9880d681SAndroid Build Coastguard Workerclass AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
760*9880d681SAndroid Build Coastguard Worker                  IndexMode im, Format f, InstrItinClass itin, string opc,
761*9880d681SAndroid Build Coastguard Worker                  string asm, string cstr, list<dag> pattern>
762*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrMode3, 4, im, f, itin, opc, asm, cstr, pattern> {
763*9880d681SAndroid Build Coastguard Worker  // {13}     1 == imm8, 0 == Rm
764*9880d681SAndroid Build Coastguard Worker  // {12-9}   Rn
765*9880d681SAndroid Build Coastguard Worker  // {8}      isAdd
766*9880d681SAndroid Build Coastguard Worker  // {7-4}    imm7_4/zero
767*9880d681SAndroid Build Coastguard Worker  // {3-0}    imm3_0/Rm
768*9880d681SAndroid Build Coastguard Worker  bits<4> addr;
769*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
770*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = 0b000;
771*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = 0;            // P bit
772*9880d681SAndroid Build Coastguard Worker  let Inst{21}    = 1;
773*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = isLoad;       // L bit
774*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr;         // Rn
775*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt;           // Rt
776*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = op;
777*9880d681SAndroid Build Coastguard Worker}
778*9880d681SAndroid Build Coastguard Worker
779*9880d681SAndroid Build Coastguard Worker// stores
780*9880d681SAndroid Build Coastguard Workerclass AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
781*9880d681SAndroid Build Coastguard Worker             string opc, string asm, list<dag> pattern>
782*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
783*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
784*9880d681SAndroid Build Coastguard Worker  bits<14> addr;
785*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
786*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = 0b000;
787*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = 1;            // P bit
788*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = addr{8};      // U bit
789*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = addr{13};     // 1 == imm8, 0 == Rm
790*9880d681SAndroid Build Coastguard Worker  let Inst{21}    = 0;            // W bit
791*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = 0;            // L bit
792*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr{12-9};   // Rn
793*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt;           // Rt
794*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = addr{7-4};    // imm7_4/zero
795*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = op;
796*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = addr{3-0};    // imm3_0/Rm
797*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeAddrMode3Instruction";
798*9880d681SAndroid Build Coastguard Worker}
799*9880d681SAndroid Build Coastguard Worker
800*9880d681SAndroid Build Coastguard Worker// addrmode4 instructions
801*9880d681SAndroid Build Coastguard Workerclass AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
802*9880d681SAndroid Build Coastguard Worker           string asm, string cstr, list<dag> pattern>
803*9880d681SAndroid Build Coastguard Worker  : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
804*9880d681SAndroid Build Coastguard Worker  bits<4>  p;
805*9880d681SAndroid Build Coastguard Worker  bits<16> regs;
806*9880d681SAndroid Build Coastguard Worker  bits<4>  Rn;
807*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = p;
808*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = 0b100;
809*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = 0; // S bit
810*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn;
811*9880d681SAndroid Build Coastguard Worker  let Inst{15-0}  = regs;
812*9880d681SAndroid Build Coastguard Worker}
813*9880d681SAndroid Build Coastguard Worker
814*9880d681SAndroid Build Coastguard Worker// Unsigned multiply, multiply-accumulate instructions.
815*9880d681SAndroid Build Coastguard Workerclass AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
816*9880d681SAndroid Build Coastguard Worker             string opc, string asm, list<dag> pattern>
817*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
818*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
819*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = 0b1001;
820*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = 0; // S bit
821*9880d681SAndroid Build Coastguard Worker  let Inst{27-21} = opcod;
822*9880d681SAndroid Build Coastguard Worker}
823*9880d681SAndroid Build Coastguard Workerclass AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
824*9880d681SAndroid Build Coastguard Worker              string opc, string asm, list<dag> pattern>
825*9880d681SAndroid Build Coastguard Worker  : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
826*9880d681SAndroid Build Coastguard Worker       opc, asm, "", pattern> {
827*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = 0b1001;
828*9880d681SAndroid Build Coastguard Worker  let Inst{27-21} = opcod;
829*9880d681SAndroid Build Coastguard Worker}
830*9880d681SAndroid Build Coastguard Worker
831*9880d681SAndroid Build Coastguard Worker// Most significant word multiply
832*9880d681SAndroid Build Coastguard Workerclass AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
833*9880d681SAndroid Build Coastguard Worker             InstrItinClass itin, string opc, string asm, list<dag> pattern>
834*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
835*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
836*9880d681SAndroid Build Coastguard Worker  bits<4> Rd;
837*9880d681SAndroid Build Coastguard Worker  bits<4> Rn;
838*9880d681SAndroid Build Coastguard Worker  bits<4> Rm;
839*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = opc7_4;
840*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = 1;
841*9880d681SAndroid Build Coastguard Worker  let Inst{27-21} = opcod;
842*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rd;
843*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = Rm;
844*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Rn;
845*9880d681SAndroid Build Coastguard Worker}
846*9880d681SAndroid Build Coastguard Worker// MSW multiple w/ Ra operand
847*9880d681SAndroid Build Coastguard Workerclass AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
848*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin, string opc, string asm, list<dag> pattern>
849*9880d681SAndroid Build Coastguard Worker  : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
850*9880d681SAndroid Build Coastguard Worker  bits<4> Ra;
851*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Ra;
852*9880d681SAndroid Build Coastguard Worker}
853*9880d681SAndroid Build Coastguard Worker
854*9880d681SAndroid Build Coastguard Worker// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
855*9880d681SAndroid Build Coastguard Workerclass AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
856*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin, string opc, string asm, list<dag> pattern>
857*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
858*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
859*9880d681SAndroid Build Coastguard Worker  bits<4> Rn;
860*9880d681SAndroid Build Coastguard Worker  bits<4> Rm;
861*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = 0;
862*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = 1;
863*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = 0;
864*9880d681SAndroid Build Coastguard Worker  let Inst{27-21} = opcod;
865*9880d681SAndroid Build Coastguard Worker  let Inst{6-5}   = bit6_5;
866*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = Rm;
867*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Rn;
868*9880d681SAndroid Build Coastguard Worker}
869*9880d681SAndroid Build Coastguard Workerclass AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
870*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin, string opc, string asm, list<dag> pattern>
871*9880d681SAndroid Build Coastguard Worker  : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
872*9880d681SAndroid Build Coastguard Worker  bits<4> Rd;
873*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rd;
874*9880d681SAndroid Build Coastguard Worker}
875*9880d681SAndroid Build Coastguard Worker
876*9880d681SAndroid Build Coastguard Worker// AMulxyI with Ra operand
877*9880d681SAndroid Build Coastguard Workerclass AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
878*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin, string opc, string asm, list<dag> pattern>
879*9880d681SAndroid Build Coastguard Worker  : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
880*9880d681SAndroid Build Coastguard Worker  bits<4> Ra;
881*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Ra;
882*9880d681SAndroid Build Coastguard Worker}
883*9880d681SAndroid Build Coastguard Worker// SMLAL*
884*9880d681SAndroid Build Coastguard Workerclass AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
885*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin, string opc, string asm, list<dag> pattern>
886*9880d681SAndroid Build Coastguard Worker  : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
887*9880d681SAndroid Build Coastguard Worker  bits<4> RdLo;
888*9880d681SAndroid Build Coastguard Worker  bits<4> RdHi;
889*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = RdHi;
890*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = RdLo;
891*9880d681SAndroid Build Coastguard Worker}
892*9880d681SAndroid Build Coastguard Worker
893*9880d681SAndroid Build Coastguard Worker// Extend instructions.
894*9880d681SAndroid Build Coastguard Workerclass AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
895*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
896*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
897*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
898*9880d681SAndroid Build Coastguard Worker  // All AExtI instructions have Rd and Rm register operands.
899*9880d681SAndroid Build Coastguard Worker  bits<4> Rd;
900*9880d681SAndroid Build Coastguard Worker  bits<4> Rm;
901*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rd;
902*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Rm;
903*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = 0b0111;
904*9880d681SAndroid Build Coastguard Worker  let Inst{9-8}   = 0b00;
905*9880d681SAndroid Build Coastguard Worker  let Inst{27-20} = opcod;
906*9880d681SAndroid Build Coastguard Worker
907*9880d681SAndroid Build Coastguard Worker  let Unpredictable{9-8} = 0b11;
908*9880d681SAndroid Build Coastguard Worker}
909*9880d681SAndroid Build Coastguard Worker
910*9880d681SAndroid Build Coastguard Worker// Misc Arithmetic instructions.
911*9880d681SAndroid Build Coastguard Workerclass AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
912*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin, string opc, string asm, list<dag> pattern>
913*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
914*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
915*9880d681SAndroid Build Coastguard Worker  bits<4> Rd;
916*9880d681SAndroid Build Coastguard Worker  bits<4> Rm;
917*9880d681SAndroid Build Coastguard Worker  let Inst{27-20} = opcod;
918*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = 0b1111;
919*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rd;
920*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = 0b1111;
921*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = opc7_4;
922*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Rm;
923*9880d681SAndroid Build Coastguard Worker}
924*9880d681SAndroid Build Coastguard Worker
925*9880d681SAndroid Build Coastguard Worker// Division instructions.
926*9880d681SAndroid Build Coastguard Workerclass ADivA1I<bits<3> opcod, dag oops, dag iops,
927*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin, string opc, string asm, list<dag> pattern>
928*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
929*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
930*9880d681SAndroid Build Coastguard Worker  bits<4> Rd;
931*9880d681SAndroid Build Coastguard Worker  bits<4> Rn;
932*9880d681SAndroid Build Coastguard Worker  bits<4> Rm;
933*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = 0b01110;
934*9880d681SAndroid Build Coastguard Worker  let Inst{22-20} = opcod;
935*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rd;
936*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = 0b1111;
937*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = Rm;
938*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = 0b0001;
939*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Rn;
940*9880d681SAndroid Build Coastguard Worker}
941*9880d681SAndroid Build Coastguard Worker
942*9880d681SAndroid Build Coastguard Worker// PKH instructions
943*9880d681SAndroid Build Coastguard Workerdef PKHLSLAsmOperand : ImmAsmOperand {
944*9880d681SAndroid Build Coastguard Worker  let Name = "PKHLSLImm";
945*9880d681SAndroid Build Coastguard Worker  let ParserMethod = "parsePKHLSLImm";
946*9880d681SAndroid Build Coastguard Worker}
947*9880d681SAndroid Build Coastguard Workerdef pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
948*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printPKHLSLShiftImm";
949*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = PKHLSLAsmOperand;
950*9880d681SAndroid Build Coastguard Worker}
951*9880d681SAndroid Build Coastguard Workerdef PKHASRAsmOperand : AsmOperandClass {
952*9880d681SAndroid Build Coastguard Worker  let Name = "PKHASRImm";
953*9880d681SAndroid Build Coastguard Worker  let ParserMethod = "parsePKHASRImm";
954*9880d681SAndroid Build Coastguard Worker}
955*9880d681SAndroid Build Coastguard Workerdef pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
956*9880d681SAndroid Build Coastguard Worker  let PrintMethod = "printPKHASRShiftImm";
957*9880d681SAndroid Build Coastguard Worker  let ParserMatchClass = PKHASRAsmOperand;
958*9880d681SAndroid Build Coastguard Worker}
959*9880d681SAndroid Build Coastguard Worker
960*9880d681SAndroid Build Coastguard Workerclass APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
961*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
962*9880d681SAndroid Build Coastguard Worker  : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
963*9880d681SAndroid Build Coastguard Worker      opc, asm, "", pattern> {
964*9880d681SAndroid Build Coastguard Worker  bits<4> Rd;
965*9880d681SAndroid Build Coastguard Worker  bits<4> Rn;
966*9880d681SAndroid Build Coastguard Worker  bits<4> Rm;
967*9880d681SAndroid Build Coastguard Worker  bits<5> sh;
968*9880d681SAndroid Build Coastguard Worker  let Inst{27-20} = opcod;
969*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn;
970*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rd;
971*9880d681SAndroid Build Coastguard Worker  let Inst{11-7}  = sh;
972*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = tb;
973*9880d681SAndroid Build Coastguard Worker  let Inst{5-4}   = 0b01;
974*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Rm;
975*9880d681SAndroid Build Coastguard Worker}
976*9880d681SAndroid Build Coastguard Worker
977*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
978*9880d681SAndroid Build Coastguard Worker
979*9880d681SAndroid Build Coastguard Worker// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
980*9880d681SAndroid Build Coastguard Workerclass ARMPat<dag pattern, dag result> : Pat<pattern, result> {
981*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM];
982*9880d681SAndroid Build Coastguard Worker}
983*9880d681SAndroid Build Coastguard Workerclass ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
984*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM, HasV5T];
985*9880d681SAndroid Build Coastguard Worker}
986*9880d681SAndroid Build Coastguard Workerclass ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
987*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM, HasV5TE];
988*9880d681SAndroid Build Coastguard Worker}
989*9880d681SAndroid Build Coastguard Worker// ARMV5MOPat - Same as ARMV5TEPat with UseMulOps.
990*9880d681SAndroid Build Coastguard Workerclass ARMV5MOPat<dag pattern, dag result> : Pat<pattern, result> {
991*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM, HasV5TE, UseMulOps];
992*9880d681SAndroid Build Coastguard Worker}
993*9880d681SAndroid Build Coastguard Workerclass ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
994*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsARM, HasV6];
995*9880d681SAndroid Build Coastguard Worker}
996*9880d681SAndroid Build Coastguard Workerclass VFPPat<dag pattern, dag result> : Pat<pattern, result> {
997*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasVFP2];
998*9880d681SAndroid Build Coastguard Worker}
999*9880d681SAndroid Build Coastguard Workerclass VFPNoNEONPat<dag pattern, dag result> : Pat<pattern, result> {
1000*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasVFP2, DontUseNEONForFP];
1001*9880d681SAndroid Build Coastguard Worker}
1002*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
1003*9880d681SAndroid Build Coastguard Worker// Thumb Instruction Format Definitions.
1004*9880d681SAndroid Build Coastguard Worker//
1005*9880d681SAndroid Build Coastguard Worker
1006*9880d681SAndroid Build Coastguard Workerclass ThumbI<dag oops, dag iops, AddrMode am, int sz,
1007*9880d681SAndroid Build Coastguard Worker             InstrItinClass itin, string asm, string cstr, list<dag> pattern>
1008*9880d681SAndroid Build Coastguard Worker  : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1009*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1010*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
1011*9880d681SAndroid Build Coastguard Worker  let AsmString = asm;
1012*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1013*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb];
1014*9880d681SAndroid Build Coastguard Worker}
1015*9880d681SAndroid Build Coastguard Worker
1016*9880d681SAndroid Build Coastguard Worker// TI - Thumb instruction.
1017*9880d681SAndroid Build Coastguard Workerclass TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1018*9880d681SAndroid Build Coastguard Worker  : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
1019*9880d681SAndroid Build Coastguard Worker
1020*9880d681SAndroid Build Coastguard Worker// Two-address instructions
1021*9880d681SAndroid Build Coastguard Workerclass TIt<dag oops, dag iops, InstrItinClass itin, string asm,
1022*9880d681SAndroid Build Coastguard Worker          list<dag> pattern>
1023*9880d681SAndroid Build Coastguard Worker  : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
1024*9880d681SAndroid Build Coastguard Worker           pattern>;
1025*9880d681SAndroid Build Coastguard Worker
1026*9880d681SAndroid Build Coastguard Worker// tBL, tBX 32-bit instructions
1027*9880d681SAndroid Build Coastguard Workerclass TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
1028*9880d681SAndroid Build Coastguard Worker           dag oops, dag iops, InstrItinClass itin, string asm,
1029*9880d681SAndroid Build Coastguard Worker           list<dag> pattern>
1030*9880d681SAndroid Build Coastguard Worker    : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
1031*9880d681SAndroid Build Coastguard Worker      Encoding {
1032*9880d681SAndroid Build Coastguard Worker  let Inst{31-27} = opcod1;
1033*9880d681SAndroid Build Coastguard Worker  let Inst{15-14} = opcod2;
1034*9880d681SAndroid Build Coastguard Worker  let Inst{12}    = opcod3;
1035*9880d681SAndroid Build Coastguard Worker}
1036*9880d681SAndroid Build Coastguard Worker
1037*9880d681SAndroid Build Coastguard Worker// BR_JT instructions
1038*9880d681SAndroid Build Coastguard Workerclass TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1039*9880d681SAndroid Build Coastguard Worker           list<dag> pattern>
1040*9880d681SAndroid Build Coastguard Worker  : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
1041*9880d681SAndroid Build Coastguard Worker
1042*9880d681SAndroid Build Coastguard Worker// Thumb1 only
1043*9880d681SAndroid Build Coastguard Workerclass Thumb1I<dag oops, dag iops, AddrMode am, int sz,
1044*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin, string asm, string cstr, list<dag> pattern>
1045*9880d681SAndroid Build Coastguard Worker  : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1046*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1047*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
1048*9880d681SAndroid Build Coastguard Worker  let AsmString = asm;
1049*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1050*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1051*9880d681SAndroid Build Coastguard Worker}
1052*9880d681SAndroid Build Coastguard Worker
1053*9880d681SAndroid Build Coastguard Workerclass T1I<dag oops, dag iops, InstrItinClass itin,
1054*9880d681SAndroid Build Coastguard Worker          string asm, list<dag> pattern>
1055*9880d681SAndroid Build Coastguard Worker  : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
1056*9880d681SAndroid Build Coastguard Workerclass T1Ix2<dag oops, dag iops, InstrItinClass itin,
1057*9880d681SAndroid Build Coastguard Worker            string asm, list<dag> pattern>
1058*9880d681SAndroid Build Coastguard Worker  : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
1059*9880d681SAndroid Build Coastguard Worker
1060*9880d681SAndroid Build Coastguard Worker// Two-address instructions
1061*9880d681SAndroid Build Coastguard Workerclass T1It<dag oops, dag iops, InstrItinClass itin,
1062*9880d681SAndroid Build Coastguard Worker           string asm, string cstr, list<dag> pattern>
1063*9880d681SAndroid Build Coastguard Worker  : Thumb1I<oops, iops, AddrModeNone, 2, itin,
1064*9880d681SAndroid Build Coastguard Worker            asm, cstr, pattern>;
1065*9880d681SAndroid Build Coastguard Worker
1066*9880d681SAndroid Build Coastguard Worker// Thumb1 instruction that can either be predicated or set CPSR.
1067*9880d681SAndroid Build Coastguard Workerclass Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
1068*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin,
1069*9880d681SAndroid Build Coastguard Worker               string opc, string asm, string cstr, list<dag> pattern>
1070*9880d681SAndroid Build Coastguard Worker  : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1071*9880d681SAndroid Build Coastguard Worker  let OutOperandList = !con(oops, (outs s_cc_out:$s));
1072*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
1073*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${s}${p}", asm);
1074*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1075*9880d681SAndroid Build Coastguard Worker  let thumbArithFlagSetting = 1;
1076*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1077*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "ThumbSBit";
1078*9880d681SAndroid Build Coastguard Worker}
1079*9880d681SAndroid Build Coastguard Worker
1080*9880d681SAndroid Build Coastguard Workerclass T1sI<dag oops, dag iops, InstrItinClass itin,
1081*9880d681SAndroid Build Coastguard Worker           string opc, string asm, list<dag> pattern>
1082*9880d681SAndroid Build Coastguard Worker  : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
1083*9880d681SAndroid Build Coastguard Worker
1084*9880d681SAndroid Build Coastguard Worker// Two-address instructions
1085*9880d681SAndroid Build Coastguard Workerclass T1sIt<dag oops, dag iops, InstrItinClass itin,
1086*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
1087*9880d681SAndroid Build Coastguard Worker  : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
1088*9880d681SAndroid Build Coastguard Worker             "$Rn = $Rdn", pattern>;
1089*9880d681SAndroid Build Coastguard Worker
1090*9880d681SAndroid Build Coastguard Worker// Thumb1 instruction that can be predicated.
1091*9880d681SAndroid Build Coastguard Workerclass Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
1092*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin,
1093*9880d681SAndroid Build Coastguard Worker               string opc, string asm, string cstr, list<dag> pattern>
1094*9880d681SAndroid Build Coastguard Worker  : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1095*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1096*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
1097*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", asm);
1098*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1099*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1100*9880d681SAndroid Build Coastguard Worker}
1101*9880d681SAndroid Build Coastguard Worker
1102*9880d681SAndroid Build Coastguard Workerclass T1pI<dag oops, dag iops, InstrItinClass itin,
1103*9880d681SAndroid Build Coastguard Worker           string opc, string asm, list<dag> pattern>
1104*9880d681SAndroid Build Coastguard Worker  : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
1105*9880d681SAndroid Build Coastguard Worker
1106*9880d681SAndroid Build Coastguard Worker// Two-address instructions
1107*9880d681SAndroid Build Coastguard Workerclass T1pIt<dag oops, dag iops, InstrItinClass itin,
1108*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
1109*9880d681SAndroid Build Coastguard Worker  : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
1110*9880d681SAndroid Build Coastguard Worker             "$Rn = $Rdn", pattern>;
1111*9880d681SAndroid Build Coastguard Worker
1112*9880d681SAndroid Build Coastguard Workerclass T1pIs<dag oops, dag iops,
1113*9880d681SAndroid Build Coastguard Worker            InstrItinClass itin, string opc, string asm, list<dag> pattern>
1114*9880d681SAndroid Build Coastguard Worker  : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
1115*9880d681SAndroid Build Coastguard Worker
1116*9880d681SAndroid Build Coastguard Workerclass Encoding16 : Encoding {
1117*9880d681SAndroid Build Coastguard Worker  let Inst{31-16} = 0x0000;
1118*9880d681SAndroid Build Coastguard Worker}
1119*9880d681SAndroid Build Coastguard Worker
1120*9880d681SAndroid Build Coastguard Worker// A6.2 16-bit Thumb instruction encoding
1121*9880d681SAndroid Build Coastguard Workerclass T1Encoding<bits<6> opcode> : Encoding16 {
1122*9880d681SAndroid Build Coastguard Worker  let Inst{15-10} = opcode;
1123*9880d681SAndroid Build Coastguard Worker}
1124*9880d681SAndroid Build Coastguard Worker
1125*9880d681SAndroid Build Coastguard Worker// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
1126*9880d681SAndroid Build Coastguard Workerclass T1General<bits<5> opcode> : Encoding16 {
1127*9880d681SAndroid Build Coastguard Worker  let Inst{15-14} = 0b00;
1128*9880d681SAndroid Build Coastguard Worker  let Inst{13-9} = opcode;
1129*9880d681SAndroid Build Coastguard Worker}
1130*9880d681SAndroid Build Coastguard Worker
1131*9880d681SAndroid Build Coastguard Worker// A6.2.2 Data-processing encoding.
1132*9880d681SAndroid Build Coastguard Workerclass T1DataProcessing<bits<4> opcode> : Encoding16 {
1133*9880d681SAndroid Build Coastguard Worker  let Inst{15-10} = 0b010000;
1134*9880d681SAndroid Build Coastguard Worker  let Inst{9-6} = opcode;
1135*9880d681SAndroid Build Coastguard Worker}
1136*9880d681SAndroid Build Coastguard Worker
1137*9880d681SAndroid Build Coastguard Worker// A6.2.3 Special data instructions and branch and exchange encoding.
1138*9880d681SAndroid Build Coastguard Workerclass T1Special<bits<4> opcode> : Encoding16 {
1139*9880d681SAndroid Build Coastguard Worker  let Inst{15-10} = 0b010001;
1140*9880d681SAndroid Build Coastguard Worker  let Inst{9-6}   = opcode;
1141*9880d681SAndroid Build Coastguard Worker}
1142*9880d681SAndroid Build Coastguard Worker
1143*9880d681SAndroid Build Coastguard Worker// A6.2.4 Load/store single data item encoding.
1144*9880d681SAndroid Build Coastguard Workerclass T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
1145*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = opA;
1146*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = opB;
1147*9880d681SAndroid Build Coastguard Worker}
1148*9880d681SAndroid Build Coastguard Workerclass T1LdStSP<bits<3> opB>   : T1LoadStore<0b1001, opB>; // SP relative
1149*9880d681SAndroid Build Coastguard Worker
1150*9880d681SAndroid Build Coastguard Workerclass T1BranchCond<bits<4> opcode> : Encoding16 {
1151*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = opcode;
1152*9880d681SAndroid Build Coastguard Worker}
1153*9880d681SAndroid Build Coastguard Worker
1154*9880d681SAndroid Build Coastguard Worker// Helper classes to encode Thumb1 loads and stores. For immediates, the
1155*9880d681SAndroid Build Coastguard Worker// following bits are used for "opA" (see A6.2.4):
1156*9880d681SAndroid Build Coastguard Worker//
1157*9880d681SAndroid Build Coastguard Worker//   0b0110 => Immediate, 4 bytes
1158*9880d681SAndroid Build Coastguard Worker//   0b1000 => Immediate, 2 bytes
1159*9880d681SAndroid Build Coastguard Worker//   0b0111 => Immediate, 1 byte
1160*9880d681SAndroid Build Coastguard Workerclass T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1161*9880d681SAndroid Build Coastguard Worker                     InstrItinClass itin, string opc, string asm,
1162*9880d681SAndroid Build Coastguard Worker                     list<dag> pattern>
1163*9880d681SAndroid Build Coastguard Worker  : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1164*9880d681SAndroid Build Coastguard Worker    T1LoadStore<0b0101, opcode> {
1165*9880d681SAndroid Build Coastguard Worker  bits<3> Rt;
1166*9880d681SAndroid Build Coastguard Worker  bits<8> addr;
1167*9880d681SAndroid Build Coastguard Worker  let Inst{8-6} = addr{5-3};    // Rm
1168*9880d681SAndroid Build Coastguard Worker  let Inst{5-3} = addr{2-0};    // Rn
1169*9880d681SAndroid Build Coastguard Worker  let Inst{2-0} = Rt;
1170*9880d681SAndroid Build Coastguard Worker}
1171*9880d681SAndroid Build Coastguard Workerclass T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1172*9880d681SAndroid Build Coastguard Worker                        InstrItinClass itin, string opc, string asm,
1173*9880d681SAndroid Build Coastguard Worker                        list<dag> pattern>
1174*9880d681SAndroid Build Coastguard Worker  : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
1175*9880d681SAndroid Build Coastguard Worker    T1LoadStore<opA, {opB,?,?}> {
1176*9880d681SAndroid Build Coastguard Worker  bits<3> Rt;
1177*9880d681SAndroid Build Coastguard Worker  bits<8> addr;
1178*9880d681SAndroid Build Coastguard Worker  let Inst{10-6} = addr{7-3};   // imm5
1179*9880d681SAndroid Build Coastguard Worker  let Inst{5-3}  = addr{2-0};   // Rn
1180*9880d681SAndroid Build Coastguard Worker  let Inst{2-0}  = Rt;
1181*9880d681SAndroid Build Coastguard Worker}
1182*9880d681SAndroid Build Coastguard Worker
1183*9880d681SAndroid Build Coastguard Worker// A6.2.5 Miscellaneous 16-bit instructions encoding.
1184*9880d681SAndroid Build Coastguard Workerclass T1Misc<bits<7> opcode> : Encoding16 {
1185*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = 0b1011;
1186*9880d681SAndroid Build Coastguard Worker  let Inst{11-5} = opcode;
1187*9880d681SAndroid Build Coastguard Worker}
1188*9880d681SAndroid Build Coastguard Worker
1189*9880d681SAndroid Build Coastguard Worker// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1190*9880d681SAndroid Build Coastguard Workerclass Thumb2I<dag oops, dag iops, AddrMode am, int sz,
1191*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin,
1192*9880d681SAndroid Build Coastguard Worker              string opc, string asm, string cstr, list<dag> pattern>
1193*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1194*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1195*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
1196*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", asm);
1197*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1198*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb2];
1199*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "Thumb2";
1200*9880d681SAndroid Build Coastguard Worker}
1201*9880d681SAndroid Build Coastguard Worker
1202*9880d681SAndroid Build Coastguard Worker// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1203*9880d681SAndroid Build Coastguard Worker// input operand since by default it's a zero register. It will become an
1204*9880d681SAndroid Build Coastguard Worker// implicit def once it's "flipped".
1205*9880d681SAndroid Build Coastguard Worker//
1206*9880d681SAndroid Build Coastguard Worker// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1207*9880d681SAndroid Build Coastguard Worker// more consistent.
1208*9880d681SAndroid Build Coastguard Workerclass Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
1209*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin,
1210*9880d681SAndroid Build Coastguard Worker               string opc, string asm, string cstr, list<dag> pattern>
1211*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1212*9880d681SAndroid Build Coastguard Worker  bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1213*9880d681SAndroid Build Coastguard Worker  let Inst{20} = s;
1214*9880d681SAndroid Build Coastguard Worker
1215*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1216*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
1217*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${s}${p}", asm);
1218*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1219*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb2];
1220*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "Thumb2";
1221*9880d681SAndroid Build Coastguard Worker}
1222*9880d681SAndroid Build Coastguard Worker
1223*9880d681SAndroid Build Coastguard Worker// Special cases
1224*9880d681SAndroid Build Coastguard Workerclass Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
1225*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin,
1226*9880d681SAndroid Build Coastguard Worker               string asm, string cstr, list<dag> pattern>
1227*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1228*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1229*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
1230*9880d681SAndroid Build Coastguard Worker  let AsmString = asm;
1231*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1232*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb2];
1233*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "Thumb2";
1234*9880d681SAndroid Build Coastguard Worker}
1235*9880d681SAndroid Build Coastguard Worker
1236*9880d681SAndroid Build Coastguard Workerclass ThumbXI<dag oops, dag iops, AddrMode am, int sz,
1237*9880d681SAndroid Build Coastguard Worker              InstrItinClass itin,
1238*9880d681SAndroid Build Coastguard Worker              string asm, string cstr, list<dag> pattern>
1239*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1240*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1241*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
1242*9880d681SAndroid Build Coastguard Worker  let AsmString = asm;
1243*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1244*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1245*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "Thumb";
1246*9880d681SAndroid Build Coastguard Worker}
1247*9880d681SAndroid Build Coastguard Worker
1248*9880d681SAndroid Build Coastguard Workerclass T2I<dag oops, dag iops, InstrItinClass itin,
1249*9880d681SAndroid Build Coastguard Worker          string opc, string asm, list<dag> pattern>
1250*9880d681SAndroid Build Coastguard Worker  : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1251*9880d681SAndroid Build Coastguard Workerclass T2Ii12<dag oops, dag iops, InstrItinClass itin,
1252*9880d681SAndroid Build Coastguard Worker             string opc, string asm, list<dag> pattern>
1253*9880d681SAndroid Build Coastguard Worker  : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
1254*9880d681SAndroid Build Coastguard Workerclass T2Ii8<dag oops, dag iops, InstrItinClass itin,
1255*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
1256*9880d681SAndroid Build Coastguard Worker  : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
1257*9880d681SAndroid Build Coastguard Workerclass T2Iso<dag oops, dag iops, InstrItinClass itin,
1258*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
1259*9880d681SAndroid Build Coastguard Worker  : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
1260*9880d681SAndroid Build Coastguard Workerclass T2Ipc<dag oops, dag iops, InstrItinClass itin,
1261*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
1262*9880d681SAndroid Build Coastguard Worker  : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
1263*9880d681SAndroid Build Coastguard Workerclass T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1264*9880d681SAndroid Build Coastguard Worker              string opc, string asm, string cstr, list<dag> pattern>
1265*9880d681SAndroid Build Coastguard Worker  : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, cstr,
1266*9880d681SAndroid Build Coastguard Worker            pattern> {
1267*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
1268*9880d681SAndroid Build Coastguard Worker  bits<4> Rt2;
1269*9880d681SAndroid Build Coastguard Worker  bits<13> addr;
1270*9880d681SAndroid Build Coastguard Worker  let Inst{31-25} = 0b1110100;
1271*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = P;
1272*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = addr{8};
1273*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = 1;
1274*9880d681SAndroid Build Coastguard Worker  let Inst{21}    = W;
1275*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = isLoad;
1276*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr{12-9};
1277*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt{3-0};
1278*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = Rt2{3-0};
1279*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = addr{7-0};
1280*9880d681SAndroid Build Coastguard Worker}
1281*9880d681SAndroid Build Coastguard Workerclass T2Ii8s4post<bit P, bit W, bit isLoad, dag oops, dag iops,
1282*9880d681SAndroid Build Coastguard Worker                  InstrItinClass itin, string opc, string asm, string cstr,
1283*9880d681SAndroid Build Coastguard Worker                  list<dag> pattern>
1284*9880d681SAndroid Build Coastguard Worker  : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, cstr,
1285*9880d681SAndroid Build Coastguard Worker            pattern> {
1286*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
1287*9880d681SAndroid Build Coastguard Worker  bits<4> Rt2;
1288*9880d681SAndroid Build Coastguard Worker  bits<4> addr;
1289*9880d681SAndroid Build Coastguard Worker  bits<9> imm;
1290*9880d681SAndroid Build Coastguard Worker  let Inst{31-25} = 0b1110100;
1291*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = P;
1292*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = imm{8};
1293*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = 1;
1294*9880d681SAndroid Build Coastguard Worker  let Inst{21}    = W;
1295*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = isLoad;
1296*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr;
1297*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt{3-0};
1298*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = Rt2{3-0};
1299*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = imm{7-0};
1300*9880d681SAndroid Build Coastguard Worker}
1301*9880d681SAndroid Build Coastguard Worker
1302*9880d681SAndroid Build Coastguard Workerclass T2sI<dag oops, dag iops, InstrItinClass itin,
1303*9880d681SAndroid Build Coastguard Worker           string opc, string asm, list<dag> pattern>
1304*9880d681SAndroid Build Coastguard Worker  : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
1305*9880d681SAndroid Build Coastguard Worker
1306*9880d681SAndroid Build Coastguard Workerclass T2XI<dag oops, dag iops, InstrItinClass itin,
1307*9880d681SAndroid Build Coastguard Worker           string asm, list<dag> pattern>
1308*9880d681SAndroid Build Coastguard Worker  : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
1309*9880d681SAndroid Build Coastguard Workerclass T2JTI<dag oops, dag iops, InstrItinClass itin,
1310*9880d681SAndroid Build Coastguard Worker            string asm, list<dag> pattern>
1311*9880d681SAndroid Build Coastguard Worker  : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
1312*9880d681SAndroid Build Coastguard Worker
1313*9880d681SAndroid Build Coastguard Worker// Move to/from coprocessor instructions
1314*9880d681SAndroid Build Coastguard Workerclass T2Cop<bits<4> opc, dag oops, dag iops, string opcstr, string asm,
1315*9880d681SAndroid Build Coastguard Worker            list<dag> pattern>
1316*9880d681SAndroid Build Coastguard Worker  : T2I <oops, iops, NoItinerary, opcstr, asm, pattern>, Requires<[IsThumb2]> {
1317*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = opc;
1318*9880d681SAndroid Build Coastguard Worker}
1319*9880d681SAndroid Build Coastguard Worker
1320*9880d681SAndroid Build Coastguard Worker// Two-address instructions
1321*9880d681SAndroid Build Coastguard Workerclass T2XIt<dag oops, dag iops, InstrItinClass itin,
1322*9880d681SAndroid Build Coastguard Worker            string asm, string cstr, list<dag> pattern>
1323*9880d681SAndroid Build Coastguard Worker  : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
1324*9880d681SAndroid Build Coastguard Worker
1325*9880d681SAndroid Build Coastguard Worker// T2Ipreldst - Thumb2 pre-indexed load / store instructions.
1326*9880d681SAndroid Build Coastguard Workerclass T2Ipreldst<bit signed, bits<2> opcod, bit load, bit pre,
1327*9880d681SAndroid Build Coastguard Worker                 dag oops, dag iops,
1328*9880d681SAndroid Build Coastguard Worker                 AddrMode am, IndexMode im, InstrItinClass itin,
1329*9880d681SAndroid Build Coastguard Worker                 string opc, string asm, string cstr, list<dag> pattern>
1330*9880d681SAndroid Build Coastguard Worker  : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1331*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1332*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
1333*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", asm);
1334*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1335*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb2];
1336*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "Thumb2";
1337*9880d681SAndroid Build Coastguard Worker
1338*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
1339*9880d681SAndroid Build Coastguard Worker  bits<13> addr;
1340*9880d681SAndroid Build Coastguard Worker  let Inst{31-27} = 0b11111;
1341*9880d681SAndroid Build Coastguard Worker  let Inst{26-25} = 0b00;
1342*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = signed;
1343*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = 0;
1344*9880d681SAndroid Build Coastguard Worker  let Inst{22-21} = opcod;
1345*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = load;
1346*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr{12-9};
1347*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt{3-0};
1348*9880d681SAndroid Build Coastguard Worker  let Inst{11}    = 1;
1349*9880d681SAndroid Build Coastguard Worker  // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1350*9880d681SAndroid Build Coastguard Worker  let Inst{10}    = pre; // The P bit.
1351*9880d681SAndroid Build Coastguard Worker  let Inst{9}     = addr{8}; // Sign bit
1352*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 1; // The W bit.
1353*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = addr{7-0};
1354*9880d681SAndroid Build Coastguard Worker
1355*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeT2LdStPre";
1356*9880d681SAndroid Build Coastguard Worker}
1357*9880d681SAndroid Build Coastguard Worker
1358*9880d681SAndroid Build Coastguard Worker// T2Ipostldst - Thumb2 post-indexed load / store instructions.
1359*9880d681SAndroid Build Coastguard Workerclass T2Ipostldst<bit signed, bits<2> opcod, bit load, bit pre,
1360*9880d681SAndroid Build Coastguard Worker                 dag oops, dag iops,
1361*9880d681SAndroid Build Coastguard Worker                 AddrMode am, IndexMode im, InstrItinClass itin,
1362*9880d681SAndroid Build Coastguard Worker                 string opc, string asm, string cstr, list<dag> pattern>
1363*9880d681SAndroid Build Coastguard Worker  : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1364*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1365*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
1366*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", asm);
1367*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1368*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb2];
1369*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "Thumb2";
1370*9880d681SAndroid Build Coastguard Worker
1371*9880d681SAndroid Build Coastguard Worker  bits<4> Rt;
1372*9880d681SAndroid Build Coastguard Worker  bits<4> Rn;
1373*9880d681SAndroid Build Coastguard Worker  bits<9> offset;
1374*9880d681SAndroid Build Coastguard Worker  let Inst{31-27} = 0b11111;
1375*9880d681SAndroid Build Coastguard Worker  let Inst{26-25} = 0b00;
1376*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = signed;
1377*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = 0;
1378*9880d681SAndroid Build Coastguard Worker  let Inst{22-21} = opcod;
1379*9880d681SAndroid Build Coastguard Worker  let Inst{20}    = load;
1380*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn;
1381*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Rt{3-0};
1382*9880d681SAndroid Build Coastguard Worker  let Inst{11}    = 1;
1383*9880d681SAndroid Build Coastguard Worker  // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1384*9880d681SAndroid Build Coastguard Worker  let Inst{10}    = pre; // The P bit.
1385*9880d681SAndroid Build Coastguard Worker  let Inst{9}     = offset{8}; // Sign bit
1386*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 1; // The W bit.
1387*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = offset{7-0};
1388*9880d681SAndroid Build Coastguard Worker
1389*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeT2LdStPre";
1390*9880d681SAndroid Build Coastguard Worker}
1391*9880d681SAndroid Build Coastguard Worker
1392*9880d681SAndroid Build Coastguard Worker// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1393*9880d681SAndroid Build Coastguard Workerclass T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1394*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb, IsThumb1Only];
1395*9880d681SAndroid Build Coastguard Worker}
1396*9880d681SAndroid Build Coastguard Worker
1397*9880d681SAndroid Build Coastguard Worker// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1398*9880d681SAndroid Build Coastguard Workerclass T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1399*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb2, HasV6T2];
1400*9880d681SAndroid Build Coastguard Worker}
1401*9880d681SAndroid Build Coastguard Worker
1402*9880d681SAndroid Build Coastguard Worker// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1403*9880d681SAndroid Build Coastguard Workerclass T2Pat<dag pattern, dag result> : Pat<pattern, result> {
1404*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [IsThumb2];
1405*9880d681SAndroid Build Coastguard Worker}
1406*9880d681SAndroid Build Coastguard Worker
1407*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
1408*9880d681SAndroid Build Coastguard Worker
1409*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
1410*9880d681SAndroid Build Coastguard Worker// ARM VFP Instruction templates.
1411*9880d681SAndroid Build Coastguard Worker//
1412*9880d681SAndroid Build Coastguard Worker
1413*9880d681SAndroid Build Coastguard Worker// Almost all VFP instructions are predicable.
1414*9880d681SAndroid Build Coastguard Workerclass VFPI<dag oops, dag iops, AddrMode am, int sz,
1415*9880d681SAndroid Build Coastguard Worker           IndexMode im, Format f, InstrItinClass itin,
1416*9880d681SAndroid Build Coastguard Worker           string opc, string asm, string cstr, list<dag> pattern>
1417*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1418*9880d681SAndroid Build Coastguard Worker  bits<4> p;
1419*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = p;
1420*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1421*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
1422*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", asm);
1423*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1424*9880d681SAndroid Build Coastguard Worker  let PostEncoderMethod = "VFPThumb2PostEncoder";
1425*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "VFP";
1426*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasVFP2];
1427*9880d681SAndroid Build Coastguard Worker}
1428*9880d681SAndroid Build Coastguard Worker
1429*9880d681SAndroid Build Coastguard Worker// Special cases
1430*9880d681SAndroid Build Coastguard Workerclass VFPXI<dag oops, dag iops, AddrMode am, int sz,
1431*9880d681SAndroid Build Coastguard Worker            IndexMode im, Format f, InstrItinClass itin,
1432*9880d681SAndroid Build Coastguard Worker            string asm, string cstr, list<dag> pattern>
1433*9880d681SAndroid Build Coastguard Worker  : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
1434*9880d681SAndroid Build Coastguard Worker  bits<4> p;
1435*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = p;
1436*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1437*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
1438*9880d681SAndroid Build Coastguard Worker  let AsmString = asm;
1439*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1440*9880d681SAndroid Build Coastguard Worker  let PostEncoderMethod = "VFPThumb2PostEncoder";
1441*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "VFP";
1442*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasVFP2];
1443*9880d681SAndroid Build Coastguard Worker}
1444*9880d681SAndroid Build Coastguard Worker
1445*9880d681SAndroid Build Coastguard Workerclass VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1446*9880d681SAndroid Build Coastguard Worker            string opc, string asm, list<dag> pattern>
1447*9880d681SAndroid Build Coastguard Worker  : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
1448*9880d681SAndroid Build Coastguard Worker         opc, asm, "", pattern> {
1449*9880d681SAndroid Build Coastguard Worker  let PostEncoderMethod = "VFPThumb2PostEncoder";
1450*9880d681SAndroid Build Coastguard Worker}
1451*9880d681SAndroid Build Coastguard Worker
1452*9880d681SAndroid Build Coastguard Worker// ARM VFP addrmode5 loads and stores
1453*9880d681SAndroid Build Coastguard Workerclass ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1454*9880d681SAndroid Build Coastguard Worker           InstrItinClass itin,
1455*9880d681SAndroid Build Coastguard Worker           string opc, string asm, list<dag> pattern>
1456*9880d681SAndroid Build Coastguard Worker  : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1457*9880d681SAndroid Build Coastguard Worker         VFPLdStFrm, itin, opc, asm, "", pattern> {
1458*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1459*9880d681SAndroid Build Coastguard Worker  bits<5>  Dd;
1460*9880d681SAndroid Build Coastguard Worker  bits<13> addr;
1461*9880d681SAndroid Build Coastguard Worker
1462*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1463*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = addr{8};      // U (add = (U == '1'))
1464*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Dd{4};
1465*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr{12-9};   // Rn
1466*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Dd{3-0};
1467*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = addr{7-0};    // imm8
1468*9880d681SAndroid Build Coastguard Worker
1469*9880d681SAndroid Build Coastguard Worker  let Inst{27-24} = opcod1;
1470*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1471*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1472*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 1;          // Double precision
1473*9880d681SAndroid Build Coastguard Worker
1474*9880d681SAndroid Build Coastguard Worker  // Loads & stores operate on both NEON and VFP pipelines.
1475*9880d681SAndroid Build Coastguard Worker  let D = VFPNeonDomain;
1476*9880d681SAndroid Build Coastguard Worker}
1477*9880d681SAndroid Build Coastguard Worker
1478*9880d681SAndroid Build Coastguard Workerclass ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1479*9880d681SAndroid Build Coastguard Worker           InstrItinClass itin,
1480*9880d681SAndroid Build Coastguard Worker           string opc, string asm, list<dag> pattern>
1481*9880d681SAndroid Build Coastguard Worker  : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1482*9880d681SAndroid Build Coastguard Worker         VFPLdStFrm, itin, opc, asm, "", pattern> {
1483*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1484*9880d681SAndroid Build Coastguard Worker  bits<5>  Sd;
1485*9880d681SAndroid Build Coastguard Worker  bits<13> addr;
1486*9880d681SAndroid Build Coastguard Worker
1487*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1488*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = addr{8};      // U (add = (U == '1'))
1489*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1490*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr{12-9};   // Rn
1491*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1492*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = addr{7-0};    // imm8
1493*9880d681SAndroid Build Coastguard Worker
1494*9880d681SAndroid Build Coastguard Worker  let Inst{27-24} = opcod1;
1495*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1496*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1497*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 0;          // Single precision
1498*9880d681SAndroid Build Coastguard Worker
1499*9880d681SAndroid Build Coastguard Worker  // Loads & stores operate on both NEON and VFP pipelines.
1500*9880d681SAndroid Build Coastguard Worker  let D = VFPNeonDomain;
1501*9880d681SAndroid Build Coastguard Worker}
1502*9880d681SAndroid Build Coastguard Worker
1503*9880d681SAndroid Build Coastguard Workerclass AHI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1504*9880d681SAndroid Build Coastguard Worker           InstrItinClass itin,
1505*9880d681SAndroid Build Coastguard Worker           string opc, string asm, list<dag> pattern>
1506*9880d681SAndroid Build Coastguard Worker  : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
1507*9880d681SAndroid Build Coastguard Worker         VFPLdStFrm, itin, opc, asm, "", pattern> {
1508*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasFullFP16];
1509*9880d681SAndroid Build Coastguard Worker
1510*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1511*9880d681SAndroid Build Coastguard Worker  bits<5>  Sd;
1512*9880d681SAndroid Build Coastguard Worker  bits<13> addr;
1513*9880d681SAndroid Build Coastguard Worker
1514*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1515*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = addr{8};      // U (add = (U == '1'))
1516*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1517*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = addr{12-9};   // Rn
1518*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1519*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = addr{7-0};    // imm8
1520*9880d681SAndroid Build Coastguard Worker
1521*9880d681SAndroid Build Coastguard Worker  let Inst{27-24} = opcod1;
1522*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1523*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = 0b1001;     // Half precision
1524*9880d681SAndroid Build Coastguard Worker
1525*9880d681SAndroid Build Coastguard Worker  // Loads & stores operate on both NEON and VFP pipelines.
1526*9880d681SAndroid Build Coastguard Worker  let D = VFPNeonDomain;
1527*9880d681SAndroid Build Coastguard Worker}
1528*9880d681SAndroid Build Coastguard Worker
1529*9880d681SAndroid Build Coastguard Worker// VFP Load / store multiple pseudo instructions.
1530*9880d681SAndroid Build Coastguard Workerclass PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1531*9880d681SAndroid Build Coastguard Worker                     list<dag> pattern>
1532*9880d681SAndroid Build Coastguard Worker  : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
1533*9880d681SAndroid Build Coastguard Worker            cstr, itin> {
1534*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
1535*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
1536*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
1537*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasVFP2];
1538*9880d681SAndroid Build Coastguard Worker}
1539*9880d681SAndroid Build Coastguard Worker
1540*9880d681SAndroid Build Coastguard Worker// Load / store multiple
1541*9880d681SAndroid Build Coastguard Worker
1542*9880d681SAndroid Build Coastguard Worker// Unknown precision
1543*9880d681SAndroid Build Coastguard Workerclass AXXI4<dag oops, dag iops, IndexMode im,
1544*9880d681SAndroid Build Coastguard Worker            string asm, string cstr, list<dag> pattern>
1545*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrMode4, 4, im,
1546*9880d681SAndroid Build Coastguard Worker          VFPLdStFrm, NoItinerary, asm, cstr, pattern> {
1547*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1548*9880d681SAndroid Build Coastguard Worker  bits<4>  Rn;
1549*9880d681SAndroid Build Coastguard Worker  bits<13> regs;
1550*9880d681SAndroid Build Coastguard Worker
1551*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1552*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn;
1553*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = 0;
1554*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = regs{11-8};
1555*9880d681SAndroid Build Coastguard Worker  let Inst{7-1}   = regs{7-1};
1556*9880d681SAndroid Build Coastguard Worker
1557*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = 0b110;
1558*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = 0b1011;
1559*9880d681SAndroid Build Coastguard Worker  let Inst{0}     = 1;
1560*9880d681SAndroid Build Coastguard Worker}
1561*9880d681SAndroid Build Coastguard Worker
1562*9880d681SAndroid Build Coastguard Worker// Double precision
1563*9880d681SAndroid Build Coastguard Workerclass AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1564*9880d681SAndroid Build Coastguard Worker            string asm, string cstr, list<dag> pattern>
1565*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrMode4, 4, im,
1566*9880d681SAndroid Build Coastguard Worker          VFPLdStMulFrm, itin, asm, cstr, pattern> {
1567*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1568*9880d681SAndroid Build Coastguard Worker  bits<4>  Rn;
1569*9880d681SAndroid Build Coastguard Worker  bits<13> regs;
1570*9880d681SAndroid Build Coastguard Worker
1571*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1572*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn;
1573*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = regs{12};
1574*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = regs{11-8};
1575*9880d681SAndroid Build Coastguard Worker  let Inst{7-1}   = regs{7-1};
1576*9880d681SAndroid Build Coastguard Worker
1577*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = 0b110;
1578*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1579*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 1;          // Double precision
1580*9880d681SAndroid Build Coastguard Worker  let Inst{0}     = 0;
1581*9880d681SAndroid Build Coastguard Worker}
1582*9880d681SAndroid Build Coastguard Worker
1583*9880d681SAndroid Build Coastguard Worker// Single Precision
1584*9880d681SAndroid Build Coastguard Workerclass AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
1585*9880d681SAndroid Build Coastguard Worker            string asm, string cstr, list<dag> pattern>
1586*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrMode4, 4, im,
1587*9880d681SAndroid Build Coastguard Worker          VFPLdStMulFrm, itin, asm, cstr, pattern> {
1588*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1589*9880d681SAndroid Build Coastguard Worker  bits<4> Rn;
1590*9880d681SAndroid Build Coastguard Worker  bits<13> regs;
1591*9880d681SAndroid Build Coastguard Worker
1592*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1593*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn;
1594*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = regs{8};
1595*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = regs{12-9};
1596*9880d681SAndroid Build Coastguard Worker  let Inst{7-0}   = regs{7-0};
1597*9880d681SAndroid Build Coastguard Worker
1598*9880d681SAndroid Build Coastguard Worker  let Inst{27-25} = 0b110;
1599*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1600*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 0;          // Single precision
1601*9880d681SAndroid Build Coastguard Worker}
1602*9880d681SAndroid Build Coastguard Worker
1603*9880d681SAndroid Build Coastguard Worker// Double precision, unary
1604*9880d681SAndroid Build Coastguard Workerclass ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1605*9880d681SAndroid Build Coastguard Worker           bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1606*9880d681SAndroid Build Coastguard Worker           string asm, list<dag> pattern>
1607*9880d681SAndroid Build Coastguard Worker  : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1608*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1609*9880d681SAndroid Build Coastguard Worker  bits<5> Dd;
1610*9880d681SAndroid Build Coastguard Worker  bits<5> Dm;
1611*9880d681SAndroid Build Coastguard Worker
1612*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1613*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Dm{3-0};
1614*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Dm{4};
1615*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Dd{3-0};
1616*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Dd{4};
1617*9880d681SAndroid Build Coastguard Worker
1618*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1619*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1620*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = opcod3;
1621*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1622*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 1;          // Double precision
1623*9880d681SAndroid Build Coastguard Worker  let Inst{7-6}   = opcod4;
1624*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = opcod5;
1625*9880d681SAndroid Build Coastguard Worker
1626*9880d681SAndroid Build Coastguard Worker  let Predicates = [HasVFP2, HasDPVFP];
1627*9880d681SAndroid Build Coastguard Worker}
1628*9880d681SAndroid Build Coastguard Worker
1629*9880d681SAndroid Build Coastguard Worker// Double precision, unary, not-predicated
1630*9880d681SAndroid Build Coastguard Workerclass ADuInp<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1631*9880d681SAndroid Build Coastguard Worker           bit opcod5, dag oops, dag iops, InstrItinClass itin,
1632*9880d681SAndroid Build Coastguard Worker           string asm, list<dag> pattern>
1633*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone, VFPUnaryFrm, itin, asm, "", pattern> {
1634*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1635*9880d681SAndroid Build Coastguard Worker  bits<5> Dd;
1636*9880d681SAndroid Build Coastguard Worker  bits<5> Dm;
1637*9880d681SAndroid Build Coastguard Worker
1638*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = 0b1111;
1639*9880d681SAndroid Build Coastguard Worker
1640*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1641*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Dm{3-0};
1642*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Dm{4};
1643*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Dd{3-0};
1644*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Dd{4};
1645*9880d681SAndroid Build Coastguard Worker
1646*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1647*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1648*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = opcod3;
1649*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1650*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 1;          // Double precision
1651*9880d681SAndroid Build Coastguard Worker  let Inst{7-6}   = opcod4;
1652*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = opcod5;
1653*9880d681SAndroid Build Coastguard Worker}
1654*9880d681SAndroid Build Coastguard Worker
1655*9880d681SAndroid Build Coastguard Worker// Double precision, binary
1656*9880d681SAndroid Build Coastguard Workerclass ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1657*9880d681SAndroid Build Coastguard Worker           dag iops, InstrItinClass itin, string opc, string asm,
1658*9880d681SAndroid Build Coastguard Worker           list<dag> pattern>
1659*9880d681SAndroid Build Coastguard Worker  : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1660*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1661*9880d681SAndroid Build Coastguard Worker  bits<5> Dd;
1662*9880d681SAndroid Build Coastguard Worker  bits<5> Dn;
1663*9880d681SAndroid Build Coastguard Worker  bits<5> Dm;
1664*9880d681SAndroid Build Coastguard Worker
1665*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1666*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Dm{3-0};
1667*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Dm{4};
1668*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Dn{3-0};
1669*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Dn{4};
1670*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Dd{3-0};
1671*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Dd{4};
1672*9880d681SAndroid Build Coastguard Worker
1673*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1674*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1675*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1676*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 1;          // Double precision
1677*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
1678*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
1679*9880d681SAndroid Build Coastguard Worker
1680*9880d681SAndroid Build Coastguard Worker  let Predicates = [HasVFP2, HasDPVFP];
1681*9880d681SAndroid Build Coastguard Worker}
1682*9880d681SAndroid Build Coastguard Worker
1683*9880d681SAndroid Build Coastguard Worker// FP, binary, not predicated
1684*9880d681SAndroid Build Coastguard Workerclass ADbInp<bits<5> opcod1, bits<2> opcod2, bit opcod3, dag oops, dag iops,
1685*9880d681SAndroid Build Coastguard Worker           InstrItinClass itin, string asm, list<dag> pattern>
1686*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone, VFPBinaryFrm, itin,
1687*9880d681SAndroid Build Coastguard Worker          asm, "", pattern>
1688*9880d681SAndroid Build Coastguard Worker{
1689*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1690*9880d681SAndroid Build Coastguard Worker  bits<5> Dd;
1691*9880d681SAndroid Build Coastguard Worker  bits<5> Dn;
1692*9880d681SAndroid Build Coastguard Worker  bits<5> Dm;
1693*9880d681SAndroid Build Coastguard Worker
1694*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = 0b1111;
1695*9880d681SAndroid Build Coastguard Worker
1696*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1697*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Dm{3-0};
1698*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Dm{4};
1699*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Dn{3-0};
1700*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Dn{4};
1701*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Dd{3-0};
1702*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Dd{4};
1703*9880d681SAndroid Build Coastguard Worker
1704*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1705*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1706*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1707*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 1; // double precision
1708*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = opcod3;
1709*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = 0;
1710*9880d681SAndroid Build Coastguard Worker
1711*9880d681SAndroid Build Coastguard Worker  let Predicates = [HasVFP2, HasDPVFP];
1712*9880d681SAndroid Build Coastguard Worker}
1713*9880d681SAndroid Build Coastguard Worker
1714*9880d681SAndroid Build Coastguard Worker// Single precision, unary, predicated
1715*9880d681SAndroid Build Coastguard Workerclass ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1716*9880d681SAndroid Build Coastguard Worker           bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1717*9880d681SAndroid Build Coastguard Worker           string asm, list<dag> pattern>
1718*9880d681SAndroid Build Coastguard Worker  : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1719*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1720*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1721*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1722*9880d681SAndroid Build Coastguard Worker
1723*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1724*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1725*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1726*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1727*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1728*9880d681SAndroid Build Coastguard Worker
1729*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1730*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1731*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = opcod3;
1732*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1733*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 0;          // Single precision
1734*9880d681SAndroid Build Coastguard Worker  let Inst{7-6}   = opcod4;
1735*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = opcod5;
1736*9880d681SAndroid Build Coastguard Worker}
1737*9880d681SAndroid Build Coastguard Worker
1738*9880d681SAndroid Build Coastguard Worker// Single precision, unary, non-predicated
1739*9880d681SAndroid Build Coastguard Workerclass ASuInp<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1740*9880d681SAndroid Build Coastguard Worker             bit opcod5, dag oops, dag iops, InstrItinClass itin,
1741*9880d681SAndroid Build Coastguard Worker             string asm, list<dag> pattern>
1742*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone,
1743*9880d681SAndroid Build Coastguard Worker          VFPUnaryFrm, itin, asm, "", pattern> {
1744*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1745*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1746*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1747*9880d681SAndroid Build Coastguard Worker
1748*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = 0b1111;
1749*9880d681SAndroid Build Coastguard Worker
1750*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1751*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1752*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1753*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1754*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1755*9880d681SAndroid Build Coastguard Worker
1756*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1757*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1758*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = opcod3;
1759*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1760*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 0;          // Single precision
1761*9880d681SAndroid Build Coastguard Worker  let Inst{7-6}   = opcod4;
1762*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = opcod5;
1763*9880d681SAndroid Build Coastguard Worker}
1764*9880d681SAndroid Build Coastguard Worker
1765*9880d681SAndroid Build Coastguard Worker// Single precision unary, if no NEON. Same as ASuI except not available if
1766*9880d681SAndroid Build Coastguard Worker// NEON is enabled.
1767*9880d681SAndroid Build Coastguard Workerclass ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1768*9880d681SAndroid Build Coastguard Worker            bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1769*9880d681SAndroid Build Coastguard Worker            string asm, list<dag> pattern>
1770*9880d681SAndroid Build Coastguard Worker  : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1771*9880d681SAndroid Build Coastguard Worker         pattern> {
1772*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1773*9880d681SAndroid Build Coastguard Worker}
1774*9880d681SAndroid Build Coastguard Worker
1775*9880d681SAndroid Build Coastguard Worker// Single precision, binary
1776*9880d681SAndroid Build Coastguard Workerclass ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1777*9880d681SAndroid Build Coastguard Worker           InstrItinClass itin, string opc, string asm, list<dag> pattern>
1778*9880d681SAndroid Build Coastguard Worker  : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1779*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1780*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1781*9880d681SAndroid Build Coastguard Worker  bits<5> Sn;
1782*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1783*9880d681SAndroid Build Coastguard Worker
1784*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1785*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1786*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1787*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Sn{4-1};
1788*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Sn{0};
1789*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1790*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1791*9880d681SAndroid Build Coastguard Worker
1792*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1793*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1794*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1795*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 0;          // Single precision
1796*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
1797*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
1798*9880d681SAndroid Build Coastguard Worker}
1799*9880d681SAndroid Build Coastguard Worker
1800*9880d681SAndroid Build Coastguard Worker// Single precision, binary, not predicated
1801*9880d681SAndroid Build Coastguard Workerclass ASbInp<bits<5> opcod1, bits<2> opcod2, bit opcod3, dag oops, dag iops,
1802*9880d681SAndroid Build Coastguard Worker           InstrItinClass itin, string asm, list<dag> pattern>
1803*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone,
1804*9880d681SAndroid Build Coastguard Worker          VFPBinaryFrm, itin, asm, "", pattern>
1805*9880d681SAndroid Build Coastguard Worker{
1806*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1807*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1808*9880d681SAndroid Build Coastguard Worker  bits<5> Sn;
1809*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1810*9880d681SAndroid Build Coastguard Worker
1811*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = 0b1111;
1812*9880d681SAndroid Build Coastguard Worker
1813*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1814*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1815*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1816*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Sn{4-1};
1817*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Sn{0};
1818*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1819*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1820*9880d681SAndroid Build Coastguard Worker
1821*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1822*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1823*9880d681SAndroid Build Coastguard Worker  let Inst{11-9}  = 0b101;
1824*9880d681SAndroid Build Coastguard Worker  let Inst{8}     = 0; // Single precision
1825*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = opcod3;
1826*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = 0;
1827*9880d681SAndroid Build Coastguard Worker}
1828*9880d681SAndroid Build Coastguard Worker
1829*9880d681SAndroid Build Coastguard Worker// Single precision binary, if no NEON. Same as ASbI except not available if
1830*9880d681SAndroid Build Coastguard Worker// NEON is enabled.
1831*9880d681SAndroid Build Coastguard Workerclass ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1832*9880d681SAndroid Build Coastguard Worker            dag iops, InstrItinClass itin, string opc, string asm,
1833*9880d681SAndroid Build Coastguard Worker            list<dag> pattern>
1834*9880d681SAndroid Build Coastguard Worker  : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
1835*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1836*9880d681SAndroid Build Coastguard Worker
1837*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1838*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1839*9880d681SAndroid Build Coastguard Worker  bits<5> Sn;
1840*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1841*9880d681SAndroid Build Coastguard Worker
1842*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1843*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1844*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1845*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Sn{4-1};
1846*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Sn{0};
1847*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1848*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1849*9880d681SAndroid Build Coastguard Worker}
1850*9880d681SAndroid Build Coastguard Worker
1851*9880d681SAndroid Build Coastguard Worker// Half precision, unary, predicated
1852*9880d681SAndroid Build Coastguard Workerclass AHuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1853*9880d681SAndroid Build Coastguard Worker           bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1854*9880d681SAndroid Build Coastguard Worker           string asm, list<dag> pattern>
1855*9880d681SAndroid Build Coastguard Worker  : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
1856*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasFullFP16];
1857*9880d681SAndroid Build Coastguard Worker
1858*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1859*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1860*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1861*9880d681SAndroid Build Coastguard Worker
1862*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1863*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1864*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1865*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1866*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1867*9880d681SAndroid Build Coastguard Worker
1868*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1869*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1870*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = opcod3;
1871*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = 0b1001;   // Half precision
1872*9880d681SAndroid Build Coastguard Worker  let Inst{7-6}   = opcod4;
1873*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = opcod5;
1874*9880d681SAndroid Build Coastguard Worker}
1875*9880d681SAndroid Build Coastguard Worker
1876*9880d681SAndroid Build Coastguard Worker// Half precision, unary, non-predicated
1877*9880d681SAndroid Build Coastguard Workerclass AHuInp<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1878*9880d681SAndroid Build Coastguard Worker             bit opcod5, dag oops, dag iops, InstrItinClass itin,
1879*9880d681SAndroid Build Coastguard Worker             string asm, list<dag> pattern>
1880*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone,
1881*9880d681SAndroid Build Coastguard Worker          VFPUnaryFrm, itin, asm, "", pattern> {
1882*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasFullFP16];
1883*9880d681SAndroid Build Coastguard Worker
1884*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1885*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1886*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1887*9880d681SAndroid Build Coastguard Worker
1888*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = 0b1111;
1889*9880d681SAndroid Build Coastguard Worker
1890*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1891*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1892*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1893*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1894*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1895*9880d681SAndroid Build Coastguard Worker
1896*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1897*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1898*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = opcod3;
1899*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = 0b1001;   // Half precision
1900*9880d681SAndroid Build Coastguard Worker  let Inst{7-6}   = opcod4;
1901*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = opcod5;
1902*9880d681SAndroid Build Coastguard Worker}
1903*9880d681SAndroid Build Coastguard Worker
1904*9880d681SAndroid Build Coastguard Worker// Half precision, binary
1905*9880d681SAndroid Build Coastguard Workerclass AHbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1906*9880d681SAndroid Build Coastguard Worker           InstrItinClass itin, string opc, string asm, list<dag> pattern>
1907*9880d681SAndroid Build Coastguard Worker  : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1908*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasFullFP16];
1909*9880d681SAndroid Build Coastguard Worker
1910*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1911*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1912*9880d681SAndroid Build Coastguard Worker  bits<5> Sn;
1913*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1914*9880d681SAndroid Build Coastguard Worker
1915*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1916*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1917*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1918*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Sn{4-1};
1919*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Sn{0};
1920*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1921*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1922*9880d681SAndroid Build Coastguard Worker
1923*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1924*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1925*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = 0b1001;   // Half precision
1926*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
1927*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
1928*9880d681SAndroid Build Coastguard Worker}
1929*9880d681SAndroid Build Coastguard Worker
1930*9880d681SAndroid Build Coastguard Worker// Half precision, binary, not predicated
1931*9880d681SAndroid Build Coastguard Workerclass AHbInp<bits<5> opcod1, bits<2> opcod2, bit opcod3, dag oops, dag iops,
1932*9880d681SAndroid Build Coastguard Worker           InstrItinClass itin, string asm, list<dag> pattern>
1933*9880d681SAndroid Build Coastguard Worker  : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone,
1934*9880d681SAndroid Build Coastguard Worker          VFPBinaryFrm, itin, asm, "", pattern> {
1935*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasFullFP16];
1936*9880d681SAndroid Build Coastguard Worker
1937*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
1938*9880d681SAndroid Build Coastguard Worker  bits<5> Sd;
1939*9880d681SAndroid Build Coastguard Worker  bits<5> Sn;
1940*9880d681SAndroid Build Coastguard Worker  bits<5> Sm;
1941*9880d681SAndroid Build Coastguard Worker
1942*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = 0b1111;
1943*9880d681SAndroid Build Coastguard Worker
1944*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands.
1945*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Sm{4-1};
1946*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Sm{0};
1947*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Sn{4-1};
1948*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Sn{0};
1949*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Sd{4-1};
1950*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Sd{0};
1951*9880d681SAndroid Build Coastguard Worker
1952*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1953*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1954*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = 0b1001;   // Half precision
1955*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = opcod3;
1956*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = 0;
1957*9880d681SAndroid Build Coastguard Worker}
1958*9880d681SAndroid Build Coastguard Worker
1959*9880d681SAndroid Build Coastguard Worker// VFP conversion instructions
1960*9880d681SAndroid Build Coastguard Workerclass AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1961*9880d681SAndroid Build Coastguard Worker               dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1962*9880d681SAndroid Build Coastguard Worker               list<dag> pattern>
1963*9880d681SAndroid Build Coastguard Worker  : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
1964*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = opcod1;
1965*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = opcod2;
1966*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = opcod3;
1967*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = opcod4;
1968*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = 1;
1969*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = 0;
1970*9880d681SAndroid Build Coastguard Worker}
1971*9880d681SAndroid Build Coastguard Worker
1972*9880d681SAndroid Build Coastguard Worker// VFP conversion between floating-point and fixed-point
1973*9880d681SAndroid Build Coastguard Workerclass AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1974*9880d681SAndroid Build Coastguard Worker                dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1975*9880d681SAndroid Build Coastguard Worker                list<dag> pattern>
1976*9880d681SAndroid Build Coastguard Worker  : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1977*9880d681SAndroid Build Coastguard Worker  bits<5> fbits;
1978*9880d681SAndroid Build Coastguard Worker  // size (fixed-point number): sx == 0 ? 16 : 32
1979*9880d681SAndroid Build Coastguard Worker  let Inst{7} = op5; // sx
1980*9880d681SAndroid Build Coastguard Worker  let Inst{5} = fbits{0};
1981*9880d681SAndroid Build Coastguard Worker  let Inst{3-0} = fbits{4-1};
1982*9880d681SAndroid Build Coastguard Worker}
1983*9880d681SAndroid Build Coastguard Worker
1984*9880d681SAndroid Build Coastguard Worker// VFP conversion instructions, if no NEON
1985*9880d681SAndroid Build Coastguard Workerclass AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1986*9880d681SAndroid Build Coastguard Worker                dag oops, dag iops, InstrItinClass itin,
1987*9880d681SAndroid Build Coastguard Worker                string opc, string asm, list<dag> pattern>
1988*9880d681SAndroid Build Coastguard Worker  : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1989*9880d681SAndroid Build Coastguard Worker             pattern> {
1990*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1991*9880d681SAndroid Build Coastguard Worker}
1992*9880d681SAndroid Build Coastguard Worker
1993*9880d681SAndroid Build Coastguard Workerclass AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1994*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin,
1995*9880d681SAndroid Build Coastguard Worker               string opc, string asm, list<dag> pattern>
1996*9880d681SAndroid Build Coastguard Worker  : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
1997*9880d681SAndroid Build Coastguard Worker  let Inst{27-20} = opcod1;
1998*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = opcod2;
1999*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = 1;
2000*9880d681SAndroid Build Coastguard Worker}
2001*9880d681SAndroid Build Coastguard Worker
2002*9880d681SAndroid Build Coastguard Workerclass AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
2003*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin, string opc, string asm, list<dag> pattern>
2004*9880d681SAndroid Build Coastguard Worker  : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
2005*9880d681SAndroid Build Coastguard Worker
2006*9880d681SAndroid Build Coastguard Workerclass AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
2007*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin, string opc, string asm, list<dag> pattern>
2008*9880d681SAndroid Build Coastguard Worker  : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
2009*9880d681SAndroid Build Coastguard Worker
2010*9880d681SAndroid Build Coastguard Workerclass AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
2011*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin, string opc, string asm, list<dag> pattern>
2012*9880d681SAndroid Build Coastguard Worker  : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
2013*9880d681SAndroid Build Coastguard Worker
2014*9880d681SAndroid Build Coastguard Workerclass AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
2015*9880d681SAndroid Build Coastguard Worker               InstrItinClass itin, string opc, string asm, list<dag> pattern>
2016*9880d681SAndroid Build Coastguard Worker  : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
2017*9880d681SAndroid Build Coastguard Worker
2018*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
2019*9880d681SAndroid Build Coastguard Worker
2020*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
2021*9880d681SAndroid Build Coastguard Worker// ARM NEON Instruction templates.
2022*9880d681SAndroid Build Coastguard Worker//
2023*9880d681SAndroid Build Coastguard Worker
2024*9880d681SAndroid Build Coastguard Workerclass NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
2025*9880d681SAndroid Build Coastguard Worker            InstrItinClass itin, string opc, string dt, string asm, string cstr,
2026*9880d681SAndroid Build Coastguard Worker            list<dag> pattern>
2027*9880d681SAndroid Build Coastguard Worker  : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
2028*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
2029*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
2030*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
2031*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
2032*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasNEON];
2033*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "NEON";
2034*9880d681SAndroid Build Coastguard Worker}
2035*9880d681SAndroid Build Coastguard Worker
2036*9880d681SAndroid Build Coastguard Worker// Same as NeonI except it does not have a "data type" specifier.
2037*9880d681SAndroid Build Coastguard Workerclass NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
2038*9880d681SAndroid Build Coastguard Worker             InstrItinClass itin, string opc, string asm, string cstr,
2039*9880d681SAndroid Build Coastguard Worker             list<dag> pattern>
2040*9880d681SAndroid Build Coastguard Worker  : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
2041*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
2042*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
2043*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", "\t", asm);
2044*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
2045*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasNEON];
2046*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "NEON";
2047*9880d681SAndroid Build Coastguard Worker}
2048*9880d681SAndroid Build Coastguard Worker
2049*9880d681SAndroid Build Coastguard Worker// Same as NeonI except it is not predicated
2050*9880d681SAndroid Build Coastguard Workerclass NeonInp<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
2051*9880d681SAndroid Build Coastguard Worker            InstrItinClass itin, string opc, string dt, string asm, string cstr,
2052*9880d681SAndroid Build Coastguard Worker            list<dag> pattern>
2053*9880d681SAndroid Build Coastguard Worker  : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
2054*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
2055*9880d681SAndroid Build Coastguard Worker  let InOperandList = iops;
2056*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, ".", dt, "\t", asm);
2057*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
2058*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasNEON];
2059*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "NEON";
2060*9880d681SAndroid Build Coastguard Worker
2061*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = 0b1111;
2062*9880d681SAndroid Build Coastguard Worker}
2063*9880d681SAndroid Build Coastguard Worker
2064*9880d681SAndroid Build Coastguard Workerclass NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
2065*9880d681SAndroid Build Coastguard Worker            dag oops, dag iops, InstrItinClass itin,
2066*9880d681SAndroid Build Coastguard Worker            string opc, string dt, string asm, string cstr, list<dag> pattern>
2067*9880d681SAndroid Build Coastguard Worker  : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
2068*9880d681SAndroid Build Coastguard Worker          cstr, pattern> {
2069*9880d681SAndroid Build Coastguard Worker  let Inst{31-24} = 0b11110100;
2070*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = op23;
2071*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = op21_20;
2072*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = op11_8;
2073*9880d681SAndroid Build Coastguard Worker  let Inst{7-4}   = op7_4;
2074*9880d681SAndroid Build Coastguard Worker
2075*9880d681SAndroid Build Coastguard Worker  let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
2076*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "NEONLoadStore";
2077*9880d681SAndroid Build Coastguard Worker
2078*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2079*9880d681SAndroid Build Coastguard Worker  bits<6> Rn;
2080*9880d681SAndroid Build Coastguard Worker  bits<4> Rm;
2081*9880d681SAndroid Build Coastguard Worker
2082*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2083*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2084*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Rn{3-0};
2085*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Rm{3-0};
2086*9880d681SAndroid Build Coastguard Worker}
2087*9880d681SAndroid Build Coastguard Worker
2088*9880d681SAndroid Build Coastguard Workerclass NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
2089*9880d681SAndroid Build Coastguard Worker            dag oops, dag iops, InstrItinClass itin,
2090*9880d681SAndroid Build Coastguard Worker            string opc, string dt, string asm, string cstr, list<dag> pattern>
2091*9880d681SAndroid Build Coastguard Worker  : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
2092*9880d681SAndroid Build Coastguard Worker          dt, asm, cstr, pattern> {
2093*9880d681SAndroid Build Coastguard Worker  bits<3> lane;
2094*9880d681SAndroid Build Coastguard Worker}
2095*9880d681SAndroid Build Coastguard Worker
2096*9880d681SAndroid Build Coastguard Workerclass PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
2097*9880d681SAndroid Build Coastguard Worker  : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
2098*9880d681SAndroid Build Coastguard Worker            itin> {
2099*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
2100*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
2101*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasNEON];
2102*9880d681SAndroid Build Coastguard Worker}
2103*9880d681SAndroid Build Coastguard Worker
2104*9880d681SAndroid Build Coastguard Workerclass PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
2105*9880d681SAndroid Build Coastguard Worker                  list<dag> pattern>
2106*9880d681SAndroid Build Coastguard Worker  : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
2107*9880d681SAndroid Build Coastguard Worker            itin> {
2108*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
2109*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
2110*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
2111*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasNEON];
2112*9880d681SAndroid Build Coastguard Worker}
2113*9880d681SAndroid Build Coastguard Worker
2114*9880d681SAndroid Build Coastguard Workerclass NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
2115*9880d681SAndroid Build Coastguard Worker             string opc, string dt, string asm, string cstr, list<dag> pattern>
2116*9880d681SAndroid Build Coastguard Worker  : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
2117*9880d681SAndroid Build Coastguard Worker          pattern> {
2118*9880d681SAndroid Build Coastguard Worker  let Inst{31-25} = 0b1111001;
2119*9880d681SAndroid Build Coastguard Worker  let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
2120*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "NEONData";
2121*9880d681SAndroid Build Coastguard Worker}
2122*9880d681SAndroid Build Coastguard Worker
2123*9880d681SAndroid Build Coastguard Workerclass NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
2124*9880d681SAndroid Build Coastguard Worker              string opc, string asm, string cstr, list<dag> pattern>
2125*9880d681SAndroid Build Coastguard Worker  : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
2126*9880d681SAndroid Build Coastguard Worker           cstr, pattern> {
2127*9880d681SAndroid Build Coastguard Worker  let Inst{31-25} = 0b1111001;
2128*9880d681SAndroid Build Coastguard Worker  let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
2129*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "NEONData";
2130*9880d681SAndroid Build Coastguard Worker}
2131*9880d681SAndroid Build Coastguard Worker
2132*9880d681SAndroid Build Coastguard Worker// NEON "one register and a modified immediate" format.
2133*9880d681SAndroid Build Coastguard Workerclass N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
2134*9880d681SAndroid Build Coastguard Worker               bit op5, bit op4,
2135*9880d681SAndroid Build Coastguard Worker               dag oops, dag iops, InstrItinClass itin,
2136*9880d681SAndroid Build Coastguard Worker               string opc, string dt, string asm, string cstr,
2137*9880d681SAndroid Build Coastguard Worker               list<dag> pattern>
2138*9880d681SAndroid Build Coastguard Worker  : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
2139*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = op23;
2140*9880d681SAndroid Build Coastguard Worker  let Inst{21-19} = op21_19;
2141*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = op11_8;
2142*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = op7;
2143*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
2144*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = op5;
2145*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
2146*9880d681SAndroid Build Coastguard Worker
2147*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
2148*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2149*9880d681SAndroid Build Coastguard Worker  bits<13> SIMM;
2150*9880d681SAndroid Build Coastguard Worker
2151*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2152*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2153*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = SIMM{7};
2154*9880d681SAndroid Build Coastguard Worker  let Inst{18-16} = SIMM{6-4};
2155*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = SIMM{3-0};
2156*9880d681SAndroid Build Coastguard Worker  let DecoderMethod = "DecodeNEONModImmInstruction";
2157*9880d681SAndroid Build Coastguard Worker}
2158*9880d681SAndroid Build Coastguard Worker
2159*9880d681SAndroid Build Coastguard Worker// NEON 2 vector register format.
2160*9880d681SAndroid Build Coastguard Workerclass N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
2161*9880d681SAndroid Build Coastguard Worker          bits<5> op11_7, bit op6, bit op4,
2162*9880d681SAndroid Build Coastguard Worker          dag oops, dag iops, InstrItinClass itin,
2163*9880d681SAndroid Build Coastguard Worker          string opc, string dt, string asm, string cstr, list<dag> pattern>
2164*9880d681SAndroid Build Coastguard Worker  : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
2165*9880d681SAndroid Build Coastguard Worker  let Inst{24-23} = op24_23;
2166*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = op21_20;
2167*9880d681SAndroid Build Coastguard Worker  let Inst{19-18} = op19_18;
2168*9880d681SAndroid Build Coastguard Worker  let Inst{17-16} = op17_16;
2169*9880d681SAndroid Build Coastguard Worker  let Inst{11-7}  = op11_7;
2170*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
2171*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
2172*9880d681SAndroid Build Coastguard Worker
2173*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
2174*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2175*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2176*9880d681SAndroid Build Coastguard Worker
2177*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2178*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2179*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Vm{3-0};
2180*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Vm{4};
2181*9880d681SAndroid Build Coastguard Worker}
2182*9880d681SAndroid Build Coastguard Worker
2183*9880d681SAndroid Build Coastguard Worker// Same as N2V but not predicated.
2184*9880d681SAndroid Build Coastguard Workerclass N2Vnp<bits<2> op19_18, bits<2> op17_16, bits<3> op10_8, bit op7, bit op6,
2185*9880d681SAndroid Build Coastguard Worker            dag oops, dag iops, InstrItinClass itin, string OpcodeStr,
2186*9880d681SAndroid Build Coastguard Worker            string Dt, list<dag> pattern>
2187*9880d681SAndroid Build Coastguard Worker   : NeonInp<oops, iops, AddrModeNone, IndexModeNone, N2RegFrm, itin,
2188*9880d681SAndroid Build Coastguard Worker             OpcodeStr, Dt, "$Vd, $Vm", "", pattern> {
2189*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2190*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2191*9880d681SAndroid Build Coastguard Worker
2192*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands
2193*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2194*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2195*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Vm{4};
2196*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Vm{3-0};
2197*9880d681SAndroid Build Coastguard Worker
2198*9880d681SAndroid Build Coastguard Worker  // Encode constant bits
2199*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = 0b00111;
2200*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = 0b11;
2201*9880d681SAndroid Build Coastguard Worker  let Inst{19-18} = op19_18;
2202*9880d681SAndroid Build Coastguard Worker  let Inst{17-16} = op17_16;
2203*9880d681SAndroid Build Coastguard Worker  let Inst{11} = 0;
2204*9880d681SAndroid Build Coastguard Worker  let Inst{10-8} = op10_8;
2205*9880d681SAndroid Build Coastguard Worker  let Inst{7} = op7;
2206*9880d681SAndroid Build Coastguard Worker  let Inst{6} = op6;
2207*9880d681SAndroid Build Coastguard Worker  let Inst{4} = 0;
2208*9880d681SAndroid Build Coastguard Worker
2209*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "NEON";
2210*9880d681SAndroid Build Coastguard Worker}
2211*9880d681SAndroid Build Coastguard Worker
2212*9880d681SAndroid Build Coastguard Worker// Same as N2V except it doesn't have a datatype suffix.
2213*9880d681SAndroid Build Coastguard Workerclass N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
2214*9880d681SAndroid Build Coastguard Worker           bits<5> op11_7, bit op6, bit op4,
2215*9880d681SAndroid Build Coastguard Worker           dag oops, dag iops, InstrItinClass itin,
2216*9880d681SAndroid Build Coastguard Worker           string opc, string asm, string cstr, list<dag> pattern>
2217*9880d681SAndroid Build Coastguard Worker  : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
2218*9880d681SAndroid Build Coastguard Worker  let Inst{24-23} = op24_23;
2219*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = op21_20;
2220*9880d681SAndroid Build Coastguard Worker  let Inst{19-18} = op19_18;
2221*9880d681SAndroid Build Coastguard Worker  let Inst{17-16} = op17_16;
2222*9880d681SAndroid Build Coastguard Worker  let Inst{11-7}  = op11_7;
2223*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
2224*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
2225*9880d681SAndroid Build Coastguard Worker
2226*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
2227*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2228*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2229*9880d681SAndroid Build Coastguard Worker
2230*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2231*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2232*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Vm{3-0};
2233*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Vm{4};
2234*9880d681SAndroid Build Coastguard Worker}
2235*9880d681SAndroid Build Coastguard Worker
2236*9880d681SAndroid Build Coastguard Worker// NEON 2 vector register with immediate.
2237*9880d681SAndroid Build Coastguard Workerclass N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
2238*9880d681SAndroid Build Coastguard Worker             dag oops, dag iops, Format f, InstrItinClass itin,
2239*9880d681SAndroid Build Coastguard Worker             string opc, string dt, string asm, string cstr, list<dag> pattern>
2240*9880d681SAndroid Build Coastguard Worker  : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
2241*9880d681SAndroid Build Coastguard Worker  let Inst{24}   = op24;
2242*9880d681SAndroid Build Coastguard Worker  let Inst{23}   = op23;
2243*9880d681SAndroid Build Coastguard Worker  let Inst{11-8} = op11_8;
2244*9880d681SAndroid Build Coastguard Worker  let Inst{7}    = op7;
2245*9880d681SAndroid Build Coastguard Worker  let Inst{6}    = op6;
2246*9880d681SAndroid Build Coastguard Worker  let Inst{4}    = op4;
2247*9880d681SAndroid Build Coastguard Worker
2248*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
2249*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2250*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2251*9880d681SAndroid Build Coastguard Worker  bits<6> SIMM;
2252*9880d681SAndroid Build Coastguard Worker
2253*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2254*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2255*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Vm{3-0};
2256*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Vm{4};
2257*9880d681SAndroid Build Coastguard Worker  let Inst{21-16} = SIMM{5-0};
2258*9880d681SAndroid Build Coastguard Worker}
2259*9880d681SAndroid Build Coastguard Worker
2260*9880d681SAndroid Build Coastguard Worker// NEON 3 vector register format.
2261*9880d681SAndroid Build Coastguard Worker
2262*9880d681SAndroid Build Coastguard Workerclass N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
2263*9880d681SAndroid Build Coastguard Worker                bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
2264*9880d681SAndroid Build Coastguard Worker                string opc, string dt, string asm, string cstr,
2265*9880d681SAndroid Build Coastguard Worker                list<dag> pattern>
2266*9880d681SAndroid Build Coastguard Worker  : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
2267*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = op24;
2268*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = op23;
2269*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = op21_20;
2270*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = op11_8;
2271*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
2272*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
2273*9880d681SAndroid Build Coastguard Worker}
2274*9880d681SAndroid Build Coastguard Worker
2275*9880d681SAndroid Build Coastguard Workerclass N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
2276*9880d681SAndroid Build Coastguard Worker          dag oops, dag iops, Format f, InstrItinClass itin,
2277*9880d681SAndroid Build Coastguard Worker          string opc, string dt, string asm, string cstr, list<dag> pattern>
2278*9880d681SAndroid Build Coastguard Worker  : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
2279*9880d681SAndroid Build Coastguard Worker              oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
2280*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
2281*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2282*9880d681SAndroid Build Coastguard Worker  bits<5> Vn;
2283*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2284*9880d681SAndroid Build Coastguard Worker
2285*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2286*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2287*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Vn{3-0};
2288*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Vn{4};
2289*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Vm{3-0};
2290*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Vm{4};
2291*9880d681SAndroid Build Coastguard Worker}
2292*9880d681SAndroid Build Coastguard Worker
2293*9880d681SAndroid Build Coastguard Workerclass N3Vnp<bits<5> op27_23, bits<2> op21_20, bits<4> op11_8, bit op6,
2294*9880d681SAndroid Build Coastguard Worker                bit op4, dag oops, dag iops,Format f, InstrItinClass itin,
2295*9880d681SAndroid Build Coastguard Worker                string OpcodeStr, string Dt, list<dag> pattern>
2296*9880d681SAndroid Build Coastguard Worker  : NeonInp<oops, iops, AddrModeNone, IndexModeNone, f, itin, OpcodeStr,
2297*9880d681SAndroid Build Coastguard Worker            Dt, "$Vd, $Vn, $Vm", "", pattern> {
2298*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2299*9880d681SAndroid Build Coastguard Worker  bits<5> Vn;
2300*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2301*9880d681SAndroid Build Coastguard Worker
2302*9880d681SAndroid Build Coastguard Worker  // Encode instruction operands
2303*9880d681SAndroid Build Coastguard Worker  let Inst{22} = Vd{4};
2304*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2305*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Vn{3-0};
2306*9880d681SAndroid Build Coastguard Worker  let Inst{7} = Vn{4};
2307*9880d681SAndroid Build Coastguard Worker  let Inst{5} = Vm{4};
2308*9880d681SAndroid Build Coastguard Worker  let Inst{3-0} = Vm{3-0};
2309*9880d681SAndroid Build Coastguard Worker
2310*9880d681SAndroid Build Coastguard Worker  // Encode constant bits
2311*9880d681SAndroid Build Coastguard Worker  let Inst{27-23} = op27_23;
2312*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = op21_20;
2313*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = op11_8;
2314*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
2315*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
2316*9880d681SAndroid Build Coastguard Worker}
2317*9880d681SAndroid Build Coastguard Worker
2318*9880d681SAndroid Build Coastguard Workerclass N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
2319*9880d681SAndroid Build Coastguard Worker                bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
2320*9880d681SAndroid Build Coastguard Worker                string opc, string dt, string asm, string cstr,
2321*9880d681SAndroid Build Coastguard Worker                list<dag> pattern>
2322*9880d681SAndroid Build Coastguard Worker  : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
2323*9880d681SAndroid Build Coastguard Worker              oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
2324*9880d681SAndroid Build Coastguard Worker
2325*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
2326*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2327*9880d681SAndroid Build Coastguard Worker  bits<5> Vn;
2328*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2329*9880d681SAndroid Build Coastguard Worker  bit lane;
2330*9880d681SAndroid Build Coastguard Worker
2331*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2332*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2333*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Vn{3-0};
2334*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Vn{4};
2335*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Vm{3-0};
2336*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = lane;
2337*9880d681SAndroid Build Coastguard Worker}
2338*9880d681SAndroid Build Coastguard Worker
2339*9880d681SAndroid Build Coastguard Workerclass N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
2340*9880d681SAndroid Build Coastguard Worker                bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
2341*9880d681SAndroid Build Coastguard Worker                string opc, string dt, string asm, string cstr,
2342*9880d681SAndroid Build Coastguard Worker                list<dag> pattern>
2343*9880d681SAndroid Build Coastguard Worker  : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
2344*9880d681SAndroid Build Coastguard Worker              oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
2345*9880d681SAndroid Build Coastguard Worker
2346*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
2347*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2348*9880d681SAndroid Build Coastguard Worker  bits<5> Vn;
2349*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2350*9880d681SAndroid Build Coastguard Worker  bits<2> lane;
2351*9880d681SAndroid Build Coastguard Worker
2352*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2353*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2354*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Vn{3-0};
2355*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Vn{4};
2356*9880d681SAndroid Build Coastguard Worker  let Inst{2-0}   = Vm{2-0};
2357*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = lane{1};
2358*9880d681SAndroid Build Coastguard Worker  let Inst{3}     = lane{0};
2359*9880d681SAndroid Build Coastguard Worker}
2360*9880d681SAndroid Build Coastguard Worker
2361*9880d681SAndroid Build Coastguard Worker// Same as N3V except it doesn't have a data type suffix.
2362*9880d681SAndroid Build Coastguard Workerclass N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
2363*9880d681SAndroid Build Coastguard Worker           bit op4,
2364*9880d681SAndroid Build Coastguard Worker           dag oops, dag iops, Format f, InstrItinClass itin,
2365*9880d681SAndroid Build Coastguard Worker           string opc, string asm, string cstr, list<dag> pattern>
2366*9880d681SAndroid Build Coastguard Worker  : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
2367*9880d681SAndroid Build Coastguard Worker  let Inst{24}    = op24;
2368*9880d681SAndroid Build Coastguard Worker  let Inst{23}    = op23;
2369*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = op21_20;
2370*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = op11_8;
2371*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
2372*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = op4;
2373*9880d681SAndroid Build Coastguard Worker
2374*9880d681SAndroid Build Coastguard Worker  // Instruction operands.
2375*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2376*9880d681SAndroid Build Coastguard Worker  bits<5> Vn;
2377*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2378*9880d681SAndroid Build Coastguard Worker
2379*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2380*9880d681SAndroid Build Coastguard Worker  let Inst{22}    = Vd{4};
2381*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = Vn{3-0};
2382*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = Vn{4};
2383*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = Vm{3-0};
2384*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Vm{4};
2385*9880d681SAndroid Build Coastguard Worker}
2386*9880d681SAndroid Build Coastguard Worker
2387*9880d681SAndroid Build Coastguard Worker// NEON VMOVs between scalar and core registers.
2388*9880d681SAndroid Build Coastguard Workerclass NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
2389*9880d681SAndroid Build Coastguard Worker               dag oops, dag iops, Format f, InstrItinClass itin,
2390*9880d681SAndroid Build Coastguard Worker               string opc, string dt, string asm, list<dag> pattern>
2391*9880d681SAndroid Build Coastguard Worker  : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
2392*9880d681SAndroid Build Coastguard Worker            "", itin> {
2393*9880d681SAndroid Build Coastguard Worker  let Inst{27-20} = opcod1;
2394*9880d681SAndroid Build Coastguard Worker  let Inst{11-8}  = opcod2;
2395*9880d681SAndroid Build Coastguard Worker  let Inst{6-5}   = opcod3;
2396*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = 1;
2397*9880d681SAndroid Build Coastguard Worker  // A8.6.303, A8.6.328, A8.6.329
2398*9880d681SAndroid Build Coastguard Worker  let Inst{3-0}   = 0b0000;
2399*9880d681SAndroid Build Coastguard Worker
2400*9880d681SAndroid Build Coastguard Worker  let OutOperandList = oops;
2401*9880d681SAndroid Build Coastguard Worker  let InOperandList = !con(iops, (ins pred:$p));
2402*9880d681SAndroid Build Coastguard Worker  let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
2403*9880d681SAndroid Build Coastguard Worker  let Pattern = pattern;
2404*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasNEON];
2405*9880d681SAndroid Build Coastguard Worker
2406*9880d681SAndroid Build Coastguard Worker  let PostEncoderMethod = "NEONThumb2DupPostEncoder";
2407*9880d681SAndroid Build Coastguard Worker  let DecoderNamespace = "NEONDup";
2408*9880d681SAndroid Build Coastguard Worker
2409*9880d681SAndroid Build Coastguard Worker  bits<5> V;
2410*9880d681SAndroid Build Coastguard Worker  bits<4> R;
2411*9880d681SAndroid Build Coastguard Worker  bits<4> p;
2412*9880d681SAndroid Build Coastguard Worker  bits<4> lane;
2413*9880d681SAndroid Build Coastguard Worker
2414*9880d681SAndroid Build Coastguard Worker  let Inst{31-28} = p{3-0};
2415*9880d681SAndroid Build Coastguard Worker  let Inst{7}     = V{4};
2416*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = V{3-0};
2417*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = R{3-0};
2418*9880d681SAndroid Build Coastguard Worker}
2419*9880d681SAndroid Build Coastguard Workerclass NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
2420*9880d681SAndroid Build Coastguard Worker                dag oops, dag iops, InstrItinClass itin,
2421*9880d681SAndroid Build Coastguard Worker                string opc, string dt, string asm, list<dag> pattern>
2422*9880d681SAndroid Build Coastguard Worker  : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
2423*9880d681SAndroid Build Coastguard Worker             opc, dt, asm, pattern>;
2424*9880d681SAndroid Build Coastguard Workerclass NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
2425*9880d681SAndroid Build Coastguard Worker                dag oops, dag iops, InstrItinClass itin,
2426*9880d681SAndroid Build Coastguard Worker                string opc, string dt, string asm, list<dag> pattern>
2427*9880d681SAndroid Build Coastguard Worker  : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
2428*9880d681SAndroid Build Coastguard Worker             opc, dt, asm, pattern>;
2429*9880d681SAndroid Build Coastguard Workerclass NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
2430*9880d681SAndroid Build Coastguard Worker            dag oops, dag iops, InstrItinClass itin,
2431*9880d681SAndroid Build Coastguard Worker            string opc, string dt, string asm, list<dag> pattern>
2432*9880d681SAndroid Build Coastguard Worker  : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
2433*9880d681SAndroid Build Coastguard Worker             opc, dt, asm, pattern>;
2434*9880d681SAndroid Build Coastguard Worker
2435*9880d681SAndroid Build Coastguard Worker// Vector Duplicate Lane (from scalar to all elements)
2436*9880d681SAndroid Build Coastguard Workerclass NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
2437*9880d681SAndroid Build Coastguard Worker                InstrItinClass itin, string opc, string dt, string asm,
2438*9880d681SAndroid Build Coastguard Worker                list<dag> pattern>
2439*9880d681SAndroid Build Coastguard Worker  : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
2440*9880d681SAndroid Build Coastguard Worker  let Inst{24-23} = 0b11;
2441*9880d681SAndroid Build Coastguard Worker  let Inst{21-20} = 0b11;
2442*9880d681SAndroid Build Coastguard Worker  let Inst{19-16} = op19_16;
2443*9880d681SAndroid Build Coastguard Worker  let Inst{11-7}  = 0b11000;
2444*9880d681SAndroid Build Coastguard Worker  let Inst{6}     = op6;
2445*9880d681SAndroid Build Coastguard Worker  let Inst{4}     = 0;
2446*9880d681SAndroid Build Coastguard Worker
2447*9880d681SAndroid Build Coastguard Worker  bits<5> Vd;
2448*9880d681SAndroid Build Coastguard Worker  bits<5> Vm;
2449*9880d681SAndroid Build Coastguard Worker
2450*9880d681SAndroid Build Coastguard Worker  let Inst{22}     = Vd{4};
2451*9880d681SAndroid Build Coastguard Worker  let Inst{15-12} = Vd{3-0};
2452*9880d681SAndroid Build Coastguard Worker  let Inst{5}     = Vm{4};
2453*9880d681SAndroid Build Coastguard Worker  let Inst{3-0} = Vm{3-0};
2454*9880d681SAndroid Build Coastguard Worker}
2455*9880d681SAndroid Build Coastguard Worker
2456*9880d681SAndroid Build Coastguard Worker// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
2457*9880d681SAndroid Build Coastguard Worker// for single-precision FP.
2458*9880d681SAndroid Build Coastguard Workerclass NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
2459*9880d681SAndroid Build Coastguard Worker  list<Predicate> Predicates = [HasNEON,UseNEONForFP];
2460*9880d681SAndroid Build Coastguard Worker}
2461*9880d681SAndroid Build Coastguard Worker
2462*9880d681SAndroid Build Coastguard Worker// VFP/NEON Instruction aliases for type suffices.
2463*9880d681SAndroid Build Coastguard Worker// Note: When EmitPriority == 1, the alias will be used for printing
2464*9880d681SAndroid Build Coastguard Workerclass VFPDataTypeInstAlias<string opc, string dt, string asm, dag Result, bit EmitPriority = 0> :
2465*9880d681SAndroid Build Coastguard Worker  InstAlias<!strconcat(opc, dt, "\t", asm), Result, EmitPriority>, Requires<[HasVFP2]>;
2466*9880d681SAndroid Build Coastguard Worker
2467*9880d681SAndroid Build Coastguard Worker// Note: When EmitPriority == 1, the alias will be used for printing
2468*9880d681SAndroid Build Coastguard Workermulticlass VFPDTAnyInstAlias<string opc, string asm, dag Result, bit EmitPriority = 0> {
2469*9880d681SAndroid Build Coastguard Worker  def : VFPDataTypeInstAlias<opc, ".8", asm, Result, EmitPriority>;
2470*9880d681SAndroid Build Coastguard Worker  def : VFPDataTypeInstAlias<opc, ".16", asm, Result, EmitPriority>;
2471*9880d681SAndroid Build Coastguard Worker  def : VFPDataTypeInstAlias<opc, ".32", asm, Result, EmitPriority>;
2472*9880d681SAndroid Build Coastguard Worker  def : VFPDataTypeInstAlias<opc, ".64", asm, Result, EmitPriority>;
2473*9880d681SAndroid Build Coastguard Worker}
2474*9880d681SAndroid Build Coastguard Worker
2475*9880d681SAndroid Build Coastguard Worker// Note: When EmitPriority == 1, the alias will be used for printing
2476*9880d681SAndroid Build Coastguard Workermulticlass NEONDTAnyInstAlias<string opc, string asm, dag Result, bit EmitPriority = 0> {
2477*9880d681SAndroid Build Coastguard Worker  let Predicates = [HasNEON] in {
2478*9880d681SAndroid Build Coastguard Worker  def : VFPDataTypeInstAlias<opc, ".8", asm, Result, EmitPriority>;
2479*9880d681SAndroid Build Coastguard Worker  def : VFPDataTypeInstAlias<opc, ".16", asm, Result, EmitPriority>;
2480*9880d681SAndroid Build Coastguard Worker  def : VFPDataTypeInstAlias<opc, ".32", asm, Result, EmitPriority>;
2481*9880d681SAndroid Build Coastguard Worker  def : VFPDataTypeInstAlias<opc, ".64", asm, Result, EmitPriority>;
2482*9880d681SAndroid Build Coastguard Worker}
2483*9880d681SAndroid Build Coastguard Worker}
2484*9880d681SAndroid Build Coastguard Worker
2485*9880d681SAndroid Build Coastguard Worker// The same alias classes using AsmPseudo instead, for the more complex
2486*9880d681SAndroid Build Coastguard Worker// stuff in NEON that InstAlias can't quite handle.
2487*9880d681SAndroid Build Coastguard Worker// Note that we can't use anonymous defm references here like we can
2488*9880d681SAndroid Build Coastguard Worker// above, as we care about the ultimate instruction enum names generated, unlike
2489*9880d681SAndroid Build Coastguard Worker// for instalias defs.
2490*9880d681SAndroid Build Coastguard Workerclass NEONDataTypeAsmPseudoInst<string opc, string dt, string asm, dag iops> :
2491*9880d681SAndroid Build Coastguard Worker  AsmPseudoInst<!strconcat(opc, dt, "\t", asm), iops>, Requires<[HasNEON]>;
2492*9880d681SAndroid Build Coastguard Worker
2493*9880d681SAndroid Build Coastguard Worker// Data type suffix token aliases. Implements Table A7-3 in the ARM ARM.
2494*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".s8", ".i8">;
2495*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".u8", ".i8">;
2496*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".s16", ".i16">;
2497*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".u16", ".i16">;
2498*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".s32", ".i32">;
2499*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".u32", ".i32">;
2500*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".s64", ".i64">;
2501*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".u64", ".i64">;
2502*9880d681SAndroid Build Coastguard Worker
2503*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".i8", ".8">;
2504*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".i16", ".16">;
2505*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".i32", ".32">;
2506*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".i64", ".64">;
2507*9880d681SAndroid Build Coastguard Worker
2508*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".p8", ".8">;
2509*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".p16", ".16">;
2510*9880d681SAndroid Build Coastguard Worker
2511*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".f32", ".32">;
2512*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".f64", ".64">;
2513*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".f", ".f32">;
2514*9880d681SAndroid Build Coastguard Workerdef : TokenAlias<".d", ".f64">;
2515