blob: 76595fa2952a144432a07da9a9a20fff4b701e58 [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
147//===----------------------------------------------------------------------===//
148
Evan Cheng37f25d92008-08-28 23:39:26 +0000149// ARM Instruction templates.
150//
151
Johnny Chend68e1192009-12-15 17:24:14 +0000152class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
153 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000154 : Instruction {
155 let Namespace = "ARM";
156
Evan Chengedda31c2008-11-05 18:35:52 +0000157 // TSFlagsFields
Evan Cheng37f25d92008-08-28 23:39:26 +0000158 AddrMode AM = am;
159 bits<4> AddrModeBits = AM.Value;
160
161 SizeFlagVal SZ = sz;
162 bits<3> SizeFlag = SZ.Value;
163
164 IndexMode IM = im;
165 bits<2> IndexModeBits = IM.Value;
166
167 Format F = f;
168 bits<5> Form = F.Value;
Evan Chengedda31c2008-11-05 18:35:52 +0000169
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000170 Domain D = d;
171 bits<2> Dom = D.Value;
172
Evan Chengedda31c2008-11-05 18:35:52 +0000173 //
174 // Attributes specific to ARM instructions...
175 //
176 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000177 bit canXformTo16Bit = 0;
Evan Cheng37f25d92008-08-28 23:39:26 +0000178
179 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000180 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000181}
182
Johnny Chend68e1192009-12-15 17:24:14 +0000183class Encoding {
184 field bits<32> Inst;
185}
186
187class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
188 Format f, Domain d, string cstr, InstrItinClass itin>
189 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
190
191// This Encoding-less class is used by Thumb1 to specify the encoding bits later
192// on by adding flavors to specific instructions.
193class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
194 Format f, Domain d, string cstr, InstrItinClass itin>
195 : InstTemplate<am, sz, im, f, d, cstr, itin>;
196
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000197class PseudoInst<dag oops, dag iops, InstrItinClass itin,
198 string asm, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000199 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
200 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000201 let OutOperandList = oops;
202 let InOperandList = iops;
203 let AsmString = asm;
204 let Pattern = pattern;
205}
206
207// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000208class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000209 IndexMode im, Format f, InstrItinClass itin,
210 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000211 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000212 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000213 let OutOperandList = oops;
214 let InOperandList = !con(iops, (ops pred:$p));
215 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
216 let Pattern = pattern;
217 list<Predicate> Predicates = [IsARM];
218}
Jim Grosbachf6b28622009-12-14 18:31:20 +0000219// A few are not predicable
220class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
221 IndexMode im, Format f, InstrItinClass itin,
222 string opc, string asm, string cstr,
223 list<dag> pattern>
224 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
225 let OutOperandList = oops;
226 let InOperandList = iops;
227 let AsmString = !strconcat(opc, asm);
228 let Pattern = pattern;
229 let isPredicable = 0;
230 list<Predicate> Predicates = [IsARM];
231}
Evan Cheng37f25d92008-08-28 23:39:26 +0000232
233// Same as I except it can optionally modify CPSR. Note it's modeled as
234// an input operand since by default it's a zero register. It will
235// become an implicit def once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000236class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000237 IndexMode im, Format f, InstrItinClass itin,
238 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000239 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000240 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000241 let OutOperandList = oops;
242 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
243 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
244 let Pattern = pattern;
245 list<Predicate> Predicates = [IsARM];
246}
247
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000248// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000249class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000250 IndexMode im, Format f, InstrItinClass itin,
251 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000252 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000253 let OutOperandList = oops;
254 let InOperandList = iops;
255 let AsmString = asm;
256 let Pattern = pattern;
257 list<Predicate> Predicates = [IsARM];
258}
259
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000260class AI<dag oops, dag iops, Format f, InstrItinClass itin,
261 string opc, string asm, list<dag> pattern>
262 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
263 opc, asm, "", pattern>;
264class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
265 string opc, string asm, list<dag> pattern>
266 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
267 opc, asm, "", pattern>;
268class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000269 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000270 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000271 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000272class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
273 string opc, string asm, list<dag> pattern>
274 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
275 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000276
277// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000278class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
279 string opc, string asm, list<dag> pattern>
280 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
281 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000282 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000283}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000284class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
285 string asm, list<dag> pattern>
286 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
287 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000288 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000289}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000290class ABXIx2<dag oops, dag iops, InstrItinClass itin,
291 string asm, list<dag> pattern>
292 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
293 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000294
295// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000296class JTI<dag oops, dag iops, InstrItinClass itin,
297 string asm, list<dag> pattern>
298 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000299 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000300
Jim Grosbach5278eb82009-12-11 01:42:04 +0000301
302// Atomic load/store instructions
303
304class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
305 string opc, string asm, list<dag> pattern>
306 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
307 opc, asm, "", pattern> {
308 let Inst{27-23} = 0b00011;
309 let Inst{22-21} = opcod;
310 let Inst{20} = 1;
311 let Inst{11-0} = 0b111110011111;
312}
313class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
314 string opc, string asm, list<dag> pattern>
315 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
316 opc, asm, "", pattern> {
317 let Inst{27-23} = 0b00011;
318 let Inst{22-21} = opcod;
319 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000320 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000321}
322
Evan Cheng0d14fc82008-09-01 01:51:14 +0000323// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000324class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
325 string opc, string asm, list<dag> pattern>
326 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
327 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000328 let Inst{24-21} = opcod;
329 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000330}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000331class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
332 string opc, string asm, list<dag> pattern>
333 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
334 opc, asm, "", pattern> {
335 let Inst{24-21} = opcod;
336 let Inst{27-26} = {0,0};
337}
338class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000339 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000340 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000341 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000342 let Inst{24-21} = opcod;
343 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000344}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000345class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
346 string opc, string asm, list<dag> pattern>
347 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
348 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000349
Evan Cheng0d14fc82008-09-01 01:51:14 +0000350
351// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000352class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
353 string opc, string asm, list<dag> pattern>
354 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
355 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000356 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000357}
Evan Cheng93912732008-09-01 01:27:33 +0000358
359// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000360class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
361 string opc, string asm, list<dag> pattern>
362 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
363 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000364 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000365 let Inst{21} = 0; // W bit
366 let Inst{22} = 0; // B bit
367 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000368 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000369}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000370class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
371 string asm, list<dag> pattern>
372 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000373 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000374 let Inst{20} = 1; // L bit
375 let Inst{21} = 0; // W bit
376 let Inst{22} = 0; // B bit
377 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000378 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000379}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000380class AI2ldb<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} = 1; // 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 AXI2ldb<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} = 1; // 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}
Evan Cheng17222df2008-08-31 19:02:21 +0000400
Evan Cheng93912732008-09-01 01:27:33 +0000401// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000402class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
403 string opc, string asm, list<dag> pattern>
404 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
405 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000406 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000407 let Inst{21} = 0; // W bit
408 let Inst{22} = 0; // B bit
409 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000410 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000411}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000412class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
413 string asm, list<dag> pattern>
414 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000415 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000416 let Inst{20} = 0; // L bit
417 let Inst{21} = 0; // W bit
418 let Inst{22} = 0; // B bit
419 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000420 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000421}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000422class AI2stb<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} = 1; // 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 AXI2stb<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} = 1; // 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}
Evan Cheng93912732008-09-01 01:27:33 +0000442
Evan Cheng840917b2008-09-01 07:00:14 +0000443// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000444class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
445 string opc, string asm, string cstr, list<dag> pattern>
446 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
447 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000448 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000449 let Inst{21} = 1; // W bit
450 let Inst{22} = 0; // B bit
451 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000452 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000453}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000454class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
455 string opc, string asm, string cstr, list<dag> pattern>
456 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
457 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000458 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000459 let Inst{21} = 1; // W bit
460 let Inst{22} = 1; // B bit
461 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000462 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000463}
464
Evan Cheng840917b2008-09-01 07:00:14 +0000465// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000466class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
467 string opc, string asm, string cstr, list<dag> pattern>
468 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
469 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000470 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000471 let Inst{21} = 1; // W bit
472 let Inst{22} = 0; // B bit
473 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000474 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000475}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000476class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
477 string opc, string asm, string cstr, list<dag> pattern>
478 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
479 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000480 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000481 let Inst{21} = 1; // W bit
482 let Inst{22} = 1; // B bit
483 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000484 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000485}
486
Evan Cheng840917b2008-09-01 07:00:14 +0000487// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000488class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
489 string opc, string asm, string cstr, list<dag> pattern>
490 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
491 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000492 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000493 let Inst{21} = 0; // W bit
494 let Inst{22} = 0; // B bit
495 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000496 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000497}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000498class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
499 string opc, string asm, string cstr, list<dag> pattern>
500 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
501 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000502 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000503 let Inst{21} = 0; // W bit
504 let Inst{22} = 1; // B bit
505 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000506 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000507}
508
Evan Cheng840917b2008-09-01 07:00:14 +0000509// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000510class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
511 string opc, string asm, string cstr, list<dag> pattern>
512 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
513 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000514 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000515 let Inst{21} = 0; // W bit
516 let Inst{22} = 0; // B bit
517 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000518 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000519}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000520class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
521 string opc, string asm, string cstr, list<dag> pattern>
522 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
523 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000524 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000525 let Inst{21} = 0; // W bit
526 let Inst{22} = 1; // B bit
527 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000528 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000529}
530
Evan Cheng0d14fc82008-09-01 01:51:14 +0000531// addrmode3 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000532class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
533 string opc, string asm, list<dag> pattern>
534 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
535 opc, asm, "", pattern>;
536class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
537 string asm, list<dag> pattern>
538 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
539 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000540
Evan Cheng840917b2008-09-01 07:00:14 +0000541// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000542class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
543 string opc, string asm, list<dag> pattern>
544 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
545 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000546 let Inst{4} = 1;
547 let Inst{5} = 1; // H bit
548 let Inst{6} = 0; // S bit
549 let Inst{7} = 1;
550 let Inst{20} = 1; // L bit
551 let Inst{21} = 0; // W bit
552 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000553 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000554}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000555class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
556 string asm, list<dag> pattern>
557 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000558 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000559 let Inst{4} = 1;
560 let Inst{5} = 1; // H bit
561 let Inst{6} = 0; // S bit
562 let Inst{7} = 1;
563 let Inst{20} = 1; // L bit
564 let Inst{21} = 0; // W bit
565 let Inst{24} = 1; // P bit
566}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000567class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
568 string opc, string asm, list<dag> pattern>
569 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
570 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000571 let Inst{4} = 1;
572 let Inst{5} = 1; // H bit
573 let Inst{6} = 1; // S bit
574 let Inst{7} = 1;
575 let Inst{20} = 1; // L bit
576 let Inst{21} = 0; // W bit
577 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000578 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000579}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000580class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
581 string asm, list<dag> pattern>
582 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000583 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000584 let Inst{4} = 1;
585 let Inst{5} = 1; // H bit
586 let Inst{6} = 1; // S bit
587 let Inst{7} = 1;
588 let Inst{20} = 1; // L bit
589 let Inst{21} = 0; // W bit
590 let Inst{24} = 1; // P bit
591}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000592class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
593 string opc, string asm, list<dag> pattern>
594 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
595 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000596 let Inst{4} = 1;
597 let Inst{5} = 0; // H bit
598 let Inst{6} = 1; // S bit
599 let Inst{7} = 1;
600 let Inst{20} = 1; // L bit
601 let Inst{21} = 0; // W bit
602 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000603 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000604}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000605class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
606 string asm, list<dag> pattern>
607 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000608 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000609 let Inst{4} = 1;
610 let Inst{5} = 0; // H bit
611 let Inst{6} = 1; // S bit
612 let Inst{7} = 1;
613 let Inst{20} = 1; // L bit
614 let Inst{21} = 0; // W bit
615 let Inst{24} = 1; // P bit
616}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000617class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
618 string opc, string asm, list<dag> pattern>
619 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
620 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000621 let Inst{4} = 1;
622 let Inst{5} = 0; // H bit
623 let Inst{6} = 1; // S bit
624 let Inst{7} = 1;
625 let Inst{20} = 0; // L bit
626 let Inst{21} = 0; // W bit
627 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000628 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000629}
630
631// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000632class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
633 string opc, string asm, list<dag> pattern>
634 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
635 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000636 let Inst{4} = 1;
637 let Inst{5} = 1; // H bit
638 let Inst{6} = 0; // S bit
639 let Inst{7} = 1;
640 let Inst{20} = 0; // L bit
641 let Inst{21} = 0; // W bit
642 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000643 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000644}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000645class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
646 string asm, list<dag> pattern>
647 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000648 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000649 let Inst{4} = 1;
650 let Inst{5} = 1; // H bit
651 let Inst{6} = 0; // S bit
652 let Inst{7} = 1;
653 let Inst{20} = 0; // L bit
654 let Inst{21} = 0; // W bit
655 let Inst{24} = 1; // P bit
656}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000657class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
658 string opc, string asm, list<dag> pattern>
659 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
660 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000661 let Inst{4} = 1;
662 let Inst{5} = 1; // H bit
663 let Inst{6} = 1; // S bit
664 let Inst{7} = 1;
665 let Inst{20} = 0; // L bit
666 let Inst{21} = 0; // W bit
667 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000668 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000669}
670
671// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000672class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
673 string opc, string asm, string cstr, list<dag> pattern>
674 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
675 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000676 let Inst{4} = 1;
677 let Inst{5} = 1; // H bit
678 let Inst{6} = 0; // S bit
679 let Inst{7} = 1;
680 let Inst{20} = 1; // L bit
681 let Inst{21} = 1; // W bit
682 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000683 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000684}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000685class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
686 string opc, string asm, string cstr, list<dag> pattern>
687 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
688 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000689 let Inst{4} = 1;
690 let Inst{5} = 1; // H bit
691 let Inst{6} = 1; // S bit
692 let Inst{7} = 1;
693 let Inst{20} = 1; // L bit
694 let Inst{21} = 1; // W bit
695 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000696 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000697}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000698class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
699 string opc, string asm, string cstr, list<dag> pattern>
700 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
701 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000702 let Inst{4} = 1;
703 let Inst{5} = 0; // H bit
704 let Inst{6} = 1; // S bit
705 let Inst{7} = 1;
706 let Inst{20} = 1; // L bit
707 let Inst{21} = 1; // W bit
708 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000709 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000710}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000711class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
712 string opc, string asm, string cstr, list<dag> pattern>
713 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
714 opc, asm, cstr, pattern> {
715 let Inst{4} = 1;
716 let Inst{5} = 0; // H bit
717 let Inst{6} = 1; // S bit
718 let Inst{7} = 1;
719 let Inst{20} = 0; // L bit
720 let Inst{21} = 1; // W bit
721 let Inst{24} = 1; // P bit
722 let Inst{27-25} = 0b000;
723}
724
Evan Cheng840917b2008-09-01 07:00:14 +0000725
726// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000727class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
728 string opc, string asm, string cstr, list<dag> pattern>
729 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
730 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000731 let Inst{4} = 1;
732 let Inst{5} = 1; // H bit
733 let Inst{6} = 0; // S bit
734 let Inst{7} = 1;
735 let Inst{20} = 0; // L bit
736 let Inst{21} = 1; // W bit
737 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000738 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000739}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000740class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
741 string opc, string asm, string cstr, list<dag> pattern>
742 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
743 opc, asm, cstr, pattern> {
744 let Inst{4} = 1;
745 let Inst{5} = 1; // H bit
746 let Inst{6} = 1; // S bit
747 let Inst{7} = 1;
748 let Inst{20} = 0; // L bit
749 let Inst{21} = 1; // W bit
750 let Inst{24} = 1; // P bit
751 let Inst{27-25} = 0b000;
752}
Evan Cheng840917b2008-09-01 07:00:14 +0000753
754// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000755class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
756 string opc, string asm, string cstr, list<dag> pattern>
757 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
758 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000759 let Inst{4} = 1;
760 let Inst{5} = 1; // H bit
761 let Inst{6} = 0; // S bit
762 let Inst{7} = 1;
763 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000764 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000765 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000766 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000767}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000768class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
769 string opc, string asm, string cstr, list<dag> pattern>
770 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
771 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000772 let Inst{4} = 1;
773 let Inst{5} = 1; // H bit
774 let Inst{6} = 1; // S bit
775 let Inst{7} = 1;
776 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000777 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000778 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000779 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000780}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000781class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
782 string opc, string asm, string cstr, list<dag> pattern>
783 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
784 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000785 let Inst{4} = 1;
786 let Inst{5} = 0; // H bit
787 let Inst{6} = 1; // S bit
788 let Inst{7} = 1;
789 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000790 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000791 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000792 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000793}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000794class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
795 string opc, string asm, string cstr, list<dag> pattern>
796 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
797 opc, asm, cstr, pattern> {
798 let Inst{4} = 1;
799 let Inst{5} = 0; // H bit
800 let Inst{6} = 1; // S bit
801 let Inst{7} = 1;
802 let Inst{20} = 0; // L bit
803 let Inst{21} = 0; // W bit
804 let Inst{24} = 0; // P bit
805 let Inst{27-25} = 0b000;
806}
Evan Cheng840917b2008-09-01 07:00:14 +0000807
808// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000809class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
810 string opc, string asm, string cstr, list<dag> pattern>
811 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
812 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000813 let Inst{4} = 1;
814 let Inst{5} = 1; // H bit
815 let Inst{6} = 0; // S bit
816 let Inst{7} = 1;
817 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000818 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000819 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000820 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000821}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000822class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
823 string opc, string asm, string cstr, list<dag> pattern>
824 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
825 opc, asm, cstr, pattern> {
826 let Inst{4} = 1;
827 let Inst{5} = 1; // H bit
828 let Inst{6} = 1; // S bit
829 let Inst{7} = 1;
830 let Inst{20} = 0; // L bit
831 let Inst{21} = 0; // W bit
832 let Inst{24} = 0; // P bit
833 let Inst{27-25} = 0b000;
834}
Evan Cheng840917b2008-09-01 07:00:14 +0000835
836
Evan Cheng0d14fc82008-09-01 01:51:14 +0000837// addrmode4 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000838class AXI4ld<dag oops, dag iops, Format f, InstrItinClass itin,
839 string asm, list<dag> pattern>
840 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
841 asm, "", pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000842 let Inst{20} = 1; // L bit
843 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000844 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000845}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000846class AXI4st<dag oops, dag iops, Format f, InstrItinClass itin,
847 string asm, list<dag> pattern>
848 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
849 asm, "", pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000850 let Inst{20} = 0; // L bit
851 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000852 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000853}
Evan Cheng37f25d92008-08-28 23:39:26 +0000854
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000855// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000856class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
857 string opc, string asm, list<dag> pattern>
858 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
859 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000860 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000861 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000862 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000863}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000864class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
865 string opc, string asm, list<dag> pattern>
866 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
867 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000868 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000869 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000870}
871
872// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000873class AMul2I<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> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000877 let Inst{7-4} = 0b1001;
878 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000879 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000880}
Evan Cheng37f25d92008-08-28 23:39:26 +0000881
Evan Chengeb4f52e2008-11-06 03:35:07 +0000882// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000883class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
884 string opc, string asm, list<dag> pattern>
885 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
886 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000887 let Inst{4} = 0;
888 let Inst{7} = 1;
889 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000890 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000891}
892
Evan Cheng97f48c32008-11-06 22:15:19 +0000893// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000894class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
895 string opc, string asm, list<dag> pattern>
896 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
897 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000898 let Inst{7-4} = 0b0111;
899 let Inst{27-20} = opcod;
900}
901
Evan Cheng8b59db32008-11-07 01:41:35 +0000902// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000903class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
904 string opc, string asm, list<dag> pattern>
905 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
906 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000907 let Inst{27-20} = opcod;
908}
909
Evan Cheng37f25d92008-08-28 23:39:26 +0000910//===----------------------------------------------------------------------===//
911
912// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
913class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
914 list<Predicate> Predicates = [IsARM];
915}
916class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
917 list<Predicate> Predicates = [IsARM, HasV5TE];
918}
919class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
920 list<Predicate> Predicates = [IsARM, HasV6];
921}
Evan Cheng13096642008-08-29 06:41:12 +0000922
923//===----------------------------------------------------------------------===//
924//
925// Thumb Instruction Format Definitions.
926//
927
Evan Cheng13096642008-08-29 06:41:12 +0000928// TI - Thumb instruction.
929
Evan Cheng446c4282009-07-11 06:43:01 +0000930class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000931 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000932 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000933 let OutOperandList = oops;
934 let InOperandList = iops;
Evan Cheng13096642008-08-29 06:41:12 +0000935 let AsmString = asm;
936 let Pattern = pattern;
937 list<Predicate> Predicates = [IsThumb];
938}
939
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000940class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
941 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000942
Evan Cheng35d6c412009-08-04 23:47:55 +0000943// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000944class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
945 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000946
Johnny Chend68e1192009-12-15 17:24:14 +0000947// tBL, tBX 32-bit instructions
948class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
949 dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
950 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>, Encoding {
951 let Inst{31-27} = opcod1;
952 let Inst{15-14} = opcod2;
953 let Inst{12} = opcod3;
954}
Evan Cheng13096642008-08-29 06:41:12 +0000955
956// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000957class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
958 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000959
Evan Cheng09c39fc2009-06-23 19:38:13 +0000960// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000961class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000962 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000963 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000964 let OutOperandList = oops;
965 let InOperandList = iops;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000966 let AsmString = asm;
967 let Pattern = pattern;
968 list<Predicate> Predicates = [IsThumb1Only];
969}
970
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000971class T1I<dag oops, dag iops, InstrItinClass itin,
972 string asm, list<dag> pattern>
973 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
974class T1Ix2<dag oops, dag iops, InstrItinClass itin,
975 string asm, list<dag> pattern>
976 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
977class T1JTI<dag oops, dag iops, InstrItinClass itin,
978 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +0000979 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000980
981// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000982class T1It<dag oops, dag iops, InstrItinClass itin,
983 string asm, list<dag> pattern>
984 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
985 asm, "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000986
987// Thumb1 instruction that can either be predicated or set CPSR.
988class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000989 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000990 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000991 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000992 let OutOperandList = !con(oops, (ops s_cc_out:$s));
993 let InOperandList = !con(iops, (ops pred:$p));
994 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
995 let Pattern = pattern;
996 list<Predicate> Predicates = [IsThumb1Only];
997}
998
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000999class T1sI<dag oops, dag iops, InstrItinClass itin,
1000 string opc, string asm, list<dag> pattern>
1001 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001002
1003// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001004class T1sIt<dag oops, dag iops, InstrItinClass itin,
1005 string opc, string asm, list<dag> pattern>
1006 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001007 "$lhs = $dst", pattern>;
1008
1009// Thumb1 instruction that can be predicated.
1010class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001011 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001012 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001013 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001014 let OutOperandList = oops;
1015 let InOperandList = !con(iops, (ops pred:$p));
1016 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1017 let Pattern = pattern;
1018 list<Predicate> Predicates = [IsThumb1Only];
1019}
1020
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001021class T1pI<dag oops, dag iops, InstrItinClass itin,
1022 string opc, string asm, list<dag> pattern>
1023 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001024
1025// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001026class T1pIt<dag oops, dag iops, InstrItinClass itin,
1027 string opc, string asm, list<dag> pattern>
1028 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001029 "$lhs = $dst", pattern>;
1030
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001031class T1pI1<dag oops, dag iops, InstrItinClass itin,
1032 string opc, string asm, list<dag> pattern>
1033 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1034class T1pI2<dag oops, dag iops, InstrItinClass itin,
1035 string opc, string asm, list<dag> pattern>
1036 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1037class T1pI4<dag oops, dag iops, InstrItinClass itin,
1038 string opc, string asm, list<dag> pattern>
1039 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1040class T1pIs<dag oops, dag iops,
1041 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1042 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001043
Johnny Chenbbc71b22009-12-16 02:32:54 +00001044class Encoding16 : Encoding {
1045 let Inst{31-16} = 0x0000;
1046}
1047
Johnny Chend68e1192009-12-15 17:24:14 +00001048// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001049class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001050 let Inst{15-10} = opcode;
1051}
1052
1053// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001054class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001055 let Inst{15-14} = 0b00;
1056 let Inst{13-9} = opcode;
1057}
1058
1059// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001060class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001061 let Inst{15-10} = 0b010000;
1062 let Inst{9-6} = opcode;
1063}
1064
1065// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001066class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001067 let Inst{15-10} = 0b010001;
1068 let Inst{9-6} = opcode;
1069}
1070
1071// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001072class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001073 let Inst{15-12} = opA;
1074 let Inst{11-9} = opB;
1075}
1076class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1077class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1078class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1079class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1080class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1081
1082// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001083class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001084 let Inst{15-12} = 0b1011;
1085 let Inst{11-5} = opcode;
1086}
1087
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001088// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1089class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001090 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001091 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001092 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001093 let OutOperandList = oops;
1094 let InOperandList = !con(iops, (ops pred:$p));
1095 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1096 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001097 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001098}
1099
1100// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1101// an input operand since by default it's a zero register. It will
1102// become an implicit def once it's "flipped".
1103// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1104// more consistent.
1105class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001106 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001107 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001108 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001109 let OutOperandList = oops;
1110 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
1111 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1112 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001113 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001114}
1115
1116// Special cases
1117class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001118 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001119 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001120 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001121 let OutOperandList = oops;
1122 let InOperandList = iops;
Evan Chengf49810c2009-06-23 17:48:47 +00001123 let AsmString = asm;
1124 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001125 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001126}
1127
Jim Grosbachd1228742009-12-01 18:10:36 +00001128class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1129 InstrItinClass itin,
1130 string asm, string cstr, list<dag> pattern>
1131 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1132 let OutOperandList = oops;
1133 let InOperandList = iops;
1134 let AsmString = asm;
1135 let Pattern = pattern;
1136 list<Predicate> Predicates = [IsThumb1Only];
1137}
1138
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001139class T2I<dag oops, dag iops, InstrItinClass itin,
1140 string opc, string asm, list<dag> pattern>
1141 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1142class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1143 string opc, string asm, list<dag> pattern>
1144 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
1145class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1146 string opc, string asm, list<dag> pattern>
1147 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1148class T2Iso<dag oops, dag iops, InstrItinClass itin,
1149 string opc, string asm, list<dag> pattern>
1150 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1151class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1152 string opc, string asm, list<dag> pattern>
1153 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001154class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001155 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001156 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1157 pattern> {
1158 let Inst{31-27} = 0b11101;
1159 let Inst{26-25} = 0b00;
1160 let Inst{24} = P;
1161 let Inst{23} = ?; // The U bit.
1162 let Inst{22} = 1;
1163 let Inst{21} = W;
1164 let Inst{20} = load;
1165}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001166
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001167class T2sI<dag oops, dag iops, InstrItinClass itin,
1168 string opc, string asm, list<dag> pattern>
1169 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001170
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001171class T2XI<dag oops, dag iops, InstrItinClass itin,
1172 string asm, list<dag> pattern>
1173 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1174class T2JTI<dag oops, dag iops, InstrItinClass itin,
1175 string asm, list<dag> pattern>
1176 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001177
Evan Cheng5adb66a2009-09-28 09:14:39 +00001178class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1179 string opc, string asm, list<dag> pattern>
1180 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1181
1182
Evan Chenge88d5ce2009-07-02 07:28:31 +00001183// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001184class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1185 dag oops, dag iops,
1186 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001187 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001188 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001189 let OutOperandList = oops;
1190 let InOperandList = !con(iops, (ops pred:$p));
1191 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1192 let Pattern = pattern;
1193 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001194 let Inst{31-27} = 0b11111;
1195 let Inst{26-25} = 0b00;
1196 let Inst{24} = signed;
1197 let Inst{23} = 0;
1198 let Inst{22-21} = opcod;
1199 let Inst{20} = load;
1200 let Inst{11} = 1;
1201 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1202 let Inst{10} = pre; // The P bit.
1203 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001204}
1205
Johnny Chenadc77332010-02-26 22:04:29 +00001206// Helper class for disassembly only
1207// A6.3.16 & A6.3.17
1208// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1209class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1210 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1211 : T2I<oops, iops, itin, opc, asm, pattern> {
1212 let Inst{31-27} = 0b11111;
1213 let Inst{26-24} = 0b011;
1214 let Inst{23} = long;
1215 let Inst{22-20} = op22_20;
1216 let Inst{7-4} = op7_4;
1217}
1218
David Goodwinc9d138f2009-07-27 19:59:26 +00001219// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1220class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1221 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1222}
1223
1224// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1225class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1226 list<Predicate> Predicates = [IsThumb1Only];
1227}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001228
Evan Cheng9cb9e672009-06-27 02:26:13 +00001229// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1230class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001231 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001232}
1233
Evan Cheng13096642008-08-29 06:41:12 +00001234//===----------------------------------------------------------------------===//
1235
Evan Cheng96581d32008-11-11 02:11:05 +00001236//===----------------------------------------------------------------------===//
1237// ARM VFP Instruction templates.
1238//
1239
David Goodwin3ca524e2009-07-10 17:03:29 +00001240// Almost all VFP instructions are predicable.
1241class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001242 IndexMode im, Format f, InstrItinClass itin,
1243 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001244 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001245 let OutOperandList = oops;
1246 let InOperandList = !con(iops, (ops pred:$p));
1247 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1248 let Pattern = pattern;
1249 list<Predicate> Predicates = [HasVFP2];
1250}
1251
1252// Special cases
1253class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001254 IndexMode im, Format f, InstrItinClass itin,
1255 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001256 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001257 let OutOperandList = oops;
1258 let InOperandList = iops;
1259 let AsmString = asm;
1260 let Pattern = pattern;
1261 list<Predicate> Predicates = [HasVFP2];
1262}
1263
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001264class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1265 string opc, string asm, list<dag> pattern>
1266 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1267 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001268
Evan Chengcd8e66a2008-11-11 21:48:44 +00001269// ARM VFP addrmode5 loads and stores
1270class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001271 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001272 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001273 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001274 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001275 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001276 let Inst{27-24} = opcod1;
1277 let Inst{21-20} = opcod2;
1278 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001279
1280 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1281 let Dom = VFPNeonDomain.Value;
Evan Cheng96581d32008-11-11 02:11:05 +00001282}
1283
Evan Chengcd8e66a2008-11-11 21:48:44 +00001284class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001285 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001286 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001287 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001288 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001289 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001290 let Inst{27-24} = opcod1;
1291 let Inst{21-20} = opcod2;
1292 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001293}
1294
Evan Chengcd8e66a2008-11-11 21:48:44 +00001295// Load / store multiple
Evan Cheng10bf7342009-09-09 23:55:03 +00001296class AXDI5<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001297 string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001298 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001299 VFPLdStMulFrm, itin, asm, "", pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001300 // TODO: Mark the instructions with the appropriate subtarget info.
1301 let Inst{27-25} = 0b110;
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 Chengcd8e66a2008-11-11 21:48:44 +00001306}
1307
Evan Cheng10bf7342009-09-09 23:55:03 +00001308class AXSI5<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001309 string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001310 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001311 VFPLdStMulFrm, itin, asm, "", pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001312 // TODO: Mark the instructions with the appropriate subtarget info.
1313 let Inst{27-25} = 0b110;
1314 let Inst{11-8} = 0b1010;
1315}
1316
Evan Cheng96581d32008-11-11 02:11:05 +00001317// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001318class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1319 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1320 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001321 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001322 let Inst{27-23} = opcod1;
1323 let Inst{21-20} = opcod2;
1324 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001325 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001326 let Inst{7-6} = opcod4;
1327 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001328}
1329
1330// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001331class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1332 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001333 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001334 let Inst{27-23} = opcod1;
1335 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001336 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001337 let Inst{6} = op6;
1338 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001339}
1340
1341// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001342class ASuI<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} = 0b1010;
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
David Goodwin338268c2009-08-10 22:17:39 +00001354// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001355// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001356class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1357 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1358 string asm, list<dag> pattern>
1359 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1360 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001361 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1362}
1363
Evan Cheng96581d32008-11-11 02:11:05 +00001364// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001365class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1366 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001367 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001368 let Inst{27-23} = opcod1;
1369 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001370 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001371 let Inst{6} = op6;
1372 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001373}
1374
David Goodwin338268c2009-08-10 22:17:39 +00001375// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001376// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001377class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1378 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
1379 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001380 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1381}
1382
Evan Cheng80a11982008-11-12 06:41:41 +00001383// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001384class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1385 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1386 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001387 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001388 let Inst{27-23} = opcod1;
1389 let Inst{21-20} = opcod2;
1390 let Inst{19-16} = opcod3;
1391 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001392 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001393 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001394}
1395
Johnny Chen811663f2010-02-11 18:47:03 +00001396// VFP conversion between floating-point and fixed-point
1397class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1398 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1399 list<dag> pattern>
1400 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1401 // size (fixed-point number): sx == 0 ? 16 : 32
1402 let Inst{7} = op5; // sx
1403}
1404
David Goodwin338268c2009-08-10 22:17:39 +00001405// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001406class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001407 dag oops, dag iops, InstrItinClass itin,
1408 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001409 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1410 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001411 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1412}
1413
Evan Cheng80a11982008-11-12 06:41:41 +00001414class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001415 InstrItinClass itin,
1416 string opc, string asm, list<dag> pattern>
1417 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001418 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001419 let Inst{11-8} = opcod2;
1420 let Inst{4} = 1;
1421}
1422
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001423class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1424 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1425 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001426
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001427class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1428 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1429 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001430
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001431class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1432 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1433 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001434
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001435class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1436 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1437 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001438
Evan Cheng96581d32008-11-11 02:11:05 +00001439//===----------------------------------------------------------------------===//
1440
Bob Wilson5bafff32009-06-22 23:27:02 +00001441//===----------------------------------------------------------------------===//
1442// ARM NEON Instruction templates.
1443//
Evan Cheng13096642008-08-29 06:41:12 +00001444
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001445class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001446 string opc, string dt, string asm, string cstr, list<dag> pattern>
1447 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
1448 let OutOperandList = oops;
1449 let InOperandList = !con(iops, (ops pred:$p));
1450 let AsmString = !strconcat(
1451 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1452 !strconcat("\t", asm));
1453 let Pattern = pattern;
1454 list<Predicate> Predicates = [HasNEON];
1455}
1456
1457// Same as NeonI except it does not have a "data type" specifier.
1458class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001459 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001460 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001461 let OutOperandList = oops;
Evan Chengac0869d2009-11-21 06:21:52 +00001462 let InOperandList = !con(iops, (ops pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001463 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001464 let Pattern = pattern;
1465 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001466}
1467
Evan Chengac0869d2009-11-21 06:21:52 +00001468class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1469 list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001470 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
Evan Chengac0869d2009-11-21 06:21:52 +00001471 pattern> {
Evan Cheng13096642008-08-29 06:41:12 +00001472}
Bob Wilson5bafff32009-06-22 23:27:02 +00001473
Evan Chengf81bf152009-11-23 21:57:23 +00001474class NI4<dag oops, dag iops, InstrItinClass itin, string opc,
1475 string asm, list<dag> pattern>
1476 : NeonXI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "",
1477 pattern> {
Anton Korobeynikovbaf31082009-08-08 13:35:48 +00001478}
1479
Bob Wilsonb07c1712009-10-07 21:53:04 +00001480class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1481 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001482 string opc, string dt, string asm, string cstr, list<dag> pattern>
1483 : NeonI<oops, iops, AddrMode6, IndexModeNone, itin, opc, dt, asm, cstr,
1484 pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001485 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001486 let Inst{23} = op23;
1487 let Inst{21-20} = op21_20;
1488 let Inst{11-8} = op11_8;
1489 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001490}
1491
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001492class NDataI<dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001493 string opc, string dt, string asm, string cstr, list<dag> pattern>
1494 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, dt, asm,
1495 cstr, pattern> {
1496 let Inst{31-25} = 0b1111001;
1497}
1498
1499class NDataXI<dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001500 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001501 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
Evan Chengac0869d2009-11-21 06:21:52 +00001502 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001503 let Inst{31-25} = 0b1111001;
1504}
1505
1506// NEON "one register and a modified immediate" format.
1507class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1508 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001509 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001510 string opc, string dt, string asm, string cstr, list<dag> pattern>
1511 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001512 let Inst{23} = op23;
1513 let Inst{21-19} = op21_19;
1514 let Inst{11-8} = op11_8;
1515 let Inst{7} = op7;
1516 let Inst{6} = op6;
1517 let Inst{5} = op5;
1518 let Inst{4} = op4;
1519}
1520
1521// NEON 2 vector register format.
1522class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1523 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001524 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001525 string opc, string dt, string asm, string cstr, list<dag> pattern>
1526 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1527 let Inst{24-23} = op24_23;
1528 let Inst{21-20} = op21_20;
1529 let Inst{19-18} = op19_18;
1530 let Inst{17-16} = op17_16;
1531 let Inst{11-7} = op11_7;
1532 let Inst{6} = op6;
1533 let Inst{4} = op4;
1534}
1535
1536// Same as N2V except it doesn't have a datatype suffix.
1537class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1538 bits<5> op11_7, bit op6, bit op4,
1539 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001540 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001541 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001542 let Inst{24-23} = op24_23;
1543 let Inst{21-20} = op21_20;
1544 let Inst{19-18} = op19_18;
1545 let Inst{17-16} = op17_16;
1546 let Inst{11-7} = op11_7;
1547 let Inst{6} = op6;
1548 let Inst{4} = op4;
1549}
1550
1551// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001552class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001553 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001554 string opc, string dt, string asm, string cstr, list<dag> pattern>
1555 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001556 let Inst{24} = op24;
1557 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001558 let Inst{11-8} = op11_8;
1559 let Inst{7} = op7;
1560 let Inst{6} = op6;
1561 let Inst{4} = op4;
1562}
1563
1564// NEON 3 vector register format.
1565class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001566 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001567 string opc, string dt, string asm, string cstr, list<dag> pattern>
1568 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1569 let Inst{24} = op24;
1570 let Inst{23} = op23;
1571 let Inst{21-20} = op21_20;
1572 let Inst{11-8} = op11_8;
1573 let Inst{6} = op6;
1574 let Inst{4} = op4;
1575}
1576
1577// Same as N3VX except it doesn't have a data type suffix.
1578class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1579 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001580 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001581 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001582 let Inst{24} = op24;
1583 let Inst{23} = op23;
1584 let Inst{21-20} = op21_20;
1585 let Inst{11-8} = op11_8;
1586 let Inst{6} = op6;
1587 let Inst{4} = op4;
1588}
1589
1590// NEON VMOVs between scalar and core registers.
1591class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001592 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001593 string opc, string dt, string asm, list<dag> pattern>
1594 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
1595 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001596 let Inst{27-20} = opcod1;
1597 let Inst{11-8} = opcod2;
1598 let Inst{6-5} = opcod3;
1599 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001600
1601 let OutOperandList = oops;
1602 let InOperandList = !con(iops, (ops pred:$p));
1603 let AsmString = !strconcat(
1604 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1605 !strconcat("\t", asm));
1606 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001607 list<Predicate> Predicates = [HasNEON];
1608}
1609class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001610 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001611 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001612 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001613 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001614class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001615 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001616 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001617 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001618 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001619class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001620 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001621 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001622 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001623 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001624
1625// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1626// for single-precision FP.
1627class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1628 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1629}