blob: f840770f99412ef5b4c40eb04a1bfd95e17835a6 [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
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000111// Instruction execution domain.
112class Domain<bits<2> val> {
113 bits<2> Value = val;
114}
115def GenericDomain : Domain<0>;
116def VFPDomain : Domain<1>; // Instructions in VFP domain only
117def NeonDomain : Domain<2>; // Instructions in Neon domain only
118def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
119
Evan Cheng532cdc52009-06-29 07:51:04 +0000120//===----------------------------------------------------------------------===//
Evan Cheng7b0249b2008-08-28 23:39:26 +0000121
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000122// ARM special operands.
123//
124
125// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
126// register whose default is 0 (no register).
127def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
128 (ops (i32 14), (i32 zero_reg))> {
129 let PrintMethod = "printPredicateOperand";
130}
131
132// Conditional code result for instructions whose 's' bit is set, e.g. subs.
133def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
134 let PrintMethod = "printSBitModifierOperand";
135}
136
137// Same as cc_out except it defaults to setting CPSR.
138def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
139 let PrintMethod = "printSBitModifierOperand";
140}
141
142//===----------------------------------------------------------------------===//
143
Evan Cheng7b0249b2008-08-28 23:39:26 +0000144// ARM Instruction templates.
145//
146
Evan Chengbe998242008-11-06 08:47:38 +0000147class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000148 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng7b0249b2008-08-28 23:39:26 +0000149 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +0000150 field bits<32> Inst;
151
Evan Cheng7b0249b2008-08-28 23:39:26 +0000152 let Namespace = "ARM";
153
Evan Cheng86a926a2008-11-05 18:35:52 +0000154 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +0000155 AddrMode AM = am;
156 bits<4> AddrModeBits = AM.Value;
157
158 SizeFlagVal SZ = sz;
159 bits<3> SizeFlag = SZ.Value;
160
161 IndexMode IM = im;
162 bits<2> IndexModeBits = IM.Value;
163
164 Format F = f;
165 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +0000166
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000167 Domain D = d;
168 bits<2> Dom = D.Value;
169
Evan Cheng86a926a2008-11-05 18:35:52 +0000170 //
171 // Attributes specific to ARM instructions...
172 //
173 bit isUnaryDataProc = 0;
Evan Cheng9aa4cd32009-07-08 01:46:35 +0000174 bit canXformTo16Bit = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +0000175
176 let Constraints = cstr;
David Goodwincfd67652009-08-06 16:52:47 +0000177 let Itinerary = itin;
Evan Cheng7b0249b2008-08-28 23:39:26 +0000178}
179
David Goodwincfd67652009-08-06 16:52:47 +0000180class PseudoInst<dag oops, dag iops, InstrItinClass itin,
181 string asm, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000182 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
183 "", itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000184 let OutOperandList = oops;
185 let InOperandList = iops;
186 let AsmString = asm;
187 let Pattern = pattern;
188}
189
190// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +0000191class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000192 IndexMode im, Format f, InstrItinClass itin,
193 string opc, string asm, string cstr,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000194 list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000195 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000196 let OutOperandList = oops;
197 let InOperandList = !con(iops, (ops pred:$p));
198 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
199 let Pattern = pattern;
200 list<Predicate> Predicates = [IsARM];
201}
202
203// Same as I except it can optionally modify CPSR. Note it's modeled as
204// an input operand since by default it's a zero register. It will
205// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000206class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000207 IndexMode im, Format f, InstrItinClass itin,
208 string opc, string asm, string cstr,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000209 list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000210 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000211 let OutOperandList = oops;
212 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
213 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
214 let Pattern = pattern;
215 list<Predicate> Predicates = [IsARM];
216}
217
Evan Chengc5409a82008-09-01 07:19:00 +0000218// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000219class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000220 IndexMode im, Format f, InstrItinClass itin,
221 string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000222 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Chengc5409a82008-09-01 07:19:00 +0000223 let OutOperandList = oops;
224 let InOperandList = iops;
225 let AsmString = asm;
226 let Pattern = pattern;
227 list<Predicate> Predicates = [IsARM];
228}
229
David Goodwincfd67652009-08-06 16:52:47 +0000230class AI<dag oops, dag iops, Format f, InstrItinClass itin,
231 string opc, string asm, list<dag> pattern>
232 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
233 opc, asm, "", pattern>;
234class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
235 string opc, string asm, list<dag> pattern>
236 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
237 opc, asm, "", pattern>;
238class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000239 string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000240 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng37afa432008-11-06 22:15:19 +0000241 asm, "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000242
243// Ctrl flow instructions
David Goodwincfd67652009-08-06 16:52:47 +0000244class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
245 string opc, string asm, list<dag> pattern>
246 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
247 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000248 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000249}
David Goodwincfd67652009-08-06 16:52:47 +0000250class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
251 string asm, list<dag> pattern>
252 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
253 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000254 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000255}
David Goodwincfd67652009-08-06 16:52:47 +0000256class ABXIx2<dag oops, dag iops, InstrItinClass itin,
257 string asm, list<dag> pattern>
258 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
259 asm, "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000260
261// BR_JT instructions
David Goodwincfd67652009-08-06 16:52:47 +0000262class JTI<dag oops, dag iops, InstrItinClass itin,
263 string asm, list<dag> pattern>
264 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000265 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000266
267// addrmode1 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000268class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
269 string opc, string asm, list<dag> pattern>
270 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
271 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000272 let Inst{24-21} = opcod;
273 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000274}
David Goodwincfd67652009-08-06 16:52:47 +0000275class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
276 string opc, string asm, list<dag> pattern>
277 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
278 opc, asm, "", pattern> {
279 let Inst{24-21} = opcod;
280 let Inst{27-26} = {0,0};
281}
282class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000283 string asm, list<dag> pattern>
David Goodwincfd67652009-08-06 16:52:47 +0000284 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Chengd0750352008-08-29 07:40:52 +0000285 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000286 let Inst{24-21} = opcod;
287 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000288}
David Goodwincfd67652009-08-06 16:52:47 +0000289class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
290 string opc, string asm, list<dag> pattern>
291 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
292 opc, asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000293
Evan Cheng2e62b662008-09-01 01:51:14 +0000294
295// addrmode2 loads and stores
David Goodwincfd67652009-08-06 16:52:47 +0000296class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
297 string opc, string asm, list<dag> pattern>
298 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
299 opc, asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000300 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000301}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000302
303// loads
David Goodwincfd67652009-08-06 16:52:47 +0000304class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
305 string opc, string asm, list<dag> pattern>
306 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
307 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000308 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000309 let Inst{21} = 0; // W bit
310 let Inst{22} = 0; // B bit
311 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000312 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000313}
David Goodwincfd67652009-08-06 16:52:47 +0000314class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
315 string asm, list<dag> pattern>
316 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000317 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000318 let Inst{20} = 1; // L bit
319 let Inst{21} = 0; // W bit
320 let Inst{22} = 0; // B bit
321 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000322 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000323}
David Goodwincfd67652009-08-06 16:52:47 +0000324class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
325 string opc, string asm, list<dag> pattern>
326 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
327 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000328 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000329 let Inst{21} = 0; // W bit
330 let Inst{22} = 1; // B bit
331 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000332 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000333}
David Goodwincfd67652009-08-06 16:52:47 +0000334class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
335 string asm, list<dag> pattern>
336 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000337 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000338 let Inst{20} = 1; // L bit
339 let Inst{21} = 0; // W bit
340 let Inst{22} = 1; // B bit
341 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000342 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000343}
Evan Chengda020022008-08-31 19:02:21 +0000344
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000345// stores
David Goodwincfd67652009-08-06 16:52:47 +0000346class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
347 string opc, string asm, list<dag> pattern>
348 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
349 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000350 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000351 let Inst{21} = 0; // W bit
352 let Inst{22} = 0; // B bit
353 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000354 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000355}
David Goodwincfd67652009-08-06 16:52:47 +0000356class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
357 string asm, list<dag> pattern>
358 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000359 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000360 let Inst{20} = 0; // L bit
361 let Inst{21} = 0; // W bit
362 let Inst{22} = 0; // B bit
363 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000364 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000365}
David Goodwincfd67652009-08-06 16:52:47 +0000366class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
367 string opc, string asm, list<dag> pattern>
368 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
369 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000370 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000371 let Inst{21} = 0; // W bit
372 let Inst{22} = 1; // B bit
373 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000374 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000375}
David Goodwincfd67652009-08-06 16:52:47 +0000376class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
377 string asm, list<dag> pattern>
378 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000379 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000380 let Inst{20} = 0; // L bit
381 let Inst{21} = 0; // W bit
382 let Inst{22} = 1; // B bit
383 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000384 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000385}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000386
Evan Chengac92c3f2008-09-01 07:00:14 +0000387// Pre-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000388class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
389 string opc, string asm, string cstr, list<dag> pattern>
390 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
391 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000392 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000393 let Inst{21} = 1; // W bit
394 let Inst{22} = 0; // B bit
395 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000396 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000397}
David Goodwincfd67652009-08-06 16:52:47 +0000398class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
399 string opc, string asm, string cstr, list<dag> pattern>
400 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
401 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000402 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000403 let Inst{21} = 1; // W bit
404 let Inst{22} = 1; // B bit
405 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000406 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000407}
408
Evan Chengac92c3f2008-09-01 07:00:14 +0000409// Pre-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000410class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
411 string opc, string asm, string cstr, list<dag> pattern>
412 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
413 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000414 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000415 let Inst{21} = 1; // W bit
416 let Inst{22} = 0; // B bit
417 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000418 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000419}
David Goodwincfd67652009-08-06 16:52:47 +0000420class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
421 string opc, string asm, string cstr, list<dag> pattern>
422 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
423 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000424 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000425 let Inst{21} = 1; // W bit
426 let Inst{22} = 1; // B bit
427 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000428 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000429}
430
Evan Chengac92c3f2008-09-01 07:00:14 +0000431// Post-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000432class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
433 string opc, string asm, string cstr, list<dag> pattern>
434 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
435 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000436 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000437 let Inst{21} = 0; // W bit
438 let Inst{22} = 0; // B bit
439 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000440 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000441}
David Goodwincfd67652009-08-06 16:52:47 +0000442class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
443 string opc, string asm, string cstr, list<dag> pattern>
444 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
445 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000446 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000447 let Inst{21} = 0; // W bit
448 let Inst{22} = 1; // B bit
449 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000450 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000451}
452
Evan Chengac92c3f2008-09-01 07:00:14 +0000453// Post-indexed stores
David Goodwincfd67652009-08-06 16:52:47 +0000454class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
455 string opc, string asm, string cstr, list<dag> pattern>
456 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
457 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000458 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000459 let Inst{21} = 0; // W bit
460 let Inst{22} = 0; // B bit
461 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000462 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000463}
David Goodwincfd67652009-08-06 16:52:47 +0000464class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
465 string opc, string asm, string cstr, list<dag> pattern>
466 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
467 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000468 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000469 let Inst{21} = 0; // W bit
470 let Inst{22} = 1; // B bit
471 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000472 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000473}
474
Evan Cheng2e62b662008-09-01 01:51:14 +0000475// addrmode3 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000476class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
477 string opc, string asm, list<dag> pattern>
478 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
479 opc, asm, "", pattern>;
480class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
481 string asm, list<dag> pattern>
482 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
483 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000484
Evan Chengac92c3f2008-09-01 07:00:14 +0000485// loads
David Goodwincfd67652009-08-06 16:52:47 +0000486class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
487 string opc, string asm, list<dag> pattern>
488 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
489 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +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
Evan Chengdabc6c02009-07-08 22:51:32 +0000497 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000498}
David Goodwincfd67652009-08-06 16:52:47 +0000499class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
500 string asm, list<dag> pattern>
501 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000502 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000503 let Inst{4} = 1;
504 let Inst{5} = 1; // H bit
505 let Inst{6} = 0; // S bit
506 let Inst{7} = 1;
507 let Inst{20} = 1; // L bit
508 let Inst{21} = 0; // W bit
509 let Inst{24} = 1; // P bit
510}
David Goodwincfd67652009-08-06 16:52:47 +0000511class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
512 string opc, string asm, list<dag> pattern>
513 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
514 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +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
Evan Chengdabc6c02009-07-08 22:51:32 +0000522 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000523}
David Goodwincfd67652009-08-06 16:52:47 +0000524class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
525 string asm, list<dag> pattern>
526 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000527 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000528 let Inst{4} = 1;
529 let Inst{5} = 1; // H bit
530 let Inst{6} = 1; // S bit
531 let Inst{7} = 1;
532 let Inst{20} = 1; // L bit
533 let Inst{21} = 0; // W bit
534 let Inst{24} = 1; // P bit
535}
David Goodwincfd67652009-08-06 16:52:47 +0000536class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
537 string opc, string asm, list<dag> pattern>
538 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
539 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +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
Evan Chengdabc6c02009-07-08 22:51:32 +0000547 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000548}
David Goodwincfd67652009-08-06 16:52:47 +0000549class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
550 string asm, list<dag> pattern>
551 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000552 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000553 let Inst{4} = 1;
554 let Inst{5} = 0; // H bit
555 let Inst{6} = 1; // S bit
556 let Inst{7} = 1;
557 let Inst{20} = 1; // L bit
558 let Inst{21} = 0; // W bit
559 let Inst{24} = 1; // P bit
560}
David Goodwincfd67652009-08-06 16:52:47 +0000561class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
562 string opc, string asm, list<dag> pattern>
563 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
564 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000565 let Inst{4} = 1;
566 let Inst{5} = 0; // H bit
567 let Inst{6} = 1; // S bit
568 let Inst{7} = 1;
569 let Inst{20} = 0; // L bit
570 let Inst{21} = 0; // W bit
571 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000572 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000573}
574
575// stores
David Goodwincfd67652009-08-06 16:52:47 +0000576class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
577 string opc, string asm, list<dag> pattern>
578 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
579 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +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
Evan Chengdabc6c02009-07-08 22:51:32 +0000587 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000588}
David Goodwincfd67652009-08-06 16:52:47 +0000589class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
590 string asm, list<dag> pattern>
591 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Chengc41fb3152008-11-05 23:22:34 +0000592 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000593 let Inst{4} = 1;
594 let Inst{5} = 1; // H bit
595 let Inst{6} = 0; // S bit
596 let Inst{7} = 1;
597 let Inst{20} = 0; // L bit
598 let Inst{21} = 0; // W bit
599 let Inst{24} = 1; // P bit
600}
David Goodwincfd67652009-08-06 16:52:47 +0000601class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
602 string opc, string asm, list<dag> pattern>
603 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
604 opc, asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000605 let Inst{4} = 1;
606 let Inst{5} = 1; // H bit
607 let Inst{6} = 1; // S bit
608 let Inst{7} = 1;
609 let Inst{20} = 0; // L bit
610 let Inst{21} = 0; // W bit
611 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000612 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000613}
614
615// Pre-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000616class AI3ldhpr<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} = 0; // 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 AI3ldshpr<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} = 1; // 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}
David Goodwincfd67652009-08-06 16:52:47 +0000642class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
643 string opc, string asm, string cstr, list<dag> pattern>
644 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
645 opc, asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000646 let Inst{4} = 1;
647 let Inst{5} = 0; // H bit
648 let Inst{6} = 1; // S bit
649 let Inst{7} = 1;
650 let Inst{20} = 1; // L bit
651 let Inst{21} = 1; // 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 stores
David Goodwincfd67652009-08-06 16:52:47 +0000657class AI3sthpr<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} = 0; // 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}
670
671// Post-indexed loads
David Goodwincfd67652009-08-06 16:52:47 +0000672class AI3ldhpo<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} = 0; // S bit
679 let Inst{7} = 1;
680 let Inst{20} = 1; // L bit
681 let Inst{21} = 1; // W bit
682 let Inst{24} = 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 AI3ldshpo<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} = 1; // H bit
691 let Inst{6} = 1; // S bit
692 let Inst{7} = 1;
693 let Inst{20} = 1; // L bit
694 let Inst{21} = 1; // W bit
695 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000696 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000697}
David Goodwincfd67652009-08-06 16:52:47 +0000698class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
699 string opc, string asm, string cstr, list<dag> pattern>
700 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
701 opc, asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000702 let Inst{4} = 1;
703 let Inst{5} = 0; // H bit
704 let Inst{6} = 1; // S bit
705 let Inst{7} = 1;
706 let Inst{20} = 1; // L bit
707 let Inst{21} = 1; // W bit
708 let Inst{24} = 0; // 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 stores
David Goodwincfd67652009-08-06 16:52:47 +0000713class AI3sthpo<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} = 0; // 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}
726
727
Evan Cheng2e62b662008-09-01 01:51:14 +0000728// addrmode4 instructions
David Goodwincfd67652009-08-06 16:52:47 +0000729class AXI4ld<dag oops, dag iops, Format f, InstrItinClass itin,
730 string asm, list<dag> pattern>
731 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
732 asm, "", pattern> {
Evan Chengd36b01c2008-09-01 07:48:18 +0000733 let Inst{20} = 1; // L bit
734 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000735 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000736}
David Goodwincfd67652009-08-06 16:52:47 +0000737class AXI4st<dag oops, dag iops, Format f, InstrItinClass itin,
738 string asm, list<dag> pattern>
739 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, itin,
740 asm, "", pattern> {
Evan Chengd36b01c2008-09-01 07:48:18 +0000741 let Inst{20} = 0; // L bit
742 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000743 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000744}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000745
Jim Grosbach1feed042008-11-03 18:38:31 +0000746// Unsigned multiply, multiply-accumulate instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000747class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
748 string opc, string asm, list<dag> pattern>
749 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
750 opc, asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000751 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000752 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000753 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000754}
David Goodwincfd67652009-08-06 16:52:47 +0000755class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
756 string opc, string asm, list<dag> pattern>
757 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
758 opc, asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000759 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000760 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000761}
762
763// Most significant word multiply
David Goodwincfd67652009-08-06 16:52:47 +0000764class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
765 string opc, string asm, list<dag> pattern>
766 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
767 opc, asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000768 let Inst{7-4} = 0b1001;
769 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000770 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000771}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000772
Evan Cheng38396be2008-11-06 03:35:07 +0000773// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwincfd67652009-08-06 16:52:47 +0000774class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
775 string opc, string asm, list<dag> pattern>
776 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
777 opc, asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000778 let Inst{4} = 0;
779 let Inst{7} = 1;
780 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000781 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000782}
783
Evan Cheng37afa432008-11-06 22:15:19 +0000784// Extend instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000785class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
786 string opc, string asm, list<dag> pattern>
787 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
788 opc, asm, "", pattern> {
Evan Cheng37afa432008-11-06 22:15:19 +0000789 let Inst{7-4} = 0b0111;
790 let Inst{27-20} = opcod;
791}
792
Evan Chengc2121a22008-11-07 01:41:35 +0000793// Misc Arithmetic instructions.
David Goodwincfd67652009-08-06 16:52:47 +0000794class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
795 string opc, string asm, list<dag> pattern>
796 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
797 opc, asm, "", pattern> {
Evan Chengc2121a22008-11-07 01:41:35 +0000798 let Inst{27-20} = opcod;
799}
800
Evan Cheng7b0249b2008-08-28 23:39:26 +0000801//===----------------------------------------------------------------------===//
802
803// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
804class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
805 list<Predicate> Predicates = [IsARM];
806}
807class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
808 list<Predicate> Predicates = [IsARM, HasV5TE];
809}
810class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
811 list<Predicate> Predicates = [IsARM, HasV6];
812}
Evan Cheng34a46e12008-08-29 06:41:12 +0000813
814//===----------------------------------------------------------------------===//
815//
816// Thumb Instruction Format Definitions.
817//
818
Evan Cheng34a46e12008-08-29 06:41:12 +0000819// TI - Thumb instruction.
820
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000821class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000822 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000823 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000824 let OutOperandList = oops;
825 let InOperandList = iops;
Evan Cheng34a46e12008-08-29 06:41:12 +0000826 let AsmString = asm;
827 let Pattern = pattern;
828 list<Predicate> Predicates = [IsThumb];
829}
830
David Goodwincfd67652009-08-06 16:52:47 +0000831class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
832 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000833
Evan Chengd16eb2f2009-08-04 23:47:55 +0000834// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000835class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
836 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Chengd16eb2f2009-08-04 23:47:55 +0000837
Evan Cheng68e4b582009-08-01 00:16:10 +0000838// tBL, tBX instructions
David Goodwincfd67652009-08-06 16:52:47 +0000839class TIx2<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
840 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000841
842// BR_JT instructions
David Goodwincfd67652009-08-06 16:52:47 +0000843class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
844 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000845
Evan Cheng6fc534c2009-06-23 19:38:13 +0000846// Thumb1 only
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000847class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000848 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000849 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000850 let OutOperandList = oops;
851 let InOperandList = iops;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000852 let AsmString = asm;
853 let Pattern = pattern;
854 list<Predicate> Predicates = [IsThumb1Only];
855}
856
David Goodwincfd67652009-08-06 16:52:47 +0000857class T1I<dag oops, dag iops, InstrItinClass itin,
858 string asm, list<dag> pattern>
859 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
860class T1Ix2<dag oops, dag iops, InstrItinClass itin,
861 string asm, list<dag> pattern>
862 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
863class T1JTI<dag oops, dag iops, InstrItinClass itin,
864 string asm, list<dag> pattern>
865 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000866
867// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000868class T1It<dag oops, dag iops, InstrItinClass itin,
869 string asm, list<dag> pattern>
870 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
871 asm, "$lhs = $dst", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000872
873// Thumb1 instruction that can either be predicated or set CPSR.
874class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000875 InstrItinClass itin,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000876 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000877 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000878 let OutOperandList = !con(oops, (ops s_cc_out:$s));
879 let InOperandList = !con(iops, (ops pred:$p));
880 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
881 let Pattern = pattern;
882 list<Predicate> Predicates = [IsThumb1Only];
883}
884
David Goodwincfd67652009-08-06 16:52:47 +0000885class T1sI<dag oops, dag iops, InstrItinClass itin,
886 string opc, string asm, list<dag> pattern>
887 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000888
889// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000890class T1sIt<dag oops, dag iops, InstrItinClass itin,
891 string opc, string asm, list<dag> pattern>
892 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000893 "$lhs = $dst", pattern>;
894
895// Thumb1 instruction that can be predicated.
896class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000897 InstrItinClass itin,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000898 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000899 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000900 let OutOperandList = oops;
901 let InOperandList = !con(iops, (ops pred:$p));
902 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
903 let Pattern = pattern;
904 list<Predicate> Predicates = [IsThumb1Only];
905}
906
David Goodwincfd67652009-08-06 16:52:47 +0000907class T1pI<dag oops, dag iops, InstrItinClass itin,
908 string opc, string asm, list<dag> pattern>
909 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000910
911// Two-address instructions
David Goodwincfd67652009-08-06 16:52:47 +0000912class T1pIt<dag oops, dag iops, InstrItinClass itin,
913 string opc, string asm, list<dag> pattern>
914 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000915 "$lhs = $dst", pattern>;
916
David Goodwincfd67652009-08-06 16:52:47 +0000917class T1pI1<dag oops, dag iops, InstrItinClass itin,
918 string opc, string asm, list<dag> pattern>
919 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
920class T1pI2<dag oops, dag iops, InstrItinClass itin,
921 string opc, string asm, list<dag> pattern>
922 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
923class T1pI4<dag oops, dag iops, InstrItinClass itin,
924 string opc, string asm, list<dag> pattern>
925 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
926class T1pIs<dag oops, dag iops,
927 InstrItinClass itin, string opc, string asm, list<dag> pattern>
928 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000929
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000930// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
931class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000932 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000933 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000934 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000935 let OutOperandList = oops;
936 let InOperandList = !con(iops, (ops pred:$p));
937 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
938 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000939 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000940}
941
942// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
943// an input operand since by default it's a zero register. It will
944// become an implicit def once it's "flipped".
945// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
946// more consistent.
947class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000948 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000949 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000950 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000951 let OutOperandList = oops;
952 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
953 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
954 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000955 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000956}
957
958// Special cases
959class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +0000960 InstrItinClass itin,
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000961 string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +0000962 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000963 let OutOperandList = oops;
964 let InOperandList = iops;
Evan Cheng36173712009-06-23 17:48:47 +0000965 let AsmString = asm;
966 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000967 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000968}
969
David Goodwincfd67652009-08-06 16:52:47 +0000970class T2I<dag oops, dag iops, InstrItinClass itin,
971 string opc, string asm, list<dag> pattern>
972 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
973class T2Ii12<dag oops, dag iops, InstrItinClass itin,
974 string opc, string asm, list<dag> pattern>
975 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
976class T2Ii8<dag oops, dag iops, InstrItinClass itin,
977 string opc, string asm, list<dag> pattern>
978 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
979class T2Iso<dag oops, dag iops, InstrItinClass itin,
980 string opc, string asm, list<dag> pattern>
981 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
982class T2Ipc<dag oops, dag iops, InstrItinClass itin,
983 string opc, string asm, list<dag> pattern>
984 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
985class T2Ii8s4<dag oops, dag iops, InstrItinClass itin,
986 string opc, string asm, list<dag> pattern>
987 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000988
David Goodwincfd67652009-08-06 16:52:47 +0000989class T2sI<dag oops, dag iops, InstrItinClass itin,
990 string opc, string asm, list<dag> pattern>
991 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000992
David Goodwincfd67652009-08-06 16:52:47 +0000993class T2XI<dag oops, dag iops, InstrItinClass itin,
994 string asm, list<dag> pattern>
995 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
996class T2JTI<dag oops, dag iops, InstrItinClass itin,
997 string asm, list<dag> pattern>
998 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng36173712009-06-23 17:48:47 +0000999
Evan Cheng16c012d2009-09-28 09:14:39 +00001000class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1001 string opc, string asm, list<dag> pattern>
1002 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1003
1004
Evan Chenga90942e2009-07-02 07:28:31 +00001005// T2Iidxldst - Thumb2 indexed load / store instructions.
1006class T2Iidxldst<dag oops, dag iops, AddrMode am, IndexMode im,
David Goodwincfd67652009-08-06 16:52:47 +00001007 InstrItinClass itin,
Evan Chenga90942e2009-07-02 07:28:31 +00001008 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001009 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenga90942e2009-07-02 07:28:31 +00001010 let OutOperandList = oops;
1011 let InOperandList = !con(iops, (ops pred:$p));
1012 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1013 let Pattern = pattern;
1014 list<Predicate> Predicates = [IsThumb2];
1015}
1016
David Goodwin27c016b2009-07-27 19:59:26 +00001017// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1018class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1019 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1020}
1021
1022// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1023class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1024 list<Predicate> Predicates = [IsThumb1Only];
1025}
Evan Chenga90942e2009-07-02 07:28:31 +00001026
Evan Cheng19bb7c72009-06-27 02:26:13 +00001027// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1028class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengb1b2abc2009-07-02 06:38:40 +00001029 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +00001030}
1031
Evan Cheng34a46e12008-08-29 06:41:12 +00001032//===----------------------------------------------------------------------===//
1033
Evan Chengc63e15e2008-11-11 02:11:05 +00001034//===----------------------------------------------------------------------===//
1035// ARM VFP Instruction templates.
1036//
1037
David Goodwince9fbbe2009-07-10 17:03:29 +00001038// Almost all VFP instructions are predicable.
1039class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +00001040 IndexMode im, Format f, InstrItinClass itin,
1041 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001042 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwince9fbbe2009-07-10 17:03:29 +00001043 let OutOperandList = oops;
1044 let InOperandList = !con(iops, (ops pred:$p));
1045 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1046 let Pattern = pattern;
1047 list<Predicate> Predicates = [HasVFP2];
1048}
1049
1050// Special cases
1051class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwincfd67652009-08-06 16:52:47 +00001052 IndexMode im, Format f, InstrItinClass itin,
1053 string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001054 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwince9fbbe2009-07-10 17:03:29 +00001055 let OutOperandList = oops;
1056 let InOperandList = iops;
1057 let AsmString = asm;
1058 let Pattern = pattern;
1059 list<Predicate> Predicates = [HasVFP2];
1060}
1061
David Goodwincfd67652009-08-06 16:52:47 +00001062class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1063 string opc, string asm, list<dag> pattern>
1064 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1065 opc, asm, "", pattern>;
David Goodwince9fbbe2009-07-10 17:03:29 +00001066
Evan Chengbb786b32008-11-11 21:48:44 +00001067// ARM VFP addrmode5 loads and stores
1068class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001069 InstrItinClass itin,
Evan Chengbb786b32008-11-11 21:48:44 +00001070 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001071 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001072 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001073 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001074 let Inst{27-24} = opcod1;
1075 let Inst{21-20} = opcod2;
1076 let Inst{11-8} = 0b1011;
Anton Korobeynikov1853b6e2009-11-02 00:11:06 +00001077
1078 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1079 let Dom = VFPNeonDomain.Value;
Evan Chengc63e15e2008-11-11 02:11:05 +00001080}
1081
Evan Chengbb786b32008-11-11 21:48:44 +00001082class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001083 InstrItinClass itin,
Evan Chengbb786b32008-11-11 21:48:44 +00001084 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001085 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001086 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001087 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001088 let Inst{27-24} = opcod1;
1089 let Inst{21-20} = opcod2;
1090 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +00001091}
1092
Evan Chengbb786b32008-11-11 21:48:44 +00001093// Load / store multiple
Evan Cheng71429f82009-09-09 23:55:03 +00001094class AXDI5<dag oops, dag iops, InstrItinClass itin,
David Goodwincfd67652009-08-06 16:52:47 +00001095 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001096 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001097 VFPLdStMulFrm, itin, asm, "", pattern> {
Evan Chengbb786b32008-11-11 21:48:44 +00001098 // TODO: Mark the instructions with the appropriate subtarget info.
1099 let Inst{27-25} = 0b110;
1100 let Inst{11-8} = 0b1011;
Anton Korobeynikov1853b6e2009-11-02 00:11:06 +00001101
1102 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1103 let Dom = VFPNeonDomain.Value;
Evan Chengbb786b32008-11-11 21:48:44 +00001104}
1105
Evan Cheng71429f82009-09-09 23:55:03 +00001106class AXSI5<dag oops, dag iops, InstrItinClass itin,
David Goodwincfd67652009-08-06 16:52:47 +00001107 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001108 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwincfd67652009-08-06 16:52:47 +00001109 VFPLdStMulFrm, itin, asm, "", pattern> {
Evan Chengbb786b32008-11-11 21:48:44 +00001110 // TODO: Mark the instructions with the appropriate subtarget info.
1111 let Inst{27-25} = 0b110;
1112 let Inst{11-8} = 0b1010;
1113}
1114
Evan Chengc63e15e2008-11-11 02:11:05 +00001115// Double precision, unary
1116class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001117 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1118 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001119 let Inst{27-20} = opcod1;
1120 let Inst{19-16} = opcod2;
1121 let Inst{11-8} = 0b1011;
1122 let Inst{7-4} = opcod3;
1123}
1124
1125// Double precision, binary
David Goodwincfd67652009-08-06 16:52:47 +00001126class ADbI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1127 string opc, string asm, list<dag> pattern>
1128 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001129 let Inst{27-20} = opcod;
1130 let Inst{11-8} = 0b1011;
1131}
1132
1133// Single precision, unary
1134class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
David Goodwincfd67652009-08-06 16:52:47 +00001135 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1136 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001137 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
1138 let Inst{27-20} = opcod1;
1139 let Inst{19-16} = opcod2;
1140 let Inst{11-8} = 0b1010;
1141 let Inst{7-4} = opcod3;
1142}
1143
David Goodwin4b358db2009-08-10 22:17:39 +00001144// Single precision unary, if no NEON
David Goodwinbc7c05e2009-08-04 20:39:05 +00001145// Same as ASuI except not available if NEON is enabled
1146class ASuIn<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
Bob Wilsonccd00e32009-10-26 22:42:13 +00001147 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1148 : ASuI<opcod1, opcod2, opcod3, oops, iops, itin, opc, asm, pattern> {
David Goodwinbc7c05e2009-08-04 20:39:05 +00001149 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1150}
1151
Evan Chengc63e15e2008-11-11 02:11:05 +00001152// Single precision, binary
David Goodwincfd67652009-08-06 16:52:47 +00001153class ASbI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1154 string opc, string asm, list<dag> pattern>
1155 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001156 // Bit 22 (D bit) can be changed during instruction encoding.
1157 let Inst{27-20} = opcod;
1158 let Inst{11-8} = 0b1010;
1159}
1160
David Goodwin4b358db2009-08-10 22:17:39 +00001161// Single precision binary, if no NEON
David Goodwindd19ce42009-08-04 17:53:06 +00001162// Same as ASbI except not available if NEON is enabled
David Goodwincfd67652009-08-06 16:52:47 +00001163class ASbIn<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1164 string opc, string asm, list<dag> pattern>
1165 : ASbI<opcod, oops, iops, itin, opc, asm, pattern> {
David Goodwindd19ce42009-08-04 17:53:06 +00001166 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1167}
1168
Evan Cheng74273382008-11-12 06:41:41 +00001169// VFP conversion instructions
1170class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001171 dag oops, dag iops, InstrItinClass itin,
1172 string opc, string asm, list<dag> pattern>
1173 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Evan Cheng9d3cc182008-11-11 19:40:26 +00001174 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +00001175 let Inst{19-16} = opcod2;
1176 let Inst{11-8} = opcod3;
1177 let Inst{6} = 1;
1178}
1179
David Goodwin4b358db2009-08-10 22:17:39 +00001180// VFP conversion instructions, if no NEON
1181class AVConv1In<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
1182 dag oops, dag iops, InstrItinClass itin,
1183 string opc, string asm, list<dag> pattern>
1184 : AVConv1I<opcod1, opcod2, opcod3, oops, iops, itin, opc, asm, pattern> {
1185 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1186}
1187
Evan Cheng74273382008-11-12 06:41:41 +00001188class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwincfd67652009-08-06 16:52:47 +00001189 InstrItinClass itin,
1190 string opc, string asm, list<dag> pattern>
1191 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng74273382008-11-12 06:41:41 +00001192 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001193 let Inst{11-8} = opcod2;
1194 let Inst{4} = 1;
1195}
1196
David Goodwincfd67652009-08-06 16:52:47 +00001197class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1198 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1199 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +00001200
David Goodwincfd67652009-08-06 16:52:47 +00001201class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1202 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1203 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng74273382008-11-12 06:41:41 +00001204
David Goodwincfd67652009-08-06 16:52:47 +00001205class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1206 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1207 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng74273382008-11-12 06:41:41 +00001208
David Goodwincfd67652009-08-06 16:52:47 +00001209class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1210 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1211 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001212
Evan Chengc63e15e2008-11-11 02:11:05 +00001213//===----------------------------------------------------------------------===//
1214
Bob Wilsone60fee02009-06-22 23:27:02 +00001215//===----------------------------------------------------------------------===//
1216// ARM NEON Instruction templates.
1217//
Evan Cheng34a46e12008-08-29 06:41:12 +00001218
David Goodwincfd67652009-08-06 16:52:47 +00001219class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001220 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikoveed9c142009-11-02 00:10:38 +00001221 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001222 let OutOperandList = oops;
Evan Cheng67abcec2009-11-21 06:21:52 +00001223 let InOperandList = !con(iops, (ops pred:$p));
1224 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
Bob Wilsone60fee02009-06-22 23:27:02 +00001225 let Pattern = pattern;
1226 list<Predicate> Predicates = [HasNEON];
Evan Cheng34a46e12008-08-29 06:41:12 +00001227}
1228
Evan Cheng67abcec2009-11-21 06:21:52 +00001229class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1230 list<dag> pattern>
1231 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
1232 pattern> {
Evan Cheng34a46e12008-08-29 06:41:12 +00001233}
Bob Wilsone60fee02009-06-22 23:27:02 +00001234
Evan Cheng67abcec2009-11-21 06:21:52 +00001235class NI4<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1236 list<dag> pattern>
1237 : NeonI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "", pattern> {
Anton Korobeynikov3f087662009-08-08 13:35:48 +00001238}
1239
Bob Wilsonb1721162009-10-07 21:53:04 +00001240class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1241 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001242 string opc, string asm, string cstr, list<dag> pattern>
1243 : NeonI<oops, iops, AddrMode6, IndexModeNone, itin, opc, asm, cstr, pattern> {
Bob Wilsoned592c02009-07-08 18:11:30 +00001244 let Inst{31-24} = 0b11110100;
Jim Grosbach77ef7772009-10-20 00:19:08 +00001245 let Inst{23} = op23;
1246 let Inst{21-20} = op21_20;
1247 let Inst{11-8} = op11_8;
1248 let Inst{7-4} = op7_4;
Bob Wilsoned592c02009-07-08 18:11:30 +00001249}
1250
Johnny Chen9a5dc8b2009-11-19 19:20:17 +00001251// With selective bit(s) from op7_4 specified by subclasses.
1252class NLdStLN<bit op23, bits<2> op21_20, bits<4> op11_8,
1253 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001254 string opc, string asm, string cstr, list<dag> pattern>
1255 : NeonI<oops, iops, AddrMode6, IndexModeNone, itin, opc, asm, cstr, pattern> {
Johnny Chen9a5dc8b2009-11-19 19:20:17 +00001256 let Inst{31-24} = 0b11110100;
1257 let Inst{23} = op23;
1258 let Inst{21-20} = op21_20;
1259 let Inst{11-8} = op11_8;
1260}
1261
David Goodwincfd67652009-08-06 16:52:47 +00001262class NDataI<dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001263 string opc, string asm, string cstr, list<dag> pattern>
1264 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
1265 cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001266 let Inst{31-25} = 0b1111001;
1267}
1268
1269// NEON "one register and a modified immediate" format.
1270class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1271 bit op5, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001272 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001273 string opc, string asm, string cstr, list<dag> pattern>
1274 : NDataI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001275 let Inst{23} = op23;
1276 let Inst{21-19} = op21_19;
1277 let Inst{11-8} = op11_8;
1278 let Inst{7} = op7;
1279 let Inst{6} = op6;
1280 let Inst{5} = op5;
1281 let Inst{4} = op4;
1282}
1283
1284// NEON 2 vector register format.
1285class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1286 bits<5> op11_7, bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001287 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001288 string opc, string asm, string cstr, list<dag> pattern>
1289 : NDataI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001290 let Inst{24-23} = op24_23;
1291 let Inst{21-20} = op21_20;
1292 let Inst{19-18} = op19_18;
1293 let Inst{17-16} = op17_16;
1294 let Inst{11-7} = op11_7;
1295 let Inst{6} = op6;
1296 let Inst{4} = op4;
1297}
1298
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001299// NEON Vector Duplicate (scalar).
1300// Inst{19-16} is specified by subclasses.
1301class N2VDup<bits<2> op24_23, bits<2> op21_20, bits<5> op11_7, bit op6, bit op4,
1302 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001303 string opc, string asm, string cstr, list<dag> pattern>
1304 : NDataI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001305 let Inst{24-23} = op24_23;
1306 let Inst{21-20} = op21_20;
1307 let Inst{11-7} = op11_7;
1308 let Inst{6} = op6;
1309 let Inst{4} = op4;
1310}
1311
Bob Wilsone60fee02009-06-22 23:27:02 +00001312// NEON 2 vector register with immediate.
Bob Wilson52e0d9d2009-10-21 02:15:46 +00001313class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001314 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001315 string opc, string asm, string cstr, list<dag> pattern>
1316 : NDataI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001317 let Inst{24} = op24;
1318 let Inst{23} = op23;
Bob Wilsone60fee02009-06-22 23:27:02 +00001319 let Inst{11-8} = op11_8;
1320 let Inst{7} = op7;
1321 let Inst{6} = op6;
1322 let Inst{4} = op4;
1323}
1324
1325// NEON 3 vector register format.
1326class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwincfd67652009-08-06 16:52:47 +00001327 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001328 string opc, string asm, string cstr, list<dag> pattern>
1329 : NDataI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001330 let Inst{24} = op24;
1331 let Inst{23} = op23;
1332 let Inst{21-20} = op21_20;
1333 let Inst{11-8} = op11_8;
1334 let Inst{6} = op6;
1335 let Inst{4} = op4;
1336}
1337
Jim Grosbachc8d69892009-10-20 00:38:19 +00001338// NEON 3 vector register with immediate. This is only used for VEXT where
1339// op11_8 represents the starting byte index of the extracted result in the
1340// concatenation of the operands and is left unspecified.
1341class N3VImm<bit op24, bit op23, bits<2> op21_20, bit op6, bit op4,
1342 dag oops, dag iops, InstrItinClass itin,
Evan Cheng67abcec2009-11-21 06:21:52 +00001343 string opc, string asm, string cstr, list<dag> pattern>
1344 : NDataI<oops, iops, itin, opc, asm, cstr, pattern> {
Jim Grosbachc8d69892009-10-20 00:38:19 +00001345 let Inst{24} = op24;
1346 let Inst{23} = op23;
1347 let Inst{21-20} = op21_20;
1348 let Inst{6} = op6;
1349 let Inst{4} = op4;
1350}
1351
Bob Wilsone60fee02009-06-22 23:27:02 +00001352// NEON VMOVs between scalar and core registers.
1353class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001354 dag oops, dag iops, Format f, InstrItinClass itin,
1355 string opc, string asm, list<dag> pattern>
1356 : AI<oops, iops, f, itin, opc, asm, pattern> {
Bob Wilsone60fee02009-06-22 23:27:02 +00001357 let Inst{27-20} = opcod1;
1358 let Inst{11-8} = opcod2;
1359 let Inst{6-5} = opcod3;
1360 let Inst{4} = 1;
1361 list<Predicate> Predicates = [HasNEON];
1362}
1363class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001364 dag oops, dag iops, InstrItinClass itin,
1365 string opc, string asm, list<dag> pattern>
1366 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
1367 opc, asm, pattern>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001368class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001369 dag oops, dag iops, InstrItinClass itin,
1370 string opc, string asm, list<dag> pattern>
1371 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
1372 opc, asm, pattern>;
Bob Wilsone60fee02009-06-22 23:27:02 +00001373class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwincfd67652009-08-06 16:52:47 +00001374 dag oops, dag iops, InstrItinClass itin,
1375 string opc, string asm, list<dag> pattern>
1376 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
1377 opc, asm, pattern>;
David Goodwindd19ce42009-08-04 17:53:06 +00001378
1379// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1380// for single-precision FP.
1381class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1382 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1383}