blob: 2350e400f47657663be5c1001f4057fc6410b1b3 [file] [log] [blame]
Evan Cheng37f25d92008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
Bob Wilson01135592010-03-23 17:23:59 +00002//
Evan Cheng37f25d92008-08-28 23:39:26 +00003// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bob Wilson01135592010-03-23 17:23:59 +00007//
Evan Cheng37f25d92008-08-28 23:39:26 +00008//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11//
12// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
Bob Wilson89ef7b72010-03-17 21:13:43 +000018class Format<bits<6> val> {
19 bits<6> Value = val;
Evan Cheng37f25d92008-08-28 23:39:26 +000020}
21
Evan Chengffa6d962008-11-13 23:36:57 +000022def Pseudo : Format<0>;
23def MulFrm : Format<1>;
24def BrFrm : Format<2>;
25def BrMiscFrm : Format<3>;
Evan Cheng37f25d92008-08-28 23:39:26 +000026
Evan Chengffa6d962008-11-13 23:36:57 +000027def DPFrm : Format<4>;
28def DPSoRegFrm : Format<5>;
Evan Cheng37f25d92008-08-28 23:39:26 +000029
Evan Chengffa6d962008-11-13 23:36:57 +000030def LdFrm : Format<6>;
31def StFrm : Format<7>;
32def LdMiscFrm : Format<8>;
33def StMiscFrm : Format<9>;
34def LdStMulFrm : Format<10>;
Evan Cheng37f25d92008-08-28 23:39:26 +000035
Johnny Chen81f04d52010-03-19 17:39:00 +000036def LdStExFrm : Format<11>;
Jim Grosbach5278eb82009-12-11 01:42:04 +000037
Johnny Chen81f04d52010-03-19 17:39:00 +000038def ArithMiscFrm : Format<12>;
Bob Wilson9a1c1892010-08-11 00:01:18 +000039def SatFrm : Format<13>;
40def ExtFrm : Format<14>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000041
Bob Wilson9a1c1892010-08-11 00:01:18 +000042def VFPUnaryFrm : Format<15>;
43def VFPBinaryFrm : Format<16>;
44def VFPConv1Frm : Format<17>;
45def VFPConv2Frm : Format<18>;
46def VFPConv3Frm : Format<19>;
47def VFPConv4Frm : Format<20>;
48def VFPConv5Frm : Format<21>;
49def VFPLdStFrm : Format<22>;
50def VFPLdStMulFrm : Format<23>;
51def VFPMiscFrm : Format<24>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000052
Bob Wilson9a1c1892010-08-11 00:01:18 +000053def ThumbFrm : Format<25>;
54def MiscFrm : Format<26>;
Evan Cheng37f25d92008-08-28 23:39:26 +000055
Bob Wilson9a1c1892010-08-11 00:01:18 +000056def NGetLnFrm : Format<27>;
57def NSetLnFrm : Format<28>;
58def NDupFrm : Format<29>;
59def NLdStFrm : Format<30>;
60def N1RegModImmFrm: Format<31>;
61def N2RegFrm : Format<32>;
62def NVCVTFrm : Format<33>;
63def NVDupLnFrm : Format<34>;
64def N2RegVShLFrm : Format<35>;
65def N2RegVShRFrm : Format<36>;
66def N3RegFrm : Format<37>;
67def N3RegVShFrm : Format<38>;
68def NVExtFrm : Format<39>;
69def NVMulSLFrm : Format<40>;
70def NVTBLFrm : Format<41>;
Johnny Chencaa608e2010-03-20 00:17:00 +000071
Evan Cheng34a0fa32009-07-08 01:46:35 +000072// Misc flags.
73
Evan Chengedda31c2008-11-05 18:35:52 +000074// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000075// UnaryDP - Indicates this is a unary data processing instruction, i.e.
76// it doesn't have a Rn operand.
77class UnaryDP { bit isUnaryDataProc = 1; }
78
79// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
80// a 16-bit Thumb instruction if certain conditions are met.
81class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000082
Evan Cheng37f25d92008-08-28 23:39:26 +000083//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000084// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000085//
86
87// Addressing mode.
Jim Grosbachd86609f2010-10-05 18:14:55 +000088class AddrMode<bits<5> val> {
89 bits<5> Value = val;
Evan Cheng055b0312009-06-29 07:51:04 +000090}
Bill Wendlingda2ae632010-08-31 07:50:46 +000091def AddrModeNone : AddrMode<0>;
92def AddrMode1 : AddrMode<1>;
93def AddrMode2 : AddrMode<2>;
94def AddrMode3 : AddrMode<3>;
95def AddrMode4 : AddrMode<4>;
96def AddrMode5 : AddrMode<5>;
97def AddrMode6 : AddrMode<6>;
98def AddrModeT1_1 : AddrMode<7>;
99def AddrModeT1_2 : AddrMode<8>;
100def AddrModeT1_4 : AddrMode<9>;
101def AddrModeT1_s : AddrMode<10>;
102def AddrModeT2_i12 : AddrMode<11>;
103def AddrModeT2_i8 : AddrMode<12>;
104def AddrModeT2_so : AddrMode<13>;
105def AddrModeT2_pc : AddrMode<14>;
Bob Wilson8b024a52009-07-01 23:16:05 +0000106def AddrModeT2_i8s4 : AddrMode<15>;
Jim Grosbach3e556122010-10-26 22:37:02 +0000107def AddrMode_i12 : AddrMode<16>;
Evan Cheng055b0312009-06-29 07:51:04 +0000108
109// Instruction size.
110class SizeFlagVal<bits<3> val> {
111 bits<3> Value = val;
112}
113def SizeInvalid : SizeFlagVal<0>; // Unset.
114def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
115def Size8Bytes : SizeFlagVal<2>;
116def Size4Bytes : SizeFlagVal<3>;
117def Size2Bytes : SizeFlagVal<4>;
118
119// Load / store index mode.
120class IndexMode<bits<2> val> {
121 bits<2> Value = val;
122}
123def IndexModeNone : IndexMode<0>;
124def IndexModePre : IndexMode<1>;
125def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000126def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000127
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000128// Instruction execution domain.
129class Domain<bits<2> val> {
130 bits<2> Value = val;
131}
132def GenericDomain : Domain<0>;
133def VFPDomain : Domain<1>; // Instructions in VFP domain only
134def NeonDomain : Domain<2>; // Instructions in Neon domain only
135def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
136
Evan Cheng055b0312009-06-29 07:51:04 +0000137//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000138
Evan Cheng446c4282009-07-11 06:43:01 +0000139// ARM special operands.
140//
141
Daniel Dunbar8462b302010-08-11 06:36:53 +0000142def CondCodeOperand : AsmOperandClass {
143 let Name = "CondCode";
144 let SuperClasses = [];
145}
146
Evan Cheng446c4282009-07-11 06:43:01 +0000147// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
148// register whose default is 0 (no register).
149def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
150 (ops (i32 14), (i32 zero_reg))> {
151 let PrintMethod = "printPredicateOperand";
Daniel Dunbar8462b302010-08-11 06:36:53 +0000152 let ParserMatchClass = CondCodeOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000153}
154
155// Conditional code result for instructions whose 's' bit is set, e.g. subs.
156def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Jim Grosbach08bd5492010-10-12 23:00:24 +0000157 string EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000158 let PrintMethod = "printSBitModifierOperand";
159}
160
161// Same as cc_out except it defaults to setting CPSR.
162def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Jim Grosbach08bd5492010-10-12 23:00:24 +0000163 string EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000164 let PrintMethod = "printSBitModifierOperand";
165}
166
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000167// ARM special operands for disassembly only.
168//
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000169def setend_op : Operand<i32> {
170 let PrintMethod = "printSetendOperand";
171}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000172
173def cps_opt : Operand<i32> {
174 let PrintMethod = "printCPSOptionOperand";
175}
176
177def msr_mask : Operand<i32> {
178 let PrintMethod = "printMSRMaskOperand";
179}
180
181// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
182// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
183def neg_zero : Operand<i32> {
184 let PrintMethod = "printNegZeroOperand";
185}
186
Evan Cheng446c4282009-07-11 06:43:01 +0000187//===----------------------------------------------------------------------===//
188
Evan Cheng37f25d92008-08-28 23:39:26 +0000189// ARM Instruction templates.
190//
191
Johnny Chend68e1192009-12-15 17:24:14 +0000192class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
193 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000194 : Instruction {
195 let Namespace = "ARM";
196
Evan Cheng37f25d92008-08-28 23:39:26 +0000197 AddrMode AM = am;
Evan Cheng37f25d92008-08-28 23:39:26 +0000198 SizeFlagVal SZ = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000199 IndexMode IM = im;
200 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000201 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000202 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000203 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000204 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000205 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000206
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000207 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000208 let TSFlags{4-0} = AM.Value;
209 let TSFlags{7-5} = SZ.Value;
210 let TSFlags{9-8} = IndexModeBits;
211 let TSFlags{15-10} = Form;
212 let TSFlags{16} = isUnaryDataProc;
213 let TSFlags{17} = canXformTo16Bit;
214 let TSFlags{19-18} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000215
Evan Cheng37f25d92008-08-28 23:39:26 +0000216 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000217 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000218}
219
Johnny Chend68e1192009-12-15 17:24:14 +0000220class Encoding {
221 field bits<32> Inst;
222}
223
224class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
225 Format f, Domain d, string cstr, InstrItinClass itin>
226 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
227
228// This Encoding-less class is used by Thumb1 to specify the encoding bits later
229// on by adding flavors to specific instructions.
230class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
231 Format f, Domain d, string cstr, InstrItinClass itin>
232 : InstTemplate<am, sz, im, f, d, cstr, itin>;
233
Bob Wilson01135592010-03-23 17:23:59 +0000234class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000235 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000236 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000237 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000238 let OutOperandList = oops;
239 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000240 let AsmString = asm;
Evan Cheng37f25d92008-08-28 23:39:26 +0000241 let Pattern = pattern;
242}
243
244// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000245class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000246 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000247 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000248 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000249 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000250 bits<4> p;
251 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000252 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000253 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000254 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000255 let Pattern = pattern;
256 list<Predicate> Predicates = [IsARM];
257}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000258
Jim Grosbachf6b28622009-12-14 18:31:20 +0000259// A few are not predicable
260class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000261 IndexMode im, Format f, InstrItinClass itin,
262 string opc, string asm, string cstr,
263 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000264 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
265 let OutOperandList = oops;
266 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000267 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000268 let Pattern = pattern;
269 let isPredicable = 0;
270 list<Predicate> Predicates = [IsARM];
271}
Evan Cheng37f25d92008-08-28 23:39:26 +0000272
Bill Wendling4822bce2010-08-30 01:47:35 +0000273// Same as I except it can optionally modify CPSR. Note it's modeled as an input
274// operand since by default it's a zero register. It will become an implicit def
275// once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000276class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000277 IndexMode im, Format f, InstrItinClass itin,
278 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000279 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000280 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000281 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000282 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000283 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000284 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000285
Evan Cheng37f25d92008-08-28 23:39:26 +0000286 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000287 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000288 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000289 let Pattern = pattern;
290 list<Predicate> Predicates = [IsARM];
291}
292
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000293// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000294class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000295 IndexMode im, Format f, InstrItinClass itin,
296 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000297 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000298 let OutOperandList = oops;
299 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000300 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000301 let Pattern = pattern;
302 list<Predicate> Predicates = [IsARM];
303}
304
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000305class AI<dag oops, dag iops, Format f, InstrItinClass itin,
306 string opc, string asm, list<dag> pattern>
307 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
308 opc, asm, "", pattern>;
309class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
310 string opc, string asm, list<dag> pattern>
311 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
312 opc, asm, "", pattern>;
313class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000314 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000315 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000316 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000317class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000318 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000319 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000320 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000321
322// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000323class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
324 string opc, string asm, list<dag> pattern>
325 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
326 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000327 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000328}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000329class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
330 string asm, list<dag> pattern>
331 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
332 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000333 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000334}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000335class ABXIx2<dag oops, dag iops, InstrItinClass itin,
336 string asm, list<dag> pattern>
Xerxes Ranby99ccffe2010-07-22 17:28:34 +0000337 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000338 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000339
340// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000341class JTI<dag oops, dag iops, InstrItinClass itin,
342 string asm, list<dag> pattern>
343 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000344 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000345
Jim Grosbach5278eb82009-12-11 01:42:04 +0000346// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000347class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
348 string opc, string asm, list<dag> pattern>
349 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
350 opc, asm, "", pattern> {
351 let Inst{27-23} = 0b00011;
352 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000353 let Inst{20} = 1;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000354 let Inst{11-0} = 0b111110011111;
355}
356class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
357 string opc, string asm, list<dag> pattern>
358 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
359 opc, asm, "", pattern> {
360 let Inst{27-23} = 0b00011;
361 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000362 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000363 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000364}
365
Evan Cheng0d14fc82008-09-01 01:51:14 +0000366// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000367class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
368 string opc, string asm, list<dag> pattern>
369 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
370 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000371 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000372 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000373}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000374class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
375 string opc, string asm, list<dag> pattern>
376 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
377 opc, asm, "", pattern> {
378 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000379 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000380}
381class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000382 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000383 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000384 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000385 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000386 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000387}
Bob Wilson01135592010-03-23 17:23:59 +0000388class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000389 string opc, string asm, list<dag> pattern>
390 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
391 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000392
Evan Cheng0d14fc82008-09-01 01:51:14 +0000393
394// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000395class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
396 string opc, string asm, list<dag> pattern>
397 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
398 opc, asm, "", pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +0000399 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000400}
Evan Cheng93912732008-09-01 01:27:33 +0000401
402// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000403
404// LDR/LDRB
405class AIldr1<bits<3> op, bit opc22, dag oops, dag iops, AddrMode am, Format f,
406 InstrItinClass itin, string opc, string asm, list<dag> pattern>
407 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
408 "", pattern> {
409 let Inst{27-25} = op;
410 let Inst{24} = 1; // 24 == P
411 // 23 == U
412 let Inst{22} = opc22;
413 let Inst{21} = 0; // 21 == W
414 let Inst{20} = 1;
415}
416// LDRH/LDRSB/LDRSH/LDRD
417class AIldr2<bits<4> op, bit opc22, bit opc20, dag oops, dag iops, AddrMode am,
418 Format f, InstrItinClass itin, string opc, string asm,
419 list<dag> pattern>
420 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
421 "", pattern> {
422 let Inst{27-25} = 0b000;
423 let Inst{24} = 1; // 24 == P
424 // 23 == U
425 let Inst{22} = opc22;
426 let Inst{21} = 0; // 21 == W
427 let Inst{20} = opc20;
428
429 let Inst{7-4} = op;
430}
431
432
433
434
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000435class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
436 string opc, string asm, list<dag> pattern>
437 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
438 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000439 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000440 let Inst{21} = 0; // W bit
441 let Inst{22} = 0; // B bit
442 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000443 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000444}
Bob Wilson01135592010-03-23 17:23:59 +0000445class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000446 string asm, list<dag> pattern>
447 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000448 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000449 let Inst{20} = 1; // L bit
450 let Inst{21} = 0; // W bit
451 let Inst{22} = 0; // B bit
452 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000453 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000454}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000455class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
456 string opc, string asm, list<dag> pattern>
457 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
458 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000459 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000460 let Inst{21} = 0; // W bit
461 let Inst{22} = 1; // B bit
462 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000463 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000464}
Bob Wilson01135592010-03-23 17:23:59 +0000465class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000466 string asm, list<dag> pattern>
467 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000468 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000469 let Inst{20} = 1; // L bit
470 let Inst{21} = 0; // W bit
471 let Inst{22} = 1; // B bit
472 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000473 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000474}
Evan Cheng17222df2008-08-31 19:02:21 +0000475
Evan Cheng93912732008-09-01 01:27:33 +0000476// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000477class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
478 string opc, string asm, list<dag> pattern>
479 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
480 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000481 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000482 let Inst{21} = 0; // W bit
483 let Inst{22} = 0; // B bit
484 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000485 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000486}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000487class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
488 string asm, list<dag> pattern>
489 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000490 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000491 let Inst{20} = 0; // L bit
492 let Inst{21} = 0; // W bit
493 let Inst{22} = 0; // B bit
494 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000495 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000496}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000497class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
498 string opc, string asm, list<dag> pattern>
499 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
500 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000501 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000502 let Inst{21} = 0; // W bit
503 let Inst{22} = 1; // B bit
504 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000505 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000506}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000507class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
508 string asm, list<dag> pattern>
509 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000510 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000511 let Inst{20} = 0; // L bit
512 let Inst{21} = 0; // W bit
513 let Inst{22} = 1; // B bit
514 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000515 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000516}
Evan Cheng93912732008-09-01 01:27:33 +0000517
Evan Cheng840917b2008-09-01 07:00:14 +0000518// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000519class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
520 string opc, string asm, string cstr, list<dag> pattern>
521 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
522 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000523 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000524 let Inst{21} = 1; // W bit
525 let Inst{22} = 0; // B bit
526 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000527 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000528}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000529class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
530 string opc, string asm, string cstr, list<dag> pattern>
531 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
532 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000533 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000534 let Inst{21} = 1; // W bit
535 let Inst{22} = 1; // B bit
536 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000537 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000538}
539
Evan Cheng840917b2008-09-01 07:00:14 +0000540// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000541class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
542 string opc, string asm, string cstr, list<dag> pattern>
543 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
544 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000545 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000546 let Inst{21} = 1; // W bit
547 let Inst{22} = 0; // B bit
548 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000549 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000550}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000551class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
552 string opc, string asm, string cstr, list<dag> pattern>
553 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
554 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000555 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000556 let Inst{21} = 1; // W bit
557 let Inst{22} = 1; // B bit
558 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000559 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000560}
561
Evan Cheng840917b2008-09-01 07:00:14 +0000562// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000563class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
564 string opc, string asm, string cstr, list<dag> pattern>
565 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
566 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000567 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000568 let Inst{21} = 0; // W bit
569 let Inst{22} = 0; // B bit
570 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000571 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000572}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000573class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
574 string opc, string asm, string cstr, list<dag> pattern>
575 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
576 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000577 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000578 let Inst{21} = 0; // W bit
579 let Inst{22} = 1; // B bit
580 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000581 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000582}
583
Evan Cheng840917b2008-09-01 07:00:14 +0000584// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000585class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
586 string opc, string asm, string cstr, list<dag> pattern>
587 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
588 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000589 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000590 let Inst{21} = 0; // W bit
591 let Inst{22} = 0; // B bit
592 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000593 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000594}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000595class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
596 string opc, string asm, string cstr, list<dag> pattern>
597 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
598 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000599 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000600 let Inst{21} = 0; // W bit
601 let Inst{22} = 1; // B bit
602 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000603 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000604}
605
Evan Cheng0d14fc82008-09-01 01:51:14 +0000606// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000607class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000608 string opc, string asm, list<dag> pattern>
609 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
610 opc, asm, "", pattern>;
611class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
612 string asm, list<dag> pattern>
613 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
614 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000615
Evan Cheng840917b2008-09-01 07:00:14 +0000616// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000617class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
618 string opc, string asm, list<dag> pattern>
619 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
620 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000621 let Inst{4} = 1;
622 let Inst{5} = 1; // H bit
623 let Inst{6} = 0; // S bit
624 let Inst{7} = 1;
625 let Inst{20} = 1; // L bit
626 let Inst{21} = 0; // W bit
627 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000628 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000629}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000630class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
631 string asm, list<dag> pattern>
632 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000633 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000634 let Inst{4} = 1;
635 let Inst{5} = 1; // H bit
636 let Inst{6} = 0; // S bit
637 let Inst{7} = 1;
638 let Inst{20} = 1; // L bit
639 let Inst{21} = 0; // W bit
640 let Inst{24} = 1; // P bit
641}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000642class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
643 string opc, string asm, list<dag> pattern>
644 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
645 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000646 let Inst{4} = 1;
647 let Inst{5} = 1; // H bit
648 let Inst{6} = 1; // S bit
649 let Inst{7} = 1;
650 let Inst{20} = 1; // L bit
651 let Inst{21} = 0; // W bit
652 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000653 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000654}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000655class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
656 string asm, list<dag> pattern>
657 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000658 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000659 let Inst{4} = 1;
660 let Inst{5} = 1; // H bit
661 let Inst{6} = 1; // S bit
662 let Inst{7} = 1;
663 let Inst{20} = 1; // L bit
664 let Inst{21} = 0; // W bit
665 let Inst{24} = 1; // P bit
666}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000667class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
668 string opc, string asm, list<dag> pattern>
669 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
670 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000671 let Inst{4} = 1;
672 let Inst{5} = 0; // H bit
673 let Inst{6} = 1; // S bit
674 let Inst{7} = 1;
675 let Inst{20} = 1; // L bit
676 let Inst{21} = 0; // W bit
677 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000678 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000679}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000680class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
681 string asm, list<dag> pattern>
682 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000683 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000684 let Inst{4} = 1;
685 let Inst{5} = 0; // H bit
686 let Inst{6} = 1; // S bit
687 let Inst{7} = 1;
688 let Inst{20} = 1; // L bit
689 let Inst{21} = 0; // W bit
690 let Inst{24} = 1; // P bit
691}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000692class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
693 string opc, string asm, list<dag> pattern>
694 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
695 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000696 let Inst{4} = 1;
697 let Inst{5} = 0; // H bit
698 let Inst{6} = 1; // S bit
699 let Inst{7} = 1;
700 let Inst{20} = 0; // L bit
701 let Inst{21} = 0; // W bit
702 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000703 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000704}
705
706// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000707class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
708 string opc, string asm, list<dag> pattern>
709 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
710 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000711 let Inst{4} = 1;
712 let Inst{5} = 1; // H bit
713 let Inst{6} = 0; // S bit
714 let Inst{7} = 1;
715 let Inst{20} = 0; // L bit
716 let Inst{21} = 0; // W bit
717 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000718 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000719}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000720class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
721 string asm, list<dag> pattern>
722 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000723 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000724 let Inst{4} = 1;
725 let Inst{5} = 1; // H bit
726 let Inst{6} = 0; // S bit
727 let Inst{7} = 1;
728 let Inst{20} = 0; // L bit
729 let Inst{21} = 0; // W bit
730 let Inst{24} = 1; // P bit
731}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000732class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
733 string opc, string asm, list<dag> pattern>
734 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
735 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000736 let Inst{4} = 1;
737 let Inst{5} = 1; // H bit
738 let Inst{6} = 1; // S bit
739 let Inst{7} = 1;
740 let Inst{20} = 0; // L bit
741 let Inst{21} = 0; // W bit
742 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000743 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000744}
745
746// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000747class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
748 string opc, string asm, string cstr, list<dag> pattern>
749 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
750 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000751 let Inst{4} = 1;
752 let Inst{5} = 1; // H bit
753 let Inst{6} = 0; // S bit
754 let Inst{7} = 1;
755 let Inst{20} = 1; // L bit
756 let Inst{21} = 1; // W bit
757 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000758 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000759}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000760class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
761 string opc, string asm, string cstr, list<dag> pattern>
762 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
763 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000764 let Inst{4} = 1;
765 let Inst{5} = 1; // H bit
766 let Inst{6} = 1; // S bit
767 let Inst{7} = 1;
768 let Inst{20} = 1; // L bit
769 let Inst{21} = 1; // W bit
770 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000771 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000772}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000773class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
774 string opc, string asm, string cstr, list<dag> pattern>
775 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
776 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000777 let Inst{4} = 1;
778 let Inst{5} = 0; // H bit
779 let Inst{6} = 1; // S bit
780 let Inst{7} = 1;
781 let Inst{20} = 1; // L bit
782 let Inst{21} = 1; // W bit
783 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000784 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000785}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000786class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
787 string opc, string asm, string cstr, list<dag> pattern>
788 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
789 opc, asm, cstr, pattern> {
790 let Inst{4} = 1;
791 let Inst{5} = 0; // H bit
792 let Inst{6} = 1; // S bit
793 let Inst{7} = 1;
794 let Inst{20} = 0; // L bit
795 let Inst{21} = 1; // W bit
796 let Inst{24} = 1; // P bit
797 let Inst{27-25} = 0b000;
798}
799
Evan Cheng840917b2008-09-01 07:00:14 +0000800
801// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000802class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
803 string opc, string asm, string cstr, list<dag> pattern>
804 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
805 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000806 let Inst{4} = 1;
807 let Inst{5} = 1; // H bit
808 let Inst{6} = 0; // S bit
809 let Inst{7} = 1;
810 let Inst{20} = 0; // L bit
811 let Inst{21} = 1; // W bit
812 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000813 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000814}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000815class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
816 string opc, string asm, string cstr, list<dag> pattern>
817 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
818 opc, asm, cstr, pattern> {
819 let Inst{4} = 1;
820 let Inst{5} = 1; // H bit
821 let Inst{6} = 1; // S bit
822 let Inst{7} = 1;
823 let Inst{20} = 0; // L bit
824 let Inst{21} = 1; // W bit
825 let Inst{24} = 1; // P bit
826 let Inst{27-25} = 0b000;
827}
Evan Cheng840917b2008-09-01 07:00:14 +0000828
829// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000830class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
831 string opc, string asm, string cstr, list<dag> pattern>
832 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
833 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000834 let Inst{4} = 1;
835 let Inst{5} = 1; // H bit
836 let Inst{6} = 0; // S bit
837 let Inst{7} = 1;
838 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000839 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000840 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000841 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000842}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000843class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
844 string opc, string asm, string cstr, list<dag> pattern>
845 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
846 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000847 let Inst{4} = 1;
848 let Inst{5} = 1; // H bit
849 let Inst{6} = 1; // S bit
850 let Inst{7} = 1;
851 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000852 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000853 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000854 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000855}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000856class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
857 string opc, string asm, string cstr, list<dag> pattern>
858 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
859 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000860 let Inst{4} = 1;
861 let Inst{5} = 0; // H bit
862 let Inst{6} = 1; // S bit
863 let Inst{7} = 1;
864 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000865 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000866 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000867 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000868}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000869class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
870 string opc, string asm, string cstr, list<dag> pattern>
871 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
872 opc, asm, cstr, pattern> {
873 let Inst{4} = 1;
874 let Inst{5} = 0; // H bit
875 let Inst{6} = 1; // S bit
876 let Inst{7} = 1;
877 let Inst{20} = 0; // L bit
878 let Inst{21} = 0; // W bit
879 let Inst{24} = 0; // P bit
880 let Inst{27-25} = 0b000;
881}
Evan Cheng840917b2008-09-01 07:00:14 +0000882
883// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000884class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
885 string opc, string asm, string cstr, list<dag> pattern>
886 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
887 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000888 let Inst{4} = 1;
889 let Inst{5} = 1; // H bit
890 let Inst{6} = 0; // S bit
891 let Inst{7} = 1;
892 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000893 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000894 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000895 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000896}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000897class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
898 string opc, string asm, string cstr, list<dag> pattern>
899 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
900 opc, asm, cstr, pattern> {
901 let Inst{4} = 1;
902 let Inst{5} = 1; // H bit
903 let Inst{6} = 1; // S bit
904 let Inst{7} = 1;
905 let Inst{20} = 0; // L bit
906 let Inst{21} = 0; // W bit
907 let Inst{24} = 0; // P bit
908 let Inst{27-25} = 0b000;
909}
Evan Cheng840917b2008-09-01 07:00:14 +0000910
Evan Cheng0d14fc82008-09-01 01:51:14 +0000911// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000912class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000913 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000914 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000915 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000916 let Inst{20} = 1; // L bit
917 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000918 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000919}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000920class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000921 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000922 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000923 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000924 let Inst{20} = 0; // L bit
925 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000926 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000927}
Evan Cheng37f25d92008-08-28 23:39:26 +0000928
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000929// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000930class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
931 string opc, string asm, list<dag> pattern>
932 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
933 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000934 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000935 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000936 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000937}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000938class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
939 string opc, string asm, list<dag> pattern>
940 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
941 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000942 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000943 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000944}
945
946// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000947class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
948 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000949 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
950 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000951 bits<4> Rd;
952 bits<4> Rn;
953 bits<4> Rm;
954 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000955 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000956 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000957 let Inst{19-16} = Rd;
958 let Inst{11-8} = Rm;
959 let Inst{3-0} = Rn;
960}
961// MSW multiple w/ Ra operand
962class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
963 InstrItinClass itin, string opc, string asm, list<dag> pattern>
964 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
965 bits<4> Ra;
966 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000967}
Evan Cheng37f25d92008-08-28 23:39:26 +0000968
Evan Chengeb4f52e2008-11-06 03:35:07 +0000969// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000970class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000971 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000972 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
973 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000974 bits<4> Rn;
975 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000976 let Inst{4} = 0;
977 let Inst{7} = 1;
978 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000979 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000980 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000981 let Inst{11-8} = Rm;
982 let Inst{3-0} = Rn;
983}
984class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
985 InstrItinClass itin, string opc, string asm, list<dag> pattern>
986 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
987 bits<4> Rd;
988 let Inst{19-16} = Rd;
989}
990
991// AMulxyI with Ra operand
992class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
993 InstrItinClass itin, string opc, string asm, list<dag> pattern>
994 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
995 bits<4> Ra;
996 let Inst{15-12} = Ra;
997}
998// SMLAL*
999class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
1000 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1001 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
1002 bits<4> RdLo;
1003 bits<4> RdHi;
1004 let Inst{19-16} = RdHi;
1005 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +00001006}
1007
Evan Cheng97f48c32008-11-06 22:15:19 +00001008// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001009class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1010 string opc, string asm, list<dag> pattern>
1011 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
1012 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +00001013 // All AExtI instructions have Rd and Rm register operands.
1014 bits<4> Rd;
1015 bits<4> Rm;
1016 let Inst{15-12} = Rd;
1017 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +00001018 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +00001019 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +00001020 let Inst{27-20} = opcod;
1021}
1022
Evan Cheng8b59db32008-11-07 01:41:35 +00001023// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001024class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
1025 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001026 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1027 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001028 bits<4> Rd;
1029 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +00001030 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001031 let Inst{19-16} = 0b1111;
1032 let Inst{15-12} = Rd;
1033 let Inst{11-8} = 0b1111;
1034 let Inst{7-4} = opc7_4;
1035 let Inst{3-0} = Rm;
1036}
1037
1038// PKH instructions
1039class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
1040 string opc, string asm, list<dag> pattern>
1041 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1042 opc, asm, "", pattern> {
1043 bits<4> Rd;
1044 bits<4> Rn;
1045 bits<4> Rm;
1046 bits<8> sh;
1047 let Inst{27-20} = opcod;
1048 let Inst{19-16} = Rn;
1049 let Inst{15-12} = Rd;
1050 let Inst{11-7} = sh{7-3};
1051 let Inst{6} = tb;
1052 let Inst{5-4} = 0b01;
1053 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +00001054}
1055
Evan Cheng37f25d92008-08-28 23:39:26 +00001056//===----------------------------------------------------------------------===//
1057
1058// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
1059class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
1060 list<Predicate> Predicates = [IsARM];
1061}
1062class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
1063 list<Predicate> Predicates = [IsARM, HasV5TE];
1064}
1065class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
1066 list<Predicate> Predicates = [IsARM, HasV6];
1067}
Evan Cheng13096642008-08-29 06:41:12 +00001068
1069//===----------------------------------------------------------------------===//
1070//
1071// Thumb Instruction Format Definitions.
1072//
1073
Evan Cheng13096642008-08-29 06:41:12 +00001074// TI - Thumb instruction.
1075
Evan Cheng446c4282009-07-11 06:43:01 +00001076class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001077 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001078 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001079 let OutOperandList = oops;
1080 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001081 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +00001082 let Pattern = pattern;
1083 list<Predicate> Predicates = [IsThumb];
1084}
1085
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001086class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1087 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001088
Evan Cheng35d6c412009-08-04 23:47:55 +00001089// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +00001090class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
1091 list<dag> pattern>
1092 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
1093 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +00001094
Johnny Chend68e1192009-12-15 17:24:14 +00001095// tBL, tBX 32-bit instructions
1096class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +00001097 dag oops, dag iops, InstrItinClass itin, string asm,
1098 list<dag> pattern>
1099 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
1100 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +00001101 let Inst{31-27} = opcod1;
1102 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001103 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +00001104}
Evan Cheng13096642008-08-29 06:41:12 +00001105
1106// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +00001107class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1108 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001109 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001110
Evan Cheng09c39fc2009-06-23 19:38:13 +00001111// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +00001112class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001113 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001114 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001115 let OutOperandList = oops;
1116 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001117 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001118 let Pattern = pattern;
1119 list<Predicate> Predicates = [IsThumb1Only];
1120}
1121
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001122class T1I<dag oops, dag iops, InstrItinClass itin,
1123 string asm, list<dag> pattern>
1124 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1125class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1126 string asm, list<dag> pattern>
1127 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1128class T1JTI<dag oops, dag iops, InstrItinClass itin,
1129 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001130 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001131
1132// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001133class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001134 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001135 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001136 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001137
1138// Thumb1 instruction that can either be predicated or set CPSR.
1139class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001140 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001141 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001142 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001143 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1144 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001145 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001146 let Pattern = pattern;
1147 list<Predicate> Predicates = [IsThumb1Only];
1148}
1149
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001150class T1sI<dag oops, dag iops, InstrItinClass itin,
1151 string opc, string asm, list<dag> pattern>
1152 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001153
1154// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001155class T1sIt<dag oops, dag iops, InstrItinClass itin,
1156 string opc, string asm, list<dag> pattern>
1157 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001158 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001159
1160// Thumb1 instruction that can be predicated.
1161class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001162 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001163 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001164 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001165 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001166 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001167 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001168 let Pattern = pattern;
1169 list<Predicate> Predicates = [IsThumb1Only];
1170}
1171
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001172class T1pI<dag oops, dag iops, InstrItinClass itin,
1173 string opc, string asm, list<dag> pattern>
1174 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001175
1176// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001177class T1pIt<dag oops, dag iops, InstrItinClass itin,
1178 string opc, string asm, list<dag> pattern>
1179 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001180 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001181
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001182class T1pI1<dag oops, dag iops, InstrItinClass itin,
1183 string opc, string asm, list<dag> pattern>
1184 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1185class T1pI2<dag oops, dag iops, InstrItinClass itin,
1186 string opc, string asm, list<dag> pattern>
1187 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1188class T1pI4<dag oops, dag iops, InstrItinClass itin,
1189 string opc, string asm, list<dag> pattern>
1190 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001191class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001192 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1193 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001194
Johnny Chenbbc71b22009-12-16 02:32:54 +00001195class Encoding16 : Encoding {
1196 let Inst{31-16} = 0x0000;
1197}
1198
Johnny Chend68e1192009-12-15 17:24:14 +00001199// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001200class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001201 let Inst{15-10} = opcode;
1202}
1203
1204// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001205class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001206 let Inst{15-14} = 0b00;
1207 let Inst{13-9} = opcode;
1208}
1209
1210// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001211class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001212 let Inst{15-10} = 0b010000;
1213 let Inst{9-6} = opcode;
1214}
1215
1216// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001217class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001218 let Inst{15-10} = 0b010001;
1219 let Inst{9-6} = opcode;
1220}
1221
1222// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001223class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001224 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001225 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001226}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001227class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +00001228class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1229class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1230class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +00001231class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001232
1233// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001234class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001235 let Inst{15-12} = 0b1011;
1236 let Inst{11-5} = opcode;
1237}
1238
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001239// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1240class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001241 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001242 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001243 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001244 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001245 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001246 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001247 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001248 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001249}
1250
Bill Wendlingda2ae632010-08-31 07:50:46 +00001251// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1252// input operand since by default it's a zero register. It will become an
1253// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001254//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001255// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1256// more consistent.
1257class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001258 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001259 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001260 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001261 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001262 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001263 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001264 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001265 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001266}
1267
1268// Special cases
1269class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001270 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001271 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001272 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001273 let OutOperandList = oops;
1274 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001275 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001276 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001277 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001278}
1279
Jim Grosbachd1228742009-12-01 18:10:36 +00001280class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001281 InstrItinClass itin,
1282 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001283 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1284 let OutOperandList = oops;
1285 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001286 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001287 let Pattern = pattern;
1288 list<Predicate> Predicates = [IsThumb1Only];
1289}
1290
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001291class T2I<dag oops, dag iops, InstrItinClass itin,
1292 string opc, string asm, list<dag> pattern>
1293 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1294class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1295 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001296 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001297class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1298 string opc, string asm, list<dag> pattern>
1299 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1300class T2Iso<dag oops, dag iops, InstrItinClass itin,
1301 string opc, string asm, list<dag> pattern>
1302 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1303class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1304 string opc, string asm, list<dag> pattern>
1305 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001306class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001307 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001308 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1309 pattern> {
1310 let Inst{31-27} = 0b11101;
1311 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001312 let Inst{24} = P;
1313 let Inst{23} = ?; // The U bit.
1314 let Inst{22} = 1;
1315 let Inst{21} = W;
1316 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001317}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001318
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001319class T2sI<dag oops, dag iops, InstrItinClass itin,
1320 string opc, string asm, list<dag> pattern>
1321 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001322
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001323class T2XI<dag oops, dag iops, InstrItinClass itin,
1324 string asm, list<dag> pattern>
1325 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1326class T2JTI<dag oops, dag iops, InstrItinClass itin,
1327 string asm, list<dag> pattern>
1328 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001329
Evan Cheng5adb66a2009-09-28 09:14:39 +00001330class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001331 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001332 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1333
Bob Wilson815baeb2010-03-13 01:08:20 +00001334// Two-address instructions
1335class T2XIt<dag oops, dag iops, InstrItinClass itin,
1336 string asm, string cstr, list<dag> pattern>
1337 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001338
Evan Chenge88d5ce2009-07-02 07:28:31 +00001339// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001340class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1341 dag oops, dag iops,
1342 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001343 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001344 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001345 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001346 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001347 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001348 let Pattern = pattern;
1349 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001350 let Inst{31-27} = 0b11111;
1351 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001352 let Inst{24} = signed;
1353 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001354 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001355 let Inst{20} = load;
1356 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001357 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001358 let Inst{10} = pre; // The P bit.
1359 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001360}
1361
Johnny Chenadc77332010-02-26 22:04:29 +00001362// Helper class for disassembly only
1363// A6.3.16 & A6.3.17
1364// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1365class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1366 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1367 : T2I<oops, iops, itin, opc, asm, pattern> {
1368 let Inst{31-27} = 0b11111;
1369 let Inst{26-24} = 0b011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001370 let Inst{23} = long;
Johnny Chenadc77332010-02-26 22:04:29 +00001371 let Inst{22-20} = op22_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001372 let Inst{7-4} = op7_4;
Johnny Chenadc77332010-02-26 22:04:29 +00001373}
1374
David Goodwinc9d138f2009-07-27 19:59:26 +00001375// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1376class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1377 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1378}
1379
1380// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1381class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1382 list<Predicate> Predicates = [IsThumb1Only];
1383}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001384
Evan Cheng9cb9e672009-06-27 02:26:13 +00001385// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1386class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001387 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001388}
1389
Evan Cheng13096642008-08-29 06:41:12 +00001390//===----------------------------------------------------------------------===//
1391
Evan Cheng96581d32008-11-11 02:11:05 +00001392//===----------------------------------------------------------------------===//
1393// ARM VFP Instruction templates.
1394//
1395
David Goodwin3ca524e2009-07-10 17:03:29 +00001396// Almost all VFP instructions are predicable.
1397class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001398 IndexMode im, Format f, InstrItinClass itin,
1399 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001400 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001401 bits<4> p;
1402 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001403 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001404 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001405 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001406 let Pattern = pattern;
1407 list<Predicate> Predicates = [HasVFP2];
1408}
1409
1410// Special cases
1411class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001412 IndexMode im, Format f, InstrItinClass itin,
1413 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001414 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001415 let OutOperandList = oops;
1416 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001417 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001418 let Pattern = pattern;
1419 list<Predicate> Predicates = [HasVFP2];
1420}
1421
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001422class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1423 string opc, string asm, list<dag> pattern>
1424 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1425 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001426
Evan Chengcd8e66a2008-11-11 21:48:44 +00001427// ARM VFP addrmode5 loads and stores
1428class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001429 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001430 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001431 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001432 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001433 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001434 let Inst{27-24} = opcod1;
1435 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001436 let Inst{11-9} = 0b101;
1437 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001438
1439 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001440 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001441}
1442
Evan Chengcd8e66a2008-11-11 21:48:44 +00001443class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001444 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001445 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001446 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001447 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001448 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001449 let Inst{27-24} = opcod1;
1450 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001451 let Inst{11-9} = 0b101;
1452 let Inst{8} = 0; // Single precision
Evan Cheng96581d32008-11-11 02:11:05 +00001453}
1454
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001455// VFP Load / store multiple pseudo instructions.
1456class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1457 list<dag> pattern>
1458 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1459 cstr, itin> {
1460 let OutOperandList = oops;
1461 let InOperandList = !con(iops, (ins pred:$p));
1462 let Pattern = pattern;
1463 list<Predicate> Predicates = [HasVFP2];
1464}
1465
Evan Chengcd8e66a2008-11-11 21:48:44 +00001466// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001467class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001468 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001469 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001470 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001471 // TODO: Mark the instructions with the appropriate subtarget info.
1472 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001473 let Inst{11-9} = 0b101;
1474 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001475
1476 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001477 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001478}
1479
Jim Grosbach72db1822010-09-08 00:25:50 +00001480class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001481 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001482 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001483 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001484 // TODO: Mark the instructions with the appropriate subtarget info.
1485 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001486 let Inst{11-9} = 0b101;
1487 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001488}
1489
Evan Cheng96581d32008-11-11 02:11:05 +00001490// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001491class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1492 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1493 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001494 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001495 let Inst{27-23} = opcod1;
1496 let Inst{21-20} = opcod2;
1497 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001498 let Inst{11-9} = 0b101;
1499 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001500 let Inst{7-6} = opcod4;
1501 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001502}
1503
1504// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001505class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001506 dag iops, InstrItinClass itin, string opc, string asm,
1507 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001508 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001509 let Inst{27-23} = opcod1;
1510 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001511 let Inst{11-9} = 0b101;
1512 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001513 let Inst{6} = op6;
1514 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001515}
1516
Jim Grosbach26767372010-03-24 22:31:46 +00001517// Double precision, binary, VML[AS] (for additional predicate)
1518class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1519 dag iops, InstrItinClass itin, string opc, string asm,
1520 list<dag> pattern>
1521 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1522 let Inst{27-23} = opcod1;
1523 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001524 let Inst{11-9} = 0b101;
1525 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001526 let Inst{6} = op6;
1527 let Inst{4} = op4;
Jim Grosbach26767372010-03-24 22:31:46 +00001528 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1529}
1530
Evan Cheng96581d32008-11-11 02:11:05 +00001531// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001532class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1533 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1534 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001535 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001536 let Inst{27-23} = opcod1;
1537 let Inst{21-20} = opcod2;
1538 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001539 let Inst{11-9} = 0b101;
1540 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001541 let Inst{7-6} = opcod4;
1542 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001543}
1544
David Goodwin338268c2009-08-10 22:17:39 +00001545// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001546// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001547class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1548 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1549 string asm, list<dag> pattern>
1550 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1551 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001552 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1553}
1554
Evan Cheng96581d32008-11-11 02:11:05 +00001555// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001556class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1557 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001558 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001559 let Inst{27-23} = opcod1;
1560 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001561 let Inst{11-9} = 0b101;
1562 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001563 let Inst{6} = op6;
1564 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001565}
1566
David Goodwin338268c2009-08-10 22:17:39 +00001567// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001568// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001569class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001570 dag iops, InstrItinClass itin, string opc, string asm,
1571 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001572 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001573 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1574}
1575
Evan Cheng80a11982008-11-12 06:41:41 +00001576// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001577class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1578 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1579 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001580 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001581 let Inst{27-23} = opcod1;
1582 let Inst{21-20} = opcod2;
1583 let Inst{19-16} = opcod3;
1584 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001585 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001586 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001587}
1588
Johnny Chen811663f2010-02-11 18:47:03 +00001589// VFP conversion between floating-point and fixed-point
1590class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001591 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1592 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001593 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1594 // size (fixed-point number): sx == 0 ? 16 : 32
1595 let Inst{7} = op5; // sx
1596}
1597
David Goodwin338268c2009-08-10 22:17:39 +00001598// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001599class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001600 dag oops, dag iops, InstrItinClass itin,
1601 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001602 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1603 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001604 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1605}
1606
Evan Cheng80a11982008-11-12 06:41:41 +00001607class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001608 InstrItinClass itin,
1609 string opc, string asm, list<dag> pattern>
1610 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001611 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001612 let Inst{11-8} = opcod2;
1613 let Inst{4} = 1;
1614}
1615
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001616class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1617 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1618 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001619
Bob Wilson01135592010-03-23 17:23:59 +00001620class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001621 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1622 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001623
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001624class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1625 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1626 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001627
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001628class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1629 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1630 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001631
Evan Cheng96581d32008-11-11 02:11:05 +00001632//===----------------------------------------------------------------------===//
1633
Bob Wilson5bafff32009-06-22 23:27:02 +00001634//===----------------------------------------------------------------------===//
1635// ARM NEON Instruction templates.
1636//
Evan Cheng13096642008-08-29 06:41:12 +00001637
Johnny Chencaa608e2010-03-20 00:17:00 +00001638class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1639 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1640 list<dag> pattern>
1641 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001642 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001643 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001644 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001645 let Pattern = pattern;
1646 list<Predicate> Predicates = [HasNEON];
1647}
1648
1649// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001650class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1651 InstrItinClass itin, string opc, string asm, string cstr,
1652 list<dag> pattern>
1653 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001654 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001655 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001656 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001657 let Pattern = pattern;
1658 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001659}
1660
Bob Wilsonb07c1712009-10-07 21:53:04 +00001661class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1662 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001663 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001664 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1665 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001666 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001667 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001668 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001669 let Inst{11-8} = op11_8;
1670 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001671}
1672
Bob Wilson709d5922010-08-25 23:27:42 +00001673class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1674 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1675 itin> {
1676 let OutOperandList = oops;
1677 let InOperandList = !con(iops, (ins pred:$p));
1678 list<Predicate> Predicates = [HasNEON];
1679}
1680
Jim Grosbach7cd27292010-10-06 20:36:55 +00001681class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1682 list<dag> pattern>
Bob Wilsonbd916c52010-09-13 23:55:10 +00001683 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1684 itin> {
1685 let OutOperandList = oops;
1686 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001687 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001688 list<Predicate> Predicates = [HasNEON];
1689}
1690
Johnny Chen785516a2010-03-23 16:43:47 +00001691class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001692 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001693 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1694 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001695 let Inst{31-25} = 0b1111001;
1696}
1697
Johnny Chen927b88f2010-03-23 20:40:44 +00001698class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001699 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001700 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001701 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001702 let Inst{31-25} = 0b1111001;
1703}
1704
1705// NEON "one register and a modified immediate" format.
1706class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1707 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001708 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001709 string opc, string dt, string asm, string cstr,
1710 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001711 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001712 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001713 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001714 let Inst{11-8} = op11_8;
1715 let Inst{7} = op7;
1716 let Inst{6} = op6;
1717 let Inst{5} = op5;
1718 let Inst{4} = op4;
Owen Andersona88ea032010-10-26 17:40:54 +00001719
1720 // Instruction operands.
1721 bits<5> Vd;
1722 bits<13> SIMM;
1723
1724 let Inst{15-12} = Vd{3-0};
1725 let Inst{22} = Vd{4};
1726 let Inst{24} = SIMM{7};
1727 let Inst{18-16} = SIMM{6-4};
1728 let Inst{3-0} = SIMM{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001729}
1730
1731// NEON 2 vector register format.
1732class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1733 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001734 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001735 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001736 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001737 let Inst{24-23} = op24_23;
1738 let Inst{21-20} = op21_20;
1739 let Inst{19-18} = op19_18;
1740 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001741 let Inst{11-7} = op11_7;
1742 let Inst{6} = op6;
1743 let Inst{4} = op4;
Owen Anderson162875a2010-10-25 18:43:52 +00001744
1745 // Instruction operands.
1746 bits<5> Vd;
1747 bits<5> Vm;
1748
1749 let Inst{15-12} = Vd{3-0};
1750 let Inst{22} = Vd{4};
1751 let Inst{3-0} = Vm{3-0};
1752 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001753}
1754
1755// Same as N2V except it doesn't have a datatype suffix.
1756class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001757 bits<5> op11_7, bit op6, bit op4,
1758 dag oops, dag iops, InstrItinClass itin,
1759 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001760 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001761 let Inst{24-23} = op24_23;
1762 let Inst{21-20} = op21_20;
1763 let Inst{19-18} = op19_18;
1764 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001765 let Inst{11-7} = op11_7;
1766 let Inst{6} = op6;
1767 let Inst{4} = op4;
Owen Anderson162875a2010-10-25 18:43:52 +00001768
1769 // Instruction operands.
1770 bits<5> Vd;
1771 bits<5> Vm;
1772
1773 let Inst{15-12} = Vd{3-0};
1774 let Inst{22} = Vd{4};
1775 let Inst{3-0} = Vm{3-0};
1776 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001777}
1778
1779// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001780class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001781 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001782 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001783 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001784 let Inst{24} = op24;
1785 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001786 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001787 let Inst{7} = op7;
1788 let Inst{6} = op6;
1789 let Inst{4} = op4;
Owen Anderson3557d002010-10-26 20:56:57 +00001790
1791 // Instruction operands.
1792 bits<5> Vd;
1793 bits<5> Vm;
1794 bits<6> SIMM;
1795
1796 let Inst{15-12} = Vd{3-0};
1797 let Inst{22} = Vd{4};
1798 let Inst{3-0} = Vm{3-0};
1799 let Inst{5} = Vm{4};
1800 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001801}
1802
Bob Wilson10bc69c2010-03-27 03:56:52 +00001803// NEON 3 vector register format.
1804class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1805 dag oops, dag iops, Format f, InstrItinClass itin,
1806 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001807 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001808 let Inst{24} = op24;
1809 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001810 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001811 let Inst{11-8} = op11_8;
1812 let Inst{6} = op6;
1813 let Inst{4} = op4;
Owen Andersond451f882010-10-21 20:21:49 +00001814
1815 // Instruction operands.
1816 bits<5> Vd;
1817 bits<5> Vn;
1818 bits<5> Vm;
1819
1820 let Inst{15-12} = Vd{3-0};
1821 let Inst{22} = Vd{4};
1822 let Inst{19-16} = Vn{3-0};
1823 let Inst{7} = Vn{4};
1824 let Inst{3-0} = Vm{3-0};
1825 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001826}
1827
Johnny Chen841e8282010-03-23 21:35:03 +00001828// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001829class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1830 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001831 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001832 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001833 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001834 let Inst{24} = op24;
1835 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001836 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001837 let Inst{11-8} = op11_8;
1838 let Inst{6} = op6;
1839 let Inst{4} = op4;
Owen Anderson8c71eff2010-10-25 18:28:30 +00001840
1841 // Instruction operands.
1842 bits<5> Vd;
1843 bits<5> Vn;
1844 bits<5> Vm;
1845
1846 let Inst{15-12} = Vd{3-0};
1847 let Inst{22} = Vd{4};
1848 let Inst{19-16} = Vn{3-0};
1849 let Inst{7} = Vn{4};
1850 let Inst{3-0} = Vm{3-0};
1851 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001852}
1853
1854// NEON VMOVs between scalar and core registers.
1855class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001856 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001857 string opc, string dt, string asm, list<dag> pattern>
Evan Cheng0e9996c2010-10-26 02:03:05 +00001858 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001859 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001860 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001861 let Inst{11-8} = opcod2;
1862 let Inst{6-5} = opcod3;
1863 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001864
1865 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001866 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001867 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001868 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001869 list<Predicate> Predicates = [HasNEON];
1870}
1871class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001872 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001873 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001874 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001875 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001876class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001877 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001878 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001879 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001880 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001881class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001882 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001883 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001884 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001885 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001886
Johnny Chene4614f72010-03-25 17:01:27 +00001887// Vector Duplicate Lane (from scalar to all elements)
1888class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1889 InstrItinClass itin, string opc, string dt, string asm,
1890 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001891 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001892 let Inst{24-23} = 0b11;
1893 let Inst{21-20} = 0b11;
1894 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001895 let Inst{11-7} = 0b11000;
1896 let Inst{6} = op6;
1897 let Inst{4} = 0;
Johnny Chene4614f72010-03-25 17:01:27 +00001898}
1899
David Goodwin42a83f22009-08-04 17:53:06 +00001900// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1901// for single-precision FP.
1902class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1903 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1904}