blob: 06ddbae3c608e6e4b857baa484daff0e62447d08 [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>;
Evan Cheng055b0312009-06-29 07:51:04 +0000107
108// Instruction size.
109class SizeFlagVal<bits<3> val> {
110 bits<3> Value = val;
111}
112def SizeInvalid : SizeFlagVal<0>; // Unset.
113def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
114def Size8Bytes : SizeFlagVal<2>;
115def Size4Bytes : SizeFlagVal<3>;
116def Size2Bytes : SizeFlagVal<4>;
117
118// Load / store index mode.
119class IndexMode<bits<2> val> {
120 bits<2> Value = val;
121}
122def IndexModeNone : IndexMode<0>;
123def IndexModePre : IndexMode<1>;
124def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000125def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000126
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000127// Instruction execution domain.
128class Domain<bits<2> val> {
129 bits<2> Value = val;
130}
131def GenericDomain : Domain<0>;
132def VFPDomain : Domain<1>; // Instructions in VFP domain only
133def NeonDomain : Domain<2>; // Instructions in Neon domain only
134def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
135
Evan Cheng055b0312009-06-29 07:51:04 +0000136//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000137
Evan Cheng446c4282009-07-11 06:43:01 +0000138// ARM special operands.
139//
140
Daniel Dunbar8462b302010-08-11 06:36:53 +0000141def CondCodeOperand : AsmOperandClass {
142 let Name = "CondCode";
143 let SuperClasses = [];
144}
145
Evan Cheng446c4282009-07-11 06:43:01 +0000146// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
147// register whose default is 0 (no register).
148def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
149 (ops (i32 14), (i32 zero_reg))> {
150 let PrintMethod = "printPredicateOperand";
Daniel Dunbar8462b302010-08-11 06:36:53 +0000151 let ParserMatchClass = CondCodeOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000152}
153
154// Conditional code result for instructions whose 's' bit is set, e.g. subs.
155def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Jim Grosbach08bd5492010-10-12 23:00:24 +0000156 string EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000157 let PrintMethod = "printSBitModifierOperand";
158}
159
160// Same as cc_out except it defaults to setting CPSR.
161def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Jim Grosbach08bd5492010-10-12 23:00:24 +0000162 string EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000163 let PrintMethod = "printSBitModifierOperand";
164}
165
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000166// ARM special operands for disassembly only.
167//
168
169def cps_opt : Operand<i32> {
170 let PrintMethod = "printCPSOptionOperand";
171}
172
173def msr_mask : Operand<i32> {
174 let PrintMethod = "printMSRMaskOperand";
175}
176
177// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
178// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
179def neg_zero : Operand<i32> {
180 let PrintMethod = "printNegZeroOperand";
181}
182
Evan Cheng446c4282009-07-11 06:43:01 +0000183//===----------------------------------------------------------------------===//
184
Evan Cheng37f25d92008-08-28 23:39:26 +0000185// ARM Instruction templates.
186//
187
Johnny Chend68e1192009-12-15 17:24:14 +0000188class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
189 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000190 : Instruction {
191 let Namespace = "ARM";
192
Evan Cheng37f25d92008-08-28 23:39:26 +0000193 AddrMode AM = am;
Evan Cheng37f25d92008-08-28 23:39:26 +0000194 SizeFlagVal SZ = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000195 IndexMode IM = im;
196 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000197 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000198 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000199 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000200 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000201 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000202
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000203 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000204 let TSFlags{4-0} = AM.Value;
205 let TSFlags{7-5} = SZ.Value;
206 let TSFlags{9-8} = IndexModeBits;
207 let TSFlags{15-10} = Form;
208 let TSFlags{16} = isUnaryDataProc;
209 let TSFlags{17} = canXformTo16Bit;
210 let TSFlags{19-18} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000211
Evan Cheng37f25d92008-08-28 23:39:26 +0000212 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000213 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000214}
215
Johnny Chend68e1192009-12-15 17:24:14 +0000216class Encoding {
217 field bits<32> Inst;
218}
219
220class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
221 Format f, Domain d, string cstr, InstrItinClass itin>
222 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
223
224// This Encoding-less class is used by Thumb1 to specify the encoding bits later
225// on by adding flavors to specific instructions.
226class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
227 Format f, Domain d, string cstr, InstrItinClass itin>
228 : InstTemplate<am, sz, im, f, d, cstr, itin>;
229
Bob Wilson01135592010-03-23 17:23:59 +0000230class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000231 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000232 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000233 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000234 let OutOperandList = oops;
235 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000236 let AsmString = asm;
Evan Cheng37f25d92008-08-28 23:39:26 +0000237 let Pattern = pattern;
238}
239
240// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000241class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000242 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000243 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000244 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000245 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000246 bits<4> p;
247 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000248 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000249 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000250 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000251 let Pattern = pattern;
252 list<Predicate> Predicates = [IsARM];
253}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000254
Jim Grosbachf6b28622009-12-14 18:31:20 +0000255// A few are not predicable
256class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000257 IndexMode im, Format f, InstrItinClass itin,
258 string opc, string asm, string cstr,
259 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000260 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
261 let OutOperandList = oops;
262 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000263 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000264 let Pattern = pattern;
265 let isPredicable = 0;
266 list<Predicate> Predicates = [IsARM];
267}
Evan Cheng37f25d92008-08-28 23:39:26 +0000268
Bill Wendling4822bce2010-08-30 01:47:35 +0000269// Same as I except it can optionally modify CPSR. Note it's modeled as an input
270// operand since by default it's a zero register. It will become an implicit def
271// once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000272class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000273 IndexMode im, Format f, InstrItinClass itin,
274 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000275 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000276 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000277 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000278 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000279 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000280 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000281
Evan Cheng37f25d92008-08-28 23:39:26 +0000282 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000283 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +0000284 let AsmString = !strconcat(opc, "${p}${s}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000285 let Pattern = pattern;
286 list<Predicate> Predicates = [IsARM];
287}
288
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000289// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000290class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000291 IndexMode im, Format f, InstrItinClass itin,
292 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000293 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000294 let OutOperandList = oops;
295 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000296 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000297 let Pattern = pattern;
298 list<Predicate> Predicates = [IsARM];
299}
300
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000301class AI<dag oops, dag iops, Format f, InstrItinClass itin,
302 string opc, string asm, list<dag> pattern>
303 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
304 opc, asm, "", pattern>;
305class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
306 string opc, string asm, list<dag> pattern>
307 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
308 opc, asm, "", pattern>;
309class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000310 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000311 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000312 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000313class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000314 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000315 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000316 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000317
318// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000319class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
320 string opc, string asm, list<dag> pattern>
321 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
322 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000323 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000324}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000325class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
326 string asm, list<dag> pattern>
327 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
328 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000329 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000330}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000331class ABXIx2<dag oops, dag iops, InstrItinClass itin,
332 string asm, list<dag> pattern>
Xerxes Ranby99ccffe2010-07-22 17:28:34 +0000333 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000334 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000335
336// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000337class JTI<dag oops, dag iops, InstrItinClass itin,
338 string asm, list<dag> pattern>
339 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000340 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000341
Jim Grosbach5278eb82009-12-11 01:42:04 +0000342// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000343class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
344 string opc, string asm, list<dag> pattern>
345 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
346 opc, asm, "", pattern> {
347 let Inst{27-23} = 0b00011;
348 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000349 let Inst{20} = 1;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000350 let Inst{11-0} = 0b111110011111;
351}
352class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
353 string opc, string asm, list<dag> pattern>
354 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
355 opc, asm, "", pattern> {
356 let Inst{27-23} = 0b00011;
357 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000358 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000359 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000360}
361
Evan Cheng0d14fc82008-09-01 01:51:14 +0000362// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000363class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
364 string opc, string asm, list<dag> pattern>
365 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
366 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000367 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000368 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000369}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000370class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
371 string opc, string asm, list<dag> pattern>
372 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
373 opc, asm, "", pattern> {
374 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000375 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000376}
377class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000378 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000379 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000380 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000381 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000382 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000383}
Bob Wilson01135592010-03-23 17:23:59 +0000384class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000385 string opc, string asm, list<dag> pattern>
386 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
387 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000388
Evan Cheng0d14fc82008-09-01 01:51:14 +0000389
390// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000391class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
392 string opc, string asm, list<dag> pattern>
393 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
394 opc, asm, "", pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +0000395 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000396}
Evan Cheng93912732008-09-01 01:27:33 +0000397
398// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000399class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
400 string opc, string asm, list<dag> pattern>
401 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
402 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000403 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000404 let Inst{21} = 0; // W bit
405 let Inst{22} = 0; // B bit
406 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000407 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000408}
Bob Wilson01135592010-03-23 17:23:59 +0000409class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000410 string asm, list<dag> pattern>
411 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000412 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000413 let Inst{20} = 1; // L bit
414 let Inst{21} = 0; // W bit
415 let Inst{22} = 0; // B bit
416 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000417 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000418}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000419class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
420 string opc, string asm, list<dag> pattern>
421 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
422 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000423 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000424 let Inst{21} = 0; // W bit
425 let Inst{22} = 1; // B bit
426 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000427 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000428}
Bob Wilson01135592010-03-23 17:23:59 +0000429class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000430 string asm, list<dag> pattern>
431 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000432 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000433 let Inst{20} = 1; // L bit
434 let Inst{21} = 0; // W bit
435 let Inst{22} = 1; // B bit
436 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000437 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000438}
Evan Cheng17222df2008-08-31 19:02:21 +0000439
Evan Cheng93912732008-09-01 01:27:33 +0000440// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000441class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
442 string opc, string asm, list<dag> pattern>
443 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
444 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000445 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000446 let Inst{21} = 0; // W bit
447 let Inst{22} = 0; // B bit
448 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000449 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000450}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000451class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
452 string asm, list<dag> pattern>
453 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000454 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000455 let Inst{20} = 0; // L bit
456 let Inst{21} = 0; // W bit
457 let Inst{22} = 0; // B bit
458 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000459 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000460}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000461class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
462 string opc, string asm, list<dag> pattern>
463 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
464 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000465 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000466 let Inst{21} = 0; // W bit
467 let Inst{22} = 1; // B bit
468 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000469 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000470}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000471class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
472 string asm, list<dag> pattern>
473 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000474 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000475 let Inst{20} = 0; // L bit
476 let Inst{21} = 0; // W bit
477 let Inst{22} = 1; // B bit
478 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000479 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000480}
Evan Cheng93912732008-09-01 01:27:33 +0000481
Evan Cheng840917b2008-09-01 07:00:14 +0000482// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000483class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
484 string opc, string asm, string cstr, list<dag> pattern>
485 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
486 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000487 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000488 let Inst{21} = 1; // W bit
489 let Inst{22} = 0; // B bit
490 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000491 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000492}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000493class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
494 string opc, string asm, string cstr, list<dag> pattern>
495 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
496 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000497 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000498 let Inst{21} = 1; // W bit
499 let Inst{22} = 1; // B bit
500 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000501 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000502}
503
Evan Cheng840917b2008-09-01 07:00:14 +0000504// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000505class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
506 string opc, string asm, string cstr, list<dag> pattern>
507 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
508 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000509 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000510 let Inst{21} = 1; // W bit
511 let Inst{22} = 0; // B bit
512 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000513 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000514}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000515class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
516 string opc, string asm, string cstr, list<dag> pattern>
517 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
518 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000519 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000520 let Inst{21} = 1; // W bit
521 let Inst{22} = 1; // B bit
522 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000523 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000524}
525
Evan Cheng840917b2008-09-01 07:00:14 +0000526// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000527class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
528 string opc, string asm, string cstr, list<dag> pattern>
529 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
530 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000531 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000532 let Inst{21} = 0; // W bit
533 let Inst{22} = 0; // B bit
534 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000535 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000536}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000537class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
538 string opc, string asm, string cstr, list<dag> pattern>
539 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
540 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000541 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000542 let Inst{21} = 0; // W bit
543 let Inst{22} = 1; // B bit
544 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000545 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000546}
547
Evan Cheng840917b2008-09-01 07:00:14 +0000548// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000549class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
550 string opc, string asm, string cstr, list<dag> pattern>
551 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
552 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000553 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000554 let Inst{21} = 0; // W bit
555 let Inst{22} = 0; // B bit
556 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000557 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000558}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000559class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
560 string opc, string asm, string cstr, list<dag> pattern>
561 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
562 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000563 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000564 let Inst{21} = 0; // W bit
565 let Inst{22} = 1; // B bit
566 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000567 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000568}
569
Evan Cheng0d14fc82008-09-01 01:51:14 +0000570// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000571class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000572 string opc, string asm, list<dag> pattern>
573 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
574 opc, asm, "", pattern>;
575class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
576 string asm, list<dag> pattern>
577 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
578 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000579
Evan Cheng840917b2008-09-01 07:00:14 +0000580// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000581class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
582 string opc, string asm, list<dag> pattern>
583 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
584 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000585 let Inst{4} = 1;
586 let Inst{5} = 1; // H bit
587 let Inst{6} = 0; // S bit
588 let Inst{7} = 1;
589 let Inst{20} = 1; // L bit
590 let Inst{21} = 0; // W bit
591 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000592 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000593}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000594class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
595 string asm, list<dag> pattern>
596 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000597 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000598 let Inst{4} = 1;
599 let Inst{5} = 1; // H bit
600 let Inst{6} = 0; // S bit
601 let Inst{7} = 1;
602 let Inst{20} = 1; // L bit
603 let Inst{21} = 0; // W bit
604 let Inst{24} = 1; // P bit
605}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000606class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
607 string opc, string asm, list<dag> pattern>
608 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
609 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000610 let Inst{4} = 1;
611 let Inst{5} = 1; // H bit
612 let Inst{6} = 1; // S bit
613 let Inst{7} = 1;
614 let Inst{20} = 1; // L bit
615 let Inst{21} = 0; // W bit
616 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000617 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000618}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000619class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
620 string asm, list<dag> pattern>
621 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000622 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000623 let Inst{4} = 1;
624 let Inst{5} = 1; // H bit
625 let Inst{6} = 1; // S bit
626 let Inst{7} = 1;
627 let Inst{20} = 1; // L bit
628 let Inst{21} = 0; // W bit
629 let Inst{24} = 1; // P bit
630}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000631class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
632 string opc, string asm, list<dag> pattern>
633 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
634 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000635 let Inst{4} = 1;
636 let Inst{5} = 0; // H bit
637 let Inst{6} = 1; // S bit
638 let Inst{7} = 1;
639 let Inst{20} = 1; // L bit
640 let Inst{21} = 0; // W bit
641 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000642 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000643}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000644class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
645 string asm, list<dag> pattern>
646 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000647 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000648 let Inst{4} = 1;
649 let Inst{5} = 0; // H bit
650 let Inst{6} = 1; // S bit
651 let Inst{7} = 1;
652 let Inst{20} = 1; // L bit
653 let Inst{21} = 0; // W bit
654 let Inst{24} = 1; // P bit
655}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000656class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
657 string opc, string asm, list<dag> pattern>
658 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
659 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000660 let Inst{4} = 1;
661 let Inst{5} = 0; // H bit
662 let Inst{6} = 1; // S bit
663 let Inst{7} = 1;
664 let Inst{20} = 0; // L bit
665 let Inst{21} = 0; // W bit
666 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000667 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000668}
669
670// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000671class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
672 string opc, string asm, list<dag> pattern>
673 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
674 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000675 let Inst{4} = 1;
676 let Inst{5} = 1; // H bit
677 let Inst{6} = 0; // S bit
678 let Inst{7} = 1;
679 let Inst{20} = 0; // L bit
680 let Inst{21} = 0; // W bit
681 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000682 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000683}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000684class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
685 string asm, list<dag> pattern>
686 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000687 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000688 let Inst{4} = 1;
689 let Inst{5} = 1; // H bit
690 let Inst{6} = 0; // S bit
691 let Inst{7} = 1;
692 let Inst{20} = 0; // L bit
693 let Inst{21} = 0; // W bit
694 let Inst{24} = 1; // P bit
695}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000696class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
697 string opc, string asm, list<dag> pattern>
698 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
699 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000700 let Inst{4} = 1;
701 let Inst{5} = 1; // H bit
702 let Inst{6} = 1; // S bit
703 let Inst{7} = 1;
704 let Inst{20} = 0; // L bit
705 let Inst{21} = 0; // W bit
706 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000707 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000708}
709
710// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000711class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
712 string opc, string asm, string cstr, list<dag> pattern>
713 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
714 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000715 let Inst{4} = 1;
716 let Inst{5} = 1; // H bit
717 let Inst{6} = 0; // S bit
718 let Inst{7} = 1;
719 let Inst{20} = 1; // L bit
720 let Inst{21} = 1; // W bit
721 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000722 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000723}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000724class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
725 string opc, string asm, string cstr, list<dag> pattern>
726 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
727 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000728 let Inst{4} = 1;
729 let Inst{5} = 1; // H bit
730 let Inst{6} = 1; // S bit
731 let Inst{7} = 1;
732 let Inst{20} = 1; // L bit
733 let Inst{21} = 1; // W bit
734 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000735 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000736}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000737class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
738 string opc, string asm, string cstr, list<dag> pattern>
739 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
740 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000741 let Inst{4} = 1;
742 let Inst{5} = 0; // H bit
743 let Inst{6} = 1; // S bit
744 let Inst{7} = 1;
745 let Inst{20} = 1; // L bit
746 let Inst{21} = 1; // W bit
747 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000748 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000749}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000750class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
751 string opc, string asm, string cstr, list<dag> pattern>
752 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
753 opc, asm, cstr, pattern> {
754 let Inst{4} = 1;
755 let Inst{5} = 0; // H bit
756 let Inst{6} = 1; // S bit
757 let Inst{7} = 1;
758 let Inst{20} = 0; // L bit
759 let Inst{21} = 1; // W bit
760 let Inst{24} = 1; // P bit
761 let Inst{27-25} = 0b000;
762}
763
Evan Cheng840917b2008-09-01 07:00:14 +0000764
765// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000766class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
767 string opc, string asm, string cstr, list<dag> pattern>
768 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
769 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000770 let Inst{4} = 1;
771 let Inst{5} = 1; // H bit
772 let Inst{6} = 0; // S bit
773 let Inst{7} = 1;
774 let Inst{20} = 0; // L bit
775 let Inst{21} = 1; // W bit
776 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000777 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000778}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000779class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
780 string opc, string asm, string cstr, list<dag> pattern>
781 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
782 opc, asm, cstr, pattern> {
783 let Inst{4} = 1;
784 let Inst{5} = 1; // H bit
785 let Inst{6} = 1; // S bit
786 let Inst{7} = 1;
787 let Inst{20} = 0; // L bit
788 let Inst{21} = 1; // W bit
789 let Inst{24} = 1; // P bit
790 let Inst{27-25} = 0b000;
791}
Evan Cheng840917b2008-09-01 07:00:14 +0000792
793// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000794class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
795 string opc, string asm, string cstr, list<dag> pattern>
796 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
797 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000798 let Inst{4} = 1;
799 let Inst{5} = 1; // H bit
800 let Inst{6} = 0; // S bit
801 let Inst{7} = 1;
802 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000803 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000804 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000805 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000806}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000807class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
808 string opc, string asm, string cstr, list<dag> pattern>
809 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
810 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000811 let Inst{4} = 1;
812 let Inst{5} = 1; // H bit
813 let Inst{6} = 1; // S bit
814 let Inst{7} = 1;
815 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000816 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000817 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000818 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000819}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000820class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
821 string opc, string asm, string cstr, list<dag> pattern>
822 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
823 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000824 let Inst{4} = 1;
825 let Inst{5} = 0; // H bit
826 let Inst{6} = 1; // S bit
827 let Inst{7} = 1;
828 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000829 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000830 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000831 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000832}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000833class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
834 string opc, string asm, string cstr, list<dag> pattern>
835 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
836 opc, asm, cstr, pattern> {
837 let Inst{4} = 1;
838 let Inst{5} = 0; // H bit
839 let Inst{6} = 1; // S bit
840 let Inst{7} = 1;
841 let Inst{20} = 0; // L bit
842 let Inst{21} = 0; // W bit
843 let Inst{24} = 0; // P bit
844 let Inst{27-25} = 0b000;
845}
Evan Cheng840917b2008-09-01 07:00:14 +0000846
847// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000848class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
849 string opc, string asm, string cstr, list<dag> pattern>
850 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
851 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000852 let Inst{4} = 1;
853 let Inst{5} = 1; // H bit
854 let Inst{6} = 0; // S bit
855 let Inst{7} = 1;
856 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000857 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000858 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000859 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000860}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000861class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
862 string opc, string asm, string cstr, list<dag> pattern>
863 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
864 opc, asm, cstr, pattern> {
865 let Inst{4} = 1;
866 let Inst{5} = 1; // H bit
867 let Inst{6} = 1; // S bit
868 let Inst{7} = 1;
869 let Inst{20} = 0; // L bit
870 let Inst{21} = 0; // W bit
871 let Inst{24} = 0; // P bit
872 let Inst{27-25} = 0b000;
873}
Evan Cheng840917b2008-09-01 07:00:14 +0000874
Evan Cheng0d14fc82008-09-01 01:51:14 +0000875// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000876class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000877 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000878 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000879 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000880 let Inst{20} = 1; // L bit
881 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000882 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000883}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000884class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000885 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000886 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000887 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000888 let Inst{20} = 0; // L bit
889 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000890 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000891}
Evan Cheng37f25d92008-08-28 23:39:26 +0000892
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000893// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000894class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
895 string opc, string asm, list<dag> pattern>
896 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
897 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000898 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000899 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000900 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000901}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000902class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
903 string opc, string asm, list<dag> pattern>
904 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
905 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000906 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000907 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000908}
909
910// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000911class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
912 string opc, string asm, list<dag> pattern>
913 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
914 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000915 let Inst{7-4} = 0b1001;
916 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000917 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000918}
Evan Cheng37f25d92008-08-28 23:39:26 +0000919
Evan Chengeb4f52e2008-11-06 03:35:07 +0000920// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000921class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
922 string opc, string asm, list<dag> pattern>
923 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
924 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000925 let Inst{4} = 0;
926 let Inst{7} = 1;
927 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000928 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000929}
930
Evan Cheng97f48c32008-11-06 22:15:19 +0000931// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000932class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
933 string opc, string asm, list<dag> pattern>
934 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
935 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000936 let Inst{7-4} = 0b0111;
937 let Inst{27-20} = opcod;
938}
939
Evan Cheng8b59db32008-11-07 01:41:35 +0000940// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000941class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
942 string opc, string asm, list<dag> pattern>
943 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
944 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000945 let Inst{27-20} = opcod;
946}
947
Evan Cheng37f25d92008-08-28 23:39:26 +0000948//===----------------------------------------------------------------------===//
949
950// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
951class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
952 list<Predicate> Predicates = [IsARM];
953}
954class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
955 list<Predicate> Predicates = [IsARM, HasV5TE];
956}
957class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
958 list<Predicate> Predicates = [IsARM, HasV6];
959}
Evan Cheng13096642008-08-29 06:41:12 +0000960
961//===----------------------------------------------------------------------===//
962//
963// Thumb Instruction Format Definitions.
964//
965
Evan Cheng13096642008-08-29 06:41:12 +0000966// TI - Thumb instruction.
967
Evan Cheng446c4282009-07-11 06:43:01 +0000968class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000969 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000970 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000971 let OutOperandList = oops;
972 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000973 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000974 let Pattern = pattern;
975 list<Predicate> Predicates = [IsThumb];
976}
977
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000978class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
979 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000980
Evan Cheng35d6c412009-08-04 23:47:55 +0000981// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000982class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
983 list<dag> pattern>
984 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
985 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000986
Johnny Chend68e1192009-12-15 17:24:14 +0000987// tBL, tBX 32-bit instructions
988class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000989 dag oops, dag iops, InstrItinClass itin, string asm,
990 list<dag> pattern>
991 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
992 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000993 let Inst{31-27} = opcod1;
994 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000995 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000996}
Evan Cheng13096642008-08-29 06:41:12 +0000997
998// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000999class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1000 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001001 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001002
Evan Cheng09c39fc2009-06-23 19:38:13 +00001003// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +00001004class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001005 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001006 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001007 let OutOperandList = oops;
1008 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001009 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001010 let Pattern = pattern;
1011 list<Predicate> Predicates = [IsThumb1Only];
1012}
1013
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001014class T1I<dag oops, dag iops, InstrItinClass itin,
1015 string asm, list<dag> pattern>
1016 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1017class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1018 string asm, list<dag> pattern>
1019 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1020class T1JTI<dag oops, dag iops, InstrItinClass itin,
1021 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001022 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001023
1024// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001025class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001026 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001027 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001028 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001029
1030// Thumb1 instruction that can either be predicated or set CPSR.
1031class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001032 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001033 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001034 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001035 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1036 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001037 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001038 let Pattern = pattern;
1039 list<Predicate> Predicates = [IsThumb1Only];
1040}
1041
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001042class T1sI<dag oops, dag iops, InstrItinClass itin,
1043 string opc, string asm, list<dag> pattern>
1044 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001045
1046// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001047class T1sIt<dag oops, dag iops, InstrItinClass itin,
1048 string opc, string asm, list<dag> pattern>
1049 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001050 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001051
1052// Thumb1 instruction that can be predicated.
1053class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001054 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001055 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001056 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001057 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001058 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001059 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001060 let Pattern = pattern;
1061 list<Predicate> Predicates = [IsThumb1Only];
1062}
1063
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001064class T1pI<dag oops, dag iops, InstrItinClass itin,
1065 string opc, string asm, list<dag> pattern>
1066 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001067
1068// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001069class T1pIt<dag oops, dag iops, InstrItinClass itin,
1070 string opc, string asm, list<dag> pattern>
1071 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001072 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001073
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001074class T1pI1<dag oops, dag iops, InstrItinClass itin,
1075 string opc, string asm, list<dag> pattern>
1076 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1077class T1pI2<dag oops, dag iops, InstrItinClass itin,
1078 string opc, string asm, list<dag> pattern>
1079 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1080class T1pI4<dag oops, dag iops, InstrItinClass itin,
1081 string opc, string asm, list<dag> pattern>
1082 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001083class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001084 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1085 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001086
Johnny Chenbbc71b22009-12-16 02:32:54 +00001087class Encoding16 : Encoding {
1088 let Inst{31-16} = 0x0000;
1089}
1090
Johnny Chend68e1192009-12-15 17:24:14 +00001091// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001092class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001093 let Inst{15-10} = opcode;
1094}
1095
1096// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001097class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001098 let Inst{15-14} = 0b00;
1099 let Inst{13-9} = opcode;
1100}
1101
1102// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001103class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001104 let Inst{15-10} = 0b010000;
1105 let Inst{9-6} = opcode;
1106}
1107
1108// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001109class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001110 let Inst{15-10} = 0b010001;
1111 let Inst{9-6} = opcode;
1112}
1113
1114// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001115class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001116 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001117 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001118}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001119class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +00001120class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1121class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1122class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +00001123class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001124
1125// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001126class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001127 let Inst{15-12} = 0b1011;
1128 let Inst{11-5} = opcode;
1129}
1130
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001131// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1132class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001133 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001134 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001135 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001136 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001137 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001138 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001139 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001140 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001141}
1142
Bill Wendlingda2ae632010-08-31 07:50:46 +00001143// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1144// input operand since by default it's a zero register. It will become an
1145// implicit def once it's "flipped".
1146//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001147// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1148// more consistent.
1149class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001150 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001151 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001152 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001153 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001154 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001155 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001156 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001157 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001158}
1159
1160// Special cases
1161class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001162 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001163 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001164 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001165 let OutOperandList = oops;
1166 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001167 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001168 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001169 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001170}
1171
Jim Grosbachd1228742009-12-01 18:10:36 +00001172class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001173 InstrItinClass itin,
1174 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001175 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1176 let OutOperandList = oops;
1177 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001178 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001179 let Pattern = pattern;
1180 list<Predicate> Predicates = [IsThumb1Only];
1181}
1182
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001183class T2I<dag oops, dag iops, InstrItinClass itin,
1184 string opc, string asm, list<dag> pattern>
1185 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1186class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1187 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001188 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001189class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1190 string opc, string asm, list<dag> pattern>
1191 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1192class T2Iso<dag oops, dag iops, InstrItinClass itin,
1193 string opc, string asm, list<dag> pattern>
1194 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1195class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1196 string opc, string asm, list<dag> pattern>
1197 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001198class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001199 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001200 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1201 pattern> {
1202 let Inst{31-27} = 0b11101;
1203 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001204 let Inst{24} = P;
1205 let Inst{23} = ?; // The U bit.
1206 let Inst{22} = 1;
1207 let Inst{21} = W;
1208 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001209}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001210
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001211class T2sI<dag oops, dag iops, InstrItinClass itin,
1212 string opc, string asm, list<dag> pattern>
1213 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001214
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001215class T2XI<dag oops, dag iops, InstrItinClass itin,
1216 string asm, list<dag> pattern>
1217 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1218class T2JTI<dag oops, dag iops, InstrItinClass itin,
1219 string asm, list<dag> pattern>
1220 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001221
Evan Cheng5adb66a2009-09-28 09:14:39 +00001222class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001223 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001224 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1225
Bob Wilson815baeb2010-03-13 01:08:20 +00001226// Two-address instructions
1227class T2XIt<dag oops, dag iops, InstrItinClass itin,
1228 string asm, string cstr, list<dag> pattern>
1229 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001230
Evan Chenge88d5ce2009-07-02 07:28:31 +00001231// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001232class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1233 dag oops, dag iops,
1234 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001235 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001236 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001237 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001238 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001239 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001240 let Pattern = pattern;
1241 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001242 let Inst{31-27} = 0b11111;
1243 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001244 let Inst{24} = signed;
1245 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001246 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001247 let Inst{20} = load;
1248 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001249 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001250 let Inst{10} = pre; // The P bit.
1251 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001252}
1253
Johnny Chenadc77332010-02-26 22:04:29 +00001254// Helper class for disassembly only
1255// A6.3.16 & A6.3.17
1256// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1257class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1258 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1259 : T2I<oops, iops, itin, opc, asm, pattern> {
1260 let Inst{31-27} = 0b11111;
1261 let Inst{26-24} = 0b011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001262 let Inst{23} = long;
Johnny Chenadc77332010-02-26 22:04:29 +00001263 let Inst{22-20} = op22_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001264 let Inst{7-4} = op7_4;
Johnny Chenadc77332010-02-26 22:04:29 +00001265}
1266
David Goodwinc9d138f2009-07-27 19:59:26 +00001267// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1268class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1269 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1270}
1271
1272// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1273class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1274 list<Predicate> Predicates = [IsThumb1Only];
1275}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001276
Evan Cheng9cb9e672009-06-27 02:26:13 +00001277// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1278class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001279 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001280}
1281
Evan Cheng13096642008-08-29 06:41:12 +00001282//===----------------------------------------------------------------------===//
1283
Evan Cheng96581d32008-11-11 02:11:05 +00001284//===----------------------------------------------------------------------===//
1285// ARM VFP Instruction templates.
1286//
1287
David Goodwin3ca524e2009-07-10 17:03:29 +00001288// Almost all VFP instructions are predicable.
1289class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001290 IndexMode im, Format f, InstrItinClass itin,
1291 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001292 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001293 bits<4> p;
1294 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001295 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001296 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001297 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001298 let Pattern = pattern;
1299 list<Predicate> Predicates = [HasVFP2];
1300}
1301
1302// Special cases
1303class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001304 IndexMode im, Format f, InstrItinClass itin,
1305 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001306 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001307 let OutOperandList = oops;
1308 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001309 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001310 let Pattern = pattern;
1311 list<Predicate> Predicates = [HasVFP2];
1312}
1313
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001314class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1315 string opc, string asm, list<dag> pattern>
1316 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1317 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001318
Evan Chengcd8e66a2008-11-11 21:48:44 +00001319// ARM VFP addrmode5 loads and stores
1320class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001321 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001322 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001323 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001324 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001325 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001326 let Inst{27-24} = opcod1;
1327 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001328 let Inst{11-9} = 0b101;
1329 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001330
1331 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001332 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001333}
1334
Evan Chengcd8e66a2008-11-11 21:48:44 +00001335class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001336 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001337 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001338 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001339 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001340 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001341 let Inst{27-24} = opcod1;
1342 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001343 let Inst{11-9} = 0b101;
1344 let Inst{8} = 0; // Single precision
Evan Cheng96581d32008-11-11 02:11:05 +00001345}
1346
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001347// VFP Load / store multiple pseudo instructions.
1348class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1349 list<dag> pattern>
1350 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1351 cstr, itin> {
1352 let OutOperandList = oops;
1353 let InOperandList = !con(iops, (ins pred:$p));
1354 let Pattern = pattern;
1355 list<Predicate> Predicates = [HasVFP2];
1356}
1357
Evan Chengcd8e66a2008-11-11 21:48:44 +00001358// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001359class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001360 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001361 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001362 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001363 // TODO: Mark the instructions with the appropriate subtarget info.
1364 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001365 let Inst{11-9} = 0b101;
1366 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001367
1368 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001369 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001370}
1371
Jim Grosbach72db1822010-09-08 00:25:50 +00001372class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001373 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001374 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001375 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001376 // TODO: Mark the instructions with the appropriate subtarget info.
1377 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001378 let Inst{11-9} = 0b101;
1379 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001380}
1381
Evan Cheng96581d32008-11-11 02:11:05 +00001382// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001383class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1384 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1385 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001386 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001387 let Inst{27-23} = opcod1;
1388 let Inst{21-20} = opcod2;
1389 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001390 let Inst{11-9} = 0b101;
1391 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001392 let Inst{7-6} = opcod4;
1393 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001394}
1395
1396// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001397class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001398 dag iops, InstrItinClass itin, string opc, string asm,
1399 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001400 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001401 let Inst{27-23} = opcod1;
1402 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001403 let Inst{11-9} = 0b101;
1404 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001405 let Inst{6} = op6;
1406 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001407}
1408
Jim Grosbach26767372010-03-24 22:31:46 +00001409// Double precision, binary, VML[AS] (for additional predicate)
1410class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1411 dag iops, InstrItinClass itin, string opc, string asm,
1412 list<dag> pattern>
1413 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1414 let Inst{27-23} = opcod1;
1415 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001416 let Inst{11-9} = 0b101;
1417 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001418 let Inst{6} = op6;
1419 let Inst{4} = op4;
Jim Grosbach26767372010-03-24 22:31:46 +00001420 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1421}
1422
Evan Cheng96581d32008-11-11 02:11:05 +00001423// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001424class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1425 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1426 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001427 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001428 let Inst{27-23} = opcod1;
1429 let Inst{21-20} = opcod2;
1430 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001431 let Inst{11-9} = 0b101;
1432 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001433 let Inst{7-6} = opcod4;
1434 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001435}
1436
David Goodwin338268c2009-08-10 22:17:39 +00001437// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001438// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001439class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1440 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1441 string asm, list<dag> pattern>
1442 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1443 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001444 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1445}
1446
Evan Cheng96581d32008-11-11 02:11:05 +00001447// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001448class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1449 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001450 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001451 let Inst{27-23} = opcod1;
1452 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001453 let Inst{11-9} = 0b101;
1454 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001455 let Inst{6} = op6;
1456 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001457}
1458
David Goodwin338268c2009-08-10 22:17:39 +00001459// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001460// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001461class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001462 dag iops, InstrItinClass itin, string opc, string asm,
1463 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001464 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001465 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1466}
1467
Evan Cheng80a11982008-11-12 06:41:41 +00001468// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001469class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1470 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1471 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001472 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001473 let Inst{27-23} = opcod1;
1474 let Inst{21-20} = opcod2;
1475 let Inst{19-16} = opcod3;
1476 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001477 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001478 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001479}
1480
Johnny Chen811663f2010-02-11 18:47:03 +00001481// VFP conversion between floating-point and fixed-point
1482class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001483 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1484 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001485 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1486 // size (fixed-point number): sx == 0 ? 16 : 32
1487 let Inst{7} = op5; // sx
1488}
1489
David Goodwin338268c2009-08-10 22:17:39 +00001490// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001491class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001492 dag oops, dag iops, InstrItinClass itin,
1493 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001494 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1495 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001496 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1497}
1498
Evan Cheng80a11982008-11-12 06:41:41 +00001499class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001500 InstrItinClass itin,
1501 string opc, string asm, list<dag> pattern>
1502 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001503 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001504 let Inst{11-8} = opcod2;
1505 let Inst{4} = 1;
1506}
1507
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001508class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1509 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1510 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001511
Bob Wilson01135592010-03-23 17:23:59 +00001512class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001513 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1514 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001515
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001516class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1517 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1518 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001519
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001520class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1521 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1522 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001523
Evan Cheng96581d32008-11-11 02:11:05 +00001524//===----------------------------------------------------------------------===//
1525
Bob Wilson5bafff32009-06-22 23:27:02 +00001526//===----------------------------------------------------------------------===//
1527// ARM NEON Instruction templates.
1528//
Evan Cheng13096642008-08-29 06:41:12 +00001529
Johnny Chencaa608e2010-03-20 00:17:00 +00001530class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1531 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1532 list<dag> pattern>
1533 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001534 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001535 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001536 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001537 let Pattern = pattern;
1538 list<Predicate> Predicates = [HasNEON];
1539}
1540
1541// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001542class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1543 InstrItinClass itin, string opc, string asm, string cstr,
1544 list<dag> pattern>
1545 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001546 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001547 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001548 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001549 let Pattern = pattern;
1550 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001551}
1552
Bob Wilsonb07c1712009-10-07 21:53:04 +00001553class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1554 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001555 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001556 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1557 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001558 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001559 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001560 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001561 let Inst{11-8} = op11_8;
1562 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001563}
1564
Bob Wilson709d5922010-08-25 23:27:42 +00001565class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1566 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1567 itin> {
1568 let OutOperandList = oops;
1569 let InOperandList = !con(iops, (ins pred:$p));
1570 list<Predicate> Predicates = [HasNEON];
1571}
1572
Jim Grosbach7cd27292010-10-06 20:36:55 +00001573class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1574 list<dag> pattern>
Bob Wilsonbd916c52010-09-13 23:55:10 +00001575 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1576 itin> {
1577 let OutOperandList = oops;
1578 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001579 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001580 list<Predicate> Predicates = [HasNEON];
1581}
1582
Johnny Chen785516a2010-03-23 16:43:47 +00001583class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001584 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001585 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1586 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001587 let Inst{31-25} = 0b1111001;
1588}
1589
Johnny Chen927b88f2010-03-23 20:40:44 +00001590class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001591 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001592 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001593 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001594 let Inst{31-25} = 0b1111001;
1595}
1596
1597// NEON "one register and a modified immediate" format.
1598class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1599 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001600 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001601 string opc, string dt, string asm, string cstr,
1602 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001603 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001604 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001605 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001606 let Inst{11-8} = op11_8;
1607 let Inst{7} = op7;
1608 let Inst{6} = op6;
1609 let Inst{5} = op5;
1610 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001611}
1612
1613// NEON 2 vector register format.
1614class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1615 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001616 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001617 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001618 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001619 let Inst{24-23} = op24_23;
1620 let Inst{21-20} = op21_20;
1621 let Inst{19-18} = op19_18;
1622 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001623 let Inst{11-7} = op11_7;
1624 let Inst{6} = op6;
1625 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001626}
1627
1628// Same as N2V except it doesn't have a datatype suffix.
1629class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001630 bits<5> op11_7, bit op6, bit op4,
1631 dag oops, dag iops, InstrItinClass itin,
1632 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001633 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001634 let Inst{24-23} = op24_23;
1635 let Inst{21-20} = op21_20;
1636 let Inst{19-18} = op19_18;
1637 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001638 let Inst{11-7} = op11_7;
1639 let Inst{6} = op6;
1640 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001641}
1642
1643// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001644class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001645 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001646 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001647 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001648 let Inst{24} = op24;
1649 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001650 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001651 let Inst{7} = op7;
1652 let Inst{6} = op6;
1653 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001654}
1655
Bob Wilson10bc69c2010-03-27 03:56:52 +00001656// NEON 3 vector register format.
1657class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1658 dag oops, dag iops, Format f, InstrItinClass itin,
1659 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001660 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001661 let Inst{24} = op24;
1662 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001663 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001664 let Inst{11-8} = op11_8;
1665 let Inst{6} = op6;
1666 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001667}
1668
Johnny Chen841e8282010-03-23 21:35:03 +00001669// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001670class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1671 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001672 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001673 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001674 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001675 let Inst{24} = op24;
1676 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001677 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001678 let Inst{11-8} = op11_8;
1679 let Inst{6} = op6;
1680 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001681}
1682
1683// NEON VMOVs between scalar and core registers.
1684class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001685 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001686 string opc, string dt, string asm, list<dag> pattern>
1687 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001688 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001689 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001690 let Inst{11-8} = opcod2;
1691 let Inst{6-5} = opcod3;
1692 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001693
1694 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001695 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001696 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001697 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001698 list<Predicate> Predicates = [HasNEON];
1699}
1700class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001701 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001702 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001703 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001704 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001705class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001706 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001707 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001708 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001709 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001710class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001711 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001712 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001713 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001714 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001715
Johnny Chene4614f72010-03-25 17:01:27 +00001716// Vector Duplicate Lane (from scalar to all elements)
1717class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1718 InstrItinClass itin, string opc, string dt, string asm,
1719 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001720 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001721 let Inst{24-23} = 0b11;
1722 let Inst{21-20} = 0b11;
1723 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001724 let Inst{11-7} = 0b11000;
1725 let Inst{6} = op6;
1726 let Inst{4} = 0;
Johnny Chene4614f72010-03-25 17:01:27 +00001727}
1728
David Goodwin42a83f22009-08-04 17:53:06 +00001729// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1730// for single-precision FP.
1731class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1732 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1733}