blob: 141bc1a1286c35d907b2234338ad906a6efffc62 [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> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000351 bits<4> Rt;
352 bits<4> Rn;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000353 let Inst{27-23} = 0b00011;
354 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000355 let Inst{20} = 1;
Jim Grosbach86875a22010-10-29 19:58:57 +0000356 let Inst{19-16} = Rn;
357 let Inst{15-12} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000358 let Inst{11-0} = 0b111110011111;
359}
360class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
361 string opc, string asm, list<dag> pattern>
362 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
363 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000364 bits<4> Rd;
365 bits<4> Rt;
366 bits<4> Rn;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000367 let Inst{27-23} = 0b00011;
368 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000369 let Inst{20} = 0;
Jim Grosbach86875a22010-10-29 19:58:57 +0000370 let Inst{19-16} = Rn;
371 let Inst{15-12} = Rd;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000372 let Inst{11-4} = 0b11111001;
Jim Grosbach86875a22010-10-29 19:58:57 +0000373 let Inst{3-0} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000374}
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000375class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
376 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, [$Rn]", pattern> {
377 bits<4> Rt;
378 bits<4> Rt2;
379 bits<4> Rn;
380 let Inst{27-23} = 0b00010;
381 let Inst{22} = b;
382 let Inst{21-20} = 0b00;
383 let Inst{19-16} = Rn;
384 let Inst{15-12} = Rt;
385 let Inst{11-4} = 0b00001001;
386 let Inst{3-0} = Rt2;
387}
Jim Grosbach5278eb82009-12-11 01:42:04 +0000388
Evan Cheng0d14fc82008-09-01 01:51:14 +0000389// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000390class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
391 string opc, string asm, list<dag> pattern>
392 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
393 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000394 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000395 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000396}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000397class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
398 string opc, string asm, list<dag> pattern>
399 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
400 opc, asm, "", pattern> {
401 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000402 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000403}
404class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000405 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000406 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000407 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000408 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000409 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000410}
Bob Wilson01135592010-03-23 17:23:59 +0000411class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000412 string opc, string asm, list<dag> pattern>
413 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
414 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000415
Evan Cheng0d14fc82008-09-01 01:51:14 +0000416
417// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000418class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
419 string opc, string asm, list<dag> pattern>
420 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
421 opc, asm, "", pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +0000422 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000423}
Evan Cheng93912732008-09-01 01:27:33 +0000424
425// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000426
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000427// LDR/LDRB/STR/STRB
428class AIldst1<bits<3> op, bit opc22, bit isLd, dag oops, dag iops, AddrMode am,
429 Format f, InstrItinClass itin, string opc, string asm,
430 list<dag> pattern>
Jim Grosbach3e556122010-10-26 22:37:02 +0000431 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
432 "", pattern> {
433 let Inst{27-25} = op;
434 let Inst{24} = 1; // 24 == P
435 // 23 == U
436 let Inst{22} = opc22;
437 let Inst{21} = 0; // 21 == W
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000438 let Inst{20} = isLd;
Jim Grosbach3e556122010-10-26 22:37:02 +0000439}
440// LDRH/LDRSB/LDRSH/LDRD
441class AIldr2<bits<4> op, bit opc22, bit opc20, dag oops, dag iops, AddrMode am,
442 Format f, InstrItinClass itin, string opc, string asm,
443 list<dag> pattern>
444 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
445 "", pattern> {
446 let Inst{27-25} = 0b000;
447 let Inst{24} = 1; // 24 == P
448 // 23 == U
449 let Inst{22} = opc22;
450 let Inst{21} = 0; // 21 == W
451 let Inst{20} = opc20;
452
453 let Inst{7-4} = op;
454}
455
456
457
458
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000459class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
460 string opc, string asm, list<dag> pattern>
461 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
462 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000463 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000464 let Inst{21} = 0; // W bit
465 let Inst{22} = 0; // B bit
466 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000467 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000468}
Bob Wilson01135592010-03-23 17:23:59 +0000469class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000470 string asm, list<dag> pattern>
471 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000472 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000473 let Inst{20} = 1; // L bit
474 let Inst{21} = 0; // W bit
475 let Inst{22} = 0; // B bit
476 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000477 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000478}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000479class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
480 string opc, string asm, list<dag> pattern>
481 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
482 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000483 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000484 let Inst{21} = 0; // W bit
485 let Inst{22} = 1; // B bit
486 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000487 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000488}
Bob Wilson01135592010-03-23 17:23:59 +0000489class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000490 string asm, list<dag> pattern>
491 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000492 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000493 let Inst{20} = 1; // L bit
494 let Inst{21} = 0; // W bit
495 let Inst{22} = 1; // B bit
496 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000497 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000498}
Evan Cheng17222df2008-08-31 19:02:21 +0000499
Evan Cheng93912732008-09-01 01:27:33 +0000500// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000501class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
502 string opc, string asm, list<dag> pattern>
503 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
504 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000505 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000506 let Inst{21} = 0; // W bit
507 let Inst{22} = 0; // B bit
508 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000509 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000510}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000511class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
512 string asm, list<dag> pattern>
513 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000514 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000515 let Inst{20} = 0; // L bit
516 let Inst{21} = 0; // W bit
517 let Inst{22} = 0; // B bit
518 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000519 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000520}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000521class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
522 string opc, string asm, list<dag> pattern>
523 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
524 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000525 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000526 let Inst{21} = 0; // W bit
527 let Inst{22} = 1; // B bit
528 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000529 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000530}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000531class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
532 string asm, list<dag> pattern>
533 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000534 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000535 let Inst{20} = 0; // L bit
536 let Inst{21} = 0; // W bit
537 let Inst{22} = 1; // B bit
538 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000539 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000540}
Evan Cheng93912732008-09-01 01:27:33 +0000541
Evan Cheng840917b2008-09-01 07:00:14 +0000542// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000543class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
544 string opc, string asm, string cstr, list<dag> pattern>
545 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
546 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000547 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000548 let Inst{21} = 1; // W bit
549 let Inst{22} = 0; // B bit
550 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000551 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000552}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000553class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
554 string opc, string asm, string cstr, list<dag> pattern>
555 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
556 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000557 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000558 let Inst{21} = 1; // W bit
559 let Inst{22} = 1; // B bit
560 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000561 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000562}
563
Evan Cheng840917b2008-09-01 07:00:14 +0000564// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000565class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
566 string opc, string asm, string cstr, list<dag> pattern>
567 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
568 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000569 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000570 let Inst{21} = 1; // W bit
571 let Inst{22} = 0; // B bit
572 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000573 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000574}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000575class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
576 string opc, string asm, string cstr, list<dag> pattern>
577 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
578 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000579 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000580 let Inst{21} = 1; // W bit
581 let Inst{22} = 1; // B bit
582 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000583 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000584}
585
Evan Cheng840917b2008-09-01 07:00:14 +0000586// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000587class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
588 string opc, string asm, string cstr, list<dag> pattern>
589 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
590 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000591 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000592 let Inst{21} = 0; // W bit
593 let Inst{22} = 0; // B bit
594 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000595 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000596}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000597class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
598 string opc, string asm, string cstr, list<dag> pattern>
599 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
600 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000601 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000602 let Inst{21} = 0; // W bit
603 let Inst{22} = 1; // B bit
604 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000605 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000606}
607
Evan Cheng840917b2008-09-01 07:00:14 +0000608// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000609class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
610 string opc, string asm, string cstr, list<dag> pattern>
611 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
612 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000613 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000614 let Inst{21} = 0; // W bit
615 let Inst{22} = 0; // B bit
616 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000617 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000618}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000619class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
620 string opc, string asm, string cstr, list<dag> pattern>
621 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
622 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000623 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000624 let Inst{21} = 0; // W bit
625 let Inst{22} = 1; // B bit
626 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000627 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000628}
629
Evan Cheng0d14fc82008-09-01 01:51:14 +0000630// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000631class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000632 string opc, string asm, list<dag> pattern>
633 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
634 opc, asm, "", pattern>;
635class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
636 string asm, list<dag> pattern>
637 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
638 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000639
Evan Cheng840917b2008-09-01 07:00:14 +0000640// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000641class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
642 string opc, string asm, list<dag> pattern>
643 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
644 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000645 let Inst{4} = 1;
646 let Inst{5} = 1; // H bit
647 let Inst{6} = 0; // S bit
648 let Inst{7} = 1;
649 let Inst{20} = 1; // L bit
650 let Inst{21} = 0; // W bit
651 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000652 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000653}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000654class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
655 string asm, list<dag> pattern>
656 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000657 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000658 let Inst{4} = 1;
659 let Inst{5} = 1; // H bit
660 let Inst{6} = 0; // S bit
661 let Inst{7} = 1;
662 let Inst{20} = 1; // L bit
663 let Inst{21} = 0; // W bit
664 let Inst{24} = 1; // P bit
665}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000666class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
667 string opc, string asm, list<dag> pattern>
668 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
669 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000670 let Inst{4} = 1;
671 let Inst{5} = 1; // H bit
672 let Inst{6} = 1; // S bit
673 let Inst{7} = 1;
674 let Inst{20} = 1; // L bit
675 let Inst{21} = 0; // W bit
676 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000677 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000678}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000679class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
680 string asm, list<dag> pattern>
681 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000682 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000683 let Inst{4} = 1;
684 let Inst{5} = 1; // H bit
685 let Inst{6} = 1; // S bit
686 let Inst{7} = 1;
687 let Inst{20} = 1; // L bit
688 let Inst{21} = 0; // W bit
689 let Inst{24} = 1; // P bit
690}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000691class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
692 string opc, string asm, list<dag> pattern>
693 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
694 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000695 let Inst{4} = 1;
696 let Inst{5} = 0; // H bit
697 let Inst{6} = 1; // S bit
698 let Inst{7} = 1;
699 let Inst{20} = 1; // L bit
700 let Inst{21} = 0; // W bit
701 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000702 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000703}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000704class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
705 string asm, list<dag> pattern>
706 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000707 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000708 let Inst{4} = 1;
709 let Inst{5} = 0; // H bit
710 let Inst{6} = 1; // S bit
711 let Inst{7} = 1;
712 let Inst{20} = 1; // L bit
713 let Inst{21} = 0; // W bit
714 let Inst{24} = 1; // P bit
715}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000716class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
717 string opc, string asm, list<dag> pattern>
718 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
719 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000720 let Inst{4} = 1;
721 let Inst{5} = 0; // H bit
722 let Inst{6} = 1; // S bit
723 let Inst{7} = 1;
724 let Inst{20} = 0; // L bit
725 let Inst{21} = 0; // W bit
726 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000727 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000728}
729
730// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000731class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
732 string opc, string asm, list<dag> pattern>
733 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
734 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000735 let Inst{4} = 1;
736 let Inst{5} = 1; // H bit
737 let Inst{6} = 0; // S bit
738 let Inst{7} = 1;
739 let Inst{20} = 0; // L bit
740 let Inst{21} = 0; // W bit
741 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000742 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000743}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000744class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
745 string asm, list<dag> pattern>
746 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000747 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000748 let Inst{4} = 1;
749 let Inst{5} = 1; // H bit
750 let Inst{6} = 0; // S bit
751 let Inst{7} = 1;
752 let Inst{20} = 0; // L bit
753 let Inst{21} = 0; // W bit
754 let Inst{24} = 1; // P bit
755}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000756class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
757 string opc, string asm, list<dag> pattern>
758 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
759 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000760 let Inst{4} = 1;
761 let Inst{5} = 1; // H bit
762 let Inst{6} = 1; // S bit
763 let Inst{7} = 1;
764 let Inst{20} = 0; // L bit
765 let Inst{21} = 0; // W bit
766 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000767 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000768}
769
770// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000771class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
772 string opc, string asm, string cstr, list<dag> pattern>
773 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
774 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000775 let Inst{4} = 1;
776 let Inst{5} = 1; // H bit
777 let Inst{6} = 0; // S bit
778 let Inst{7} = 1;
779 let Inst{20} = 1; // L bit
780 let Inst{21} = 1; // W bit
781 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000782 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000783}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000784class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
785 string opc, string asm, string cstr, list<dag> pattern>
786 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
787 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000788 let Inst{4} = 1;
789 let Inst{5} = 1; // H bit
790 let Inst{6} = 1; // S bit
791 let Inst{7} = 1;
792 let Inst{20} = 1; // L bit
793 let Inst{21} = 1; // W bit
794 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000795 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000796}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000797class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
798 string opc, string asm, string cstr, list<dag> pattern>
799 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
800 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000801 let Inst{4} = 1;
802 let Inst{5} = 0; // H bit
803 let Inst{6} = 1; // S bit
804 let Inst{7} = 1;
805 let Inst{20} = 1; // L bit
806 let Inst{21} = 1; // W bit
807 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000808 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000809}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000810class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
811 string opc, string asm, string cstr, list<dag> pattern>
812 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
813 opc, asm, cstr, pattern> {
814 let Inst{4} = 1;
815 let Inst{5} = 0; // H bit
816 let Inst{6} = 1; // S bit
817 let Inst{7} = 1;
818 let Inst{20} = 0; // L bit
819 let Inst{21} = 1; // W bit
820 let Inst{24} = 1; // P bit
821 let Inst{27-25} = 0b000;
822}
823
Evan Cheng840917b2008-09-01 07:00:14 +0000824
825// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000826class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
827 string opc, string asm, string cstr, list<dag> pattern>
828 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
829 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000830 let Inst{4} = 1;
831 let Inst{5} = 1; // H bit
832 let Inst{6} = 0; // S bit
833 let Inst{7} = 1;
834 let Inst{20} = 0; // L bit
835 let Inst{21} = 1; // W bit
836 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000837 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000838}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000839class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
840 string opc, string asm, string cstr, list<dag> pattern>
841 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
842 opc, asm, cstr, pattern> {
843 let Inst{4} = 1;
844 let Inst{5} = 1; // H bit
845 let Inst{6} = 1; // S bit
846 let Inst{7} = 1;
847 let Inst{20} = 0; // L bit
848 let Inst{21} = 1; // W bit
849 let Inst{24} = 1; // P bit
850 let Inst{27-25} = 0b000;
851}
Evan Cheng840917b2008-09-01 07:00:14 +0000852
853// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000854class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
855 string opc, string asm, string cstr, list<dag> pattern>
856 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
857 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000858 let Inst{4} = 1;
859 let Inst{5} = 1; // H bit
860 let Inst{6} = 0; // S bit
861 let Inst{7} = 1;
862 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000863 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000864 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000865 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000866}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000867class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
868 string opc, string asm, string cstr, list<dag> pattern>
869 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
870 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000871 let Inst{4} = 1;
872 let Inst{5} = 1; // H bit
873 let Inst{6} = 1; // S bit
874 let Inst{7} = 1;
875 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000876 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000877 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000878 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000879}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000880class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
881 string opc, string asm, string cstr, list<dag> pattern>
882 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
883 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000884 let Inst{4} = 1;
885 let Inst{5} = 0; // H bit
886 let Inst{6} = 1; // S bit
887 let Inst{7} = 1;
888 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000889 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000890 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000891 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000892}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000893class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
894 string opc, string asm, string cstr, list<dag> pattern>
895 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
896 opc, asm, cstr, pattern> {
897 let Inst{4} = 1;
898 let Inst{5} = 0; // H bit
899 let Inst{6} = 1; // S bit
900 let Inst{7} = 1;
901 let Inst{20} = 0; // L bit
902 let Inst{21} = 0; // W bit
903 let Inst{24} = 0; // P bit
904 let Inst{27-25} = 0b000;
905}
Evan Cheng840917b2008-09-01 07:00:14 +0000906
907// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000908class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
909 string opc, string asm, string cstr, list<dag> pattern>
910 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
911 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000912 let Inst{4} = 1;
913 let Inst{5} = 1; // H bit
914 let Inst{6} = 0; // S bit
915 let Inst{7} = 1;
916 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000917 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000918 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000919 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000920}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000921class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
922 string opc, string asm, string cstr, list<dag> pattern>
923 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
924 opc, asm, cstr, pattern> {
925 let Inst{4} = 1;
926 let Inst{5} = 1; // H bit
927 let Inst{6} = 1; // S bit
928 let Inst{7} = 1;
929 let Inst{20} = 0; // L bit
930 let Inst{21} = 0; // W bit
931 let Inst{24} = 0; // P bit
932 let Inst{27-25} = 0b000;
933}
Evan Cheng840917b2008-09-01 07:00:14 +0000934
Evan Cheng0d14fc82008-09-01 01:51:14 +0000935// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000936class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000937 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000938 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000939 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000940 let Inst{20} = 1; // L bit
941 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000942 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000943}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000944class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000945 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000946 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000947 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000948 let Inst{20} = 0; // L bit
949 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000950 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000951}
Evan Cheng37f25d92008-08-28 23:39:26 +0000952
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000953// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000954class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
955 string opc, string asm, list<dag> pattern>
956 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
957 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000958 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000959 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000960 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000961}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000962class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
963 string opc, string asm, list<dag> pattern>
964 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
965 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000966 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000967 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000968}
969
970// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000971class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
972 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 Grosbach9463d0e2010-10-22 17:16:17 +0000975 bits<4> Rd;
976 bits<4> Rn;
977 bits<4> Rm;
978 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000979 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000980 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000981 let Inst{19-16} = Rd;
982 let Inst{11-8} = Rm;
983 let Inst{3-0} = Rn;
984}
985// MSW multiple w/ Ra operand
986class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
987 InstrItinClass itin, string opc, string asm, list<dag> pattern>
988 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
989 bits<4> Ra;
990 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000991}
Evan Cheng37f25d92008-08-28 23:39:26 +0000992
Evan Chengeb4f52e2008-11-06 03:35:07 +0000993// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000994class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000995 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000996 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
997 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000998 bits<4> Rn;
999 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +00001000 let Inst{4} = 0;
1001 let Inst{7} = 1;
1002 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +00001003 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +00001004 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +00001005 let Inst{11-8} = Rm;
1006 let Inst{3-0} = Rn;
1007}
1008class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
1009 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1010 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
1011 bits<4> Rd;
1012 let Inst{19-16} = Rd;
1013}
1014
1015// AMulxyI with Ra operand
1016class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
1017 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1018 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
1019 bits<4> Ra;
1020 let Inst{15-12} = Ra;
1021}
1022// SMLAL*
1023class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
1024 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1025 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
1026 bits<4> RdLo;
1027 bits<4> RdHi;
1028 let Inst{19-16} = RdHi;
1029 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +00001030}
1031
Evan Cheng97f48c32008-11-06 22:15:19 +00001032// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001033class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
1034 string opc, string asm, list<dag> pattern>
1035 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
1036 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +00001037 // All AExtI instructions have Rd and Rm register operands.
1038 bits<4> Rd;
1039 bits<4> Rm;
1040 let Inst{15-12} = Rd;
1041 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +00001042 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +00001043 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +00001044 let Inst{27-20} = opcod;
1045}
1046
Evan Cheng8b59db32008-11-07 01:41:35 +00001047// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001048class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
1049 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001050 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1051 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001052 bits<4> Rd;
1053 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +00001054 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +00001055 let Inst{19-16} = 0b1111;
1056 let Inst{15-12} = Rd;
1057 let Inst{11-8} = 0b1111;
1058 let Inst{7-4} = opc7_4;
1059 let Inst{3-0} = Rm;
1060}
1061
1062// PKH instructions
1063class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
1064 string opc, string asm, list<dag> pattern>
1065 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1066 opc, asm, "", pattern> {
1067 bits<4> Rd;
1068 bits<4> Rn;
1069 bits<4> Rm;
1070 bits<8> sh;
1071 let Inst{27-20} = opcod;
1072 let Inst{19-16} = Rn;
1073 let Inst{15-12} = Rd;
1074 let Inst{11-7} = sh{7-3};
1075 let Inst{6} = tb;
1076 let Inst{5-4} = 0b01;
1077 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +00001078}
1079
Evan Cheng37f25d92008-08-28 23:39:26 +00001080//===----------------------------------------------------------------------===//
1081
1082// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
1083class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
1084 list<Predicate> Predicates = [IsARM];
1085}
1086class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
1087 list<Predicate> Predicates = [IsARM, HasV5TE];
1088}
1089class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
1090 list<Predicate> Predicates = [IsARM, HasV6];
1091}
Evan Cheng13096642008-08-29 06:41:12 +00001092
1093//===----------------------------------------------------------------------===//
1094//
1095// Thumb Instruction Format Definitions.
1096//
1097
Evan Cheng13096642008-08-29 06:41:12 +00001098// TI - Thumb instruction.
1099
Evan Cheng446c4282009-07-11 06:43:01 +00001100class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001101 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001102 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001103 let OutOperandList = oops;
1104 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001105 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +00001106 let Pattern = pattern;
1107 list<Predicate> Predicates = [IsThumb];
1108}
1109
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001110class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1111 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001112
Evan Cheng35d6c412009-08-04 23:47:55 +00001113// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +00001114class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
1115 list<dag> pattern>
1116 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
1117 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +00001118
Johnny Chend68e1192009-12-15 17:24:14 +00001119// tBL, tBX 32-bit instructions
1120class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +00001121 dag oops, dag iops, InstrItinClass itin, string asm,
1122 list<dag> pattern>
1123 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
1124 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +00001125 let Inst{31-27} = opcod1;
1126 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001127 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +00001128}
Evan Cheng13096642008-08-29 06:41:12 +00001129
1130// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +00001131class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1132 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001133 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001134
Evan Cheng09c39fc2009-06-23 19:38:13 +00001135// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +00001136class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001137 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001138 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001139 let OutOperandList = oops;
1140 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001141 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001142 let Pattern = pattern;
1143 list<Predicate> Predicates = [IsThumb1Only];
1144}
1145
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001146class T1I<dag oops, dag iops, InstrItinClass itin,
1147 string asm, list<dag> pattern>
1148 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1149class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1150 string asm, list<dag> pattern>
1151 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1152class T1JTI<dag oops, dag iops, InstrItinClass itin,
1153 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001154 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001155
1156// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001157class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001158 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001159 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001160 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001161
1162// Thumb1 instruction that can either be predicated or set CPSR.
1163class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001164 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001165 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001166 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001167 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1168 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001169 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001170 let Pattern = pattern;
1171 list<Predicate> Predicates = [IsThumb1Only];
1172}
1173
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001174class T1sI<dag oops, dag iops, InstrItinClass itin,
1175 string opc, string asm, list<dag> pattern>
1176 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001177
1178// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001179class T1sIt<dag oops, dag iops, InstrItinClass itin,
1180 string opc, string asm, list<dag> pattern>
1181 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001182 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001183
1184// Thumb1 instruction that can be predicated.
1185class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001186 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001187 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001188 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001189 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001190 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001191 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001192 let Pattern = pattern;
1193 list<Predicate> Predicates = [IsThumb1Only];
1194}
1195
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001196class T1pI<dag oops, dag iops, InstrItinClass itin,
1197 string opc, string asm, list<dag> pattern>
1198 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001199
1200// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001201class T1pIt<dag oops, dag iops, InstrItinClass itin,
1202 string opc, string asm, list<dag> pattern>
1203 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001204 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001205
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001206class T1pI1<dag oops, dag iops, InstrItinClass itin,
1207 string opc, string asm, list<dag> pattern>
1208 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1209class T1pI2<dag oops, dag iops, InstrItinClass itin,
1210 string opc, string asm, list<dag> pattern>
1211 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1212class T1pI4<dag oops, dag iops, InstrItinClass itin,
1213 string opc, string asm, list<dag> pattern>
1214 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001215class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001216 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1217 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001218
Johnny Chenbbc71b22009-12-16 02:32:54 +00001219class Encoding16 : Encoding {
1220 let Inst{31-16} = 0x0000;
1221}
1222
Johnny Chend68e1192009-12-15 17:24:14 +00001223// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001224class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001225 let Inst{15-10} = opcode;
1226}
1227
1228// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001229class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001230 let Inst{15-14} = 0b00;
1231 let Inst{13-9} = opcode;
1232}
1233
1234// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001235class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001236 let Inst{15-10} = 0b010000;
1237 let Inst{9-6} = opcode;
1238}
1239
1240// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001241class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001242 let Inst{15-10} = 0b010001;
1243 let Inst{9-6} = opcode;
1244}
1245
1246// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001247class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001248 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001249 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001250}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001251class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +00001252class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1253class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1254class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +00001255class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001256
1257// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001258class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001259 let Inst{15-12} = 0b1011;
1260 let Inst{11-5} = opcode;
1261}
1262
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001263// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1264class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001265 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001266 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001267 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001268 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001269 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001270 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001271 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001272 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001273}
1274
Bill Wendlingda2ae632010-08-31 07:50:46 +00001275// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1276// input operand since by default it's a zero register. It will become an
1277// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001278//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001279// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1280// more consistent.
1281class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001282 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001283 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001284 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001285 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001286 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001287 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001288 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001289 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001290}
1291
1292// Special cases
1293class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001294 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001295 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001296 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001297 let OutOperandList = oops;
1298 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001299 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001300 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001301 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001302}
1303
Jim Grosbachd1228742009-12-01 18:10:36 +00001304class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001305 InstrItinClass itin,
1306 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001307 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1308 let OutOperandList = oops;
1309 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001310 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001311 let Pattern = pattern;
1312 list<Predicate> Predicates = [IsThumb1Only];
1313}
1314
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001315class T2I<dag oops, dag iops, InstrItinClass itin,
1316 string opc, string asm, list<dag> pattern>
1317 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1318class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1319 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001320 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001321class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1322 string opc, string asm, list<dag> pattern>
1323 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1324class T2Iso<dag oops, dag iops, InstrItinClass itin,
1325 string opc, string asm, list<dag> pattern>
1326 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1327class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1328 string opc, string asm, list<dag> pattern>
1329 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001330class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001331 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001332 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1333 pattern> {
1334 let Inst{31-27} = 0b11101;
1335 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001336 let Inst{24} = P;
1337 let Inst{23} = ?; // The U bit.
1338 let Inst{22} = 1;
1339 let Inst{21} = W;
1340 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001341}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001342
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001343class T2sI<dag oops, dag iops, InstrItinClass itin,
1344 string opc, string asm, list<dag> pattern>
1345 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001346
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001347class T2XI<dag oops, dag iops, InstrItinClass itin,
1348 string asm, list<dag> pattern>
1349 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1350class T2JTI<dag oops, dag iops, InstrItinClass itin,
1351 string asm, list<dag> pattern>
1352 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001353
Evan Cheng5adb66a2009-09-28 09:14:39 +00001354class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001355 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001356 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1357
Bob Wilson815baeb2010-03-13 01:08:20 +00001358// Two-address instructions
1359class T2XIt<dag oops, dag iops, InstrItinClass itin,
1360 string asm, string cstr, list<dag> pattern>
1361 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001362
Evan Chenge88d5ce2009-07-02 07:28:31 +00001363// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001364class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1365 dag oops, dag iops,
1366 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001367 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001368 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001369 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001370 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001371 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001372 let Pattern = pattern;
1373 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001374 let Inst{31-27} = 0b11111;
1375 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001376 let Inst{24} = signed;
1377 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001378 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001379 let Inst{20} = load;
1380 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001381 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001382 let Inst{10} = pre; // The P bit.
1383 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001384}
1385
Johnny Chenadc77332010-02-26 22:04:29 +00001386// Helper class for disassembly only
1387// A6.3.16 & A6.3.17
1388// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1389class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1390 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1391 : T2I<oops, iops, itin, opc, asm, pattern> {
1392 let Inst{31-27} = 0b11111;
1393 let Inst{26-24} = 0b011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001394 let Inst{23} = long;
Johnny Chenadc77332010-02-26 22:04:29 +00001395 let Inst{22-20} = op22_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001396 let Inst{7-4} = op7_4;
Johnny Chenadc77332010-02-26 22:04:29 +00001397}
1398
David Goodwinc9d138f2009-07-27 19:59:26 +00001399// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1400class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1401 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1402}
1403
1404// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1405class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1406 list<Predicate> Predicates = [IsThumb1Only];
1407}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001408
Evan Cheng9cb9e672009-06-27 02:26:13 +00001409// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1410class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001411 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001412}
1413
Evan Cheng13096642008-08-29 06:41:12 +00001414//===----------------------------------------------------------------------===//
1415
Evan Cheng96581d32008-11-11 02:11:05 +00001416//===----------------------------------------------------------------------===//
1417// ARM VFP Instruction templates.
1418//
1419
David Goodwin3ca524e2009-07-10 17:03:29 +00001420// Almost all VFP instructions are predicable.
1421class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001422 IndexMode im, Format f, InstrItinClass itin,
1423 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001424 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001425 bits<4> p;
1426 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001427 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001428 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001429 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001430 let Pattern = pattern;
1431 list<Predicate> Predicates = [HasVFP2];
1432}
1433
1434// Special cases
1435class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001436 IndexMode im, Format f, InstrItinClass itin,
1437 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001438 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001439 let OutOperandList = oops;
1440 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001441 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001442 let Pattern = pattern;
1443 list<Predicate> Predicates = [HasVFP2];
1444}
1445
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001446class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1447 string opc, string asm, list<dag> pattern>
1448 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1449 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001450
Evan Chengcd8e66a2008-11-11 21:48:44 +00001451// ARM VFP addrmode5 loads and stores
1452class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001453 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001454 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001455 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001456 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001457 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001458 let Inst{27-24} = opcod1;
1459 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001460 let Inst{11-9} = 0b101;
1461 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001462
1463 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001464 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001465}
1466
Evan Chengcd8e66a2008-11-11 21:48:44 +00001467class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001468 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001469 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001470 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001471 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001472 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001473 let Inst{27-24} = opcod1;
1474 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001475 let Inst{11-9} = 0b101;
1476 let Inst{8} = 0; // Single precision
Evan Cheng96581d32008-11-11 02:11:05 +00001477}
1478
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001479// VFP Load / store multiple pseudo instructions.
1480class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1481 list<dag> pattern>
1482 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1483 cstr, itin> {
1484 let OutOperandList = oops;
1485 let InOperandList = !con(iops, (ins pred:$p));
1486 let Pattern = pattern;
1487 list<Predicate> Predicates = [HasVFP2];
1488}
1489
Evan Chengcd8e66a2008-11-11 21:48:44 +00001490// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001491class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001492 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001493 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001494 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001495 // TODO: Mark the instructions with the appropriate subtarget info.
1496 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001497 let Inst{11-9} = 0b101;
1498 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001499
1500 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001501 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001502}
1503
Jim Grosbach72db1822010-09-08 00:25:50 +00001504class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001505 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001506 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001507 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001508 // TODO: Mark the instructions with the appropriate subtarget info.
1509 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001510 let Inst{11-9} = 0b101;
1511 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001512}
1513
Evan Cheng96581d32008-11-11 02:11:05 +00001514// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001515class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1516 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1517 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001518 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001519 let Inst{27-23} = opcod1;
1520 let Inst{21-20} = opcod2;
1521 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001522 let Inst{11-9} = 0b101;
1523 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001524 let Inst{7-6} = opcod4;
1525 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001526}
1527
1528// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001529class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001530 dag iops, InstrItinClass itin, string opc, string asm,
1531 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001532 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001533 let Inst{27-23} = opcod1;
1534 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001535 let Inst{11-9} = 0b101;
1536 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001537 let Inst{6} = op6;
1538 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001539}
1540
Jim Grosbach26767372010-03-24 22:31:46 +00001541// Double precision, binary, VML[AS] (for additional predicate)
1542class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1543 dag iops, InstrItinClass itin, string opc, string asm,
1544 list<dag> pattern>
1545 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1546 let Inst{27-23} = opcod1;
1547 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001548 let Inst{11-9} = 0b101;
1549 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001550 let Inst{6} = op6;
1551 let Inst{4} = op4;
Jim Grosbach26767372010-03-24 22:31:46 +00001552 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1553}
1554
Evan Cheng96581d32008-11-11 02:11:05 +00001555// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001556class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1557 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1558 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001559 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001560 let Inst{27-23} = opcod1;
1561 let Inst{21-20} = opcod2;
1562 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001563 let Inst{11-9} = 0b101;
1564 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001565 let Inst{7-6} = opcod4;
1566 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001567}
1568
David Goodwin338268c2009-08-10 22:17:39 +00001569// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001570// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001571class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1572 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1573 string asm, list<dag> pattern>
1574 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1575 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001576 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1577}
1578
Evan Cheng96581d32008-11-11 02:11:05 +00001579// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001580class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1581 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001582 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001583 let Inst{27-23} = opcod1;
1584 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001585 let Inst{11-9} = 0b101;
1586 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001587 let Inst{6} = op6;
1588 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001589}
1590
David Goodwin338268c2009-08-10 22:17:39 +00001591// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001592// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001593class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001594 dag iops, InstrItinClass itin, string opc, string asm,
1595 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001596 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001597 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1598}
1599
Evan Cheng80a11982008-11-12 06:41:41 +00001600// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001601class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1602 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1603 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001604 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001605 let Inst{27-23} = opcod1;
1606 let Inst{21-20} = opcod2;
1607 let Inst{19-16} = opcod3;
1608 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001609 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001610 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001611}
1612
Johnny Chen811663f2010-02-11 18:47:03 +00001613// VFP conversion between floating-point and fixed-point
1614class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001615 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1616 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001617 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1618 // size (fixed-point number): sx == 0 ? 16 : 32
1619 let Inst{7} = op5; // sx
1620}
1621
David Goodwin338268c2009-08-10 22:17:39 +00001622// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001623class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001624 dag oops, dag iops, InstrItinClass itin,
1625 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001626 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1627 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001628 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1629}
1630
Evan Cheng80a11982008-11-12 06:41:41 +00001631class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001632 InstrItinClass itin,
1633 string opc, string asm, list<dag> pattern>
1634 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001635 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001636 let Inst{11-8} = opcod2;
1637 let Inst{4} = 1;
1638}
1639
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001640class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1641 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1642 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001643
Bob Wilson01135592010-03-23 17:23:59 +00001644class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001645 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1646 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001647
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001648class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1649 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1650 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001651
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001652class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1653 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1654 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001655
Evan Cheng96581d32008-11-11 02:11:05 +00001656//===----------------------------------------------------------------------===//
1657
Bob Wilson5bafff32009-06-22 23:27:02 +00001658//===----------------------------------------------------------------------===//
1659// ARM NEON Instruction templates.
1660//
Evan Cheng13096642008-08-29 06:41:12 +00001661
Johnny Chencaa608e2010-03-20 00:17:00 +00001662class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1663 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1664 list<dag> pattern>
1665 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001666 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001667 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001668 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001669 let Pattern = pattern;
1670 list<Predicate> Predicates = [HasNEON];
1671}
1672
1673// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001674class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1675 InstrItinClass itin, string opc, string asm, string cstr,
1676 list<dag> pattern>
1677 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001678 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001679 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001680 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001681 let Pattern = pattern;
1682 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001683}
1684
Bob Wilsonb07c1712009-10-07 21:53:04 +00001685class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1686 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001687 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001688 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1689 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001690 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001691 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001692 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001693 let Inst{11-8} = op11_8;
1694 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001695}
1696
Bob Wilson709d5922010-08-25 23:27:42 +00001697class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1698 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1699 itin> {
1700 let OutOperandList = oops;
1701 let InOperandList = !con(iops, (ins pred:$p));
1702 list<Predicate> Predicates = [HasNEON];
1703}
1704
Jim Grosbach7cd27292010-10-06 20:36:55 +00001705class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1706 list<dag> pattern>
Bob Wilsonbd916c52010-09-13 23:55:10 +00001707 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1708 itin> {
1709 let OutOperandList = oops;
1710 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001711 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001712 list<Predicate> Predicates = [HasNEON];
1713}
1714
Johnny Chen785516a2010-03-23 16:43:47 +00001715class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001716 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001717 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1718 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001719 let Inst{31-25} = 0b1111001;
1720}
1721
Johnny Chen927b88f2010-03-23 20:40:44 +00001722class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001723 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001724 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001725 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001726 let Inst{31-25} = 0b1111001;
1727}
1728
1729// NEON "one register and a modified immediate" format.
1730class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1731 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001732 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001733 string opc, string dt, string asm, string cstr,
1734 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001735 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001736 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001737 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001738 let Inst{11-8} = op11_8;
1739 let Inst{7} = op7;
1740 let Inst{6} = op6;
1741 let Inst{5} = op5;
1742 let Inst{4} = op4;
Owen Andersona88ea032010-10-26 17:40:54 +00001743
1744 // Instruction operands.
1745 bits<5> Vd;
1746 bits<13> SIMM;
1747
1748 let Inst{15-12} = Vd{3-0};
1749 let Inst{22} = Vd{4};
1750 let Inst{24} = SIMM{7};
1751 let Inst{18-16} = SIMM{6-4};
1752 let Inst{3-0} = SIMM{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001753}
1754
1755// NEON 2 vector register format.
1756class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1757 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001758 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001759 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001760 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001761 let Inst{24-23} = op24_23;
1762 let Inst{21-20} = op21_20;
1763 let Inst{19-18} = op19_18;
1764 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001765 let Inst{11-7} = op11_7;
1766 let Inst{6} = op6;
1767 let Inst{4} = op4;
Owen Anderson162875a2010-10-25 18:43:52 +00001768
1769 // Instruction operands.
1770 bits<5> Vd;
1771 bits<5> Vm;
1772
1773 let Inst{15-12} = Vd{3-0};
1774 let Inst{22} = Vd{4};
1775 let Inst{3-0} = Vm{3-0};
1776 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001777}
1778
1779// Same as N2V except it doesn't have a datatype suffix.
1780class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001781 bits<5> op11_7, bit op6, bit op4,
1782 dag oops, dag iops, InstrItinClass itin,
1783 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001784 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001785 let Inst{24-23} = op24_23;
1786 let Inst{21-20} = op21_20;
1787 let Inst{19-18} = op19_18;
1788 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001789 let Inst{11-7} = op11_7;
1790 let Inst{6} = op6;
1791 let Inst{4} = op4;
Owen Anderson162875a2010-10-25 18:43:52 +00001792
1793 // Instruction operands.
1794 bits<5> Vd;
1795 bits<5> Vm;
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};
Bob Wilson5bafff32009-06-22 23:27:02 +00001801}
1802
1803// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001804class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001805 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001806 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001807 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001808 let Inst{24} = op24;
1809 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001810 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001811 let Inst{7} = op7;
1812 let Inst{6} = op6;
1813 let Inst{4} = op4;
Owen Anderson3557d002010-10-26 20:56:57 +00001814
1815 // Instruction operands.
1816 bits<5> Vd;
1817 bits<5> Vm;
1818 bits<6> SIMM;
1819
1820 let Inst{15-12} = Vd{3-0};
1821 let Inst{22} = Vd{4};
1822 let Inst{3-0} = Vm{3-0};
1823 let Inst{5} = Vm{4};
1824 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001825}
1826
Bob Wilson10bc69c2010-03-27 03:56:52 +00001827// NEON 3 vector register format.
1828class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1829 dag oops, dag iops, Format f, InstrItinClass itin,
1830 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001831 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001832 let Inst{24} = op24;
1833 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001834 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001835 let Inst{11-8} = op11_8;
1836 let Inst{6} = op6;
1837 let Inst{4} = op4;
Owen Andersond451f882010-10-21 20:21:49 +00001838
1839 // Instruction operands.
1840 bits<5> Vd;
1841 bits<5> Vn;
1842 bits<5> Vm;
1843
1844 let Inst{15-12} = Vd{3-0};
1845 let Inst{22} = Vd{4};
1846 let Inst{19-16} = Vn{3-0};
1847 let Inst{7} = Vn{4};
1848 let Inst{3-0} = Vm{3-0};
1849 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001850}
1851
Johnny Chen841e8282010-03-23 21:35:03 +00001852// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001853class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1854 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001855 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001856 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001857 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001858 let Inst{24} = op24;
1859 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001860 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001861 let Inst{11-8} = op11_8;
1862 let Inst{6} = op6;
1863 let Inst{4} = op4;
Owen Anderson8c71eff2010-10-25 18:28:30 +00001864
1865 // Instruction operands.
1866 bits<5> Vd;
1867 bits<5> Vn;
1868 bits<5> Vm;
1869
1870 let Inst{15-12} = Vd{3-0};
1871 let Inst{22} = Vd{4};
1872 let Inst{19-16} = Vn{3-0};
1873 let Inst{7} = Vn{4};
1874 let Inst{3-0} = Vm{3-0};
1875 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001876}
1877
1878// NEON VMOVs between scalar and core registers.
1879class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001880 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001881 string opc, string dt, string asm, list<dag> pattern>
Evan Cheng0e9996c2010-10-26 02:03:05 +00001882 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001883 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001884 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001885 let Inst{11-8} = opcod2;
1886 let Inst{6-5} = opcod3;
1887 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001888
1889 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001890 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001891 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001892 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001893 list<Predicate> Predicates = [HasNEON];
Owen Andersonf587a9352010-10-27 19:25:54 +00001894
Owen Andersond2fbdb72010-10-27 21:28:09 +00001895 bits<5> V;
1896 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001897 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001898 bits<4> lane;
Owen Andersonf587a9352010-10-27 19:25:54 +00001899
1900 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001901 let Inst{7} = V{4};
1902 let Inst{19-16} = V{3-0};
1903 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001904}
1905class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001906 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001907 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001908 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001909 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001910class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001911 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001912 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001913 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001914 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001915class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001916 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001917 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001918 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001919 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001920
Johnny Chene4614f72010-03-25 17:01:27 +00001921// Vector Duplicate Lane (from scalar to all elements)
1922class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1923 InstrItinClass itin, string opc, string dt, string asm,
1924 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001925 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001926 let Inst{24-23} = 0b11;
1927 let Inst{21-20} = 0b11;
1928 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001929 let Inst{11-7} = 0b11000;
1930 let Inst{6} = op6;
1931 let Inst{4} = 0;
Owen Andersonf587a9352010-10-27 19:25:54 +00001932
1933 bits<5> Vd;
1934 bits<5> Vm;
1935 bits<4> lane;
1936
1937 let Inst{22} = Vd{4};
1938 let Inst{15-12} = Vd{3-0};
1939 let Inst{5} = Vm{4};
1940 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001941}
1942
David Goodwin42a83f22009-08-04 17:53:06 +00001943// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1944// for single-precision FP.
1945class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1946 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1947}