blob: 00c2ceea7a00df8dfb87e9c80d113f78cf7ea0a0 [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 Chen927b88f2010-03-23 20:40:44 +000062def NLdStFrm : Format<31>;
63def NVdImmFrm : Format<32>;
64def NVdVmImmFrm : Format<33>;
Johnny Chen3ae9a572010-03-23 21:25:38 +000065def NVdVmVCVTFrm : Format<34>;
Johnny Chencaa608e2010-03-20 00:17:00 +000066
Evan Cheng34a0fa32009-07-08 01:46:35 +000067// Misc flags.
68
Evan Chengedda31c2008-11-05 18:35:52 +000069// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000070// UnaryDP - Indicates this is a unary data processing instruction, i.e.
71// it doesn't have a Rn operand.
72class UnaryDP { bit isUnaryDataProc = 1; }
73
74// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
75// a 16-bit Thumb instruction if certain conditions are met.
76class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000077
Evan Cheng37f25d92008-08-28 23:39:26 +000078//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000079// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000080//
81
82// Addressing mode.
83class AddrMode<bits<4> val> {
84 bits<4> Value = val;
85}
86def AddrModeNone : AddrMode<0>;
87def AddrMode1 : AddrMode<1>;
88def AddrMode2 : AddrMode<2>;
89def AddrMode3 : AddrMode<3>;
90def AddrMode4 : AddrMode<4>;
91def AddrMode5 : AddrMode<5>;
Bob Wilson8b024a52009-07-01 23:16:05 +000092def AddrMode6 : AddrMode<6>;
93def AddrModeT1_1 : AddrMode<7>;
94def AddrModeT1_2 : AddrMode<8>;
95def AddrModeT1_4 : AddrMode<9>;
96def AddrModeT1_s : AddrMode<10>;
David Goodwine1e52ed2009-07-22 22:24:31 +000097def AddrModeT2_i12: AddrMode<11>;
Bob Wilson8b024a52009-07-01 23:16:05 +000098def AddrModeT2_i8 : AddrMode<12>;
99def AddrModeT2_so : AddrMode<13>;
100def AddrModeT2_pc : AddrMode<14>;
101def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng055b0312009-06-29 07:51:04 +0000102
103// Instruction size.
104class SizeFlagVal<bits<3> val> {
105 bits<3> Value = val;
106}
107def SizeInvalid : SizeFlagVal<0>; // Unset.
108def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
109def Size8Bytes : SizeFlagVal<2>;
110def Size4Bytes : SizeFlagVal<3>;
111def Size2Bytes : SizeFlagVal<4>;
112
113// Load / store index mode.
114class IndexMode<bits<2> val> {
115 bits<2> Value = val;
116}
117def IndexModeNone : IndexMode<0>;
118def IndexModePre : IndexMode<1>;
119def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000120def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000121
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000122// Instruction execution domain.
123class Domain<bits<2> val> {
124 bits<2> Value = val;
125}
126def GenericDomain : Domain<0>;
127def VFPDomain : Domain<1>; // Instructions in VFP domain only
128def NeonDomain : Domain<2>; // Instructions in Neon domain only
129def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
130
Evan Cheng055b0312009-06-29 07:51:04 +0000131//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000132
Evan Cheng446c4282009-07-11 06:43:01 +0000133// ARM special operands.
134//
135
136// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
137// register whose default is 0 (no register).
138def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
139 (ops (i32 14), (i32 zero_reg))> {
140 let PrintMethod = "printPredicateOperand";
141}
142
143// Conditional code result for instructions whose 's' bit is set, e.g. subs.
144def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
145 let PrintMethod = "printSBitModifierOperand";
146}
147
148// Same as cc_out except it defaults to setting CPSR.
149def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
150 let PrintMethod = "printSBitModifierOperand";
151}
152
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000153// ARM special operands for disassembly only.
154//
155
156def cps_opt : Operand<i32> {
157 let PrintMethod = "printCPSOptionOperand";
158}
159
160def msr_mask : Operand<i32> {
161 let PrintMethod = "printMSRMaskOperand";
162}
163
164// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
165// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
166def neg_zero : Operand<i32> {
167 let PrintMethod = "printNegZeroOperand";
168}
169
Evan Cheng446c4282009-07-11 06:43:01 +0000170//===----------------------------------------------------------------------===//
171
Evan Cheng37f25d92008-08-28 23:39:26 +0000172// ARM Instruction templates.
173//
174
Johnny Chend68e1192009-12-15 17:24:14 +0000175class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
176 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000177 : Instruction {
178 let Namespace = "ARM";
179
Evan Chengedda31c2008-11-05 18:35:52 +0000180 // TSFlagsFields
Evan Cheng37f25d92008-08-28 23:39:26 +0000181 AddrMode AM = am;
182 bits<4> AddrModeBits = AM.Value;
Bob Wilson01135592010-03-23 17:23:59 +0000183
Evan Cheng37f25d92008-08-28 23:39:26 +0000184 SizeFlagVal SZ = sz;
185 bits<3> SizeFlag = SZ.Value;
186
187 IndexMode IM = im;
188 bits<2> IndexModeBits = IM.Value;
Bob Wilson01135592010-03-23 17:23:59 +0000189
Evan Cheng37f25d92008-08-28 23:39:26 +0000190 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000191 bits<6> Form = F.Value;
Evan Chengedda31c2008-11-05 18:35:52 +0000192
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000193 Domain D = d;
194 bits<2> Dom = D.Value;
195
Evan Chengedda31c2008-11-05 18:35:52 +0000196 //
197 // Attributes specific to ARM instructions...
198 //
199 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000200 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000201
Evan Cheng37f25d92008-08-28 23:39:26 +0000202 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000203 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000204}
205
Johnny Chend68e1192009-12-15 17:24:14 +0000206class Encoding {
207 field bits<32> Inst;
208}
209
210class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
211 Format f, Domain d, string cstr, InstrItinClass itin>
212 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
213
214// This Encoding-less class is used by Thumb1 to specify the encoding bits later
215// on by adding flavors to specific instructions.
216class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
217 Format f, Domain d, string cstr, InstrItinClass itin>
218 : InstTemplate<am, sz, im, f, d, cstr, itin>;
219
Bob Wilson01135592010-03-23 17:23:59 +0000220class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000221 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000222 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000223 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000224 let OutOperandList = oops;
225 let InOperandList = iops;
226 let AsmString = asm;
227 let Pattern = pattern;
228}
229
230// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000231class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000232 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000233 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000234 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000235 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000236 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000237 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng37f25d92008-08-28 23:39:26 +0000238 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
239 let Pattern = pattern;
240 list<Predicate> Predicates = [IsARM];
241}
Jim Grosbachf6b28622009-12-14 18:31:20 +0000242// A few are not predicable
243class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000244 IndexMode im, Format f, InstrItinClass itin,
245 string opc, string asm, string cstr,
246 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000247 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
248 let OutOperandList = oops;
249 let InOperandList = iops;
250 let AsmString = !strconcat(opc, asm);
251 let Pattern = pattern;
252 let isPredicable = 0;
253 list<Predicate> Predicates = [IsARM];
254}
Evan Cheng37f25d92008-08-28 23:39:26 +0000255
256// Same as I except it can optionally modify CPSR. Note it's modeled as
257// an input operand since by default it's a zero register. It will
258// become an implicit def once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000259class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000260 IndexMode im, Format f, InstrItinClass itin,
261 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000262 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000263 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000264 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000265 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng37f25d92008-08-28 23:39:26 +0000266 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
267 let Pattern = pattern;
268 list<Predicate> Predicates = [IsARM];
269}
270
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000271// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000272class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000273 IndexMode im, Format f, InstrItinClass itin,
274 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000275 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000276 let OutOperandList = oops;
277 let InOperandList = iops;
278 let AsmString = asm;
279 let Pattern = pattern;
280 list<Predicate> Predicates = [IsARM];
281}
282
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000283class AI<dag oops, dag iops, Format f, InstrItinClass itin,
284 string opc, string asm, list<dag> pattern>
285 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
286 opc, asm, "", pattern>;
287class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
288 string opc, string asm, list<dag> pattern>
289 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
290 opc, asm, "", pattern>;
291class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000292 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000293 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000294 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000295class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000296 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000297 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000298 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000299
300// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000301class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
302 string opc, string asm, list<dag> pattern>
303 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
304 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000305 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000306}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000307class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
308 string asm, list<dag> pattern>
309 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
310 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000311 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000312}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000313class ABXIx2<dag oops, dag iops, InstrItinClass itin,
314 string asm, list<dag> pattern>
315 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
316 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000317
318// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000319class JTI<dag oops, dag iops, InstrItinClass itin,
320 string asm, list<dag> pattern>
321 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000322 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000323
Jim Grosbach5278eb82009-12-11 01:42:04 +0000324
325// Atomic load/store instructions
326
327class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
328 string opc, string asm, list<dag> pattern>
329 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
330 opc, asm, "", pattern> {
331 let Inst{27-23} = 0b00011;
332 let Inst{22-21} = opcod;
333 let Inst{20} = 1;
334 let Inst{11-0} = 0b111110011111;
335}
336class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
337 string opc, string asm, list<dag> pattern>
338 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
339 opc, asm, "", pattern> {
340 let Inst{27-23} = 0b00011;
341 let Inst{22-21} = opcod;
342 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000343 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000344}
345
Evan Cheng0d14fc82008-09-01 01:51:14 +0000346// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000347class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
348 string opc, string asm, list<dag> pattern>
349 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
350 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000351 let Inst{24-21} = opcod;
352 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000353}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000354class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
355 string opc, string asm, list<dag> pattern>
356 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
357 opc, asm, "", pattern> {
358 let Inst{24-21} = opcod;
359 let Inst{27-26} = {0,0};
360}
361class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000362 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000363 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000364 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000365 let Inst{24-21} = opcod;
366 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000367}
Bob Wilson01135592010-03-23 17:23:59 +0000368class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000369 string opc, string asm, list<dag> pattern>
370 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
371 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000372
Evan Cheng0d14fc82008-09-01 01:51:14 +0000373
374// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000375class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
376 string opc, string asm, list<dag> pattern>
377 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
378 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000379 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000380}
Evan Cheng93912732008-09-01 01:27:33 +0000381
382// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000383class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
384 string opc, string asm, list<dag> pattern>
385 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
386 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000387 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000388 let Inst{21} = 0; // W bit
389 let Inst{22} = 0; // B bit
390 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000391 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000392}
Bob Wilson01135592010-03-23 17:23:59 +0000393class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000394 string asm, list<dag> pattern>
395 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000396 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000397 let Inst{20} = 1; // L bit
398 let Inst{21} = 0; // W bit
399 let Inst{22} = 0; // B bit
400 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000401 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000402}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000403class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
404 string opc, string asm, list<dag> pattern>
405 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
406 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000407 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000408 let Inst{21} = 0; // W bit
409 let Inst{22} = 1; // B bit
410 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000411 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000412}
Bob Wilson01135592010-03-23 17:23:59 +0000413class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000414 string asm, list<dag> pattern>
415 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000416 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000417 let Inst{20} = 1; // L bit
418 let Inst{21} = 0; // W bit
419 let Inst{22} = 1; // B bit
420 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000421 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000422}
Evan Cheng17222df2008-08-31 19:02:21 +0000423
Evan Cheng93912732008-09-01 01:27:33 +0000424// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000425class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
426 string opc, string asm, list<dag> pattern>
427 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
428 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000429 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000430 let Inst{21} = 0; // W bit
431 let Inst{22} = 0; // B bit
432 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000433 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000434}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000435class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
436 string asm, list<dag> pattern>
437 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000438 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000439 let Inst{20} = 0; // L bit
440 let Inst{21} = 0; // W bit
441 let Inst{22} = 0; // B bit
442 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000443 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000444}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000445class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
446 string opc, string asm, list<dag> pattern>
447 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
448 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000449 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000450 let Inst{21} = 0; // W bit
451 let Inst{22} = 1; // B bit
452 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000453 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000454}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000455class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
456 string asm, list<dag> pattern>
457 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000458 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000459 let Inst{20} = 0; // L bit
460 let Inst{21} = 0; // W bit
461 let Inst{22} = 1; // B bit
462 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000463 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000464}
Evan Cheng93912732008-09-01 01:27:33 +0000465
Evan Cheng840917b2008-09-01 07:00:14 +0000466// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000467class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
468 string opc, string asm, string cstr, list<dag> pattern>
469 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
470 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000471 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000472 let Inst{21} = 1; // W bit
473 let Inst{22} = 0; // B bit
474 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000475 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000476}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000477class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
478 string opc, string asm, string cstr, list<dag> pattern>
479 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
480 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000481 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000482 let Inst{21} = 1; // W bit
483 let Inst{22} = 1; // B bit
484 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000485 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000486}
487
Evan Cheng840917b2008-09-01 07:00:14 +0000488// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000489class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
490 string opc, string asm, string cstr, list<dag> pattern>
491 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
492 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000493 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000494 let Inst{21} = 1; // W bit
495 let Inst{22} = 0; // B bit
496 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000497 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000498}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000499class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
500 string opc, string asm, string cstr, list<dag> pattern>
501 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
502 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000503 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000504 let Inst{21} = 1; // W bit
505 let Inst{22} = 1; // B bit
506 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000507 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000508}
509
Evan Cheng840917b2008-09-01 07:00:14 +0000510// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000511class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
512 string opc, string asm, string cstr, list<dag> pattern>
513 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
514 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000515 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000516 let Inst{21} = 0; // W bit
517 let Inst{22} = 0; // B bit
518 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000519 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000520}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000521class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
522 string opc, string asm, string cstr, list<dag> pattern>
523 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
524 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000525 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000526 let Inst{21} = 0; // W bit
527 let Inst{22} = 1; // B bit
528 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000529 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000530}
531
Evan Cheng840917b2008-09-01 07:00:14 +0000532// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000533class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
534 string opc, string asm, string cstr, list<dag> pattern>
535 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
536 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000537 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000538 let Inst{21} = 0; // W bit
539 let Inst{22} = 0; // B bit
540 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000541 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000542}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000543class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
544 string opc, string asm, string cstr, list<dag> pattern>
545 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
546 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000547 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000548 let Inst{21} = 0; // W bit
549 let Inst{22} = 1; // B bit
550 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000551 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000552}
553
Evan Cheng0d14fc82008-09-01 01:51:14 +0000554// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000555class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000556 string opc, string asm, list<dag> pattern>
557 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
558 opc, asm, "", pattern>;
559class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
560 string asm, list<dag> pattern>
561 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
562 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000563
Evan Cheng840917b2008-09-01 07:00:14 +0000564// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000565class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
566 string opc, string asm, list<dag> pattern>
567 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
568 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000569 let Inst{4} = 1;
570 let Inst{5} = 1; // H bit
571 let Inst{6} = 0; // S bit
572 let Inst{7} = 1;
573 let Inst{20} = 1; // L bit
574 let Inst{21} = 0; // W bit
575 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000576 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000577}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000578class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
579 string asm, list<dag> pattern>
580 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000581 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000582 let Inst{4} = 1;
583 let Inst{5} = 1; // H bit
584 let Inst{6} = 0; // S bit
585 let Inst{7} = 1;
586 let Inst{20} = 1; // L bit
587 let Inst{21} = 0; // W bit
588 let Inst{24} = 1; // P bit
589}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000590class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
591 string opc, string asm, list<dag> pattern>
592 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
593 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000594 let Inst{4} = 1;
595 let Inst{5} = 1; // H bit
596 let Inst{6} = 1; // S bit
597 let Inst{7} = 1;
598 let Inst{20} = 1; // L bit
599 let Inst{21} = 0; // W bit
600 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000601 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000602}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000603class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
604 string asm, list<dag> pattern>
605 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000606 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000607 let Inst{4} = 1;
608 let Inst{5} = 1; // H bit
609 let Inst{6} = 1; // S bit
610 let Inst{7} = 1;
611 let Inst{20} = 1; // L bit
612 let Inst{21} = 0; // W bit
613 let Inst{24} = 1; // P bit
614}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000615class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
616 string opc, string asm, list<dag> pattern>
617 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
618 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000619 let Inst{4} = 1;
620 let Inst{5} = 0; // H bit
621 let Inst{6} = 1; // S bit
622 let Inst{7} = 1;
623 let Inst{20} = 1; // L bit
624 let Inst{21} = 0; // W bit
625 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000626 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000627}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000628class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
629 string asm, list<dag> pattern>
630 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000631 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000632 let Inst{4} = 1;
633 let Inst{5} = 0; // H bit
634 let Inst{6} = 1; // S bit
635 let Inst{7} = 1;
636 let Inst{20} = 1; // L bit
637 let Inst{21} = 0; // W bit
638 let Inst{24} = 1; // P bit
639}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000640class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
641 string opc, string asm, list<dag> pattern>
642 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
643 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000644 let Inst{4} = 1;
645 let Inst{5} = 0; // H bit
646 let Inst{6} = 1; // S bit
647 let Inst{7} = 1;
648 let Inst{20} = 0; // L bit
649 let Inst{21} = 0; // W bit
650 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000651 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000652}
653
654// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000655class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
656 string opc, string asm, list<dag> pattern>
657 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
658 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000659 let Inst{4} = 1;
660 let Inst{5} = 1; // H bit
661 let Inst{6} = 0; // S bit
662 let Inst{7} = 1;
663 let Inst{20} = 0; // L bit
664 let Inst{21} = 0; // W bit
665 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000666 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000667}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000668class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
669 string asm, list<dag> pattern>
670 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000671 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000672 let Inst{4} = 1;
673 let Inst{5} = 1; // H bit
674 let Inst{6} = 0; // S bit
675 let Inst{7} = 1;
676 let Inst{20} = 0; // L bit
677 let Inst{21} = 0; // W bit
678 let Inst{24} = 1; // P bit
679}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000680class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
681 string opc, string asm, list<dag> pattern>
682 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
683 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000684 let Inst{4} = 1;
685 let Inst{5} = 1; // H bit
686 let Inst{6} = 1; // S bit
687 let Inst{7} = 1;
688 let Inst{20} = 0; // L bit
689 let Inst{21} = 0; // W bit
690 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000691 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000692}
693
694// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000695class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
696 string opc, string asm, string cstr, list<dag> pattern>
697 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
698 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000699 let Inst{4} = 1;
700 let Inst{5} = 1; // H bit
701 let Inst{6} = 0; // S bit
702 let Inst{7} = 1;
703 let Inst{20} = 1; // L bit
704 let Inst{21} = 1; // W bit
705 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000706 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000707}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000708class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
709 string opc, string asm, string cstr, list<dag> pattern>
710 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
711 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000712 let Inst{4} = 1;
713 let Inst{5} = 1; // H bit
714 let Inst{6} = 1; // S bit
715 let Inst{7} = 1;
716 let Inst{20} = 1; // L bit
717 let Inst{21} = 1; // W bit
718 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000719 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000720}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000721class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
722 string opc, string asm, string cstr, list<dag> pattern>
723 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
724 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000725 let Inst{4} = 1;
726 let Inst{5} = 0; // H bit
727 let Inst{6} = 1; // S bit
728 let Inst{7} = 1;
729 let Inst{20} = 1; // L bit
730 let Inst{21} = 1; // W bit
731 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000732 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000733}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000734class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
735 string opc, string asm, string cstr, list<dag> pattern>
736 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
737 opc, asm, cstr, pattern> {
738 let Inst{4} = 1;
739 let Inst{5} = 0; // H bit
740 let Inst{6} = 1; // S bit
741 let Inst{7} = 1;
742 let Inst{20} = 0; // L bit
743 let Inst{21} = 1; // W bit
744 let Inst{24} = 1; // P bit
745 let Inst{27-25} = 0b000;
746}
747
Evan Cheng840917b2008-09-01 07:00:14 +0000748
749// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000750class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
751 string opc, string asm, string cstr, list<dag> pattern>
752 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
753 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000754 let Inst{4} = 1;
755 let Inst{5} = 1; // H bit
756 let Inst{6} = 0; // S bit
757 let Inst{7} = 1;
758 let Inst{20} = 0; // L bit
759 let Inst{21} = 1; // W bit
760 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000761 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000762}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000763class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
764 string opc, string asm, string cstr, list<dag> pattern>
765 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
766 opc, asm, cstr, pattern> {
767 let Inst{4} = 1;
768 let Inst{5} = 1; // H bit
769 let Inst{6} = 1; // S bit
770 let Inst{7} = 1;
771 let Inst{20} = 0; // L bit
772 let Inst{21} = 1; // W bit
773 let Inst{24} = 1; // P bit
774 let Inst{27-25} = 0b000;
775}
Evan Cheng840917b2008-09-01 07:00:14 +0000776
777// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000778class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
779 string opc, string asm, string cstr, list<dag> pattern>
780 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
781 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000782 let Inst{4} = 1;
783 let Inst{5} = 1; // H bit
784 let Inst{6} = 0; // S bit
785 let Inst{7} = 1;
786 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000787 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000788 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000789 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000790}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000791class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
792 string opc, string asm, string cstr, list<dag> pattern>
793 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
794 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000795 let Inst{4} = 1;
796 let Inst{5} = 1; // H bit
797 let Inst{6} = 1; // S bit
798 let Inst{7} = 1;
799 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000800 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000801 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000802 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000803}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000804class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
805 string opc, string asm, string cstr, list<dag> pattern>
806 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
807 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000808 let Inst{4} = 1;
809 let Inst{5} = 0; // H bit
810 let Inst{6} = 1; // S bit
811 let Inst{7} = 1;
812 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000813 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000814 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000815 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000816}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000817class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
818 string opc, string asm, string cstr, list<dag> pattern>
819 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
820 opc, asm, cstr, pattern> {
821 let Inst{4} = 1;
822 let Inst{5} = 0; // H bit
823 let Inst{6} = 1; // S bit
824 let Inst{7} = 1;
825 let Inst{20} = 0; // L bit
826 let Inst{21} = 0; // W bit
827 let Inst{24} = 0; // P bit
828 let Inst{27-25} = 0b000;
829}
Evan Cheng840917b2008-09-01 07:00:14 +0000830
831// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000832class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
833 string opc, string asm, string cstr, list<dag> pattern>
834 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
835 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000836 let Inst{4} = 1;
837 let Inst{5} = 1; // H bit
838 let Inst{6} = 0; // S bit
839 let Inst{7} = 1;
840 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000841 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000842 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000843 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000844}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000845class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
846 string opc, string asm, string cstr, list<dag> pattern>
847 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
848 opc, asm, cstr, pattern> {
849 let Inst{4} = 1;
850 let Inst{5} = 1; // H bit
851 let Inst{6} = 1; // S bit
852 let Inst{7} = 1;
853 let Inst{20} = 0; // L bit
854 let Inst{21} = 0; // W bit
855 let Inst{24} = 0; // P bit
856 let Inst{27-25} = 0b000;
857}
Evan Cheng840917b2008-09-01 07:00:14 +0000858
Evan Cheng0d14fc82008-09-01 01:51:14 +0000859// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000860class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000861 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000862 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000863 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000864 let Inst{20} = 1; // L bit
865 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000866 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000867}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000868class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000869 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000870 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000871 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000872 let Inst{20} = 0; // L bit
873 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000874 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000875}
Evan Cheng37f25d92008-08-28 23:39:26 +0000876
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000877// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000878class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
879 string opc, string asm, list<dag> pattern>
880 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
881 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000882 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000883 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000884 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000885}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000886class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
887 string opc, string asm, list<dag> pattern>
888 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
889 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000890 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000891 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000892}
893
894// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000895class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
896 string opc, string asm, list<dag> pattern>
897 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
898 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000899 let Inst{7-4} = 0b1001;
900 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000901 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000902}
Evan Cheng37f25d92008-08-28 23:39:26 +0000903
Evan Chengeb4f52e2008-11-06 03:35:07 +0000904// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000905class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
906 string opc, string asm, list<dag> pattern>
907 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
908 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000909 let Inst{4} = 0;
910 let Inst{7} = 1;
911 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000912 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000913}
914
Evan Cheng97f48c32008-11-06 22:15:19 +0000915// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000916class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
917 string opc, string asm, list<dag> pattern>
918 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
919 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000920 let Inst{7-4} = 0b0111;
921 let Inst{27-20} = opcod;
922}
923
Evan Cheng8b59db32008-11-07 01:41:35 +0000924// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000925class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
926 string opc, string asm, list<dag> pattern>
927 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
928 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000929 let Inst{27-20} = opcod;
930}
931
Evan Cheng37f25d92008-08-28 23:39:26 +0000932//===----------------------------------------------------------------------===//
933
934// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
935class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
936 list<Predicate> Predicates = [IsARM];
937}
938class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
939 list<Predicate> Predicates = [IsARM, HasV5TE];
940}
941class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
942 list<Predicate> Predicates = [IsARM, HasV6];
943}
Evan Cheng13096642008-08-29 06:41:12 +0000944
945//===----------------------------------------------------------------------===//
946//
947// Thumb Instruction Format Definitions.
948//
949
Evan Cheng13096642008-08-29 06:41:12 +0000950// TI - Thumb instruction.
951
Evan Cheng446c4282009-07-11 06:43:01 +0000952class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000953 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000954 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000955 let OutOperandList = oops;
956 let InOperandList = iops;
Evan Cheng13096642008-08-29 06:41:12 +0000957 let AsmString = asm;
958 let Pattern = pattern;
959 list<Predicate> Predicates = [IsThumb];
960}
961
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000962class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
963 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000964
Evan Cheng35d6c412009-08-04 23:47:55 +0000965// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000966class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
967 list<dag> pattern>
968 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
969 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000970
Johnny Chend68e1192009-12-15 17:24:14 +0000971// tBL, tBX 32-bit instructions
972class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000973 dag oops, dag iops, InstrItinClass itin, string asm,
974 list<dag> pattern>
975 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
976 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000977 let Inst{31-27} = opcod1;
978 let Inst{15-14} = opcod2;
979 let Inst{12} = opcod3;
980}
Evan Cheng13096642008-08-29 06:41:12 +0000981
982// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000983class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
984 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000985 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000986
Evan Cheng09c39fc2009-06-23 19:38:13 +0000987// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000988class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000989 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000990 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000991 let OutOperandList = oops;
992 let InOperandList = iops;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000993 let AsmString = asm;
994 let Pattern = pattern;
995 list<Predicate> Predicates = [IsThumb1Only];
996}
997
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000998class T1I<dag oops, dag iops, InstrItinClass itin,
999 string asm, list<dag> pattern>
1000 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1001class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1002 string asm, list<dag> pattern>
1003 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1004class T1JTI<dag oops, dag iops, InstrItinClass itin,
1005 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001006 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001007
1008// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001009class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001010 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001011 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001012 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001013
1014// Thumb1 instruction that can either be predicated or set CPSR.
1015class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001016 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001017 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001018 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001019 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1020 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001021 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1022 let Pattern = pattern;
1023 list<Predicate> Predicates = [IsThumb1Only];
1024}
1025
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001026class T1sI<dag oops, dag iops, InstrItinClass itin,
1027 string opc, string asm, list<dag> pattern>
1028 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001029
1030// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001031class T1sIt<dag oops, dag iops, InstrItinClass itin,
1032 string opc, string asm, list<dag> pattern>
1033 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001034 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001035
1036// Thumb1 instruction that can be predicated.
1037class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001038 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001039 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001040 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001041 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001042 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001043 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1044 let Pattern = pattern;
1045 list<Predicate> Predicates = [IsThumb1Only];
1046}
1047
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001048class T1pI<dag oops, dag iops, InstrItinClass itin,
1049 string opc, string asm, list<dag> pattern>
1050 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001051
1052// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001053class T1pIt<dag oops, dag iops, InstrItinClass itin,
1054 string opc, string asm, list<dag> pattern>
1055 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001056 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001057
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001058class T1pI1<dag oops, dag iops, InstrItinClass itin,
1059 string opc, string asm, list<dag> pattern>
1060 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1061class T1pI2<dag oops, dag iops, InstrItinClass itin,
1062 string opc, string asm, list<dag> pattern>
1063 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1064class T1pI4<dag oops, dag iops, InstrItinClass itin,
1065 string opc, string asm, list<dag> pattern>
1066 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001067class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001068 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1069 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001070
Johnny Chenbbc71b22009-12-16 02:32:54 +00001071class Encoding16 : Encoding {
1072 let Inst{31-16} = 0x0000;
1073}
1074
Johnny Chend68e1192009-12-15 17:24:14 +00001075// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001076class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001077 let Inst{15-10} = opcode;
1078}
1079
1080// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001081class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001082 let Inst{15-14} = 0b00;
1083 let Inst{13-9} = opcode;
1084}
1085
1086// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001087class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001088 let Inst{15-10} = 0b010000;
1089 let Inst{9-6} = opcode;
1090}
1091
1092// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001093class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001094 let Inst{15-10} = 0b010001;
1095 let Inst{9-6} = opcode;
1096}
1097
1098// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001099class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001100 let Inst{15-12} = opA;
1101 let Inst{11-9} = opB;
1102}
1103class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1104class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1105class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1106class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1107class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1108
1109// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001110class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001111 let Inst{15-12} = 0b1011;
1112 let Inst{11-5} = opcode;
1113}
1114
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001115// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1116class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001117 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001118 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001119 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001120 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001121 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001122 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1123 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001124 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001125}
1126
1127// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1128// an input operand since by default it's a zero register. It will
1129// become an implicit def once it's "flipped".
1130// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1131// more consistent.
1132class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001133 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001134 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001135 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001136 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001137 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001138 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1139 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001140 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001141}
1142
1143// Special cases
1144class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001145 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001146 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001147 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001148 let OutOperandList = oops;
1149 let InOperandList = iops;
Evan Chengf49810c2009-06-23 17:48:47 +00001150 let AsmString = asm;
1151 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001152 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001153}
1154
Jim Grosbachd1228742009-12-01 18:10:36 +00001155class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001156 InstrItinClass itin,
1157 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001158 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1159 let OutOperandList = oops;
1160 let InOperandList = iops;
1161 let AsmString = asm;
1162 let Pattern = pattern;
1163 list<Predicate> Predicates = [IsThumb1Only];
1164}
1165
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001166class T2I<dag oops, dag iops, InstrItinClass itin,
1167 string opc, string asm, list<dag> pattern>
1168 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1169class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1170 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001171 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001172class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1173 string opc, string asm, list<dag> pattern>
1174 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1175class T2Iso<dag oops, dag iops, InstrItinClass itin,
1176 string opc, string asm, list<dag> pattern>
1177 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1178class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1179 string opc, string asm, list<dag> pattern>
1180 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001181class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001182 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001183 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1184 pattern> {
1185 let Inst{31-27} = 0b11101;
1186 let Inst{26-25} = 0b00;
1187 let Inst{24} = P;
1188 let Inst{23} = ?; // The U bit.
1189 let Inst{22} = 1;
1190 let Inst{21} = W;
1191 let Inst{20} = load;
1192}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001193
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001194class T2sI<dag oops, dag iops, InstrItinClass itin,
1195 string opc, string asm, list<dag> pattern>
1196 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001197
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001198class T2XI<dag oops, dag iops, InstrItinClass itin,
1199 string asm, list<dag> pattern>
1200 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1201class T2JTI<dag oops, dag iops, InstrItinClass itin,
1202 string asm, list<dag> pattern>
1203 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001204
Evan Cheng5adb66a2009-09-28 09:14:39 +00001205class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001206 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001207 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1208
Bob Wilson815baeb2010-03-13 01:08:20 +00001209// Two-address instructions
1210class T2XIt<dag oops, dag iops, InstrItinClass itin,
1211 string asm, string cstr, list<dag> pattern>
1212 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001213
Evan Chenge88d5ce2009-07-02 07:28:31 +00001214// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001215class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1216 dag oops, dag iops,
1217 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001218 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001219 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001220 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001221 let InOperandList = !con(iops, (ins pred:$p));
Evan Chenge88d5ce2009-07-02 07:28:31 +00001222 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1223 let Pattern = pattern;
1224 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001225 let Inst{31-27} = 0b11111;
1226 let Inst{26-25} = 0b00;
1227 let Inst{24} = signed;
1228 let Inst{23} = 0;
1229 let Inst{22-21} = opcod;
1230 let Inst{20} = load;
1231 let Inst{11} = 1;
1232 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1233 let Inst{10} = pre; // The P bit.
1234 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001235}
1236
Johnny Chenadc77332010-02-26 22:04:29 +00001237// Helper class for disassembly only
1238// A6.3.16 & A6.3.17
1239// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1240class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1241 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1242 : T2I<oops, iops, itin, opc, asm, pattern> {
1243 let Inst{31-27} = 0b11111;
1244 let Inst{26-24} = 0b011;
1245 let Inst{23} = long;
1246 let Inst{22-20} = op22_20;
1247 let Inst{7-4} = op7_4;
1248}
1249
David Goodwinc9d138f2009-07-27 19:59:26 +00001250// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1251class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1252 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1253}
1254
1255// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1256class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1257 list<Predicate> Predicates = [IsThumb1Only];
1258}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001259
Evan Cheng9cb9e672009-06-27 02:26:13 +00001260// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1261class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001262 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001263}
1264
Evan Cheng13096642008-08-29 06:41:12 +00001265//===----------------------------------------------------------------------===//
1266
Evan Cheng96581d32008-11-11 02:11:05 +00001267//===----------------------------------------------------------------------===//
1268// ARM VFP Instruction templates.
1269//
1270
David Goodwin3ca524e2009-07-10 17:03:29 +00001271// Almost all VFP instructions are predicable.
1272class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001273 IndexMode im, Format f, InstrItinClass itin,
1274 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001275 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001276 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001277 let InOperandList = !con(iops, (ins pred:$p));
David Goodwin3ca524e2009-07-10 17:03:29 +00001278 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1279 let Pattern = pattern;
1280 list<Predicate> Predicates = [HasVFP2];
1281}
1282
1283// Special cases
1284class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001285 IndexMode im, Format f, InstrItinClass itin,
1286 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001287 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001288 let OutOperandList = oops;
1289 let InOperandList = iops;
1290 let AsmString = asm;
1291 let Pattern = pattern;
1292 list<Predicate> Predicates = [HasVFP2];
1293}
1294
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001295class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1296 string opc, string asm, list<dag> pattern>
1297 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1298 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001299
Evan Chengcd8e66a2008-11-11 21:48:44 +00001300// ARM VFP addrmode5 loads and stores
1301class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001302 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001303 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001304 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001305 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001306 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001307 let Inst{27-24} = opcod1;
1308 let Inst{21-20} = opcod2;
1309 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001310
1311 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1312 let Dom = VFPNeonDomain.Value;
Evan Cheng96581d32008-11-11 02:11:05 +00001313}
1314
Evan Chengcd8e66a2008-11-11 21:48:44 +00001315class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001316 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001317 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001318 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001319 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001320 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001321 let Inst{27-24} = opcod1;
1322 let Inst{21-20} = opcod2;
1323 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001324}
1325
Evan Chengcd8e66a2008-11-11 21:48:44 +00001326// Load / store multiple
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001327class AXDI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001328 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001329 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001330 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001331 // TODO: Mark the instructions with the appropriate subtarget info.
1332 let Inst{27-25} = 0b110;
1333 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001334
1335 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1336 let Dom = VFPNeonDomain.Value;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001337}
1338
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001339class AXSI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001340 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001341 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001342 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001343 // TODO: Mark the instructions with the appropriate subtarget info.
1344 let Inst{27-25} = 0b110;
1345 let Inst{11-8} = 0b1010;
1346}
1347
Evan Cheng96581d32008-11-11 02:11:05 +00001348// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001349class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1350 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1351 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001352 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001353 let Inst{27-23} = opcod1;
1354 let Inst{21-20} = opcod2;
1355 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001356 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001357 let Inst{7-6} = opcod4;
1358 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001359}
1360
1361// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001362class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001363 dag iops, InstrItinClass itin, string opc, string asm,
1364 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001365 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001366 let Inst{27-23} = opcod1;
1367 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001368 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001369 let Inst{6} = op6;
1370 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001371}
1372
1373// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001374class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1375 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1376 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001377 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001378 let Inst{27-23} = opcod1;
1379 let Inst{21-20} = opcod2;
1380 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001381 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001382 let Inst{7-6} = opcod4;
1383 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001384}
1385
David Goodwin338268c2009-08-10 22:17:39 +00001386// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001387// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001388class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1389 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1390 string asm, list<dag> pattern>
1391 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1392 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001393 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1394}
1395
Evan Cheng96581d32008-11-11 02:11:05 +00001396// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001397class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1398 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001399 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001400 let Inst{27-23} = opcod1;
1401 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001402 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001403 let Inst{6} = op6;
1404 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001405}
1406
David Goodwin338268c2009-08-10 22:17:39 +00001407// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001408// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001409class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001410 dag iops, InstrItinClass itin, string opc, string asm,
1411 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001412 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001413 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1414}
1415
Evan Cheng80a11982008-11-12 06:41:41 +00001416// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001417class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1418 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1419 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001420 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001421 let Inst{27-23} = opcod1;
1422 let Inst{21-20} = opcod2;
1423 let Inst{19-16} = opcod3;
1424 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001425 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001426 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001427}
1428
Johnny Chen811663f2010-02-11 18:47:03 +00001429// VFP conversion between floating-point and fixed-point
1430class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001431 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1432 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001433 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1434 // size (fixed-point number): sx == 0 ? 16 : 32
1435 let Inst{7} = op5; // sx
1436}
1437
David Goodwin338268c2009-08-10 22:17:39 +00001438// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001439class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001440 dag oops, dag iops, InstrItinClass itin,
1441 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001442 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1443 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001444 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1445}
1446
Evan Cheng80a11982008-11-12 06:41:41 +00001447class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001448 InstrItinClass itin,
1449 string opc, string asm, list<dag> pattern>
1450 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001451 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001452 let Inst{11-8} = opcod2;
1453 let Inst{4} = 1;
1454}
1455
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001456class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1457 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1458 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001459
Bob Wilson01135592010-03-23 17:23:59 +00001460class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001461 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1462 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001463
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001464class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1465 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1466 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001467
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001468class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1469 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1470 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001471
Evan Cheng96581d32008-11-11 02:11:05 +00001472//===----------------------------------------------------------------------===//
1473
Bob Wilson5bafff32009-06-22 23:27:02 +00001474//===----------------------------------------------------------------------===//
1475// ARM NEON Instruction templates.
1476//
Evan Cheng13096642008-08-29 06:41:12 +00001477
Johnny Chencaa608e2010-03-20 00:17:00 +00001478class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1479 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1480 list<dag> pattern>
1481 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001482 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001483 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001484 let AsmString = !strconcat(
1485 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1486 !strconcat("\t", asm));
1487 let Pattern = pattern;
1488 list<Predicate> Predicates = [HasNEON];
1489}
1490
1491// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001492class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1493 InstrItinClass itin, string opc, string asm, string cstr,
1494 list<dag> pattern>
1495 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001496 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001497 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001498 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001499 let Pattern = pattern;
1500 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001501}
1502
Evan Chengac0869d2009-11-21 06:21:52 +00001503class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1504 list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001505 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, NEONFrm, itin, opc, asm, "",
Bob Wilson01135592010-03-23 17:23:59 +00001506 pattern> {
Evan Cheng13096642008-08-29 06:41:12 +00001507}
Bob Wilson5bafff32009-06-22 23:27:02 +00001508
Bob Wilsonb07c1712009-10-07 21:53:04 +00001509class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1510 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001511 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001512 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1513 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001514 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001515 let Inst{23} = op23;
1516 let Inst{21-20} = op21_20;
1517 let Inst{11-8} = op11_8;
1518 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001519}
1520
Johnny Chen785516a2010-03-23 16:43:47 +00001521class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001522 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001523 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1524 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001525 let Inst{31-25} = 0b1111001;
1526}
1527
Johnny Chen927b88f2010-03-23 20:40:44 +00001528class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001529 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001530 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001531 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001532 let Inst{31-25} = 0b1111001;
1533}
1534
1535// NEON "one register and a modified immediate" format.
1536class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1537 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001538 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001539 string opc, string dt, string asm, string cstr,
1540 list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001541 : NDataI<oops, iops, NVdImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001542 let Inst{23} = op23;
1543 let Inst{21-19} = op21_19;
1544 let Inst{11-8} = op11_8;
1545 let Inst{7} = op7;
1546 let Inst{6} = op6;
1547 let Inst{5} = op5;
1548 let Inst{4} = op4;
1549}
1550
1551// NEON 2 vector register format.
1552class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1553 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001554 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001555 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001556 : NDataI<oops, iops, NVdVmImmFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001557 let Inst{24-23} = op24_23;
1558 let Inst{21-20} = op21_20;
1559 let Inst{19-18} = op19_18;
1560 let Inst{17-16} = op17_16;
1561 let Inst{11-7} = op11_7;
1562 let Inst{6} = op6;
1563 let Inst{4} = op4;
1564}
1565
1566// Same as N2V except it doesn't have a datatype suffix.
1567class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001568 bits<5> op11_7, bit op6, bit op4,
1569 dag oops, dag iops, InstrItinClass itin,
1570 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001571 : NDataXI<oops, iops, NVdVmImmFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001572 let Inst{24-23} = op24_23;
1573 let Inst{21-20} = op21_20;
1574 let Inst{19-18} = op19_18;
1575 let Inst{17-16} = op17_16;
1576 let Inst{11-7} = op11_7;
1577 let Inst{6} = op6;
1578 let Inst{4} = op4;
1579}
1580
1581// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001582class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001583 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001584 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001585 : NDataI<oops, iops, NEONFrm, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001586 let Inst{24} = op24;
1587 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001588 let Inst{11-8} = op11_8;
1589 let Inst{7} = op7;
1590 let Inst{6} = op6;
1591 let Inst{4} = op4;
1592}
1593
1594// NEON 3 vector register format.
1595class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001596 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001597 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001598 : NDataI<oops, iops, NEONFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001599 let Inst{24} = op24;
1600 let Inst{23} = op23;
1601 let Inst{21-20} = op21_20;
1602 let Inst{11-8} = op11_8;
1603 let Inst{6} = op6;
1604 let Inst{4} = op4;
1605}
1606
1607// Same as N3VX except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001608class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1609 bit op4,
1610 dag oops, dag iops, InstrItinClass itin,
1611 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001612 : NDataXI<oops, iops, NEONFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001613 let Inst{24} = op24;
1614 let Inst{23} = op23;
1615 let Inst{21-20} = op21_20;
1616 let Inst{11-8} = op11_8;
1617 let Inst{6} = op6;
1618 let Inst{4} = op4;
1619}
1620
1621// NEON VMOVs between scalar and core registers.
1622class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001623 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001624 string opc, string dt, string asm, list<dag> pattern>
1625 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001626 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001627 let Inst{27-20} = opcod1;
1628 let Inst{11-8} = opcod2;
1629 let Inst{6-5} = opcod3;
1630 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001631
1632 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001633 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001634 let AsmString = !strconcat(
1635 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1636 !strconcat("\t", asm));
1637 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001638 list<Predicate> Predicates = [HasNEON];
1639}
1640class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001641 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001642 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001643 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001644 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001645class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001646 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001647 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001648 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001649 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001650class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001651 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001652 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001653 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001654 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001655
1656// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1657// for single-precision FP.
1658class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1659 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1660}