blob: cf0edff31bbc5c29d52ba3f088f4b81a205a009d [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
Jim Grosbach437d6992009-12-11 01:42:04 +000036def LdStExFrm : Format<28>;
37
Evan Cheng9d2c9232008-11-13 23:36:57 +000038def ArithMiscFrm : Format<11>;
39def ExtFrm : Format<12>;
Evan Chengbb786b32008-11-11 21:48:44 +000040
Evan Cheng9d2c9232008-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 Chengbb786b32008-11-11 21:48:44 +000051
Evan Cheng9d2c9232008-11-13 23:36:57 +000052def ThumbFrm : Format<23>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000053
Bob Wilsone60fee02009-06-22 23:27:02 +000054def NEONFrm : Format<24>;
55def NEONGetLnFrm : Format<25>;
56def NEONSetLnFrm : Format<26>;
57def NEONDupFrm : Format<27>;
58
Evan Cheng9aa4cd32009-07-08 01:46:35 +000059// Misc flags.
60
Evan Cheng86a926a2008-11-05 18:35:52 +000061// the instruction has a Rn register operand.
Evan Cheng9aa4cd32009-07-08 01:46:35 +000062// UnaryDP - Indicates this is a unary data processing instruction, i.e.
63// it doesn't have a Rn operand.
64class UnaryDP { bit isUnaryDataProc = 1; }
65
66// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
67// a 16-bit Thumb instruction if certain conditions are met.
68class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000069
Evan Cheng7b0249b2008-08-28 23:39:26 +000070//===----------------------------------------------------------------------===//
Evan Cheng532cdc52009-06-29 07:51:04 +000071// ARM Instruction flags. These need to match ARMInstrInfo.h.
72//
73
74// Addressing mode.
75class AddrMode<bits<4> val> {
76 bits<4> Value = val;
77}
78def AddrModeNone : AddrMode<0>;
79def AddrMode1 : AddrMode<1>;
80def AddrMode2 : AddrMode<2>;
81def AddrMode3 : AddrMode<3>;
82def AddrMode4 : AddrMode<4>;
83def AddrMode5 : AddrMode<5>;
Bob Wilson970a10d2009-07-01 23:16:05 +000084def AddrMode6 : AddrMode<6>;
85def AddrModeT1_1 : AddrMode<7>;
86def AddrModeT1_2 : AddrMode<8>;
87def AddrModeT1_4 : AddrMode<9>;
88def AddrModeT1_s : AddrMode<10>;
David Goodwind1147262009-07-22 22:24:31 +000089def AddrModeT2_i12: AddrMode<11>;
Bob Wilson970a10d2009-07-01 23:16:05 +000090def AddrModeT2_i8 : AddrMode<12>;
91def AddrModeT2_so : AddrMode<13>;
92def AddrModeT2_pc : AddrMode<14>;
93def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng532cdc52009-06-29 07:51:04 +000094
95// Instruction size.
96class SizeFlagVal<bits<3> val> {
97 bits<3> Value = val;
98}
99def SizeInvalid : SizeFlagVal<0>; // Unset.
100def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
101def Size8Bytes : SizeFlagVal<2>;
102def Size4Bytes : SizeFlagVal<3>;
103def Size2Bytes : SizeFlagVal<4>;
104
105// Load / store index mode.
106class IndexMode<bits<2> val> {
107 bits<2> Value = val;
108}
109def IndexModeNone : IndexMode<0>;
110def IndexModePre : IndexMode<1>;
111def IndexModePost : IndexMode<2>;
112
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000113// Instruction execution domain.
114class Domain<bits<2> val> {
115 bits<2> Value = val;
116}
117def GenericDomain : Domain<0>;
118def VFPDomain : Domain<1>; // Instructions in VFP domain only
119def NeonDomain : Domain<2>; // Instructions in Neon domain only
120def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
121
Evan Cheng532cdc52009-06-29 07:51:04 +0000122//===----------------------------------------------------------------------===//
Evan Cheng7b0249b2008-08-28 23:39:26 +0000123
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000124// ARM special operands.
125//
126
127// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
128// register whose default is 0 (no register).
129def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
130 (ops (i32 14), (i32 zero_reg))> {
131 let PrintMethod = "printPredicateOperand";
132}
133
134// Conditional code result for instructions whose 's' bit is set, e.g. subs.
135def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
136 let PrintMethod = "printSBitModifierOperand";
137}
138
139// Same as cc_out except it defaults to setting CPSR.
140def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
141 let PrintMethod = "printSBitModifierOperand";
142}
143
144//===----------------------------------------------------------------------===//
145
Evan Cheng7b0249b2008-08-28 23:39:26 +0000146// ARM Instruction templates.
147//
148
Evan Chengbe998242008-11-06 08:47:38 +0000149class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000150 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng7b0249b2008-08-28 23:39:26 +0000151 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +0000152 field bits<32> Inst;
153
Evan Cheng7b0249b2008-08-28 23:39:26 +0000154 let Namespace = "ARM";
155
Evan Cheng86a926a2008-11-05 18:35:52 +0000156 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +0000157 AddrMode AM = am;
158 bits<4> AddrModeBits = AM.Value;
159
160 SizeFlagVal SZ = sz;
161 bits<3> SizeFlag = SZ.Value;
162
163 IndexMode IM = im;
164 bits<2> IndexModeBits = IM.Value;
165
166 Format F = f;
167 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +0000168
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000169 Domain D = d;
170 bits<2> Dom = D.Value;
171
Evan Cheng86a926a2008-11-05 18:35:52 +0000172 //
173 // Attributes specific to ARM instructions...
174 //
175 bit isUnaryDataProc = 0;
Evan Cheng9aa4cd32009-07-08 01:46:35 +0000176 bit canXformTo16Bit = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +0000177
178 let Constraints = cstr;
David Goodwincfd67652009-08-06 16:52:47 +0000179 let Itinerary = itin;
Evan Cheng7b0249b2008-08-28 23:39:26 +0000180}
181
David Goodwincfd67652009-08-06 16:52:47 +0000182class PseudoInst<dag oops, dag iops, InstrItinClass itin,
183 string asm, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000184 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
185 "", itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000186 let OutOperandList = oops;
187 let InOperandList = iops;
188 let AsmString = asm;
189 let Pattern = pattern;
190}
191
192// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +0000193class I<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>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000197 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000198 let OutOperandList = oops;
199 let InOperandList = !con(iops, (ops pred:$p));
200 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
201 let Pattern = pattern;
202 list<Predicate> Predicates = [IsARM];
203}
Jim Grosbach63437d92009-12-14 18:31:20 +0000204// A few are not predicable
205class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
206 IndexMode im, Format f, InstrItinClass itin,
207 string opc, string asm, string cstr,
208 list<dag> pattern>
209 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
210 let OutOperandList = oops;
211 let InOperandList = iops;
212 let AsmString = !strconcat(opc, asm);
213 let Pattern = pattern;
214 let isPredicable = 0;
215 list<Predicate> Predicates = [IsARM];
216}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000217
218// Same as I except it can optionally modify CPSR. Note it's modeled as
219// an input operand since by default it's a zero register. It will
220// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000221class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000222 IndexMode im, Format f, InstrItinClass itin,
223 string opc, string asm, string cstr,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000224 list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000225 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000226 let OutOperandList = oops;
227 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
228 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
229 let Pattern = pattern;
230 list<Predicate> Predicates = [IsARM];
231}
232
Evan Chengc5409a82008-09-01 07:19:00 +0000233// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000234class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000235 IndexMode im, Format f, InstrItinClass itin,
236 string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000237 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Chengc5409a82008-09-01 07:19:00 +0000238 let OutOperandList = oops;
239 let InOperandList = iops;
240 let AsmString = asm;
241 let Pattern = pattern;
242 list<Predicate> Predicates = [IsARM];
243}
244
David Goodwincfd67652009-08-06 16:52:47 +0000245class AI<dag oops, dag iops, Format f, InstrItinClass itin,
246 string opc, string asm, list<dag> pattern>
247 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
248 opc, asm, "", pattern>;
249class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
250 string opc, string asm, list<dag> pattern>
251 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
252 opc, asm, "", pattern>;
253class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000254 string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000255 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng37afa432008-11-06 22:15:19 +0000256 asm, "", pattern>;
Jim Grosbach63437d92009-12-14 18:31:20 +0000257class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
258 string opc, string asm, list<dag> pattern>
259 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
260 opc, asm, "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000261
262// Ctrl flow instructions
David Goodwincfd67652009-08-06 16:52:47 +0000263class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
264 string opc, string asm, list<dag> pattern>
265 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
266 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000267 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000268}
David Goodwincfd67652009-08-06 16:52:47 +0000269class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
270 string asm, list<dag> pattern>
271 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
272 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000273 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000274}
David Goodwincfd67652009-08-06 16:52:47 +0000275class ABXIx2<dag oops, dag iops, InstrItinClass itin,
276 string asm, list<dag> pattern>
277 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
278 asm, "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000279
280// BR_JT instructions
David Goodwincfd67652009-08-06 16:52:47 +0000281class JTI<dag oops, dag iops, InstrItinClass itin,
282 string asm, list<dag> pattern>
283 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000284 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000285
Jim Grosbach437d6992009-12-11 01:42:04 +0000286
287// Atomic load/store instructions
288
289class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
290 string opc, string asm, list<dag> pattern>
291 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
292 opc, asm, "", pattern> {
293 let Inst{27-23} = 0b00011;
294 let Inst{22-21} = opcod;
295 let Inst{20} = 1;
296 let Inst{11-0} = 0b111110011111;
297}
298class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
299 string opc, string asm, list<dag> pattern>
300 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
301 opc, asm, "", pattern> {
302 let Inst{27-23} = 0b00011;
303 let Inst{22-21} = opcod;
304 let Inst{20} = 0;
Johnny Chen7e632492009-12-11 19:37:26 +0000305 let Inst{11-4} = 0b11111001;
Jim Grosbach437d6992009-12-11 01:42:04 +0000306}
307
Evan Cheng2e62b662008-09-01 01:51:14 +0000308// addrmode1 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000309class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
310 string opc, string asm, list<dag> pattern>
311 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
312 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000313 let Inst{24-21} = opcod;
314 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000315}
David Goodwincfd67652009-08-06 16:52:47 +0000316class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
317 string opc, string asm, list<dag> pattern>
318 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
319 opc, asm, "", pattern> {
320 let Inst{24-21} = opcod;
321 let Inst{27-26} = {0,0};
322}
323class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000324 string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000325 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Chengd0750352008-08-29 07:40:52 +0000326 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000327 let Inst{24-21} = opcod;
328 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000329}
David Goodwincfd67652009-08-06 16:52:47 +0000330class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
331 string opc, string asm, list<dag> pattern>
332 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
333 opc, asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000334
Evan Cheng2e62b662008-09-01 01:51:14 +0000335
336// addrmode2 loads and stores
David Goodwincfd67652009-08-06 16:52:47 +0000337class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
338 string opc, string asm, list<dag> pattern>
339 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
340 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000341 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000342}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000343
344// loads
David Goodwincfd67652009-08-06 16:52:47 +0000345class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
346 string opc, string asm, list<dag> pattern>
347 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
348 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000349 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000350 let Inst{21} = 0; // W bit
351 let Inst{22} = 0; // B bit
352 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000353 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000354}
David Goodwincfd67652009-08-06 16:52:47 +0000355class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
356 string asm, list<dag> pattern>
357 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000358 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000359 let Inst{20} = 1; // L bit
360 let Inst{21} = 0; // W bit
361 let Inst{22} = 0; // B bit
362 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000363 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000364}
David Goodwincfd67652009-08-06 16:52:47 +0000365class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
366 string opc, string asm, list<dag> pattern>
367 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
368 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000369 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000370 let Inst{21} = 0; // W bit
371 let Inst{22} = 1; // B bit
372 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000373 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000374}
David Goodwincfd67652009-08-06 16:52:47 +0000375class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
376 string asm, list<dag> pattern>
377 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000378 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000379 let Inst{20} = 1; // L bit
380 let Inst{21} = 0; // W bit
381 let Inst{22} = 1; // B bit
382 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000383 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000384}
Evan Chengda020022008-08-31 19:02:21 +0000385
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000386// stores
David Goodwincfd67652009-08-06 16:52:47 +0000387class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
388 string opc, string asm, list<dag> pattern>
389 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
390 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000391 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000392 let Inst{21} = 0; // W bit
393 let Inst{22} = 0; // B bit
394 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000395 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000396}
David Goodwincfd67652009-08-06 16:52:47 +0000397class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
398 string asm, list<dag> pattern>
399 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000400 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000401 let Inst{20} = 0; // L bit
402 let Inst{21} = 0; // 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 Chengae7b1d72008-09-01 07:34:13 +0000406}
David Goodwincfd67652009-08-06 16:52:47 +0000407class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
408 string opc, string asm, list<dag> pattern>
409 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
410 opc, asm, "", 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} = 0; // 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}
David Goodwincfd67652009-08-06 16:52:47 +0000417class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
418 string asm, list<dag> pattern>
419 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000420 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000421 let Inst{20} = 0; // L bit
422 let Inst{21} = 0; // W bit
423 let Inst{22} = 1; // B bit
424 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000425 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000426}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000427
Evan Chengac92c3f2008-09-01 07:00:14 +0000428// Pre-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000429class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
430 string opc, string asm, string cstr, list<dag> pattern>
431 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, 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} = 1; // W bit
435 let Inst{22} = 0; // B bit
436 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000437 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000438}
David Goodwincfd67652009-08-06 16:52:47 +0000439class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
440 string opc, string asm, string cstr, list<dag> pattern>
441 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
442 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000443 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000444 let Inst{21} = 1; // W bit
445 let Inst{22} = 1; // B bit
446 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000447 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000448}
449
Evan Chengac92c3f2008-09-01 07:00:14 +0000450// Pre-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000451class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
452 string opc, string asm, string cstr, list<dag> pattern>
453 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, 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} = 1; // W bit
457 let Inst{22} = 0; // B bit
458 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000459 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000460}
David Goodwincfd67652009-08-06 16:52:47 +0000461class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
462 string opc, string asm, string cstr, list<dag> pattern>
463 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
464 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000465 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000466 let Inst{21} = 1; // W bit
467 let Inst{22} = 1; // B bit
468 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000469 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000470}
471
Evan Chengac92c3f2008-09-01 07:00:14 +0000472// Post-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000473class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
474 string opc, string asm, string cstr, list<dag> pattern>
475 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
476 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000477 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000478 let Inst{21} = 0; // W bit
479 let Inst{22} = 0; // B bit
480 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000481 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000482}
David Goodwincfd67652009-08-06 16:52:47 +0000483class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
484 string opc, string asm, string cstr, list<dag> pattern>
485 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
486 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000487 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000488 let Inst{21} = 0; // W bit
489 let Inst{22} = 1; // B bit
490 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000491 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000492}
493
Evan Chengac92c3f2008-09-01 07:00:14 +0000494// Post-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000495class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
496 string opc, string asm, string cstr, list<dag> pattern>
497 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
498 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000499 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000500 let Inst{21} = 0; // W bit
501 let Inst{22} = 0; // B bit
502 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000503 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000504}
David Goodwincfd67652009-08-06 16:52:47 +0000505class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
506 string opc, string asm, string cstr, list<dag> pattern>
507 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
508 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000509 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000510 let Inst{21} = 0; // W bit
511 let Inst{22} = 1; // B bit
512 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000513 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000514}
515
Evan Cheng2e62b662008-09-01 01:51:14 +0000516// addrmode3 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000517class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
518 string opc, string asm, list<dag> pattern>
519 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
520 opc, asm, "", pattern>;
521class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
522 string asm, list<dag> pattern>
523 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
524 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000525
Evan Chengac92c3f2008-09-01 07:00:14 +0000526// loads
David Goodwincfd67652009-08-06 16:52:47 +0000527class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
528 string opc, string asm, list<dag> pattern>
529 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
530 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000531 let Inst{4} = 1;
532 let Inst{5} = 1; // H bit
533 let Inst{6} = 0; // S bit
534 let Inst{7} = 1;
535 let Inst{20} = 1; // L bit
536 let Inst{21} = 0; // W bit
537 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000538 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000539}
David Goodwincfd67652009-08-06 16:52:47 +0000540class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
541 string asm, list<dag> pattern>
542 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000543 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000544 let Inst{4} = 1;
545 let Inst{5} = 1; // H bit
546 let Inst{6} = 0; // S bit
547 let Inst{7} = 1;
548 let Inst{20} = 1; // L bit
549 let Inst{21} = 0; // W bit
550 let Inst{24} = 1; // P bit
551}
David Goodwincfd67652009-08-06 16:52:47 +0000552class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
553 string opc, string asm, list<dag> pattern>
554 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
555 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000556 let Inst{4} = 1;
557 let Inst{5} = 1; // H bit
558 let Inst{6} = 1; // S bit
559 let Inst{7} = 1;
560 let Inst{20} = 1; // L bit
561 let Inst{21} = 0; // W bit
562 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000563 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000564}
David Goodwincfd67652009-08-06 16:52:47 +0000565class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
566 string asm, list<dag> pattern>
567 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000568 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000569 let Inst{4} = 1;
570 let Inst{5} = 1; // H bit
571 let Inst{6} = 1; // S bit
572 let Inst{7} = 1;
573 let Inst{20} = 1; // L bit
574 let Inst{21} = 0; // W bit
575 let Inst{24} = 1; // P bit
576}
David Goodwincfd67652009-08-06 16:52:47 +0000577class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
578 string opc, string asm, list<dag> pattern>
579 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
580 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000581 let Inst{4} = 1;
582 let Inst{5} = 0; // H bit
583 let Inst{6} = 1; // S bit
584 let Inst{7} = 1;
585 let Inst{20} = 1; // L bit
586 let Inst{21} = 0; // W bit
587 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000588 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000589}
David Goodwincfd67652009-08-06 16:52:47 +0000590class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
591 string asm, list<dag> pattern>
592 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000593 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000594 let Inst{4} = 1;
595 let Inst{5} = 0; // H bit
596 let Inst{6} = 1; // S bit
597 let Inst{7} = 1;
598 let Inst{20} = 1; // L bit
599 let Inst{21} = 0; // W bit
600 let Inst{24} = 1; // P bit
601}
David Goodwincfd67652009-08-06 16:52:47 +0000602class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
603 string opc, string asm, list<dag> pattern>
604 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
605 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000606 let Inst{4} = 1;
607 let Inst{5} = 0; // H bit
608 let Inst{6} = 1; // S bit
609 let Inst{7} = 1;
610 let Inst{20} = 0; // L bit
611 let Inst{21} = 0; // W bit
612 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000613 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000614}
615
616// stores
David Goodwincfd67652009-08-06 16:52:47 +0000617class AI3sth<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 Chengac92c3f2008-09-01 07:00:14 +0000621 let Inst{4} = 1;
622 let Inst{5} = 1; // H bit
623 let Inst{6} = 0; // S bit
624 let Inst{7} = 1;
625 let Inst{20} = 0; // L bit
626 let Inst{21} = 0; // W bit
627 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000628 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000629}
David Goodwincfd67652009-08-06 16:52:47 +0000630class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
631 string asm, list<dag> pattern>
632 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000633 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000634 let Inst{4} = 1;
635 let Inst{5} = 1; // H bit
636 let Inst{6} = 0; // S bit
637 let Inst{7} = 1;
638 let Inst{20} = 0; // L bit
639 let Inst{21} = 0; // W bit
640 let Inst{24} = 1; // P bit
641}
David Goodwincfd67652009-08-06 16:52:47 +0000642class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
643 string opc, string asm, list<dag> pattern>
644 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
645 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000646 let Inst{4} = 1;
647 let Inst{5} = 1; // H bit
648 let Inst{6} = 1; // S bit
649 let Inst{7} = 1;
650 let Inst{20} = 0; // L bit
651 let Inst{21} = 0; // W bit
652 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000653 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000654}
655
656// Pre-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000657class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
658 string opc, string asm, string cstr, list<dag> pattern>
659 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
660 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000661 let Inst{4} = 1;
662 let Inst{5} = 1; // H bit
663 let Inst{6} = 0; // S bit
664 let Inst{7} = 1;
665 let Inst{20} = 1; // L bit
666 let Inst{21} = 1; // W bit
667 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000668 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000669}
David Goodwincfd67652009-08-06 16:52:47 +0000670class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
671 string opc, string asm, string cstr, list<dag> pattern>
672 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
673 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000674 let Inst{4} = 1;
675 let Inst{5} = 1; // H bit
676 let Inst{6} = 1; // S bit
677 let Inst{7} = 1;
678 let Inst{20} = 1; // L bit
679 let Inst{21} = 1; // W bit
680 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000681 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000682}
David Goodwincfd67652009-08-06 16:52:47 +0000683class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
684 string opc, string asm, string cstr, list<dag> pattern>
685 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
686 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000687 let Inst{4} = 1;
688 let Inst{5} = 0; // H bit
689 let Inst{6} = 1; // S bit
690 let Inst{7} = 1;
691 let Inst{20} = 1; // L bit
692 let Inst{21} = 1; // W bit
693 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000694 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000695}
696
697// Pre-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000698class AI3sthpr<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 Chengac92c3f2008-09-01 07:00:14 +0000702 let Inst{4} = 1;
703 let Inst{5} = 1; // H bit
704 let Inst{6} = 0; // S bit
705 let Inst{7} = 1;
706 let Inst{20} = 0; // L bit
707 let Inst{21} = 1; // W bit
708 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000709 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000710}
711
712// Post-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000713class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
714 string opc, string asm, string cstr, list<dag> pattern>
715 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
716 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000717 let Inst{4} = 1;
718 let Inst{5} = 1; // H bit
719 let Inst{6} = 0; // S bit
720 let Inst{7} = 1;
721 let Inst{20} = 1; // L bit
722 let Inst{21} = 1; // W bit
723 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000724 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000725}
David Goodwincfd67652009-08-06 16:52:47 +0000726class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
727 string opc, string asm, string cstr, list<dag> pattern>
728 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
729 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000730 let Inst{4} = 1;
731 let Inst{5} = 1; // H bit
732 let Inst{6} = 1; // S bit
733 let Inst{7} = 1;
734 let Inst{20} = 1; // L bit
735 let Inst{21} = 1; // W bit
736 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000737 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000738}
David Goodwincfd67652009-08-06 16:52:47 +0000739class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
740 string opc, string asm, string cstr, list<dag> pattern>
741 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
742 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000743 let Inst{4} = 1;
744 let Inst{5} = 0; // H bit
745 let Inst{6} = 1; // S bit
746 let Inst{7} = 1;
747 let Inst{20} = 1; // L bit
748 let Inst{21} = 1; // W bit
749 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000750 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000751}
752
753// Post-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000754class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
755 string opc, string asm, string cstr, list<dag> pattern>
756 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
757 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000758 let Inst{4} = 1;
759 let Inst{5} = 1; // H bit
760 let Inst{6} = 0; // S bit
761 let Inst{7} = 1;
762 let Inst{20} = 0; // L bit
763 let Inst{21} = 1; // W bit
764 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000765 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000766}
767
768
Evan Cheng2e62b662008-09-01 01:51:14 +0000769// addrmode4 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000770class AXI4ld<dag oops, dag iops, Format f, InstrItinClass itin,
771 string asm, list<dag> pattern>
772 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
773 asm, "", pattern> {
Evan Chengd36b01c2008-09-01 07:48:18 +0000774 let Inst{20} = 1; // L bit
775 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000776 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000777}
David Goodwincfd67652009-08-06 16:52:47 +0000778class AXI4st<dag oops, dag iops, Format f, InstrItinClass itin,
779 string asm, list<dag> pattern>
780 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
781 asm, "", pattern> {
Evan Chengd36b01c2008-09-01 07:48:18 +0000782 let Inst{20} = 0; // L bit
783 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000784 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000785}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000786
Jim Grosbach1feed042008-11-03 18:38:31 +0000787// Unsigned multiply, multiply-accumulate instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000788class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
789 string opc, string asm, list<dag> pattern>
790 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
791 opc, asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000792 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000793 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000794 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000795}
David Goodwincfd67652009-08-06 16:52:47 +0000796class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
797 string opc, string asm, list<dag> pattern>
798 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
799 opc, asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000800 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000801 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000802}
803
804// Most significant word multiply
David Goodwincfd67652009-08-06 16:52:47 +0000805class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
806 string opc, string asm, list<dag> pattern>
807 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
808 opc, asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000809 let Inst{7-4} = 0b1001;
810 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000811 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000812}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000813
Evan Cheng38396be2008-11-06 03:35:07 +0000814// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwincfd67652009-08-06 16:52:47 +0000815class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
816 string opc, string asm, list<dag> pattern>
817 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
818 opc, asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000819 let Inst{4} = 0;
820 let Inst{7} = 1;
821 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000822 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000823}
824
Evan Cheng37afa432008-11-06 22:15:19 +0000825// Extend instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000826class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
827 string opc, string asm, list<dag> pattern>
828 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
829 opc, asm, "", pattern> {
Evan Cheng37afa432008-11-06 22:15:19 +0000830 let Inst{7-4} = 0b0111;
831 let Inst{27-20} = opcod;
832}
833
Evan Chengc2121a22008-11-07 01:41:35 +0000834// Misc Arithmetic instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000835class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
836 string opc, string asm, list<dag> pattern>
837 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
838 opc, asm, "", pattern> {
Evan Chengc2121a22008-11-07 01:41:35 +0000839 let Inst{27-20} = opcod;
840}
841
Evan Cheng7b0249b2008-08-28 23:39:26 +0000842//===----------------------------------------------------------------------===//
843
844// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
845class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
846 list<Predicate> Predicates = [IsARM];
847}
848class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
849 list<Predicate> Predicates = [IsARM, HasV5TE];
850}
851class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
852 list<Predicate> Predicates = [IsARM, HasV6];
853}
Evan Cheng34a46e12008-08-29 06:41:12 +0000854
855//===----------------------------------------------------------------------===//
856//
857// Thumb Instruction Format Definitions.
858//
859
Evan Cheng34a46e12008-08-29 06:41:12 +0000860// TI - Thumb instruction.
861
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000862class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000863 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000864 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000865 let OutOperandList = oops;
866 let InOperandList = iops;
Evan Cheng34a46e12008-08-29 06:41:12 +0000867 let AsmString = asm;
868 let Pattern = pattern;
869 list<Predicate> Predicates = [IsThumb];
870}
871
David Goodwincfd67652009-08-06 16:52:47 +0000872class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
873 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000874
Evan Chengd16eb2f2009-08-04 23:47:55 +0000875// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000876class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
877 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Chengd16eb2f2009-08-04 23:47:55 +0000878
Evan Cheng68e4b582009-08-01 00:16:10 +0000879// tBL, tBX instructions
David Goodwincfd67652009-08-06 16:52:47 +0000880class TIx2<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
881 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000882
883// BR_JT instructions
David Goodwincfd67652009-08-06 16:52:47 +0000884class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
885 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000886
Evan Cheng6fc534c2009-06-23 19:38:13 +0000887// Thumb1 only
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000888class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000889 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000890 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000891 let OutOperandList = oops;
892 let InOperandList = iops;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000893 let AsmString = asm;
894 let Pattern = pattern;
895 list<Predicate> Predicates = [IsThumb1Only];
896}
897
David Goodwincfd67652009-08-06 16:52:47 +0000898class T1I<dag oops, dag iops, InstrItinClass itin,
899 string asm, list<dag> pattern>
900 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
901class T1Ix2<dag oops, dag iops, InstrItinClass itin,
902 string asm, list<dag> pattern>
903 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
904class T1JTI<dag oops, dag iops, InstrItinClass itin,
905 string asm, list<dag> pattern>
906 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000907
908// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000909class T1It<dag oops, dag iops, InstrItinClass itin,
910 string asm, list<dag> pattern>
911 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
912 asm, "$lhs = $dst", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000913
914// Thumb1 instruction that can either be predicated or set CPSR.
915class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000916 InstrItinClass itin,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000917 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000918 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000919 let OutOperandList = !con(oops, (ops s_cc_out:$s));
920 let InOperandList = !con(iops, (ops pred:$p));
921 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
922 let Pattern = pattern;
923 list<Predicate> Predicates = [IsThumb1Only];
924}
925
David Goodwincfd67652009-08-06 16:52:47 +0000926class T1sI<dag oops, dag iops, InstrItinClass itin,
927 string opc, string asm, list<dag> pattern>
928 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000929
930// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000931class T1sIt<dag oops, dag iops, InstrItinClass itin,
932 string opc, string asm, list<dag> pattern>
933 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000934 "$lhs = $dst", pattern>;
935
936// Thumb1 instruction that can be predicated.
937class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000938 InstrItinClass itin,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000939 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000940 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000941 let OutOperandList = oops;
942 let InOperandList = !con(iops, (ops pred:$p));
943 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
944 let Pattern = pattern;
945 list<Predicate> Predicates = [IsThumb1Only];
946}
947
David Goodwincfd67652009-08-06 16:52:47 +0000948class T1pI<dag oops, dag iops, InstrItinClass itin,
949 string opc, string asm, list<dag> pattern>
950 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000951
952// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000953class T1pIt<dag oops, dag iops, InstrItinClass itin,
954 string opc, string asm, list<dag> pattern>
955 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000956 "$lhs = $dst", pattern>;
957
David Goodwincfd67652009-08-06 16:52:47 +0000958class T1pI1<dag oops, dag iops, InstrItinClass itin,
959 string opc, string asm, list<dag> pattern>
960 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
961class T1pI2<dag oops, dag iops, InstrItinClass itin,
962 string opc, string asm, list<dag> pattern>
963 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
964class T1pI4<dag oops, dag iops, InstrItinClass itin,
965 string opc, string asm, list<dag> pattern>
966 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
967class T1pIs<dag oops, dag iops,
968 InstrItinClass itin, string opc, string asm, list<dag> pattern>
969 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000970
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000971// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
972class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000973 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000974 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000975 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000976 let OutOperandList = oops;
977 let InOperandList = !con(iops, (ops pred:$p));
978 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
979 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000980 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000981}
982
983// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
984// an input operand since by default it's a zero register. It will
985// become an implicit def once it's "flipped".
986// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
987// more consistent.
988class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000989 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000990 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000991 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000992 let OutOperandList = oops;
993 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
994 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
995 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000996 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000997}
998
999// Special cases
1000class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +00001001 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +00001002 string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001003 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +00001004 let OutOperandList = oops;
1005 let InOperandList = iops;
Evan Cheng36173712009-06-23 17:48:47 +00001006 let AsmString = asm;
1007 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +00001008 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +00001009}
1010
Jim Grosbacha0fb7c42009-12-01 18:10:36 +00001011class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1012 InstrItinClass itin,
1013 string asm, string cstr, list<dag> pattern>
1014 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1015 let OutOperandList = oops;
1016 let InOperandList = iops;
1017 let AsmString = asm;
1018 let Pattern = pattern;
1019 list<Predicate> Predicates = [IsThumb1Only];
1020}
1021
David Goodwincfd67652009-08-06 16:52:47 +00001022class T2I<dag oops, dag iops, InstrItinClass itin,
1023 string opc, string asm, list<dag> pattern>
1024 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1025class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1026 string opc, string asm, list<dag> pattern>
1027 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
1028class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1029 string opc, string asm, list<dag> pattern>
1030 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1031class T2Iso<dag oops, dag iops, InstrItinClass itin,
1032 string opc, string asm, list<dag> pattern>
1033 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1034class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1035 string opc, string asm, list<dag> pattern>
1036 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
1037class T2Ii8s4<dag oops, dag iops, InstrItinClass itin,
1038 string opc, string asm, list<dag> pattern>
1039 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +00001040
David Goodwincfd67652009-08-06 16:52:47 +00001041class T2sI<dag oops, dag iops, InstrItinClass itin,
1042 string opc, string asm, list<dag> pattern>
1043 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +00001044
David Goodwincfd67652009-08-06 16:52:47 +00001045class T2XI<dag oops, dag iops, InstrItinClass itin,
1046 string asm, list<dag> pattern>
1047 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1048class T2JTI<dag oops, dag iops, InstrItinClass itin,
1049 string asm, list<dag> pattern>
1050 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng36173712009-06-23 17:48:47 +00001051
Evan Cheng16c012d2009-09-28 09:14:39 +00001052class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1053 string opc, string asm, list<dag> pattern>
1054 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1055
1056
Evan Chenga90942e2009-07-02 07:28:31 +00001057// T2Iidxldst - Thumb2 indexed load / store instructions.
1058class T2Iidxldst<dag oops, dag iops, AddrMode am, IndexMode im,
David Goodwincfd67652009-08-06 16:52:47 +00001059 InstrItinClass itin,
Evan Chenga90942e2009-07-02 07:28:31 +00001060 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001061 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenga90942e2009-07-02 07:28:31 +00001062 let OutOperandList = oops;
1063 let InOperandList = !con(iops, (ops pred:$p));
1064 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1065 let Pattern = pattern;
1066 list<Predicate> Predicates = [IsThumb2];
1067}
1068
David Goodwin27c016b2009-07-27 19:59:26 +00001069// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1070class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1071 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1072}
1073
1074// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1075class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1076 list<Predicate> Predicates = [IsThumb1Only];
1077}
Evan Chenga90942e2009-07-02 07:28:31 +00001078
Evan Cheng19bb7c72009-06-27 02:26:13 +00001079// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1080class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengb1b2abc2009-07-02 06:38:40 +00001081 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +00001082}
1083
Evan Cheng34a46e12008-08-29 06:41:12 +00001084//===----------------------------------------------------------------------===//
1085
Evan Chengc63e15e2008-11-11 02:11:05 +00001086//===----------------------------------------------------------------------===//
1087// ARM VFP Instruction templates.
1088//
1089
David Goodwince9fbbe2009-07-10 17:03:29 +00001090// Almost all VFP instructions are predicable.
1091class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +00001092 IndexMode im, Format f, InstrItinClass itin,
1093 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001094 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwince9fbbe2009-07-10 17:03:29 +00001095 let OutOperandList = oops;
1096 let InOperandList = !con(iops, (ops pred:$p));
1097 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1098 let Pattern = pattern;
1099 list<Predicate> Predicates = [HasVFP2];
1100}
1101
1102// Special cases
1103class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +00001104 IndexMode im, Format f, InstrItinClass itin,
1105 string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001106 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwince9fbbe2009-07-10 17:03:29 +00001107 let OutOperandList = oops;
1108 let InOperandList = iops;
1109 let AsmString = asm;
1110 let Pattern = pattern;
1111 list<Predicate> Predicates = [HasVFP2];
1112}
1113
David Goodwincfd67652009-08-06 16:52:47 +00001114class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1115 string opc, string asm, list<dag> pattern>
1116 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1117 opc, asm, "", pattern>;
David Goodwince9fbbe2009-07-10 17:03:29 +00001118
Evan Chengbb786b32008-11-11 21:48:44 +00001119// ARM VFP addrmode5 loads and stores
1120class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001121 InstrItinClass itin,
Evan Chengbb786b32008-11-11 21:48:44 +00001122 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001123 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001124 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001125 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001126 let Inst{27-24} = opcod1;
1127 let Inst{21-20} = opcod2;
1128 let Inst{11-8} = 0b1011;
Anton Korobeynikov1853b6e2009-11-02 00:11:06 +00001129
1130 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1131 let Dom = VFPNeonDomain.Value;
Evan Chengc63e15e2008-11-11 02:11:05 +00001132}
1133
Evan Chengbb786b32008-11-11 21:48:44 +00001134class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001135 InstrItinClass itin,
Evan Chengbb786b32008-11-11 21:48:44 +00001136 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001137 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001138 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001139 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001140 let Inst{27-24} = opcod1;
1141 let Inst{21-20} = opcod2;
1142 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +00001143}
1144
Evan Chengbb786b32008-11-11 21:48:44 +00001145// Load / store multiple
Evan Cheng71429f82009-09-09 23:55:03 +00001146class AXDI5<dag oops, dag iops, InstrItinClass itin,
David Goodwincfd67652009-08-06 16:52:47 +00001147 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001148 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001149 VFPLdStMulFrm, itin, asm, "", pattern> {
Evan Chengbb786b32008-11-11 21:48:44 +00001150 // TODO: Mark the instructions with the appropriate subtarget info.
1151 let Inst{27-25} = 0b110;
1152 let Inst{11-8} = 0b1011;
Anton Korobeynikov1853b6e2009-11-02 00:11:06 +00001153
1154 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1155 let Dom = VFPNeonDomain.Value;
Evan Chengbb786b32008-11-11 21:48:44 +00001156}
1157
Evan Cheng71429f82009-09-09 23:55:03 +00001158class AXSI5<dag oops, dag iops, InstrItinClass itin,
David Goodwincfd67652009-08-06 16:52:47 +00001159 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001160 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001161 VFPLdStMulFrm, itin, asm, "", pattern> {
Evan Chengbb786b32008-11-11 21:48:44 +00001162 // TODO: Mark the instructions with the appropriate subtarget info.
1163 let Inst{27-25} = 0b110;
1164 let Inst{11-8} = 0b1010;
1165}
1166
Evan Chengc63e15e2008-11-11 02:11:05 +00001167// Double precision, unary
1168class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001169 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1170 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001171 let Inst{27-20} = opcod1;
1172 let Inst{19-16} = opcod2;
1173 let Inst{11-8} = 0b1011;
1174 let Inst{7-4} = opcod3;
1175}
1176
1177// Double precision, binary
David Goodwincfd67652009-08-06 16:52:47 +00001178class ADbI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1179 string opc, string asm, list<dag> pattern>
1180 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001181 let Inst{27-20} = opcod;
1182 let Inst{11-8} = 0b1011;
1183}
1184
1185// Single precision, unary
1186class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001187 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1188 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001189 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
1190 let Inst{27-20} = opcod1;
1191 let Inst{19-16} = opcod2;
1192 let Inst{11-8} = 0b1010;
1193 let Inst{7-4} = opcod3;
1194}
1195
David Goodwin4b358db2009-08-10 22:17:39 +00001196// Single precision unary, if no NEON
David Goodwinbc7c05e2009-08-04 20:39:05 +00001197// Same as ASuI except not available if NEON is enabled
1198class ASuIn<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
Bob Wilsonccd00e32009-10-26 22:42:13 +00001199 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1200 : ASuI<opcod1, opcod2, opcod3, oops, iops, itin, opc, asm, pattern> {
David Goodwinbc7c05e2009-08-04 20:39:05 +00001201 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1202}
1203
Evan Chengc63e15e2008-11-11 02:11:05 +00001204// Single precision, binary
David Goodwincfd67652009-08-06 16:52:47 +00001205class ASbI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1206 string opc, string asm, list<dag> pattern>
1207 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001208 // Bit 22 (D bit) can be changed during instruction encoding.
1209 let Inst{27-20} = opcod;
1210 let Inst{11-8} = 0b1010;
1211}
1212
David Goodwin4b358db2009-08-10 22:17:39 +00001213// Single precision binary, if no NEON
David Goodwindd19ce42009-08-04 17:53:06 +00001214// Same as ASbI except not available if NEON is enabled
David Goodwincfd67652009-08-06 16:52:47 +00001215class ASbIn<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1216 string opc, string asm, list<dag> pattern>
1217 : ASbI<opcod, oops, iops, itin, opc, asm, pattern> {
David Goodwindd19ce42009-08-04 17:53:06 +00001218 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1219}
1220
Evan Cheng74273382008-11-12 06:41:41 +00001221// VFP conversion instructions
1222class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001223 dag oops, dag iops, InstrItinClass itin,
1224 string opc, string asm, list<dag> pattern>
1225 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Evan Cheng9d3cc182008-11-11 19:40:26 +00001226 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +00001227 let Inst{19-16} = opcod2;
1228 let Inst{11-8} = opcod3;
1229 let Inst{6} = 1;
1230}
1231
David Goodwin4b358db2009-08-10 22:17:39 +00001232// VFP conversion instructions, if no NEON
1233class AVConv1In<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
1234 dag oops, dag iops, InstrItinClass itin,
1235 string opc, string asm, list<dag> pattern>
1236 : AVConv1I<opcod1, opcod2, opcod3, oops, iops, itin, opc, asm, pattern> {
1237 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1238}
1239
Evan Cheng74273382008-11-12 06:41:41 +00001240class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwincfd67652009-08-06 16:52:47 +00001241 InstrItinClass itin,
1242 string opc, string asm, list<dag> pattern>
1243 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng74273382008-11-12 06:41:41 +00001244 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001245 let Inst{11-8} = opcod2;
1246 let Inst{4} = 1;
1247}
1248
David Goodwincfd67652009-08-06 16:52:47 +00001249class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1250 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1251 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +00001252
David Goodwincfd67652009-08-06 16:52:47 +00001253class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1254 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1255 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng74273382008-11-12 06:41:41 +00001256
David Goodwincfd67652009-08-06 16:52:47 +00001257class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1258 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1259 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng74273382008-11-12 06:41:41 +00001260
David Goodwincfd67652009-08-06 16:52:47 +00001261class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1262 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1263 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001264
Evan Chengc63e15e2008-11-11 02:11:05 +00001265//===----------------------------------------------------------------------===//
1266
Bob Wilsone60fee02009-06-22 23:27:02 +00001267//===----------------------------------------------------------------------===//
1268// ARM NEON Instruction templates.
1269//
Evan Cheng34a46e12008-08-29 06:41:12 +00001270
David Goodwincfd67652009-08-06 16:52:47 +00001271class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001272 string opc, string dt, string asm, string cstr, list<dag> pattern>
1273 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
1274 let OutOperandList = oops;
1275 let InOperandList = !con(iops, (ops pred:$p));
1276 let AsmString = !strconcat(
1277 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1278 !strconcat("\t", asm));
1279 let Pattern = pattern;
1280 list<Predicate> Predicates = [HasNEON];
1281}
1282
1283// Same as NeonI except it does not have a "data type" specifier.
1284class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001285 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001286 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001287 let OutOperandList = oops;
Evan Cheng67abcec2009-11-21 06:21:52 +00001288 let InOperandList = !con(iops, (ops pred:$p));
Evan Cheng09c61b32009-11-23 21:57:23 +00001289 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilsone60fee02009-06-22 23:27:02 +00001290 let Pattern = pattern;
1291 list<Predicate> Predicates = [HasNEON];
Evan Cheng34a46e12008-08-29 06:41:12 +00001292}
1293
Evan Cheng67abcec2009-11-21 06:21:52 +00001294class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1295 list<dag> pattern>
Evan Cheng09c61b32009-11-23 21:57:23 +00001296 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
Evan Cheng67abcec2009-11-21 06:21:52 +00001297 pattern> {
Evan Cheng34a46e12008-08-29 06:41:12 +00001298}
Bob Wilsone60fee02009-06-22 23:27:02 +00001299
Evan Cheng09c61b32009-11-23 21:57:23 +00001300class NI4<dag oops, dag iops, InstrItinClass itin, string opc,
1301 string asm, list<dag> pattern>
1302 : NeonXI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "",
1303 pattern> {
Anton Korobeynikov3f087662009-08-08 13:35:48 +00001304}
1305
Bob Wilsonb1721162009-10-07 21:53:04 +00001306class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1307 dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001308 string opc, string dt, string asm, string cstr, list<dag> pattern>
1309 : NeonI<oops, iops, AddrMode6, IndexModeNone, itin, opc, dt, asm, cstr,
1310 pattern> {
Bob Wilsoned592c02009-07-08 18:11:30 +00001311 let Inst{31-24} = 0b11110100;
Jim Grosbach77ef7772009-10-20 00:19:08 +00001312 let Inst{23} = op23;
1313 let Inst{21-20} = op21_20;
1314 let Inst{11-8} = op11_8;
1315 let Inst{7-4} = op7_4;
Bob Wilsoned592c02009-07-08 18:11:30 +00001316}
1317
David Goodwincfd67652009-08-06 16:52:47 +00001318class NDataI<dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001319 string opc, string dt, string asm, string cstr, list<dag> pattern>
1320 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, dt, asm,
1321 cstr, pattern> {
1322 let Inst{31-25} = 0b1111001;
1323}
1324
1325class NDataXI<dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001326 string opc, string asm, string cstr, list<dag> pattern>
Evan Cheng09c61b32009-11-23 21:57:23 +00001327 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
Evan Cheng67abcec2009-11-21 06:21:52 +00001328 cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001329 let Inst{31-25} = 0b1111001;
1330}
1331
1332// NEON "one register and a modified immediate" format.
1333class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1334 bit op5, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001335 dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001336 string opc, string dt, string asm, string cstr, list<dag> pattern>
1337 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001338 let Inst{23} = op23;
1339 let Inst{21-19} = op21_19;
1340 let Inst{11-8} = op11_8;
1341 let Inst{7} = op7;
1342 let Inst{6} = op6;
1343 let Inst{5} = op5;
1344 let Inst{4} = op4;
1345}
1346
1347// NEON 2 vector register format.
1348class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1349 bits<5> op11_7, bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001350 dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001351 string opc, string dt, string asm, string cstr, list<dag> pattern>
1352 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1353 let Inst{24-23} = op24_23;
1354 let Inst{21-20} = op21_20;
1355 let Inst{19-18} = op19_18;
1356 let Inst{17-16} = op17_16;
1357 let Inst{11-7} = op11_7;
1358 let Inst{6} = op6;
1359 let Inst{4} = op4;
1360}
1361
1362// Same as N2V except it doesn't have a datatype suffix.
1363class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1364 bits<5> op11_7, bit op6, bit op4,
1365 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001366 string opc, string asm, string cstr, list<dag> pattern>
Evan Cheng09c61b32009-11-23 21:57:23 +00001367 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001368 let Inst{24-23} = op24_23;
1369 let Inst{21-20} = op21_20;
1370 let Inst{19-18} = op19_18;
1371 let Inst{17-16} = op17_16;
1372 let Inst{11-7} = op11_7;
1373 let Inst{6} = op6;
1374 let Inst{4} = op4;
1375}
1376
1377// NEON 2 vector register with immediate.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001378class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001379 dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001380 string opc, string dt, string asm, string cstr, list<dag> pattern>
1381 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001382 let Inst{24} = op24;
1383 let Inst{23} = op23;
Bob Wilsone60fee02009-06-22 23:27:02 +00001384 let Inst{11-8} = op11_8;
1385 let Inst{7} = op7;
1386 let Inst{6} = op6;
1387 let Inst{4} = op4;
1388}
1389
1390// NEON 3 vector register format.
1391class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001392 dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001393 string opc, string dt, string asm, string cstr, list<dag> pattern>
1394 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1395 let Inst{24} = op24;
1396 let Inst{23} = op23;
1397 let Inst{21-20} = op21_20;
1398 let Inst{11-8} = op11_8;
1399 let Inst{6} = op6;
1400 let Inst{4} = op4;
1401}
1402
1403// Same as N3VX except it doesn't have a data type suffix.
1404class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1405 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001406 string opc, string asm, string cstr, list<dag> pattern>
Evan Cheng09c61b32009-11-23 21:57:23 +00001407 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001408 let Inst{24} = op24;
1409 let Inst{23} = op23;
1410 let Inst{21-20} = op21_20;
1411 let Inst{11-8} = op11_8;
1412 let Inst{6} = op6;
1413 let Inst{4} = op4;
1414}
1415
1416// NEON VMOVs between scalar and core registers.
1417class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001418 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001419 string opc, string dt, string asm, list<dag> pattern>
1420 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
1421 "", itin> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001422 let Inst{27-20} = opcod1;
1423 let Inst{11-8} = opcod2;
1424 let Inst{6-5} = opcod3;
1425 let Inst{4} = 1;
Evan Cheng09c61b32009-11-23 21:57:23 +00001426
1427 let OutOperandList = oops;
1428 let InOperandList = !con(iops, (ops pred:$p));
1429 let AsmString = !strconcat(
1430 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1431 !strconcat("\t", asm));
1432 let Pattern = pattern;
Bob Wilsone60fee02009-06-22 23:27:02 +00001433 list<Predicate> Predicates = [HasNEON];
1434}
1435class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001436 dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001437 string opc, string dt, string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +00001438 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001439 opc, dt, asm, pattern>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001440class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001441 dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001442 string opc, string dt, string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +00001443 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001444 opc, dt, asm, pattern>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001445class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001446 dag oops, dag iops, InstrItinClass itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001447 string opc, string dt, string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +00001448 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
Evan Cheng09c61b32009-11-23 21:57:23 +00001449 opc, dt, asm, pattern>;
David Goodwindd19ce42009-08-04 17:53:06 +00001450
1451// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1452// for single-precision FP.
1453class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1454 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1455}