blob: 49f382df306edb41f78e231d5fcf9291faabac85 [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> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000936 // All AExtI instructions have Rd and Rm register operands.
937 bits<4> Rd;
938 bits<4> Rm;
939 let Inst{15-12} = Rd;
940 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000941 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000942 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000943 let Inst{27-20} = opcod;
944}
945
Evan Cheng8b59db32008-11-07 01:41:35 +0000946// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000947class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
948 string opc, string asm, list<dag> pattern>
949 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
950 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000951 let Inst{27-20} = opcod;
952}
953
Evan Cheng37f25d92008-08-28 23:39:26 +0000954//===----------------------------------------------------------------------===//
955
956// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
957class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
958 list<Predicate> Predicates = [IsARM];
959}
960class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
961 list<Predicate> Predicates = [IsARM, HasV5TE];
962}
963class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
964 list<Predicate> Predicates = [IsARM, HasV6];
965}
Evan Cheng13096642008-08-29 06:41:12 +0000966
967//===----------------------------------------------------------------------===//
968//
969// Thumb Instruction Format Definitions.
970//
971
Evan Cheng13096642008-08-29 06:41:12 +0000972// TI - Thumb instruction.
973
Evan Cheng446c4282009-07-11 06:43:01 +0000974class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000975 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000976 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000977 let OutOperandList = oops;
978 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000979 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000980 let Pattern = pattern;
981 list<Predicate> Predicates = [IsThumb];
982}
983
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000984class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
985 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000986
Evan Cheng35d6c412009-08-04 23:47:55 +0000987// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000988class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
989 list<dag> pattern>
990 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
991 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000992
Johnny Chend68e1192009-12-15 17:24:14 +0000993// tBL, tBX 32-bit instructions
994class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000995 dag oops, dag iops, InstrItinClass itin, string asm,
996 list<dag> pattern>
997 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
998 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000999 let Inst{31-27} = opcod1;
1000 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001001 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +00001002}
Evan Cheng13096642008-08-29 06:41:12 +00001003
1004// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +00001005class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1006 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001007 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001008
Evan Cheng09c39fc2009-06-23 19:38:13 +00001009// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +00001010class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001011 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001012 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001013 let OutOperandList = oops;
1014 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001015 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001016 let Pattern = pattern;
1017 list<Predicate> Predicates = [IsThumb1Only];
1018}
1019
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001020class T1I<dag oops, dag iops, InstrItinClass itin,
1021 string asm, list<dag> pattern>
1022 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1023class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1024 string asm, list<dag> pattern>
1025 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1026class T1JTI<dag oops, dag iops, InstrItinClass itin,
1027 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001028 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001029
1030// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001031class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001032 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001033 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001034 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001035
1036// Thumb1 instruction that can either be predicated or set CPSR.
1037class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001038 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001039 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001040 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001041 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1042 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001043 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001044 let Pattern = pattern;
1045 list<Predicate> Predicates = [IsThumb1Only];
1046}
1047
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001048class T1sI<dag oops, dag iops, InstrItinClass itin,
1049 string opc, string asm, list<dag> pattern>
1050 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001051
1052// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001053class T1sIt<dag oops, dag iops, InstrItinClass itin,
1054 string opc, string asm, list<dag> pattern>
1055 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001056 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001057
1058// Thumb1 instruction that can be predicated.
1059class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001060 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001061 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001062 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001063 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001064 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001065 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001066 let Pattern = pattern;
1067 list<Predicate> Predicates = [IsThumb1Only];
1068}
1069
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001070class T1pI<dag oops, dag iops, InstrItinClass itin,
1071 string opc, string asm, list<dag> pattern>
1072 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001073
1074// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001075class T1pIt<dag oops, dag iops, InstrItinClass itin,
1076 string opc, string asm, list<dag> pattern>
1077 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001078 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001079
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001080class T1pI1<dag oops, dag iops, InstrItinClass itin,
1081 string opc, string asm, list<dag> pattern>
1082 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1083class T1pI2<dag oops, dag iops, InstrItinClass itin,
1084 string opc, string asm, list<dag> pattern>
1085 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1086class T1pI4<dag oops, dag iops, InstrItinClass itin,
1087 string opc, string asm, list<dag> pattern>
1088 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001089class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001090 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1091 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001092
Johnny Chenbbc71b22009-12-16 02:32:54 +00001093class Encoding16 : Encoding {
1094 let Inst{31-16} = 0x0000;
1095}
1096
Johnny Chend68e1192009-12-15 17:24:14 +00001097// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001098class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001099 let Inst{15-10} = opcode;
1100}
1101
1102// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001103class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001104 let Inst{15-14} = 0b00;
1105 let Inst{13-9} = opcode;
1106}
1107
1108// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001109class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001110 let Inst{15-10} = 0b010000;
1111 let Inst{9-6} = opcode;
1112}
1113
1114// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001115class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001116 let Inst{15-10} = 0b010001;
1117 let Inst{9-6} = opcode;
1118}
1119
1120// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001121class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001122 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001123 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001124}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001125class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +00001126class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1127class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1128class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +00001129class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001130
1131// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001132class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001133 let Inst{15-12} = 0b1011;
1134 let Inst{11-5} = opcode;
1135}
1136
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001137// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1138class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001139 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001140 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001141 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001142 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001143 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001144 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001145 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001146 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001147}
1148
Bill Wendlingda2ae632010-08-31 07:50:46 +00001149// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1150// input operand since by default it's a zero register. It will become an
1151// implicit def once it's "flipped".
1152//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001153// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1154// more consistent.
1155class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001156 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001157 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001158 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001159 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001160 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001161 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001162 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001163 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001164}
1165
1166// Special cases
1167class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001168 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001169 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001170 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001171 let OutOperandList = oops;
1172 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001173 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001174 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001175 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001176}
1177
Jim Grosbachd1228742009-12-01 18:10:36 +00001178class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001179 InstrItinClass itin,
1180 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001181 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1182 let OutOperandList = oops;
1183 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001184 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001185 let Pattern = pattern;
1186 list<Predicate> Predicates = [IsThumb1Only];
1187}
1188
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001189class T2I<dag oops, dag iops, InstrItinClass itin,
1190 string opc, string asm, list<dag> pattern>
1191 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1192class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1193 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001194 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001195class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1196 string opc, string asm, list<dag> pattern>
1197 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1198class T2Iso<dag oops, dag iops, InstrItinClass itin,
1199 string opc, string asm, list<dag> pattern>
1200 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1201class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1202 string opc, string asm, list<dag> pattern>
1203 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001204class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001205 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001206 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1207 pattern> {
1208 let Inst{31-27} = 0b11101;
1209 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001210 let Inst{24} = P;
1211 let Inst{23} = ?; // The U bit.
1212 let Inst{22} = 1;
1213 let Inst{21} = W;
1214 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001215}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001216
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001217class T2sI<dag oops, dag iops, InstrItinClass itin,
1218 string opc, string asm, list<dag> pattern>
1219 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001220
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001221class T2XI<dag oops, dag iops, InstrItinClass itin,
1222 string asm, list<dag> pattern>
1223 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1224class T2JTI<dag oops, dag iops, InstrItinClass itin,
1225 string asm, list<dag> pattern>
1226 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001227
Evan Cheng5adb66a2009-09-28 09:14:39 +00001228class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001229 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001230 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1231
Bob Wilson815baeb2010-03-13 01:08:20 +00001232// Two-address instructions
1233class T2XIt<dag oops, dag iops, InstrItinClass itin,
1234 string asm, string cstr, list<dag> pattern>
1235 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001236
Evan Chenge88d5ce2009-07-02 07:28:31 +00001237// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001238class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1239 dag oops, dag iops,
1240 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001241 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001242 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001243 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001244 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001245 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001246 let Pattern = pattern;
1247 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001248 let Inst{31-27} = 0b11111;
1249 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001250 let Inst{24} = signed;
1251 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001252 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001253 let Inst{20} = load;
1254 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001255 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001256 let Inst{10} = pre; // The P bit.
1257 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001258}
1259
Johnny Chenadc77332010-02-26 22:04:29 +00001260// Helper class for disassembly only
1261// A6.3.16 & A6.3.17
1262// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1263class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1264 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1265 : T2I<oops, iops, itin, opc, asm, pattern> {
1266 let Inst{31-27} = 0b11111;
1267 let Inst{26-24} = 0b011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001268 let Inst{23} = long;
Johnny Chenadc77332010-02-26 22:04:29 +00001269 let Inst{22-20} = op22_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001270 let Inst{7-4} = op7_4;
Johnny Chenadc77332010-02-26 22:04:29 +00001271}
1272
David Goodwinc9d138f2009-07-27 19:59:26 +00001273// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1274class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1275 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1276}
1277
1278// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1279class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1280 list<Predicate> Predicates = [IsThumb1Only];
1281}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001282
Evan Cheng9cb9e672009-06-27 02:26:13 +00001283// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1284class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001285 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001286}
1287
Evan Cheng13096642008-08-29 06:41:12 +00001288//===----------------------------------------------------------------------===//
1289
Evan Cheng96581d32008-11-11 02:11:05 +00001290//===----------------------------------------------------------------------===//
1291// ARM VFP Instruction templates.
1292//
1293
David Goodwin3ca524e2009-07-10 17:03:29 +00001294// Almost all VFP instructions are predicable.
1295class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001296 IndexMode im, Format f, InstrItinClass itin,
1297 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001298 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001299 bits<4> p;
1300 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001301 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001302 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001303 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001304 let Pattern = pattern;
1305 list<Predicate> Predicates = [HasVFP2];
1306}
1307
1308// Special cases
1309class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001310 IndexMode im, Format f, InstrItinClass itin,
1311 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001312 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001313 let OutOperandList = oops;
1314 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001315 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001316 let Pattern = pattern;
1317 list<Predicate> Predicates = [HasVFP2];
1318}
1319
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001320class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1321 string opc, string asm, list<dag> pattern>
1322 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1323 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001324
Evan Chengcd8e66a2008-11-11 21:48:44 +00001325// ARM VFP addrmode5 loads and stores
1326class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001327 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001328 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001329 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001330 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001331 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001332 let Inst{27-24} = opcod1;
1333 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001334 let Inst{11-9} = 0b101;
1335 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001336
1337 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001338 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001339}
1340
Evan Chengcd8e66a2008-11-11 21:48:44 +00001341class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001342 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001343 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001344 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001345 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001346 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001347 let Inst{27-24} = opcod1;
1348 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001349 let Inst{11-9} = 0b101;
1350 let Inst{8} = 0; // Single precision
Evan Cheng96581d32008-11-11 02:11:05 +00001351}
1352
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001353// VFP Load / store multiple pseudo instructions.
1354class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1355 list<dag> pattern>
1356 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1357 cstr, itin> {
1358 let OutOperandList = oops;
1359 let InOperandList = !con(iops, (ins pred:$p));
1360 let Pattern = pattern;
1361 list<Predicate> Predicates = [HasVFP2];
1362}
1363
Evan Chengcd8e66a2008-11-11 21:48:44 +00001364// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001365class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001366 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001367 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001368 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001369 // TODO: Mark the instructions with the appropriate subtarget info.
1370 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001371 let Inst{11-9} = 0b101;
1372 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001373
1374 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001375 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001376}
1377
Jim Grosbach72db1822010-09-08 00:25:50 +00001378class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001379 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001380 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001381 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001382 // TODO: Mark the instructions with the appropriate subtarget info.
1383 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001384 let Inst{11-9} = 0b101;
1385 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001386}
1387
Evan Cheng96581d32008-11-11 02:11:05 +00001388// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001389class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1390 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1391 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001392 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001393 let Inst{27-23} = opcod1;
1394 let Inst{21-20} = opcod2;
1395 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001396 let Inst{11-9} = 0b101;
1397 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001398 let Inst{7-6} = opcod4;
1399 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001400}
1401
1402// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001403class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001404 dag iops, InstrItinClass itin, string opc, string asm,
1405 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001406 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001407 let Inst{27-23} = opcod1;
1408 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001409 let Inst{11-9} = 0b101;
1410 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001411 let Inst{6} = op6;
1412 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001413}
1414
Jim Grosbach26767372010-03-24 22:31:46 +00001415// Double precision, binary, VML[AS] (for additional predicate)
1416class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1417 dag iops, InstrItinClass itin, string opc, string asm,
1418 list<dag> pattern>
1419 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1420 let Inst{27-23} = opcod1;
1421 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001422 let Inst{11-9} = 0b101;
1423 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001424 let Inst{6} = op6;
1425 let Inst{4} = op4;
Jim Grosbach26767372010-03-24 22:31:46 +00001426 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1427}
1428
Evan Cheng96581d32008-11-11 02:11:05 +00001429// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001430class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1431 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1432 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001433 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001434 let Inst{27-23} = opcod1;
1435 let Inst{21-20} = opcod2;
1436 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001437 let Inst{11-9} = 0b101;
1438 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001439 let Inst{7-6} = opcod4;
1440 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001441}
1442
David Goodwin338268c2009-08-10 22:17:39 +00001443// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001444// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001445class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1446 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1447 string asm, list<dag> pattern>
1448 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1449 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001450 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1451}
1452
Evan Cheng96581d32008-11-11 02:11:05 +00001453// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001454class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1455 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001456 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001457 let Inst{27-23} = opcod1;
1458 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001459 let Inst{11-9} = 0b101;
1460 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001461 let Inst{6} = op6;
1462 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001463}
1464
David Goodwin338268c2009-08-10 22:17:39 +00001465// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001466// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001467class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001468 dag iops, InstrItinClass itin, string opc, string asm,
1469 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001470 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001471 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1472}
1473
Evan Cheng80a11982008-11-12 06:41:41 +00001474// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001475class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1476 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1477 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001478 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001479 let Inst{27-23} = opcod1;
1480 let Inst{21-20} = opcod2;
1481 let Inst{19-16} = opcod3;
1482 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001483 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001484 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001485}
1486
Johnny Chen811663f2010-02-11 18:47:03 +00001487// VFP conversion between floating-point and fixed-point
1488class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001489 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1490 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001491 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1492 // size (fixed-point number): sx == 0 ? 16 : 32
1493 let Inst{7} = op5; // sx
1494}
1495
David Goodwin338268c2009-08-10 22:17:39 +00001496// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001497class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001498 dag oops, dag iops, InstrItinClass itin,
1499 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001500 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1501 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001502 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1503}
1504
Evan Cheng80a11982008-11-12 06:41:41 +00001505class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001506 InstrItinClass itin,
1507 string opc, string asm, list<dag> pattern>
1508 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001509 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001510 let Inst{11-8} = opcod2;
1511 let Inst{4} = 1;
1512}
1513
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001514class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1515 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1516 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001517
Bob Wilson01135592010-03-23 17:23:59 +00001518class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001519 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1520 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001521
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001522class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1523 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1524 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001525
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001526class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1527 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1528 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001529
Evan Cheng96581d32008-11-11 02:11:05 +00001530//===----------------------------------------------------------------------===//
1531
Bob Wilson5bafff32009-06-22 23:27:02 +00001532//===----------------------------------------------------------------------===//
1533// ARM NEON Instruction templates.
1534//
Evan Cheng13096642008-08-29 06:41:12 +00001535
Johnny Chencaa608e2010-03-20 00:17:00 +00001536class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1537 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1538 list<dag> pattern>
1539 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001540 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001541 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001542 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001543 let Pattern = pattern;
1544 list<Predicate> Predicates = [HasNEON];
1545}
1546
1547// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001548class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1549 InstrItinClass itin, string opc, string asm, string cstr,
1550 list<dag> pattern>
1551 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001552 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001553 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001554 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001555 let Pattern = pattern;
1556 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001557}
1558
Bob Wilsonb07c1712009-10-07 21:53:04 +00001559class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1560 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001561 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001562 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1563 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001564 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001565 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001566 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001567 let Inst{11-8} = op11_8;
1568 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001569}
1570
Bob Wilson709d5922010-08-25 23:27:42 +00001571class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1572 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1573 itin> {
1574 let OutOperandList = oops;
1575 let InOperandList = !con(iops, (ins pred:$p));
1576 list<Predicate> Predicates = [HasNEON];
1577}
1578
Jim Grosbach7cd27292010-10-06 20:36:55 +00001579class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1580 list<dag> pattern>
Bob Wilsonbd916c52010-09-13 23:55:10 +00001581 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1582 itin> {
1583 let OutOperandList = oops;
1584 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001585 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001586 list<Predicate> Predicates = [HasNEON];
1587}
1588
Johnny Chen785516a2010-03-23 16:43:47 +00001589class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001590 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001591 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1592 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001593 let Inst{31-25} = 0b1111001;
1594}
1595
Johnny Chen927b88f2010-03-23 20:40:44 +00001596class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001597 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001598 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001599 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001600 let Inst{31-25} = 0b1111001;
1601}
1602
1603// NEON "one register and a modified immediate" format.
1604class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1605 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001606 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001607 string opc, string dt, string asm, string cstr,
1608 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001609 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001610 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001611 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001612 let Inst{11-8} = op11_8;
1613 let Inst{7} = op7;
1614 let Inst{6} = op6;
1615 let Inst{5} = op5;
1616 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001617}
1618
1619// NEON 2 vector register format.
1620class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1621 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001622 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001623 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001624 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001625 let Inst{24-23} = op24_23;
1626 let Inst{21-20} = op21_20;
1627 let Inst{19-18} = op19_18;
1628 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001629 let Inst{11-7} = op11_7;
1630 let Inst{6} = op6;
1631 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001632}
1633
1634// Same as N2V except it doesn't have a datatype suffix.
1635class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001636 bits<5> op11_7, bit op6, bit op4,
1637 dag oops, dag iops, InstrItinClass itin,
1638 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001639 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001640 let Inst{24-23} = op24_23;
1641 let Inst{21-20} = op21_20;
1642 let Inst{19-18} = op19_18;
1643 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001644 let Inst{11-7} = op11_7;
1645 let Inst{6} = op6;
1646 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001647}
1648
1649// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001650class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001651 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001652 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001653 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001654 let Inst{24} = op24;
1655 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001656 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001657 let Inst{7} = op7;
1658 let Inst{6} = op6;
1659 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001660}
1661
Bob Wilson10bc69c2010-03-27 03:56:52 +00001662// NEON 3 vector register format.
1663class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1664 dag oops, dag iops, Format f, InstrItinClass itin,
1665 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001666 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001667 let Inst{24} = op24;
1668 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001669 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001670 let Inst{11-8} = op11_8;
1671 let Inst{6} = op6;
1672 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001673}
1674
Johnny Chen841e8282010-03-23 21:35:03 +00001675// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001676class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1677 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001678 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001679 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001680 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001681 let Inst{24} = op24;
1682 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001683 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001684 let Inst{11-8} = op11_8;
1685 let Inst{6} = op6;
1686 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001687}
1688
1689// NEON VMOVs between scalar and core registers.
1690class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001691 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001692 string opc, string dt, string asm, list<dag> pattern>
1693 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001694 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001695 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001696 let Inst{11-8} = opcod2;
1697 let Inst{6-5} = opcod3;
1698 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001699
1700 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001701 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001702 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001703 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001704 list<Predicate> Predicates = [HasNEON];
1705}
1706class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001707 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001708 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001709 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001710 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001711class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001712 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001713 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001714 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001715 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001716class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001717 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001718 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001719 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001720 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001721
Johnny Chene4614f72010-03-25 17:01:27 +00001722// Vector Duplicate Lane (from scalar to all elements)
1723class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1724 InstrItinClass itin, string opc, string dt, string asm,
1725 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001726 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001727 let Inst{24-23} = 0b11;
1728 let Inst{21-20} = 0b11;
1729 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001730 let Inst{11-7} = 0b11000;
1731 let Inst{6} = op6;
1732 let Inst{4} = 0;
Johnny Chene4614f72010-03-25 17:01:27 +00001733}
1734
David Goodwin42a83f22009-08-04 17:53:06 +00001735// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1736// for single-precision FP.
1737class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1738 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1739}