blob: 4f6f05d40943e75ee5679bce038e8fdfabbc12e3 [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.
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>;
39def ExtFrm : Format<13>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000040
Johnny Chen81f04d52010-03-19 17:39:00 +000041def VFPUnaryFrm : Format<14>;
42def VFPBinaryFrm : Format<15>;
43def VFPConv1Frm : Format<16>;
44def VFPConv2Frm : Format<17>;
45def VFPConv3Frm : Format<18>;
46def VFPConv4Frm : Format<19>;
47def VFPConv5Frm : Format<20>;
48def VFPLdStFrm : Format<21>;
49def VFPLdStMulFrm : Format<22>;
50def VFPMiscFrm : Format<23>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000051
Johnny Chen81f04d52010-03-19 17:39:00 +000052def ThumbFrm : Format<24>;
Evan Cheng37f25d92008-08-28 23:39:26 +000053
Johnny Chen81f04d52010-03-19 17:39:00 +000054def NEONFrm : Format<25>;
55def NEONGetLnFrm : Format<26>;
56def NEONSetLnFrm : Format<27>;
57def NEONDupFrm : Format<28>;
Bob Wilson5bafff32009-06-22 23:27:02 +000058
Johnny Chenf4d81052010-02-12 22:53:19 +000059def MiscFrm : Format<29>;
60def ThumbMiscFrm : Format<30>;
61
Johnny Chencaa608e2010-03-20 00:17:00 +000062def NLdStFrm : Format<31>;
63
Evan Cheng34a0fa32009-07-08 01:46:35 +000064// Misc flags.
65
Evan Chengedda31c2008-11-05 18:35:52 +000066// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000067// UnaryDP - Indicates this is a unary data processing instruction, i.e.
68// it doesn't have a Rn operand.
69class UnaryDP { bit isUnaryDataProc = 1; }
70
71// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
72// a 16-bit Thumb instruction if certain conditions are met.
73class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000074
Evan Cheng37f25d92008-08-28 23:39:26 +000075//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000076// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000077//
78
79// Addressing mode.
80class AddrMode<bits<4> val> {
81 bits<4> Value = val;
82}
83def AddrModeNone : AddrMode<0>;
84def AddrMode1 : AddrMode<1>;
85def AddrMode2 : AddrMode<2>;
86def AddrMode3 : AddrMode<3>;
87def AddrMode4 : AddrMode<4>;
88def AddrMode5 : AddrMode<5>;
Bob Wilson8b024a52009-07-01 23:16:05 +000089def AddrMode6 : AddrMode<6>;
90def AddrModeT1_1 : AddrMode<7>;
91def AddrModeT1_2 : AddrMode<8>;
92def AddrModeT1_4 : AddrMode<9>;
93def AddrModeT1_s : AddrMode<10>;
David Goodwine1e52ed2009-07-22 22:24:31 +000094def AddrModeT2_i12: AddrMode<11>;
Bob Wilson8b024a52009-07-01 23:16:05 +000095def AddrModeT2_i8 : AddrMode<12>;
96def AddrModeT2_so : AddrMode<13>;
97def AddrModeT2_pc : AddrMode<14>;
98def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng055b0312009-06-29 07:51:04 +000099
100// Instruction size.
101class SizeFlagVal<bits<3> val> {
102 bits<3> Value = val;
103}
104def SizeInvalid : SizeFlagVal<0>; // Unset.
105def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
106def Size8Bytes : SizeFlagVal<2>;
107def Size4Bytes : SizeFlagVal<3>;
108def Size2Bytes : SizeFlagVal<4>;
109
110// Load / store index mode.
111class IndexMode<bits<2> val> {
112 bits<2> Value = val;
113}
114def IndexModeNone : IndexMode<0>;
115def IndexModePre : IndexMode<1>;
116def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000117def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000118
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000119// Instruction execution domain.
120class Domain<bits<2> val> {
121 bits<2> Value = val;
122}
123def GenericDomain : Domain<0>;
124def VFPDomain : Domain<1>; // Instructions in VFP domain only
125def NeonDomain : Domain<2>; // Instructions in Neon domain only
126def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
127
Evan Cheng055b0312009-06-29 07:51:04 +0000128//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000129
Evan Cheng446c4282009-07-11 06:43:01 +0000130// ARM special operands.
131//
132
133// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
134// register whose default is 0 (no register).
135def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
136 (ops (i32 14), (i32 zero_reg))> {
137 let PrintMethod = "printPredicateOperand";
138}
139
140// Conditional code result for instructions whose 's' bit is set, e.g. subs.
141def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
142 let PrintMethod = "printSBitModifierOperand";
143}
144
145// Same as cc_out except it defaults to setting CPSR.
146def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
147 let PrintMethod = "printSBitModifierOperand";
148}
149
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000150// ARM special operands for disassembly only.
151//
152
153def cps_opt : Operand<i32> {
154 let PrintMethod = "printCPSOptionOperand";
155}
156
157def msr_mask : Operand<i32> {
158 let PrintMethod = "printMSRMaskOperand";
159}
160
161// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
162// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
163def neg_zero : Operand<i32> {
164 let PrintMethod = "printNegZeroOperand";
165}
166
Evan Cheng446c4282009-07-11 06:43:01 +0000167//===----------------------------------------------------------------------===//
168
Evan Cheng37f25d92008-08-28 23:39:26 +0000169// ARM Instruction templates.
170//
171
Johnny Chend68e1192009-12-15 17:24:14 +0000172class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
173 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000174 : Instruction {
175 let Namespace = "ARM";
176
Evan Chengedda31c2008-11-05 18:35:52 +0000177 // TSFlagsFields
Evan Cheng37f25d92008-08-28 23:39:26 +0000178 AddrMode AM = am;
179 bits<4> AddrModeBits = AM.Value;
180
181 SizeFlagVal SZ = sz;
182 bits<3> SizeFlag = SZ.Value;
183
184 IndexMode IM = im;
185 bits<2> IndexModeBits = IM.Value;
186
187 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000188 bits<6> Form = F.Value;
Evan Chengedda31c2008-11-05 18:35:52 +0000189
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000190 Domain D = d;
191 bits<2> Dom = D.Value;
192
Evan Chengedda31c2008-11-05 18:35:52 +0000193 //
194 // Attributes specific to ARM instructions...
195 //
196 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000197 bit canXformTo16Bit = 0;
Evan Cheng37f25d92008-08-28 23:39:26 +0000198
199 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000200 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000201}
202
Johnny Chend68e1192009-12-15 17:24:14 +0000203class Encoding {
204 field bits<32> Inst;
205}
206
207class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
208 Format f, Domain d, string cstr, InstrItinClass itin>
209 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
210
211// This Encoding-less class is used by Thumb1 to specify the encoding bits later
212// on by adding flavors to specific instructions.
213class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
214 Format f, Domain d, string cstr, InstrItinClass itin>
215 : InstTemplate<am, sz, im, f, d, cstr, itin>;
216
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000217class PseudoInst<dag oops, dag iops, InstrItinClass itin,
218 string asm, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000219 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
220 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000221 let OutOperandList = oops;
222 let InOperandList = iops;
223 let AsmString = asm;
224 let Pattern = pattern;
225}
226
227// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000228class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000229 IndexMode im, Format f, InstrItinClass itin,
230 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000231 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000232 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000233 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000234 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng37f25d92008-08-28 23:39:26 +0000235 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
236 let Pattern = pattern;
237 list<Predicate> Predicates = [IsARM];
238}
Jim Grosbachf6b28622009-12-14 18:31:20 +0000239// A few are not predicable
240class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
241 IndexMode im, Format f, InstrItinClass itin,
242 string opc, string asm, string cstr,
243 list<dag> pattern>
244 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
245 let OutOperandList = oops;
246 let InOperandList = iops;
247 let AsmString = !strconcat(opc, asm);
248 let Pattern = pattern;
249 let isPredicable = 0;
250 list<Predicate> Predicates = [IsARM];
251}
Evan Cheng37f25d92008-08-28 23:39:26 +0000252
253// Same as I except it can optionally modify CPSR. Note it's modeled as
254// an input operand since by default it's a zero register. It will
255// become an implicit def once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000256class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000257 IndexMode im, Format f, InstrItinClass itin,
258 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000259 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000260 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000261 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000262 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng37f25d92008-08-28 23:39:26 +0000263 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
264 let Pattern = pattern;
265 list<Predicate> Predicates = [IsARM];
266}
267
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000268// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000269class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000270 IndexMode im, Format f, InstrItinClass itin,
271 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000272 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000273 let OutOperandList = oops;
274 let InOperandList = iops;
275 let AsmString = asm;
276 let Pattern = pattern;
277 list<Predicate> Predicates = [IsARM];
278}
279
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000280class AI<dag oops, dag iops, Format f, InstrItinClass itin,
281 string opc, string asm, list<dag> pattern>
282 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
283 opc, asm, "", pattern>;
284class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
285 string opc, string asm, list<dag> pattern>
286 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
287 opc, asm, "", pattern>;
288class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000289 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000290 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000291 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000292class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
293 string opc, string asm, list<dag> pattern>
294 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
295 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000296
297// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000298class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
299 string opc, string asm, list<dag> pattern>
300 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
301 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000302 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000303}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000304class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
305 string asm, list<dag> pattern>
306 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
307 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000308 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000309}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000310class ABXIx2<dag oops, dag iops, InstrItinClass itin,
311 string asm, list<dag> pattern>
312 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
313 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000314
315// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000316class JTI<dag oops, dag iops, InstrItinClass itin,
317 string asm, list<dag> pattern>
318 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000319 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000320
Jim Grosbach5278eb82009-12-11 01:42:04 +0000321
322// Atomic load/store instructions
323
324class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
325 string opc, string asm, list<dag> pattern>
326 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
327 opc, asm, "", pattern> {
328 let Inst{27-23} = 0b00011;
329 let Inst{22-21} = opcod;
330 let Inst{20} = 1;
331 let Inst{11-0} = 0b111110011111;
332}
333class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
334 string opc, string asm, list<dag> pattern>
335 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
336 opc, asm, "", pattern> {
337 let Inst{27-23} = 0b00011;
338 let Inst{22-21} = opcod;
339 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000340 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000341}
342
Evan Cheng0d14fc82008-09-01 01:51:14 +0000343// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000344class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
345 string opc, string asm, list<dag> pattern>
346 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
347 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000348 let Inst{24-21} = opcod;
349 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000350}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000351class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
352 string opc, string asm, list<dag> pattern>
353 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
354 opc, asm, "", pattern> {
355 let Inst{24-21} = opcod;
356 let Inst{27-26} = {0,0};
357}
358class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000359 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000360 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000361 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000362 let Inst{24-21} = opcod;
363 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000364}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000365class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
366 string opc, string asm, list<dag> pattern>
367 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
368 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000369
Evan Cheng0d14fc82008-09-01 01:51:14 +0000370
371// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000372class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
373 string opc, string asm, list<dag> pattern>
374 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
375 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000376 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000377}
Evan Cheng93912732008-09-01 01:27:33 +0000378
379// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000380class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
381 string opc, string asm, list<dag> pattern>
382 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
383 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000384 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000385 let Inst{21} = 0; // W bit
386 let Inst{22} = 0; // B bit
387 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000388 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000389}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000390class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
391 string asm, list<dag> pattern>
392 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000393 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000394 let Inst{20} = 1; // L bit
395 let Inst{21} = 0; // W bit
396 let Inst{22} = 0; // B bit
397 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000398 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000399}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000400class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
401 string opc, string asm, list<dag> pattern>
402 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
403 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000404 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000405 let Inst{21} = 0; // W bit
406 let Inst{22} = 1; // B bit
407 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000408 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000409}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000410class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
411 string asm, list<dag> pattern>
412 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000413 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000414 let Inst{20} = 1; // L bit
415 let Inst{21} = 0; // W bit
416 let Inst{22} = 1; // B bit
417 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000418 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000419}
Evan Cheng17222df2008-08-31 19:02:21 +0000420
Evan Cheng93912732008-09-01 01:27:33 +0000421// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000422class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
423 string opc, string asm, list<dag> pattern>
424 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
425 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000426 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000427 let Inst{21} = 0; // W bit
428 let Inst{22} = 0; // B bit
429 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000430 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000431}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000432class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
433 string asm, list<dag> pattern>
434 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000435 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000436 let Inst{20} = 0; // L bit
437 let Inst{21} = 0; // W bit
438 let Inst{22} = 0; // B bit
439 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000440 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000441}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000442class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
443 string opc, string asm, list<dag> pattern>
444 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
445 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000446 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000447 let Inst{21} = 0; // W bit
448 let Inst{22} = 1; // B bit
449 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000450 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000451}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000452class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
453 string asm, list<dag> pattern>
454 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000455 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000456 let Inst{20} = 0; // L bit
457 let Inst{21} = 0; // W bit
458 let Inst{22} = 1; // B bit
459 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000460 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000461}
Evan Cheng93912732008-09-01 01:27:33 +0000462
Evan Cheng840917b2008-09-01 07:00:14 +0000463// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000464class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
465 string opc, string asm, string cstr, list<dag> pattern>
466 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
467 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000468 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000469 let Inst{21} = 1; // W bit
470 let Inst{22} = 0; // B bit
471 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000472 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000473}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000474class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
475 string opc, string asm, string cstr, list<dag> pattern>
476 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
477 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000478 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000479 let Inst{21} = 1; // W bit
480 let Inst{22} = 1; // B bit
481 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000482 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000483}
484
Evan Cheng840917b2008-09-01 07:00:14 +0000485// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000486class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
487 string opc, string asm, string cstr, list<dag> pattern>
488 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
489 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000490 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000491 let Inst{21} = 1; // W bit
492 let Inst{22} = 0; // B bit
493 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000494 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000495}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000496class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
497 string opc, string asm, string cstr, list<dag> pattern>
498 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
499 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000500 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000501 let Inst{21} = 1; // W bit
502 let Inst{22} = 1; // B bit
503 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000504 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000505}
506
Evan Cheng840917b2008-09-01 07:00:14 +0000507// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000508class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
509 string opc, string asm, string cstr, list<dag> pattern>
510 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
511 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000512 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000513 let Inst{21} = 0; // W bit
514 let Inst{22} = 0; // B bit
515 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000516 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000517}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000518class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
519 string opc, string asm, string cstr, list<dag> pattern>
520 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
521 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000522 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000523 let Inst{21} = 0; // W bit
524 let Inst{22} = 1; // B bit
525 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000526 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000527}
528
Evan Cheng840917b2008-09-01 07:00:14 +0000529// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000530class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
531 string opc, string asm, string cstr, list<dag> pattern>
532 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
533 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000534 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000535 let Inst{21} = 0; // W bit
536 let Inst{22} = 0; // B bit
537 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000538 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000539}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000540class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
541 string opc, string asm, string cstr, list<dag> pattern>
542 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
543 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000544 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000545 let Inst{21} = 0; // W bit
546 let Inst{22} = 1; // B bit
547 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000548 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000549}
550
Evan Cheng0d14fc82008-09-01 01:51:14 +0000551// addrmode3 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000552class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
553 string opc, string asm, list<dag> pattern>
554 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
555 opc, asm, "", pattern>;
556class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
557 string asm, list<dag> pattern>
558 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
559 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000560
Evan Cheng840917b2008-09-01 07:00:14 +0000561// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000562class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
563 string opc, string asm, list<dag> pattern>
564 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
565 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000566 let Inst{4} = 1;
567 let Inst{5} = 1; // H bit
568 let Inst{6} = 0; // S bit
569 let Inst{7} = 1;
570 let Inst{20} = 1; // L bit
571 let Inst{21} = 0; // W bit
572 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000573 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000574}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000575class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
576 string asm, list<dag> pattern>
577 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000578 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000579 let Inst{4} = 1;
580 let Inst{5} = 1; // H bit
581 let Inst{6} = 0; // S bit
582 let Inst{7} = 1;
583 let Inst{20} = 1; // L bit
584 let Inst{21} = 0; // W bit
585 let Inst{24} = 1; // P bit
586}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000587class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
588 string opc, string asm, list<dag> pattern>
589 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
590 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000591 let Inst{4} = 1;
592 let Inst{5} = 1; // H bit
593 let Inst{6} = 1; // S bit
594 let Inst{7} = 1;
595 let Inst{20} = 1; // L bit
596 let Inst{21} = 0; // W bit
597 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000598 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000599}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000600class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
601 string asm, list<dag> pattern>
602 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000603 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000604 let Inst{4} = 1;
605 let Inst{5} = 1; // H bit
606 let Inst{6} = 1; // S bit
607 let Inst{7} = 1;
608 let Inst{20} = 1; // L bit
609 let Inst{21} = 0; // W bit
610 let Inst{24} = 1; // P bit
611}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000612class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
613 string opc, string asm, list<dag> pattern>
614 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
615 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000616 let Inst{4} = 1;
617 let Inst{5} = 0; // H bit
618 let Inst{6} = 1; // S bit
619 let Inst{7} = 1;
620 let Inst{20} = 1; // L bit
621 let Inst{21} = 0; // W bit
622 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000623 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000624}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000625class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
626 string asm, list<dag> pattern>
627 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000628 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000629 let Inst{4} = 1;
630 let Inst{5} = 0; // H bit
631 let Inst{6} = 1; // S bit
632 let Inst{7} = 1;
633 let Inst{20} = 1; // L bit
634 let Inst{21} = 0; // W bit
635 let Inst{24} = 1; // P bit
636}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000637class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
638 string opc, string asm, list<dag> pattern>
639 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
640 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000641 let Inst{4} = 1;
642 let Inst{5} = 0; // H bit
643 let Inst{6} = 1; // S bit
644 let Inst{7} = 1;
645 let Inst{20} = 0; // L bit
646 let Inst{21} = 0; // W bit
647 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000648 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000649}
650
651// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000652class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
653 string opc, string asm, list<dag> pattern>
654 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
655 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000656 let Inst{4} = 1;
657 let Inst{5} = 1; // H bit
658 let Inst{6} = 0; // S bit
659 let Inst{7} = 1;
660 let Inst{20} = 0; // L bit
661 let Inst{21} = 0; // W bit
662 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000663 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000664}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000665class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
666 string asm, list<dag> pattern>
667 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000668 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000669 let Inst{4} = 1;
670 let Inst{5} = 1; // H bit
671 let Inst{6} = 0; // S bit
672 let Inst{7} = 1;
673 let Inst{20} = 0; // L bit
674 let Inst{21} = 0; // W bit
675 let Inst{24} = 1; // P bit
676}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000677class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
678 string opc, string asm, list<dag> pattern>
679 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
680 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000681 let Inst{4} = 1;
682 let Inst{5} = 1; // H bit
683 let Inst{6} = 1; // S bit
684 let Inst{7} = 1;
685 let Inst{20} = 0; // L bit
686 let Inst{21} = 0; // W bit
687 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000688 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000689}
690
691// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000692class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
693 string opc, string asm, string cstr, list<dag> pattern>
694 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
695 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000696 let Inst{4} = 1;
697 let Inst{5} = 1; // H bit
698 let Inst{6} = 0; // S bit
699 let Inst{7} = 1;
700 let Inst{20} = 1; // L bit
701 let Inst{21} = 1; // 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}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000705class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
706 string opc, string asm, string cstr, list<dag> pattern>
707 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
708 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000709 let Inst{4} = 1;
710 let Inst{5} = 1; // H bit
711 let Inst{6} = 1; // S bit
712 let Inst{7} = 1;
713 let Inst{20} = 1; // L bit
714 let Inst{21} = 1; // W bit
715 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000716 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000717}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000718class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
719 string opc, string asm, string cstr, list<dag> pattern>
720 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
721 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000722 let Inst{4} = 1;
723 let Inst{5} = 0; // H bit
724 let Inst{6} = 1; // S bit
725 let Inst{7} = 1;
726 let Inst{20} = 1; // L bit
727 let Inst{21} = 1; // W bit
728 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000729 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000730}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000731class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
732 string opc, string asm, string cstr, list<dag> pattern>
733 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
734 opc, asm, cstr, pattern> {
735 let Inst{4} = 1;
736 let Inst{5} = 0; // H bit
737 let Inst{6} = 1; // S bit
738 let Inst{7} = 1;
739 let Inst{20} = 0; // L bit
740 let Inst{21} = 1; // W bit
741 let Inst{24} = 1; // P bit
742 let Inst{27-25} = 0b000;
743}
744
Evan Cheng840917b2008-09-01 07:00:14 +0000745
746// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000747class AI3sthpr<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} = 0; // 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}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000760class AI3stdpr<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> {
764 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} = 0; // L bit
769 let Inst{21} = 1; // W bit
770 let Inst{24} = 1; // P bit
771 let Inst{27-25} = 0b000;
772}
Evan Cheng840917b2008-09-01 07:00:14 +0000773
774// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000775class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
776 string opc, string asm, string cstr, list<dag> pattern>
777 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
778 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000779 let Inst{4} = 1;
780 let Inst{5} = 1; // H bit
781 let Inst{6} = 0; // S bit
782 let Inst{7} = 1;
783 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000784 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000785 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000786 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000787}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000788class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
789 string opc, string asm, string cstr, list<dag> pattern>
790 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
791 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000792 let Inst{4} = 1;
793 let Inst{5} = 1; // H bit
794 let Inst{6} = 1; // S bit
795 let Inst{7} = 1;
796 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000797 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000798 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000799 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000800}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000801class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
802 string opc, string asm, string cstr, list<dag> pattern>
803 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
804 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000805 let Inst{4} = 1;
806 let Inst{5} = 0; // H bit
807 let Inst{6} = 1; // S bit
808 let Inst{7} = 1;
809 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000810 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000811 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000812 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000813}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000814class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
815 string opc, string asm, string cstr, list<dag> pattern>
816 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
817 opc, asm, cstr, pattern> {
818 let Inst{4} = 1;
819 let Inst{5} = 0; // H bit
820 let Inst{6} = 1; // S bit
821 let Inst{7} = 1;
822 let Inst{20} = 0; // L bit
823 let Inst{21} = 0; // W bit
824 let Inst{24} = 0; // P bit
825 let Inst{27-25} = 0b000;
826}
Evan Cheng840917b2008-09-01 07:00:14 +0000827
828// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000829class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
830 string opc, string asm, string cstr, list<dag> pattern>
831 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
832 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000833 let Inst{4} = 1;
834 let Inst{5} = 1; // H bit
835 let Inst{6} = 0; // S bit
836 let Inst{7} = 1;
837 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000838 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000839 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000840 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000841}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000842class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
843 string opc, string asm, string cstr, list<dag> pattern>
844 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
845 opc, asm, cstr, pattern> {
846 let Inst{4} = 1;
847 let Inst{5} = 1; // H bit
848 let Inst{6} = 1; // S bit
849 let Inst{7} = 1;
850 let Inst{20} = 0; // L bit
851 let Inst{21} = 0; // W bit
852 let Inst{24} = 0; // P bit
853 let Inst{27-25} = 0b000;
854}
Evan Cheng840917b2008-09-01 07:00:14 +0000855
856
Evan Cheng0d14fc82008-09-01 01:51:14 +0000857// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000858class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000859 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000860 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000861 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000862 let Inst{20} = 1; // L bit
863 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000864 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000865}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000866class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000867 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000868 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000869 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000870 let Inst{20} = 0; // L bit
871 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000872 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000873}
Evan Cheng37f25d92008-08-28 23:39:26 +0000874
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000875// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000876class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
877 string opc, string asm, list<dag> pattern>
878 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
879 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000880 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000881 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000882 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000883}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000884class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
885 string opc, string asm, list<dag> pattern>
886 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
887 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000888 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000889 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000890}
891
892// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000893class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
894 string opc, string asm, list<dag> pattern>
895 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
896 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000897 let Inst{7-4} = 0b1001;
898 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000899 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000900}
Evan Cheng37f25d92008-08-28 23:39:26 +0000901
Evan Chengeb4f52e2008-11-06 03:35:07 +0000902// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000903class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
904 string opc, string asm, list<dag> pattern>
905 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
906 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000907 let Inst{4} = 0;
908 let Inst{7} = 1;
909 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000910 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000911}
912
Evan Cheng97f48c32008-11-06 22:15:19 +0000913// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000914class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
915 string opc, string asm, list<dag> pattern>
916 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
917 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000918 let Inst{7-4} = 0b0111;
919 let Inst{27-20} = opcod;
920}
921
Evan Cheng8b59db32008-11-07 01:41:35 +0000922// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000923class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
924 string opc, string asm, list<dag> pattern>
925 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
926 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000927 let Inst{27-20} = opcod;
928}
929
Evan Cheng37f25d92008-08-28 23:39:26 +0000930//===----------------------------------------------------------------------===//
931
932// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
933class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
934 list<Predicate> Predicates = [IsARM];
935}
936class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
937 list<Predicate> Predicates = [IsARM, HasV5TE];
938}
939class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
940 list<Predicate> Predicates = [IsARM, HasV6];
941}
Evan Cheng13096642008-08-29 06:41:12 +0000942
943//===----------------------------------------------------------------------===//
944//
945// Thumb Instruction Format Definitions.
946//
947
Evan Cheng13096642008-08-29 06:41:12 +0000948// TI - Thumb instruction.
949
Evan Cheng446c4282009-07-11 06:43:01 +0000950class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000951 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000952 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000953 let OutOperandList = oops;
954 let InOperandList = iops;
Evan Cheng13096642008-08-29 06:41:12 +0000955 let AsmString = asm;
956 let Pattern = pattern;
957 list<Predicate> Predicates = [IsThumb];
958}
959
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000960class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
961 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000962
Evan Cheng35d6c412009-08-04 23:47:55 +0000963// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000964class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
965 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000966
Johnny Chend68e1192009-12-15 17:24:14 +0000967// tBL, tBX 32-bit instructions
968class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
969 dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
970 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>, Encoding {
971 let Inst{31-27} = opcod1;
972 let Inst{15-14} = opcod2;
973 let Inst{12} = opcod3;
974}
Evan Cheng13096642008-08-29 06:41:12 +0000975
976// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000977class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
978 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000979
Evan Cheng09c39fc2009-06-23 19:38:13 +0000980// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000981class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000982 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000983 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000984 let OutOperandList = oops;
985 let InOperandList = iops;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000986 let AsmString = asm;
987 let Pattern = pattern;
988 list<Predicate> Predicates = [IsThumb1Only];
989}
990
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000991class T1I<dag oops, dag iops, InstrItinClass itin,
992 string asm, list<dag> pattern>
993 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
994class T1Ix2<dag oops, dag iops, InstrItinClass itin,
995 string asm, list<dag> pattern>
996 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
997class T1JTI<dag oops, dag iops, InstrItinClass itin,
998 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +0000999 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001000
1001// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001002class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001003 string asm, string cstr, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001004 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001005 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001006
1007// Thumb1 instruction that can either be predicated or set CPSR.
1008class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001009 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001010 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001011 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001012 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1013 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001014 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1015 let Pattern = pattern;
1016 list<Predicate> Predicates = [IsThumb1Only];
1017}
1018
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001019class T1sI<dag oops, dag iops, InstrItinClass itin,
1020 string opc, string asm, list<dag> pattern>
1021 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001022
1023// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001024class T1sIt<dag oops, dag iops, InstrItinClass itin,
1025 string opc, string asm, list<dag> pattern>
1026 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001027 "$lhs = $dst", pattern>;
1028
1029// Thumb1 instruction that can be predicated.
1030class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001031 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001032 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001033 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001034 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001035 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001036 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1037 let Pattern = pattern;
1038 list<Predicate> Predicates = [IsThumb1Only];
1039}
1040
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001041class T1pI<dag oops, dag iops, InstrItinClass itin,
1042 string opc, string asm, list<dag> pattern>
1043 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001044
1045// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001046class T1pIt<dag oops, dag iops, InstrItinClass itin,
1047 string opc, string asm, list<dag> pattern>
1048 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001049 "$lhs = $dst", pattern>;
1050
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001051class T1pI1<dag oops, dag iops, InstrItinClass itin,
1052 string opc, string asm, list<dag> pattern>
1053 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1054class T1pI2<dag oops, dag iops, InstrItinClass itin,
1055 string opc, string asm, list<dag> pattern>
1056 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1057class T1pI4<dag oops, dag iops, InstrItinClass itin,
1058 string opc, string asm, list<dag> pattern>
1059 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1060class T1pIs<dag oops, dag iops,
1061 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1062 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001063
Johnny Chenbbc71b22009-12-16 02:32:54 +00001064class Encoding16 : Encoding {
1065 let Inst{31-16} = 0x0000;
1066}
1067
Johnny Chend68e1192009-12-15 17:24:14 +00001068// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001069class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001070 let Inst{15-10} = opcode;
1071}
1072
1073// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001074class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001075 let Inst{15-14} = 0b00;
1076 let Inst{13-9} = opcode;
1077}
1078
1079// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001080class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001081 let Inst{15-10} = 0b010000;
1082 let Inst{9-6} = opcode;
1083}
1084
1085// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001086class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001087 let Inst{15-10} = 0b010001;
1088 let Inst{9-6} = opcode;
1089}
1090
1091// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001092class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001093 let Inst{15-12} = opA;
1094 let Inst{11-9} = opB;
1095}
1096class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1097class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1098class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1099class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1100class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1101
1102// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001103class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001104 let Inst{15-12} = 0b1011;
1105 let Inst{11-5} = opcode;
1106}
1107
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001108// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1109class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001110 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001111 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001112 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001113 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001114 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001115 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1116 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001117 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001118}
1119
1120// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1121// an input operand since by default it's a zero register. It will
1122// become an implicit def once it's "flipped".
1123// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1124// more consistent.
1125class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001126 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001127 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001128 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001129 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001130 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001131 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1132 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001133 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001134}
1135
1136// Special cases
1137class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001138 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001139 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001140 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001141 let OutOperandList = oops;
1142 let InOperandList = iops;
Evan Chengf49810c2009-06-23 17:48:47 +00001143 let AsmString = asm;
1144 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001145 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001146}
1147
Jim Grosbachd1228742009-12-01 18:10:36 +00001148class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1149 InstrItinClass itin,
1150 string asm, string cstr, list<dag> pattern>
1151 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1152 let OutOperandList = oops;
1153 let InOperandList = iops;
1154 let AsmString = asm;
1155 let Pattern = pattern;
1156 list<Predicate> Predicates = [IsThumb1Only];
1157}
1158
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001159class T2I<dag oops, dag iops, InstrItinClass itin,
1160 string opc, string asm, list<dag> pattern>
1161 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1162class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1163 string opc, string asm, list<dag> pattern>
1164 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
1165class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1166 string opc, string asm, list<dag> pattern>
1167 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1168class T2Iso<dag oops, dag iops, InstrItinClass itin,
1169 string opc, string asm, list<dag> pattern>
1170 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1171class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1172 string opc, string asm, list<dag> pattern>
1173 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001174class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001175 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001176 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1177 pattern> {
1178 let Inst{31-27} = 0b11101;
1179 let Inst{26-25} = 0b00;
1180 let Inst{24} = P;
1181 let Inst{23} = ?; // The U bit.
1182 let Inst{22} = 1;
1183 let Inst{21} = W;
1184 let Inst{20} = load;
1185}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001186
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001187class T2sI<dag oops, dag iops, InstrItinClass itin,
1188 string opc, string asm, list<dag> pattern>
1189 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001190
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001191class T2XI<dag oops, dag iops, InstrItinClass itin,
1192 string asm, list<dag> pattern>
1193 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1194class T2JTI<dag oops, dag iops, InstrItinClass itin,
1195 string asm, list<dag> pattern>
1196 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001197
Evan Cheng5adb66a2009-09-28 09:14:39 +00001198class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1199 string opc, string asm, list<dag> pattern>
1200 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1201
Bob Wilson815baeb2010-03-13 01:08:20 +00001202// Two-address instructions
1203class T2XIt<dag oops, dag iops, InstrItinClass itin,
1204 string asm, string cstr, list<dag> pattern>
1205 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001206
Evan Chenge88d5ce2009-07-02 07:28:31 +00001207// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001208class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1209 dag oops, dag iops,
1210 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001211 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001212 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001213 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001214 let InOperandList = !con(iops, (ins pred:$p));
Evan Chenge88d5ce2009-07-02 07:28:31 +00001215 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1216 let Pattern = pattern;
1217 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001218 let Inst{31-27} = 0b11111;
1219 let Inst{26-25} = 0b00;
1220 let Inst{24} = signed;
1221 let Inst{23} = 0;
1222 let Inst{22-21} = opcod;
1223 let Inst{20} = load;
1224 let Inst{11} = 1;
1225 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1226 let Inst{10} = pre; // The P bit.
1227 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001228}
1229
Johnny Chenadc77332010-02-26 22:04:29 +00001230// Helper class for disassembly only
1231// A6.3.16 & A6.3.17
1232// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1233class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1234 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1235 : T2I<oops, iops, itin, opc, asm, pattern> {
1236 let Inst{31-27} = 0b11111;
1237 let Inst{26-24} = 0b011;
1238 let Inst{23} = long;
1239 let Inst{22-20} = op22_20;
1240 let Inst{7-4} = op7_4;
1241}
1242
David Goodwinc9d138f2009-07-27 19:59:26 +00001243// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1244class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1245 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1246}
1247
1248// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1249class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1250 list<Predicate> Predicates = [IsThumb1Only];
1251}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001252
Evan Cheng9cb9e672009-06-27 02:26:13 +00001253// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1254class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001255 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001256}
1257
Evan Cheng13096642008-08-29 06:41:12 +00001258//===----------------------------------------------------------------------===//
1259
Evan Cheng96581d32008-11-11 02:11:05 +00001260//===----------------------------------------------------------------------===//
1261// ARM VFP Instruction templates.
1262//
1263
David Goodwin3ca524e2009-07-10 17:03:29 +00001264// Almost all VFP instructions are predicable.
1265class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001266 IndexMode im, Format f, InstrItinClass itin,
1267 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001268 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001269 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001270 let InOperandList = !con(iops, (ins pred:$p));
David Goodwin3ca524e2009-07-10 17:03:29 +00001271 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1272 let Pattern = pattern;
1273 list<Predicate> Predicates = [HasVFP2];
1274}
1275
1276// Special cases
1277class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001278 IndexMode im, Format f, InstrItinClass itin,
1279 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001280 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001281 let OutOperandList = oops;
1282 let InOperandList = iops;
1283 let AsmString = asm;
1284 let Pattern = pattern;
1285 list<Predicate> Predicates = [HasVFP2];
1286}
1287
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001288class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1289 string opc, string asm, list<dag> pattern>
1290 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1291 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001292
Evan Chengcd8e66a2008-11-11 21:48:44 +00001293// ARM VFP addrmode5 loads and stores
1294class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001295 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001296 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001297 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001298 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001299 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001300 let Inst{27-24} = opcod1;
1301 let Inst{21-20} = opcod2;
1302 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001303
1304 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1305 let Dom = VFPNeonDomain.Value;
Evan Cheng96581d32008-11-11 02:11:05 +00001306}
1307
Evan Chengcd8e66a2008-11-11 21:48:44 +00001308class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001309 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001310 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001311 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001312 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001313 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001314 let Inst{27-24} = opcod1;
1315 let Inst{21-20} = opcod2;
1316 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001317}
1318
Evan Chengcd8e66a2008-11-11 21:48:44 +00001319// Load / store multiple
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001320class AXDI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001321 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001322 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson815baeb2010-03-13 01:08:20 +00001323 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001324 // TODO: Mark the instructions with the appropriate subtarget info.
1325 let Inst{27-25} = 0b110;
1326 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001327
1328 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1329 let Dom = VFPNeonDomain.Value;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001330}
1331
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001332class AXSI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001333 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001334 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson815baeb2010-03-13 01:08:20 +00001335 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001336 // TODO: Mark the instructions with the appropriate subtarget info.
1337 let Inst{27-25} = 0b110;
1338 let Inst{11-8} = 0b1010;
1339}
1340
Evan Cheng96581d32008-11-11 02:11:05 +00001341// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001342class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1343 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1344 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001345 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001346 let Inst{27-23} = opcod1;
1347 let Inst{21-20} = opcod2;
1348 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001349 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001350 let Inst{7-6} = opcod4;
1351 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001352}
1353
1354// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001355class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1356 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001357 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001358 let Inst{27-23} = opcod1;
1359 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001360 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001361 let Inst{6} = op6;
1362 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001363}
1364
1365// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001366class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1367 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1368 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001369 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001370 let Inst{27-23} = opcod1;
1371 let Inst{21-20} = opcod2;
1372 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001373 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001374 let Inst{7-6} = opcod4;
1375 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001376}
1377
David Goodwin338268c2009-08-10 22:17:39 +00001378// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001379// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001380class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1381 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1382 string asm, list<dag> pattern>
1383 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1384 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001385 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1386}
1387
Evan Cheng96581d32008-11-11 02:11:05 +00001388// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001389class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1390 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001391 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001392 let Inst{27-23} = opcod1;
1393 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001394 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001395 let Inst{6} = op6;
1396 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001397}
1398
David Goodwin338268c2009-08-10 22:17:39 +00001399// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001400// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001401class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1402 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
1403 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001404 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1405}
1406
Evan Cheng80a11982008-11-12 06:41:41 +00001407// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001408class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1409 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1410 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001411 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001412 let Inst{27-23} = opcod1;
1413 let Inst{21-20} = opcod2;
1414 let Inst{19-16} = opcod3;
1415 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001416 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001417 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001418}
1419
Johnny Chen811663f2010-02-11 18:47:03 +00001420// VFP conversion between floating-point and fixed-point
1421class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1422 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1423 list<dag> pattern>
1424 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1425 // size (fixed-point number): sx == 0 ? 16 : 32
1426 let Inst{7} = op5; // sx
1427}
1428
David Goodwin338268c2009-08-10 22:17:39 +00001429// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001430class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001431 dag oops, dag iops, InstrItinClass itin,
1432 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001433 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1434 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001435 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1436}
1437
Evan Cheng80a11982008-11-12 06:41:41 +00001438class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001439 InstrItinClass itin,
1440 string opc, string asm, list<dag> pattern>
1441 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001442 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001443 let Inst{11-8} = opcod2;
1444 let Inst{4} = 1;
1445}
1446
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001447class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1448 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1449 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001450
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001451class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1452 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1453 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001454
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001455class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1456 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1457 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001458
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001459class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1460 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1461 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001462
Evan Cheng96581d32008-11-11 02:11:05 +00001463//===----------------------------------------------------------------------===//
1464
Bob Wilson5bafff32009-06-22 23:27:02 +00001465//===----------------------------------------------------------------------===//
1466// ARM NEON Instruction templates.
1467//
Evan Cheng13096642008-08-29 06:41:12 +00001468
Johnny Chencaa608e2010-03-20 00:17:00 +00001469class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1470 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1471 list<dag> pattern>
1472 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001473 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001474 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001475 let AsmString = !strconcat(
1476 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1477 !strconcat("\t", asm));
1478 let Pattern = pattern;
1479 list<Predicate> Predicates = [HasNEON];
1480}
1481
1482// Same as NeonI except it does not have a "data type" specifier.
1483class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001484 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001485 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001486 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001487 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001488 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001489 let Pattern = pattern;
1490 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001491}
1492
Evan Chengac0869d2009-11-21 06:21:52 +00001493class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1494 list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001495 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
Evan Chengac0869d2009-11-21 06:21:52 +00001496 pattern> {
Evan Cheng13096642008-08-29 06:41:12 +00001497}
Bob Wilson5bafff32009-06-22 23:27:02 +00001498
Evan Chengf81bf152009-11-23 21:57:23 +00001499class NI4<dag oops, dag iops, InstrItinClass itin, string opc,
1500 string asm, list<dag> pattern>
1501 : NeonXI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "",
1502 pattern> {
Anton Korobeynikovbaf31082009-08-08 13:35:48 +00001503}
1504
Bob Wilsonb07c1712009-10-07 21:53:04 +00001505class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1506 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001507 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001508 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1509 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001510 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001511 let Inst{23} = op23;
1512 let Inst{21-20} = op21_20;
1513 let Inst{11-8} = op11_8;
1514 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001515}
1516
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001517class NDataI<dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001518 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001519 : NeonI<oops, iops, AddrModeNone, IndexModeNone, NEONFrm, itin, opc, dt, asm,
Evan Chengf81bf152009-11-23 21:57:23 +00001520 cstr, pattern> {
1521 let Inst{31-25} = 0b1111001;
1522}
1523
1524class NDataXI<dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001525 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001526 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
Evan Chengac0869d2009-11-21 06:21:52 +00001527 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001528 let Inst{31-25} = 0b1111001;
1529}
1530
1531// NEON "one register and a modified immediate" format.
1532class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1533 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001534 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001535 string opc, string dt, string asm, string cstr, list<dag> pattern>
1536 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001537 let Inst{23} = op23;
1538 let Inst{21-19} = op21_19;
1539 let Inst{11-8} = op11_8;
1540 let Inst{7} = op7;
1541 let Inst{6} = op6;
1542 let Inst{5} = op5;
1543 let Inst{4} = op4;
1544}
1545
1546// NEON 2 vector register format.
1547class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1548 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001549 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001550 string opc, string dt, string asm, string cstr, list<dag> pattern>
1551 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1552 let Inst{24-23} = op24_23;
1553 let Inst{21-20} = op21_20;
1554 let Inst{19-18} = op19_18;
1555 let Inst{17-16} = op17_16;
1556 let Inst{11-7} = op11_7;
1557 let Inst{6} = op6;
1558 let Inst{4} = op4;
1559}
1560
1561// Same as N2V except it doesn't have a datatype suffix.
1562class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1563 bits<5> op11_7, bit op6, bit op4,
1564 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001565 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001566 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001567 let Inst{24-23} = op24_23;
1568 let Inst{21-20} = op21_20;
1569 let Inst{19-18} = op19_18;
1570 let Inst{17-16} = op17_16;
1571 let Inst{11-7} = op11_7;
1572 let Inst{6} = op6;
1573 let Inst{4} = op4;
1574}
1575
1576// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001577class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001578 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001579 string opc, string dt, string asm, string cstr, list<dag> pattern>
1580 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001581 let Inst{24} = op24;
1582 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001583 let Inst{11-8} = op11_8;
1584 let Inst{7} = op7;
1585 let Inst{6} = op6;
1586 let Inst{4} = op4;
1587}
1588
1589// NEON 3 vector register format.
1590class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001591 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001592 string opc, string dt, string asm, string cstr, list<dag> pattern>
1593 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1594 let Inst{24} = op24;
1595 let Inst{23} = op23;
1596 let Inst{21-20} = op21_20;
1597 let Inst{11-8} = op11_8;
1598 let Inst{6} = op6;
1599 let Inst{4} = op4;
1600}
1601
1602// Same as N3VX except it doesn't have a data type suffix.
1603class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1604 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001605 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001606 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001607 let Inst{24} = op24;
1608 let Inst{23} = op23;
1609 let Inst{21-20} = op21_20;
1610 let Inst{11-8} = op11_8;
1611 let Inst{6} = op6;
1612 let Inst{4} = op4;
1613}
1614
1615// NEON VMOVs between scalar and core registers.
1616class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001617 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001618 string opc, string dt, string asm, list<dag> pattern>
1619 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
1620 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001621 let Inst{27-20} = opcod1;
1622 let Inst{11-8} = opcod2;
1623 let Inst{6-5} = opcod3;
1624 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001625
1626 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001627 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001628 let AsmString = !strconcat(
1629 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1630 !strconcat("\t", asm));
1631 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001632 list<Predicate> Predicates = [HasNEON];
1633}
1634class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001635 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001636 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001637 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001638 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001639class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001640 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001641 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001642 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001643 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001644class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001645 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001646 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001647 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001648 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001649
1650// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1651// for single-precision FP.
1652class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1653 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1654}