blob: 84eca85192cdaacde8588f822d29881849d6ef2d [file] [log] [blame]
Evan Cheng37f25d92008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
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.
18class Format<bits<5> val> {
19 bits<5> Value = val;
20}
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
Jim Grosbach5278eb82009-12-11 01:42:04 +000036def LdStExFrm : Format<28>;
37
Evan Chengffa6d962008-11-13 23:36:57 +000038def ArithMiscFrm : Format<11>;
39def ExtFrm : Format<12>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000040
Evan Chengffa6d962008-11-13 23:36:57 +000041def VFPUnaryFrm : Format<13>;
42def VFPBinaryFrm : Format<14>;
43def VFPConv1Frm : Format<15>;
44def VFPConv2Frm : Format<16>;
45def VFPConv3Frm : Format<17>;
46def VFPConv4Frm : Format<18>;
47def VFPConv5Frm : Format<19>;
48def VFPLdStFrm : Format<20>;
49def VFPLdStMulFrm : Format<21>;
50def VFPMiscFrm : Format<22>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000051
Evan Chengffa6d962008-11-13 23:36:57 +000052def ThumbFrm : Format<23>;
Evan Cheng37f25d92008-08-28 23:39:26 +000053
Bob Wilson5bafff32009-06-22 23:27:02 +000054def NEONFrm : Format<24>;
55def NEONGetLnFrm : Format<25>;
56def NEONSetLnFrm : Format<26>;
57def NEONDupFrm : Format<27>;
58
Johnny Chenf4d81052010-02-12 22:53:19 +000059def MiscFrm : Format<29>;
60def ThumbMiscFrm : Format<30>;
61
Evan Cheng34a0fa32009-07-08 01:46:35 +000062// Misc flags.
63
Evan Chengedda31c2008-11-05 18:35:52 +000064// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000065// UnaryDP - Indicates this is a unary data processing instruction, i.e.
66// it doesn't have a Rn operand.
67class UnaryDP { bit isUnaryDataProc = 1; }
68
69// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
70// a 16-bit Thumb instruction if certain conditions are met.
71class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000072
Evan Cheng37f25d92008-08-28 23:39:26 +000073//===----------------------------------------------------------------------===//
Evan Cheng055b0312009-06-29 07:51:04 +000074// ARM Instruction flags. These need to match ARMInstrInfo.h.
75//
76
77// Addressing mode.
78class AddrMode<bits<4> val> {
79 bits<4> Value = val;
80}
81def AddrModeNone : AddrMode<0>;
82def AddrMode1 : AddrMode<1>;
83def AddrMode2 : AddrMode<2>;
84def AddrMode3 : AddrMode<3>;
85def AddrMode4 : AddrMode<4>;
86def AddrMode5 : AddrMode<5>;
Bob Wilson8b024a52009-07-01 23:16:05 +000087def AddrMode6 : AddrMode<6>;
88def AddrModeT1_1 : AddrMode<7>;
89def AddrModeT1_2 : AddrMode<8>;
90def AddrModeT1_4 : AddrMode<9>;
91def AddrModeT1_s : AddrMode<10>;
David Goodwine1e52ed2009-07-22 22:24:31 +000092def AddrModeT2_i12: AddrMode<11>;
Bob Wilson8b024a52009-07-01 23:16:05 +000093def AddrModeT2_i8 : AddrMode<12>;
94def AddrModeT2_so : AddrMode<13>;
95def AddrModeT2_pc : AddrMode<14>;
96def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng055b0312009-06-29 07:51:04 +000097
98// Instruction size.
99class SizeFlagVal<bits<3> val> {
100 bits<3> Value = val;
101}
102def SizeInvalid : SizeFlagVal<0>; // Unset.
103def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
104def Size8Bytes : SizeFlagVal<2>;
105def Size4Bytes : SizeFlagVal<3>;
106def Size2Bytes : SizeFlagVal<4>;
107
108// Load / store index mode.
109class IndexMode<bits<2> val> {
110 bits<2> Value = val;
111}
112def IndexModeNone : IndexMode<0>;
113def IndexModePre : IndexMode<1>;
114def IndexModePost : IndexMode<2>;
115
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000116// Instruction execution domain.
117class Domain<bits<2> val> {
118 bits<2> Value = val;
119}
120def GenericDomain : Domain<0>;
121def VFPDomain : Domain<1>; // Instructions in VFP domain only
122def NeonDomain : Domain<2>; // Instructions in Neon domain only
123def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
124
Evan Cheng055b0312009-06-29 07:51:04 +0000125//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000126
Evan Cheng446c4282009-07-11 06:43:01 +0000127// ARM special operands.
128//
129
130// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
131// register whose default is 0 (no register).
132def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
133 (ops (i32 14), (i32 zero_reg))> {
134 let PrintMethod = "printPredicateOperand";
135}
136
137// Conditional code result for instructions whose 's' bit is set, e.g. subs.
138def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
139 let PrintMethod = "printSBitModifierOperand";
140}
141
142// Same as cc_out except it defaults to setting CPSR.
143def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
144 let PrintMethod = "printSBitModifierOperand";
145}
146
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000147// ARM special operands for disassembly only.
148//
149
150def cps_opt : Operand<i32> {
151 let PrintMethod = "printCPSOptionOperand";
152}
153
154def msr_mask : Operand<i32> {
155 let PrintMethod = "printMSRMaskOperand";
156}
157
158// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
159// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
160def neg_zero : Operand<i32> {
161 let PrintMethod = "printNegZeroOperand";
162}
163
Evan Cheng446c4282009-07-11 06:43:01 +0000164//===----------------------------------------------------------------------===//
165
Evan Cheng37f25d92008-08-28 23:39:26 +0000166// ARM Instruction templates.
167//
168
Johnny Chend68e1192009-12-15 17:24:14 +0000169class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
170 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000171 : Instruction {
172 let Namespace = "ARM";
173
Evan Chengedda31c2008-11-05 18:35:52 +0000174 // TSFlagsFields
Evan Cheng37f25d92008-08-28 23:39:26 +0000175 AddrMode AM = am;
176 bits<4> AddrModeBits = AM.Value;
177
178 SizeFlagVal SZ = sz;
179 bits<3> SizeFlag = SZ.Value;
180
181 IndexMode IM = im;
182 bits<2> IndexModeBits = IM.Value;
183
184 Format F = f;
185 bits<5> Form = F.Value;
Evan Chengedda31c2008-11-05 18:35:52 +0000186
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000187 Domain D = d;
188 bits<2> Dom = D.Value;
189
Evan Chengedda31c2008-11-05 18:35:52 +0000190 //
191 // Attributes specific to ARM instructions...
192 //
193 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000194 bit canXformTo16Bit = 0;
Evan Cheng37f25d92008-08-28 23:39:26 +0000195
196 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000197 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000198}
199
Johnny Chend68e1192009-12-15 17:24:14 +0000200class Encoding {
201 field bits<32> Inst;
202}
203
204class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
205 Format f, Domain d, string cstr, InstrItinClass itin>
206 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
207
208// This Encoding-less class is used by Thumb1 to specify the encoding bits later
209// on by adding flavors to specific instructions.
210class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
211 Format f, Domain d, string cstr, InstrItinClass itin>
212 : InstTemplate<am, sz, im, f, d, cstr, itin>;
213
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000214class PseudoInst<dag oops, dag iops, InstrItinClass itin,
215 string asm, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000216 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
217 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000218 let OutOperandList = oops;
219 let InOperandList = iops;
220 let AsmString = asm;
221 let Pattern = pattern;
222}
223
224// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000225class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000226 IndexMode im, Format f, InstrItinClass itin,
227 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000228 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000229 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000230 let OutOperandList = oops;
231 let InOperandList = !con(iops, (ops pred:$p));
232 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
233 let Pattern = pattern;
234 list<Predicate> Predicates = [IsARM];
235}
Jim Grosbachf6b28622009-12-14 18:31:20 +0000236// A few are not predicable
237class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
238 IndexMode im, Format f, InstrItinClass itin,
239 string opc, string asm, string cstr,
240 list<dag> pattern>
241 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
242 let OutOperandList = oops;
243 let InOperandList = iops;
244 let AsmString = !strconcat(opc, asm);
245 let Pattern = pattern;
246 let isPredicable = 0;
247 list<Predicate> Predicates = [IsARM];
248}
Evan Cheng37f25d92008-08-28 23:39:26 +0000249
250// Same as I except it can optionally modify CPSR. Note it's modeled as
251// an input operand since by default it's a zero register. It will
252// become an implicit def once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000253class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000254 IndexMode im, Format f, InstrItinClass itin,
255 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000256 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000257 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000258 let OutOperandList = oops;
259 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
260 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
261 let Pattern = pattern;
262 list<Predicate> Predicates = [IsARM];
263}
264
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000265// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000266class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000267 IndexMode im, Format f, InstrItinClass itin,
268 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000269 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000270 let OutOperandList = oops;
271 let InOperandList = iops;
272 let AsmString = asm;
273 let Pattern = pattern;
274 list<Predicate> Predicates = [IsARM];
275}
276
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000277class AI<dag oops, dag iops, Format f, InstrItinClass itin,
278 string opc, string asm, list<dag> pattern>
279 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
280 opc, asm, "", pattern>;
281class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
282 string opc, string asm, list<dag> pattern>
283 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
284 opc, asm, "", pattern>;
285class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000286 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000287 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000288 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000289class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
290 string opc, string asm, list<dag> pattern>
291 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
292 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000293
294// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000295class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
296 string opc, string asm, list<dag> pattern>
297 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
298 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000299 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000300}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000301class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
302 string asm, list<dag> pattern>
303 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
304 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000305 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000306}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000307class ABXIx2<dag oops, dag iops, InstrItinClass itin,
308 string asm, list<dag> pattern>
309 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
310 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000311
312// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000313class JTI<dag oops, dag iops, InstrItinClass itin,
314 string asm, list<dag> pattern>
315 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000316 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000317
Jim Grosbach5278eb82009-12-11 01:42:04 +0000318
319// Atomic load/store instructions
320
321class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
322 string opc, string asm, list<dag> pattern>
323 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
324 opc, asm, "", pattern> {
325 let Inst{27-23} = 0b00011;
326 let Inst{22-21} = opcod;
327 let Inst{20} = 1;
328 let Inst{11-0} = 0b111110011111;
329}
330class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
331 string opc, string asm, list<dag> pattern>
332 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
333 opc, asm, "", pattern> {
334 let Inst{27-23} = 0b00011;
335 let Inst{22-21} = opcod;
336 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000337 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000338}
339
Evan Cheng0d14fc82008-09-01 01:51:14 +0000340// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000341class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
342 string opc, string asm, list<dag> pattern>
343 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
344 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000345 let Inst{24-21} = opcod;
346 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000347}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000348class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
349 string opc, string asm, list<dag> pattern>
350 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
351 opc, asm, "", pattern> {
352 let Inst{24-21} = opcod;
353 let Inst{27-26} = {0,0};
354}
355class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000356 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000357 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000358 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000359 let Inst{24-21} = opcod;
360 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000361}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000362class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
363 string opc, string asm, list<dag> pattern>
364 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
365 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000366
Evan Cheng0d14fc82008-09-01 01:51:14 +0000367
368// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000369class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
370 string opc, string asm, list<dag> pattern>
371 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
372 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000373 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000374}
Evan Cheng93912732008-09-01 01:27:33 +0000375
376// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000377class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
378 string opc, string asm, list<dag> pattern>
379 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
380 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000381 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000382 let Inst{21} = 0; // W bit
383 let Inst{22} = 0; // B bit
384 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000385 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000386}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000387class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
388 string asm, list<dag> pattern>
389 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000390 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000391 let Inst{20} = 1; // L bit
392 let Inst{21} = 0; // W bit
393 let Inst{22} = 0; // B bit
394 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000395 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000396}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000397class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
398 string opc, string asm, list<dag> pattern>
399 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
400 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000401 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000402 let Inst{21} = 0; // W bit
403 let Inst{22} = 1; // B bit
404 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000405 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000406}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000407class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
408 string asm, list<dag> pattern>
409 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000410 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000411 let Inst{20} = 1; // L bit
412 let Inst{21} = 0; // W bit
413 let Inst{22} = 1; // B bit
414 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000415 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000416}
Evan Cheng17222df2008-08-31 19:02:21 +0000417
Evan Cheng93912732008-09-01 01:27:33 +0000418// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000419class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
420 string opc, string asm, list<dag> pattern>
421 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
422 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000423 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000424 let Inst{21} = 0; // W bit
425 let Inst{22} = 0; // B bit
426 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000427 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000428}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000429class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
430 string asm, list<dag> pattern>
431 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000432 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000433 let Inst{20} = 0; // L bit
434 let Inst{21} = 0; // W bit
435 let Inst{22} = 0; // B bit
436 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000437 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000438}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000439class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
440 string opc, string asm, list<dag> pattern>
441 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
442 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000443 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000444 let Inst{21} = 0; // W bit
445 let Inst{22} = 1; // B bit
446 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000447 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000448}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000449class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
450 string asm, list<dag> pattern>
451 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000452 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000453 let Inst{20} = 0; // L bit
454 let Inst{21} = 0; // W bit
455 let Inst{22} = 1; // B bit
456 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000457 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000458}
Evan Cheng93912732008-09-01 01:27:33 +0000459
Evan Cheng840917b2008-09-01 07:00:14 +0000460// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000461class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
462 string opc, string asm, string cstr, list<dag> pattern>
463 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
464 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000465 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000466 let Inst{21} = 1; // W bit
467 let Inst{22} = 0; // B bit
468 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000469 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000470}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000471class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
472 string opc, string asm, string cstr, list<dag> pattern>
473 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
474 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000475 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000476 let Inst{21} = 1; // W bit
477 let Inst{22} = 1; // B bit
478 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000479 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000480}
481
Evan Cheng840917b2008-09-01 07:00:14 +0000482// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000483class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
484 string opc, string asm, string cstr, list<dag> pattern>
485 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
486 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000487 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000488 let Inst{21} = 1; // W bit
489 let Inst{22} = 0; // B bit
490 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000491 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000492}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000493class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
494 string opc, string asm, string cstr, list<dag> pattern>
495 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
496 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000497 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000498 let Inst{21} = 1; // W bit
499 let Inst{22} = 1; // B bit
500 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000501 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000502}
503
Evan Cheng840917b2008-09-01 07:00:14 +0000504// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000505class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
506 string opc, string asm, string cstr, list<dag> pattern>
507 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
508 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000509 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000510 let Inst{21} = 0; // W bit
511 let Inst{22} = 0; // B bit
512 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000513 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000514}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000515class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
516 string opc, string asm, string cstr, list<dag> pattern>
517 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
518 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000519 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000520 let Inst{21} = 0; // W bit
521 let Inst{22} = 1; // B bit
522 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000523 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000524}
525
Evan Cheng840917b2008-09-01 07:00:14 +0000526// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000527class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
528 string opc, string asm, string cstr, list<dag> pattern>
529 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
530 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000531 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000532 let Inst{21} = 0; // W bit
533 let Inst{22} = 0; // B bit
534 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000535 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000536}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000537class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
538 string opc, string asm, string cstr, list<dag> pattern>
539 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
540 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000541 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000542 let Inst{21} = 0; // W bit
543 let Inst{22} = 1; // B bit
544 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000545 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000546}
547
Evan Cheng0d14fc82008-09-01 01:51:14 +0000548// addrmode3 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000549class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
550 string opc, string asm, list<dag> pattern>
551 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
552 opc, asm, "", pattern>;
553class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
554 string asm, list<dag> pattern>
555 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
556 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000557
Evan Cheng840917b2008-09-01 07:00:14 +0000558// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000559class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
560 string opc, string asm, list<dag> pattern>
561 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
562 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000563 let Inst{4} = 1;
564 let Inst{5} = 1; // H bit
565 let Inst{6} = 0; // S bit
566 let Inst{7} = 1;
567 let Inst{20} = 1; // L bit
568 let Inst{21} = 0; // W bit
569 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000570 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000571}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000572class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
573 string asm, list<dag> pattern>
574 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000575 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000576 let Inst{4} = 1;
577 let Inst{5} = 1; // H bit
578 let Inst{6} = 0; // S bit
579 let Inst{7} = 1;
580 let Inst{20} = 1; // L bit
581 let Inst{21} = 0; // W bit
582 let Inst{24} = 1; // P bit
583}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000584class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
585 string opc, string asm, list<dag> pattern>
586 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
587 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000588 let Inst{4} = 1;
589 let Inst{5} = 1; // H bit
590 let Inst{6} = 1; // S bit
591 let Inst{7} = 1;
592 let Inst{20} = 1; // L bit
593 let Inst{21} = 0; // W bit
594 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000595 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000596}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000597class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
598 string asm, list<dag> pattern>
599 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000600 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000601 let Inst{4} = 1;
602 let Inst{5} = 1; // H bit
603 let Inst{6} = 1; // S bit
604 let Inst{7} = 1;
605 let Inst{20} = 1; // L bit
606 let Inst{21} = 0; // W bit
607 let Inst{24} = 1; // P bit
608}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000609class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
610 string opc, string asm, list<dag> pattern>
611 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
612 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000613 let Inst{4} = 1;
614 let Inst{5} = 0; // H bit
615 let Inst{6} = 1; // S bit
616 let Inst{7} = 1;
617 let Inst{20} = 1; // L bit
618 let Inst{21} = 0; // W bit
619 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000620 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000621}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000622class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
623 string asm, list<dag> pattern>
624 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000625 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000626 let Inst{4} = 1;
627 let Inst{5} = 0; // H bit
628 let Inst{6} = 1; // S bit
629 let Inst{7} = 1;
630 let Inst{20} = 1; // L bit
631 let Inst{21} = 0; // W bit
632 let Inst{24} = 1; // P bit
633}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000634class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
635 string opc, string asm, list<dag> pattern>
636 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
637 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000638 let Inst{4} = 1;
639 let Inst{5} = 0; // H bit
640 let Inst{6} = 1; // S bit
641 let Inst{7} = 1;
642 let Inst{20} = 0; // L bit
643 let Inst{21} = 0; // W bit
644 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000645 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000646}
647
648// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000649class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
650 string opc, string asm, list<dag> pattern>
651 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
652 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000653 let Inst{4} = 1;
654 let Inst{5} = 1; // H bit
655 let Inst{6} = 0; // S bit
656 let Inst{7} = 1;
657 let Inst{20} = 0; // L bit
658 let Inst{21} = 0; // W bit
659 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000660 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000661}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000662class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
663 string asm, list<dag> pattern>
664 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000665 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000666 let Inst{4} = 1;
667 let Inst{5} = 1; // H bit
668 let Inst{6} = 0; // S bit
669 let Inst{7} = 1;
670 let Inst{20} = 0; // L bit
671 let Inst{21} = 0; // W bit
672 let Inst{24} = 1; // P bit
673}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000674class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
675 string opc, string asm, list<dag> pattern>
676 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
677 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000678 let Inst{4} = 1;
679 let Inst{5} = 1; // H bit
680 let Inst{6} = 1; // S bit
681 let Inst{7} = 1;
682 let Inst{20} = 0; // L bit
683 let Inst{21} = 0; // W bit
684 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000685 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000686}
687
688// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000689class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
690 string opc, string asm, string cstr, list<dag> pattern>
691 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
692 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000693 let Inst{4} = 1;
694 let Inst{5} = 1; // H bit
695 let Inst{6} = 0; // S bit
696 let Inst{7} = 1;
697 let Inst{20} = 1; // L bit
698 let Inst{21} = 1; // W bit
699 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000700 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000701}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000702class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
703 string opc, string asm, string cstr, list<dag> pattern>
704 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
705 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000706 let Inst{4} = 1;
707 let Inst{5} = 1; // H bit
708 let Inst{6} = 1; // S bit
709 let Inst{7} = 1;
710 let Inst{20} = 1; // L bit
711 let Inst{21} = 1; // W bit
712 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000713 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000714}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000715class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
716 string opc, string asm, string cstr, list<dag> pattern>
717 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
718 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000719 let Inst{4} = 1;
720 let Inst{5} = 0; // H bit
721 let Inst{6} = 1; // S bit
722 let Inst{7} = 1;
723 let Inst{20} = 1; // L bit
724 let Inst{21} = 1; // W bit
725 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000726 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000727}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000728class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
729 string opc, string asm, string cstr, list<dag> pattern>
730 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
731 opc, asm, cstr, pattern> {
732 let Inst{4} = 1;
733 let Inst{5} = 0; // H bit
734 let Inst{6} = 1; // S bit
735 let Inst{7} = 1;
736 let Inst{20} = 0; // L bit
737 let Inst{21} = 1; // W bit
738 let Inst{24} = 1; // P bit
739 let Inst{27-25} = 0b000;
740}
741
Evan Cheng840917b2008-09-01 07:00:14 +0000742
743// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000744class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
745 string opc, string asm, string cstr, list<dag> pattern>
746 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
747 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000748 let Inst{4} = 1;
749 let Inst{5} = 1; // H bit
750 let Inst{6} = 0; // S bit
751 let Inst{7} = 1;
752 let Inst{20} = 0; // L bit
753 let Inst{21} = 1; // W bit
754 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000755 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000756}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000757class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
758 string opc, string asm, string cstr, list<dag> pattern>
759 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
760 opc, asm, cstr, pattern> {
761 let Inst{4} = 1;
762 let Inst{5} = 1; // H bit
763 let Inst{6} = 1; // S bit
764 let Inst{7} = 1;
765 let Inst{20} = 0; // L bit
766 let Inst{21} = 1; // W bit
767 let Inst{24} = 1; // P bit
768 let Inst{27-25} = 0b000;
769}
Evan Cheng840917b2008-09-01 07:00:14 +0000770
771// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000772class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
773 string opc, string asm, string cstr, list<dag> pattern>
774 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
775 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000776 let Inst{4} = 1;
777 let Inst{5} = 1; // H bit
778 let Inst{6} = 0; // S bit
779 let Inst{7} = 1;
780 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000781 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000782 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000783 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000784}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000785class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
786 string opc, string asm, string cstr, list<dag> pattern>
787 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
788 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000789 let Inst{4} = 1;
790 let Inst{5} = 1; // H bit
791 let Inst{6} = 1; // S bit
792 let Inst{7} = 1;
793 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000794 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000795 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000796 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000797}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000798class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
799 string opc, string asm, string cstr, list<dag> pattern>
800 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
801 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000802 let Inst{4} = 1;
803 let Inst{5} = 0; // H bit
804 let Inst{6} = 1; // S bit
805 let Inst{7} = 1;
806 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000807 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000808 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000809 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000810}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000811class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
812 string opc, string asm, string cstr, list<dag> pattern>
813 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
814 opc, asm, cstr, pattern> {
815 let Inst{4} = 1;
816 let Inst{5} = 0; // H bit
817 let Inst{6} = 1; // S bit
818 let Inst{7} = 1;
819 let Inst{20} = 0; // L bit
820 let Inst{21} = 0; // W bit
821 let Inst{24} = 0; // P bit
822 let Inst{27-25} = 0b000;
823}
Evan Cheng840917b2008-09-01 07:00:14 +0000824
825// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000826class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
827 string opc, string asm, string cstr, list<dag> pattern>
828 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
829 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000830 let Inst{4} = 1;
831 let Inst{5} = 1; // H bit
832 let Inst{6} = 0; // S bit
833 let Inst{7} = 1;
834 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000835 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000836 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000837 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000838}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000839class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
840 string opc, string asm, string cstr, list<dag> pattern>
841 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
842 opc, asm, cstr, pattern> {
843 let Inst{4} = 1;
844 let Inst{5} = 1; // H bit
845 let Inst{6} = 1; // S bit
846 let Inst{7} = 1;
847 let Inst{20} = 0; // L bit
848 let Inst{21} = 0; // W bit
849 let Inst{24} = 0; // P bit
850 let Inst{27-25} = 0b000;
851}
Evan Cheng840917b2008-09-01 07:00:14 +0000852
853
Evan Cheng0d14fc82008-09-01 01:51:14 +0000854// addrmode4 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000855class AXI4ld<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000856 string asm, string cstr, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000857 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000858 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000859 let Inst{20} = 1; // L bit
860 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000861 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000862}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000863class AXI4st<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000864 string asm, string cstr, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000865 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000866 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000867 let Inst{20} = 0; // L bit
868 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000869 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000870}
Evan Cheng37f25d92008-08-28 23:39:26 +0000871
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000872// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000873class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
874 string opc, string asm, list<dag> pattern>
875 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
876 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000877 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000878 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000879 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000880}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000881class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
882 string opc, string asm, list<dag> pattern>
883 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
884 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000885 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000886 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000887}
888
889// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000890class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
891 string opc, string asm, list<dag> pattern>
892 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
893 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000894 let Inst{7-4} = 0b1001;
895 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000896 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000897}
Evan Cheng37f25d92008-08-28 23:39:26 +0000898
Evan Chengeb4f52e2008-11-06 03:35:07 +0000899// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000900class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
901 string opc, string asm, list<dag> pattern>
902 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
903 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000904 let Inst{4} = 0;
905 let Inst{7} = 1;
906 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000907 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000908}
909
Evan Cheng97f48c32008-11-06 22:15:19 +0000910// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000911class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
912 string opc, string asm, list<dag> pattern>
913 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
914 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000915 let Inst{7-4} = 0b0111;
916 let Inst{27-20} = opcod;
917}
918
Evan Cheng8b59db32008-11-07 01:41:35 +0000919// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000920class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
921 string opc, string asm, list<dag> pattern>
922 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
923 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000924 let Inst{27-20} = opcod;
925}
926
Evan Cheng37f25d92008-08-28 23:39:26 +0000927//===----------------------------------------------------------------------===//
928
929// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
930class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
931 list<Predicate> Predicates = [IsARM];
932}
933class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
934 list<Predicate> Predicates = [IsARM, HasV5TE];
935}
936class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
937 list<Predicate> Predicates = [IsARM, HasV6];
938}
Evan Cheng13096642008-08-29 06:41:12 +0000939
940//===----------------------------------------------------------------------===//
941//
942// Thumb Instruction Format Definitions.
943//
944
Evan Cheng13096642008-08-29 06:41:12 +0000945// TI - Thumb instruction.
946
Evan Cheng446c4282009-07-11 06:43:01 +0000947class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000948 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000949 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000950 let OutOperandList = oops;
951 let InOperandList = iops;
Evan Cheng13096642008-08-29 06:41:12 +0000952 let AsmString = asm;
953 let Pattern = pattern;
954 list<Predicate> Predicates = [IsThumb];
955}
956
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000957class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
958 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000959
Evan Cheng35d6c412009-08-04 23:47:55 +0000960// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000961class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
962 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000963
Johnny Chend68e1192009-12-15 17:24:14 +0000964// tBL, tBX 32-bit instructions
965class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
966 dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
967 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>, Encoding {
968 let Inst{31-27} = opcod1;
969 let Inst{15-14} = opcod2;
970 let Inst{12} = opcod3;
971}
Evan Cheng13096642008-08-29 06:41:12 +0000972
973// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000974class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
975 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000976
Evan Cheng09c39fc2009-06-23 19:38:13 +0000977// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000978class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000979 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000980 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000981 let OutOperandList = oops;
982 let InOperandList = iops;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000983 let AsmString = asm;
984 let Pattern = pattern;
985 list<Predicate> Predicates = [IsThumb1Only];
986}
987
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000988class T1I<dag oops, dag iops, InstrItinClass itin,
989 string asm, list<dag> pattern>
990 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
991class T1Ix2<dag oops, dag iops, InstrItinClass itin,
992 string asm, list<dag> pattern>
993 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
994class T1JTI<dag oops, dag iops, InstrItinClass itin,
995 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +0000996 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000997
998// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000999class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001000 string asm, string cstr, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001001 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001002 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001003
1004// Thumb1 instruction that can either be predicated or set CPSR.
1005class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001006 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001007 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001008 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001009 let OutOperandList = !con(oops, (ops s_cc_out:$s));
1010 let InOperandList = !con(iops, (ops pred:$p));
1011 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1012 let Pattern = pattern;
1013 list<Predicate> Predicates = [IsThumb1Only];
1014}
1015
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001016class T1sI<dag oops, dag iops, InstrItinClass itin,
1017 string opc, string asm, list<dag> pattern>
1018 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001019
1020// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001021class T1sIt<dag oops, dag iops, InstrItinClass itin,
1022 string opc, string asm, list<dag> pattern>
1023 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001024 "$lhs = $dst", pattern>;
1025
1026// Thumb1 instruction that can be predicated.
1027class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001028 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001029 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001030 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001031 let OutOperandList = oops;
1032 let InOperandList = !con(iops, (ops pred:$p));
1033 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1034 let Pattern = pattern;
1035 list<Predicate> Predicates = [IsThumb1Only];
1036}
1037
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001038class T1pI<dag oops, dag iops, InstrItinClass itin,
1039 string opc, string asm, list<dag> pattern>
1040 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001041
1042// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001043class T1pIt<dag oops, dag iops, InstrItinClass itin,
1044 string opc, string asm, list<dag> pattern>
1045 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001046 "$lhs = $dst", pattern>;
1047
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001048class T1pI1<dag oops, dag iops, InstrItinClass itin,
1049 string opc, string asm, list<dag> pattern>
1050 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1051class T1pI2<dag oops, dag iops, InstrItinClass itin,
1052 string opc, string asm, list<dag> pattern>
1053 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1054class T1pI4<dag oops, dag iops, InstrItinClass itin,
1055 string opc, string asm, list<dag> pattern>
1056 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1057class T1pIs<dag oops, dag iops,
1058 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1059 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001060
Johnny Chenbbc71b22009-12-16 02:32:54 +00001061class Encoding16 : Encoding {
1062 let Inst{31-16} = 0x0000;
1063}
1064
Johnny Chend68e1192009-12-15 17:24:14 +00001065// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001066class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001067 let Inst{15-10} = opcode;
1068}
1069
1070// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001071class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001072 let Inst{15-14} = 0b00;
1073 let Inst{13-9} = opcode;
1074}
1075
1076// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001077class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001078 let Inst{15-10} = 0b010000;
1079 let Inst{9-6} = opcode;
1080}
1081
1082// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001083class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001084 let Inst{15-10} = 0b010001;
1085 let Inst{9-6} = opcode;
1086}
1087
1088// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001089class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001090 let Inst{15-12} = opA;
1091 let Inst{11-9} = opB;
1092}
1093class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1094class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1095class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1096class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1097class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1098
1099// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001100class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001101 let Inst{15-12} = 0b1011;
1102 let Inst{11-5} = opcode;
1103}
1104
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001105// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1106class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001107 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001108 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001109 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001110 let OutOperandList = oops;
1111 let InOperandList = !con(iops, (ops pred:$p));
1112 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1113 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001114 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001115}
1116
1117// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1118// an input operand since by default it's a zero register. It will
1119// become an implicit def once it's "flipped".
1120// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1121// more consistent.
1122class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001123 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001124 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001125 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001126 let OutOperandList = oops;
1127 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
1128 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1129 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001130 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001131}
1132
1133// Special cases
1134class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001135 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001136 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001137 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001138 let OutOperandList = oops;
1139 let InOperandList = iops;
Evan Chengf49810c2009-06-23 17:48:47 +00001140 let AsmString = asm;
1141 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001142 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001143}
1144
Jim Grosbachd1228742009-12-01 18:10:36 +00001145class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1146 InstrItinClass itin,
1147 string asm, string cstr, list<dag> pattern>
1148 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1149 let OutOperandList = oops;
1150 let InOperandList = iops;
1151 let AsmString = asm;
1152 let Pattern = pattern;
1153 list<Predicate> Predicates = [IsThumb1Only];
1154}
1155
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001156class T2I<dag oops, dag iops, InstrItinClass itin,
1157 string opc, string asm, list<dag> pattern>
1158 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1159class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1160 string opc, string asm, list<dag> pattern>
1161 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
1162class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1163 string opc, string asm, list<dag> pattern>
1164 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1165class T2Iso<dag oops, dag iops, InstrItinClass itin,
1166 string opc, string asm, list<dag> pattern>
1167 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1168class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1169 string opc, string asm, list<dag> pattern>
1170 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001171class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001172 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001173 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1174 pattern> {
1175 let Inst{31-27} = 0b11101;
1176 let Inst{26-25} = 0b00;
1177 let Inst{24} = P;
1178 let Inst{23} = ?; // The U bit.
1179 let Inst{22} = 1;
1180 let Inst{21} = W;
1181 let Inst{20} = load;
1182}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001183
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001184class T2sI<dag oops, dag iops, InstrItinClass itin,
1185 string opc, string asm, list<dag> pattern>
1186 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001187
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001188class T2XI<dag oops, dag iops, InstrItinClass itin,
1189 string asm, list<dag> pattern>
1190 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1191class T2JTI<dag oops, dag iops, InstrItinClass itin,
1192 string asm, list<dag> pattern>
1193 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001194
Evan Cheng5adb66a2009-09-28 09:14:39 +00001195class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1196 string opc, string asm, list<dag> pattern>
1197 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1198
Bob Wilson815baeb2010-03-13 01:08:20 +00001199// Two-address instructions
1200class T2XIt<dag oops, dag iops, InstrItinClass itin,
1201 string asm, string cstr, list<dag> pattern>
1202 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001203
Evan Chenge88d5ce2009-07-02 07:28:31 +00001204// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001205class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1206 dag oops, dag iops,
1207 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001208 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001209 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001210 let OutOperandList = oops;
1211 let InOperandList = !con(iops, (ops pred:$p));
1212 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1213 let Pattern = pattern;
1214 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001215 let Inst{31-27} = 0b11111;
1216 let Inst{26-25} = 0b00;
1217 let Inst{24} = signed;
1218 let Inst{23} = 0;
1219 let Inst{22-21} = opcod;
1220 let Inst{20} = load;
1221 let Inst{11} = 1;
1222 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1223 let Inst{10} = pre; // The P bit.
1224 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001225}
1226
Johnny Chenadc77332010-02-26 22:04:29 +00001227// Helper class for disassembly only
1228// A6.3.16 & A6.3.17
1229// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1230class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1231 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1232 : T2I<oops, iops, itin, opc, asm, pattern> {
1233 let Inst{31-27} = 0b11111;
1234 let Inst{26-24} = 0b011;
1235 let Inst{23} = long;
1236 let Inst{22-20} = op22_20;
1237 let Inst{7-4} = op7_4;
1238}
1239
David Goodwinc9d138f2009-07-27 19:59:26 +00001240// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1241class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1242 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1243}
1244
1245// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1246class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1247 list<Predicate> Predicates = [IsThumb1Only];
1248}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001249
Evan Cheng9cb9e672009-06-27 02:26:13 +00001250// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1251class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001252 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001253}
1254
Evan Cheng13096642008-08-29 06:41:12 +00001255//===----------------------------------------------------------------------===//
1256
Evan Cheng96581d32008-11-11 02:11:05 +00001257//===----------------------------------------------------------------------===//
1258// ARM VFP Instruction templates.
1259//
1260
David Goodwin3ca524e2009-07-10 17:03:29 +00001261// Almost all VFP instructions are predicable.
1262class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001263 IndexMode im, Format f, InstrItinClass itin,
1264 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001265 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001266 let OutOperandList = oops;
1267 let InOperandList = !con(iops, (ops pred:$p));
1268 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1269 let Pattern = pattern;
1270 list<Predicate> Predicates = [HasVFP2];
1271}
1272
1273// Special cases
1274class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001275 IndexMode im, Format f, InstrItinClass itin,
1276 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001277 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001278 let OutOperandList = oops;
1279 let InOperandList = iops;
1280 let AsmString = asm;
1281 let Pattern = pattern;
1282 list<Predicate> Predicates = [HasVFP2];
1283}
1284
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001285class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1286 string opc, string asm, list<dag> pattern>
1287 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1288 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001289
Evan Chengcd8e66a2008-11-11 21:48:44 +00001290// ARM VFP addrmode5 loads and stores
1291class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001292 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001293 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001294 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001295 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001296 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001297 let Inst{27-24} = opcod1;
1298 let Inst{21-20} = opcod2;
1299 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001300
1301 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1302 let Dom = VFPNeonDomain.Value;
Evan Cheng96581d32008-11-11 02:11:05 +00001303}
1304
Evan Chengcd8e66a2008-11-11 21:48:44 +00001305class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001306 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001307 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001308 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001309 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001310 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001311 let Inst{27-24} = opcod1;
1312 let Inst{21-20} = opcod2;
1313 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001314}
1315
Evan Chengcd8e66a2008-11-11 21:48:44 +00001316// Load / store multiple
Evan Cheng10bf7342009-09-09 23:55:03 +00001317class AXDI5<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001318 string asm, string cstr, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001319 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson815baeb2010-03-13 01:08:20 +00001320 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001321 // TODO: Mark the instructions with the appropriate subtarget info.
1322 let Inst{27-25} = 0b110;
1323 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001324
1325 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1326 let Dom = VFPNeonDomain.Value;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001327}
1328
Evan Cheng10bf7342009-09-09 23:55:03 +00001329class AXSI5<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001330 string asm, string cstr, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001331 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson815baeb2010-03-13 01:08:20 +00001332 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001333 // TODO: Mark the instructions with the appropriate subtarget info.
1334 let Inst{27-25} = 0b110;
1335 let Inst{11-8} = 0b1010;
1336}
1337
Evan Cheng96581d32008-11-11 02:11:05 +00001338// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001339class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1340 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1341 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001342 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001343 let Inst{27-23} = opcod1;
1344 let Inst{21-20} = opcod2;
1345 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001346 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001347 let Inst{7-6} = opcod4;
1348 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001349}
1350
1351// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001352class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1353 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001354 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001355 let Inst{27-23} = opcod1;
1356 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001357 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001358 let Inst{6} = op6;
1359 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001360}
1361
1362// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001363class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1364 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1365 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001366 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001367 let Inst{27-23} = opcod1;
1368 let Inst{21-20} = opcod2;
1369 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001370 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001371 let Inst{7-6} = opcod4;
1372 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001373}
1374
David Goodwin338268c2009-08-10 22:17:39 +00001375// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001376// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001377class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1378 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1379 string asm, list<dag> pattern>
1380 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1381 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001382 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1383}
1384
Evan Cheng96581d32008-11-11 02:11:05 +00001385// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001386class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1387 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001388 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001389 let Inst{27-23} = opcod1;
1390 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001391 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001392 let Inst{6} = op6;
1393 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001394}
1395
David Goodwin338268c2009-08-10 22:17:39 +00001396// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001397// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001398class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1399 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
1400 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001401 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1402}
1403
Evan Cheng80a11982008-11-12 06:41:41 +00001404// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001405class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1406 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1407 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001408 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001409 let Inst{27-23} = opcod1;
1410 let Inst{21-20} = opcod2;
1411 let Inst{19-16} = opcod3;
1412 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001413 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001414 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001415}
1416
Johnny Chen811663f2010-02-11 18:47:03 +00001417// VFP conversion between floating-point and fixed-point
1418class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1419 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1420 list<dag> pattern>
1421 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1422 // size (fixed-point number): sx == 0 ? 16 : 32
1423 let Inst{7} = op5; // sx
1424}
1425
David Goodwin338268c2009-08-10 22:17:39 +00001426// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001427class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001428 dag oops, dag iops, InstrItinClass itin,
1429 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001430 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1431 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001432 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1433}
1434
Evan Cheng80a11982008-11-12 06:41:41 +00001435class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001436 InstrItinClass itin,
1437 string opc, string asm, list<dag> pattern>
1438 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001439 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001440 let Inst{11-8} = opcod2;
1441 let Inst{4} = 1;
1442}
1443
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001444class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1445 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1446 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001447
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001448class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1449 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1450 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001451
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001452class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1453 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1454 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001455
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001456class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1457 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1458 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001459
Evan Cheng96581d32008-11-11 02:11:05 +00001460//===----------------------------------------------------------------------===//
1461
Bob Wilson5bafff32009-06-22 23:27:02 +00001462//===----------------------------------------------------------------------===//
1463// ARM NEON Instruction templates.
1464//
Evan Cheng13096642008-08-29 06:41:12 +00001465
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001466class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001467 string opc, string dt, string asm, string cstr, list<dag> pattern>
1468 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
1469 let OutOperandList = oops;
1470 let InOperandList = !con(iops, (ops pred:$p));
1471 let AsmString = !strconcat(
1472 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1473 !strconcat("\t", asm));
1474 let Pattern = pattern;
1475 list<Predicate> Predicates = [HasNEON];
1476}
1477
1478// Same as NeonI except it does not have a "data type" specifier.
1479class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001480 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001481 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001482 let OutOperandList = oops;
Evan Chengac0869d2009-11-21 06:21:52 +00001483 let InOperandList = !con(iops, (ops pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001484 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001485 let Pattern = pattern;
1486 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001487}
1488
Evan Chengac0869d2009-11-21 06:21:52 +00001489class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1490 list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001491 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
Evan Chengac0869d2009-11-21 06:21:52 +00001492 pattern> {
Evan Cheng13096642008-08-29 06:41:12 +00001493}
Bob Wilson5bafff32009-06-22 23:27:02 +00001494
Evan Chengf81bf152009-11-23 21:57:23 +00001495class NI4<dag oops, dag iops, InstrItinClass itin, string opc,
1496 string asm, list<dag> pattern>
1497 : NeonXI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "",
1498 pattern> {
Anton Korobeynikovbaf31082009-08-08 13:35:48 +00001499}
1500
Bob Wilsonb07c1712009-10-07 21:53:04 +00001501class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1502 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001503 string opc, string dt, string asm, string cstr, list<dag> pattern>
1504 : NeonI<oops, iops, AddrMode6, IndexModeNone, itin, opc, dt, asm, cstr,
1505 pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001506 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001507 let Inst{23} = op23;
1508 let Inst{21-20} = op21_20;
1509 let Inst{11-8} = op11_8;
1510 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001511}
1512
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001513class NDataI<dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001514 string opc, string dt, string asm, string cstr, list<dag> pattern>
1515 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, dt, asm,
1516 cstr, pattern> {
1517 let Inst{31-25} = 0b1111001;
1518}
1519
1520class NDataXI<dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001521 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001522 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
Evan Chengac0869d2009-11-21 06:21:52 +00001523 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001524 let Inst{31-25} = 0b1111001;
1525}
1526
1527// NEON "one register and a modified immediate" format.
1528class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1529 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001530 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001531 string opc, string dt, string asm, string cstr, list<dag> pattern>
1532 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001533 let Inst{23} = op23;
1534 let Inst{21-19} = op21_19;
1535 let Inst{11-8} = op11_8;
1536 let Inst{7} = op7;
1537 let Inst{6} = op6;
1538 let Inst{5} = op5;
1539 let Inst{4} = op4;
1540}
1541
1542// NEON 2 vector register format.
1543class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1544 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001545 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001546 string opc, string dt, string asm, string cstr, list<dag> pattern>
1547 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1548 let Inst{24-23} = op24_23;
1549 let Inst{21-20} = op21_20;
1550 let Inst{19-18} = op19_18;
1551 let Inst{17-16} = op17_16;
1552 let Inst{11-7} = op11_7;
1553 let Inst{6} = op6;
1554 let Inst{4} = op4;
1555}
1556
1557// Same as N2V except it doesn't have a datatype suffix.
1558class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1559 bits<5> op11_7, bit op6, bit op4,
1560 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001561 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001562 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001563 let Inst{24-23} = op24_23;
1564 let Inst{21-20} = op21_20;
1565 let Inst{19-18} = op19_18;
1566 let Inst{17-16} = op17_16;
1567 let Inst{11-7} = op11_7;
1568 let Inst{6} = op6;
1569 let Inst{4} = op4;
1570}
1571
1572// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001573class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001574 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001575 string opc, string dt, string asm, string cstr, list<dag> pattern>
1576 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001577 let Inst{24} = op24;
1578 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001579 let Inst{11-8} = op11_8;
1580 let Inst{7} = op7;
1581 let Inst{6} = op6;
1582 let Inst{4} = op4;
1583}
1584
1585// NEON 3 vector register format.
1586class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001587 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001588 string opc, string dt, string asm, string cstr, list<dag> pattern>
1589 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1590 let Inst{24} = op24;
1591 let Inst{23} = op23;
1592 let Inst{21-20} = op21_20;
1593 let Inst{11-8} = op11_8;
1594 let Inst{6} = op6;
1595 let Inst{4} = op4;
1596}
1597
1598// Same as N3VX except it doesn't have a data type suffix.
1599class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1600 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001601 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001602 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001603 let Inst{24} = op24;
1604 let Inst{23} = op23;
1605 let Inst{21-20} = op21_20;
1606 let Inst{11-8} = op11_8;
1607 let Inst{6} = op6;
1608 let Inst{4} = op4;
1609}
1610
1611// NEON VMOVs between scalar and core registers.
1612class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001613 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001614 string opc, string dt, string asm, list<dag> pattern>
1615 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
1616 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001617 let Inst{27-20} = opcod1;
1618 let Inst{11-8} = opcod2;
1619 let Inst{6-5} = opcod3;
1620 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001621
1622 let OutOperandList = oops;
1623 let InOperandList = !con(iops, (ops pred:$p));
1624 let AsmString = !strconcat(
1625 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1626 !strconcat("\t", asm));
1627 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001628 list<Predicate> Predicates = [HasNEON];
1629}
1630class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001631 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001632 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001633 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001634 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001635class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001636 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001637 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001638 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001639 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001640class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001641 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001642 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001643 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001644 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001645
1646// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1647// for single-precision FP.
1648class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1649 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1650}