blob: d487df16df5e3a5a5c9fa87034dc8bdce9fbb2f3 [file] [log] [blame]
Evan Cheng37f25d92008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
Bob Wilson01135592010-03-23 17:23:59 +00002//
Evan Cheng37f25d92008-08-28 23:39:26 +00003// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bob Wilson01135592010-03-23 17:23:59 +00007//
Evan Cheng37f25d92008-08-28 23:39:26 +00008//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11//
12// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
Bob Wilson89ef7b72010-03-17 21:13:43 +000018class Format<bits<6> val> {
19 bits<6> Value = val;
Evan Cheng37f25d92008-08-28 23:39:26 +000020}
21
Evan Chengffa6d962008-11-13 23:36:57 +000022def Pseudo : Format<0>;
23def MulFrm : Format<1>;
24def BrFrm : Format<2>;
25def BrMiscFrm : Format<3>;
Evan Cheng37f25d92008-08-28 23:39:26 +000026
Evan Chengffa6d962008-11-13 23:36:57 +000027def DPFrm : Format<4>;
28def DPSoRegFrm : Format<5>;
Evan Cheng37f25d92008-08-28 23:39:26 +000029
Evan Chengffa6d962008-11-13 23:36:57 +000030def LdFrm : Format<6>;
31def StFrm : Format<7>;
32def LdMiscFrm : Format<8>;
33def StMiscFrm : Format<9>;
34def LdStMulFrm : Format<10>;
Evan Cheng37f25d92008-08-28 23:39:26 +000035
Johnny Chen81f04d52010-03-19 17:39:00 +000036def LdStExFrm : Format<11>;
Jim Grosbach5278eb82009-12-11 01:42:04 +000037
Johnny Chen81f04d52010-03-19 17:39:00 +000038def ArithMiscFrm : Format<12>;
39def ExtFrm : Format<13>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000040
Johnny Chen81f04d52010-03-19 17:39:00 +000041def VFPUnaryFrm : Format<14>;
42def VFPBinaryFrm : Format<15>;
43def VFPConv1Frm : Format<16>;
44def VFPConv2Frm : Format<17>;
45def VFPConv3Frm : Format<18>;
46def VFPConv4Frm : Format<19>;
47def VFPConv5Frm : Format<20>;
48def VFPLdStFrm : Format<21>;
49def VFPLdStMulFrm : Format<22>;
50def VFPMiscFrm : Format<23>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000051
Johnny Chen81f04d52010-03-19 17:39:00 +000052def ThumbFrm : Format<24>;
Evan Cheng37f25d92008-08-28 23:39:26 +000053
Johnny Chen81f04d52010-03-19 17:39:00 +000054def NEONFrm : Format<25>;
55def NEONGetLnFrm : Format<26>;
56def NEONSetLnFrm : Format<27>;
57def NEONDupFrm : Format<28>;
Bob Wilson5bafff32009-06-22 23:27:02 +000058
Johnny Chenf4d81052010-02-12 22:53:19 +000059def MiscFrm : Format<29>;
60def ThumbMiscFrm : Format<30>;
61
Johnny Chenfa80bec2010-03-25 20:39:04 +000062def NLdStFrm : Format<31>;
63def N1RegModImmFrm : Format<32>;
64def N2RegFrm : Format<33>;
65def NVCVTFrm : Format<34>;
Johnny Chen2d2898e2010-03-25 21:49:12 +000066def NVDupLnFrm : Format<35>;
Johnny Chen0a3dc102010-03-26 01:07:59 +000067def N2RegVShLFrm : Format<36>;
68def N2RegVShRFrm : Format<37>;
Johnny Chen575c91c2010-03-26 18:32:20 +000069def N3RegFrm : Format<38>;
Johnny Chenc6e704d2010-03-26 21:26:28 +000070def N3RegVShFrm : Format<39>;
Johnny Chen629c25c2010-03-26 22:28:56 +000071def NVExtFrm : Format<40>;
Johnny Chen897dd0c2010-03-27 01:03:13 +000072def NVMulSLFrm : Format<41>;
Johnny Chen79c4d822010-03-29 01:14:22 +000073def NVTBLFrm : Format<42>;
Johnny Chencaa608e2010-03-20 00:17:00 +000074
Evan Cheng34a0fa32009-07-08 01:46:35 +000075// Misc flags.
76
Evan Chengedda31c2008-11-05 18:35:52 +000077// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000078// UnaryDP - Indicates this is a unary data processing instruction, i.e.
79// it doesn't have a Rn operand.
80class UnaryDP { bit isUnaryDataProc = 1; }
81
82// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
83// a 16-bit Thumb instruction if certain conditions are met.
84class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000085
Evan Cheng37f25d92008-08-28 23:39:26 +000086//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000087// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000088//
89
90// Addressing mode.
91class AddrMode<bits<4> val> {
92 bits<4> Value = val;
93}
94def AddrModeNone : AddrMode<0>;
95def AddrMode1 : AddrMode<1>;
96def AddrMode2 : AddrMode<2>;
97def AddrMode3 : AddrMode<3>;
98def AddrMode4 : AddrMode<4>;
99def AddrMode5 : AddrMode<5>;
Bob Wilson8b024a52009-07-01 23:16:05 +0000100def AddrMode6 : AddrMode<6>;
101def AddrModeT1_1 : AddrMode<7>;
102def AddrModeT1_2 : AddrMode<8>;
103def AddrModeT1_4 : AddrMode<9>;
104def AddrModeT1_s : AddrMode<10>;
David Goodwine1e52ed2009-07-22 22:24:31 +0000105def AddrModeT2_i12: AddrMode<11>;
Bob Wilson8b024a52009-07-01 23:16:05 +0000106def AddrModeT2_i8 : AddrMode<12>;
107def AddrModeT2_so : AddrMode<13>;
108def AddrModeT2_pc : AddrMode<14>;
109def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng055b0312009-06-29 07:51:04 +0000110
111// Instruction size.
112class SizeFlagVal<bits<3> val> {
113 bits<3> Value = val;
114}
115def SizeInvalid : SizeFlagVal<0>; // Unset.
116def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
117def Size8Bytes : SizeFlagVal<2>;
118def Size4Bytes : SizeFlagVal<3>;
119def Size2Bytes : SizeFlagVal<4>;
120
121// Load / store index mode.
122class IndexMode<bits<2> val> {
123 bits<2> Value = val;
124}
125def IndexModeNone : IndexMode<0>;
126def IndexModePre : IndexMode<1>;
127def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000128def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000129
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000130// Instruction execution domain.
131class Domain<bits<2> val> {
132 bits<2> Value = val;
133}
134def GenericDomain : Domain<0>;
135def VFPDomain : Domain<1>; // Instructions in VFP domain only
136def NeonDomain : Domain<2>; // Instructions in Neon domain only
137def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
138
Evan Cheng055b0312009-06-29 07:51:04 +0000139//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000140
Evan Cheng446c4282009-07-11 06:43:01 +0000141// ARM special operands.
142//
143
144// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
145// register whose default is 0 (no register).
146def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
147 (ops (i32 14), (i32 zero_reg))> {
148 let PrintMethod = "printPredicateOperand";
149}
150
151// Conditional code result for instructions whose 's' bit is set, e.g. subs.
152def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
153 let PrintMethod = "printSBitModifierOperand";
154}
155
156// Same as cc_out except it defaults to setting CPSR.
157def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
158 let PrintMethod = "printSBitModifierOperand";
159}
160
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000161// ARM special operands for disassembly only.
162//
163
164def cps_opt : Operand<i32> {
165 let PrintMethod = "printCPSOptionOperand";
166}
167
168def msr_mask : Operand<i32> {
169 let PrintMethod = "printMSRMaskOperand";
170}
171
172// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
173// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
174def neg_zero : Operand<i32> {
175 let PrintMethod = "printNegZeroOperand";
176}
177
Evan Cheng446c4282009-07-11 06:43:01 +0000178//===----------------------------------------------------------------------===//
179
Evan Cheng37f25d92008-08-28 23:39:26 +0000180// ARM Instruction templates.
181//
182
Johnny Chend68e1192009-12-15 17:24:14 +0000183class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
184 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000185 : Instruction {
186 let Namespace = "ARM";
187
Evan Cheng37f25d92008-08-28 23:39:26 +0000188 AddrMode AM = am;
Evan Cheng37f25d92008-08-28 23:39:26 +0000189 SizeFlagVal SZ = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000190 IndexMode IM = im;
191 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000192 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000193 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000194 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000195 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000196 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000197
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000198 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
199 let TSFlags{3-0} = AM.Value;
200 let TSFlags{6-4} = SZ.Value;
201 let TSFlags{8-7} = IndexModeBits;
202 let TSFlags{14-9} = Form;
203 let TSFlags{15} = isUnaryDataProc;
204 let TSFlags{16} = canXformTo16Bit;
205 let TSFlags{18-17} = D.Value;
206
Evan Cheng37f25d92008-08-28 23:39:26 +0000207 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000208 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000209}
210
Johnny Chend68e1192009-12-15 17:24:14 +0000211class Encoding {
212 field bits<32> Inst;
213}
214
215class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
216 Format f, Domain d, string cstr, InstrItinClass itin>
217 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
218
219// This Encoding-less class is used by Thumb1 to specify the encoding bits later
220// on by adding flavors to specific instructions.
221class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
222 Format f, Domain d, string cstr, InstrItinClass itin>
223 : InstTemplate<am, sz, im, f, d, cstr, itin>;
224
Bob Wilson01135592010-03-23 17:23:59 +0000225class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000226 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000227 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000228 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000229 let OutOperandList = oops;
230 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000231 let AsmString = asm;
Evan Cheng37f25d92008-08-28 23:39:26 +0000232 let Pattern = pattern;
233}
234
235// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000236class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000237 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000238 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000239 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000240 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000241 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000242 let InOperandList = !con(iops, (ins pred:$p));
Bob Wilsond3038462010-05-24 20:08:34 +0000243 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
Evan Cheng37f25d92008-08-28 23:39:26 +0000244 let Pattern = pattern;
245 list<Predicate> Predicates = [IsARM];
246}
Jim Grosbachf6b28622009-12-14 18:31:20 +0000247// A few are not predicable
248class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000249 IndexMode im, Format f, InstrItinClass itin,
250 string opc, string asm, string cstr,
251 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000252 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
253 let OutOperandList = oops;
254 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000255 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000256 let Pattern = pattern;
257 let isPredicable = 0;
258 list<Predicate> Predicates = [IsARM];
259}
Evan Cheng37f25d92008-08-28 23:39:26 +0000260
261// Same as I except it can optionally modify CPSR. Note it's modeled as
262// an input operand since by default it's a zero register. It will
263// become an implicit def once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000264class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000265 IndexMode im, Format f, InstrItinClass itin,
266 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000267 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000268 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000269 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000270 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsond3038462010-05-24 20:08:34 +0000271 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
Evan Cheng37f25d92008-08-28 23:39:26 +0000272 let Pattern = pattern;
273 list<Predicate> Predicates = [IsARM];
274}
275
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000276// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000277class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000278 IndexMode im, Format f, InstrItinClass itin,
279 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000280 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000281 let OutOperandList = oops;
282 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000283 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000284 let Pattern = pattern;
285 list<Predicate> Predicates = [IsARM];
286}
287
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000288class AI<dag oops, dag iops, Format f, InstrItinClass itin,
289 string opc, string asm, list<dag> pattern>
290 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
291 opc, asm, "", pattern>;
292class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
293 string opc, string asm, list<dag> pattern>
294 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
295 opc, asm, "", pattern>;
296class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000297 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000298 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000299 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000300class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000301 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000302 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000303 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000304
305// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000306class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
307 string opc, string asm, list<dag> pattern>
308 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
309 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000310 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000311}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000312class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
313 string asm, list<dag> pattern>
314 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
315 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000316 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000317}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000318class ABXIx2<dag oops, dag iops, InstrItinClass itin,
319 string asm, list<dag> pattern>
320 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
321 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000322
323// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000324class JTI<dag oops, dag iops, InstrItinClass itin,
325 string asm, list<dag> pattern>
326 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000327 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000328
Jim Grosbach5278eb82009-12-11 01:42:04 +0000329
330// Atomic load/store instructions
331
332class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
333 string opc, string asm, list<dag> pattern>
334 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
335 opc, asm, "", pattern> {
336 let Inst{27-23} = 0b00011;
337 let Inst{22-21} = opcod;
338 let Inst{20} = 1;
339 let Inst{11-0} = 0b111110011111;
340}
341class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
342 string opc, string asm, list<dag> pattern>
343 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
344 opc, asm, "", pattern> {
345 let Inst{27-23} = 0b00011;
346 let Inst{22-21} = opcod;
347 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000348 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000349}
350
Evan Cheng0d14fc82008-09-01 01:51:14 +0000351// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000352class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
353 string opc, string asm, list<dag> pattern>
354 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
355 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000356 let Inst{24-21} = opcod;
357 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000358}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000359class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
360 string opc, string asm, list<dag> pattern>
361 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
362 opc, asm, "", pattern> {
363 let Inst{24-21} = opcod;
364 let Inst{27-26} = {0,0};
365}
366class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000367 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000368 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000369 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000370 let Inst{24-21} = opcod;
371 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000372}
Bob Wilson01135592010-03-23 17:23:59 +0000373class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000374 string opc, string asm, list<dag> pattern>
375 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
376 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000377
Evan Cheng0d14fc82008-09-01 01:51:14 +0000378
379// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000380class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
381 string opc, string asm, list<dag> pattern>
382 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
383 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000384 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000385}
Evan Cheng93912732008-09-01 01:27:33 +0000386
387// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000388class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
389 string opc, string asm, list<dag> pattern>
390 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
391 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000392 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000393 let Inst{21} = 0; // W bit
394 let Inst{22} = 0; // B bit
395 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000396 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000397}
Bob Wilson01135592010-03-23 17:23:59 +0000398class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000399 string asm, list<dag> pattern>
400 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000401 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000402 let Inst{20} = 1; // L bit
403 let Inst{21} = 0; // W bit
404 let Inst{22} = 0; // B bit
405 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000406 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000407}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000408class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
409 string opc, string asm, list<dag> pattern>
410 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
411 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000412 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000413 let Inst{21} = 0; // W bit
414 let Inst{22} = 1; // B bit
415 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000416 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000417}
Bob Wilson01135592010-03-23 17:23:59 +0000418class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000419 string asm, list<dag> pattern>
420 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000421 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000422 let Inst{20} = 1; // L bit
423 let Inst{21} = 0; // W bit
424 let Inst{22} = 1; // B bit
425 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000426 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000427}
Evan Cheng17222df2008-08-31 19:02:21 +0000428
Evan Cheng93912732008-09-01 01:27:33 +0000429// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000430class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
431 string opc, string asm, list<dag> pattern>
432 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
433 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000434 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000435 let Inst{21} = 0; // W bit
436 let Inst{22} = 0; // B bit
437 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000438 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000439}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000440class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
441 string asm, list<dag> pattern>
442 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000443 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000444 let Inst{20} = 0; // L bit
445 let Inst{21} = 0; // W bit
446 let Inst{22} = 0; // B bit
447 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000448 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000449}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000450class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
451 string opc, string asm, list<dag> pattern>
452 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
453 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000454 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000455 let Inst{21} = 0; // W bit
456 let Inst{22} = 1; // B bit
457 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000458 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000459}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000460class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
461 string asm, list<dag> pattern>
462 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000463 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000464 let Inst{20} = 0; // L bit
465 let Inst{21} = 0; // W bit
466 let Inst{22} = 1; // B bit
467 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000468 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000469}
Evan Cheng93912732008-09-01 01:27:33 +0000470
Evan Cheng840917b2008-09-01 07:00:14 +0000471// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000472class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
473 string opc, string asm, string cstr, list<dag> pattern>
474 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
475 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000476 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000477 let Inst{21} = 1; // W bit
478 let Inst{22} = 0; // B bit
479 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000480 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000481}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000482class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
483 string opc, string asm, string cstr, list<dag> pattern>
484 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
485 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000486 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000487 let Inst{21} = 1; // W bit
488 let Inst{22} = 1; // B bit
489 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000490 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000491}
492
Evan Cheng840917b2008-09-01 07:00:14 +0000493// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000494class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
495 string opc, string asm, string cstr, list<dag> pattern>
496 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
497 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000498 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000499 let Inst{21} = 1; // W bit
500 let Inst{22} = 0; // B bit
501 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000502 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000503}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000504class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
505 string opc, string asm, string cstr, list<dag> pattern>
506 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
507 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000508 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000509 let Inst{21} = 1; // W bit
510 let Inst{22} = 1; // B bit
511 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000512 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000513}
514
Evan Cheng840917b2008-09-01 07:00:14 +0000515// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000516class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
517 string opc, string asm, string cstr, list<dag> pattern>
518 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
519 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000520 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000521 let Inst{21} = 0; // W bit
522 let Inst{22} = 0; // B bit
523 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000524 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000525}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000526class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
527 string opc, string asm, string cstr, list<dag> pattern>
528 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
529 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000530 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000531 let Inst{21} = 0; // W bit
532 let Inst{22} = 1; // B bit
533 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000534 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000535}
536
Evan Cheng840917b2008-09-01 07:00:14 +0000537// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000538class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
539 string opc, string asm, string cstr, list<dag> pattern>
540 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
541 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000542 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000543 let Inst{21} = 0; // W bit
544 let Inst{22} = 0; // B bit
545 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000546 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000547}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000548class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
549 string opc, string asm, string cstr, list<dag> pattern>
550 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
551 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000552 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000553 let Inst{21} = 0; // W bit
554 let Inst{22} = 1; // B bit
555 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000556 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000557}
558
Evan Cheng0d14fc82008-09-01 01:51:14 +0000559// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000560class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000561 string opc, string asm, list<dag> pattern>
562 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
563 opc, asm, "", pattern>;
564class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
565 string asm, list<dag> pattern>
566 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
567 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000568
Evan Cheng840917b2008-09-01 07:00:14 +0000569// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000570class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
571 string opc, string asm, list<dag> pattern>
572 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
573 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000574 let Inst{4} = 1;
575 let Inst{5} = 1; // H bit
576 let Inst{6} = 0; // S bit
577 let Inst{7} = 1;
578 let Inst{20} = 1; // L bit
579 let Inst{21} = 0; // W bit
580 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000581 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000582}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000583class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
584 string asm, list<dag> pattern>
585 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000586 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000587 let Inst{4} = 1;
588 let Inst{5} = 1; // H bit
589 let Inst{6} = 0; // S bit
590 let Inst{7} = 1;
591 let Inst{20} = 1; // L bit
592 let Inst{21} = 0; // W bit
593 let Inst{24} = 1; // P bit
594}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000595class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
596 string opc, string asm, list<dag> pattern>
597 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
598 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000599 let Inst{4} = 1;
600 let Inst{5} = 1; // H bit
601 let Inst{6} = 1; // S bit
602 let Inst{7} = 1;
603 let Inst{20} = 1; // L bit
604 let Inst{21} = 0; // W bit
605 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000606 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000607}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000608class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
609 string asm, list<dag> pattern>
610 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000611 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000612 let Inst{4} = 1;
613 let Inst{5} = 1; // H bit
614 let Inst{6} = 1; // S bit
615 let Inst{7} = 1;
616 let Inst{20} = 1; // L bit
617 let Inst{21} = 0; // W bit
618 let Inst{24} = 1; // P bit
619}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000620class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
621 string opc, string asm, list<dag> pattern>
622 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
623 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000624 let Inst{4} = 1;
625 let Inst{5} = 0; // H bit
626 let Inst{6} = 1; // S bit
627 let Inst{7} = 1;
628 let Inst{20} = 1; // L bit
629 let Inst{21} = 0; // W bit
630 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000631 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000632}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000633class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
634 string asm, list<dag> pattern>
635 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000636 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000637 let Inst{4} = 1;
638 let Inst{5} = 0; // H bit
639 let Inst{6} = 1; // S bit
640 let Inst{7} = 1;
641 let Inst{20} = 1; // L bit
642 let Inst{21} = 0; // W bit
643 let Inst{24} = 1; // P bit
644}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000645class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
646 string opc, string asm, list<dag> pattern>
647 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
648 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000649 let Inst{4} = 1;
650 let Inst{5} = 0; // H bit
651 let Inst{6} = 1; // S bit
652 let Inst{7} = 1;
653 let Inst{20} = 0; // L bit
654 let Inst{21} = 0; // W bit
655 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000656 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000657}
658
659// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000660class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
661 string opc, string asm, list<dag> pattern>
662 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
663 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000664 let Inst{4} = 1;
665 let Inst{5} = 1; // H bit
666 let Inst{6} = 0; // S bit
667 let Inst{7} = 1;
668 let Inst{20} = 0; // L bit
669 let Inst{21} = 0; // W bit
670 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000671 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000672}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000673class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
674 string asm, list<dag> pattern>
675 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000676 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000677 let Inst{4} = 1;
678 let Inst{5} = 1; // H bit
679 let Inst{6} = 0; // S bit
680 let Inst{7} = 1;
681 let Inst{20} = 0; // L bit
682 let Inst{21} = 0; // W bit
683 let Inst{24} = 1; // P bit
684}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000685class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
686 string opc, string asm, list<dag> pattern>
687 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
688 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000689 let Inst{4} = 1;
690 let Inst{5} = 1; // H bit
691 let Inst{6} = 1; // S bit
692 let Inst{7} = 1;
693 let Inst{20} = 0; // L bit
694 let Inst{21} = 0; // W bit
695 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000696 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000697}
698
699// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000700class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
701 string opc, string asm, string cstr, list<dag> pattern>
702 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
703 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000704 let Inst{4} = 1;
705 let Inst{5} = 1; // H bit
706 let Inst{6} = 0; // S bit
707 let Inst{7} = 1;
708 let Inst{20} = 1; // L bit
709 let Inst{21} = 1; // W bit
710 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000711 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000712}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000713class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
714 string opc, string asm, string cstr, list<dag> pattern>
715 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
716 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000717 let Inst{4} = 1;
718 let Inst{5} = 1; // H bit
719 let Inst{6} = 1; // 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} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000724 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000725}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000726class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
727 string opc, string asm, string cstr, list<dag> pattern>
728 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
729 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000730 let Inst{4} = 1;
731 let Inst{5} = 0; // 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} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000737 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000738}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000739class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
740 string opc, string asm, string cstr, list<dag> pattern>
741 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
742 opc, asm, cstr, pattern> {
743 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} = 0; // L bit
748 let Inst{21} = 1; // W bit
749 let Inst{24} = 1; // P bit
750 let Inst{27-25} = 0b000;
751}
752
Evan Cheng840917b2008-09-01 07:00:14 +0000753
754// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000755class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
756 string opc, string asm, string cstr, list<dag> pattern>
757 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
758 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000759 let Inst{4} = 1;
760 let Inst{5} = 1; // H bit
761 let Inst{6} = 0; // S bit
762 let Inst{7} = 1;
763 let Inst{20} = 0; // L bit
764 let Inst{21} = 1; // W bit
765 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000766 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000767}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000768class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
769 string opc, string asm, string cstr, list<dag> pattern>
770 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
771 opc, asm, cstr, pattern> {
772 let Inst{4} = 1;
773 let Inst{5} = 1; // H bit
774 let Inst{6} = 1; // S bit
775 let Inst{7} = 1;
776 let Inst{20} = 0; // L bit
777 let Inst{21} = 1; // W bit
778 let Inst{24} = 1; // P bit
779 let Inst{27-25} = 0b000;
780}
Evan Cheng840917b2008-09-01 07:00:14 +0000781
782// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000783class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
784 string opc, string asm, string cstr, list<dag> pattern>
785 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
786 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000787 let Inst{4} = 1;
788 let Inst{5} = 1; // H bit
789 let Inst{6} = 0; // S bit
790 let Inst{7} = 1;
791 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000792 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000793 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000794 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000795}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000796class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
797 string opc, string asm, string cstr, list<dag> pattern>
798 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
799 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000800 let Inst{4} = 1;
801 let Inst{5} = 1; // H bit
802 let Inst{6} = 1; // S bit
803 let Inst{7} = 1;
804 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000805 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000806 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000807 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000808}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000809class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
810 string opc, string asm, string cstr, list<dag> pattern>
811 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
812 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000813 let Inst{4} = 1;
814 let Inst{5} = 0; // H bit
815 let Inst{6} = 1; // S bit
816 let Inst{7} = 1;
817 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000818 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000819 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000820 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000821}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000822class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
823 string opc, string asm, string cstr, list<dag> pattern>
824 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
825 opc, asm, cstr, pattern> {
826 let Inst{4} = 1;
827 let Inst{5} = 0; // H bit
828 let Inst{6} = 1; // S bit
829 let Inst{7} = 1;
830 let Inst{20} = 0; // L bit
831 let Inst{21} = 0; // W bit
832 let Inst{24} = 0; // P bit
833 let Inst{27-25} = 0b000;
834}
Evan Cheng840917b2008-09-01 07:00:14 +0000835
836// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000837class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
838 string opc, string asm, string cstr, list<dag> pattern>
839 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
840 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000841 let Inst{4} = 1;
842 let Inst{5} = 1; // H bit
843 let Inst{6} = 0; // S bit
844 let Inst{7} = 1;
845 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000846 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000847 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000848 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000849}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000850class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
851 string opc, string asm, string cstr, list<dag> pattern>
852 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
853 opc, asm, cstr, pattern> {
854 let Inst{4} = 1;
855 let Inst{5} = 1; // H bit
856 let Inst{6} = 1; // S bit
857 let Inst{7} = 1;
858 let Inst{20} = 0; // L bit
859 let Inst{21} = 0; // W bit
860 let Inst{24} = 0; // P bit
861 let Inst{27-25} = 0b000;
862}
Evan Cheng840917b2008-09-01 07:00:14 +0000863
Evan Cheng0d14fc82008-09-01 01:51:14 +0000864// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000865class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000866 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000867 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000868 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000869 let Inst{20} = 1; // L bit
870 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000871 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000872}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000873class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000874 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000875 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000876 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000877 let Inst{20} = 0; // L bit
878 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000879 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000880}
Evan Cheng37f25d92008-08-28 23:39:26 +0000881
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000882// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000883class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
884 string opc, string asm, list<dag> pattern>
885 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
886 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000887 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000888 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000889 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000890}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000891class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
892 string opc, string asm, list<dag> pattern>
893 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
894 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000895 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000896 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000897}
898
899// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000900class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
901 string opc, string asm, list<dag> pattern>
902 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
903 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000904 let Inst{7-4} = 0b1001;
905 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000906 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000907}
Evan Cheng37f25d92008-08-28 23:39:26 +0000908
Evan Chengeb4f52e2008-11-06 03:35:07 +0000909// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000910class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
911 string opc, string asm, list<dag> pattern>
912 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
913 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000914 let Inst{4} = 0;
915 let Inst{7} = 1;
916 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000917 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000918}
919
Evan Cheng97f48c32008-11-06 22:15:19 +0000920// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000921class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
922 string opc, string asm, list<dag> pattern>
923 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
924 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000925 let Inst{7-4} = 0b0111;
926 let Inst{27-20} = opcod;
927}
928
Evan Cheng8b59db32008-11-07 01:41:35 +0000929// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000930class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
931 string opc, string asm, list<dag> pattern>
932 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
933 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000934 let Inst{27-20} = opcod;
935}
936
Evan Cheng37f25d92008-08-28 23:39:26 +0000937//===----------------------------------------------------------------------===//
938
939// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
940class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
941 list<Predicate> Predicates = [IsARM];
942}
943class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
944 list<Predicate> Predicates = [IsARM, HasV5TE];
945}
946class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
947 list<Predicate> Predicates = [IsARM, HasV6];
948}
Evan Cheng13096642008-08-29 06:41:12 +0000949
950//===----------------------------------------------------------------------===//
951//
952// Thumb Instruction Format Definitions.
953//
954
Evan Cheng13096642008-08-29 06:41:12 +0000955// TI - Thumb instruction.
956
Evan Cheng446c4282009-07-11 06:43:01 +0000957class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000958 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000959 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000960 let OutOperandList = oops;
961 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000962 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000963 let Pattern = pattern;
964 list<Predicate> Predicates = [IsThumb];
965}
966
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000967class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
968 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000969
Evan Cheng35d6c412009-08-04 23:47:55 +0000970// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000971class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
972 list<dag> pattern>
973 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
974 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000975
Johnny Chend68e1192009-12-15 17:24:14 +0000976// tBL, tBX 32-bit instructions
977class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000978 dag oops, dag iops, InstrItinClass itin, string asm,
979 list<dag> pattern>
980 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
981 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000982 let Inst{31-27} = opcod1;
983 let Inst{15-14} = opcod2;
984 let Inst{12} = opcod3;
985}
Evan Cheng13096642008-08-29 06:41:12 +0000986
987// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000988class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
989 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000990 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000991
Evan Cheng09c39fc2009-06-23 19:38:13 +0000992// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000993class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000994 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000995 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000996 let OutOperandList = oops;
997 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000998 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000999 let Pattern = pattern;
1000 list<Predicate> Predicates = [IsThumb1Only];
1001}
1002
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001003class T1I<dag oops, dag iops, InstrItinClass itin,
1004 string asm, list<dag> pattern>
1005 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1006class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1007 string asm, list<dag> pattern>
1008 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1009class T1JTI<dag oops, dag iops, InstrItinClass itin,
1010 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001011 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001012
1013// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001014class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001015 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001016 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001017 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001018
1019// Thumb1 instruction that can either be predicated or set CPSR.
1020class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001021 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001022 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001023 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001024 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1025 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001026 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1027 let Pattern = pattern;
1028 list<Predicate> Predicates = [IsThumb1Only];
1029}
1030
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001031class T1sI<dag oops, dag iops, InstrItinClass itin,
1032 string opc, string asm, list<dag> pattern>
1033 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001034
1035// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001036class T1sIt<dag oops, dag iops, InstrItinClass itin,
1037 string opc, string asm, list<dag> pattern>
1038 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001039 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001040
1041// Thumb1 instruction that can be predicated.
1042class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001043 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001044 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001045 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001046 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001047 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001048 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1049 let Pattern = pattern;
1050 list<Predicate> Predicates = [IsThumb1Only];
1051}
1052
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001053class T1pI<dag oops, dag iops, InstrItinClass itin,
1054 string opc, string asm, list<dag> pattern>
1055 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001056
1057// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001058class T1pIt<dag oops, dag iops, InstrItinClass itin,
1059 string opc, string asm, list<dag> pattern>
1060 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001061 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001062
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001063class T1pI1<dag oops, dag iops, InstrItinClass itin,
1064 string opc, string asm, list<dag> pattern>
1065 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1066class T1pI2<dag oops, dag iops, InstrItinClass itin,
1067 string opc, string asm, list<dag> pattern>
1068 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1069class T1pI4<dag oops, dag iops, InstrItinClass itin,
1070 string opc, string asm, list<dag> pattern>
1071 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001072class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001073 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1074 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001075
Johnny Chenbbc71b22009-12-16 02:32:54 +00001076class Encoding16 : Encoding {
1077 let Inst{31-16} = 0x0000;
1078}
1079
Johnny Chend68e1192009-12-15 17:24:14 +00001080// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001081class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001082 let Inst{15-10} = opcode;
1083}
1084
1085// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001086class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001087 let Inst{15-14} = 0b00;
1088 let Inst{13-9} = opcode;
1089}
1090
1091// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001092class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001093 let Inst{15-10} = 0b010000;
1094 let Inst{9-6} = opcode;
1095}
1096
1097// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001098class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001099 let Inst{15-10} = 0b010001;
1100 let Inst{9-6} = opcode;
1101}
1102
1103// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001104class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001105 let Inst{15-12} = opA;
1106 let Inst{11-9} = opB;
1107}
1108class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1109class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1110class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1111class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1112class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1113
1114// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001115class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001116 let Inst{15-12} = 0b1011;
1117 let Inst{11-5} = opcode;
1118}
1119
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001120// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1121class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001122 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001123 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001124 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001125 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001126 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001127 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1128 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001129 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001130}
1131
1132// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1133// an input operand since by default it's a zero register. It will
1134// become an implicit def once it's "flipped".
1135// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1136// more consistent.
1137class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001138 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001139 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001140 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001141 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001142 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsond3038462010-05-24 20:08:34 +00001143 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001144 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001145 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001146}
1147
1148// Special cases
1149class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001150 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001151 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001152 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001153 let OutOperandList = oops;
1154 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001155 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001156 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001157 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001158}
1159
Jim Grosbachd1228742009-12-01 18:10:36 +00001160class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001161 InstrItinClass itin,
1162 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001163 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1164 let OutOperandList = oops;
1165 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001166 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001167 let Pattern = pattern;
1168 list<Predicate> Predicates = [IsThumb1Only];
1169}
1170
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001171class T2I<dag oops, dag iops, InstrItinClass itin,
1172 string opc, string asm, list<dag> pattern>
1173 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1174class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1175 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001176 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001177class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1178 string opc, string asm, list<dag> pattern>
1179 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1180class T2Iso<dag oops, dag iops, InstrItinClass itin,
1181 string opc, string asm, list<dag> pattern>
1182 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1183class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1184 string opc, string asm, list<dag> pattern>
1185 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001186class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001187 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001188 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1189 pattern> {
1190 let Inst{31-27} = 0b11101;
1191 let Inst{26-25} = 0b00;
1192 let Inst{24} = P;
1193 let Inst{23} = ?; // The U bit.
1194 let Inst{22} = 1;
1195 let Inst{21} = W;
1196 let Inst{20} = load;
1197}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001198
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001199class T2sI<dag oops, dag iops, InstrItinClass itin,
1200 string opc, string asm, list<dag> pattern>
1201 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001202
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001203class T2XI<dag oops, dag iops, InstrItinClass itin,
1204 string asm, list<dag> pattern>
1205 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1206class T2JTI<dag oops, dag iops, InstrItinClass itin,
1207 string asm, list<dag> pattern>
1208 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001209
Evan Cheng5adb66a2009-09-28 09:14:39 +00001210class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001211 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001212 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1213
Bob Wilson815baeb2010-03-13 01:08:20 +00001214// Two-address instructions
1215class T2XIt<dag oops, dag iops, InstrItinClass itin,
1216 string asm, string cstr, list<dag> pattern>
1217 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001218
Evan Chenge88d5ce2009-07-02 07:28:31 +00001219// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001220class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1221 dag oops, dag iops,
1222 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001223 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001224 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001225 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001226 let InOperandList = !con(iops, (ins pred:$p));
Evan Chenge88d5ce2009-07-02 07:28:31 +00001227 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1228 let Pattern = pattern;
1229 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001230 let Inst{31-27} = 0b11111;
1231 let Inst{26-25} = 0b00;
1232 let Inst{24} = signed;
1233 let Inst{23} = 0;
1234 let Inst{22-21} = opcod;
1235 let Inst{20} = load;
1236 let Inst{11} = 1;
1237 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1238 let Inst{10} = pre; // The P bit.
1239 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001240}
1241
Johnny Chenadc77332010-02-26 22:04:29 +00001242// Helper class for disassembly only
1243// A6.3.16 & A6.3.17
1244// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1245class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1246 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1247 : T2I<oops, iops, itin, opc, asm, pattern> {
1248 let Inst{31-27} = 0b11111;
1249 let Inst{26-24} = 0b011;
1250 let Inst{23} = long;
1251 let Inst{22-20} = op22_20;
1252 let Inst{7-4} = op7_4;
1253}
1254
David Goodwinc9d138f2009-07-27 19:59:26 +00001255// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1256class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1257 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1258}
1259
1260// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1261class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1262 list<Predicate> Predicates = [IsThumb1Only];
1263}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001264
Evan Cheng9cb9e672009-06-27 02:26:13 +00001265// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1266class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001267 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001268}
1269
Evan Cheng13096642008-08-29 06:41:12 +00001270//===----------------------------------------------------------------------===//
1271
Evan Cheng96581d32008-11-11 02:11:05 +00001272//===----------------------------------------------------------------------===//
1273// ARM VFP Instruction templates.
1274//
1275
David Goodwin3ca524e2009-07-10 17:03:29 +00001276// Almost all VFP instructions are predicable.
1277class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001278 IndexMode im, Format f, InstrItinClass itin,
1279 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001280 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001281 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001282 let InOperandList = !con(iops, (ins pred:$p));
Bob Wilsond3038462010-05-24 20:08:34 +00001283 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
David Goodwin3ca524e2009-07-10 17:03:29 +00001284 let Pattern = pattern;
1285 list<Predicate> Predicates = [HasVFP2];
1286}
1287
1288// Special cases
1289class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001290 IndexMode im, Format f, InstrItinClass itin,
1291 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001292 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001293 let OutOperandList = oops;
1294 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001295 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001296 let Pattern = pattern;
1297 list<Predicate> Predicates = [HasVFP2];
1298}
1299
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001300class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1301 string opc, string asm, list<dag> pattern>
1302 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1303 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001304
Evan Chengcd8e66a2008-11-11 21:48:44 +00001305// ARM VFP addrmode5 loads and stores
1306class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001307 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001308 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001309 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001310 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001311 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001312 let Inst{27-24} = opcod1;
1313 let Inst{21-20} = opcod2;
1314 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001315
1316 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001317 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001318}
1319
Evan Chengcd8e66a2008-11-11 21:48:44 +00001320class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001321 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001322 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001323 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001324 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001325 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001326 let Inst{27-24} = opcod1;
1327 let Inst{21-20} = opcod2;
1328 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001329}
1330
Evan Chengcd8e66a2008-11-11 21:48:44 +00001331// Load / store multiple
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001332class AXDI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001333 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001334 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001335 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001336 // TODO: Mark the instructions with the appropriate subtarget info.
1337 let Inst{27-25} = 0b110;
1338 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001339
1340 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001341 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001342}
1343
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001344class AXSI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001345 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001346 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001347 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001348 // TODO: Mark the instructions with the appropriate subtarget info.
1349 let Inst{27-25} = 0b110;
1350 let Inst{11-8} = 0b1010;
1351}
1352
Evan Cheng96581d32008-11-11 02:11:05 +00001353// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001354class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1355 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1356 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001357 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001358 let Inst{27-23} = opcod1;
1359 let Inst{21-20} = opcod2;
1360 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001361 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001362 let Inst{7-6} = opcod4;
1363 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001364}
1365
1366// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001367class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001368 dag iops, InstrItinClass itin, string opc, string asm,
1369 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001370 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001371 let Inst{27-23} = opcod1;
1372 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001373 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001374 let Inst{6} = op6;
1375 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001376}
1377
Jim Grosbach26767372010-03-24 22:31:46 +00001378// Double precision, binary, VML[AS] (for additional predicate)
1379class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1380 dag iops, InstrItinClass itin, string opc, string asm,
1381 list<dag> pattern>
1382 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1383 let Inst{27-23} = opcod1;
1384 let Inst{21-20} = opcod2;
1385 let Inst{11-8} = 0b1011;
1386 let Inst{6} = op6;
1387 let Inst{4} = op4;
1388 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1389}
1390
1391
Evan Cheng96581d32008-11-11 02:11:05 +00001392// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001393class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1394 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1395 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001396 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001397 let Inst{27-23} = opcod1;
1398 let Inst{21-20} = opcod2;
1399 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001400 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001401 let Inst{7-6} = opcod4;
1402 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001403}
1404
David Goodwin338268c2009-08-10 22:17:39 +00001405// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001406// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001407class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1408 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1409 string asm, list<dag> pattern>
1410 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1411 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001412 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1413}
1414
Evan Cheng96581d32008-11-11 02:11:05 +00001415// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001416class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1417 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001418 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001419 let Inst{27-23} = opcod1;
1420 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001421 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001422 let Inst{6} = op6;
1423 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001424}
1425
David Goodwin338268c2009-08-10 22:17:39 +00001426// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001427// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001428class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001429 dag iops, InstrItinClass itin, string opc, string asm,
1430 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001431 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001432 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1433}
1434
Evan Cheng80a11982008-11-12 06:41:41 +00001435// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001436class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1437 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1438 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001439 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001440 let Inst{27-23} = opcod1;
1441 let Inst{21-20} = opcod2;
1442 let Inst{19-16} = opcod3;
1443 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001444 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001445 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001446}
1447
Johnny Chen811663f2010-02-11 18:47:03 +00001448// VFP conversion between floating-point and fixed-point
1449class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001450 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1451 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001452 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1453 // size (fixed-point number): sx == 0 ? 16 : 32
1454 let Inst{7} = op5; // sx
1455}
1456
David Goodwin338268c2009-08-10 22:17:39 +00001457// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001458class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001459 dag oops, dag iops, InstrItinClass itin,
1460 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001461 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1462 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001463 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1464}
1465
Evan Cheng80a11982008-11-12 06:41:41 +00001466class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001467 InstrItinClass itin,
1468 string opc, string asm, list<dag> pattern>
1469 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001470 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001471 let Inst{11-8} = opcod2;
1472 let Inst{4} = 1;
1473}
1474
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001475class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1476 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1477 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001478
Bob Wilson01135592010-03-23 17:23:59 +00001479class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001480 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1481 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001482
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001483class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1484 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1485 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001486
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001487class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1488 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1489 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001490
Evan Cheng96581d32008-11-11 02:11:05 +00001491//===----------------------------------------------------------------------===//
1492
Bob Wilson5bafff32009-06-22 23:27:02 +00001493//===----------------------------------------------------------------------===//
1494// ARM NEON Instruction templates.
1495//
Evan Cheng13096642008-08-29 06:41:12 +00001496
Johnny Chencaa608e2010-03-20 00:17:00 +00001497class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1498 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1499 list<dag> pattern>
1500 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001501 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001502 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001503 let AsmString = !strconcat(
1504 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1505 !strconcat("\t", asm));
1506 let Pattern = pattern;
1507 list<Predicate> Predicates = [HasNEON];
1508}
1509
1510// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001511class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1512 InstrItinClass itin, string opc, string asm, string cstr,
1513 list<dag> pattern>
1514 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001515 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001516 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001517 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001518 let Pattern = pattern;
1519 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001520}
1521
Bob Wilsonb07c1712009-10-07 21:53:04 +00001522class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1523 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001524 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001525 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1526 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001527 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001528 let Inst{23} = op23;
1529 let Inst{21-20} = op21_20;
1530 let Inst{11-8} = op11_8;
1531 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001532}
1533
Johnny Chen785516a2010-03-23 16:43:47 +00001534class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001535 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001536 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1537 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001538 let Inst{31-25} = 0b1111001;
1539}
1540
Johnny Chen927b88f2010-03-23 20:40:44 +00001541class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001542 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001543 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001544 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001545 let Inst{31-25} = 0b1111001;
1546}
1547
1548// NEON "one register and a modified immediate" format.
1549class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1550 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001551 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001552 string opc, string dt, string asm, string cstr,
1553 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001554 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001555 let Inst{23} = op23;
1556 let Inst{21-19} = op21_19;
1557 let Inst{11-8} = op11_8;
1558 let Inst{7} = op7;
1559 let Inst{6} = op6;
1560 let Inst{5} = op5;
1561 let Inst{4} = op4;
1562}
1563
1564// NEON 2 vector register format.
1565class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1566 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001567 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001568 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001569 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001570 let Inst{24-23} = op24_23;
1571 let Inst{21-20} = op21_20;
1572 let Inst{19-18} = op19_18;
1573 let Inst{17-16} = op17_16;
1574 let Inst{11-7} = op11_7;
1575 let Inst{6} = op6;
1576 let Inst{4} = op4;
1577}
1578
1579// Same as N2V except it doesn't have a datatype suffix.
1580class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001581 bits<5> op11_7, bit op6, bit op4,
1582 dag oops, dag iops, InstrItinClass itin,
1583 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001584 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001585 let Inst{24-23} = op24_23;
1586 let Inst{21-20} = op21_20;
1587 let Inst{19-18} = op19_18;
1588 let Inst{17-16} = op17_16;
1589 let Inst{11-7} = op11_7;
1590 let Inst{6} = op6;
1591 let Inst{4} = op4;
1592}
1593
1594// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001595class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001596 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001597 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001598 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001599 let Inst{24} = op24;
1600 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001601 let Inst{11-8} = op11_8;
1602 let Inst{7} = op7;
1603 let Inst{6} = op6;
1604 let Inst{4} = op4;
1605}
1606
Bob Wilson10bc69c2010-03-27 03:56:52 +00001607// NEON 3 vector register format.
1608class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1609 dag oops, dag iops, Format f, InstrItinClass itin,
1610 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001611 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001612 let Inst{24} = op24;
1613 let Inst{23} = op23;
1614 let Inst{21-20} = op21_20;
1615 let Inst{11-8} = op11_8;
1616 let Inst{6} = op6;
1617 let Inst{4} = op4;
1618}
1619
Johnny Chen841e8282010-03-23 21:35:03 +00001620// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001621class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1622 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001623 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001624 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001625 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001626 let Inst{24} = op24;
1627 let Inst{23} = op23;
1628 let Inst{21-20} = op21_20;
1629 let Inst{11-8} = op11_8;
1630 let Inst{6} = op6;
1631 let Inst{4} = op4;
1632}
1633
1634// NEON VMOVs between scalar and core registers.
1635class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001636 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001637 string opc, string dt, string asm, list<dag> pattern>
1638 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001639 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001640 let Inst{27-20} = opcod1;
1641 let Inst{11-8} = opcod2;
1642 let Inst{6-5} = opcod3;
1643 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001644
1645 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001646 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001647 let AsmString = !strconcat(
1648 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1649 !strconcat("\t", asm));
1650 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001651 list<Predicate> Predicates = [HasNEON];
1652}
1653class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001654 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001655 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001656 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001657 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001658class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001659 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001660 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001661 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001662 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001663class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001664 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001665 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001666 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001667 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001668
Johnny Chene4614f72010-03-25 17:01:27 +00001669// Vector Duplicate Lane (from scalar to all elements)
1670class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1671 InstrItinClass itin, string opc, string dt, string asm,
1672 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001673 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001674 let Inst{24-23} = 0b11;
1675 let Inst{21-20} = 0b11;
1676 let Inst{19-16} = op19_16;
1677 let Inst{11-7} = 0b11000;
1678 let Inst{6} = op6;
1679 let Inst{4} = 0;
1680}
1681
David Goodwin42a83f22009-08-04 17:53:06 +00001682// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1683// for single-precision FP.
1684class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1685 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1686}