blob: 52553f5477dbee495d7ec72bc1f646ccd560e8bc [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.
18class Format<bits<5> val> {
19 bits<5> Value = val;
20}
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
Jim Grosbach5278eb82009-12-11 01:42:04 +000036def LdStExFrm : Format<28>;
37
Evan Chengffa6d962008-11-13 23:36:57 +000038def ArithMiscFrm : Format<11>;
39def ExtFrm : Format<12>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000040
Evan Chengffa6d962008-11-13 23:36:57 +000041def VFPUnaryFrm : Format<13>;
42def VFPBinaryFrm : Format<14>;
43def VFPConv1Frm : Format<15>;
44def VFPConv2Frm : Format<16>;
45def VFPConv3Frm : Format<17>;
46def VFPConv4Frm : Format<18>;
47def VFPConv5Frm : Format<19>;
48def VFPLdStFrm : Format<20>;
49def VFPLdStMulFrm : Format<21>;
50def VFPMiscFrm : Format<22>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000051
Evan Chengffa6d962008-11-13 23:36:57 +000052def ThumbFrm : Format<23>;
Evan Cheng37f25d92008-08-28 23:39:26 +000053
Bob Wilson5bafff32009-06-22 23:27:02 +000054def NEONFrm : Format<24>;
55def NEONGetLnFrm : Format<25>;
56def NEONSetLnFrm : Format<26>;
57def NEONDupFrm : Format<27>;
58
Johnny Chenf4d81052010-02-12 22:53:19 +000059def MiscFrm : Format<29>;
60def ThumbMiscFrm : Format<30>;
61
Evan Cheng34a0fa32009-07-08 01:46:35 +000062// Misc flags.
63
Evan Chengedda31c2008-11-05 18:35:52 +000064// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000065// UnaryDP - Indicates this is a unary data processing instruction, i.e.
66// it doesn't have a Rn operand.
67class UnaryDP { bit isUnaryDataProc = 1; }
68
69// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
70// a 16-bit Thumb instruction if certain conditions are met.
71class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000072
Evan Cheng37f25d92008-08-28 23:39:26 +000073//===----------------------------------------------------------------------===//
Evan Cheng055b0312009-06-29 07:51:04 +000074// ARM Instruction flags. These need to match ARMInstrInfo.h.
75//
76
77// Addressing mode.
78class AddrMode<bits<4> val> {
79 bits<4> Value = val;
80}
81def AddrModeNone : AddrMode<0>;
82def AddrMode1 : AddrMode<1>;
83def AddrMode2 : AddrMode<2>;
84def AddrMode3 : AddrMode<3>;
85def AddrMode4 : AddrMode<4>;
86def AddrMode5 : AddrMode<5>;
Bob Wilson8b024a52009-07-01 23:16:05 +000087def AddrMode6 : AddrMode<6>;
88def AddrModeT1_1 : AddrMode<7>;
89def AddrModeT1_2 : AddrMode<8>;
90def AddrModeT1_4 : AddrMode<9>;
91def AddrModeT1_s : AddrMode<10>;
David Goodwine1e52ed2009-07-22 22:24:31 +000092def AddrModeT2_i12: AddrMode<11>;
Bob Wilson8b024a52009-07-01 23:16:05 +000093def AddrModeT2_i8 : AddrMode<12>;
94def AddrModeT2_so : AddrMode<13>;
95def AddrModeT2_pc : AddrMode<14>;
96def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng055b0312009-06-29 07:51:04 +000097
98// Instruction size.
99class SizeFlagVal<bits<3> val> {
100 bits<3> Value = val;
101}
102def SizeInvalid : SizeFlagVal<0>; // Unset.
103def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
104def Size8Bytes : SizeFlagVal<2>;
105def Size4Bytes : SizeFlagVal<3>;
106def Size2Bytes : SizeFlagVal<4>;
107
108// Load / store index mode.
109class IndexMode<bits<2> val> {
110 bits<2> Value = val;
111}
112def IndexModeNone : IndexMode<0>;
113def IndexModePre : IndexMode<1>;
114def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000115def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000116
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000117// Instruction execution domain.
118class Domain<bits<2> val> {
119 bits<2> Value = val;
120}
121def GenericDomain : Domain<0>;
122def VFPDomain : Domain<1>; // Instructions in VFP domain only
123def NeonDomain : Domain<2>; // Instructions in Neon domain only
124def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
125
Evan Cheng055b0312009-06-29 07:51:04 +0000126//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000127
Evan Cheng446c4282009-07-11 06:43:01 +0000128// ARM special operands.
129//
130
131// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
132// register whose default is 0 (no register).
133def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
134 (ops (i32 14), (i32 zero_reg))> {
135 let PrintMethod = "printPredicateOperand";
136}
137
138// Conditional code result for instructions whose 's' bit is set, e.g. subs.
139def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
140 let PrintMethod = "printSBitModifierOperand";
141}
142
143// Same as cc_out except it defaults to setting CPSR.
144def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
145 let PrintMethod = "printSBitModifierOperand";
146}
147
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000148// ARM special operands for disassembly only.
149//
150
151def cps_opt : Operand<i32> {
152 let PrintMethod = "printCPSOptionOperand";
153}
154
155def msr_mask : Operand<i32> {
156 let PrintMethod = "printMSRMaskOperand";
157}
158
159// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
160// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
161def neg_zero : Operand<i32> {
162 let PrintMethod = "printNegZeroOperand";
163}
164
Evan Cheng446c4282009-07-11 06:43:01 +0000165//===----------------------------------------------------------------------===//
166
Evan Cheng37f25d92008-08-28 23:39:26 +0000167// ARM Instruction templates.
168//
169
Johnny Chend68e1192009-12-15 17:24:14 +0000170class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
171 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000172 : Instruction {
173 let Namespace = "ARM";
174
Evan Chengedda31c2008-11-05 18:35:52 +0000175 // TSFlagsFields
Evan Cheng37f25d92008-08-28 23:39:26 +0000176 AddrMode AM = am;
177 bits<4> AddrModeBits = AM.Value;
178
179 SizeFlagVal SZ = sz;
180 bits<3> SizeFlag = SZ.Value;
181
182 IndexMode IM = im;
183 bits<2> IndexModeBits = IM.Value;
184
185 Format F = f;
186 bits<5> Form = F.Value;
Evan Chengedda31c2008-11-05 18:35:52 +0000187
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000188 Domain D = d;
189 bits<2> Dom = D.Value;
190
Evan Chengedda31c2008-11-05 18:35:52 +0000191 //
192 // Attributes specific to ARM instructions...
193 //
194 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000195 bit canXformTo16Bit = 0;
Evan Cheng37f25d92008-08-28 23:39:26 +0000196
197 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000198 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000199}
200
Johnny Chend68e1192009-12-15 17:24:14 +0000201class Encoding {
202 field bits<32> Inst;
203}
204
205class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
206 Format f, Domain d, string cstr, InstrItinClass itin>
207 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
208
209// This Encoding-less class is used by Thumb1 to specify the encoding bits later
210// on by adding flavors to specific instructions.
211class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
212 Format f, Domain d, string cstr, InstrItinClass itin>
213 : InstTemplate<am, sz, im, f, d, cstr, itin>;
214
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000215class PseudoInst<dag oops, dag iops, InstrItinClass itin,
216 string asm, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000217 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
218 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000219 let OutOperandList = oops;
220 let InOperandList = iops;
221 let AsmString = asm;
222 let Pattern = pattern;
223}
224
225// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000226class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000227 IndexMode im, Format f, InstrItinClass itin,
228 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000229 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000230 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000231 let OutOperandList = oops;
232 let InOperandList = !con(iops, (ops pred:$p));
233 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
234 let Pattern = pattern;
235 list<Predicate> Predicates = [IsARM];
236}
Jim Grosbachf6b28622009-12-14 18:31:20 +0000237// A few are not predicable
238class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
239 IndexMode im, Format f, InstrItinClass itin,
240 string opc, string asm, string cstr,
241 list<dag> pattern>
242 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
243 let OutOperandList = oops;
244 let InOperandList = iops;
245 let AsmString = !strconcat(opc, asm);
246 let Pattern = pattern;
247 let isPredicable = 0;
248 list<Predicate> Predicates = [IsARM];
249}
Evan Cheng37f25d92008-08-28 23:39:26 +0000250
251// Same as I except it can optionally modify CPSR. Note it's modeled as
252// an input operand since by default it's a zero register. It will
253// become an implicit def once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000254class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000255 IndexMode im, Format f, InstrItinClass itin,
256 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000257 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000258 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000259 let OutOperandList = oops;
260 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
261 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
262 let Pattern = pattern;
263 list<Predicate> Predicates = [IsARM];
264}
265
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000266// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000267class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000268 IndexMode im, Format f, InstrItinClass itin,
269 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000270 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000271 let OutOperandList = oops;
272 let InOperandList = iops;
273 let AsmString = asm;
274 let Pattern = pattern;
275 list<Predicate> Predicates = [IsARM];
276}
277
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000278class AI<dag oops, dag iops, Format f, InstrItinClass itin,
279 string opc, string asm, list<dag> pattern>
280 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
281 opc, asm, "", pattern>;
282class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
283 string opc, string asm, list<dag> pattern>
284 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
285 opc, asm, "", pattern>;
286class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000287 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000288 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000289 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000290class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
291 string opc, string asm, list<dag> pattern>
292 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
293 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000294
295// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000296class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
297 string opc, string asm, list<dag> pattern>
298 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
299 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000300 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000301}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000302class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
303 string asm, list<dag> pattern>
304 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
305 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000306 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000307}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000308class ABXIx2<dag oops, dag iops, InstrItinClass itin,
309 string asm, list<dag> pattern>
310 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
311 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000312
313// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000314class JTI<dag oops, dag iops, InstrItinClass itin,
315 string asm, list<dag> pattern>
316 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000317 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000318
Jim Grosbach5278eb82009-12-11 01:42:04 +0000319
320// Atomic load/store instructions
321
322class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
323 string opc, string asm, list<dag> pattern>
324 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
325 opc, asm, "", pattern> {
326 let Inst{27-23} = 0b00011;
327 let Inst{22-21} = opcod;
328 let Inst{20} = 1;
329 let Inst{11-0} = 0b111110011111;
330}
331class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
332 string opc, string asm, list<dag> pattern>
333 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
334 opc, asm, "", pattern> {
335 let Inst{27-23} = 0b00011;
336 let Inst{22-21} = opcod;
337 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000338 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000339}
340
Evan Cheng0d14fc82008-09-01 01:51:14 +0000341// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000342class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
343 string opc, string asm, list<dag> pattern>
344 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
345 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000346 let Inst{24-21} = opcod;
347 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000348}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000349class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
350 string opc, string asm, list<dag> pattern>
351 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
352 opc, asm, "", pattern> {
353 let Inst{24-21} = opcod;
354 let Inst{27-26} = {0,0};
355}
356class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000357 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000358 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000359 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000360 let Inst{24-21} = opcod;
361 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000362}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000363class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
364 string opc, string asm, list<dag> pattern>
365 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
366 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000367
Evan Cheng0d14fc82008-09-01 01:51:14 +0000368
369// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000370class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
371 string opc, string asm, list<dag> pattern>
372 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
373 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000374 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000375}
Evan Cheng93912732008-09-01 01:27:33 +0000376
377// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000378class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
379 string opc, string asm, list<dag> pattern>
380 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
381 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000382 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000383 let Inst{21} = 0; // W bit
384 let Inst{22} = 0; // B bit
385 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000386 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000387}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000388class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
389 string asm, list<dag> pattern>
390 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000391 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000392 let Inst{20} = 1; // L bit
393 let Inst{21} = 0; // W bit
394 let Inst{22} = 0; // B bit
395 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000396 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000397}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000398class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
399 string opc, string asm, list<dag> pattern>
400 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
401 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000402 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000403 let Inst{21} = 0; // W bit
404 let Inst{22} = 1; // B bit
405 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000406 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000407}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000408class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
409 string asm, list<dag> pattern>
410 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000411 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000412 let Inst{20} = 1; // L bit
413 let Inst{21} = 0; // W bit
414 let Inst{22} = 1; // B bit
415 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000416 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000417}
Evan Cheng17222df2008-08-31 19:02:21 +0000418
Evan Cheng93912732008-09-01 01:27:33 +0000419// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000420class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
421 string opc, string asm, list<dag> pattern>
422 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
423 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000424 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000425 let Inst{21} = 0; // W bit
426 let Inst{22} = 0; // B bit
427 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000428 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000429}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000430class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
431 string asm, list<dag> pattern>
432 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000433 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000434 let Inst{20} = 0; // L bit
435 let Inst{21} = 0; // W bit
436 let Inst{22} = 0; // B bit
437 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000438 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000439}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000440class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
441 string opc, string asm, list<dag> pattern>
442 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
443 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000444 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000445 let Inst{21} = 0; // W bit
446 let Inst{22} = 1; // B bit
447 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000448 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000449}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000450class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
451 string asm, list<dag> pattern>
452 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000453 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000454 let Inst{20} = 0; // L bit
455 let Inst{21} = 0; // W bit
456 let Inst{22} = 1; // B bit
457 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000458 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000459}
Evan Cheng93912732008-09-01 01:27:33 +0000460
Evan Cheng840917b2008-09-01 07:00:14 +0000461// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000462class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
463 string opc, string asm, string cstr, list<dag> pattern>
464 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
465 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000466 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000467 let Inst{21} = 1; // W bit
468 let Inst{22} = 0; // B bit
469 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000470 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000471}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000472class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
473 string opc, string asm, string cstr, list<dag> pattern>
474 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
475 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000476 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000477 let Inst{21} = 1; // W bit
478 let Inst{22} = 1; // B bit
479 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000480 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000481}
482
Evan Cheng840917b2008-09-01 07:00:14 +0000483// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000484class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
485 string opc, string asm, string cstr, list<dag> pattern>
486 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
487 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000488 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000489 let Inst{21} = 1; // W bit
490 let Inst{22} = 0; // B bit
491 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000492 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000493}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000494class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
495 string opc, string asm, string cstr, list<dag> pattern>
496 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
497 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000498 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000499 let Inst{21} = 1; // W bit
500 let Inst{22} = 1; // B bit
501 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000502 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000503}
504
Evan Cheng840917b2008-09-01 07:00:14 +0000505// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000506class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
507 string opc, string asm, string cstr, list<dag> pattern>
508 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
509 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000510 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000511 let Inst{21} = 0; // W bit
512 let Inst{22} = 0; // B bit
513 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000514 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000515}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000516class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
517 string opc, string asm, string cstr, list<dag> pattern>
518 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
519 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000520 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000521 let Inst{21} = 0; // W bit
522 let Inst{22} = 1; // B bit
523 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000524 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000525}
526
Evan Cheng840917b2008-09-01 07:00:14 +0000527// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000528class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
529 string opc, string asm, string cstr, list<dag> pattern>
530 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
531 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000532 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000533 let Inst{21} = 0; // W bit
534 let Inst{22} = 0; // B bit
535 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000536 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000537}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000538class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
539 string opc, string asm, string cstr, list<dag> pattern>
540 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
541 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000542 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000543 let Inst{21} = 0; // W bit
544 let Inst{22} = 1; // B bit
545 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000546 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000547}
548
Evan Cheng0d14fc82008-09-01 01:51:14 +0000549// addrmode3 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000550class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
551 string opc, string asm, list<dag> pattern>
552 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
553 opc, asm, "", pattern>;
554class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
555 string asm, list<dag> pattern>
556 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
557 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000558
Evan Cheng840917b2008-09-01 07:00:14 +0000559// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000560class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
561 string opc, string asm, list<dag> pattern>
562 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
563 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000564 let Inst{4} = 1;
565 let Inst{5} = 1; // H bit
566 let Inst{6} = 0; // S bit
567 let Inst{7} = 1;
568 let Inst{20} = 1; // L bit
569 let Inst{21} = 0; // W bit
570 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000571 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000572}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000573class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
574 string asm, list<dag> pattern>
575 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000576 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000577 let Inst{4} = 1;
578 let Inst{5} = 1; // H bit
579 let Inst{6} = 0; // S bit
580 let Inst{7} = 1;
581 let Inst{20} = 1; // L bit
582 let Inst{21} = 0; // W bit
583 let Inst{24} = 1; // P bit
584}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000585class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
586 string opc, string asm, list<dag> pattern>
587 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
588 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000589 let Inst{4} = 1;
590 let Inst{5} = 1; // H bit
591 let Inst{6} = 1; // S bit
592 let Inst{7} = 1;
593 let Inst{20} = 1; // L bit
594 let Inst{21} = 0; // W bit
595 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000596 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000597}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000598class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
599 string asm, list<dag> pattern>
600 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000601 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000602 let Inst{4} = 1;
603 let Inst{5} = 1; // H bit
604 let Inst{6} = 1; // S bit
605 let Inst{7} = 1;
606 let Inst{20} = 1; // L bit
607 let Inst{21} = 0; // W bit
608 let Inst{24} = 1; // P bit
609}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000610class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
611 string opc, string asm, list<dag> pattern>
612 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
613 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000614 let Inst{4} = 1;
615 let Inst{5} = 0; // H bit
616 let Inst{6} = 1; // S bit
617 let Inst{7} = 1;
618 let Inst{20} = 1; // L bit
619 let Inst{21} = 0; // W bit
620 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000621 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000622}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000623class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
624 string asm, list<dag> pattern>
625 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000626 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000627 let Inst{4} = 1;
628 let Inst{5} = 0; // H bit
629 let Inst{6} = 1; // S bit
630 let Inst{7} = 1;
631 let Inst{20} = 1; // L bit
632 let Inst{21} = 0; // W bit
633 let Inst{24} = 1; // P bit
634}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000635class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
636 string opc, string asm, list<dag> pattern>
637 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
638 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000639 let Inst{4} = 1;
640 let Inst{5} = 0; // H bit
641 let Inst{6} = 1; // S bit
642 let Inst{7} = 1;
643 let Inst{20} = 0; // L bit
644 let Inst{21} = 0; // W bit
645 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000646 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000647}
648
649// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000650class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
651 string opc, string asm, list<dag> pattern>
652 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
653 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000654 let Inst{4} = 1;
655 let Inst{5} = 1; // H bit
656 let Inst{6} = 0; // S bit
657 let Inst{7} = 1;
658 let Inst{20} = 0; // L bit
659 let Inst{21} = 0; // W bit
660 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000661 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000662}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000663class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
664 string asm, list<dag> pattern>
665 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000666 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000667 let Inst{4} = 1;
668 let Inst{5} = 1; // H bit
669 let Inst{6} = 0; // S bit
670 let Inst{7} = 1;
671 let Inst{20} = 0; // L bit
672 let Inst{21} = 0; // W bit
673 let Inst{24} = 1; // P bit
674}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000675class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
676 string opc, string asm, list<dag> pattern>
677 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
678 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000679 let Inst{4} = 1;
680 let Inst{5} = 1; // H bit
681 let Inst{6} = 1; // S bit
682 let Inst{7} = 1;
683 let Inst{20} = 0; // L bit
684 let Inst{21} = 0; // W bit
685 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000686 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000687}
688
689// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000690class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
691 string opc, string asm, string cstr, list<dag> pattern>
692 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
693 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000694 let Inst{4} = 1;
695 let Inst{5} = 1; // H bit
696 let Inst{6} = 0; // S bit
697 let Inst{7} = 1;
698 let Inst{20} = 1; // L bit
699 let Inst{21} = 1; // W bit
700 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000701 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000702}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000703class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
704 string opc, string asm, string cstr, list<dag> pattern>
705 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
706 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000707 let Inst{4} = 1;
708 let Inst{5} = 1; // H bit
709 let Inst{6} = 1; // S bit
710 let Inst{7} = 1;
711 let Inst{20} = 1; // L bit
712 let Inst{21} = 1; // W bit
713 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000714 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000715}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000716class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
717 string opc, string asm, string cstr, list<dag> pattern>
718 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
719 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000720 let Inst{4} = 1;
721 let Inst{5} = 0; // H bit
722 let Inst{6} = 1; // S bit
723 let Inst{7} = 1;
724 let Inst{20} = 1; // L bit
725 let Inst{21} = 1; // W bit
726 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000727 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000728}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000729class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
730 string opc, string asm, string cstr, list<dag> pattern>
731 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
732 opc, asm, cstr, pattern> {
733 let Inst{4} = 1;
734 let Inst{5} = 0; // H bit
735 let Inst{6} = 1; // S bit
736 let Inst{7} = 1;
737 let Inst{20} = 0; // L bit
738 let Inst{21} = 1; // W bit
739 let Inst{24} = 1; // P bit
740 let Inst{27-25} = 0b000;
741}
742
Evan Cheng840917b2008-09-01 07:00:14 +0000743
744// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000745class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
746 string opc, string asm, string cstr, list<dag> pattern>
747 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
748 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000749 let Inst{4} = 1;
750 let Inst{5} = 1; // H bit
751 let Inst{6} = 0; // S bit
752 let Inst{7} = 1;
753 let Inst{20} = 0; // L bit
754 let Inst{21} = 1; // W bit
755 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000756 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000757}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000758class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
759 string opc, string asm, string cstr, list<dag> pattern>
760 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
761 opc, asm, cstr, pattern> {
762 let Inst{4} = 1;
763 let Inst{5} = 1; // H bit
764 let Inst{6} = 1; // S bit
765 let Inst{7} = 1;
766 let Inst{20} = 0; // L bit
767 let Inst{21} = 1; // W bit
768 let Inst{24} = 1; // P bit
769 let Inst{27-25} = 0b000;
770}
Evan Cheng840917b2008-09-01 07:00:14 +0000771
772// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000773class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
774 string opc, string asm, string cstr, list<dag> pattern>
775 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
776 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000777 let Inst{4} = 1;
778 let Inst{5} = 1; // H bit
779 let Inst{6} = 0; // S bit
780 let Inst{7} = 1;
781 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000782 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000783 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000784 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000785}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000786class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
787 string opc, string asm, string cstr, list<dag> pattern>
788 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
789 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000790 let Inst{4} = 1;
791 let Inst{5} = 1; // H bit
792 let Inst{6} = 1; // S bit
793 let Inst{7} = 1;
794 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000795 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000796 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000797 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000798}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000799class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
800 string opc, string asm, string cstr, list<dag> pattern>
801 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
802 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000803 let Inst{4} = 1;
804 let Inst{5} = 0; // H bit
805 let Inst{6} = 1; // S bit
806 let Inst{7} = 1;
807 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000808 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000809 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000810 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000811}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000812class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
813 string opc, string asm, string cstr, list<dag> pattern>
814 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
815 opc, asm, cstr, pattern> {
816 let Inst{4} = 1;
817 let Inst{5} = 0; // H bit
818 let Inst{6} = 1; // S bit
819 let Inst{7} = 1;
820 let Inst{20} = 0; // L bit
821 let Inst{21} = 0; // W bit
822 let Inst{24} = 0; // P bit
823 let Inst{27-25} = 0b000;
824}
Evan Cheng840917b2008-09-01 07:00:14 +0000825
826// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000827class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
828 string opc, string asm, string cstr, list<dag> pattern>
829 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
830 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000831 let Inst{4} = 1;
832 let Inst{5} = 1; // H bit
833 let Inst{6} = 0; // S bit
834 let Inst{7} = 1;
835 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000836 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000837 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000838 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000839}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000840class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
841 string opc, string asm, string cstr, list<dag> pattern>
842 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
843 opc, asm, cstr, pattern> {
844 let Inst{4} = 1;
845 let Inst{5} = 1; // H bit
846 let Inst{6} = 1; // S bit
847 let Inst{7} = 1;
848 let Inst{20} = 0; // L bit
849 let Inst{21} = 0; // W bit
850 let Inst{24} = 0; // P bit
851 let Inst{27-25} = 0b000;
852}
Evan Cheng840917b2008-09-01 07:00:14 +0000853
854
Evan Cheng0d14fc82008-09-01 01:51:14 +0000855// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000856class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000857 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000858 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000859 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000860 let Inst{20} = 1; // L bit
861 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000862 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000863}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000864class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000865 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000866 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000867 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000868 let Inst{20} = 0; // L bit
869 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000870 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000871}
Evan Cheng37f25d92008-08-28 23:39:26 +0000872
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000873// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000874class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
875 string opc, string asm, list<dag> pattern>
876 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
877 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000878 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000879 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000880 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000881}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000882class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
883 string opc, string asm, list<dag> pattern>
884 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
885 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000886 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000887 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000888}
889
890// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000891class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
892 string opc, string asm, list<dag> pattern>
893 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
894 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000895 let Inst{7-4} = 0b1001;
896 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000897 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000898}
Evan Cheng37f25d92008-08-28 23:39:26 +0000899
Evan Chengeb4f52e2008-11-06 03:35:07 +0000900// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000901class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
902 string opc, string asm, list<dag> pattern>
903 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
904 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000905 let Inst{4} = 0;
906 let Inst{7} = 1;
907 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000908 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000909}
910
Evan Cheng97f48c32008-11-06 22:15:19 +0000911// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000912class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
913 string opc, string asm, list<dag> pattern>
914 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
915 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000916 let Inst{7-4} = 0b0111;
917 let Inst{27-20} = opcod;
918}
919
Evan Cheng8b59db32008-11-07 01:41:35 +0000920// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000921class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
922 string opc, string asm, list<dag> pattern>
923 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
924 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000925 let Inst{27-20} = opcod;
926}
927
Evan Cheng37f25d92008-08-28 23:39:26 +0000928//===----------------------------------------------------------------------===//
929
930// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
931class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
932 list<Predicate> Predicates = [IsARM];
933}
934class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
935 list<Predicate> Predicates = [IsARM, HasV5TE];
936}
937class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
938 list<Predicate> Predicates = [IsARM, HasV6];
939}
Evan Cheng13096642008-08-29 06:41:12 +0000940
941//===----------------------------------------------------------------------===//
942//
943// Thumb Instruction Format Definitions.
944//
945
Evan Cheng13096642008-08-29 06:41:12 +0000946// TI - Thumb instruction.
947
Evan Cheng446c4282009-07-11 06:43:01 +0000948class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000949 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000950 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000951 let OutOperandList = oops;
952 let InOperandList = iops;
Evan Cheng13096642008-08-29 06:41:12 +0000953 let AsmString = asm;
954 let Pattern = pattern;
955 list<Predicate> Predicates = [IsThumb];
956}
957
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000958class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
959 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000960
Evan Cheng35d6c412009-08-04 23:47:55 +0000961// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000962class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
963 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000964
Johnny Chend68e1192009-12-15 17:24:14 +0000965// tBL, tBX 32-bit instructions
966class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
967 dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
968 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>, Encoding {
969 let Inst{31-27} = opcod1;
970 let Inst{15-14} = opcod2;
971 let Inst{12} = opcod3;
972}
Evan Cheng13096642008-08-29 06:41:12 +0000973
974// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000975class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
976 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000977
Evan Cheng09c39fc2009-06-23 19:38:13 +0000978// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000979class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000980 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000981 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000982 let OutOperandList = oops;
983 let InOperandList = iops;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000984 let AsmString = asm;
985 let Pattern = pattern;
986 list<Predicate> Predicates = [IsThumb1Only];
987}
988
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000989class T1I<dag oops, dag iops, InstrItinClass itin,
990 string asm, list<dag> pattern>
991 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
992class T1Ix2<dag oops, dag iops, InstrItinClass itin,
993 string asm, list<dag> pattern>
994 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
995class T1JTI<dag oops, dag iops, InstrItinClass itin,
996 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +0000997 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000998
999// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001000class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001001 string asm, string cstr, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001002 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001003 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001004
1005// Thumb1 instruction that can either be predicated or set CPSR.
1006class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001007 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001008 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001009 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001010 let OutOperandList = !con(oops, (ops s_cc_out:$s));
1011 let InOperandList = !con(iops, (ops pred:$p));
1012 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1013 let Pattern = pattern;
1014 list<Predicate> Predicates = [IsThumb1Only];
1015}
1016
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001017class T1sI<dag oops, dag iops, InstrItinClass itin,
1018 string opc, string asm, list<dag> pattern>
1019 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001020
1021// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001022class T1sIt<dag oops, dag iops, InstrItinClass itin,
1023 string opc, string asm, list<dag> pattern>
1024 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001025 "$lhs = $dst", pattern>;
1026
1027// Thumb1 instruction that can be predicated.
1028class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001029 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001030 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001031 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001032 let OutOperandList = oops;
1033 let InOperandList = !con(iops, (ops pred:$p));
1034 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1035 let Pattern = pattern;
1036 list<Predicate> Predicates = [IsThumb1Only];
1037}
1038
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001039class T1pI<dag oops, dag iops, InstrItinClass itin,
1040 string opc, string asm, list<dag> pattern>
1041 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001042
1043// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001044class T1pIt<dag oops, dag iops, InstrItinClass itin,
1045 string opc, string asm, list<dag> pattern>
1046 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001047 "$lhs = $dst", pattern>;
1048
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001049class T1pI1<dag oops, dag iops, InstrItinClass itin,
1050 string opc, string asm, list<dag> pattern>
1051 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1052class T1pI2<dag oops, dag iops, InstrItinClass itin,
1053 string opc, string asm, list<dag> pattern>
1054 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1055class T1pI4<dag oops, dag iops, InstrItinClass itin,
1056 string opc, string asm, list<dag> pattern>
1057 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1058class T1pIs<dag oops, dag iops,
1059 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1060 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001061
Johnny Chenbbc71b22009-12-16 02:32:54 +00001062class Encoding16 : Encoding {
1063 let Inst{31-16} = 0x0000;
1064}
1065
Johnny Chend68e1192009-12-15 17:24:14 +00001066// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001067class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001068 let Inst{15-10} = opcode;
1069}
1070
1071// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001072class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001073 let Inst{15-14} = 0b00;
1074 let Inst{13-9} = opcode;
1075}
1076
1077// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001078class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001079 let Inst{15-10} = 0b010000;
1080 let Inst{9-6} = opcode;
1081}
1082
1083// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001084class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001085 let Inst{15-10} = 0b010001;
1086 let Inst{9-6} = opcode;
1087}
1088
1089// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001090class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001091 let Inst{15-12} = opA;
1092 let Inst{11-9} = opB;
1093}
1094class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1095class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1096class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1097class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1098class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1099
1100// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001101class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001102 let Inst{15-12} = 0b1011;
1103 let Inst{11-5} = opcode;
1104}
1105
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001106// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1107class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001108 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001109 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001110 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001111 let OutOperandList = oops;
1112 let InOperandList = !con(iops, (ops pred:$p));
1113 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1114 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001115 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001116}
1117
1118// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1119// an input operand since by default it's a zero register. It will
1120// become an implicit def once it's "flipped".
1121// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1122// more consistent.
1123class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001124 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001125 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001126 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001127 let OutOperandList = oops;
1128 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
1129 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1130 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001131 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001132}
1133
1134// Special cases
1135class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001136 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001137 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001138 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001139 let OutOperandList = oops;
1140 let InOperandList = iops;
Evan Chengf49810c2009-06-23 17:48:47 +00001141 let AsmString = asm;
1142 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001143 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001144}
1145
Jim Grosbachd1228742009-12-01 18:10:36 +00001146class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1147 InstrItinClass itin,
1148 string asm, string cstr, list<dag> pattern>
1149 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1150 let OutOperandList = oops;
1151 let InOperandList = iops;
1152 let AsmString = asm;
1153 let Pattern = pattern;
1154 list<Predicate> Predicates = [IsThumb1Only];
1155}
1156
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001157class T2I<dag oops, dag iops, InstrItinClass itin,
1158 string opc, string asm, list<dag> pattern>
1159 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1160class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1161 string opc, string asm, list<dag> pattern>
1162 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
1163class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1164 string opc, string asm, list<dag> pattern>
1165 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1166class T2Iso<dag oops, dag iops, InstrItinClass itin,
1167 string opc, string asm, list<dag> pattern>
1168 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1169class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1170 string opc, string asm, list<dag> pattern>
1171 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001172class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001173 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001174 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1175 pattern> {
1176 let Inst{31-27} = 0b11101;
1177 let Inst{26-25} = 0b00;
1178 let Inst{24} = P;
1179 let Inst{23} = ?; // The U bit.
1180 let Inst{22} = 1;
1181 let Inst{21} = W;
1182 let Inst{20} = load;
1183}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001184
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001185class T2sI<dag oops, dag iops, InstrItinClass itin,
1186 string opc, string asm, list<dag> pattern>
1187 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001188
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001189class T2XI<dag oops, dag iops, InstrItinClass itin,
1190 string asm, list<dag> pattern>
1191 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1192class T2JTI<dag oops, dag iops, InstrItinClass itin,
1193 string asm, list<dag> pattern>
1194 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001195
Evan Cheng5adb66a2009-09-28 09:14:39 +00001196class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1197 string opc, string asm, list<dag> pattern>
1198 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1199
Bob Wilson815baeb2010-03-13 01:08:20 +00001200// Two-address instructions
1201class T2XIt<dag oops, dag iops, InstrItinClass itin,
1202 string asm, string cstr, list<dag> pattern>
1203 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001204
Evan Chenge88d5ce2009-07-02 07:28:31 +00001205// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001206class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1207 dag oops, dag iops,
1208 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001209 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001210 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001211 let OutOperandList = oops;
1212 let InOperandList = !con(iops, (ops pred:$p));
1213 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1214 let Pattern = pattern;
1215 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001216 let Inst{31-27} = 0b11111;
1217 let Inst{26-25} = 0b00;
1218 let Inst{24} = signed;
1219 let Inst{23} = 0;
1220 let Inst{22-21} = opcod;
1221 let Inst{20} = load;
1222 let Inst{11} = 1;
1223 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1224 let Inst{10} = pre; // The P bit.
1225 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001226}
1227
Johnny Chenadc77332010-02-26 22:04:29 +00001228// Helper class for disassembly only
1229// A6.3.16 & A6.3.17
1230// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1231class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1232 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1233 : T2I<oops, iops, itin, opc, asm, pattern> {
1234 let Inst{31-27} = 0b11111;
1235 let Inst{26-24} = 0b011;
1236 let Inst{23} = long;
1237 let Inst{22-20} = op22_20;
1238 let Inst{7-4} = op7_4;
1239}
1240
David Goodwinc9d138f2009-07-27 19:59:26 +00001241// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1242class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1243 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1244}
1245
1246// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1247class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1248 list<Predicate> Predicates = [IsThumb1Only];
1249}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001250
Evan Cheng9cb9e672009-06-27 02:26:13 +00001251// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1252class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001253 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001254}
1255
Evan Cheng13096642008-08-29 06:41:12 +00001256//===----------------------------------------------------------------------===//
1257
Evan Cheng96581d32008-11-11 02:11:05 +00001258//===----------------------------------------------------------------------===//
1259// ARM VFP Instruction templates.
1260//
1261
David Goodwin3ca524e2009-07-10 17:03:29 +00001262// Almost all VFP instructions are predicable.
1263class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001264 IndexMode im, Format f, InstrItinClass itin,
1265 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001266 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001267 let OutOperandList = oops;
1268 let InOperandList = !con(iops, (ops pred:$p));
1269 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1270 let Pattern = pattern;
1271 list<Predicate> Predicates = [HasVFP2];
1272}
1273
1274// Special cases
1275class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001276 IndexMode im, Format f, InstrItinClass itin,
1277 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001278 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001279 let OutOperandList = oops;
1280 let InOperandList = iops;
1281 let AsmString = asm;
1282 let Pattern = pattern;
1283 list<Predicate> Predicates = [HasVFP2];
1284}
1285
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001286class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1287 string opc, string asm, list<dag> pattern>
1288 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1289 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001290
Evan Chengcd8e66a2008-11-11 21:48:44 +00001291// ARM VFP addrmode5 loads and stores
1292class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001293 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001294 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001295 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001296 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001297 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001298 let Inst{27-24} = opcod1;
1299 let Inst{21-20} = opcod2;
1300 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001301
1302 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1303 let Dom = VFPNeonDomain.Value;
Evan Cheng96581d32008-11-11 02:11:05 +00001304}
1305
Evan Chengcd8e66a2008-11-11 21:48:44 +00001306class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001307 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001308 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001309 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001310 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001311 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001312 let Inst{27-24} = opcod1;
1313 let Inst{21-20} = opcod2;
1314 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001315}
1316
Evan Chengcd8e66a2008-11-11 21:48:44 +00001317// Load / store multiple
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001318class AXDI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001319 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001320 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson815baeb2010-03-13 01:08:20 +00001321 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001322 // TODO: Mark the instructions with the appropriate subtarget info.
1323 let Inst{27-25} = 0b110;
1324 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001325
1326 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1327 let Dom = VFPNeonDomain.Value;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001328}
1329
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001330class AXSI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001331 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001332 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson815baeb2010-03-13 01:08:20 +00001333 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001334 // TODO: Mark the instructions with the appropriate subtarget info.
1335 let Inst{27-25} = 0b110;
1336 let Inst{11-8} = 0b1010;
1337}
1338
Evan Cheng96581d32008-11-11 02:11:05 +00001339// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001340class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1341 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1342 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001343 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001344 let Inst{27-23} = opcod1;
1345 let Inst{21-20} = opcod2;
1346 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001347 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001348 let Inst{7-6} = opcod4;
1349 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001350}
1351
1352// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001353class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1354 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001355 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001356 let Inst{27-23} = opcod1;
1357 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001358 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001359 let Inst{6} = op6;
1360 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001361}
1362
1363// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001364class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1365 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1366 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001367 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001368 let Inst{27-23} = opcod1;
1369 let Inst{21-20} = opcod2;
1370 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001371 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001372 let Inst{7-6} = opcod4;
1373 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001374}
1375
David Goodwin338268c2009-08-10 22:17:39 +00001376// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001377// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001378class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1379 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1380 string asm, list<dag> pattern>
1381 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1382 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001383 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1384}
1385
Evan Cheng96581d32008-11-11 02:11:05 +00001386// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001387class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1388 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001389 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001390 let Inst{27-23} = opcod1;
1391 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001392 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001393 let Inst{6} = op6;
1394 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001395}
1396
David Goodwin338268c2009-08-10 22:17:39 +00001397// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001398// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001399class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1400 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
1401 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001402 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1403}
1404
Evan Cheng80a11982008-11-12 06:41:41 +00001405// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001406class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1407 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1408 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001409 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001410 let Inst{27-23} = opcod1;
1411 let Inst{21-20} = opcod2;
1412 let Inst{19-16} = opcod3;
1413 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001414 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001415 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001416}
1417
Johnny Chen811663f2010-02-11 18:47:03 +00001418// VFP conversion between floating-point and fixed-point
1419class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1420 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1421 list<dag> pattern>
1422 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1423 // size (fixed-point number): sx == 0 ? 16 : 32
1424 let Inst{7} = op5; // sx
1425}
1426
David Goodwin338268c2009-08-10 22:17:39 +00001427// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001428class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001429 dag oops, dag iops, InstrItinClass itin,
1430 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001431 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1432 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001433 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1434}
1435
Evan Cheng80a11982008-11-12 06:41:41 +00001436class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001437 InstrItinClass itin,
1438 string opc, string asm, list<dag> pattern>
1439 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001440 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001441 let Inst{11-8} = opcod2;
1442 let Inst{4} = 1;
1443}
1444
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001445class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1446 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1447 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001448
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001449class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1450 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1451 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001452
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001453class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1454 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1455 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001456
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001457class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1458 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1459 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001460
Evan Cheng96581d32008-11-11 02:11:05 +00001461//===----------------------------------------------------------------------===//
1462
Bob Wilson5bafff32009-06-22 23:27:02 +00001463//===----------------------------------------------------------------------===//
1464// ARM NEON Instruction templates.
1465//
Evan Cheng13096642008-08-29 06:41:12 +00001466
Johnny Chen9e088762010-03-17 17:52:21 +00001467// NSFormat specifies further details of a NEON instruction. This is used by
1468// the disassembler to classify NEONFrm instructions for disassembly purpose.
1469class NSFormat<bits<5> val> {
1470 bits<5> Value = val;
1471}
1472def NSFormatNone : NSFormat<0>;
1473def VLDSTLaneFrm : NSFormat<1>;
1474def VLDSTLaneDblFrm : NSFormat<2>;
1475def VLDSTRQFrm : NSFormat<3>;
1476def NVdImmFrm : NSFormat<4>;
1477def NVdVmImmFrm : NSFormat<5>;
1478def NVdVmImmVCVTFrm : NSFormat<6>;
1479def NVdVmImmVDupLaneFrm : NSFormat<7>;
1480def NVdVmImmVSHLLFrm : NSFormat<8>;
1481def NVectorShuffleFrm : NSFormat<9>;
1482def NVectorShiftFrm : NSFormat<10>;
1483def NVectorShift2Frm : NSFormat<11>;
1484def NVdVnVmImmFrm : NSFormat<12>;
1485def NVdVnVmImmVectorShiftFrm : NSFormat<13>;
1486def NVdVnVmImmVectorExtractFrm : NSFormat<14>;
1487def NVdVnVmImmMulScalarFrm : NSFormat<15>;
1488def VTBLFrm : NSFormat<16>;
1489
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001490class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001491 string opc, string dt, string asm, string cstr, list<dag> pattern>
1492 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
1493 let OutOperandList = oops;
1494 let InOperandList = !con(iops, (ops pred:$p));
1495 let AsmString = !strconcat(
1496 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1497 !strconcat("\t", asm));
1498 let Pattern = pattern;
1499 list<Predicate> Predicates = [HasNEON];
Johnny Chen9e088762010-03-17 17:52:21 +00001500 NSFormat NSF = NSFormatNone; // For disassembly.
1501 bits<5> NSForm = NSFormatNone.Value; // For disassembly.
Evan Chengf81bf152009-11-23 21:57:23 +00001502}
1503
1504// Same as NeonI except it does not have a "data type" specifier.
1505class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001506 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001507 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001508 let OutOperandList = oops;
Evan Chengac0869d2009-11-21 06:21:52 +00001509 let InOperandList = !con(iops, (ops pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001510 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001511 let Pattern = pattern;
1512 list<Predicate> Predicates = [HasNEON];
Johnny Chen9e088762010-03-17 17:52:21 +00001513 NSFormat NSF = NSFormatNone; // For disassembly.
1514 bits<5> NSForm = NSFormatNone.Value; // For disassembly.
Evan Cheng13096642008-08-29 06:41:12 +00001515}
1516
Evan Chengac0869d2009-11-21 06:21:52 +00001517class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1518 list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001519 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
Evan Chengac0869d2009-11-21 06:21:52 +00001520 pattern> {
Evan Cheng13096642008-08-29 06:41:12 +00001521}
Bob Wilson5bafff32009-06-22 23:27:02 +00001522
Evan Chengf81bf152009-11-23 21:57:23 +00001523class NI4<dag oops, dag iops, InstrItinClass itin, string opc,
1524 string asm, list<dag> pattern>
1525 : NeonXI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "",
1526 pattern> {
Johnny Chen9e088762010-03-17 17:52:21 +00001527 let NSF = VLDSTRQFrm; // For disassembly.
1528 let NSForm = VLDSTRQFrm.Value; // For disassembly.
Anton Korobeynikovbaf31082009-08-08 13:35:48 +00001529}
1530
Bob Wilsonb07c1712009-10-07 21:53:04 +00001531class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1532 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001533 string opc, string dt, string asm, string cstr, list<dag> pattern>
1534 : NeonI<oops, iops, AddrMode6, IndexModeNone, itin, opc, dt, asm, cstr,
1535 pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001536 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001537 let Inst{23} = op23;
1538 let Inst{21-20} = op21_20;
1539 let Inst{11-8} = op11_8;
1540 let Inst{7-4} = op7_4;
Johnny Chen9e088762010-03-17 17:52:21 +00001541 let NSF = VLDSTLaneFrm; // For disassembly.
1542 let NSForm = VLDSTLaneFrm.Value; // For disassembly.
Bob Wilson205a5ca2009-07-08 18:11:30 +00001543}
1544
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001545class NDataI<dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001546 string opc, string dt, string asm, string cstr, list<dag> pattern>
1547 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, dt, asm,
1548 cstr, pattern> {
1549 let Inst{31-25} = 0b1111001;
1550}
1551
1552class NDataXI<dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001553 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001554 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
Evan Chengac0869d2009-11-21 06:21:52 +00001555 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001556 let Inst{31-25} = 0b1111001;
1557}
1558
1559// NEON "one register and a modified immediate" format.
1560class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1561 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001562 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001563 string opc, string dt, string asm, string cstr, list<dag> pattern>
1564 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001565 let Inst{23} = op23;
1566 let Inst{21-19} = op21_19;
1567 let Inst{11-8} = op11_8;
1568 let Inst{7} = op7;
1569 let Inst{6} = op6;
1570 let Inst{5} = op5;
1571 let Inst{4} = op4;
Johnny Chen9e088762010-03-17 17:52:21 +00001572 let NSF = NVdImmFrm; // For disassembly.
1573 let NSForm = NVdImmFrm.Value; // For disassembly.
Bob Wilson5bafff32009-06-22 23:27:02 +00001574}
1575
1576// NEON 2 vector register format.
1577class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1578 bits<5> op11_7, 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>
1581 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1582 let Inst{24-23} = op24_23;
1583 let Inst{21-20} = op21_20;
1584 let Inst{19-18} = op19_18;
1585 let Inst{17-16} = op17_16;
1586 let Inst{11-7} = op11_7;
1587 let Inst{6} = op6;
1588 let Inst{4} = op4;
Johnny Chen9e088762010-03-17 17:52:21 +00001589 let NSF = NVdVmImmFrm; // For disassembly.
1590 let NSForm = NVdVmImmFrm.Value; // For disassembly.
Evan Chengf81bf152009-11-23 21:57:23 +00001591}
1592
1593// Same as N2V except it doesn't have a datatype suffix.
1594class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1595 bits<5> op11_7, bit op6, bit op4,
1596 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001597 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001598 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001599 let Inst{24-23} = op24_23;
1600 let Inst{21-20} = op21_20;
1601 let Inst{19-18} = op19_18;
1602 let Inst{17-16} = op17_16;
1603 let Inst{11-7} = op11_7;
1604 let Inst{6} = op6;
1605 let Inst{4} = op4;
Johnny Chen9e088762010-03-17 17:52:21 +00001606 let NSF = NVdVmImmFrm; // For disassembly.
1607 let NSForm = NVdVmImmFrm.Value; // For disassembly.
Bob Wilson5bafff32009-06-22 23:27:02 +00001608}
1609
1610// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001611class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001612 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001613 string opc, string dt, string asm, string cstr, list<dag> pattern>
1614 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001615 let Inst{24} = op24;
1616 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001617 let Inst{11-8} = op11_8;
1618 let Inst{7} = op7;
1619 let Inst{6} = op6;
1620 let Inst{4} = op4;
Johnny Chen9e088762010-03-17 17:52:21 +00001621 let NSF = NVdVmImmFrm; // For disassembly.
1622 let NSForm = NVdVmImmFrm.Value; // For disassembly.
Bob Wilson5bafff32009-06-22 23:27:02 +00001623}
1624
1625// NEON 3 vector register format.
1626class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001627 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001628 string opc, string dt, string asm, string cstr, list<dag> pattern>
1629 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1630 let Inst{24} = op24;
1631 let Inst{23} = op23;
1632 let Inst{21-20} = op21_20;
1633 let Inst{11-8} = op11_8;
1634 let Inst{6} = op6;
1635 let Inst{4} = op4;
Johnny Chen9e088762010-03-17 17:52:21 +00001636 let NSF = NVdVnVmImmFrm; // For disassembly.
1637 let NSForm = NVdVnVmImmFrm.Value; // For disassembly.
Evan Chengf81bf152009-11-23 21:57:23 +00001638}
1639
1640// Same as N3VX except it doesn't have a data type suffix.
1641class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1642 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001643 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001644 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001645 let Inst{24} = op24;
1646 let Inst{23} = op23;
1647 let Inst{21-20} = op21_20;
1648 let Inst{11-8} = op11_8;
1649 let Inst{6} = op6;
1650 let Inst{4} = op4;
Johnny Chen9e088762010-03-17 17:52:21 +00001651 let NSF = NVdVnVmImmFrm; // For disassembly.
1652 let NSForm = NVdVnVmImmFrm.Value; // For disassembly.
Bob Wilson5bafff32009-06-22 23:27:02 +00001653}
1654
1655// NEON VMOVs between scalar and core registers.
1656class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001657 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001658 string opc, string dt, string asm, list<dag> pattern>
1659 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
1660 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001661 let Inst{27-20} = opcod1;
1662 let Inst{11-8} = opcod2;
1663 let Inst{6-5} = opcod3;
1664 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001665
1666 let OutOperandList = oops;
1667 let InOperandList = !con(iops, (ops pred:$p));
1668 let AsmString = !strconcat(
1669 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1670 !strconcat("\t", asm));
1671 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001672 list<Predicate> Predicates = [HasNEON];
1673}
1674class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001675 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001676 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001677 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001678 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001679class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001680 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001681 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001682 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001683 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001684class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001685 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001686 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001687 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001688 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001689
1690// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1691// for single-precision FP.
1692class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1693 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1694}