blob: 2bfc0652d0e8e9a95867b378ff8730ffdc98a1af [file] [log] [blame]
Evan Cheng37f25d92008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
Bob Wilson01135592010-03-23 17:23:59 +00002//
Evan Cheng37f25d92008-08-28 23:39:26 +00003// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bob Wilson01135592010-03-23 17:23:59 +00007//
Evan Cheng37f25d92008-08-28 23:39:26 +00008//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11//
12// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
Bob Wilson89ef7b72010-03-17 21:13:43 +000018class Format<bits<6> val> {
19 bits<6> Value = val;
Evan Cheng37f25d92008-08-28 23:39:26 +000020}
21
Evan Chengffa6d962008-11-13 23:36:57 +000022def Pseudo : Format<0>;
23def MulFrm : Format<1>;
24def BrFrm : Format<2>;
25def BrMiscFrm : Format<3>;
Evan Cheng37f25d92008-08-28 23:39:26 +000026
Evan Chengffa6d962008-11-13 23:36:57 +000027def DPFrm : Format<4>;
28def DPSoRegFrm : Format<5>;
Evan Cheng37f25d92008-08-28 23:39:26 +000029
Evan Chengffa6d962008-11-13 23:36:57 +000030def LdFrm : Format<6>;
31def StFrm : Format<7>;
32def LdMiscFrm : Format<8>;
33def StMiscFrm : Format<9>;
34def LdStMulFrm : Format<10>;
Evan Cheng37f25d92008-08-28 23:39:26 +000035
Johnny Chen81f04d52010-03-19 17:39:00 +000036def LdStExFrm : Format<11>;
Jim Grosbach5278eb82009-12-11 01:42:04 +000037
Johnny Chen81f04d52010-03-19 17:39:00 +000038def ArithMiscFrm : Format<12>;
Bob Wilson9a1c1892010-08-11 00:01:18 +000039def SatFrm : Format<13>;
40def ExtFrm : Format<14>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000041
Bob Wilson9a1c1892010-08-11 00:01:18 +000042def VFPUnaryFrm : Format<15>;
43def VFPBinaryFrm : Format<16>;
44def VFPConv1Frm : Format<17>;
45def VFPConv2Frm : Format<18>;
46def VFPConv3Frm : Format<19>;
47def VFPConv4Frm : Format<20>;
48def VFPConv5Frm : Format<21>;
49def VFPLdStFrm : Format<22>;
50def VFPLdStMulFrm : Format<23>;
51def VFPMiscFrm : Format<24>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000052
Bob Wilson9a1c1892010-08-11 00:01:18 +000053def ThumbFrm : Format<25>;
54def MiscFrm : Format<26>;
Evan Cheng37f25d92008-08-28 23:39:26 +000055
Bob Wilson9a1c1892010-08-11 00:01:18 +000056def NGetLnFrm : Format<27>;
57def NSetLnFrm : Format<28>;
58def NDupFrm : Format<29>;
59def NLdStFrm : Format<30>;
60def N1RegModImmFrm: Format<31>;
61def N2RegFrm : Format<32>;
62def NVCVTFrm : Format<33>;
63def NVDupLnFrm : Format<34>;
64def N2RegVShLFrm : Format<35>;
65def N2RegVShRFrm : Format<36>;
66def N3RegFrm : Format<37>;
67def N3RegVShFrm : Format<38>;
68def NVExtFrm : Format<39>;
69def NVMulSLFrm : Format<40>;
70def NVTBLFrm : Format<41>;
Johnny Chencaa608e2010-03-20 00:17:00 +000071
Evan Cheng34a0fa32009-07-08 01:46:35 +000072// Misc flags.
73
Evan Chengedda31c2008-11-05 18:35:52 +000074// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000075// UnaryDP - Indicates this is a unary data processing instruction, i.e.
76// it doesn't have a Rn operand.
77class UnaryDP { bit isUnaryDataProc = 1; }
78
79// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
80// a 16-bit Thumb instruction if certain conditions are met.
81class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000082
Evan Cheng37f25d92008-08-28 23:39:26 +000083//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000084// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000085//
86
87// Addressing mode.
Jim Grosbachd86609f2010-10-05 18:14:55 +000088class AddrMode<bits<5> val> {
89 bits<5> Value = val;
Evan Cheng055b0312009-06-29 07:51:04 +000090}
Bill Wendlingda2ae632010-08-31 07:50:46 +000091def AddrModeNone : AddrMode<0>;
92def AddrMode1 : AddrMode<1>;
93def AddrMode2 : AddrMode<2>;
94def AddrMode3 : AddrMode<3>;
95def AddrMode4 : AddrMode<4>;
96def AddrMode5 : AddrMode<5>;
97def AddrMode6 : AddrMode<6>;
98def AddrModeT1_1 : AddrMode<7>;
99def AddrModeT1_2 : AddrMode<8>;
100def AddrModeT1_4 : AddrMode<9>;
101def AddrModeT1_s : AddrMode<10>;
102def AddrModeT2_i12 : AddrMode<11>;
103def AddrModeT2_i8 : AddrMode<12>;
104def AddrModeT2_so : AddrMode<13>;
105def AddrModeT2_pc : AddrMode<14>;
Bob Wilson8b024a52009-07-01 23:16:05 +0000106def AddrModeT2_i8s4 : AddrMode<15>;
Jim Grosbach3e556122010-10-26 22:37:02 +0000107def AddrMode_i12 : AddrMode<16>;
Evan Cheng055b0312009-06-29 07:51:04 +0000108
109// Instruction size.
110class SizeFlagVal<bits<3> val> {
111 bits<3> Value = val;
112}
113def SizeInvalid : SizeFlagVal<0>; // Unset.
114def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
115def Size8Bytes : SizeFlagVal<2>;
116def Size4Bytes : SizeFlagVal<3>;
117def Size2Bytes : SizeFlagVal<4>;
118
119// Load / store index mode.
120class IndexMode<bits<2> val> {
121 bits<2> Value = val;
122}
123def IndexModeNone : IndexMode<0>;
124def IndexModePre : IndexMode<1>;
125def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000126def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000127
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000128// Instruction execution domain.
129class Domain<bits<2> val> {
130 bits<2> Value = val;
131}
132def GenericDomain : Domain<0>;
133def VFPDomain : Domain<1>; // Instructions in VFP domain only
134def NeonDomain : Domain<2>; // Instructions in Neon domain only
135def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
136
Evan Cheng055b0312009-06-29 07:51:04 +0000137//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000138
Evan Cheng446c4282009-07-11 06:43:01 +0000139// ARM special operands.
140//
141
Daniel Dunbar8462b302010-08-11 06:36:53 +0000142def CondCodeOperand : AsmOperandClass {
143 let Name = "CondCode";
144 let SuperClasses = [];
145}
146
Evan Cheng446c4282009-07-11 06:43:01 +0000147// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
148// register whose default is 0 (no register).
149def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
150 (ops (i32 14), (i32 zero_reg))> {
151 let PrintMethod = "printPredicateOperand";
Daniel Dunbar8462b302010-08-11 06:36:53 +0000152 let ParserMatchClass = CondCodeOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000153}
154
155// Conditional code result for instructions whose 's' bit is set, e.g. subs.
156def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Jim Grosbach08bd5492010-10-12 23:00:24 +0000157 string EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000158 let PrintMethod = "printSBitModifierOperand";
159}
160
161// Same as cc_out except it defaults to setting CPSR.
162def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Jim Grosbach08bd5492010-10-12 23:00:24 +0000163 string EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000164 let PrintMethod = "printSBitModifierOperand";
165}
166
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000167// ARM special operands for disassembly only.
168//
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000169def setend_op : Operand<i32> {
170 let PrintMethod = "printSetendOperand";
171}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000172
173def cps_opt : Operand<i32> {
174 let PrintMethod = "printCPSOptionOperand";
175}
176
177def msr_mask : Operand<i32> {
178 let PrintMethod = "printMSRMaskOperand";
179}
180
181// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
182// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
183def neg_zero : Operand<i32> {
184 let PrintMethod = "printNegZeroOperand";
185}
186
Evan Cheng446c4282009-07-11 06:43:01 +0000187//===----------------------------------------------------------------------===//
188
Evan Cheng37f25d92008-08-28 23:39:26 +0000189// ARM Instruction templates.
190//
191
Johnny Chend68e1192009-12-15 17:24:14 +0000192class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
193 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000194 : Instruction {
195 let Namespace = "ARM";
196
Evan Cheng37f25d92008-08-28 23:39:26 +0000197 AddrMode AM = am;
Evan Cheng37f25d92008-08-28 23:39:26 +0000198 SizeFlagVal SZ = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000199 IndexMode IM = im;
200 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000201 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000202 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000203 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000204 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000205 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000206
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000207 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000208 let TSFlags{4-0} = AM.Value;
209 let TSFlags{7-5} = SZ.Value;
210 let TSFlags{9-8} = IndexModeBits;
211 let TSFlags{15-10} = Form;
212 let TSFlags{16} = isUnaryDataProc;
213 let TSFlags{17} = canXformTo16Bit;
214 let TSFlags{19-18} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000215
Evan Cheng37f25d92008-08-28 23:39:26 +0000216 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000217 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000218}
219
Johnny Chend68e1192009-12-15 17:24:14 +0000220class Encoding {
221 field bits<32> Inst;
222}
223
224class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
225 Format f, Domain d, string cstr, InstrItinClass itin>
226 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
227
228// This Encoding-less class is used by Thumb1 to specify the encoding bits later
229// on by adding flavors to specific instructions.
230class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
231 Format f, Domain d, string cstr, InstrItinClass itin>
232 : InstTemplate<am, sz, im, f, d, cstr, itin>;
233
Bob Wilson01135592010-03-23 17:23:59 +0000234class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000235 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000236 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000237 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000238 let OutOperandList = oops;
239 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000240 let AsmString = asm;
Evan Cheng37f25d92008-08-28 23:39:26 +0000241 let Pattern = pattern;
242}
243
244// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000245class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000246 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000247 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000248 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000249 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000250 bits<4> p;
251 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000252 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000253 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000254 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000255 let Pattern = pattern;
256 list<Predicate> Predicates = [IsARM];
257}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000258
Jim Grosbachf6b28622009-12-14 18:31:20 +0000259// A few are not predicable
260class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000261 IndexMode im, Format f, InstrItinClass itin,
262 string opc, string asm, string cstr,
263 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000264 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
265 let OutOperandList = oops;
266 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000267 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000268 let Pattern = pattern;
269 let isPredicable = 0;
270 list<Predicate> Predicates = [IsARM];
271}
Evan Cheng37f25d92008-08-28 23:39:26 +0000272
Bill Wendling4822bce2010-08-30 01:47:35 +0000273// Same as I except it can optionally modify CPSR. Note it's modeled as an input
274// operand since by default it's a zero register. It will become an implicit def
275// once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000276class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000277 IndexMode im, Format f, InstrItinClass itin,
278 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000279 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000280 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000281 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000282 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000283 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000284 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000285
Evan Cheng37f25d92008-08-28 23:39:26 +0000286 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000287 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000288 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000289 let Pattern = pattern;
290 list<Predicate> Predicates = [IsARM];
291}
292
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000293// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000294class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000295 IndexMode im, Format f, InstrItinClass itin,
296 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000297 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000298 let OutOperandList = oops;
299 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000300 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000301 let Pattern = pattern;
302 list<Predicate> Predicates = [IsARM];
303}
304
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000305class AI<dag oops, dag iops, Format f, InstrItinClass itin,
306 string opc, string asm, list<dag> pattern>
307 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
308 opc, asm, "", pattern>;
309class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
310 string opc, string asm, list<dag> pattern>
311 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
312 opc, asm, "", pattern>;
313class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000314 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000315 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000316 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000317class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000318 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000319 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000320 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000321
322// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000323class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
324 string opc, string asm, list<dag> pattern>
325 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
326 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000327 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000328}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000329class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
330 string asm, list<dag> pattern>
331 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
332 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000333 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000334}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000335class ABXIx2<dag oops, dag iops, InstrItinClass itin,
336 string asm, list<dag> pattern>
Xerxes Ranby99ccffe2010-07-22 17:28:34 +0000337 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000338 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000339
340// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000341class JTI<dag oops, dag iops, InstrItinClass itin,
342 string asm, list<dag> pattern>
343 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000344 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000345
Jim Grosbach5278eb82009-12-11 01:42:04 +0000346// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000347class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
348 string opc, string asm, list<dag> pattern>
349 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
350 opc, asm, "", pattern> {
351 let Inst{27-23} = 0b00011;
352 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000353 let Inst{20} = 1;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000354 let Inst{11-0} = 0b111110011111;
355}
356class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
357 string opc, string asm, list<dag> pattern>
358 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
359 opc, asm, "", pattern> {
360 let Inst{27-23} = 0b00011;
361 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000362 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000363 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000364}
365
Evan Cheng0d14fc82008-09-01 01:51:14 +0000366// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000367class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
368 string opc, string asm, list<dag> pattern>
369 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
370 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000371 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000372 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000373}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000374class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
375 string opc, string asm, list<dag> pattern>
376 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
377 opc, asm, "", pattern> {
378 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000379 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000380}
381class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000382 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000383 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000384 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000385 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000386 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000387}
Bob Wilson01135592010-03-23 17:23:59 +0000388class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000389 string opc, string asm, list<dag> pattern>
390 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
391 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000392
Evan Cheng0d14fc82008-09-01 01:51:14 +0000393
394// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000395class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
396 string opc, string asm, list<dag> pattern>
397 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
398 opc, asm, "", pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +0000399 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000400}
Evan Cheng93912732008-09-01 01:27:33 +0000401
402// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000403
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000404// LDR/LDRB/STR/STRB
405class AIldst1<bits<3> op, bit opc22, bit isLd, dag oops, dag iops, AddrMode am,
406 Format f, InstrItinClass itin, string opc, string asm,
407 list<dag> pattern>
Jim Grosbach3e556122010-10-26 22:37:02 +0000408 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
409 "", pattern> {
410 let Inst{27-25} = op;
411 let Inst{24} = 1; // 24 == P
412 // 23 == U
413 let Inst{22} = opc22;
414 let Inst{21} = 0; // 21 == W
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000415 let Inst{20} = isLd;
Jim Grosbach3e556122010-10-26 22:37:02 +0000416}
417// LDRH/LDRSB/LDRSH/LDRD
418class AIldr2<bits<4> op, bit opc22, bit opc20, dag oops, dag iops, AddrMode am,
419 Format f, InstrItinClass itin, string opc, string asm,
420 list<dag> pattern>
421 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
422 "", pattern> {
423 let Inst{27-25} = 0b000;
424 let Inst{24} = 1; // 24 == P
425 // 23 == U
426 let Inst{22} = opc22;
427 let Inst{21} = 0; // 21 == W
428 let Inst{20} = opc20;
429
430 let Inst{7-4} = op;
431}
432
433
434
435
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000436class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
437 string opc, string asm, list<dag> pattern>
438 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
439 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000440 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000441 let Inst{21} = 0; // W bit
442 let Inst{22} = 0; // B bit
443 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000444 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000445}
Bob Wilson01135592010-03-23 17:23:59 +0000446class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000447 string asm, list<dag> pattern>
448 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000449 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000450 let Inst{20} = 1; // L bit
451 let Inst{21} = 0; // W bit
452 let Inst{22} = 0; // B bit
453 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000454 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000455}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000456class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
457 string opc, string asm, list<dag> pattern>
458 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
459 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000460 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000461 let Inst{21} = 0; // W bit
462 let Inst{22} = 1; // B bit
463 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000464 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000465}
Bob Wilson01135592010-03-23 17:23:59 +0000466class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000467 string asm, list<dag> pattern>
468 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000469 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000470 let Inst{20} = 1; // L bit
471 let Inst{21} = 0; // W bit
472 let Inst{22} = 1; // B bit
473 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000474 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000475}
Evan Cheng17222df2008-08-31 19:02:21 +0000476
Evan Cheng93912732008-09-01 01:27:33 +0000477// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000478class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
479 string opc, string asm, list<dag> pattern>
480 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
481 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000482 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000483 let Inst{21} = 0; // W bit
484 let Inst{22} = 0; // B bit
485 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000486 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000487}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000488class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
489 string asm, list<dag> pattern>
490 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000491 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000492 let Inst{20} = 0; // L bit
493 let Inst{21} = 0; // W bit
494 let Inst{22} = 0; // B bit
495 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000496 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000497}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000498class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
499 string opc, string asm, list<dag> pattern>
500 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
501 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000502 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000503 let Inst{21} = 0; // W bit
504 let Inst{22} = 1; // B bit
505 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000506 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000507}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000508class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
509 string asm, list<dag> pattern>
510 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000511 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000512 let Inst{20} = 0; // L bit
513 let Inst{21} = 0; // W bit
514 let Inst{22} = 1; // B bit
515 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000516 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000517}
Evan Cheng93912732008-09-01 01:27:33 +0000518
Evan Cheng840917b2008-09-01 07:00:14 +0000519// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000520class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
521 string opc, string asm, string cstr, list<dag> pattern>
522 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
523 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000524 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000525 let Inst{21} = 1; // W bit
526 let Inst{22} = 0; // B bit
527 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000528 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000529}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000530class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
531 string opc, string asm, string cstr, list<dag> pattern>
532 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
533 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000534 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000535 let Inst{21} = 1; // W bit
536 let Inst{22} = 1; // B bit
537 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000538 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000539}
540
Evan Cheng840917b2008-09-01 07:00:14 +0000541// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000542class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
543 string opc, string asm, string cstr, list<dag> pattern>
544 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
545 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000546 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000547 let Inst{21} = 1; // W bit
548 let Inst{22} = 0; // B bit
549 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000550 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000551}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000552class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
553 string opc, string asm, string cstr, list<dag> pattern>
554 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
555 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000556 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000557 let Inst{21} = 1; // W bit
558 let Inst{22} = 1; // B bit
559 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000560 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000561}
562
Evan Cheng840917b2008-09-01 07:00:14 +0000563// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000564class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
565 string opc, string asm, string cstr, list<dag> pattern>
566 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
567 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000568 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000569 let Inst{21} = 0; // W bit
570 let Inst{22} = 0; // B bit
571 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000572 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000573}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000574class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
575 string opc, string asm, string cstr, list<dag> pattern>
576 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
577 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000578 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000579 let Inst{21} = 0; // W bit
580 let Inst{22} = 1; // B bit
581 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000582 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000583}
584
Evan Cheng840917b2008-09-01 07:00:14 +0000585// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000586class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
587 string opc, string asm, string cstr, list<dag> pattern>
588 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
589 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000590 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000591 let Inst{21} = 0; // W bit
592 let Inst{22} = 0; // B bit
593 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000594 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000595}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000596class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
597 string opc, string asm, string cstr, list<dag> pattern>
598 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
599 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000600 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000601 let Inst{21} = 0; // W bit
602 let Inst{22} = 1; // B bit
603 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000604 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000605}
606
Evan Cheng0d14fc82008-09-01 01:51:14 +0000607// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000608class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000609 string opc, string asm, list<dag> pattern>
610 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
611 opc, asm, "", pattern>;
612class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
613 string asm, list<dag> pattern>
614 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
615 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000616
Evan Cheng840917b2008-09-01 07:00:14 +0000617// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000618class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
619 string opc, string asm, list<dag> pattern>
620 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
621 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000622 let Inst{4} = 1;
623 let Inst{5} = 1; // H bit
624 let Inst{6} = 0; // S bit
625 let Inst{7} = 1;
626 let Inst{20} = 1; // L bit
627 let Inst{21} = 0; // W bit
628 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000629 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000630}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000631class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
632 string asm, list<dag> pattern>
633 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000634 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000635 let Inst{4} = 1;
636 let Inst{5} = 1; // H bit
637 let Inst{6} = 0; // S bit
638 let Inst{7} = 1;
639 let Inst{20} = 1; // L bit
640 let Inst{21} = 0; // W bit
641 let Inst{24} = 1; // P bit
642}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000643class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
644 string opc, string asm, list<dag> pattern>
645 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
646 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000647 let Inst{4} = 1;
648 let Inst{5} = 1; // H bit
649 let Inst{6} = 1; // S bit
650 let Inst{7} = 1;
651 let Inst{20} = 1; // L bit
652 let Inst{21} = 0; // W bit
653 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000654 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000655}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000656class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
657 string asm, list<dag> pattern>
658 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000659 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000660 let Inst{4} = 1;
661 let Inst{5} = 1; // H bit
662 let Inst{6} = 1; // S bit
663 let Inst{7} = 1;
664 let Inst{20} = 1; // L bit
665 let Inst{21} = 0; // W bit
666 let Inst{24} = 1; // P bit
667}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000668class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
669 string opc, string asm, list<dag> pattern>
670 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
671 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000672 let Inst{4} = 1;
673 let Inst{5} = 0; // H bit
674 let Inst{6} = 1; // S bit
675 let Inst{7} = 1;
676 let Inst{20} = 1; // L bit
677 let Inst{21} = 0; // W bit
678 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000679 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000680}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000681class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
682 string asm, list<dag> pattern>
683 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000684 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000685 let Inst{4} = 1;
686 let Inst{5} = 0; // H bit
687 let Inst{6} = 1; // S bit
688 let Inst{7} = 1;
689 let Inst{20} = 1; // L bit
690 let Inst{21} = 0; // W bit
691 let Inst{24} = 1; // P bit
692}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000693class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
694 string opc, string asm, list<dag> pattern>
695 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
696 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000697 let Inst{4} = 1;
698 let Inst{5} = 0; // H bit
699 let Inst{6} = 1; // S bit
700 let Inst{7} = 1;
701 let Inst{20} = 0; // L bit
702 let Inst{21} = 0; // 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}
706
707// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000708class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
709 string opc, string asm, list<dag> pattern>
710 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
711 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000712 let Inst{4} = 1;
713 let Inst{5} = 1; // H bit
714 let Inst{6} = 0; // S bit
715 let Inst{7} = 1;
716 let Inst{20} = 0; // L bit
717 let Inst{21} = 0; // W bit
718 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000719 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000720}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000721class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
722 string asm, list<dag> pattern>
723 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000724 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000725 let Inst{4} = 1;
726 let Inst{5} = 1; // H bit
727 let Inst{6} = 0; // S bit
728 let Inst{7} = 1;
729 let Inst{20} = 0; // L bit
730 let Inst{21} = 0; // W bit
731 let Inst{24} = 1; // P bit
732}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000733class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
734 string opc, string asm, list<dag> pattern>
735 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
736 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000737 let Inst{4} = 1;
738 let Inst{5} = 1; // H bit
739 let Inst{6} = 1; // S bit
740 let Inst{7} = 1;
741 let Inst{20} = 0; // L bit
742 let Inst{21} = 0; // W bit
743 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000744 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000745}
746
747// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000748class AI3ldhpr<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} = 1; // 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}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000761class AI3ldshpr<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> {
Evan Cheng840917b2008-09-01 07:00:14 +0000765 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} = 1; // L bit
770 let Inst{21} = 1; // W bit
771 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000772 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000773}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000774class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
775 string opc, string asm, string cstr, list<dag> pattern>
776 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
777 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000778 let Inst{4} = 1;
779 let Inst{5} = 0; // H bit
780 let Inst{6} = 1; // S bit
781 let Inst{7} = 1;
782 let Inst{20} = 1; // L bit
783 let Inst{21} = 1; // W bit
784 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000785 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000786}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000787class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
788 string opc, string asm, string cstr, list<dag> pattern>
789 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
790 opc, asm, cstr, pattern> {
791 let Inst{4} = 1;
792 let Inst{5} = 0; // H bit
793 let Inst{6} = 1; // S bit
794 let Inst{7} = 1;
795 let Inst{20} = 0; // L bit
796 let Inst{21} = 1; // W bit
797 let Inst{24} = 1; // P bit
798 let Inst{27-25} = 0b000;
799}
800
Evan Cheng840917b2008-09-01 07:00:14 +0000801
802// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000803class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
804 string opc, string asm, string cstr, list<dag> pattern>
805 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
806 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000807 let Inst{4} = 1;
808 let Inst{5} = 1; // H bit
809 let Inst{6} = 0; // S bit
810 let Inst{7} = 1;
811 let Inst{20} = 0; // L bit
812 let Inst{21} = 1; // W bit
813 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000814 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000815}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000816class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
817 string opc, string asm, string cstr, list<dag> pattern>
818 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
819 opc, asm, cstr, pattern> {
820 let Inst{4} = 1;
821 let Inst{5} = 1; // H bit
822 let Inst{6} = 1; // S bit
823 let Inst{7} = 1;
824 let Inst{20} = 0; // L bit
825 let Inst{21} = 1; // W bit
826 let Inst{24} = 1; // P bit
827 let Inst{27-25} = 0b000;
828}
Evan Cheng840917b2008-09-01 07:00:14 +0000829
830// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000831class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
832 string opc, string asm, string cstr, list<dag> pattern>
833 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
834 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000835 let Inst{4} = 1;
836 let Inst{5} = 1; // H bit
837 let Inst{6} = 0; // S bit
838 let Inst{7} = 1;
839 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000840 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000841 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000842 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000843}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000844class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
845 string opc, string asm, string cstr, list<dag> pattern>
846 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
847 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000848 let Inst{4} = 1;
849 let Inst{5} = 1; // H bit
850 let Inst{6} = 1; // S bit
851 let Inst{7} = 1;
852 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000853 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000854 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000855 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000856}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000857class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
858 string opc, string asm, string cstr, list<dag> pattern>
859 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
860 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000861 let Inst{4} = 1;
862 let Inst{5} = 0; // H bit
863 let Inst{6} = 1; // S bit
864 let Inst{7} = 1;
865 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000866 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000867 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000868 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000869}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000870class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
871 string opc, string asm, string cstr, list<dag> pattern>
872 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
873 opc, asm, cstr, pattern> {
874 let Inst{4} = 1;
875 let Inst{5} = 0; // H bit
876 let Inst{6} = 1; // S bit
877 let Inst{7} = 1;
878 let Inst{20} = 0; // L bit
879 let Inst{21} = 0; // W bit
880 let Inst{24} = 0; // P bit
881 let Inst{27-25} = 0b000;
882}
Evan Cheng840917b2008-09-01 07:00:14 +0000883
884// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000885class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
886 string opc, string asm, string cstr, list<dag> pattern>
887 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
888 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000889 let Inst{4} = 1;
890 let Inst{5} = 1; // H bit
891 let Inst{6} = 0; // S bit
892 let Inst{7} = 1;
893 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000894 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000895 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000896 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000897}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000898class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
899 string opc, string asm, string cstr, list<dag> pattern>
900 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
901 opc, asm, cstr, pattern> {
902 let Inst{4} = 1;
903 let Inst{5} = 1; // H bit
904 let Inst{6} = 1; // S bit
905 let Inst{7} = 1;
906 let Inst{20} = 0; // L bit
907 let Inst{21} = 0; // W bit
908 let Inst{24} = 0; // P bit
909 let Inst{27-25} = 0b000;
910}
Evan Cheng840917b2008-09-01 07:00:14 +0000911
Evan Cheng0d14fc82008-09-01 01:51:14 +0000912// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000913class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000914 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000915 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000916 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000917 let Inst{20} = 1; // L bit
918 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000919 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000920}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000921class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000922 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000923 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000924 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000925 let Inst{20} = 0; // L bit
926 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000927 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000928}
Evan Cheng37f25d92008-08-28 23:39:26 +0000929
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000930// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000931class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
932 string opc, string asm, list<dag> pattern>
933 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
934 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000935 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000936 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000937 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000938}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000939class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
940 string opc, string asm, list<dag> pattern>
941 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
942 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000943 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000944 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000945}
946
947// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000948class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
949 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000950 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
951 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000952 bits<4> Rd;
953 bits<4> Rn;
954 bits<4> Rm;
955 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000956 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000957 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000958 let Inst{19-16} = Rd;
959 let Inst{11-8} = Rm;
960 let Inst{3-0} = Rn;
961}
962// MSW multiple w/ Ra operand
963class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
964 InstrItinClass itin, string opc, string asm, list<dag> pattern>
965 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
966 bits<4> Ra;
967 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000968}
Evan Cheng37f25d92008-08-28 23:39:26 +0000969
Evan Chengeb4f52e2008-11-06 03:35:07 +0000970// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000971class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000972 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000973 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
974 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000975 bits<4> Rn;
976 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000977 let Inst{4} = 0;
978 let Inst{7} = 1;
979 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000980 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000981 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000982 let Inst{11-8} = Rm;
983 let Inst{3-0} = Rn;
984}
985class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
986 InstrItinClass itin, string opc, string asm, list<dag> pattern>
987 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
988 bits<4> Rd;
989 let Inst{19-16} = Rd;
990}
991
992// AMulxyI with Ra operand
993class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
994 InstrItinClass itin, string opc, string asm, list<dag> pattern>
995 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
996 bits<4> Ra;
997 let Inst{15-12} = Ra;
998}
999// SMLAL*
1000class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
1001 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1002 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
1003 bits<4> RdLo;
1004 bits<4> RdHi;
1005 let Inst{19-16} = RdHi;
1006 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +00001007}
1008
Evan Cheng97f48c32008-11-06 22:15:19 +00001009// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001010class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1011 string opc, string asm, list<dag> pattern>
1012 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
1013 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +00001014 // All AExtI instructions have Rd and Rm register operands.
1015 bits<4> Rd;
1016 bits<4> Rm;
1017 let Inst{15-12} = Rd;
1018 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +00001019 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +00001020 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +00001021 let Inst{27-20} = opcod;
1022}
1023
Evan Cheng8b59db32008-11-07 01:41:35 +00001024// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001025class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
1026 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001027 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1028 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001029 bits<4> Rd;
1030 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +00001031 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001032 let Inst{19-16} = 0b1111;
1033 let Inst{15-12} = Rd;
1034 let Inst{11-8} = 0b1111;
1035 let Inst{7-4} = opc7_4;
1036 let Inst{3-0} = Rm;
1037}
1038
1039// PKH instructions
1040class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
1041 string opc, string asm, list<dag> pattern>
1042 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1043 opc, asm, "", pattern> {
1044 bits<4> Rd;
1045 bits<4> Rn;
1046 bits<4> Rm;
1047 bits<8> sh;
1048 let Inst{27-20} = opcod;
1049 let Inst{19-16} = Rn;
1050 let Inst{15-12} = Rd;
1051 let Inst{11-7} = sh{7-3};
1052 let Inst{6} = tb;
1053 let Inst{5-4} = 0b01;
1054 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +00001055}
1056
Evan Cheng37f25d92008-08-28 23:39:26 +00001057//===----------------------------------------------------------------------===//
1058
1059// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
1060class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
1061 list<Predicate> Predicates = [IsARM];
1062}
1063class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
1064 list<Predicate> Predicates = [IsARM, HasV5TE];
1065}
1066class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
1067 list<Predicate> Predicates = [IsARM, HasV6];
1068}
Evan Cheng13096642008-08-29 06:41:12 +00001069
1070//===----------------------------------------------------------------------===//
1071//
1072// Thumb Instruction Format Definitions.
1073//
1074
Evan Cheng13096642008-08-29 06:41:12 +00001075// TI - Thumb instruction.
1076
Evan Cheng446c4282009-07-11 06:43:01 +00001077class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001078 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001079 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001080 let OutOperandList = oops;
1081 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001082 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +00001083 let Pattern = pattern;
1084 list<Predicate> Predicates = [IsThumb];
1085}
1086
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001087class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1088 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001089
Evan Cheng35d6c412009-08-04 23:47:55 +00001090// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +00001091class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
1092 list<dag> pattern>
1093 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
1094 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +00001095
Johnny Chend68e1192009-12-15 17:24:14 +00001096// tBL, tBX 32-bit instructions
1097class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +00001098 dag oops, dag iops, InstrItinClass itin, string asm,
1099 list<dag> pattern>
1100 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
1101 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +00001102 let Inst{31-27} = opcod1;
1103 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001104 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +00001105}
Evan Cheng13096642008-08-29 06:41:12 +00001106
1107// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +00001108class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1109 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001110 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001111
Evan Cheng09c39fc2009-06-23 19:38:13 +00001112// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +00001113class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001114 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001115 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001116 let OutOperandList = oops;
1117 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001118 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001119 let Pattern = pattern;
1120 list<Predicate> Predicates = [IsThumb1Only];
1121}
1122
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001123class T1I<dag oops, dag iops, InstrItinClass itin,
1124 string asm, list<dag> pattern>
1125 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1126class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1127 string asm, list<dag> pattern>
1128 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1129class T1JTI<dag oops, dag iops, InstrItinClass itin,
1130 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001131 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001132
1133// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001134class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001135 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001136 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001137 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001138
1139// Thumb1 instruction that can either be predicated or set CPSR.
1140class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001141 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001142 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001143 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001144 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1145 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001146 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001147 let Pattern = pattern;
1148 list<Predicate> Predicates = [IsThumb1Only];
1149}
1150
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001151class T1sI<dag oops, dag iops, InstrItinClass itin,
1152 string opc, string asm, list<dag> pattern>
1153 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001154
1155// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001156class T1sIt<dag oops, dag iops, InstrItinClass itin,
1157 string opc, string asm, list<dag> pattern>
1158 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001159 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001160
1161// Thumb1 instruction that can be predicated.
1162class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001163 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001164 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001165 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001166 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001167 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001168 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001169 let Pattern = pattern;
1170 list<Predicate> Predicates = [IsThumb1Only];
1171}
1172
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001173class T1pI<dag oops, dag iops, InstrItinClass itin,
1174 string opc, string asm, list<dag> pattern>
1175 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001176
1177// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001178class T1pIt<dag oops, dag iops, InstrItinClass itin,
1179 string opc, string asm, list<dag> pattern>
1180 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001181 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001182
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001183class T1pI1<dag oops, dag iops, InstrItinClass itin,
1184 string opc, string asm, list<dag> pattern>
1185 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1186class T1pI2<dag oops, dag iops, InstrItinClass itin,
1187 string opc, string asm, list<dag> pattern>
1188 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1189class T1pI4<dag oops, dag iops, InstrItinClass itin,
1190 string opc, string asm, list<dag> pattern>
1191 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001192class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001193 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1194 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001195
Johnny Chenbbc71b22009-12-16 02:32:54 +00001196class Encoding16 : Encoding {
1197 let Inst{31-16} = 0x0000;
1198}
1199
Johnny Chend68e1192009-12-15 17:24:14 +00001200// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001201class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001202 let Inst{15-10} = opcode;
1203}
1204
1205// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001206class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001207 let Inst{15-14} = 0b00;
1208 let Inst{13-9} = opcode;
1209}
1210
1211// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001212class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001213 let Inst{15-10} = 0b010000;
1214 let Inst{9-6} = opcode;
1215}
1216
1217// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001218class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001219 let Inst{15-10} = 0b010001;
1220 let Inst{9-6} = opcode;
1221}
1222
1223// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001224class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001225 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001226 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001227}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001228class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +00001229class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1230class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1231class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +00001232class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001233
1234// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001235class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001236 let Inst{15-12} = 0b1011;
1237 let Inst{11-5} = opcode;
1238}
1239
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001240// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1241class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001242 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001243 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001244 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001245 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001246 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001247 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001248 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001249 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001250}
1251
Bill Wendlingda2ae632010-08-31 07:50:46 +00001252// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1253// input operand since by default it's a zero register. It will become an
1254// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001255//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001256// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1257// more consistent.
1258class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001259 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001260 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001261 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001262 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001263 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001264 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001265 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001266 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001267}
1268
1269// Special cases
1270class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001271 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001272 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001273 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001274 let OutOperandList = oops;
1275 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001276 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001277 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001278 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001279}
1280
Jim Grosbachd1228742009-12-01 18:10:36 +00001281class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001282 InstrItinClass itin,
1283 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001284 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1285 let OutOperandList = oops;
1286 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001287 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001288 let Pattern = pattern;
1289 list<Predicate> Predicates = [IsThumb1Only];
1290}
1291
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001292class T2I<dag oops, dag iops, InstrItinClass itin,
1293 string opc, string asm, list<dag> pattern>
1294 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1295class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1296 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001297 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001298class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1299 string opc, string asm, list<dag> pattern>
1300 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1301class T2Iso<dag oops, dag iops, InstrItinClass itin,
1302 string opc, string asm, list<dag> pattern>
1303 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1304class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1305 string opc, string asm, list<dag> pattern>
1306 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001307class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001308 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001309 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1310 pattern> {
1311 let Inst{31-27} = 0b11101;
1312 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001313 let Inst{24} = P;
1314 let Inst{23} = ?; // The U bit.
1315 let Inst{22} = 1;
1316 let Inst{21} = W;
1317 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001318}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001319
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001320class T2sI<dag oops, dag iops, InstrItinClass itin,
1321 string opc, string asm, list<dag> pattern>
1322 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001323
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001324class T2XI<dag oops, dag iops, InstrItinClass itin,
1325 string asm, list<dag> pattern>
1326 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1327class T2JTI<dag oops, dag iops, InstrItinClass itin,
1328 string asm, list<dag> pattern>
1329 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001330
Evan Cheng5adb66a2009-09-28 09:14:39 +00001331class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001332 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001333 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1334
Bob Wilson815baeb2010-03-13 01:08:20 +00001335// Two-address instructions
1336class T2XIt<dag oops, dag iops, InstrItinClass itin,
1337 string asm, string cstr, list<dag> pattern>
1338 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001339
Evan Chenge88d5ce2009-07-02 07:28:31 +00001340// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001341class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1342 dag oops, dag iops,
1343 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001344 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001345 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001346 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001347 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001348 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001349 let Pattern = pattern;
1350 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001351 let Inst{31-27} = 0b11111;
1352 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001353 let Inst{24} = signed;
1354 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001355 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001356 let Inst{20} = load;
1357 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001358 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001359 let Inst{10} = pre; // The P bit.
1360 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001361}
1362
Johnny Chenadc77332010-02-26 22:04:29 +00001363// Helper class for disassembly only
1364// A6.3.16 & A6.3.17
1365// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1366class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1367 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1368 : T2I<oops, iops, itin, opc, asm, pattern> {
1369 let Inst{31-27} = 0b11111;
1370 let Inst{26-24} = 0b011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001371 let Inst{23} = long;
Johnny Chenadc77332010-02-26 22:04:29 +00001372 let Inst{22-20} = op22_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001373 let Inst{7-4} = op7_4;
Johnny Chenadc77332010-02-26 22:04:29 +00001374}
1375
David Goodwinc9d138f2009-07-27 19:59:26 +00001376// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1377class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1378 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1379}
1380
1381// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1382class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1383 list<Predicate> Predicates = [IsThumb1Only];
1384}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001385
Evan Cheng9cb9e672009-06-27 02:26:13 +00001386// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1387class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001388 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001389}
1390
Evan Cheng13096642008-08-29 06:41:12 +00001391//===----------------------------------------------------------------------===//
1392
Evan Cheng96581d32008-11-11 02:11:05 +00001393//===----------------------------------------------------------------------===//
1394// ARM VFP Instruction templates.
1395//
1396
David Goodwin3ca524e2009-07-10 17:03:29 +00001397// Almost all VFP instructions are predicable.
1398class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001399 IndexMode im, Format f, InstrItinClass itin,
1400 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001401 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001402 bits<4> p;
1403 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001404 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001405 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001406 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001407 let Pattern = pattern;
1408 list<Predicate> Predicates = [HasVFP2];
1409}
1410
1411// Special cases
1412class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001413 IndexMode im, Format f, InstrItinClass itin,
1414 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001415 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001416 let OutOperandList = oops;
1417 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001418 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001419 let Pattern = pattern;
1420 list<Predicate> Predicates = [HasVFP2];
1421}
1422
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001423class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1424 string opc, string asm, list<dag> pattern>
1425 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1426 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001427
Evan Chengcd8e66a2008-11-11 21:48:44 +00001428// ARM VFP addrmode5 loads and stores
1429class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001430 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001431 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001432 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001433 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001434 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001435 let Inst{27-24} = opcod1;
1436 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001437 let Inst{11-9} = 0b101;
1438 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001439
1440 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001441 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001442}
1443
Evan Chengcd8e66a2008-11-11 21:48:44 +00001444class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001445 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001446 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001447 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001448 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001449 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001450 let Inst{27-24} = opcod1;
1451 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001452 let Inst{11-9} = 0b101;
1453 let Inst{8} = 0; // Single precision
Evan Cheng96581d32008-11-11 02:11:05 +00001454}
1455
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001456// VFP Load / store multiple pseudo instructions.
1457class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1458 list<dag> pattern>
1459 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1460 cstr, itin> {
1461 let OutOperandList = oops;
1462 let InOperandList = !con(iops, (ins pred:$p));
1463 let Pattern = pattern;
1464 list<Predicate> Predicates = [HasVFP2];
1465}
1466
Evan Chengcd8e66a2008-11-11 21:48:44 +00001467// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001468class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001469 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001470 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001471 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001472 // TODO: Mark the instructions with the appropriate subtarget info.
1473 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001474 let Inst{11-9} = 0b101;
1475 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001476
1477 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001478 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001479}
1480
Jim Grosbach72db1822010-09-08 00:25:50 +00001481class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001482 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001483 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001484 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001485 // TODO: Mark the instructions with the appropriate subtarget info.
1486 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001487 let Inst{11-9} = 0b101;
1488 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001489}
1490
Evan Cheng96581d32008-11-11 02:11:05 +00001491// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001492class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1493 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1494 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001495 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001496 let Inst{27-23} = opcod1;
1497 let Inst{21-20} = opcod2;
1498 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001499 let Inst{11-9} = 0b101;
1500 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001501 let Inst{7-6} = opcod4;
1502 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001503}
1504
1505// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001506class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001507 dag iops, InstrItinClass itin, string opc, string asm,
1508 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001509 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001510 let Inst{27-23} = opcod1;
1511 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001512 let Inst{11-9} = 0b101;
1513 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001514 let Inst{6} = op6;
1515 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001516}
1517
Jim Grosbach26767372010-03-24 22:31:46 +00001518// Double precision, binary, VML[AS] (for additional predicate)
1519class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1520 dag iops, InstrItinClass itin, string opc, string asm,
1521 list<dag> pattern>
1522 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1523 let Inst{27-23} = opcod1;
1524 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001525 let Inst{11-9} = 0b101;
1526 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001527 let Inst{6} = op6;
1528 let Inst{4} = op4;
Jim Grosbach26767372010-03-24 22:31:46 +00001529 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1530}
1531
Evan Cheng96581d32008-11-11 02:11:05 +00001532// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001533class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1534 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1535 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001536 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001537 let Inst{27-23} = opcod1;
1538 let Inst{21-20} = opcod2;
1539 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001540 let Inst{11-9} = 0b101;
1541 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001542 let Inst{7-6} = opcod4;
1543 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001544}
1545
David Goodwin338268c2009-08-10 22:17:39 +00001546// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001547// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001548class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1549 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1550 string asm, list<dag> pattern>
1551 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1552 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001553 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1554}
1555
Evan Cheng96581d32008-11-11 02:11:05 +00001556// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001557class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1558 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001559 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001560 let Inst{27-23} = opcod1;
1561 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001562 let Inst{11-9} = 0b101;
1563 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001564 let Inst{6} = op6;
1565 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001566}
1567
David Goodwin338268c2009-08-10 22:17:39 +00001568// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001569// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001570class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001571 dag iops, InstrItinClass itin, string opc, string asm,
1572 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001573 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001574 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1575}
1576
Evan Cheng80a11982008-11-12 06:41:41 +00001577// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001578class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1579 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1580 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001581 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001582 let Inst{27-23} = opcod1;
1583 let Inst{21-20} = opcod2;
1584 let Inst{19-16} = opcod3;
1585 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001586 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001587 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001588}
1589
Johnny Chen811663f2010-02-11 18:47:03 +00001590// VFP conversion between floating-point and fixed-point
1591class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001592 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1593 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001594 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1595 // size (fixed-point number): sx == 0 ? 16 : 32
1596 let Inst{7} = op5; // sx
1597}
1598
David Goodwin338268c2009-08-10 22:17:39 +00001599// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001600class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001601 dag oops, dag iops, InstrItinClass itin,
1602 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001603 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1604 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001605 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1606}
1607
Evan Cheng80a11982008-11-12 06:41:41 +00001608class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001609 InstrItinClass itin,
1610 string opc, string asm, list<dag> pattern>
1611 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001612 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001613 let Inst{11-8} = opcod2;
1614 let Inst{4} = 1;
1615}
1616
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001617class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1618 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1619 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001620
Bob Wilson01135592010-03-23 17:23:59 +00001621class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001622 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1623 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001624
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001625class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1626 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1627 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001628
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001629class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1630 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1631 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001632
Evan Cheng96581d32008-11-11 02:11:05 +00001633//===----------------------------------------------------------------------===//
1634
Bob Wilson5bafff32009-06-22 23:27:02 +00001635//===----------------------------------------------------------------------===//
1636// ARM NEON Instruction templates.
1637//
Evan Cheng13096642008-08-29 06:41:12 +00001638
Johnny Chencaa608e2010-03-20 00:17:00 +00001639class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1640 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1641 list<dag> pattern>
1642 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001643 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001644 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001645 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001646 let Pattern = pattern;
1647 list<Predicate> Predicates = [HasNEON];
1648}
1649
1650// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001651class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1652 InstrItinClass itin, string opc, string asm, string cstr,
1653 list<dag> pattern>
1654 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001655 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001656 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001657 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001658 let Pattern = pattern;
1659 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001660}
1661
Bob Wilsonb07c1712009-10-07 21:53:04 +00001662class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1663 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001664 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001665 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1666 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001667 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001668 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001669 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001670 let Inst{11-8} = op11_8;
1671 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001672}
1673
Bob Wilson709d5922010-08-25 23:27:42 +00001674class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1675 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1676 itin> {
1677 let OutOperandList = oops;
1678 let InOperandList = !con(iops, (ins pred:$p));
1679 list<Predicate> Predicates = [HasNEON];
1680}
1681
Jim Grosbach7cd27292010-10-06 20:36:55 +00001682class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1683 list<dag> pattern>
Bob Wilsonbd916c52010-09-13 23:55:10 +00001684 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1685 itin> {
1686 let OutOperandList = oops;
1687 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001688 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001689 list<Predicate> Predicates = [HasNEON];
1690}
1691
Johnny Chen785516a2010-03-23 16:43:47 +00001692class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001693 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001694 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1695 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001696 let Inst{31-25} = 0b1111001;
1697}
1698
Johnny Chen927b88f2010-03-23 20:40:44 +00001699class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001700 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001701 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001702 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001703 let Inst{31-25} = 0b1111001;
1704}
1705
1706// NEON "one register and a modified immediate" format.
1707class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1708 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001709 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001710 string opc, string dt, string asm, string cstr,
1711 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001712 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001713 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001714 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001715 let Inst{11-8} = op11_8;
1716 let Inst{7} = op7;
1717 let Inst{6} = op6;
1718 let Inst{5} = op5;
1719 let Inst{4} = op4;
Owen Andersona88ea032010-10-26 17:40:54 +00001720
1721 // Instruction operands.
1722 bits<5> Vd;
1723 bits<13> SIMM;
1724
1725 let Inst{15-12} = Vd{3-0};
1726 let Inst{22} = Vd{4};
1727 let Inst{24} = SIMM{7};
1728 let Inst{18-16} = SIMM{6-4};
1729 let Inst{3-0} = SIMM{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001730}
1731
1732// NEON 2 vector register format.
1733class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1734 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001735 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001736 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001737 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001738 let Inst{24-23} = op24_23;
1739 let Inst{21-20} = op21_20;
1740 let Inst{19-18} = op19_18;
1741 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001742 let Inst{11-7} = op11_7;
1743 let Inst{6} = op6;
1744 let Inst{4} = op4;
Owen Anderson162875a2010-10-25 18:43:52 +00001745
1746 // Instruction operands.
1747 bits<5> Vd;
1748 bits<5> Vm;
1749
1750 let Inst{15-12} = Vd{3-0};
1751 let Inst{22} = Vd{4};
1752 let Inst{3-0} = Vm{3-0};
1753 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001754}
1755
1756// Same as N2V except it doesn't have a datatype suffix.
1757class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001758 bits<5> op11_7, bit op6, bit op4,
1759 dag oops, dag iops, InstrItinClass itin,
1760 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001761 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001762 let Inst{24-23} = op24_23;
1763 let Inst{21-20} = op21_20;
1764 let Inst{19-18} = op19_18;
1765 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001766 let Inst{11-7} = op11_7;
1767 let Inst{6} = op6;
1768 let Inst{4} = op4;
Owen Anderson162875a2010-10-25 18:43:52 +00001769
1770 // Instruction operands.
1771 bits<5> Vd;
1772 bits<5> Vm;
1773
1774 let Inst{15-12} = Vd{3-0};
1775 let Inst{22} = Vd{4};
1776 let Inst{3-0} = Vm{3-0};
1777 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001778}
1779
1780// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001781class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001782 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001783 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001784 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001785 let Inst{24} = op24;
1786 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001787 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001788 let Inst{7} = op7;
1789 let Inst{6} = op6;
1790 let Inst{4} = op4;
Owen Anderson3557d002010-10-26 20:56:57 +00001791
1792 // Instruction operands.
1793 bits<5> Vd;
1794 bits<5> Vm;
1795 bits<6> SIMM;
1796
1797 let Inst{15-12} = Vd{3-0};
1798 let Inst{22} = Vd{4};
1799 let Inst{3-0} = Vm{3-0};
1800 let Inst{5} = Vm{4};
1801 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001802}
1803
Bob Wilson10bc69c2010-03-27 03:56:52 +00001804// NEON 3 vector register format.
1805class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1806 dag oops, dag iops, Format f, InstrItinClass itin,
1807 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001808 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001809 let Inst{24} = op24;
1810 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001811 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001812 let Inst{11-8} = op11_8;
1813 let Inst{6} = op6;
1814 let Inst{4} = op4;
Owen Andersond451f882010-10-21 20:21:49 +00001815
1816 // Instruction operands.
1817 bits<5> Vd;
1818 bits<5> Vn;
1819 bits<5> Vm;
1820
1821 let Inst{15-12} = Vd{3-0};
1822 let Inst{22} = Vd{4};
1823 let Inst{19-16} = Vn{3-0};
1824 let Inst{7} = Vn{4};
1825 let Inst{3-0} = Vm{3-0};
1826 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001827}
1828
Johnny Chen841e8282010-03-23 21:35:03 +00001829// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001830class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1831 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001832 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001833 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001834 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001835 let Inst{24} = op24;
1836 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001837 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001838 let Inst{11-8} = op11_8;
1839 let Inst{6} = op6;
1840 let Inst{4} = op4;
Owen Anderson8c71eff2010-10-25 18:28:30 +00001841
1842 // Instruction operands.
1843 bits<5> Vd;
1844 bits<5> Vn;
1845 bits<5> Vm;
1846
1847 let Inst{15-12} = Vd{3-0};
1848 let Inst{22} = Vd{4};
1849 let Inst{19-16} = Vn{3-0};
1850 let Inst{7} = Vn{4};
1851 let Inst{3-0} = Vm{3-0};
1852 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001853}
1854
1855// NEON VMOVs between scalar and core registers.
1856class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001857 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001858 string opc, string dt, string asm, list<dag> pattern>
Evan Cheng0e9996c2010-10-26 02:03:05 +00001859 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001860 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001861 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001862 let Inst{11-8} = opcod2;
1863 let Inst{6-5} = opcod3;
1864 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001865
1866 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001867 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001868 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001869 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001870 list<Predicate> Predicates = [HasNEON];
Owen Andersonf587a9352010-10-27 19:25:54 +00001871
Owen Andersond2fbdb72010-10-27 21:28:09 +00001872 bits<5> V;
1873 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001874 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001875 bits<4> lane;
Owen Andersonf587a9352010-10-27 19:25:54 +00001876
1877 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001878 let Inst{7} = V{4};
1879 let Inst{19-16} = V{3-0};
1880 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001881}
1882class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001883 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001884 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001885 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001886 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001887class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001888 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001889 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001890 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001891 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001892class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001893 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001894 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001895 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001896 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001897
Johnny Chene4614f72010-03-25 17:01:27 +00001898// Vector Duplicate Lane (from scalar to all elements)
1899class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1900 InstrItinClass itin, string opc, string dt, string asm,
1901 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001902 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001903 let Inst{24-23} = 0b11;
1904 let Inst{21-20} = 0b11;
1905 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001906 let Inst{11-7} = 0b11000;
1907 let Inst{6} = op6;
1908 let Inst{4} = 0;
Owen Andersonf587a9352010-10-27 19:25:54 +00001909
1910 bits<5> Vd;
1911 bits<5> Vm;
1912 bits<4> lane;
1913
1914 let Inst{22} = Vd{4};
1915 let Inst{15-12} = Vd{3-0};
1916 let Inst{5} = Vm{4};
1917 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001918}
1919
David Goodwin42a83f22009-08-04 17:53:06 +00001920// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1921// for single-precision FP.
1922class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1923 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1924}