blob: deff83b1c9910108e3262e489076bb8a9035930b [file] [log] [blame]
Evan Cheng7b0249b2008-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 Cheng9d2c9232008-11-13 23:36:57 +000022def Pseudo : Format<0>;
23def MulFrm : Format<1>;
24def BrFrm : Format<2>;
25def BrMiscFrm : Format<3>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000026
Evan Cheng9d2c9232008-11-13 23:36:57 +000027def DPFrm : Format<4>;
28def DPSoRegFrm : Format<5>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000029
Evan Cheng9d2c9232008-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 Cheng7b0249b2008-08-28 23:39:26 +000035
Evan Cheng9d2c9232008-11-13 23:36:57 +000036def ArithMiscFrm : Format<11>;
37def ExtFrm : Format<12>;
Evan Chengbb786b32008-11-11 21:48:44 +000038
Evan Cheng9d2c9232008-11-13 23:36:57 +000039def VFPUnaryFrm : Format<13>;
40def VFPBinaryFrm : Format<14>;
41def VFPConv1Frm : Format<15>;
42def VFPConv2Frm : Format<16>;
43def VFPConv3Frm : Format<17>;
44def VFPConv4Frm : Format<18>;
45def VFPConv5Frm : Format<19>;
46def VFPLdStFrm : Format<20>;
47def VFPLdStMulFrm : Format<21>;
48def VFPMiscFrm : Format<22>;
Evan Chengbb786b32008-11-11 21:48:44 +000049
Evan Cheng9d2c9232008-11-13 23:36:57 +000050def ThumbFrm : Format<23>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000051
Bob Wilsone60fee02009-06-22 23:27:02 +000052def NEONFrm : Format<24>;
53def NEONGetLnFrm : Format<25>;
54def NEONSetLnFrm : Format<26>;
55def NEONDupFrm : Format<27>;
56
Evan Cheng9aa4cd32009-07-08 01:46:35 +000057// Misc flags.
58
Evan Cheng86a926a2008-11-05 18:35:52 +000059// the instruction has a Rn register operand.
Evan Cheng9aa4cd32009-07-08 01:46:35 +000060// UnaryDP - Indicates this is a unary data processing instruction, i.e.
61// it doesn't have a Rn operand.
62class UnaryDP { bit isUnaryDataProc = 1; }
63
64// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
65// a 16-bit Thumb instruction if certain conditions are met.
66class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000067
Evan Cheng7b0249b2008-08-28 23:39:26 +000068//===----------------------------------------------------------------------===//
Evan Cheng532cdc52009-06-29 07:51:04 +000069// ARM Instruction flags. These need to match ARMInstrInfo.h.
70//
71
72// Addressing mode.
73class AddrMode<bits<4> val> {
74 bits<4> Value = val;
75}
76def AddrModeNone : AddrMode<0>;
77def AddrMode1 : AddrMode<1>;
78def AddrMode2 : AddrMode<2>;
79def AddrMode3 : AddrMode<3>;
80def AddrMode4 : AddrMode<4>;
81def AddrMode5 : AddrMode<5>;
Bob Wilson970a10d2009-07-01 23:16:05 +000082def AddrMode6 : AddrMode<6>;
83def AddrModeT1_1 : AddrMode<7>;
84def AddrModeT1_2 : AddrMode<8>;
85def AddrModeT1_4 : AddrMode<9>;
86def AddrModeT1_s : AddrMode<10>;
David Goodwind1147262009-07-22 22:24:31 +000087def AddrModeT2_i12: AddrMode<11>;
Bob Wilson970a10d2009-07-01 23:16:05 +000088def AddrModeT2_i8 : AddrMode<12>;
89def AddrModeT2_so : AddrMode<13>;
90def AddrModeT2_pc : AddrMode<14>;
91def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng532cdc52009-06-29 07:51:04 +000092
93// Instruction size.
94class SizeFlagVal<bits<3> val> {
95 bits<3> Value = val;
96}
97def SizeInvalid : SizeFlagVal<0>; // Unset.
98def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
99def Size8Bytes : SizeFlagVal<2>;
100def Size4Bytes : SizeFlagVal<3>;
101def Size2Bytes : SizeFlagVal<4>;
102
103// Load / store index mode.
104class IndexMode<bits<2> val> {
105 bits<2> Value = val;
106}
107def IndexModeNone : IndexMode<0>;
108def IndexModePre : IndexMode<1>;
109def IndexModePost : IndexMode<2>;
110
111//===----------------------------------------------------------------------===//
Evan Cheng7b0249b2008-08-28 23:39:26 +0000112
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000113// ARM special operands.
114//
115
116// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
117// register whose default is 0 (no register).
118def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
119 (ops (i32 14), (i32 zero_reg))> {
120 let PrintMethod = "printPredicateOperand";
121}
122
123// Conditional code result for instructions whose 's' bit is set, e.g. subs.
124def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
125 let PrintMethod = "printSBitModifierOperand";
126}
127
128// Same as cc_out except it defaults to setting CPSR.
129def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
130 let PrintMethod = "printSBitModifierOperand";
131}
132
133//===----------------------------------------------------------------------===//
134
Evan Cheng7b0249b2008-08-28 23:39:26 +0000135// ARM Instruction templates.
136//
137
Evan Chengbe998242008-11-06 08:47:38 +0000138class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
David Goodwincfd67652009-08-06 16:52:47 +0000139 Format f, string cstr, InstrItinClass itin>
Evan Cheng7b0249b2008-08-28 23:39:26 +0000140 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +0000141 field bits<32> Inst;
142
Evan Cheng7b0249b2008-08-28 23:39:26 +0000143 let Namespace = "ARM";
144
Evan Cheng86a926a2008-11-05 18:35:52 +0000145 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +0000146 AddrMode AM = am;
147 bits<4> AddrModeBits = AM.Value;
148
149 SizeFlagVal SZ = sz;
150 bits<3> SizeFlag = SZ.Value;
151
152 IndexMode IM = im;
153 bits<2> IndexModeBits = IM.Value;
154
155 Format F = f;
156 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +0000157
158 //
159 // Attributes specific to ARM instructions...
160 //
161 bit isUnaryDataProc = 0;
Evan Cheng9aa4cd32009-07-08 01:46:35 +0000162 bit canXformTo16Bit = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +0000163
164 let Constraints = cstr;
David Goodwincfd67652009-08-06 16:52:47 +0000165 let Itinerary = itin;
Evan Cheng7b0249b2008-08-28 23:39:26 +0000166}
167
David Goodwincfd67652009-08-06 16:52:47 +0000168class PseudoInst<dag oops, dag iops, InstrItinClass itin,
169 string asm, list<dag> pattern>
170 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, "", itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000171 let OutOperandList = oops;
172 let InOperandList = iops;
173 let AsmString = asm;
174 let Pattern = pattern;
175}
176
177// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +0000178class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000179 IndexMode im, Format f, InstrItinClass itin,
180 string opc, string asm, string cstr,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000181 list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000182 : InstARM<am, sz, im, f, cstr, itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000183 let OutOperandList = oops;
184 let InOperandList = !con(iops, (ops pred:$p));
185 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
186 let Pattern = pattern;
187 list<Predicate> Predicates = [IsARM];
188}
189
190// Same as I except it can optionally modify CPSR. Note it's modeled as
191// an input operand since by default it's a zero register. It will
192// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000193class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000194 IndexMode im, Format f, InstrItinClass itin,
195 string opc, string asm, string cstr,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000196 list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000197 : InstARM<am, sz, im, f, cstr, itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000198 let OutOperandList = oops;
199 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
200 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
201 let Pattern = pattern;
202 list<Predicate> Predicates = [IsARM];
203}
204
Evan Chengc5409a82008-09-01 07:19:00 +0000205// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000206class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000207 IndexMode im, Format f, InstrItinClass itin,
208 string asm, string cstr, list<dag> pattern>
209 : InstARM<am, sz, im, f, cstr, itin> {
Evan Chengc5409a82008-09-01 07:19:00 +0000210 let OutOperandList = oops;
211 let InOperandList = iops;
212 let AsmString = asm;
213 let Pattern = pattern;
214 list<Predicate> Predicates = [IsARM];
215}
216
David Goodwincfd67652009-08-06 16:52:47 +0000217class AI<dag oops, dag iops, Format f, InstrItinClass itin,
218 string opc, string asm, list<dag> pattern>
219 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
220 opc, asm, "", pattern>;
221class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
222 string opc, string asm, list<dag> pattern>
223 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
224 opc, asm, "", pattern>;
225class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000226 string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000227 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng37afa432008-11-06 22:15:19 +0000228 asm, "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000229
230// Ctrl flow instructions
David Goodwincfd67652009-08-06 16:52:47 +0000231class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
232 string opc, string asm, list<dag> pattern>
233 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
234 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000235 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000236}
David Goodwincfd67652009-08-06 16:52:47 +0000237class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
238 string asm, list<dag> pattern>
239 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
240 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000241 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000242}
David Goodwincfd67652009-08-06 16:52:47 +0000243class ABXIx2<dag oops, dag iops, InstrItinClass itin,
244 string asm, list<dag> pattern>
245 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
246 asm, "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000247
248// BR_JT instructions
David Goodwincfd67652009-08-06 16:52:47 +0000249class JTI<dag oops, dag iops, InstrItinClass itin,
250 string asm, list<dag> pattern>
251 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000252 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000253
254// addrmode1 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000255class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
256 string opc, string asm, list<dag> pattern>
257 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
258 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000259 let Inst{24-21} = opcod;
260 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000261}
David Goodwincfd67652009-08-06 16:52:47 +0000262class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
263 string opc, string asm, list<dag> pattern>
264 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
265 opc, asm, "", pattern> {
266 let Inst{24-21} = opcod;
267 let Inst{27-26} = {0,0};
268}
269class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000270 string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000271 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Chengd0750352008-08-29 07:40:52 +0000272 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000273 let Inst{24-21} = opcod;
274 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000275}
David Goodwincfd67652009-08-06 16:52:47 +0000276class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
277 string opc, string asm, list<dag> pattern>
278 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
279 opc, asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000280
Evan Cheng2e62b662008-09-01 01:51:14 +0000281
282// addrmode2 loads and stores
David Goodwincfd67652009-08-06 16:52:47 +0000283class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
284 string opc, string asm, list<dag> pattern>
285 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
286 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000287 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000288}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000289
290// loads
David Goodwincfd67652009-08-06 16:52:47 +0000291class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
292 string opc, string asm, list<dag> pattern>
293 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
294 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000295 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000296 let Inst{21} = 0; // W bit
297 let Inst{22} = 0; // B bit
298 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000299 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000300}
David Goodwincfd67652009-08-06 16:52:47 +0000301class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
302 string asm, list<dag> pattern>
303 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000304 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000305 let Inst{20} = 1; // L bit
306 let Inst{21} = 0; // W bit
307 let Inst{22} = 0; // B bit
308 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000309 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000310}
David Goodwincfd67652009-08-06 16:52:47 +0000311class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
312 string opc, string asm, list<dag> pattern>
313 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
314 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000315 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000316 let Inst{21} = 0; // W bit
317 let Inst{22} = 1; // B bit
318 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000319 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000320}
David Goodwincfd67652009-08-06 16:52:47 +0000321class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
322 string asm, list<dag> pattern>
323 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000324 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000325 let Inst{20} = 1; // L bit
326 let Inst{21} = 0; // W bit
327 let Inst{22} = 1; // B bit
328 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000329 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000330}
Evan Chengda020022008-08-31 19:02:21 +0000331
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000332// stores
David Goodwincfd67652009-08-06 16:52:47 +0000333class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
334 string opc, string asm, list<dag> pattern>
335 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
336 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000337 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000338 let Inst{21} = 0; // W bit
339 let Inst{22} = 0; // B bit
340 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000341 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000342}
David Goodwincfd67652009-08-06 16:52:47 +0000343class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
344 string asm, list<dag> pattern>
345 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000346 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000347 let Inst{20} = 0; // L bit
348 let Inst{21} = 0; // W bit
349 let Inst{22} = 0; // B bit
350 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000351 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000352}
David Goodwincfd67652009-08-06 16:52:47 +0000353class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
354 string opc, string asm, list<dag> pattern>
355 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
356 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000357 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358 let Inst{21} = 0; // W bit
359 let Inst{22} = 1; // B bit
360 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000361 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000362}
David Goodwincfd67652009-08-06 16:52:47 +0000363class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
364 string asm, list<dag> pattern>
365 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000366 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000367 let Inst{20} = 0; // L bit
368 let Inst{21} = 0; // W bit
369 let Inst{22} = 1; // B bit
370 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000371 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000372}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000373
Evan Chengac92c3f2008-09-01 07:00:14 +0000374// Pre-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000375class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
376 string opc, string asm, string cstr, list<dag> pattern>
377 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
378 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000379 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000380 let Inst{21} = 1; // W bit
381 let Inst{22} = 0; // B bit
382 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000383 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000384}
David Goodwincfd67652009-08-06 16:52:47 +0000385class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
386 string opc, string asm, string cstr, list<dag> pattern>
387 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
388 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000389 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000390 let Inst{21} = 1; // W bit
391 let Inst{22} = 1; // B bit
392 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000393 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000394}
395
Evan Chengac92c3f2008-09-01 07:00:14 +0000396// Pre-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000397class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
398 string opc, string asm, string cstr, list<dag> pattern>
399 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
400 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000401 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000402 let Inst{21} = 1; // W bit
403 let Inst{22} = 0; // B bit
404 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000405 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000406}
David Goodwincfd67652009-08-06 16:52:47 +0000407class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
408 string opc, string asm, string cstr, list<dag> pattern>
409 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
410 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000411 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000412 let Inst{21} = 1; // W bit
413 let Inst{22} = 1; // B bit
414 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000415 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000416}
417
Evan Chengac92c3f2008-09-01 07:00:14 +0000418// Post-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000419class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
420 string opc, string asm, string cstr, list<dag> pattern>
421 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
422 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000423 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000424 let Inst{21} = 0; // W bit
425 let Inst{22} = 0; // B bit
426 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000427 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000428}
David Goodwincfd67652009-08-06 16:52:47 +0000429class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
430 string opc, string asm, string cstr, list<dag> pattern>
431 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
432 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000433 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000434 let Inst{21} = 0; // W bit
435 let Inst{22} = 1; // B bit
436 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000437 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000438}
439
Evan Chengac92c3f2008-09-01 07:00:14 +0000440// Post-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000441class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
442 string opc, string asm, string cstr, list<dag> pattern>
443 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
444 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000445 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000446 let Inst{21} = 0; // W bit
447 let Inst{22} = 0; // B bit
448 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000449 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000450}
David Goodwincfd67652009-08-06 16:52:47 +0000451class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
452 string opc, string asm, string cstr, list<dag> pattern>
453 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
454 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000455 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000456 let Inst{21} = 0; // W bit
457 let Inst{22} = 1; // B bit
458 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000459 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000460}
461
Evan Cheng2e62b662008-09-01 01:51:14 +0000462// addrmode3 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000463class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
464 string opc, string asm, list<dag> pattern>
465 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
466 opc, asm, "", pattern>;
467class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
468 string asm, list<dag> pattern>
469 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
470 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000471
Evan Chengac92c3f2008-09-01 07:00:14 +0000472// loads
David Goodwincfd67652009-08-06 16:52:47 +0000473class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
474 string opc, string asm, list<dag> pattern>
475 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
476 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000477 let Inst{4} = 1;
478 let Inst{5} = 1; // H bit
479 let Inst{6} = 0; // S bit
480 let Inst{7} = 1;
481 let Inst{20} = 1; // L bit
482 let Inst{21} = 0; // W bit
483 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000484 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000485}
David Goodwincfd67652009-08-06 16:52:47 +0000486class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
487 string asm, list<dag> pattern>
488 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000489 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000490 let Inst{4} = 1;
491 let Inst{5} = 1; // H bit
492 let Inst{6} = 0; // S bit
493 let Inst{7} = 1;
494 let Inst{20} = 1; // L bit
495 let Inst{21} = 0; // W bit
496 let Inst{24} = 1; // P bit
497}
David Goodwincfd67652009-08-06 16:52:47 +0000498class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
499 string opc, string asm, list<dag> pattern>
500 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
501 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000502 let Inst{4} = 1;
503 let Inst{5} = 1; // H bit
504 let Inst{6} = 1; // S bit
505 let Inst{7} = 1;
506 let Inst{20} = 1; // L bit
507 let Inst{21} = 0; // W bit
508 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000509 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000510}
David Goodwincfd67652009-08-06 16:52:47 +0000511class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
512 string asm, list<dag> pattern>
513 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000514 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000515 let Inst{4} = 1;
516 let Inst{5} = 1; // H bit
517 let Inst{6} = 1; // S bit
518 let Inst{7} = 1;
519 let Inst{20} = 1; // L bit
520 let Inst{21} = 0; // W bit
521 let Inst{24} = 1; // P bit
522}
David Goodwincfd67652009-08-06 16:52:47 +0000523class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
524 string opc, string asm, list<dag> pattern>
525 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
526 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000527 let Inst{4} = 1;
528 let Inst{5} = 0; // H bit
529 let Inst{6} = 1; // S bit
530 let Inst{7} = 1;
531 let Inst{20} = 1; // L bit
532 let Inst{21} = 0; // W bit
533 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000534 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000535}
David Goodwincfd67652009-08-06 16:52:47 +0000536class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
537 string asm, list<dag> pattern>
538 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000539 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000540 let Inst{4} = 1;
541 let Inst{5} = 0; // H bit
542 let Inst{6} = 1; // S bit
543 let Inst{7} = 1;
544 let Inst{20} = 1; // L bit
545 let Inst{21} = 0; // W bit
546 let Inst{24} = 1; // P bit
547}
David Goodwincfd67652009-08-06 16:52:47 +0000548class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
549 string opc, string asm, list<dag> pattern>
550 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
551 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000552 let Inst{4} = 1;
553 let Inst{5} = 0; // H bit
554 let Inst{6} = 1; // S bit
555 let Inst{7} = 1;
556 let Inst{20} = 0; // L bit
557 let Inst{21} = 0; // W bit
558 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000559 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000560}
561
562// stores
David Goodwincfd67652009-08-06 16:52:47 +0000563class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
564 string opc, string asm, list<dag> pattern>
565 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
566 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000567 let Inst{4} = 1;
568 let Inst{5} = 1; // H bit
569 let Inst{6} = 0; // S bit
570 let Inst{7} = 1;
571 let Inst{20} = 0; // L bit
572 let Inst{21} = 0; // W bit
573 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000574 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000575}
David Goodwincfd67652009-08-06 16:52:47 +0000576class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
577 string asm, list<dag> pattern>
578 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000579 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000580 let Inst{4} = 1;
581 let Inst{5} = 1; // H bit
582 let Inst{6} = 0; // S bit
583 let Inst{7} = 1;
584 let Inst{20} = 0; // L bit
585 let Inst{21} = 0; // W bit
586 let Inst{24} = 1; // P bit
587}
David Goodwincfd67652009-08-06 16:52:47 +0000588class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
589 string opc, string asm, list<dag> pattern>
590 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
591 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000592 let Inst{4} = 1;
593 let Inst{5} = 1; // H bit
594 let Inst{6} = 1; // S bit
595 let Inst{7} = 1;
596 let Inst{20} = 0; // L bit
597 let Inst{21} = 0; // W bit
598 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000599 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000600}
601
602// Pre-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000603class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
604 string opc, string asm, string cstr, list<dag> pattern>
605 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
606 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000607 let Inst{4} = 1;
608 let Inst{5} = 1; // H bit
609 let Inst{6} = 0; // S bit
610 let Inst{7} = 1;
611 let Inst{20} = 1; // L bit
612 let Inst{21} = 1; // W bit
613 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000614 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000615}
David Goodwincfd67652009-08-06 16:52:47 +0000616class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
617 string opc, string asm, string cstr, list<dag> pattern>
618 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
619 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000620 let Inst{4} = 1;
621 let Inst{5} = 1; // H bit
622 let Inst{6} = 1; // S bit
623 let Inst{7} = 1;
624 let Inst{20} = 1; // L bit
625 let Inst{21} = 1; // W bit
626 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000627 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000628}
David Goodwincfd67652009-08-06 16:52:47 +0000629class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
630 string opc, string asm, string cstr, list<dag> pattern>
631 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
632 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000633 let Inst{4} = 1;
634 let Inst{5} = 0; // H bit
635 let Inst{6} = 1; // S bit
636 let Inst{7} = 1;
637 let Inst{20} = 1; // L bit
638 let Inst{21} = 1; // W bit
639 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000640 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000641}
642
643// Pre-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000644class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
645 string opc, string asm, string cstr, list<dag> pattern>
646 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
647 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000648 let Inst{4} = 1;
649 let Inst{5} = 1; // H bit
650 let Inst{6} = 0; // S bit
651 let Inst{7} = 1;
652 let Inst{20} = 0; // L bit
653 let Inst{21} = 1; // W bit
654 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000655 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000656}
657
658// Post-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000659class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
660 string opc, string asm, string cstr, list<dag> pattern>
661 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
662 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000663 let Inst{4} = 1;
664 let Inst{5} = 1; // H bit
665 let Inst{6} = 0; // S bit
666 let Inst{7} = 1;
667 let Inst{20} = 1; // L bit
668 let Inst{21} = 1; // W bit
669 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000670 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000671}
David Goodwincfd67652009-08-06 16:52:47 +0000672class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
673 string opc, string asm, string cstr, list<dag> pattern>
674 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
675 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000676 let Inst{4} = 1;
677 let Inst{5} = 1; // H bit
678 let Inst{6} = 1; // 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} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000683 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000684}
David Goodwincfd67652009-08-06 16:52:47 +0000685class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
686 string opc, string asm, string cstr, list<dag> pattern>
687 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
688 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000689 let Inst{4} = 1;
690 let Inst{5} = 0; // 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} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000696 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000697}
698
699// Post-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000700class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
701 string opc, string asm, string cstr, list<dag> pattern>
702 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
703 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000704 let Inst{4} = 1;
705 let Inst{5} = 1; // H bit
706 let Inst{6} = 0; // S bit
707 let Inst{7} = 1;
708 let Inst{20} = 0; // L bit
709 let Inst{21} = 1; // W bit
710 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000711 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000712}
713
714
Evan Cheng2e62b662008-09-01 01:51:14 +0000715// addrmode4 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000716class AXI4ld<dag oops, dag iops, Format f, InstrItinClass itin,
717 string asm, list<dag> pattern>
718 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
719 asm, "", pattern> {
Evan Chengd36b01c2008-09-01 07:48:18 +0000720 let Inst{20} = 1; // L bit
721 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000722 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000723}
David Goodwincfd67652009-08-06 16:52:47 +0000724class AXI4st<dag oops, dag iops, Format f, InstrItinClass itin,
725 string asm, list<dag> pattern>
726 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
727 asm, "", pattern> {
Evan Chengd36b01c2008-09-01 07:48:18 +0000728 let Inst{20} = 0; // L bit
729 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000730 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000731}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000732
Jim Grosbach1feed042008-11-03 18:38:31 +0000733// Unsigned multiply, multiply-accumulate instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000734class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
735 string opc, string asm, list<dag> pattern>
736 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
737 opc, asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000738 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000739 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000740 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000741}
David Goodwincfd67652009-08-06 16:52:47 +0000742class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
743 string opc, string asm, list<dag> pattern>
744 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
745 opc, asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000746 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000747 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000748}
749
750// Most significant word multiply
David Goodwincfd67652009-08-06 16:52:47 +0000751class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
752 string opc, string asm, list<dag> pattern>
753 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
754 opc, asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000755 let Inst{7-4} = 0b1001;
756 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000757 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000758}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000759
Evan Cheng38396be2008-11-06 03:35:07 +0000760// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwincfd67652009-08-06 16:52:47 +0000761class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
762 string opc, string asm, list<dag> pattern>
763 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
764 opc, asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000765 let Inst{4} = 0;
766 let Inst{7} = 1;
767 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000768 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000769}
770
Evan Cheng37afa432008-11-06 22:15:19 +0000771// Extend instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000772class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
773 string opc, string asm, list<dag> pattern>
774 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
775 opc, asm, "", pattern> {
Evan Cheng37afa432008-11-06 22:15:19 +0000776 let Inst{7-4} = 0b0111;
777 let Inst{27-20} = opcod;
778}
779
Evan Chengc2121a22008-11-07 01:41:35 +0000780// Misc Arithmetic instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000781class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
782 string opc, string asm, list<dag> pattern>
783 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
784 opc, asm, "", pattern> {
Evan Chengc2121a22008-11-07 01:41:35 +0000785 let Inst{27-20} = opcod;
786}
787
Evan Cheng7b0249b2008-08-28 23:39:26 +0000788//===----------------------------------------------------------------------===//
789
790// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
791class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
792 list<Predicate> Predicates = [IsARM];
793}
794class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
795 list<Predicate> Predicates = [IsARM, HasV5TE];
796}
797class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
798 list<Predicate> Predicates = [IsARM, HasV6];
799}
Evan Cheng34a46e12008-08-29 06:41:12 +0000800
801//===----------------------------------------------------------------------===//
802//
803// Thumb Instruction Format Definitions.
804//
805
Evan Cheng34a46e12008-08-29 06:41:12 +0000806// TI - Thumb instruction.
807
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000808class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000809 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
810 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000811 let OutOperandList = oops;
812 let InOperandList = iops;
Evan Cheng34a46e12008-08-29 06:41:12 +0000813 let AsmString = asm;
814 let Pattern = pattern;
815 list<Predicate> Predicates = [IsThumb];
816}
817
David Goodwincfd67652009-08-06 16:52:47 +0000818class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
819 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000820
Evan Chengd16eb2f2009-08-04 23:47:55 +0000821// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000822class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
823 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Chengd16eb2f2009-08-04 23:47:55 +0000824
Evan Cheng68e4b582009-08-01 00:16:10 +0000825// tBL, tBX instructions
David Goodwincfd67652009-08-06 16:52:47 +0000826class TIx2<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
827 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000828
829// BR_JT instructions
David Goodwincfd67652009-08-06 16:52:47 +0000830class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
831 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000832
Evan Cheng6fc534c2009-06-23 19:38:13 +0000833// Thumb1 only
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000834class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000835 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
836 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000837 let OutOperandList = oops;
838 let InOperandList = iops;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000839 let AsmString = asm;
840 let Pattern = pattern;
841 list<Predicate> Predicates = [IsThumb1Only];
842}
843
David Goodwincfd67652009-08-06 16:52:47 +0000844class T1I<dag oops, dag iops, InstrItinClass itin,
845 string asm, list<dag> pattern>
846 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
847class T1Ix2<dag oops, dag iops, InstrItinClass itin,
848 string asm, list<dag> pattern>
849 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
850class T1JTI<dag oops, dag iops, InstrItinClass itin,
851 string asm, list<dag> pattern>
852 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000853
854// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000855class T1It<dag oops, dag iops, InstrItinClass itin,
856 string asm, list<dag> pattern>
857 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
858 asm, "$lhs = $dst", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000859
860// Thumb1 instruction that can either be predicated or set CPSR.
861class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000862 InstrItinClass itin,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000863 string opc, string asm, string cstr, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000864 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000865 let OutOperandList = !con(oops, (ops s_cc_out:$s));
866 let InOperandList = !con(iops, (ops pred:$p));
867 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
868 let Pattern = pattern;
869 list<Predicate> Predicates = [IsThumb1Only];
870}
871
David Goodwincfd67652009-08-06 16:52:47 +0000872class T1sI<dag oops, dag iops, InstrItinClass itin,
873 string opc, string asm, list<dag> pattern>
874 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000875
876// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000877class T1sIt<dag oops, dag iops, InstrItinClass itin,
878 string opc, string asm, list<dag> pattern>
879 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000880 "$lhs = $dst", pattern>;
881
882// Thumb1 instruction that can be predicated.
883class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000884 InstrItinClass itin,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000885 string opc, string asm, string cstr, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000886 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000887 let OutOperandList = oops;
888 let InOperandList = !con(iops, (ops pred:$p));
889 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
890 let Pattern = pattern;
891 list<Predicate> Predicates = [IsThumb1Only];
892}
893
David Goodwincfd67652009-08-06 16:52:47 +0000894class T1pI<dag oops, dag iops, InstrItinClass itin,
895 string opc, string asm, list<dag> pattern>
896 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000897
898// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000899class T1pIt<dag oops, dag iops, InstrItinClass itin,
900 string opc, string asm, list<dag> pattern>
901 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000902 "$lhs = $dst", pattern>;
903
David Goodwincfd67652009-08-06 16:52:47 +0000904class T1pI1<dag oops, dag iops, InstrItinClass itin,
905 string opc, string asm, list<dag> pattern>
906 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
907class T1pI2<dag oops, dag iops, InstrItinClass itin,
908 string opc, string asm, list<dag> pattern>
909 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
910class T1pI4<dag oops, dag iops, InstrItinClass itin,
911 string opc, string asm, list<dag> pattern>
912 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
913class T1pIs<dag oops, dag iops,
914 InstrItinClass itin, string opc, string asm, list<dag> pattern>
915 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000916
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000917// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
918class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000919 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000920 string opc, string asm, string cstr, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000921 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000922 let OutOperandList = oops;
923 let InOperandList = !con(iops, (ops pred:$p));
924 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
925 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000926 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000927}
928
929// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
930// an input operand since by default it's a zero register. It will
931// become an implicit def once it's "flipped".
932// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
933// more consistent.
934class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000935 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000936 string opc, string asm, string cstr, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000937 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000938 let OutOperandList = oops;
939 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
940 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
941 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000942 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000943}
944
945// Special cases
946class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000947 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000948 string asm, string cstr, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000949 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000950 let OutOperandList = oops;
951 let InOperandList = iops;
Evan Cheng36173712009-06-23 17:48:47 +0000952 let AsmString = asm;
953 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000954 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000955}
956
David Goodwincfd67652009-08-06 16:52:47 +0000957class T2I<dag oops, dag iops, InstrItinClass itin,
958 string opc, string asm, list<dag> pattern>
959 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
960class T2Ii12<dag oops, dag iops, InstrItinClass itin,
961 string opc, string asm, list<dag> pattern>
962 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
963class T2Ii8<dag oops, dag iops, InstrItinClass itin,
964 string opc, string asm, list<dag> pattern>
965 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
966class T2Iso<dag oops, dag iops, InstrItinClass itin,
967 string opc, string asm, list<dag> pattern>
968 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
969class T2Ipc<dag oops, dag iops, InstrItinClass itin,
970 string opc, string asm, list<dag> pattern>
971 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
972class T2Ii8s4<dag oops, dag iops, InstrItinClass itin,
973 string opc, string asm, list<dag> pattern>
974 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000975
David Goodwincfd67652009-08-06 16:52:47 +0000976class T2sI<dag oops, dag iops, InstrItinClass itin,
977 string opc, string asm, list<dag> pattern>
978 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000979
David Goodwincfd67652009-08-06 16:52:47 +0000980class T2XI<dag oops, dag iops, InstrItinClass itin,
981 string asm, list<dag> pattern>
982 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
983class T2JTI<dag oops, dag iops, InstrItinClass itin,
984 string asm, list<dag> pattern>
985 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng36173712009-06-23 17:48:47 +0000986
Evan Chenga90942e2009-07-02 07:28:31 +0000987// T2Iidxldst - Thumb2 indexed load / store instructions.
988class T2Iidxldst<dag oops, dag iops, AddrMode am, IndexMode im,
David Goodwincfd67652009-08-06 16:52:47 +0000989 InstrItinClass itin,
Evan Chenga90942e2009-07-02 07:28:31 +0000990 string opc, string asm, string cstr, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000991 : InstARM<am, Size4Bytes, im, ThumbFrm, cstr, itin> {
Evan Chenga90942e2009-07-02 07:28:31 +0000992 let OutOperandList = oops;
993 let InOperandList = !con(iops, (ops pred:$p));
994 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
995 let Pattern = pattern;
996 list<Predicate> Predicates = [IsThumb2];
997}
998
David Goodwin27c016b2009-07-27 19:59:26 +0000999// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1000class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1001 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1002}
1003
1004// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1005class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1006 list<Predicate> Predicates = [IsThumb1Only];
1007}
Evan Chenga90942e2009-07-02 07:28:31 +00001008
Evan Cheng19bb7c72009-06-27 02:26:13 +00001009// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1010class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengb1b2abc2009-07-02 06:38:40 +00001011 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +00001012}
1013
Evan Cheng34a46e12008-08-29 06:41:12 +00001014//===----------------------------------------------------------------------===//
1015
Evan Chengc63e15e2008-11-11 02:11:05 +00001016//===----------------------------------------------------------------------===//
1017// ARM VFP Instruction templates.
1018//
1019
David Goodwince9fbbe2009-07-10 17:03:29 +00001020// Almost all VFP instructions are predicable.
1021class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +00001022 IndexMode im, Format f, InstrItinClass itin,
1023 string opc, string asm, string cstr, list<dag> pattern>
1024 : InstARM<am, sz, im, f, cstr, itin> {
David Goodwince9fbbe2009-07-10 17:03:29 +00001025 let OutOperandList = oops;
1026 let InOperandList = !con(iops, (ops pred:$p));
1027 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1028 let Pattern = pattern;
1029 list<Predicate> Predicates = [HasVFP2];
1030}
1031
1032// Special cases
1033class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +00001034 IndexMode im, Format f, InstrItinClass itin,
1035 string asm, string cstr, list<dag> pattern>
1036 : InstARM<am, sz, im, f, cstr, itin> {
David Goodwince9fbbe2009-07-10 17:03:29 +00001037 let OutOperandList = oops;
1038 let InOperandList = iops;
1039 let AsmString = asm;
1040 let Pattern = pattern;
1041 list<Predicate> Predicates = [HasVFP2];
1042}
1043
David Goodwincfd67652009-08-06 16:52:47 +00001044class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1045 string opc, string asm, list<dag> pattern>
1046 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1047 opc, asm, "", pattern>;
David Goodwince9fbbe2009-07-10 17:03:29 +00001048
Evan Chengbb786b32008-11-11 21:48:44 +00001049// ARM VFP addrmode5 loads and stores
1050class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001051 InstrItinClass itin,
Evan Chengbb786b32008-11-11 21:48:44 +00001052 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001053 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001054 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001055 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001056 let Inst{27-24} = opcod1;
1057 let Inst{21-20} = opcod2;
1058 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +00001059}
1060
Evan Chengbb786b32008-11-11 21:48:44 +00001061class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001062 InstrItinClass itin,
Evan Chengbb786b32008-11-11 21:48:44 +00001063 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001064 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001065 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001066 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001067 let Inst{27-24} = opcod1;
1068 let Inst{21-20} = opcod2;
1069 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +00001070}
1071
Evan Chengbb786b32008-11-11 21:48:44 +00001072// Load / store multiple
David Goodwincfd67652009-08-06 16:52:47 +00001073class AXSI5<dag oops, dag iops, InstrItinClass itin,
1074 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001075 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001076 VFPLdStMulFrm, itin, asm, "", pattern> {
Evan Chengbb786b32008-11-11 21:48:44 +00001077 // TODO: Mark the instructions with the appropriate subtarget info.
1078 let Inst{27-25} = 0b110;
1079 let Inst{11-8} = 0b1011;
1080}
1081
David Goodwincfd67652009-08-06 16:52:47 +00001082class AXDI5<dag oops, dag iops, InstrItinClass itin,
1083 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001084 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001085 VFPLdStMulFrm, itin, asm, "", pattern> {
Evan Chengbb786b32008-11-11 21:48:44 +00001086 // TODO: Mark the instructions with the appropriate subtarget info.
1087 let Inst{27-25} = 0b110;
1088 let Inst{11-8} = 0b1010;
1089}
1090
1091
Evan Chengc63e15e2008-11-11 02:11:05 +00001092// Double precision, unary
1093class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001094 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1095 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001096 let Inst{27-20} = opcod1;
1097 let Inst{19-16} = opcod2;
1098 let Inst{11-8} = 0b1011;
1099 let Inst{7-4} = opcod3;
1100}
1101
1102// Double precision, binary
David Goodwincfd67652009-08-06 16:52:47 +00001103class ADbI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1104 string opc, string asm, list<dag> pattern>
1105 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001106 let Inst{27-20} = opcod;
1107 let Inst{11-8} = 0b1011;
1108}
1109
1110// Single precision, unary
1111class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001112 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1113 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001114 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
1115 let Inst{27-20} = opcod1;
1116 let Inst{19-16} = opcod2;
1117 let Inst{11-8} = 0b1010;
1118 let Inst{7-4} = opcod3;
1119}
1120
David Goodwin4b358db2009-08-10 22:17:39 +00001121// Single precision unary, if no NEON
David Goodwinbc7c05e2009-08-04 20:39:05 +00001122// Same as ASuI except not available if NEON is enabled
1123class ASuIn<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001124 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1125 : ASuI<opcod1, opcod2, opcod2, oops, iops, itin, opc, asm, pattern> {
David Goodwinbc7c05e2009-08-04 20:39:05 +00001126 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1127}
1128
Evan Chengc63e15e2008-11-11 02:11:05 +00001129// Single precision, binary
David Goodwincfd67652009-08-06 16:52:47 +00001130class ASbI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1131 string opc, string asm, list<dag> pattern>
1132 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001133 // Bit 22 (D bit) can be changed during instruction encoding.
1134 let Inst{27-20} = opcod;
1135 let Inst{11-8} = 0b1010;
1136}
1137
David Goodwin4b358db2009-08-10 22:17:39 +00001138// Single precision binary, if no NEON
David Goodwindd19ce42009-08-04 17:53:06 +00001139// Same as ASbI except not available if NEON is enabled
David Goodwincfd67652009-08-06 16:52:47 +00001140class ASbIn<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1141 string opc, string asm, list<dag> pattern>
1142 : ASbI<opcod, oops, iops, itin, opc, asm, pattern> {
David Goodwindd19ce42009-08-04 17:53:06 +00001143 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1144}
1145
Evan Cheng74273382008-11-12 06:41:41 +00001146// VFP conversion instructions
1147class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001148 dag oops, dag iops, InstrItinClass itin,
1149 string opc, string asm, list<dag> pattern>
1150 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Evan Cheng9d3cc182008-11-11 19:40:26 +00001151 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +00001152 let Inst{19-16} = opcod2;
1153 let Inst{11-8} = opcod3;
1154 let Inst{6} = 1;
1155}
1156
David Goodwin4b358db2009-08-10 22:17:39 +00001157// VFP conversion instructions, if no NEON
1158class AVConv1In<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
1159 dag oops, dag iops, InstrItinClass itin,
1160 string opc, string asm, list<dag> pattern>
1161 : AVConv1I<opcod1, opcod2, opcod3, oops, iops, itin, opc, asm, pattern> {
1162 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1163}
1164
Evan Cheng74273382008-11-12 06:41:41 +00001165class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwincfd67652009-08-06 16:52:47 +00001166 InstrItinClass itin,
1167 string opc, string asm, list<dag> pattern>
1168 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng74273382008-11-12 06:41:41 +00001169 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001170 let Inst{11-8} = opcod2;
1171 let Inst{4} = 1;
1172}
1173
David Goodwincfd67652009-08-06 16:52:47 +00001174class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1175 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1176 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +00001177
David Goodwincfd67652009-08-06 16:52:47 +00001178class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1179 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1180 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng74273382008-11-12 06:41:41 +00001181
David Goodwincfd67652009-08-06 16:52:47 +00001182class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1183 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1184 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng74273382008-11-12 06:41:41 +00001185
David Goodwincfd67652009-08-06 16:52:47 +00001186class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1187 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1188 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001189
Evan Chengc63e15e2008-11-11 02:11:05 +00001190//===----------------------------------------------------------------------===//
1191
Bob Wilsone60fee02009-06-22 23:27:02 +00001192//===----------------------------------------------------------------------===//
1193// ARM NEON Instruction templates.
1194//
Evan Cheng34a46e12008-08-29 06:41:12 +00001195
David Goodwincfd67652009-08-06 16:52:47 +00001196class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
1197 string asm, string cstr, list<dag> pattern>
1198 : InstARM<am, Size4Bytes, im, NEONFrm, cstr, itin> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001199 let OutOperandList = oops;
1200 let InOperandList = iops;
1201 let AsmString = asm;
1202 let Pattern = pattern;
1203 list<Predicate> Predicates = [HasNEON];
Evan Cheng34a46e12008-08-29 06:41:12 +00001204}
1205
David Goodwincfd67652009-08-06 16:52:47 +00001206class NI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1207 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, asm, "", pattern> {
Evan Cheng34a46e12008-08-29 06:41:12 +00001208}
Bob Wilsone60fee02009-06-22 23:27:02 +00001209
Anton Korobeynikov3f087662009-08-08 13:35:48 +00001210class NI4<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1211 : NeonI<oops, iops, AddrMode4, IndexModeNone, itin, asm, "", pattern> {
1212}
1213
David Goodwincfd67652009-08-06 16:52:47 +00001214class NLdSt<dag oops, dag iops, InstrItinClass itin,
1215 string asm, list<dag> pattern>
1216 : NeonI<oops, iops, AddrMode6, IndexModeNone, itin, asm, "", pattern> {
Bob Wilsoned592c02009-07-08 18:11:30 +00001217 let Inst{31-24} = 0b11110100;
1218}
1219
David Goodwincfd67652009-08-06 16:52:47 +00001220class NDataI<dag oops, dag iops, InstrItinClass itin,
1221 string asm, string cstr, list<dag> pattern>
1222 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001223 let Inst{31-25} = 0b1111001;
1224}
1225
1226// NEON "one register and a modified immediate" format.
1227class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1228 bit op5, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001229 dag oops, dag iops, InstrItinClass itin,
1230 string asm, string cstr, list<dag> pattern>
1231 : NDataI<oops, iops, itin, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001232 let Inst{23} = op23;
1233 let Inst{21-19} = op21_19;
1234 let Inst{11-8} = op11_8;
1235 let Inst{7} = op7;
1236 let Inst{6} = op6;
1237 let Inst{5} = op5;
1238 let Inst{4} = op4;
1239}
1240
1241// NEON 2 vector register format.
1242class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1243 bits<5> op11_7, bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001244 dag oops, dag iops, InstrItinClass itin,
1245 string asm, string cstr, list<dag> pattern>
1246 : NDataI<oops, iops, itin, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001247 let Inst{24-23} = op24_23;
1248 let Inst{21-20} = op21_20;
1249 let Inst{19-18} = op19_18;
1250 let Inst{17-16} = op17_16;
1251 let Inst{11-7} = op11_7;
1252 let Inst{6} = op6;
1253 let Inst{4} = op4;
1254}
1255
1256// NEON 2 vector register with immediate.
1257class N2VImm<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1258 bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001259 dag oops, dag iops, InstrItinClass itin,
1260 string asm, string cstr, list<dag> pattern>
1261 : NDataI<oops, iops, itin, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001262 let Inst{24} = op24;
1263 let Inst{23} = op23;
1264 let Inst{21-16} = op21_16;
1265 let Inst{11-8} = op11_8;
1266 let Inst{7} = op7;
1267 let Inst{6} = op6;
1268 let Inst{4} = op4;
1269}
1270
1271// NEON 3 vector register format.
1272class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001273 dag oops, dag iops, InstrItinClass itin,
1274 string asm, string cstr, list<dag> pattern>
1275 : NDataI<oops, iops, itin, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001276 let Inst{24} = op24;
1277 let Inst{23} = op23;
1278 let Inst{21-20} = op21_20;
1279 let Inst{11-8} = op11_8;
1280 let Inst{6} = op6;
1281 let Inst{4} = op4;
1282}
1283
1284// NEON VMOVs between scalar and core registers.
1285class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001286 dag oops, dag iops, Format f, InstrItinClass itin,
1287 string opc, string asm, list<dag> pattern>
1288 : AI<oops, iops, f, itin, opc, asm, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001289 let Inst{27-20} = opcod1;
1290 let Inst{11-8} = opcod2;
1291 let Inst{6-5} = opcod3;
1292 let Inst{4} = 1;
1293 list<Predicate> Predicates = [HasNEON];
1294}
1295class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001296 dag oops, dag iops, InstrItinClass itin,
1297 string opc, string asm, list<dag> pattern>
1298 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
1299 opc, asm, pattern>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001300class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001301 dag oops, dag iops, InstrItinClass itin,
1302 string opc, string asm, list<dag> pattern>
1303 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
1304 opc, asm, pattern>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001305class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001306 dag oops, dag iops, InstrItinClass itin,
1307 string opc, string asm, list<dag> pattern>
1308 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
1309 opc, asm, pattern>;
David Goodwindd19ce42009-08-04 17:53:06 +00001310
1311// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1312// for single-precision FP.
1313class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1314 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1315}