blob: 43dcf32a7df7125f4774bff939b27216a4a432e2 [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 Chencaa608e2010-03-20 00:17:00 +000062def NLdStFrm : Format<31>;
Johnny Chen785516a2010-03-23 16:43:47 +000063def NVdImmFrm : Format<32>;
Johnny Chencaa608e2010-03-20 00:17:00 +000064
Evan Cheng34a0fa32009-07-08 01:46:35 +000065// Misc flags.
66
Evan Chengedda31c2008-11-05 18:35:52 +000067// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000068// UnaryDP - Indicates this is a unary data processing instruction, i.e.
69// it doesn't have a Rn operand.
70class UnaryDP { bit isUnaryDataProc = 1; }
71
72// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
73// a 16-bit Thumb instruction if certain conditions are met.
74class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000075
Evan Cheng37f25d92008-08-28 23:39:26 +000076//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000077// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000078//
79
80// Addressing mode.
81class AddrMode<bits<4> val> {
82 bits<4> Value = val;
83}
84def AddrModeNone : AddrMode<0>;
85def AddrMode1 : AddrMode<1>;
86def AddrMode2 : AddrMode<2>;
87def AddrMode3 : AddrMode<3>;
88def AddrMode4 : AddrMode<4>;
89def AddrMode5 : AddrMode<5>;
Bob Wilson8b024a52009-07-01 23:16:05 +000090def AddrMode6 : AddrMode<6>;
91def AddrModeT1_1 : AddrMode<7>;
92def AddrModeT1_2 : AddrMode<8>;
93def AddrModeT1_4 : AddrMode<9>;
94def AddrModeT1_s : AddrMode<10>;
David Goodwine1e52ed2009-07-22 22:24:31 +000095def AddrModeT2_i12: AddrMode<11>;
Bob Wilson8b024a52009-07-01 23:16:05 +000096def AddrModeT2_i8 : AddrMode<12>;
97def AddrModeT2_so : AddrMode<13>;
98def AddrModeT2_pc : AddrMode<14>;
99def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng055b0312009-06-29 07:51:04 +0000100
101// Instruction size.
102class SizeFlagVal<bits<3> val> {
103 bits<3> Value = val;
104}
105def SizeInvalid : SizeFlagVal<0>; // Unset.
106def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
107def Size8Bytes : SizeFlagVal<2>;
108def Size4Bytes : SizeFlagVal<3>;
109def Size2Bytes : SizeFlagVal<4>;
110
111// Load / store index mode.
112class IndexMode<bits<2> val> {
113 bits<2> Value = val;
114}
115def IndexModeNone : IndexMode<0>;
116def IndexModePre : IndexMode<1>;
117def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000118def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000119
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000120// Instruction execution domain.
121class Domain<bits<2> val> {
122 bits<2> Value = val;
123}
124def GenericDomain : Domain<0>;
125def VFPDomain : Domain<1>; // Instructions in VFP domain only
126def NeonDomain : Domain<2>; // Instructions in Neon domain only
127def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
128
Evan Cheng055b0312009-06-29 07:51:04 +0000129//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000130
Evan Cheng446c4282009-07-11 06:43:01 +0000131// ARM special operands.
132//
133
134// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
135// register whose default is 0 (no register).
136def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
137 (ops (i32 14), (i32 zero_reg))> {
138 let PrintMethod = "printPredicateOperand";
139}
140
141// Conditional code result for instructions whose 's' bit is set, e.g. subs.
142def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
143 let PrintMethod = "printSBitModifierOperand";
144}
145
146// Same as cc_out except it defaults to setting CPSR.
147def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
148 let PrintMethod = "printSBitModifierOperand";
149}
150
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000151// ARM special operands for disassembly only.
152//
153
154def cps_opt : Operand<i32> {
155 let PrintMethod = "printCPSOptionOperand";
156}
157
158def msr_mask : Operand<i32> {
159 let PrintMethod = "printMSRMaskOperand";
160}
161
162// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
163// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
164def neg_zero : Operand<i32> {
165 let PrintMethod = "printNegZeroOperand";
166}
167
Evan Cheng446c4282009-07-11 06:43:01 +0000168//===----------------------------------------------------------------------===//
169
Evan Cheng37f25d92008-08-28 23:39:26 +0000170// ARM Instruction templates.
171//
172
Johnny Chend68e1192009-12-15 17:24:14 +0000173class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
174 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000175 : Instruction {
176 let Namespace = "ARM";
177
Evan Chengedda31c2008-11-05 18:35:52 +0000178 // TSFlagsFields
Evan Cheng37f25d92008-08-28 23:39:26 +0000179 AddrMode AM = am;
180 bits<4> AddrModeBits = AM.Value;
Bob Wilson01135592010-03-23 17:23:59 +0000181
Evan Cheng37f25d92008-08-28 23:39:26 +0000182 SizeFlagVal SZ = sz;
183 bits<3> SizeFlag = SZ.Value;
184
185 IndexMode IM = im;
186 bits<2> IndexModeBits = IM.Value;
Bob Wilson01135592010-03-23 17:23:59 +0000187
Evan Cheng37f25d92008-08-28 23:39:26 +0000188 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000189 bits<6> Form = F.Value;
Evan Chengedda31c2008-11-05 18:35:52 +0000190
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000191 Domain D = d;
192 bits<2> Dom = D.Value;
193
Evan Chengedda31c2008-11-05 18:35:52 +0000194 //
195 // Attributes specific to ARM instructions...
196 //
197 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000198 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000199
Evan Cheng37f25d92008-08-28 23:39:26 +0000200 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000201 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000202}
203
Johnny Chend68e1192009-12-15 17:24:14 +0000204class Encoding {
205 field bits<32> Inst;
206}
207
208class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
209 Format f, Domain d, string cstr, InstrItinClass itin>
210 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
211
212// This Encoding-less class is used by Thumb1 to specify the encoding bits later
213// on by adding flavors to specific instructions.
214class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
215 Format f, Domain d, string cstr, InstrItinClass itin>
216 : InstTemplate<am, sz, im, f, d, cstr, itin>;
217
Bob Wilson01135592010-03-23 17:23:59 +0000218class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000219 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000220 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000221 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000222 let OutOperandList = oops;
223 let InOperandList = iops;
224 let AsmString = asm;
225 let Pattern = pattern;
226}
227
228// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000229class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000230 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000231 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000232 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000233 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000234 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000235 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng37f25d92008-08-28 23:39:26 +0000236 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
237 let Pattern = pattern;
238 list<Predicate> Predicates = [IsARM];
239}
Jim Grosbachf6b28622009-12-14 18:31:20 +0000240// A few are not predicable
241class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000242 IndexMode im, Format f, InstrItinClass itin,
243 string opc, string asm, string cstr,
244 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000245 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
246 let OutOperandList = oops;
247 let InOperandList = iops;
248 let AsmString = !strconcat(opc, asm);
249 let Pattern = pattern;
250 let isPredicable = 0;
251 list<Predicate> Predicates = [IsARM];
252}
Evan Cheng37f25d92008-08-28 23:39:26 +0000253
254// Same as I except it can optionally modify CPSR. Note it's modeled as
255// an input operand since by default it's a zero register. It will
256// become an implicit def once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000257class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000258 IndexMode im, Format f, InstrItinClass itin,
259 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000260 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000261 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000262 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000263 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng37f25d92008-08-28 23:39:26 +0000264 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
265 let Pattern = pattern;
266 list<Predicate> Predicates = [IsARM];
267}
268
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000269// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000270class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000271 IndexMode im, Format f, InstrItinClass itin,
272 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000273 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000274 let OutOperandList = oops;
275 let InOperandList = iops;
276 let AsmString = asm;
277 let Pattern = pattern;
278 list<Predicate> Predicates = [IsARM];
279}
280
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000281class AI<dag oops, dag iops, Format f, InstrItinClass itin,
282 string opc, string asm, list<dag> pattern>
283 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
284 opc, asm, "", pattern>;
285class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
286 string opc, string asm, list<dag> pattern>
287 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
288 opc, asm, "", pattern>;
289class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000290 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000291 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000292 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000293class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000294 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000295 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000296 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000297
298// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000299class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
300 string opc, string asm, list<dag> pattern>
301 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
302 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000303 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000304}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000305class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
306 string asm, list<dag> pattern>
307 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
308 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000309 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000310}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000311class ABXIx2<dag oops, dag iops, InstrItinClass itin,
312 string asm, list<dag> pattern>
313 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
314 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000315
316// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000317class JTI<dag oops, dag iops, InstrItinClass itin,
318 string asm, list<dag> pattern>
319 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000320 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000321
Jim Grosbach5278eb82009-12-11 01:42:04 +0000322
323// Atomic load/store instructions
324
325class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
326 string opc, string asm, list<dag> pattern>
327 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
328 opc, asm, "", pattern> {
329 let Inst{27-23} = 0b00011;
330 let Inst{22-21} = opcod;
331 let Inst{20} = 1;
332 let Inst{11-0} = 0b111110011111;
333}
334class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
335 string opc, string asm, list<dag> pattern>
336 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
337 opc, asm, "", pattern> {
338 let Inst{27-23} = 0b00011;
339 let Inst{22-21} = opcod;
340 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000341 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000342}
343
Evan Cheng0d14fc82008-09-01 01:51:14 +0000344// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000345class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
346 string opc, string asm, list<dag> pattern>
347 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
348 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000349 let Inst{24-21} = opcod;
350 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000351}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000352class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
353 string opc, string asm, list<dag> pattern>
354 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
355 opc, asm, "", pattern> {
356 let Inst{24-21} = opcod;
357 let Inst{27-26} = {0,0};
358}
359class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000360 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000361 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000362 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000363 let Inst{24-21} = opcod;
364 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000365}
Bob Wilson01135592010-03-23 17:23:59 +0000366class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000367 string opc, string asm, list<dag> pattern>
368 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
369 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000370
Evan Cheng0d14fc82008-09-01 01:51:14 +0000371
372// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000373class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
374 string opc, string asm, list<dag> pattern>
375 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
376 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000377 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000378}
Evan Cheng93912732008-09-01 01:27:33 +0000379
380// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000381class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
382 string opc, string asm, list<dag> pattern>
383 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
384 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000385 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000386 let Inst{21} = 0; // W bit
387 let Inst{22} = 0; // B bit
388 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000389 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000390}
Bob Wilson01135592010-03-23 17:23:59 +0000391class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000392 string asm, list<dag> pattern>
393 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000394 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000395 let Inst{20} = 1; // L bit
396 let Inst{21} = 0; // W bit
397 let Inst{22} = 0; // B bit
398 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000399 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000400}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000401class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
402 string opc, string asm, list<dag> pattern>
403 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
404 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000405 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000406 let Inst{21} = 0; // W bit
407 let Inst{22} = 1; // B bit
408 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000409 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000410}
Bob Wilson01135592010-03-23 17:23:59 +0000411class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000412 string asm, list<dag> pattern>
413 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000414 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000415 let Inst{20} = 1; // L bit
416 let Inst{21} = 0; // W bit
417 let Inst{22} = 1; // B bit
418 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000419 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000420}
Evan Cheng17222df2008-08-31 19:02:21 +0000421
Evan Cheng93912732008-09-01 01:27:33 +0000422// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000423class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
424 string opc, string asm, list<dag> pattern>
425 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
426 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000427 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000428 let Inst{21} = 0; // W bit
429 let Inst{22} = 0; // B bit
430 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000431 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000432}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000433class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
434 string asm, list<dag> pattern>
435 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000436 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000437 let Inst{20} = 0; // L bit
438 let Inst{21} = 0; // W bit
439 let Inst{22} = 0; // B bit
440 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000441 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000442}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000443class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
444 string opc, string asm, list<dag> pattern>
445 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
446 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000447 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000448 let Inst{21} = 0; // W bit
449 let Inst{22} = 1; // B bit
450 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000451 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000452}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000453class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
454 string asm, list<dag> pattern>
455 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000456 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000457 let Inst{20} = 0; // L bit
458 let Inst{21} = 0; // W bit
459 let Inst{22} = 1; // B bit
460 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000461 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000462}
Evan Cheng93912732008-09-01 01:27:33 +0000463
Evan Cheng840917b2008-09-01 07:00:14 +0000464// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000465class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
466 string opc, string asm, string cstr, list<dag> pattern>
467 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
468 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000469 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000470 let Inst{21} = 1; // W bit
471 let Inst{22} = 0; // B bit
472 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000473 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000474}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000475class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
476 string opc, string asm, string cstr, list<dag> pattern>
477 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
478 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000479 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000480 let Inst{21} = 1; // W bit
481 let Inst{22} = 1; // B bit
482 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000483 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000484}
485
Evan Cheng840917b2008-09-01 07:00:14 +0000486// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000487class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
488 string opc, string asm, string cstr, list<dag> pattern>
489 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
490 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000491 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000492 let Inst{21} = 1; // W bit
493 let Inst{22} = 0; // B bit
494 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000495 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000496}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000497class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
498 string opc, string asm, string cstr, list<dag> pattern>
499 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
500 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000501 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000502 let Inst{21} = 1; // W bit
503 let Inst{22} = 1; // B bit
504 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000505 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000506}
507
Evan Cheng840917b2008-09-01 07:00:14 +0000508// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000509class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
510 string opc, string asm, string cstr, list<dag> pattern>
511 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
512 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000513 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000514 let Inst{21} = 0; // W bit
515 let Inst{22} = 0; // B bit
516 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000517 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000518}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000519class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
520 string opc, string asm, string cstr, list<dag> pattern>
521 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
522 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000523 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000524 let Inst{21} = 0; // W bit
525 let Inst{22} = 1; // B bit
526 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000527 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000528}
529
Evan Cheng840917b2008-09-01 07:00:14 +0000530// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000531class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
532 string opc, string asm, string cstr, list<dag> pattern>
533 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
534 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000535 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000536 let Inst{21} = 0; // W bit
537 let Inst{22} = 0; // B bit
538 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000539 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000540}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000541class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
542 string opc, string asm, string cstr, list<dag> pattern>
543 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
544 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000545 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000546 let Inst{21} = 0; // W bit
547 let Inst{22} = 1; // B bit
548 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000549 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000550}
551
Evan Cheng0d14fc82008-09-01 01:51:14 +0000552// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000553class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000554 string opc, string asm, list<dag> pattern>
555 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
556 opc, asm, "", pattern>;
557class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
558 string asm, list<dag> pattern>
559 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
560 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000561
Evan Cheng840917b2008-09-01 07:00:14 +0000562// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000563class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
564 string opc, string asm, list<dag> pattern>
565 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
566 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000567 let Inst{4} = 1;
568 let Inst{5} = 1; // H bit
569 let Inst{6} = 0; // S bit
570 let Inst{7} = 1;
571 let Inst{20} = 1; // L bit
572 let Inst{21} = 0; // W bit
573 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000574 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000575}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000576class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
577 string asm, list<dag> pattern>
578 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000579 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000580 let Inst{4} = 1;
581 let Inst{5} = 1; // H bit
582 let Inst{6} = 0; // S bit
583 let Inst{7} = 1;
584 let Inst{20} = 1; // L bit
585 let Inst{21} = 0; // W bit
586 let Inst{24} = 1; // P bit
587}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000588class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
589 string opc, string asm, list<dag> pattern>
590 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
591 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000592 let Inst{4} = 1;
593 let Inst{5} = 1; // H bit
594 let Inst{6} = 1; // S bit
595 let Inst{7} = 1;
596 let Inst{20} = 1; // L bit
597 let Inst{21} = 0; // W bit
598 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000599 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000600}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000601class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
602 string asm, list<dag> pattern>
603 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000604 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000605 let Inst{4} = 1;
606 let Inst{5} = 1; // H bit
607 let Inst{6} = 1; // S bit
608 let Inst{7} = 1;
609 let Inst{20} = 1; // L bit
610 let Inst{21} = 0; // W bit
611 let Inst{24} = 1; // P bit
612}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000613class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
614 string opc, string asm, list<dag> pattern>
615 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
616 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000617 let Inst{4} = 1;
618 let Inst{5} = 0; // H bit
619 let Inst{6} = 1; // S bit
620 let Inst{7} = 1;
621 let Inst{20} = 1; // L bit
622 let Inst{21} = 0; // W bit
623 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000624 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000625}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000626class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
627 string asm, list<dag> pattern>
628 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000629 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000630 let Inst{4} = 1;
631 let Inst{5} = 0; // H bit
632 let Inst{6} = 1; // S bit
633 let Inst{7} = 1;
634 let Inst{20} = 1; // L bit
635 let Inst{21} = 0; // W bit
636 let Inst{24} = 1; // P bit
637}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000638class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
639 string opc, string asm, list<dag> pattern>
640 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
641 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000642 let Inst{4} = 1;
643 let Inst{5} = 0; // H bit
644 let Inst{6} = 1; // S bit
645 let Inst{7} = 1;
646 let Inst{20} = 0; // L bit
647 let Inst{21} = 0; // W bit
648 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000649 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000650}
651
652// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000653class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
654 string opc, string asm, list<dag> pattern>
655 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
656 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000657 let Inst{4} = 1;
658 let Inst{5} = 1; // H bit
659 let Inst{6} = 0; // S bit
660 let Inst{7} = 1;
661 let Inst{20} = 0; // L bit
662 let Inst{21} = 0; // W bit
663 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000664 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000665}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000666class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
667 string asm, list<dag> pattern>
668 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000669 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000670 let Inst{4} = 1;
671 let Inst{5} = 1; // H bit
672 let Inst{6} = 0; // S bit
673 let Inst{7} = 1;
674 let Inst{20} = 0; // L bit
675 let Inst{21} = 0; // W bit
676 let Inst{24} = 1; // P bit
677}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000678class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
679 string opc, string asm, list<dag> pattern>
680 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
681 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000682 let Inst{4} = 1;
683 let Inst{5} = 1; // H bit
684 let Inst{6} = 1; // S bit
685 let Inst{7} = 1;
686 let Inst{20} = 0; // L bit
687 let Inst{21} = 0; // W bit
688 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000689 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000690}
691
692// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000693class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
694 string opc, string asm, string cstr, list<dag> pattern>
695 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
696 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000697 let Inst{4} = 1;
698 let Inst{5} = 1; // H bit
699 let Inst{6} = 0; // S bit
700 let Inst{7} = 1;
701 let Inst{20} = 1; // L bit
702 let Inst{21} = 1; // W bit
703 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000704 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000705}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000706class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
707 string opc, string asm, string cstr, list<dag> pattern>
708 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
709 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000710 let Inst{4} = 1;
711 let Inst{5} = 1; // H bit
712 let Inst{6} = 1; // S bit
713 let Inst{7} = 1;
714 let Inst{20} = 1; // L bit
715 let Inst{21} = 1; // W bit
716 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000717 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000718}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000719class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
720 string opc, string asm, string cstr, list<dag> pattern>
721 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
722 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000723 let Inst{4} = 1;
724 let Inst{5} = 0; // H bit
725 let Inst{6} = 1; // S bit
726 let Inst{7} = 1;
727 let Inst{20} = 1; // L bit
728 let Inst{21} = 1; // W bit
729 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000730 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000731}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000732class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
733 string opc, string asm, string cstr, list<dag> pattern>
734 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
735 opc, asm, cstr, pattern> {
736 let Inst{4} = 1;
737 let Inst{5} = 0; // H bit
738 let Inst{6} = 1; // S bit
739 let Inst{7} = 1;
740 let Inst{20} = 0; // L bit
741 let Inst{21} = 1; // W bit
742 let Inst{24} = 1; // P bit
743 let Inst{27-25} = 0b000;
744}
745
Evan Cheng840917b2008-09-01 07:00:14 +0000746
747// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000748class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
749 string opc, string asm, string cstr, list<dag> pattern>
750 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
751 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000752 let Inst{4} = 1;
753 let Inst{5} = 1; // H bit
754 let Inst{6} = 0; // S bit
755 let Inst{7} = 1;
756 let Inst{20} = 0; // L bit
757 let Inst{21} = 1; // W bit
758 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000759 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000760}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000761class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
762 string opc, string asm, string cstr, list<dag> pattern>
763 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
764 opc, asm, cstr, pattern> {
765 let Inst{4} = 1;
766 let Inst{5} = 1; // H bit
767 let Inst{6} = 1; // S bit
768 let Inst{7} = 1;
769 let Inst{20} = 0; // L bit
770 let Inst{21} = 1; // W bit
771 let Inst{24} = 1; // P bit
772 let Inst{27-25} = 0b000;
773}
Evan Cheng840917b2008-09-01 07:00:14 +0000774
775// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000776class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
777 string opc, string asm, string cstr, list<dag> pattern>
778 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
779 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000780 let Inst{4} = 1;
781 let Inst{5} = 1; // H bit
782 let Inst{6} = 0; // S bit
783 let Inst{7} = 1;
784 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000785 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000786 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000787 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000788}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000789class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
790 string opc, string asm, string cstr, list<dag> pattern>
791 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
792 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000793 let Inst{4} = 1;
794 let Inst{5} = 1; // H bit
795 let Inst{6} = 1; // S bit
796 let Inst{7} = 1;
797 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000798 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000799 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000800 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000801}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000802class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
803 string opc, string asm, string cstr, list<dag> pattern>
804 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
805 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000806 let Inst{4} = 1;
807 let Inst{5} = 0; // H bit
808 let Inst{6} = 1; // S bit
809 let Inst{7} = 1;
810 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000811 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000812 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000813 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000814}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000815class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
816 string opc, string asm, string cstr, list<dag> pattern>
817 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
818 opc, asm, cstr, pattern> {
819 let Inst{4} = 1;
820 let Inst{5} = 0; // H bit
821 let Inst{6} = 1; // S bit
822 let Inst{7} = 1;
823 let Inst{20} = 0; // L bit
824 let Inst{21} = 0; // W bit
825 let Inst{24} = 0; // P bit
826 let Inst{27-25} = 0b000;
827}
Evan Cheng840917b2008-09-01 07:00:14 +0000828
829// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000830class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
831 string opc, string asm, string cstr, list<dag> pattern>
832 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
833 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000834 let Inst{4} = 1;
835 let Inst{5} = 1; // H bit
836 let Inst{6} = 0; // S bit
837 let Inst{7} = 1;
838 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000839 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000840 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000841 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000842}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000843class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
844 string opc, string asm, string cstr, list<dag> pattern>
845 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
846 opc, asm, cstr, pattern> {
847 let Inst{4} = 1;
848 let Inst{5} = 1; // H bit
849 let Inst{6} = 1; // S bit
850 let Inst{7} = 1;
851 let Inst{20} = 0; // L bit
852 let Inst{21} = 0; // W bit
853 let Inst{24} = 0; // P bit
854 let Inst{27-25} = 0b000;
855}
Evan Cheng840917b2008-09-01 07:00:14 +0000856
Evan Cheng0d14fc82008-09-01 01:51:14 +0000857// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000858class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000859 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000860 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000861 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000862 let Inst{20} = 1; // L bit
863 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000864 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000865}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000866class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000867 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000868 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000869 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000870 let Inst{20} = 0; // L bit
871 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000872 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000873}
Evan Cheng37f25d92008-08-28 23:39:26 +0000874
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000875// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000876class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
877 string opc, string asm, list<dag> pattern>
878 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
879 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000880 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000881 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000882 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000883}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000884class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
885 string opc, string asm, list<dag> pattern>
886 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
887 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000888 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000889 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000890}
891
892// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000893class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
894 string opc, string asm, list<dag> pattern>
895 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
896 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000897 let Inst{7-4} = 0b1001;
898 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000899 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000900}
Evan Cheng37f25d92008-08-28 23:39:26 +0000901
Evan Chengeb4f52e2008-11-06 03:35:07 +0000902// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000903class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
904 string opc, string asm, list<dag> pattern>
905 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
906 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000907 let Inst{4} = 0;
908 let Inst{7} = 1;
909 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000910 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000911}
912
Evan Cheng97f48c32008-11-06 22:15:19 +0000913// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000914class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
915 string opc, string asm, list<dag> pattern>
916 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
917 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000918 let Inst{7-4} = 0b0111;
919 let Inst{27-20} = opcod;
920}
921
Evan Cheng8b59db32008-11-07 01:41:35 +0000922// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000923class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
924 string opc, string asm, list<dag> pattern>
925 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
926 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000927 let Inst{27-20} = opcod;
928}
929
Evan Cheng37f25d92008-08-28 23:39:26 +0000930//===----------------------------------------------------------------------===//
931
932// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
933class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
934 list<Predicate> Predicates = [IsARM];
935}
936class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
937 list<Predicate> Predicates = [IsARM, HasV5TE];
938}
939class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
940 list<Predicate> Predicates = [IsARM, HasV6];
941}
Evan Cheng13096642008-08-29 06:41:12 +0000942
943//===----------------------------------------------------------------------===//
944//
945// Thumb Instruction Format Definitions.
946//
947
Evan Cheng13096642008-08-29 06:41:12 +0000948// TI - Thumb instruction.
949
Evan Cheng446c4282009-07-11 06:43:01 +0000950class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000951 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000952 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000953 let OutOperandList = oops;
954 let InOperandList = iops;
Evan Cheng13096642008-08-29 06:41:12 +0000955 let AsmString = asm;
956 let Pattern = pattern;
957 list<Predicate> Predicates = [IsThumb];
958}
959
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000960class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
961 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000962
Evan Cheng35d6c412009-08-04 23:47:55 +0000963// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000964class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
965 list<dag> pattern>
966 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
967 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000968
Johnny Chend68e1192009-12-15 17:24:14 +0000969// tBL, tBX 32-bit instructions
970class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000971 dag oops, dag iops, InstrItinClass itin, string asm,
972 list<dag> pattern>
973 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
974 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000975 let Inst{31-27} = opcod1;
976 let Inst{15-14} = opcod2;
977 let Inst{12} = opcod3;
978}
Evan Cheng13096642008-08-29 06:41:12 +0000979
980// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000981class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
982 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000983 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000984
Evan Cheng09c39fc2009-06-23 19:38:13 +0000985// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000986class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000987 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000988 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000989 let OutOperandList = oops;
990 let InOperandList = iops;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000991 let AsmString = asm;
992 let Pattern = pattern;
993 list<Predicate> Predicates = [IsThumb1Only];
994}
995
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000996class T1I<dag oops, dag iops, InstrItinClass itin,
997 string asm, list<dag> pattern>
998 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
999class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1000 string asm, list<dag> pattern>
1001 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1002class T1JTI<dag oops, dag iops, InstrItinClass itin,
1003 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001004 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001005
1006// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001007class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001008 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001009 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001010 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001011
1012// Thumb1 instruction that can either be predicated or set CPSR.
1013class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001014 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001015 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001016 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001017 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1018 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001019 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1020 let Pattern = pattern;
1021 list<Predicate> Predicates = [IsThumb1Only];
1022}
1023
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001024class T1sI<dag oops, dag iops, InstrItinClass itin,
1025 string opc, string asm, list<dag> pattern>
1026 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001027
1028// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001029class T1sIt<dag oops, dag iops, InstrItinClass itin,
1030 string opc, string asm, list<dag> pattern>
1031 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001032 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001033
1034// Thumb1 instruction that can be predicated.
1035class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001036 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001037 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001038 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001039 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001040 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001041 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1042 let Pattern = pattern;
1043 list<Predicate> Predicates = [IsThumb1Only];
1044}
1045
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001046class T1pI<dag oops, dag iops, InstrItinClass itin,
1047 string opc, string asm, list<dag> pattern>
1048 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001049
1050// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001051class T1pIt<dag oops, dag iops, InstrItinClass itin,
1052 string opc, string asm, list<dag> pattern>
1053 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001054 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001055
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001056class T1pI1<dag oops, dag iops, InstrItinClass itin,
1057 string opc, string asm, list<dag> pattern>
1058 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1059class T1pI2<dag oops, dag iops, InstrItinClass itin,
1060 string opc, string asm, list<dag> pattern>
1061 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1062class T1pI4<dag oops, dag iops, InstrItinClass itin,
1063 string opc, string asm, list<dag> pattern>
1064 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001065class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001066 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1067 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001068
Johnny Chenbbc71b22009-12-16 02:32:54 +00001069class Encoding16 : Encoding {
1070 let Inst{31-16} = 0x0000;
1071}
1072
Johnny Chend68e1192009-12-15 17:24:14 +00001073// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001074class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001075 let Inst{15-10} = opcode;
1076}
1077
1078// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001079class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001080 let Inst{15-14} = 0b00;
1081 let Inst{13-9} = opcode;
1082}
1083
1084// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001085class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001086 let Inst{15-10} = 0b010000;
1087 let Inst{9-6} = opcode;
1088}
1089
1090// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001091class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001092 let Inst{15-10} = 0b010001;
1093 let Inst{9-6} = opcode;
1094}
1095
1096// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001097class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001098 let Inst{15-12} = opA;
1099 let Inst{11-9} = opB;
1100}
1101class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1102class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1103class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1104class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1105class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1106
1107// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001108class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001109 let Inst{15-12} = 0b1011;
1110 let Inst{11-5} = opcode;
1111}
1112
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001113// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1114class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001115 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001116 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001117 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001118 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001119 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001120 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1121 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001122 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001123}
1124
1125// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1126// an input operand since by default it's a zero register. It will
1127// become an implicit def once it's "flipped".
1128// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1129// more consistent.
1130class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001131 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001132 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001133 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001134 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001135 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001136 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1137 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001138 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001139}
1140
1141// Special cases
1142class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001143 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001144 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001145 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001146 let OutOperandList = oops;
1147 let InOperandList = iops;
Evan Chengf49810c2009-06-23 17:48:47 +00001148 let AsmString = asm;
1149 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001150 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001151}
1152
Jim Grosbachd1228742009-12-01 18:10:36 +00001153class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001154 InstrItinClass itin,
1155 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001156 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1157 let OutOperandList = oops;
1158 let InOperandList = iops;
1159 let AsmString = asm;
1160 let Pattern = pattern;
1161 list<Predicate> Predicates = [IsThumb1Only];
1162}
1163
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001164class T2I<dag oops, dag iops, InstrItinClass itin,
1165 string opc, string asm, list<dag> pattern>
1166 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1167class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1168 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001169 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001170class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1171 string opc, string asm, list<dag> pattern>
1172 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1173class T2Iso<dag oops, dag iops, InstrItinClass itin,
1174 string opc, string asm, list<dag> pattern>
1175 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1176class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1177 string opc, string asm, list<dag> pattern>
1178 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001179class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001180 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001181 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1182 pattern> {
1183 let Inst{31-27} = 0b11101;
1184 let Inst{26-25} = 0b00;
1185 let Inst{24} = P;
1186 let Inst{23} = ?; // The U bit.
1187 let Inst{22} = 1;
1188 let Inst{21} = W;
1189 let Inst{20} = load;
1190}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001191
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001192class T2sI<dag oops, dag iops, InstrItinClass itin,
1193 string opc, string asm, list<dag> pattern>
1194 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001195
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001196class T2XI<dag oops, dag iops, InstrItinClass itin,
1197 string asm, list<dag> pattern>
1198 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1199class T2JTI<dag oops, dag iops, InstrItinClass itin,
1200 string asm, list<dag> pattern>
1201 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001202
Evan Cheng5adb66a2009-09-28 09:14:39 +00001203class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001204 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001205 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1206
Bob Wilson815baeb2010-03-13 01:08:20 +00001207// Two-address instructions
1208class T2XIt<dag oops, dag iops, InstrItinClass itin,
1209 string asm, string cstr, list<dag> pattern>
1210 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001211
Evan Chenge88d5ce2009-07-02 07:28:31 +00001212// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001213class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1214 dag oops, dag iops,
1215 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001216 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001217 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001218 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001219 let InOperandList = !con(iops, (ins pred:$p));
Evan Chenge88d5ce2009-07-02 07:28:31 +00001220 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1221 let Pattern = pattern;
1222 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001223 let Inst{31-27} = 0b11111;
1224 let Inst{26-25} = 0b00;
1225 let Inst{24} = signed;
1226 let Inst{23} = 0;
1227 let Inst{22-21} = opcod;
1228 let Inst{20} = load;
1229 let Inst{11} = 1;
1230 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1231 let Inst{10} = pre; // The P bit.
1232 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001233}
1234
Johnny Chenadc77332010-02-26 22:04:29 +00001235// Helper class for disassembly only
1236// A6.3.16 & A6.3.17
1237// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1238class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1239 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1240 : T2I<oops, iops, itin, opc, asm, pattern> {
1241 let Inst{31-27} = 0b11111;
1242 let Inst{26-24} = 0b011;
1243 let Inst{23} = long;
1244 let Inst{22-20} = op22_20;
1245 let Inst{7-4} = op7_4;
1246}
1247
David Goodwinc9d138f2009-07-27 19:59:26 +00001248// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1249class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1250 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1251}
1252
1253// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1254class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1255 list<Predicate> Predicates = [IsThumb1Only];
1256}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001257
Evan Cheng9cb9e672009-06-27 02:26:13 +00001258// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1259class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001260 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001261}
1262
Evan Cheng13096642008-08-29 06:41:12 +00001263//===----------------------------------------------------------------------===//
1264
Evan Cheng96581d32008-11-11 02:11:05 +00001265//===----------------------------------------------------------------------===//
1266// ARM VFP Instruction templates.
1267//
1268
David Goodwin3ca524e2009-07-10 17:03:29 +00001269// Almost all VFP instructions are predicable.
1270class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001271 IndexMode im, Format f, InstrItinClass itin,
1272 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001273 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001274 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001275 let InOperandList = !con(iops, (ins pred:$p));
David Goodwin3ca524e2009-07-10 17:03:29 +00001276 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1277 let Pattern = pattern;
1278 list<Predicate> Predicates = [HasVFP2];
1279}
1280
1281// Special cases
1282class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001283 IndexMode im, Format f, InstrItinClass itin,
1284 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001285 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001286 let OutOperandList = oops;
1287 let InOperandList = iops;
1288 let AsmString = asm;
1289 let Pattern = pattern;
1290 list<Predicate> Predicates = [HasVFP2];
1291}
1292
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001293class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1294 string opc, string asm, list<dag> pattern>
1295 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1296 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001297
Evan Chengcd8e66a2008-11-11 21:48:44 +00001298// ARM VFP addrmode5 loads and stores
1299class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001300 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001301 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001302 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001303 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001304 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001305 let Inst{27-24} = opcod1;
1306 let Inst{21-20} = opcod2;
1307 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001308
1309 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1310 let Dom = VFPNeonDomain.Value;
Evan Cheng96581d32008-11-11 02:11:05 +00001311}
1312
Evan Chengcd8e66a2008-11-11 21:48:44 +00001313class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001314 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001315 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001316 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001317 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001318 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001319 let Inst{27-24} = opcod1;
1320 let Inst{21-20} = opcod2;
1321 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001322}
1323
Evan Chengcd8e66a2008-11-11 21:48:44 +00001324// Load / store multiple
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001325class AXDI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001326 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001327 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001328 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001329 // TODO: Mark the instructions with the appropriate subtarget info.
1330 let Inst{27-25} = 0b110;
1331 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001332
1333 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1334 let Dom = VFPNeonDomain.Value;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001335}
1336
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001337class AXSI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001338 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001339 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001340 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001341 // TODO: Mark the instructions with the appropriate subtarget info.
1342 let Inst{27-25} = 0b110;
1343 let Inst{11-8} = 0b1010;
1344}
1345
Evan Cheng96581d32008-11-11 02:11:05 +00001346// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001347class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1348 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1349 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001350 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001351 let Inst{27-23} = opcod1;
1352 let Inst{21-20} = opcod2;
1353 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001354 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001355 let Inst{7-6} = opcod4;
1356 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001357}
1358
1359// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001360class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001361 dag iops, InstrItinClass itin, string opc, string asm,
1362 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001363 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001364 let Inst{27-23} = opcod1;
1365 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001366 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001367 let Inst{6} = op6;
1368 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001369}
1370
1371// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001372class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1373 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1374 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001375 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001376 let Inst{27-23} = opcod1;
1377 let Inst{21-20} = opcod2;
1378 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001379 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001380 let Inst{7-6} = opcod4;
1381 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001382}
1383
David Goodwin338268c2009-08-10 22:17:39 +00001384// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001385// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001386class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1387 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1388 string asm, list<dag> pattern>
1389 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1390 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001391 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1392}
1393
Evan Cheng96581d32008-11-11 02:11:05 +00001394// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001395class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1396 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001397 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001398 let Inst{27-23} = opcod1;
1399 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001400 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001401 let Inst{6} = op6;
1402 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001403}
1404
David Goodwin338268c2009-08-10 22:17:39 +00001405// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001406// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001407class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001408 dag iops, InstrItinClass itin, string opc, string asm,
1409 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001410 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001411 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1412}
1413
Evan Cheng80a11982008-11-12 06:41:41 +00001414// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001415class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1416 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1417 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001418 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001419 let Inst{27-23} = opcod1;
1420 let Inst{21-20} = opcod2;
1421 let Inst{19-16} = opcod3;
1422 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001423 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001424 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001425}
1426
Johnny Chen811663f2010-02-11 18:47:03 +00001427// VFP conversion between floating-point and fixed-point
1428class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001429 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1430 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001431 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1432 // size (fixed-point number): sx == 0 ? 16 : 32
1433 let Inst{7} = op5; // sx
1434}
1435
David Goodwin338268c2009-08-10 22:17:39 +00001436// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001437class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001438 dag oops, dag iops, InstrItinClass itin,
1439 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001440 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1441 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001442 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1443}
1444
Evan Cheng80a11982008-11-12 06:41:41 +00001445class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001446 InstrItinClass itin,
1447 string opc, string asm, list<dag> pattern>
1448 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001449 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001450 let Inst{11-8} = opcod2;
1451 let Inst{4} = 1;
1452}
1453
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001454class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1455 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1456 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001457
Bob Wilson01135592010-03-23 17:23:59 +00001458class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001459 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1460 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001461
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001462class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1463 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1464 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001465
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001466class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1467 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1468 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001469
Evan Cheng96581d32008-11-11 02:11:05 +00001470//===----------------------------------------------------------------------===//
1471
Bob Wilson5bafff32009-06-22 23:27:02 +00001472//===----------------------------------------------------------------------===//
1473// ARM NEON Instruction templates.
1474//
Evan Cheng13096642008-08-29 06:41:12 +00001475
Johnny Chencaa608e2010-03-20 00:17:00 +00001476class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1477 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1478 list<dag> pattern>
1479 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001480 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001481 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001482 let AsmString = !strconcat(
1483 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1484 !strconcat("\t", asm));
1485 let Pattern = pattern;
1486 list<Predicate> Predicates = [HasNEON];
1487}
1488
1489// Same as NeonI except it does not have a "data type" specifier.
1490class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001491 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001492 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001493 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001494 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001495 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001496 let Pattern = pattern;
1497 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001498}
1499
Evan Chengac0869d2009-11-21 06:21:52 +00001500class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1501 list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001502 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
Bob Wilson01135592010-03-23 17:23:59 +00001503 pattern> {
Evan Cheng13096642008-08-29 06:41:12 +00001504}
Bob Wilson5bafff32009-06-22 23:27:02 +00001505
Evan Chengf81bf152009-11-23 21:57:23 +00001506class NI4<dag oops, dag iops, InstrItinClass itin, string opc,
1507 string asm, list<dag> pattern>
1508 : NeonXI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "",
1509 pattern> {
Anton Korobeynikovbaf31082009-08-08 13:35:48 +00001510}
1511
Bob Wilsonb07c1712009-10-07 21:53:04 +00001512class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1513 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001514 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001515 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1516 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001517 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001518 let Inst{23} = op23;
1519 let Inst{21-20} = op21_20;
1520 let Inst{11-8} = op11_8;
1521 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001522}
1523
Johnny Chen785516a2010-03-23 16:43:47 +00001524class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001525 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001526 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1527 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001528 let Inst{31-25} = 0b1111001;
1529}
1530
1531class NDataXI<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001532 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001533 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001534 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001535 let Inst{31-25} = 0b1111001;
1536}
1537
1538// NEON "one register and a modified immediate" format.
1539class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1540 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001541 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001542 string opc, string dt, string asm, string cstr,
1543 list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001544 : NDataI<oops, iops, NVdImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001545 let Inst{23} = op23;
1546 let Inst{21-19} = op21_19;
1547 let Inst{11-8} = op11_8;
1548 let Inst{7} = op7;
1549 let Inst{6} = op6;
1550 let Inst{5} = op5;
1551 let Inst{4} = op4;
1552}
1553
1554// NEON 2 vector register format.
1555class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1556 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001557 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001558 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001559 : NDataI<oops, iops, NEONFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001560 let Inst{24-23} = op24_23;
1561 let Inst{21-20} = op21_20;
1562 let Inst{19-18} = op19_18;
1563 let Inst{17-16} = op17_16;
1564 let Inst{11-7} = op11_7;
1565 let Inst{6} = op6;
1566 let Inst{4} = op4;
1567}
1568
1569// Same as N2V except it doesn't have a datatype suffix.
1570class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001571 bits<5> op11_7, bit op6, bit op4,
1572 dag oops, dag iops, InstrItinClass itin,
1573 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001574 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001575 let Inst{24-23} = op24_23;
1576 let Inst{21-20} = op21_20;
1577 let Inst{19-18} = op19_18;
1578 let Inst{17-16} = op17_16;
1579 let Inst{11-7} = op11_7;
1580 let Inst{6} = op6;
1581 let Inst{4} = op4;
1582}
1583
1584// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001585class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001586 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001587 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001588 : NDataI<oops, iops, NEONFrm, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001589 let Inst{24} = op24;
1590 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001591 let Inst{11-8} = op11_8;
1592 let Inst{7} = op7;
1593 let Inst{6} = op6;
1594 let Inst{4} = op4;
1595}
1596
1597// NEON 3 vector register format.
1598class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001599 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001600 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001601 : NDataI<oops, iops, NEONFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001602 let Inst{24} = op24;
1603 let Inst{23} = op23;
1604 let Inst{21-20} = op21_20;
1605 let Inst{11-8} = op11_8;
1606 let Inst{6} = op6;
1607 let Inst{4} = op4;
1608}
1609
1610// Same as N3VX except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001611class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1612 bit op4,
1613 dag oops, dag iops, InstrItinClass itin,
1614 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001615 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001616 let Inst{24} = op24;
1617 let Inst{23} = op23;
1618 let Inst{21-20} = op21_20;
1619 let Inst{11-8} = op11_8;
1620 let Inst{6} = op6;
1621 let Inst{4} = op4;
1622}
1623
1624// NEON VMOVs between scalar and core registers.
1625class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001626 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001627 string opc, string dt, string asm, list<dag> pattern>
1628 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001629 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001630 let Inst{27-20} = opcod1;
1631 let Inst{11-8} = opcod2;
1632 let Inst{6-5} = opcod3;
1633 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001634
1635 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001636 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001637 let AsmString = !strconcat(
1638 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1639 !strconcat("\t", asm));
1640 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001641 list<Predicate> Predicates = [HasNEON];
1642}
1643class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001644 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001645 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001646 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001647 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001648class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001649 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001650 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001651 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001652 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001653class NVDup<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, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001657 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001658
1659// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1660// for single-precision FP.
1661class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1662 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1663}