blob: f69bb39062ef354e0c83658af8dfe74ad5138a22 [file] [log] [blame]
Evan Cheng37f25d92008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11//
12// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
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;
181
182 SizeFlagVal SZ = sz;
183 bits<3> SizeFlag = SZ.Value;
184
185 IndexMode IM = im;
186 bits<2> IndexModeBits = IM.Value;
187
188 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;
Evan Cheng37f25d92008-08-28 23:39:26 +0000199
200 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
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000218class PseudoInst<dag oops, dag iops, InstrItinClass itin,
219 string asm, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000220 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
221 "", 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,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000230 IndexMode im, Format f, InstrItinClass itin,
231 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,
242 IndexMode im, Format f, InstrItinClass itin,
243 string opc, string asm, string cstr,
244 list<dag> pattern>
245 : 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,
294 string opc, string asm, list<dag> pattern>
295 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
296 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}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000366class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
367 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}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000391class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
392 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}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000411class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
412 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
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000553class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
554 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
857
Evan Cheng0d14fc82008-09-01 01:51:14 +0000858// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000859class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000860 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000861 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000862 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000863 let Inst{20} = 1; // L bit
864 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000865 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000866}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000867class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000868 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000869 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000870 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000871 let Inst{20} = 0; // L bit
872 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000873 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000874}
Evan Cheng37f25d92008-08-28 23:39:26 +0000875
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000876// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000877class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
878 string opc, string asm, list<dag> pattern>
879 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
880 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000881 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000882 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000883 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000884}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000885class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
886 string opc, string asm, list<dag> pattern>
887 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
888 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000889 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000890 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000891}
892
893// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000894class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
895 string opc, string asm, list<dag> pattern>
896 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
897 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000898 let Inst{7-4} = 0b1001;
899 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000900 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000901}
Evan Cheng37f25d92008-08-28 23:39:26 +0000902
Evan Chengeb4f52e2008-11-06 03:35:07 +0000903// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000904class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
905 string opc, string asm, list<dag> pattern>
906 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
907 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000908 let Inst{4} = 0;
909 let Inst{7} = 1;
910 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000911 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000912}
913
Evan Cheng97f48c32008-11-06 22:15:19 +0000914// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000915class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
916 string opc, string asm, list<dag> pattern>
917 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
918 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000919 let Inst{7-4} = 0b0111;
920 let Inst{27-20} = opcod;
921}
922
Evan Cheng8b59db32008-11-07 01:41:35 +0000923// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000924class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
925 string opc, string asm, list<dag> pattern>
926 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
927 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000928 let Inst{27-20} = opcod;
929}
930
Evan Cheng37f25d92008-08-28 23:39:26 +0000931//===----------------------------------------------------------------------===//
932
933// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
934class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
935 list<Predicate> Predicates = [IsARM];
936}
937class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
938 list<Predicate> Predicates = [IsARM, HasV5TE];
939}
940class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
941 list<Predicate> Predicates = [IsARM, HasV6];
942}
Evan Cheng13096642008-08-29 06:41:12 +0000943
944//===----------------------------------------------------------------------===//
945//
946// Thumb Instruction Format Definitions.
947//
948
Evan Cheng13096642008-08-29 06:41:12 +0000949// TI - Thumb instruction.
950
Evan Cheng446c4282009-07-11 06:43:01 +0000951class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000952 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000953 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000954 let OutOperandList = oops;
955 let InOperandList = iops;
Evan Cheng13096642008-08-29 06:41:12 +0000956 let AsmString = asm;
957 let Pattern = pattern;
958 list<Predicate> Predicates = [IsThumb];
959}
960
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000961class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
962 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000963
Evan Cheng35d6c412009-08-04 23:47:55 +0000964// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000965class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
966 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000967
Johnny Chend68e1192009-12-15 17:24:14 +0000968// tBL, tBX 32-bit instructions
969class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
970 dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
971 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>, Encoding {
972 let Inst{31-27} = opcod1;
973 let Inst{15-14} = opcod2;
974 let Inst{12} = opcod3;
975}
Evan Cheng13096642008-08-29 06:41:12 +0000976
977// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000978class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
979 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000980
Evan Cheng09c39fc2009-06-23 19:38:13 +0000981// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000982class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000983 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000984 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000985 let OutOperandList = oops;
986 let InOperandList = iops;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000987 let AsmString = asm;
988 let Pattern = pattern;
989 list<Predicate> Predicates = [IsThumb1Only];
990}
991
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000992class T1I<dag oops, dag iops, InstrItinClass itin,
993 string asm, list<dag> pattern>
994 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
995class T1Ix2<dag oops, dag iops, InstrItinClass itin,
996 string asm, list<dag> pattern>
997 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
998class T1JTI<dag oops, dag iops, InstrItinClass itin,
999 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001000 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001001
1002// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001003class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001004 string asm, string cstr, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001005 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001006 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001007
1008// Thumb1 instruction that can either be predicated or set CPSR.
1009class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001010 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001011 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001012 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001013 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1014 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001015 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1016 let Pattern = pattern;
1017 list<Predicate> Predicates = [IsThumb1Only];
1018}
1019
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001020class T1sI<dag oops, dag iops, InstrItinClass itin,
1021 string opc, string asm, list<dag> pattern>
1022 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001023
1024// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001025class T1sIt<dag oops, dag iops, InstrItinClass itin,
1026 string opc, string asm, list<dag> pattern>
1027 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001028 "$lhs = $dst", pattern>;
1029
1030// Thumb1 instruction that can be predicated.
1031class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001032 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001033 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001034 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001035 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001036 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001037 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1038 let Pattern = pattern;
1039 list<Predicate> Predicates = [IsThumb1Only];
1040}
1041
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001042class T1pI<dag oops, dag iops, InstrItinClass itin,
1043 string opc, string asm, list<dag> pattern>
1044 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001045
1046// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001047class T1pIt<dag oops, dag iops, InstrItinClass itin,
1048 string opc, string asm, list<dag> pattern>
1049 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001050 "$lhs = $dst", pattern>;
1051
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001052class T1pI1<dag oops, dag iops, InstrItinClass itin,
1053 string opc, string asm, list<dag> pattern>
1054 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1055class T1pI2<dag oops, dag iops, InstrItinClass itin,
1056 string opc, string asm, list<dag> pattern>
1057 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1058class T1pI4<dag oops, dag iops, InstrItinClass itin,
1059 string opc, string asm, list<dag> pattern>
1060 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1061class T1pIs<dag oops, dag iops,
1062 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1063 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001064
Johnny Chenbbc71b22009-12-16 02:32:54 +00001065class Encoding16 : Encoding {
1066 let Inst{31-16} = 0x0000;
1067}
1068
Johnny Chend68e1192009-12-15 17:24:14 +00001069// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001070class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001071 let Inst{15-10} = opcode;
1072}
1073
1074// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001075class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001076 let Inst{15-14} = 0b00;
1077 let Inst{13-9} = opcode;
1078}
1079
1080// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001081class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001082 let Inst{15-10} = 0b010000;
1083 let Inst{9-6} = opcode;
1084}
1085
1086// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001087class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001088 let Inst{15-10} = 0b010001;
1089 let Inst{9-6} = opcode;
1090}
1091
1092// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001093class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001094 let Inst{15-12} = opA;
1095 let Inst{11-9} = opB;
1096}
1097class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1098class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1099class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1100class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1101class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1102
1103// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001104class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001105 let Inst{15-12} = 0b1011;
1106 let Inst{11-5} = opcode;
1107}
1108
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001109// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1110class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001111 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001112 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001113 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001114 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001115 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001116 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1117 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001118 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001119}
1120
1121// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1122// an input operand since by default it's a zero register. It will
1123// become an implicit def once it's "flipped".
1124// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1125// more consistent.
1126class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001127 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001128 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001129 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001130 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001131 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001132 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1133 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001134 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001135}
1136
1137// Special cases
1138class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001139 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001140 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001141 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001142 let OutOperandList = oops;
1143 let InOperandList = iops;
Evan Chengf49810c2009-06-23 17:48:47 +00001144 let AsmString = asm;
1145 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001146 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001147}
1148
Jim Grosbachd1228742009-12-01 18:10:36 +00001149class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1150 InstrItinClass itin,
1151 string asm, string cstr, list<dag> pattern>
1152 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1153 let OutOperandList = oops;
1154 let InOperandList = iops;
1155 let AsmString = asm;
1156 let Pattern = pattern;
1157 list<Predicate> Predicates = [IsThumb1Only];
1158}
1159
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001160class T2I<dag oops, dag iops, InstrItinClass itin,
1161 string opc, string asm, list<dag> pattern>
1162 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1163class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1164 string opc, string asm, list<dag> pattern>
1165 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
1166class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1167 string opc, string asm, list<dag> pattern>
1168 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1169class T2Iso<dag oops, dag iops, InstrItinClass itin,
1170 string opc, string asm, list<dag> pattern>
1171 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1172class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1173 string opc, string asm, list<dag> pattern>
1174 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001175class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001176 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001177 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1178 pattern> {
1179 let Inst{31-27} = 0b11101;
1180 let Inst{26-25} = 0b00;
1181 let Inst{24} = P;
1182 let Inst{23} = ?; // The U bit.
1183 let Inst{22} = 1;
1184 let Inst{21} = W;
1185 let Inst{20} = load;
1186}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001187
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001188class T2sI<dag oops, dag iops, InstrItinClass itin,
1189 string opc, string asm, list<dag> pattern>
1190 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001191
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001192class T2XI<dag oops, dag iops, InstrItinClass itin,
1193 string asm, list<dag> pattern>
1194 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1195class T2JTI<dag oops, dag iops, InstrItinClass itin,
1196 string asm, list<dag> pattern>
1197 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001198
Evan Cheng5adb66a2009-09-28 09:14:39 +00001199class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1200 string opc, string asm, list<dag> pattern>
1201 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1202
Bob Wilson815baeb2010-03-13 01:08:20 +00001203// Two-address instructions
1204class T2XIt<dag oops, dag iops, InstrItinClass itin,
1205 string asm, string cstr, list<dag> pattern>
1206 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001207
Evan Chenge88d5ce2009-07-02 07:28:31 +00001208// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001209class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1210 dag oops, dag iops,
1211 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001212 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001213 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001214 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001215 let InOperandList = !con(iops, (ins pred:$p));
Evan Chenge88d5ce2009-07-02 07:28:31 +00001216 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1217 let Pattern = pattern;
1218 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001219 let Inst{31-27} = 0b11111;
1220 let Inst{26-25} = 0b00;
1221 let Inst{24} = signed;
1222 let Inst{23} = 0;
1223 let Inst{22-21} = opcod;
1224 let Inst{20} = load;
1225 let Inst{11} = 1;
1226 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1227 let Inst{10} = pre; // The P bit.
1228 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001229}
1230
Johnny Chenadc77332010-02-26 22:04:29 +00001231// Helper class for disassembly only
1232// A6.3.16 & A6.3.17
1233// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1234class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1235 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1236 : T2I<oops, iops, itin, opc, asm, pattern> {
1237 let Inst{31-27} = 0b11111;
1238 let Inst{26-24} = 0b011;
1239 let Inst{23} = long;
1240 let Inst{22-20} = op22_20;
1241 let Inst{7-4} = op7_4;
1242}
1243
David Goodwinc9d138f2009-07-27 19:59:26 +00001244// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1245class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1246 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1247}
1248
1249// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1250class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1251 list<Predicate> Predicates = [IsThumb1Only];
1252}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001253
Evan Cheng9cb9e672009-06-27 02:26:13 +00001254// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1255class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001256 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001257}
1258
Evan Cheng13096642008-08-29 06:41:12 +00001259//===----------------------------------------------------------------------===//
1260
Evan Cheng96581d32008-11-11 02:11:05 +00001261//===----------------------------------------------------------------------===//
1262// ARM VFP Instruction templates.
1263//
1264
David Goodwin3ca524e2009-07-10 17:03:29 +00001265// Almost all VFP instructions are predicable.
1266class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001267 IndexMode im, Format f, InstrItinClass itin,
1268 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001269 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001270 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001271 let InOperandList = !con(iops, (ins pred:$p));
David Goodwin3ca524e2009-07-10 17:03:29 +00001272 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1273 let Pattern = pattern;
1274 list<Predicate> Predicates = [HasVFP2];
1275}
1276
1277// Special cases
1278class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001279 IndexMode im, Format f, InstrItinClass itin,
1280 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001281 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001282 let OutOperandList = oops;
1283 let InOperandList = iops;
1284 let AsmString = asm;
1285 let Pattern = pattern;
1286 list<Predicate> Predicates = [HasVFP2];
1287}
1288
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001289class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1290 string opc, string asm, list<dag> pattern>
1291 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1292 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001293
Evan Chengcd8e66a2008-11-11 21:48:44 +00001294// ARM VFP addrmode5 loads and stores
1295class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001296 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001297 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001298 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001299 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001300 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001301 let Inst{27-24} = opcod1;
1302 let Inst{21-20} = opcod2;
1303 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001304
1305 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1306 let Dom = VFPNeonDomain.Value;
Evan Cheng96581d32008-11-11 02:11:05 +00001307}
1308
Evan Chengcd8e66a2008-11-11 21:48:44 +00001309class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001310 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001311 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001312 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001313 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001314 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001315 let Inst{27-24} = opcod1;
1316 let Inst{21-20} = opcod2;
1317 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001318}
1319
Evan Chengcd8e66a2008-11-11 21:48:44 +00001320// Load / store multiple
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001321class AXDI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001322 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001323 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson815baeb2010-03-13 01:08:20 +00001324 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001325 // TODO: Mark the instructions with the appropriate subtarget info.
1326 let Inst{27-25} = 0b110;
1327 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001328
1329 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1330 let Dom = VFPNeonDomain.Value;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001331}
1332
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001333class AXSI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001334 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001335 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson815baeb2010-03-13 01:08:20 +00001336 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001337 // TODO: Mark the instructions with the appropriate subtarget info.
1338 let Inst{27-25} = 0b110;
1339 let Inst{11-8} = 0b1010;
1340}
1341
Evan Cheng96581d32008-11-11 02:11:05 +00001342// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001343class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1344 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1345 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001346 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001347 let Inst{27-23} = opcod1;
1348 let Inst{21-20} = opcod2;
1349 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001350 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001351 let Inst{7-6} = opcod4;
1352 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001353}
1354
1355// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001356class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1357 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001358 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001359 let Inst{27-23} = opcod1;
1360 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001361 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001362 let Inst{6} = op6;
1363 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001364}
1365
1366// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001367class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1368 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1369 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001370 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001371 let Inst{27-23} = opcod1;
1372 let Inst{21-20} = opcod2;
1373 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001374 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001375 let Inst{7-6} = opcod4;
1376 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001377}
1378
David Goodwin338268c2009-08-10 22:17:39 +00001379// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001380// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001381class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1382 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1383 string asm, list<dag> pattern>
1384 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1385 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001386 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1387}
1388
Evan Cheng96581d32008-11-11 02:11:05 +00001389// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001390class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1391 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001392 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001393 let Inst{27-23} = opcod1;
1394 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001395 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001396 let Inst{6} = op6;
1397 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001398}
1399
David Goodwin338268c2009-08-10 22:17:39 +00001400// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001401// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001402class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1403 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
1404 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001405 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1406}
1407
Evan Cheng80a11982008-11-12 06:41:41 +00001408// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001409class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1410 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1411 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001412 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001413 let Inst{27-23} = opcod1;
1414 let Inst{21-20} = opcod2;
1415 let Inst{19-16} = opcod3;
1416 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001417 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001418 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001419}
1420
Johnny Chen811663f2010-02-11 18:47:03 +00001421// VFP conversion between floating-point and fixed-point
1422class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1423 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1424 list<dag> pattern>
1425 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1426 // size (fixed-point number): sx == 0 ? 16 : 32
1427 let Inst{7} = op5; // sx
1428}
1429
David Goodwin338268c2009-08-10 22:17:39 +00001430// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001431class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001432 dag oops, dag iops, InstrItinClass itin,
1433 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001434 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1435 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001436 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1437}
1438
Evan Cheng80a11982008-11-12 06:41:41 +00001439class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001440 InstrItinClass itin,
1441 string opc, string asm, list<dag> pattern>
1442 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001443 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001444 let Inst{11-8} = opcod2;
1445 let Inst{4} = 1;
1446}
1447
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001448class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1449 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1450 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001451
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001452class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1453 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1454 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001455
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001456class AVConv4I<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, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001459
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001460class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1461 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1462 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001463
Evan Cheng96581d32008-11-11 02:11:05 +00001464//===----------------------------------------------------------------------===//
1465
Bob Wilson5bafff32009-06-22 23:27:02 +00001466//===----------------------------------------------------------------------===//
1467// ARM NEON Instruction templates.
1468//
Evan Cheng13096642008-08-29 06:41:12 +00001469
Johnny Chencaa608e2010-03-20 00:17:00 +00001470class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1471 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1472 list<dag> pattern>
1473 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001474 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001475 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001476 let AsmString = !strconcat(
1477 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1478 !strconcat("\t", asm));
1479 let Pattern = pattern;
1480 list<Predicate> Predicates = [HasNEON];
1481}
1482
1483// Same as NeonI except it does not have a "data type" specifier.
1484class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001485 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001486 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001487 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001488 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001489 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001490 let Pattern = pattern;
1491 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001492}
1493
Evan Chengac0869d2009-11-21 06:21:52 +00001494class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1495 list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001496 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
Evan Chengac0869d2009-11-21 06:21:52 +00001497 pattern> {
Evan Cheng13096642008-08-29 06:41:12 +00001498}
Bob Wilson5bafff32009-06-22 23:27:02 +00001499
Evan Chengf81bf152009-11-23 21:57:23 +00001500class NI4<dag oops, dag iops, InstrItinClass itin, string opc,
1501 string asm, list<dag> pattern>
1502 : NeonXI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "",
1503 pattern> {
Anton Korobeynikovbaf31082009-08-08 13:35:48 +00001504}
1505
Bob Wilsonb07c1712009-10-07 21:53:04 +00001506class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1507 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001508 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001509 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1510 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001511 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001512 let Inst{23} = op23;
1513 let Inst{21-20} = op21_20;
1514 let Inst{11-8} = op11_8;
1515 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001516}
1517
Johnny Chen785516a2010-03-23 16:43:47 +00001518class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001519 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001520 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1521 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001522 let Inst{31-25} = 0b1111001;
1523}
1524
1525class NDataXI<dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001526 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001527 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
Evan Chengac0869d2009-11-21 06:21:52 +00001528 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001529 let Inst{31-25} = 0b1111001;
1530}
1531
1532// NEON "one register and a modified immediate" format.
1533class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1534 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001535 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001536 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001537 : NDataI<oops, iops, NVdImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001538 let Inst{23} = op23;
1539 let Inst{21-19} = op21_19;
1540 let Inst{11-8} = op11_8;
1541 let Inst{7} = op7;
1542 let Inst{6} = op6;
1543 let Inst{5} = op5;
1544 let Inst{4} = op4;
1545}
1546
1547// NEON 2 vector register format.
1548class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1549 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001550 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001551 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001552 : NDataI<oops, iops, NEONFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001553 let Inst{24-23} = op24_23;
1554 let Inst{21-20} = op21_20;
1555 let Inst{19-18} = op19_18;
1556 let Inst{17-16} = op17_16;
1557 let Inst{11-7} = op11_7;
1558 let Inst{6} = op6;
1559 let Inst{4} = op4;
1560}
1561
1562// Same as N2V except it doesn't have a datatype suffix.
1563class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1564 bits<5> op11_7, bit op6, bit op4,
1565 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001566 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001567 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001568 let Inst{24-23} = op24_23;
1569 let Inst{21-20} = op21_20;
1570 let Inst{19-18} = op19_18;
1571 let Inst{17-16} = op17_16;
1572 let Inst{11-7} = op11_7;
1573 let Inst{6} = op6;
1574 let Inst{4} = op4;
1575}
1576
1577// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001578class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001579 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001580 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001581 : NDataI<oops, iops, NEONFrm, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001582 let Inst{24} = op24;
1583 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001584 let Inst{11-8} = op11_8;
1585 let Inst{7} = op7;
1586 let Inst{6} = op6;
1587 let Inst{4} = op4;
1588}
1589
1590// NEON 3 vector register format.
1591class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001592 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001593 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001594 : NDataI<oops, iops, NEONFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001595 let Inst{24} = op24;
1596 let Inst{23} = op23;
1597 let Inst{21-20} = op21_20;
1598 let Inst{11-8} = op11_8;
1599 let Inst{6} = op6;
1600 let Inst{4} = op4;
1601}
1602
1603// Same as N3VX except it doesn't have a data type suffix.
1604class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1605 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001606 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001607 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001608 let Inst{24} = op24;
1609 let Inst{23} = op23;
1610 let Inst{21-20} = op21_20;
1611 let Inst{11-8} = op11_8;
1612 let Inst{6} = op6;
1613 let Inst{4} = op4;
1614}
1615
1616// NEON VMOVs between scalar and core registers.
1617class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001618 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001619 string opc, string dt, string asm, list<dag> pattern>
1620 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
1621 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001622 let Inst{27-20} = opcod1;
1623 let Inst{11-8} = opcod2;
1624 let Inst{6-5} = opcod3;
1625 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001626
1627 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001628 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001629 let AsmString = !strconcat(
1630 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1631 !strconcat("\t", asm));
1632 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001633 list<Predicate> Predicates = [HasNEON];
1634}
1635class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001636 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001637 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001638 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001639 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001640class NVSetLane<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, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001644 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001645class NVDup<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, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001649 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001650
1651// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1652// for single-precision FP.
1653class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1654 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1655}