blob: 04c9b0e52af3ec76fd6fc1fc1362267727d0f160 [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))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000157 let 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))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000163 let 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;
Jim Grosbacha30a51b2010-11-19 22:42:55 +0000206
Chris Lattner150d20e2010-10-31 19:22:57 +0000207 // If this is a pseudo instruction, mark it isCodeGenOnly.
208 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson01135592010-03-23 17:23:59 +0000209
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000210 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000211 let TSFlags{4-0} = AM.Value;
212 let TSFlags{7-5} = SZ.Value;
213 let TSFlags{9-8} = IndexModeBits;
214 let TSFlags{15-10} = Form;
215 let TSFlags{16} = isUnaryDataProc;
216 let TSFlags{17} = canXformTo16Bit;
217 let TSFlags{19-18} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000218
Evan Cheng37f25d92008-08-28 23:39:26 +0000219 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000220 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000221}
222
Johnny Chend68e1192009-12-15 17:24:14 +0000223class Encoding {
224 field bits<32> Inst;
225}
226
227class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
228 Format f, Domain d, string cstr, InstrItinClass itin>
229 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
230
231// This Encoding-less class is used by Thumb1 to specify the encoding bits later
232// on by adding flavors to specific instructions.
233class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
234 Format f, Domain d, string cstr, InstrItinClass itin>
235 : InstTemplate<am, sz, im, f, d, cstr, itin>;
236
Jim Grosbach99594eb2010-11-18 01:38:26 +0000237class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Jim Grosbachc6961f12010-11-18 01:20:48 +0000238 // FIXME: This really should derive from InstTemplate instead, as pseudos
239 // don't need encoding information. TableGen doesn't like that
240 // currently. Need to figure out why and fix it.
Bob Wilson01135592010-03-23 17:23:59 +0000241 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000242 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000243 let OutOperandList = oops;
244 let InOperandList = iops;
Evan Cheng37f25d92008-08-28 23:39:26 +0000245 let Pattern = pattern;
246}
247
Jim Grosbach53694262010-11-18 01:15:56 +0000248// PseudoInst that's ARM-mode only.
249class ARMPseudoInst<dag oops, dag iops, InstrItinClass itin,
Jim Grosbach99594eb2010-11-18 01:38:26 +0000250 list<dag> pattern>
251 : PseudoInst<oops, iops, itin, pattern> {
Jim Grosbach056ab102010-11-18 18:01:40 +0000252 // Default these to 4byte size, as they're almost always expanded to a
253 // single instruction. Any exceptions can override the SZ field value.
254 let SZ = Size4Bytes;
Jim Grosbach53694262010-11-18 01:15:56 +0000255 list<Predicate> Predicates = [IsARM];
256}
257
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000258// PseudoInst that's Thumb-mode only.
259class tPseudoInst<dag oops, dag iops, SizeFlagVal sz, InstrItinClass itin,
260 list<dag> pattern>
261 : PseudoInst<oops, iops, itin, pattern> {
262 let SZ = sz;
263 list<Predicate> Predicates = [IsThumb];
264}
Jim Grosbach53694262010-11-18 01:15:56 +0000265
Evan Cheng37f25d92008-08-28 23:39:26 +0000266// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000267class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000268 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000269 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000270 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000271 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000272 bits<4> p;
273 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000274 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000275 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000276 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000277 let Pattern = pattern;
278 list<Predicate> Predicates = [IsARM];
279}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000280
Jim Grosbachf6b28622009-12-14 18:31:20 +0000281// A few are not predicable
282class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000283 IndexMode im, Format f, InstrItinClass itin,
284 string opc, string asm, string cstr,
285 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000286 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
287 let OutOperandList = oops;
288 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000289 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000290 let Pattern = pattern;
291 let isPredicable = 0;
292 list<Predicate> Predicates = [IsARM];
293}
Evan Cheng37f25d92008-08-28 23:39:26 +0000294
Bill Wendling4822bce2010-08-30 01:47:35 +0000295// Same as I except it can optionally modify CPSR. Note it's modeled as an input
296// operand since by default it's a zero register. It will become an implicit def
297// once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000298class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000299 IndexMode im, Format f, InstrItinClass itin,
300 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000301 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000302 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000303 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000304 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000305 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000306 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000307
Evan Cheng37f25d92008-08-28 23:39:26 +0000308 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000309 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000310 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000311 let Pattern = pattern;
312 list<Predicate> Predicates = [IsARM];
313}
314
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000315// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000316class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000317 IndexMode im, Format f, InstrItinClass itin,
318 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000319 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000320 let OutOperandList = oops;
321 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000322 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000323 let Pattern = pattern;
324 list<Predicate> Predicates = [IsARM];
325}
326
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000327class AI<dag oops, dag iops, Format f, InstrItinClass itin,
328 string opc, string asm, list<dag> pattern>
329 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
330 opc, asm, "", pattern>;
331class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
332 string opc, string asm, list<dag> pattern>
333 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
334 opc, asm, "", pattern>;
335class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000336 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000337 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000338 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000339class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000340 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000341 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000342 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000343
344// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000345class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
346 string opc, string asm, list<dag> pattern>
347 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
348 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000349 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000350}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000351class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
352 string asm, list<dag> pattern>
353 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
354 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000355 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000356}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000357class ABXIx2<dag oops, dag iops, InstrItinClass itin,
358 string asm, list<dag> pattern>
Xerxes Ranby99ccffe2010-07-22 17:28:34 +0000359 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000360 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000361
362// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000363class JTI<dag oops, dag iops, InstrItinClass itin,
364 string asm, list<dag> pattern>
365 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000366 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000367
Jim Grosbach5278eb82009-12-11 01:42:04 +0000368// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000369class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
370 string opc, string asm, list<dag> pattern>
371 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
372 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000373 bits<4> Rt;
374 bits<4> Rn;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000375 let Inst{27-23} = 0b00011;
376 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000377 let Inst{20} = 1;
Jim Grosbach86875a22010-10-29 19:58:57 +0000378 let Inst{19-16} = Rn;
379 let Inst{15-12} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000380 let Inst{11-0} = 0b111110011111;
381}
382class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
383 string opc, string asm, list<dag> pattern>
384 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
385 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000386 bits<4> Rd;
387 bits<4> Rt;
388 bits<4> Rn;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000389 let Inst{27-23} = 0b00011;
390 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000391 let Inst{20} = 0;
Jim Grosbach86875a22010-10-29 19:58:57 +0000392 let Inst{19-16} = Rn;
393 let Inst{15-12} = Rd;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000394 let Inst{11-4} = 0b11111001;
Jim Grosbach86875a22010-10-29 19:58:57 +0000395 let Inst{3-0} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000396}
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000397class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
398 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, [$Rn]", pattern> {
399 bits<4> Rt;
400 bits<4> Rt2;
401 bits<4> Rn;
402 let Inst{27-23} = 0b00010;
403 let Inst{22} = b;
404 let Inst{21-20} = 0b00;
405 let Inst{19-16} = Rn;
406 let Inst{15-12} = Rt;
407 let Inst{11-4} = 0b00001001;
408 let Inst{3-0} = Rt2;
409}
Jim Grosbach5278eb82009-12-11 01:42:04 +0000410
Evan Cheng0d14fc82008-09-01 01:51:14 +0000411// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000412class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
413 string opc, string asm, list<dag> pattern>
414 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
415 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000416 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000417 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000418}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000419class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
420 string opc, string asm, list<dag> pattern>
421 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
422 opc, asm, "", pattern> {
423 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000424 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000425}
426class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000427 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000428 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000429 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000430 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000431 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000432}
Bob Wilson01135592010-03-23 17:23:59 +0000433class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000434 string opc, string asm, list<dag> pattern>
435 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
436 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000437
Evan Cheng0d14fc82008-09-01 01:51:14 +0000438
Evan Cheng93912732008-09-01 01:27:33 +0000439// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000440
Jim Grosbach9558b4c2010-11-19 21:07:51 +0000441// LDR/LDRB/STR/STRB/...
442class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000443 Format f, InstrItinClass itin, string opc, string asm,
444 list<dag> pattern>
Jim Grosbach3e556122010-10-26 22:37:02 +0000445 : I<oops, iops, am, Size4Bytes, IndexModeNone, f, itin, opc, asm,
446 "", pattern> {
447 let Inst{27-25} = op;
448 let Inst{24} = 1; // 24 == P
449 // 23 == U
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000450 let Inst{22} = isByte;
Jim Grosbach3e556122010-10-26 22:37:02 +0000451 let Inst{21} = 0; // 21 == W
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000452 let Inst{20} = isLd;
Jim Grosbach3e556122010-10-26 22:37:02 +0000453}
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000454// Indexed load/stores
455class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000456 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000457 string asm, string cstr, list<dag> pattern>
458 : I<oops, iops, AddrMode2, Size4Bytes, im, f, itin,
459 opc, asm, cstr, pattern> {
Jim Grosbach99f53d12010-11-15 20:47:07 +0000460 bits<4> Rt;
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000461 let Inst{27-26} = 0b01;
462 let Inst{24} = isPre; // P bit
463 let Inst{22} = isByte; // B bit
464 let Inst{21} = isPre; // W bit
465 let Inst{20} = isLd; // L bit
Jim Grosbach99f53d12010-11-15 20:47:07 +0000466 let Inst{15-12} = Rt;
Jim Grosbach3e556122010-10-26 22:37:02 +0000467}
Jim Grosbach953557f42010-11-19 21:35:06 +0000468class AI2stridx<bit isByte, bit isPre, dag oops, dag iops,
469 IndexMode im, Format f, InstrItinClass itin, string opc,
470 string asm, string cstr, list<dag> pattern>
471 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
472 pattern> {
473 // AM2 store w/ two operands: (GPR, am2offset)
474 // {13} 1 == Rm, 0 == imm12
475 // {12} isAdd
476 // {11-0} imm12/Rm
477 bits<14> offset;
478 bits<4> Rn;
479 let Inst{25} = offset{13};
480 let Inst{23} = offset{12};
481 let Inst{19-16} = Rn;
482 let Inst{11-0} = offset{11-0};
483}
Jim Grosbach3e556122010-10-26 22:37:02 +0000484
Evan Cheng0d14fc82008-09-01 01:51:14 +0000485// addrmode3 instructions
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000486class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
487 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Jim Grosbach160f8f02010-11-18 00:46:58 +0000488 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
489 opc, asm, "", pattern> {
490 bits<14> addr;
491 bits<4> Rt;
492 let Inst{27-25} = 0b000;
493 let Inst{24} = 1; // P bit
494 let Inst{23} = addr{8}; // U bit
495 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
496 let Inst{21} = 0; // W bit
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000497 let Inst{20} = op20; // L bit
Jim Grosbach160f8f02010-11-18 00:46:58 +0000498 let Inst{19-16} = addr{12-9}; // Rn
499 let Inst{15-12} = Rt; // Rt
500 let Inst{11-8} = addr{7-4}; // imm7_4/zero
501 let Inst{7-4} = op;
502 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
503}
Evan Cheng840917b2008-09-01 07:00:14 +0000504
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000505class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
506 IndexMode im, Format f, InstrItinClass itin, string opc,
507 string asm, string cstr, list<dag> pattern>
508 : I<oops, iops, AddrMode3, Size4Bytes, im, f, itin,
509 opc, asm, cstr, pattern> {
510 bits<4> Rt;
511 let Inst{27-25} = 0b000;
512 let Inst{24} = isPre; // P bit
513 let Inst{21} = isPre; // W bit
514 let Inst{20} = op20; // L bit
515 let Inst{15-12} = Rt; // Rt
516 let Inst{7-4} = op;
517}
Jim Grosbach2dc77682010-11-29 18:37:44 +0000518class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
519 IndexMode im, Format f, InstrItinClass itin, string opc,
520 string asm, string cstr, list<dag> pattern>
521 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
522 pattern> {
523 // AM3 store w/ two operands: (GPR, am3offset)
524 bits<14> offset;
525 bits<4> Rt;
526 bits<4> Rn;
527 let Inst{27-25} = 0b000;
528 let Inst{23} = offset{8};
529 let Inst{22} = offset{9};
530 let Inst{19-16} = Rn;
531 let Inst{15-12} = Rt; // Rt
532 let Inst{11-8} = offset{7-4}; // imm7_4/zero
533 let Inst{7-4} = op;
534 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
535}
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000536
Evan Cheng840917b2008-09-01 07:00:14 +0000537// stores
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000538class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000539 string opc, string asm, list<dag> pattern>
540 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
541 opc, asm, "", pattern> {
Jim Grosbach570a9222010-11-11 01:09:40 +0000542 bits<14> addr;
543 bits<4> Rt;
Evan Chengdda0f4c2009-07-08 22:51:32 +0000544 let Inst{27-25} = 0b000;
Jim Grosbach570a9222010-11-11 01:09:40 +0000545 let Inst{24} = 1; // P bit
546 let Inst{23} = addr{8}; // U bit
547 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
548 let Inst{21} = 0; // W bit
549 let Inst{20} = 0; // L bit
550 let Inst{19-16} = addr{12-9}; // Rn
551 let Inst{15-12} = Rt; // Rt
552 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000553 let Inst{7-4} = op;
Jim Grosbach570a9222010-11-11 01:09:40 +0000554 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng840917b2008-09-01 07:00:14 +0000555}
Evan Cheng840917b2008-09-01 07:00:14 +0000556
Evan Cheng840917b2008-09-01 07:00:14 +0000557// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000558class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
559 string opc, string asm, string cstr, list<dag> pattern>
560 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
561 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000562 let Inst{4} = 1;
563 let Inst{5} = 1; // H bit
564 let Inst{6} = 0; // S bit
565 let Inst{7} = 1;
566 let Inst{20} = 0; // L bit
567 let Inst{21} = 1; // W bit
568 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000569 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000570}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000571class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
572 string opc, string asm, string cstr, list<dag> pattern>
573 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
574 opc, asm, cstr, pattern> {
575 let Inst{4} = 1;
576 let Inst{5} = 1; // H bit
577 let Inst{6} = 1; // S bit
578 let Inst{7} = 1;
579 let Inst{20} = 0; // L bit
580 let Inst{21} = 1; // W bit
581 let Inst{24} = 1; // P bit
582 let Inst{27-25} = 0b000;
583}
Evan Cheng840917b2008-09-01 07:00:14 +0000584
Evan Cheng840917b2008-09-01 07:00:14 +0000585// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000586class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
587 string opc, string asm, string cstr, list<dag> pattern>
588 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
589 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000590 let Inst{4} = 1;
591 let Inst{5} = 1; // H bit
592 let Inst{6} = 0; // S bit
593 let Inst{7} = 1;
594 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000595 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000596 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000597 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000598}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000599class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
600 string opc, string asm, string cstr, list<dag> pattern>
601 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
602 opc, asm, cstr, pattern> {
603 let Inst{4} = 1;
604 let Inst{5} = 1; // H bit
605 let Inst{6} = 1; // S bit
606 let Inst{7} = 1;
607 let Inst{20} = 0; // L bit
608 let Inst{21} = 0; // W bit
609 let Inst{24} = 0; // P bit
610 let Inst{27-25} = 0b000;
611}
Evan Cheng840917b2008-09-01 07:00:14 +0000612
Evan Cheng0d14fc82008-09-01 01:51:14 +0000613// addrmode4 instructions
Bill Wendling6c470b82010-11-13 09:09:38 +0000614class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
615 string asm, string cstr, list<dag> pattern>
616 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin, asm, cstr, pattern> {
617 bits<4> p;
618 bits<16> regs;
619 bits<4> Rn;
620 let Inst{31-28} = p;
621 let Inst{27-25} = 0b100;
622 let Inst{22} = 0; // S bit
623 let Inst{19-16} = Rn;
624 let Inst{15-0} = regs;
625}
Evan Cheng37f25d92008-08-28 23:39:26 +0000626
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000627// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000628class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
629 string opc, string asm, list<dag> pattern>
630 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
631 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000632 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000633 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000634 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000635}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000636class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
637 string opc, string asm, list<dag> pattern>
638 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
639 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000640 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000641 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000642}
643
644// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000645class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
646 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000647 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
648 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000649 bits<4> Rd;
650 bits<4> Rn;
651 bits<4> Rm;
652 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000653 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000654 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000655 let Inst{19-16} = Rd;
656 let Inst{11-8} = Rm;
657 let Inst{3-0} = Rn;
658}
659// MSW multiple w/ Ra operand
660class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
661 InstrItinClass itin, string opc, string asm, list<dag> pattern>
662 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
663 bits<4> Ra;
664 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000665}
Evan Cheng37f25d92008-08-28 23:39:26 +0000666
Evan Chengeb4f52e2008-11-06 03:35:07 +0000667// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000668class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000669 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000670 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
671 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000672 bits<4> Rn;
673 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000674 let Inst{4} = 0;
675 let Inst{7} = 1;
676 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000677 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000678 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000679 let Inst{11-8} = Rm;
680 let Inst{3-0} = Rn;
681}
682class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
683 InstrItinClass itin, string opc, string asm, list<dag> pattern>
684 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
685 bits<4> Rd;
686 let Inst{19-16} = Rd;
687}
688
689// AMulxyI with Ra operand
690class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
691 InstrItinClass itin, string opc, string asm, list<dag> pattern>
692 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
693 bits<4> Ra;
694 let Inst{15-12} = Ra;
695}
696// SMLAL*
697class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
698 InstrItinClass itin, string opc, string asm, list<dag> pattern>
699 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
700 bits<4> RdLo;
701 bits<4> RdHi;
702 let Inst{19-16} = RdHi;
703 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000704}
705
Evan Cheng97f48c32008-11-06 22:15:19 +0000706// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000707class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
708 string opc, string asm, list<dag> pattern>
709 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
710 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000711 // All AExtI instructions have Rd and Rm register operands.
712 bits<4> Rd;
713 bits<4> Rm;
714 let Inst{15-12} = Rd;
715 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000716 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000717 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000718 let Inst{27-20} = opcod;
719}
720
Evan Cheng8b59db32008-11-07 01:41:35 +0000721// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000722class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
723 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000724 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
725 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000726 bits<4> Rd;
727 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000728 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000729 let Inst{19-16} = 0b1111;
730 let Inst{15-12} = Rd;
731 let Inst{11-8} = 0b1111;
732 let Inst{7-4} = opc7_4;
733 let Inst{3-0} = Rm;
734}
735
736// PKH instructions
737class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
738 string opc, string asm, list<dag> pattern>
739 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
740 opc, asm, "", pattern> {
741 bits<4> Rd;
742 bits<4> Rn;
743 bits<4> Rm;
744 bits<8> sh;
745 let Inst{27-20} = opcod;
746 let Inst{19-16} = Rn;
747 let Inst{15-12} = Rd;
748 let Inst{11-7} = sh{7-3};
749 let Inst{6} = tb;
750 let Inst{5-4} = 0b01;
751 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000752}
753
Evan Cheng37f25d92008-08-28 23:39:26 +0000754//===----------------------------------------------------------------------===//
755
756// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
757class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
758 list<Predicate> Predicates = [IsARM];
759}
760class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
761 list<Predicate> Predicates = [IsARM, HasV5TE];
762}
763class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
764 list<Predicate> Predicates = [IsARM, HasV6];
765}
Evan Cheng13096642008-08-29 06:41:12 +0000766
767//===----------------------------------------------------------------------===//
768//
769// Thumb Instruction Format Definitions.
770//
771
Evan Cheng13096642008-08-29 06:41:12 +0000772// TI - Thumb instruction.
773
Evan Cheng446c4282009-07-11 06:43:01 +0000774class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000775 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000776 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000777 let OutOperandList = oops;
778 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000779 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000780 let Pattern = pattern;
781 list<Predicate> Predicates = [IsThumb];
782}
783
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000784class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
785 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000786
Evan Cheng35d6c412009-08-04 23:47:55 +0000787// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000788class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
789 list<dag> pattern>
790 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
791 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000792
Johnny Chend68e1192009-12-15 17:24:14 +0000793// tBL, tBX 32-bit instructions
794class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000795 dag oops, dag iops, InstrItinClass itin, string asm,
796 list<dag> pattern>
797 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
798 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000799 let Inst{31-27} = opcod1;
800 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000801 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000802}
Evan Cheng13096642008-08-29 06:41:12 +0000803
804// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000805class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
806 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000807 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000808
Evan Cheng09c39fc2009-06-23 19:38:13 +0000809// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000810class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000811 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000812 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000813 let OutOperandList = oops;
814 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000815 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000816 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000817 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng09c39fc2009-06-23 19:38:13 +0000818}
819
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000820class T1I<dag oops, dag iops, InstrItinClass itin,
821 string asm, list<dag> pattern>
822 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
823class T1Ix2<dag oops, dag iops, InstrItinClass itin,
824 string asm, list<dag> pattern>
825 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000826
827// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000828class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000829 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000830 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000831 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000832
833// Thumb1 instruction that can either be predicated or set CPSR.
834class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000835 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000836 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000837 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +0000838 let OutOperandList = !con(oops, (outs s_cc_out:$s));
839 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000840 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000841 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000842 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000843}
844
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000845class T1sI<dag oops, dag iops, InstrItinClass itin,
846 string opc, string asm, list<dag> pattern>
847 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000848
849// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000850class T1sIt<dag oops, dag iops, InstrItinClass itin,
851 string opc, string asm, list<dag> pattern>
852 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +0000853 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000854
855// Thumb1 instruction that can be predicated.
856class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000857 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000858 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000859 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000860 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000861 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000862 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000863 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000864 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000865}
866
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000867class T1pI<dag oops, dag iops, InstrItinClass itin,
868 string opc, string asm, list<dag> pattern>
869 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000870
871// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000872class T1pIt<dag oops, dag iops, InstrItinClass itin,
873 string opc, string asm, list<dag> pattern>
874 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +0000875 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000876
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000877class T1pI1<dag oops, dag iops, InstrItinClass itin,
878 string opc, string asm, list<dag> pattern>
879 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
880class T1pI2<dag oops, dag iops, InstrItinClass itin,
881 string opc, string asm, list<dag> pattern>
882 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
883class T1pI4<dag oops, dag iops, InstrItinClass itin,
884 string opc, string asm, list<dag> pattern>
885 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +0000886class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000887 InstrItinClass itin, string opc, string asm, list<dag> pattern>
888 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000889
Johnny Chenbbc71b22009-12-16 02:32:54 +0000890class Encoding16 : Encoding {
891 let Inst{31-16} = 0x0000;
892}
893
Johnny Chend68e1192009-12-15 17:24:14 +0000894// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +0000895class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000896 let Inst{15-10} = opcode;
897}
898
899// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000900class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000901 let Inst{15-14} = 0b00;
902 let Inst{13-9} = opcode;
903}
904
905// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000906class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000907 let Inst{15-10} = 0b010000;
908 let Inst{9-6} = opcode;
909}
910
911// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000912class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000913 let Inst{15-10} = 0b010001;
Bill Wendling6bc105a2010-11-17 00:45:23 +0000914 let Inst{9-6} = opcode;
Johnny Chend68e1192009-12-15 17:24:14 +0000915}
916
917// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000918class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000919 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000920 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +0000921}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000922class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +0000923class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
924class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
925class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +0000926class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +0000927
928// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000929class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000930 let Inst{15-12} = 0b1011;
931 let Inst{11-5} = opcode;
932}
933
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000934// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
935class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000936 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000937 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000938 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000939 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000940 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000941 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000942 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +0000943 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000944}
945
Bill Wendlingda2ae632010-08-31 07:50:46 +0000946// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
947// input operand since by default it's a zero register. It will become an
948// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +0000949//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000950// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
951// more consistent.
952class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000953 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000954 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000955 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000956 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000957 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +0000958 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000959 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +0000960 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000961}
962
963// Special cases
964class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000965 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000966 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000967 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +0000968 let OutOperandList = oops;
969 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000970 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +0000971 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +0000972 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +0000973}
974
Jim Grosbachd1228742009-12-01 18:10:36 +0000975class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000976 InstrItinClass itin,
977 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +0000978 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
979 let OutOperandList = oops;
980 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000981 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +0000982 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000983 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Jim Grosbachd1228742009-12-01 18:10:36 +0000984}
985
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000986class T2I<dag oops, dag iops, InstrItinClass itin,
987 string opc, string asm, list<dag> pattern>
988 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
989class T2Ii12<dag oops, dag iops, InstrItinClass itin,
990 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000991 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000992class T2Ii8<dag oops, dag iops, InstrItinClass itin,
993 string opc, string asm, list<dag> pattern>
994 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
995class T2Iso<dag oops, dag iops, InstrItinClass itin,
996 string opc, string asm, list<dag> pattern>
997 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
998class T2Ipc<dag oops, dag iops, InstrItinClass itin,
999 string opc, string asm, list<dag> pattern>
1000 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001001class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001002 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001003 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1004 pattern> {
1005 let Inst{31-27} = 0b11101;
1006 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001007 let Inst{24} = P;
1008 let Inst{23} = ?; // The U bit.
1009 let Inst{22} = 1;
1010 let Inst{21} = W;
1011 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001012}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001013
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001014class T2sI<dag oops, dag iops, InstrItinClass itin,
1015 string opc, string asm, list<dag> pattern>
1016 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001017
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001018class T2XI<dag oops, dag iops, InstrItinClass itin,
1019 string asm, list<dag> pattern>
1020 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1021class T2JTI<dag oops, dag iops, InstrItinClass itin,
1022 string asm, list<dag> pattern>
1023 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001024
Evan Cheng5adb66a2009-09-28 09:14:39 +00001025class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001026 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001027 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1028
Bob Wilson815baeb2010-03-13 01:08:20 +00001029// Two-address instructions
1030class T2XIt<dag oops, dag iops, InstrItinClass itin,
1031 string asm, string cstr, list<dag> pattern>
1032 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001033
Evan Chenge88d5ce2009-07-02 07:28:31 +00001034// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001035class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1036 dag oops, dag iops,
1037 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001038 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001039 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001040 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001041 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001042 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001043 let Pattern = pattern;
1044 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001045 let Inst{31-27} = 0b11111;
1046 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001047 let Inst{24} = signed;
1048 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001049 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001050 let Inst{20} = load;
1051 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001052 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001053 let Inst{10} = pre; // The P bit.
1054 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001055}
1056
David Goodwinc9d138f2009-07-27 19:59:26 +00001057// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1058class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001059 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwinc9d138f2009-07-27 19:59:26 +00001060}
1061
1062// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1063class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001064 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwinc9d138f2009-07-27 19:59:26 +00001065}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001066
Evan Cheng9cb9e672009-06-27 02:26:13 +00001067// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1068class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001069 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001070}
1071
Evan Cheng13096642008-08-29 06:41:12 +00001072//===----------------------------------------------------------------------===//
1073
Evan Cheng96581d32008-11-11 02:11:05 +00001074//===----------------------------------------------------------------------===//
1075// ARM VFP Instruction templates.
1076//
1077
David Goodwin3ca524e2009-07-10 17:03:29 +00001078// Almost all VFP instructions are predicable.
1079class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001080 IndexMode im, Format f, InstrItinClass itin,
1081 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001082 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001083 bits<4> p;
1084 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001085 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001086 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001087 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001088 let Pattern = pattern;
1089 list<Predicate> Predicates = [HasVFP2];
1090}
1091
1092// Special cases
1093class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001094 IndexMode im, Format f, InstrItinClass itin,
1095 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001096 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001097 bits<4> p;
1098 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001099 let OutOperandList = oops;
1100 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001101 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001102 let Pattern = pattern;
1103 list<Predicate> Predicates = [HasVFP2];
1104}
1105
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001106class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1107 string opc, string asm, list<dag> pattern>
1108 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1109 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001110
Evan Chengcd8e66a2008-11-11 21:48:44 +00001111// ARM VFP addrmode5 loads and stores
1112class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001113 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001114 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001115 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001116 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001117 // Instruction operands.
1118 bits<5> Dd;
1119 bits<13> addr;
1120
1121 // Encode instruction operands.
1122 let Inst{23} = addr{8}; // U (add = (U == '1'))
1123 let Inst{22} = Dd{4};
1124 let Inst{19-16} = addr{12-9}; // Rn
1125 let Inst{15-12} = Dd{3-0};
1126 let Inst{7-0} = addr{7-0}; // imm8
1127
Evan Cheng96581d32008-11-11 02:11:05 +00001128 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001129 let Inst{27-24} = opcod1;
1130 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001131 let Inst{11-9} = 0b101;
1132 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001133
1134 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001135 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001136}
1137
Evan Chengcd8e66a2008-11-11 21:48:44 +00001138class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001139 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001140 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001141 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001142 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001143 // Instruction operands.
1144 bits<5> Sd;
1145 bits<13> addr;
1146
1147 // Encode instruction operands.
1148 let Inst{23} = addr{8}; // U (add = (U == '1'))
1149 let Inst{22} = Sd{0};
1150 let Inst{19-16} = addr{12-9}; // Rn
1151 let Inst{15-12} = Sd{4-1};
1152 let Inst{7-0} = addr{7-0}; // imm8
1153
Evan Cheng96581d32008-11-11 02:11:05 +00001154 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001155 let Inst{27-24} = opcod1;
1156 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001157 let Inst{11-9} = 0b101;
1158 let Inst{8} = 0; // Single precision
Evan Cheng96581d32008-11-11 02:11:05 +00001159}
1160
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001161// VFP Load / store multiple pseudo instructions.
1162class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1163 list<dag> pattern>
1164 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1165 cstr, itin> {
1166 let OutOperandList = oops;
1167 let InOperandList = !con(iops, (ins pred:$p));
1168 let Pattern = pattern;
1169 list<Predicate> Predicates = [HasVFP2];
1170}
1171
Evan Chengcd8e66a2008-11-11 21:48:44 +00001172// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001173class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001174 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001175 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001176 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001177 // Instruction operands.
1178 bits<4> Rn;
1179 bits<13> regs;
1180
1181 // Encode instruction operands.
1182 let Inst{19-16} = Rn;
1183 let Inst{22} = regs{12};
1184 let Inst{15-12} = regs{11-8};
1185 let Inst{7-0} = regs{7-0};
1186
Evan Chengcd8e66a2008-11-11 21:48:44 +00001187 // TODO: Mark the instructions with the appropriate subtarget info.
1188 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001189 let Inst{11-9} = 0b101;
1190 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001191
1192 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001193 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001194}
1195
Jim Grosbach72db1822010-09-08 00:25:50 +00001196class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001197 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001198 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001199 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001200 // Instruction operands.
1201 bits<4> Rn;
1202 bits<13> regs;
1203
1204 // Encode instruction operands.
1205 let Inst{19-16} = Rn;
1206 let Inst{22} = regs{8};
1207 let Inst{15-12} = regs{12-9};
1208 let Inst{7-0} = regs{7-0};
1209
Evan Chengcd8e66a2008-11-11 21:48:44 +00001210 // TODO: Mark the instructions with the appropriate subtarget info.
1211 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001212 let Inst{11-9} = 0b101;
1213 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001214}
1215
Evan Cheng96581d32008-11-11 02:11:05 +00001216// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001217class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1218 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1219 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001220 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001221 // Instruction operands.
1222 bits<5> Dd;
1223 bits<5> Dm;
1224
1225 // Encode instruction operands.
1226 let Inst{3-0} = Dm{3-0};
1227 let Inst{5} = Dm{4};
1228 let Inst{15-12} = Dd{3-0};
1229 let Inst{22} = Dd{4};
1230
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001231 let Inst{27-23} = opcod1;
1232 let Inst{21-20} = opcod2;
1233 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001234 let Inst{11-9} = 0b101;
1235 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001236 let Inst{7-6} = opcod4;
1237 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001238}
1239
1240// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001241class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001242 dag iops, InstrItinClass itin, string opc, string asm,
1243 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001244 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001245 // Instruction operands.
1246 bits<5> Dd;
1247 bits<5> Dn;
1248 bits<5> Dm;
1249
1250 // Encode instruction operands.
1251 let Inst{3-0} = Dm{3-0};
1252 let Inst{5} = Dm{4};
1253 let Inst{19-16} = Dn{3-0};
1254 let Inst{7} = Dn{4};
1255 let Inst{15-12} = Dd{3-0};
1256 let Inst{22} = Dd{4};
1257
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001258 let Inst{27-23} = opcod1;
1259 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001260 let Inst{11-9} = 0b101;
1261 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001262 let Inst{6} = op6;
1263 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001264}
1265
1266// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001267class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1268 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1269 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001270 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001271 // Instruction operands.
1272 bits<5> Sd;
1273 bits<5> Sm;
1274
1275 // Encode instruction operands.
1276 let Inst{3-0} = Sm{4-1};
1277 let Inst{5} = Sm{0};
1278 let Inst{15-12} = Sd{4-1};
1279 let Inst{22} = Sd{0};
1280
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001281 let Inst{27-23} = opcod1;
1282 let Inst{21-20} = opcod2;
1283 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001284 let Inst{11-9} = 0b101;
1285 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001286 let Inst{7-6} = opcod4;
1287 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001288}
1289
David Goodwin338268c2009-08-10 22:17:39 +00001290// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001291// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001292class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1293 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1294 string asm, list<dag> pattern>
1295 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1296 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001297 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1298}
1299
Evan Cheng96581d32008-11-11 02:11:05 +00001300// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001301class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1302 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001303 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001304 // Instruction operands.
1305 bits<5> Sd;
1306 bits<5> Sn;
1307 bits<5> Sm;
1308
1309 // Encode instruction operands.
1310 let Inst{3-0} = Sm{4-1};
1311 let Inst{5} = Sm{0};
1312 let Inst{19-16} = Sn{4-1};
1313 let Inst{7} = Sn{0};
1314 let Inst{15-12} = Sd{4-1};
1315 let Inst{22} = Sd{0};
1316
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001317 let Inst{27-23} = opcod1;
1318 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001319 let Inst{11-9} = 0b101;
1320 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001321 let Inst{6} = op6;
1322 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001323}
1324
David Goodwin338268c2009-08-10 22:17:39 +00001325// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001326// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001327class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001328 dag iops, InstrItinClass itin, string opc, string asm,
1329 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001330 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001331 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling69661192010-11-01 06:00:39 +00001332
1333 // Instruction operands.
1334 bits<5> Sd;
1335 bits<5> Sn;
1336 bits<5> Sm;
1337
1338 // Encode instruction operands.
1339 let Inst{3-0} = Sm{4-1};
1340 let Inst{5} = Sm{0};
1341 let Inst{19-16} = Sn{4-1};
1342 let Inst{7} = Sn{0};
1343 let Inst{15-12} = Sd{4-1};
1344 let Inst{22} = Sd{0};
David Goodwin42a83f22009-08-04 17:53:06 +00001345}
1346
Evan Cheng80a11982008-11-12 06:41:41 +00001347// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001348class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1349 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1350 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001351 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001352 let Inst{27-23} = opcod1;
1353 let Inst{21-20} = opcod2;
1354 let Inst{19-16} = opcod3;
1355 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001356 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001357 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001358}
1359
Johnny Chen811663f2010-02-11 18:47:03 +00001360// VFP conversion between floating-point and fixed-point
1361class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001362 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1363 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001364 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1365 // size (fixed-point number): sx == 0 ? 16 : 32
1366 let Inst{7} = op5; // sx
1367}
1368
David Goodwin338268c2009-08-10 22:17:39 +00001369// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001370class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001371 dag oops, dag iops, InstrItinClass itin,
1372 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001373 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1374 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001375 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1376}
1377
Evan Cheng80a11982008-11-12 06:41:41 +00001378class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001379 InstrItinClass itin,
1380 string opc, string asm, list<dag> pattern>
1381 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001382 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001383 let Inst{11-8} = opcod2;
1384 let Inst{4} = 1;
1385}
1386
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001387class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1388 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1389 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001390
Bob Wilson01135592010-03-23 17:23:59 +00001391class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001392 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1393 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001394
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001395class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1396 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1397 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001398
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001399class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1400 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1401 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001402
Evan Cheng96581d32008-11-11 02:11:05 +00001403//===----------------------------------------------------------------------===//
1404
Bob Wilson5bafff32009-06-22 23:27:02 +00001405//===----------------------------------------------------------------------===//
1406// ARM NEON Instruction templates.
1407//
Evan Cheng13096642008-08-29 06:41:12 +00001408
Johnny Chencaa608e2010-03-20 00:17:00 +00001409class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1410 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1411 list<dag> pattern>
1412 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001413 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001414 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001415 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001416 let Pattern = pattern;
1417 list<Predicate> Predicates = [HasNEON];
1418}
1419
1420// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001421class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1422 InstrItinClass itin, string opc, string asm, string cstr,
1423 list<dag> pattern>
1424 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001425 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001426 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001427 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001428 let Pattern = pattern;
1429 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001430}
1431
Bob Wilsonb07c1712009-10-07 21:53:04 +00001432class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1433 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001434 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001435 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1436 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001437 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001438 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001439 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001440 let Inst{11-8} = op11_8;
1441 let Inst{7-4} = op7_4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001442
Chris Lattner2ac19022010-11-15 05:19:05 +00001443 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001444
Owen Andersond9aa7d32010-11-02 00:05:05 +00001445 bits<5> Vd;
Owen Andersonf431eda2010-11-02 23:47:29 +00001446 bits<6> Rn;
1447 bits<4> Rm;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001448
Owen Andersond9aa7d32010-11-02 00:05:05 +00001449 let Inst{22} = Vd{4};
1450 let Inst{15-12} = Vd{3-0};
Owen Andersonf431eda2010-11-02 23:47:29 +00001451 let Inst{19-16} = Rn{3-0};
1452 let Inst{3-0} = Rm{3-0};
Bob Wilson205a5ca2009-07-08 18:11:30 +00001453}
1454
Owen Andersond138d702010-11-02 20:47:39 +00001455class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1456 dag oops, dag iops, InstrItinClass itin,
1457 string opc, string dt, string asm, string cstr, list<dag> pattern>
1458 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1459 dt, asm, cstr, pattern> {
1460 bits<3> lane;
1461}
1462
Bob Wilson709d5922010-08-25 23:27:42 +00001463class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1464 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1465 itin> {
1466 let OutOperandList = oops;
1467 let InOperandList = !con(iops, (ins pred:$p));
1468 list<Predicate> Predicates = [HasNEON];
1469}
1470
Jim Grosbach7cd27292010-10-06 20:36:55 +00001471class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1472 list<dag> pattern>
Bob Wilsonbd916c52010-09-13 23:55:10 +00001473 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1474 itin> {
1475 let OutOperandList = oops;
1476 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001477 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001478 list<Predicate> Predicates = [HasNEON];
1479}
1480
Johnny Chen785516a2010-03-23 16:43:47 +00001481class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001482 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001483 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1484 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001485 let Inst{31-25} = 0b1111001;
Chris Lattner2ac19022010-11-15 05:19:05 +00001486 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Evan Chengf81bf152009-11-23 21:57:23 +00001487}
1488
Johnny Chen927b88f2010-03-23 20:40:44 +00001489class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001490 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001491 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001492 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001493 let Inst{31-25} = 0b1111001;
1494}
1495
1496// NEON "one register and a modified immediate" format.
1497class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1498 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001499 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001500 string opc, string dt, string asm, string cstr,
1501 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001502 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001503 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001504 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001505 let Inst{11-8} = op11_8;
1506 let Inst{7} = op7;
1507 let Inst{6} = op6;
1508 let Inst{5} = op5;
1509 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001510
Owen Andersona88ea032010-10-26 17:40:54 +00001511 // Instruction operands.
1512 bits<5> Vd;
1513 bits<13> SIMM;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001514
Owen Andersona88ea032010-10-26 17:40:54 +00001515 let Inst{15-12} = Vd{3-0};
1516 let Inst{22} = Vd{4};
1517 let Inst{24} = SIMM{7};
1518 let Inst{18-16} = SIMM{6-4};
1519 let Inst{3-0} = SIMM{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001520}
1521
1522// NEON 2 vector register format.
1523class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1524 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001525 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001526 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001527 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001528 let Inst{24-23} = op24_23;
1529 let Inst{21-20} = op21_20;
1530 let Inst{19-18} = op19_18;
1531 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001532 let Inst{11-7} = op11_7;
1533 let Inst{6} = op6;
1534 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001535
Owen Anderson162875a2010-10-25 18:43:52 +00001536 // Instruction operands.
1537 bits<5> Vd;
1538 bits<5> Vm;
1539
1540 let Inst{15-12} = Vd{3-0};
1541 let Inst{22} = Vd{4};
1542 let Inst{3-0} = Vm{3-0};
1543 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001544}
1545
1546// Same as N2V except it doesn't have a datatype suffix.
1547class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001548 bits<5> op11_7, bit op6, bit op4,
1549 dag oops, dag iops, InstrItinClass itin,
1550 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001551 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001552 let Inst{24-23} = op24_23;
1553 let Inst{21-20} = op21_20;
1554 let Inst{19-18} = op19_18;
1555 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001556 let Inst{11-7} = op11_7;
1557 let Inst{6} = op6;
1558 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001559
Owen Anderson162875a2010-10-25 18:43:52 +00001560 // Instruction operands.
1561 bits<5> Vd;
1562 bits<5> Vm;
1563
1564 let Inst{15-12} = Vd{3-0};
1565 let Inst{22} = Vd{4};
1566 let Inst{3-0} = Vm{3-0};
1567 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001568}
1569
1570// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001571class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001572 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001573 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001574 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001575 let Inst{24} = op24;
1576 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001577 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001578 let Inst{7} = op7;
1579 let Inst{6} = op6;
1580 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001581
Owen Anderson3557d002010-10-26 20:56:57 +00001582 // Instruction operands.
1583 bits<5> Vd;
1584 bits<5> Vm;
1585 bits<6> SIMM;
1586
1587 let Inst{15-12} = Vd{3-0};
1588 let Inst{22} = Vd{4};
1589 let Inst{3-0} = Vm{3-0};
1590 let Inst{5} = Vm{4};
1591 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001592}
1593
Bob Wilson10bc69c2010-03-27 03:56:52 +00001594// NEON 3 vector register format.
1595class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1596 dag oops, dag iops, Format f, InstrItinClass itin,
1597 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001598 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001599 let Inst{24} = op24;
1600 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001601 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001602 let Inst{11-8} = op11_8;
1603 let Inst{6} = op6;
1604 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001605
Owen Andersond451f882010-10-21 20:21:49 +00001606 // Instruction operands.
1607 bits<5> Vd;
1608 bits<5> Vn;
1609 bits<5> Vm;
1610
1611 let Inst{15-12} = Vd{3-0};
1612 let Inst{22} = Vd{4};
1613 let Inst{19-16} = Vn{3-0};
1614 let Inst{7} = Vn{4};
1615 let Inst{3-0} = Vm{3-0};
1616 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001617}
1618
Johnny Chen841e8282010-03-23 21:35:03 +00001619// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001620class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1621 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001622 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001623 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001624 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001625 let Inst{24} = op24;
1626 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001627 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001628 let Inst{11-8} = op11_8;
1629 let Inst{6} = op6;
1630 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001631
Owen Anderson8c71eff2010-10-25 18:28:30 +00001632 // Instruction operands.
1633 bits<5> Vd;
1634 bits<5> Vn;
1635 bits<5> Vm;
1636
1637 let Inst{15-12} = Vd{3-0};
1638 let Inst{22} = Vd{4};
1639 let Inst{19-16} = Vn{3-0};
1640 let Inst{7} = Vn{4};
1641 let Inst{3-0} = Vm{3-0};
1642 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001643}
1644
1645// NEON VMOVs between scalar and core registers.
1646class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001647 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001648 string opc, string dt, string asm, list<dag> pattern>
Evan Cheng0e9996c2010-10-26 02:03:05 +00001649 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001650 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001651 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001652 let Inst{11-8} = opcod2;
1653 let Inst{6-5} = opcod3;
1654 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001655
1656 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001657 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001658 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001659 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001660 list<Predicate> Predicates = [HasNEON];
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001661
Chris Lattner2ac19022010-11-15 05:19:05 +00001662 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001663
Owen Andersond2fbdb72010-10-27 21:28:09 +00001664 bits<5> V;
1665 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001666 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001667 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001668
Owen Andersonf587a9352010-10-27 19:25:54 +00001669 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001670 let Inst{7} = V{4};
1671 let Inst{19-16} = V{3-0};
1672 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001673}
1674class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001675 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001676 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001677 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001678 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001679class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001680 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001681 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001682 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001683 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001684class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001685 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001686 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001687 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001688 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001689
Johnny Chene4614f72010-03-25 17:01:27 +00001690// Vector Duplicate Lane (from scalar to all elements)
1691class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1692 InstrItinClass itin, string opc, string dt, string asm,
1693 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001694 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001695 let Inst{24-23} = 0b11;
1696 let Inst{21-20} = 0b11;
1697 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001698 let Inst{11-7} = 0b11000;
1699 let Inst{6} = op6;
1700 let Inst{4} = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001701
Owen Andersonf587a9352010-10-27 19:25:54 +00001702 bits<5> Vd;
1703 bits<5> Vm;
1704 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001705
Owen Andersonf587a9352010-10-27 19:25:54 +00001706 let Inst{22} = Vd{4};
1707 let Inst{15-12} = Vd{3-0};
1708 let Inst{5} = Vm{4};
1709 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001710}
1711
David Goodwin42a83f22009-08-04 17:53:06 +00001712// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1713// for single-precision FP.
1714class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1715 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1716}