blob: 9610427bcbf788973201c7447f129db3ead7e3af [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.
88class AddrMode<bits<4> val> {
89 bits<4> Value = val;
90}
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))> {
156 let PrintMethod = "printSBitModifierOperand";
157}
158
159// Same as cc_out except it defaults to setting CPSR.
160def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
161 let PrintMethod = "printSBitModifierOperand";
162}
163
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000164// ARM special operands for disassembly only.
165//
166
167def cps_opt : Operand<i32> {
168 let PrintMethod = "printCPSOptionOperand";
169}
170
171def msr_mask : Operand<i32> {
172 let PrintMethod = "printMSRMaskOperand";
173}
174
175// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
176// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
177def neg_zero : Operand<i32> {
178 let PrintMethod = "printNegZeroOperand";
179}
180
Evan Cheng446c4282009-07-11 06:43:01 +0000181//===----------------------------------------------------------------------===//
182
Evan Cheng37f25d92008-08-28 23:39:26 +0000183// ARM Instruction templates.
184//
185
Johnny Chend68e1192009-12-15 17:24:14 +0000186class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
187 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000188 : Instruction {
189 let Namespace = "ARM";
190
Evan Cheng37f25d92008-08-28 23:39:26 +0000191 AddrMode AM = am;
Evan Cheng37f25d92008-08-28 23:39:26 +0000192 SizeFlagVal SZ = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000193 IndexMode IM = im;
194 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000195 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000196 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000197 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000198 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000199 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000200
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000201 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
202 let TSFlags{3-0} = AM.Value;
203 let TSFlags{6-4} = SZ.Value;
204 let TSFlags{8-7} = IndexModeBits;
205 let TSFlags{14-9} = Form;
206 let TSFlags{15} = isUnaryDataProc;
207 let TSFlags{16} = canXformTo16Bit;
208 let TSFlags{18-17} = D.Value;
209
Evan Cheng37f25d92008-08-28 23:39:26 +0000210 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000211 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000212}
213
Johnny Chend68e1192009-12-15 17:24:14 +0000214class Encoding {
215 field bits<32> Inst;
216}
217
218class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
219 Format f, Domain d, string cstr, InstrItinClass itin>
220 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
221
222// This Encoding-less class is used by Thumb1 to specify the encoding bits later
223// on by adding flavors to specific instructions.
224class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
225 Format f, Domain d, string cstr, InstrItinClass itin>
226 : InstTemplate<am, sz, im, f, d, cstr, itin>;
227
Bob Wilson01135592010-03-23 17:23:59 +0000228class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000229 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000230 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000231 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000232 let OutOperandList = oops;
233 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000234 let AsmString = asm;
Evan Cheng37f25d92008-08-28 23:39:26 +0000235 let Pattern = pattern;
236}
237
238// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000239class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000240 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000241 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000242 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000243 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000244 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000245 let InOperandList = !con(iops, (ins pred:$p));
Bob Wilsond3038462010-05-24 20:08:34 +0000246 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
Evan Cheng37f25d92008-08-28 23:39:26 +0000247 let Pattern = pattern;
248 list<Predicate> Predicates = [IsARM];
249}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000250
Jim Grosbachf6b28622009-12-14 18:31:20 +0000251// A few are not predicable
252class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000253 IndexMode im, Format f, InstrItinClass itin,
254 string opc, string asm, string cstr,
255 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000256 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
257 let OutOperandList = oops;
258 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000259 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000260 let Pattern = pattern;
261 let isPredicable = 0;
262 list<Predicate> Predicates = [IsARM];
263}
Evan Cheng37f25d92008-08-28 23:39:26 +0000264
Bill Wendling4822bce2010-08-30 01:47:35 +0000265// Same as I except it can optionally modify CPSR. Note it's modeled as an input
266// operand since by default it's a zero register. It will become an implicit def
267// once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000268class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000269 IndexMode im, Format f, InstrItinClass itin,
270 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000271 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000272 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000273 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000274 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsond3038462010-05-24 20:08:34 +0000275 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
Evan Cheng37f25d92008-08-28 23:39:26 +0000276 let Pattern = pattern;
277 list<Predicate> Predicates = [IsARM];
278}
279
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000280// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000281class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000282 IndexMode im, Format f, InstrItinClass itin,
283 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000284 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000285 let OutOperandList = oops;
286 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000287 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000288 let Pattern = pattern;
289 list<Predicate> Predicates = [IsARM];
290}
291
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000292class AI<dag oops, dag iops, Format f, InstrItinClass itin,
293 string opc, string asm, list<dag> pattern>
294 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
295 opc, asm, "", pattern>;
296class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
297 string opc, string asm, list<dag> pattern>
298 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
299 opc, asm, "", pattern>;
300class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000301 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000302 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000303 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000304class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000305 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000306 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000307 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000308
309// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000310class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
311 string opc, string asm, list<dag> pattern>
312 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
313 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000314 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000315}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000316class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
317 string asm, list<dag> pattern>
318 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
319 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000320 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000321}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000322class ABXIx2<dag oops, dag iops, InstrItinClass itin,
323 string asm, list<dag> pattern>
Xerxes Ranby99ccffe2010-07-22 17:28:34 +0000324 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000325 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000326
327// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000328class JTI<dag oops, dag iops, InstrItinClass itin,
329 string asm, list<dag> pattern>
330 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000331 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000332
Jim Grosbach5278eb82009-12-11 01:42:04 +0000333// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000334class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
335 string opc, string asm, list<dag> pattern>
336 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
337 opc, asm, "", pattern> {
338 let Inst{27-23} = 0b00011;
339 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000340 let Inst{20} = 1;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000341 let Inst{11-0} = 0b111110011111;
342}
343class AIstrex<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} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000350 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000351}
352
Evan Cheng0d14fc82008-09-01 01:51:14 +0000353// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000354class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
355 string opc, string asm, list<dag> pattern>
356 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
357 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000358 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000359 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000360}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000361class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
362 string opc, string asm, list<dag> pattern>
363 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
364 opc, asm, "", pattern> {
365 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000366 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000367}
368class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000369 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000370 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000371 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000372 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000373 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000374}
Bob Wilson01135592010-03-23 17:23:59 +0000375class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000376 string opc, string asm, list<dag> pattern>
377 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
378 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000379
Evan Cheng0d14fc82008-09-01 01:51:14 +0000380
381// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000382class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
383 string opc, string asm, list<dag> pattern>
384 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
385 opc, asm, "", pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +0000386 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000387}
Evan Cheng93912732008-09-01 01:27:33 +0000388
389// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000390class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
391 string opc, string asm, list<dag> pattern>
392 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
393 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000394 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000395 let Inst{21} = 0; // W bit
396 let Inst{22} = 0; // B bit
397 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000398 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000399}
Bob Wilson01135592010-03-23 17:23:59 +0000400class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000401 string asm, list<dag> pattern>
402 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000403 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000404 let Inst{20} = 1; // L bit
405 let Inst{21} = 0; // W bit
406 let Inst{22} = 0; // B bit
407 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000408 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000409}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000410class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
411 string opc, string asm, list<dag> pattern>
412 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
413 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000414 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000415 let Inst{21} = 0; // W bit
416 let Inst{22} = 1; // B bit
417 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000418 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000419}
Bob Wilson01135592010-03-23 17:23:59 +0000420class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000421 string asm, list<dag> pattern>
422 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000423 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000424 let Inst{20} = 1; // L bit
425 let Inst{21} = 0; // W bit
426 let Inst{22} = 1; // B bit
427 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000428 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000429}
Evan Cheng17222df2008-08-31 19:02:21 +0000430
Evan Cheng93912732008-09-01 01:27:33 +0000431// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000432class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
433 string opc, string asm, list<dag> pattern>
434 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
435 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000436 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000437 let Inst{21} = 0; // W bit
438 let Inst{22} = 0; // B bit
439 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000440 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000441}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000442class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
443 string asm, list<dag> pattern>
444 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000445 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000446 let Inst{20} = 0; // L bit
447 let Inst{21} = 0; // W bit
448 let Inst{22} = 0; // B bit
449 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000450 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000451}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000452class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
453 string opc, string asm, list<dag> pattern>
454 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
455 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000456 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000457 let Inst{21} = 0; // W bit
458 let Inst{22} = 1; // B bit
459 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000460 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000461}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000462class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
463 string asm, list<dag> pattern>
464 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000465 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000466 let Inst{20} = 0; // L bit
467 let Inst{21} = 0; // W bit
468 let Inst{22} = 1; // B bit
469 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000470 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000471}
Evan Cheng93912732008-09-01 01:27:33 +0000472
Evan Cheng840917b2008-09-01 07:00:14 +0000473// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000474class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
475 string opc, string asm, string cstr, list<dag> pattern>
476 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
477 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000478 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000479 let Inst{21} = 1; // W bit
480 let Inst{22} = 0; // B bit
481 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000482 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000483}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000484class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
485 string opc, string asm, string cstr, list<dag> pattern>
486 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
487 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000488 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000489 let Inst{21} = 1; // W bit
490 let Inst{22} = 1; // B bit
491 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000492 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000493}
494
Evan Cheng840917b2008-09-01 07:00:14 +0000495// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000496class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
497 string opc, string asm, string cstr, list<dag> pattern>
498 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
499 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000500 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000501 let Inst{21} = 1; // W bit
502 let Inst{22} = 0; // B bit
503 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000504 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000505}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000506class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
507 string opc, string asm, string cstr, list<dag> pattern>
508 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
509 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000510 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000511 let Inst{21} = 1; // W bit
512 let Inst{22} = 1; // B bit
513 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000514 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000515}
516
Evan Cheng840917b2008-09-01 07:00:14 +0000517// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000518class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
519 string opc, string asm, string cstr, list<dag> pattern>
520 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
521 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000522 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000523 let Inst{21} = 0; // W bit
524 let Inst{22} = 0; // B bit
525 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000526 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000527}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000528class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
529 string opc, string asm, string cstr, list<dag> pattern>
530 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
531 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000532 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000533 let Inst{21} = 0; // W bit
534 let Inst{22} = 1; // B bit
535 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000536 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000537}
538
Evan Cheng840917b2008-09-01 07:00:14 +0000539// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000540class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
541 string opc, string asm, string cstr, list<dag> pattern>
542 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
543 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000544 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000545 let Inst{21} = 0; // W bit
546 let Inst{22} = 0; // B bit
547 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000548 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000549}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000550class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
551 string opc, string asm, string cstr, list<dag> pattern>
552 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
553 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000554 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000555 let Inst{21} = 0; // W bit
556 let Inst{22} = 1; // B bit
557 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000558 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000559}
560
Evan Cheng0d14fc82008-09-01 01:51:14 +0000561// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000562class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000563 string opc, string asm, list<dag> pattern>
564 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
565 opc, asm, "", pattern>;
566class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
567 string asm, list<dag> pattern>
568 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
569 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000570
Evan Cheng840917b2008-09-01 07:00:14 +0000571// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000572class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
573 string opc, string asm, list<dag> pattern>
574 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
575 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000576 let Inst{4} = 1;
577 let Inst{5} = 1; // H bit
578 let Inst{6} = 0; // S bit
579 let Inst{7} = 1;
580 let Inst{20} = 1; // L bit
581 let Inst{21} = 0; // W bit
582 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000583 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000584}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000585class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
586 string asm, list<dag> pattern>
587 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000588 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000589 let Inst{4} = 1;
590 let Inst{5} = 1; // H bit
591 let Inst{6} = 0; // S bit
592 let Inst{7} = 1;
593 let Inst{20} = 1; // L bit
594 let Inst{21} = 0; // W bit
595 let Inst{24} = 1; // P bit
596}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000597class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
598 string opc, string asm, list<dag> pattern>
599 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
600 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000601 let Inst{4} = 1;
602 let Inst{5} = 1; // H bit
603 let Inst{6} = 1; // S bit
604 let Inst{7} = 1;
605 let Inst{20} = 1; // L bit
606 let Inst{21} = 0; // W bit
607 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000608 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000609}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000610class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
611 string asm, list<dag> pattern>
612 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000613 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000614 let Inst{4} = 1;
615 let Inst{5} = 1; // H bit
616 let Inst{6} = 1; // S bit
617 let Inst{7} = 1;
618 let Inst{20} = 1; // L bit
619 let Inst{21} = 0; // W bit
620 let Inst{24} = 1; // P bit
621}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000622class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
623 string opc, string asm, list<dag> pattern>
624 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
625 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000626 let Inst{4} = 1;
627 let Inst{5} = 0; // H bit
628 let Inst{6} = 1; // S bit
629 let Inst{7} = 1;
630 let Inst{20} = 1; // L bit
631 let Inst{21} = 0; // W bit
632 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000633 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000634}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000635class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
636 string asm, list<dag> pattern>
637 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000638 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000639 let Inst{4} = 1;
640 let Inst{5} = 0; // H bit
641 let Inst{6} = 1; // S bit
642 let Inst{7} = 1;
643 let Inst{20} = 1; // L bit
644 let Inst{21} = 0; // W bit
645 let Inst{24} = 1; // P bit
646}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000647class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
648 string opc, string asm, list<dag> pattern>
649 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
650 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000651 let Inst{4} = 1;
652 let Inst{5} = 0; // H bit
653 let Inst{6} = 1; // S bit
654 let Inst{7} = 1;
655 let Inst{20} = 0; // L bit
656 let Inst{21} = 0; // W bit
657 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000658 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000659}
660
661// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000662class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
663 string opc, string asm, list<dag> pattern>
664 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
665 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000666 let Inst{4} = 1;
667 let Inst{5} = 1; // H bit
668 let Inst{6} = 0; // S bit
669 let Inst{7} = 1;
670 let Inst{20} = 0; // L bit
671 let Inst{21} = 0; // W bit
672 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000673 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000674}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000675class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
676 string asm, list<dag> pattern>
677 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000678 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000679 let Inst{4} = 1;
680 let Inst{5} = 1; // H bit
681 let Inst{6} = 0; // S bit
682 let Inst{7} = 1;
683 let Inst{20} = 0; // L bit
684 let Inst{21} = 0; // W bit
685 let Inst{24} = 1; // P bit
686}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000687class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
688 string opc, string asm, list<dag> pattern>
689 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
690 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000691 let Inst{4} = 1;
692 let Inst{5} = 1; // H bit
693 let Inst{6} = 1; // S bit
694 let Inst{7} = 1;
695 let Inst{20} = 0; // L bit
696 let Inst{21} = 0; // W bit
697 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000698 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000699}
700
701// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000702class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
703 string opc, string asm, string cstr, list<dag> pattern>
704 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
705 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000706 let Inst{4} = 1;
707 let Inst{5} = 1; // H bit
708 let Inst{6} = 0; // S bit
709 let Inst{7} = 1;
710 let Inst{20} = 1; // L bit
711 let Inst{21} = 1; // W bit
712 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000713 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000714}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000715class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
716 string opc, string asm, string cstr, list<dag> pattern>
717 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
718 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000719 let Inst{4} = 1;
720 let Inst{5} = 1; // H bit
721 let Inst{6} = 1; // S bit
722 let Inst{7} = 1;
723 let Inst{20} = 1; // L bit
724 let Inst{21} = 1; // W bit
725 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000726 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000727}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000728class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
729 string opc, string asm, string cstr, list<dag> pattern>
730 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
731 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000732 let Inst{4} = 1;
733 let Inst{5} = 0; // H bit
734 let Inst{6} = 1; // S bit
735 let Inst{7} = 1;
736 let Inst{20} = 1; // L bit
737 let Inst{21} = 1; // W bit
738 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000739 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000740}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000741class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
742 string opc, string asm, string cstr, list<dag> pattern>
743 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
744 opc, asm, cstr, pattern> {
745 let Inst{4} = 1;
746 let Inst{5} = 0; // H bit
747 let Inst{6} = 1; // S bit
748 let Inst{7} = 1;
749 let Inst{20} = 0; // L bit
750 let Inst{21} = 1; // W bit
751 let Inst{24} = 1; // P bit
752 let Inst{27-25} = 0b000;
753}
754
Evan Cheng840917b2008-09-01 07:00:14 +0000755
756// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000757class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
758 string opc, string asm, string cstr, list<dag> pattern>
759 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
760 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000761 let Inst{4} = 1;
762 let Inst{5} = 1; // H bit
763 let Inst{6} = 0; // S bit
764 let Inst{7} = 1;
765 let Inst{20} = 0; // L bit
766 let Inst{21} = 1; // W bit
767 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000768 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000769}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000770class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
771 string opc, string asm, string cstr, list<dag> pattern>
772 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
773 opc, asm, cstr, pattern> {
774 let Inst{4} = 1;
775 let Inst{5} = 1; // H bit
776 let Inst{6} = 1; // S bit
777 let Inst{7} = 1;
778 let Inst{20} = 0; // L bit
779 let Inst{21} = 1; // W bit
780 let Inst{24} = 1; // P bit
781 let Inst{27-25} = 0b000;
782}
Evan Cheng840917b2008-09-01 07:00:14 +0000783
784// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000785class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
786 string opc, string asm, string cstr, list<dag> pattern>
787 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
788 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000789 let Inst{4} = 1;
790 let Inst{5} = 1; // H bit
791 let Inst{6} = 0; // S bit
792 let Inst{7} = 1;
793 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000794 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000795 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000796 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000797}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000798class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
799 string opc, string asm, string cstr, list<dag> pattern>
800 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
801 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000802 let Inst{4} = 1;
803 let Inst{5} = 1; // H bit
804 let Inst{6} = 1; // S bit
805 let Inst{7} = 1;
806 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000807 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000808 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000809 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000810}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000811class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
812 string opc, string asm, string cstr, list<dag> pattern>
813 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
814 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000815 let Inst{4} = 1;
816 let Inst{5} = 0; // H bit
817 let Inst{6} = 1; // S bit
818 let Inst{7} = 1;
819 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000820 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000821 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000822 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000823}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000824class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
825 string opc, string asm, string cstr, list<dag> pattern>
826 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
827 opc, asm, cstr, pattern> {
828 let Inst{4} = 1;
829 let Inst{5} = 0; // H bit
830 let Inst{6} = 1; // S bit
831 let Inst{7} = 1;
832 let Inst{20} = 0; // L bit
833 let Inst{21} = 0; // W bit
834 let Inst{24} = 0; // P bit
835 let Inst{27-25} = 0b000;
836}
Evan Cheng840917b2008-09-01 07:00:14 +0000837
838// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000839class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
840 string opc, string asm, string cstr, list<dag> pattern>
841 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
842 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000843 let Inst{4} = 1;
844 let Inst{5} = 1; // H bit
845 let Inst{6} = 0; // S bit
846 let Inst{7} = 1;
847 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000848 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000849 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000850 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000851}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000852class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
853 string opc, string asm, string cstr, list<dag> pattern>
854 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
855 opc, asm, cstr, pattern> {
856 let Inst{4} = 1;
857 let Inst{5} = 1; // H bit
858 let Inst{6} = 1; // S bit
859 let Inst{7} = 1;
860 let Inst{20} = 0; // L bit
861 let Inst{21} = 0; // W bit
862 let Inst{24} = 0; // P bit
863 let Inst{27-25} = 0b000;
864}
Evan Cheng840917b2008-09-01 07:00:14 +0000865
Evan Cheng0d14fc82008-09-01 01:51:14 +0000866// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000867class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000868 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000869 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000870 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000871 let Inst{20} = 1; // L bit
872 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000873 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000874}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000875class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000876 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000877 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000878 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000879 let Inst{20} = 0; // L bit
880 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000881 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000882}
Evan Cheng37f25d92008-08-28 23:39:26 +0000883
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000884// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000885class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
886 string opc, string asm, list<dag> pattern>
887 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
888 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000889 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000890 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000891 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000892}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000893class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
894 string opc, string asm, list<dag> pattern>
895 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
896 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000897 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000898 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000899}
900
901// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000902class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
903 string opc, string asm, list<dag> pattern>
904 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
905 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000906 let Inst{7-4} = 0b1001;
907 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000908 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000909}
Evan Cheng37f25d92008-08-28 23:39:26 +0000910
Evan Chengeb4f52e2008-11-06 03:35:07 +0000911// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000912class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
913 string opc, string asm, list<dag> pattern>
914 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
915 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000916 let Inst{4} = 0;
917 let Inst{7} = 1;
918 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000919 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000920}
921
Evan Cheng97f48c32008-11-06 22:15:19 +0000922// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000923class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
924 string opc, string asm, list<dag> pattern>
925 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
926 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000927 let Inst{7-4} = 0b0111;
928 let Inst{27-20} = opcod;
929}
930
Evan Cheng8b59db32008-11-07 01:41:35 +0000931// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000932class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
933 string opc, string asm, list<dag> pattern>
934 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
935 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000936 let Inst{27-20} = opcod;
937}
938
Evan Cheng37f25d92008-08-28 23:39:26 +0000939//===----------------------------------------------------------------------===//
940
941// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
942class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
943 list<Predicate> Predicates = [IsARM];
944}
945class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
946 list<Predicate> Predicates = [IsARM, HasV5TE];
947}
948class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
949 list<Predicate> Predicates = [IsARM, HasV6];
950}
Evan Cheng13096642008-08-29 06:41:12 +0000951
952//===----------------------------------------------------------------------===//
953//
954// Thumb Instruction Format Definitions.
955//
956
Evan Cheng13096642008-08-29 06:41:12 +0000957// TI - Thumb instruction.
958
Evan Cheng446c4282009-07-11 06:43:01 +0000959class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000960 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000961 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000962 let OutOperandList = oops;
963 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000964 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000965 let Pattern = pattern;
966 list<Predicate> Predicates = [IsThumb];
967}
968
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000969class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
970 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000971
Evan Cheng35d6c412009-08-04 23:47:55 +0000972// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000973class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
974 list<dag> pattern>
975 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
976 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000977
Johnny Chend68e1192009-12-15 17:24:14 +0000978// tBL, tBX 32-bit instructions
979class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000980 dag oops, dag iops, InstrItinClass itin, string asm,
981 list<dag> pattern>
982 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
983 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000984 let Inst{31-27} = opcod1;
985 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000986 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000987}
Evan Cheng13096642008-08-29 06:41:12 +0000988
989// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000990class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
991 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000992 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000993
Evan Cheng09c39fc2009-06-23 19:38:13 +0000994// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000995class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000996 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000997 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000998 let OutOperandList = oops;
999 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001000 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001001 let Pattern = pattern;
1002 list<Predicate> Predicates = [IsThumb1Only];
1003}
1004
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001005class T1I<dag oops, dag iops, InstrItinClass itin,
1006 string asm, list<dag> pattern>
1007 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1008class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1009 string asm, list<dag> pattern>
1010 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1011class T1JTI<dag oops, dag iops, InstrItinClass itin,
1012 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001013 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001014
1015// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001016class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001017 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001018 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001019 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001020
1021// Thumb1 instruction that can either be predicated or set CPSR.
1022class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001023 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001024 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001025 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001026 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1027 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001028 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1029 let Pattern = pattern;
1030 list<Predicate> Predicates = [IsThumb1Only];
1031}
1032
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001033class T1sI<dag oops, dag iops, InstrItinClass itin,
1034 string opc, string asm, list<dag> pattern>
1035 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001036
1037// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001038class T1sIt<dag oops, dag iops, InstrItinClass itin,
1039 string opc, string asm, list<dag> pattern>
1040 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001041 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001042
1043// Thumb1 instruction that can be predicated.
1044class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001045 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001046 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001047 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001048 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001049 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001050 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1051 let Pattern = pattern;
1052 list<Predicate> Predicates = [IsThumb1Only];
1053}
1054
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001055class T1pI<dag oops, dag iops, InstrItinClass itin,
1056 string opc, string asm, list<dag> pattern>
1057 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001058
1059// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001060class T1pIt<dag oops, dag iops, InstrItinClass itin,
1061 string opc, string asm, list<dag> pattern>
1062 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001063 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001064
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001065class T1pI1<dag oops, dag iops, InstrItinClass itin,
1066 string opc, string asm, list<dag> pattern>
1067 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1068class T1pI2<dag oops, dag iops, InstrItinClass itin,
1069 string opc, string asm, list<dag> pattern>
1070 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1071class T1pI4<dag oops, dag iops, InstrItinClass itin,
1072 string opc, string asm, list<dag> pattern>
1073 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001074class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001075 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1076 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001077
Johnny Chenbbc71b22009-12-16 02:32:54 +00001078class Encoding16 : Encoding {
1079 let Inst{31-16} = 0x0000;
1080}
1081
Johnny Chend68e1192009-12-15 17:24:14 +00001082// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001083class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001084 let Inst{15-10} = opcode;
1085}
1086
1087// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001088class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001089 let Inst{15-14} = 0b00;
1090 let Inst{13-9} = opcode;
1091}
1092
1093// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001094class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001095 let Inst{15-10} = 0b010000;
1096 let Inst{9-6} = opcode;
1097}
1098
1099// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001100class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001101 let Inst{15-10} = 0b010001;
1102 let Inst{9-6} = opcode;
1103}
1104
1105// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001106class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001107 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001108 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001109}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001110class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +00001111class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1112class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1113class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +00001114class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001115
1116// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001117class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001118 let Inst{15-12} = 0b1011;
1119 let Inst{11-5} = opcode;
1120}
1121
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001122// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1123class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001124 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001125 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001126 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001127 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001128 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001129 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1130 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001131 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001132}
1133
Bill Wendlingda2ae632010-08-31 07:50:46 +00001134// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1135// input operand since by default it's a zero register. It will become an
1136// implicit def once it's "flipped".
1137//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001138// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1139// more consistent.
1140class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001141 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001142 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001143 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001144 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001145 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsond3038462010-05-24 20:08:34 +00001146 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001147 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001148 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001149}
1150
1151// Special cases
1152class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001153 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001154 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001155 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001156 let OutOperandList = oops;
1157 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001158 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001159 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001160 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001161}
1162
Jim Grosbachd1228742009-12-01 18:10:36 +00001163class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001164 InstrItinClass itin,
1165 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001166 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1167 let OutOperandList = oops;
1168 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001169 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001170 let Pattern = pattern;
1171 list<Predicate> Predicates = [IsThumb1Only];
1172}
1173
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001174class T2I<dag oops, dag iops, InstrItinClass itin,
1175 string opc, string asm, list<dag> pattern>
1176 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1177class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1178 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001179 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001180class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1181 string opc, string asm, list<dag> pattern>
1182 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1183class T2Iso<dag oops, dag iops, InstrItinClass itin,
1184 string opc, string asm, list<dag> pattern>
1185 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1186class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1187 string opc, string asm, list<dag> pattern>
1188 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001189class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001190 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001191 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1192 pattern> {
1193 let Inst{31-27} = 0b11101;
1194 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001195 let Inst{24} = P;
1196 let Inst{23} = ?; // The U bit.
1197 let Inst{22} = 1;
1198 let Inst{21} = W;
1199 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001200}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001201
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001202class T2sI<dag oops, dag iops, InstrItinClass itin,
1203 string opc, string asm, list<dag> pattern>
1204 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001205
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001206class T2XI<dag oops, dag iops, InstrItinClass itin,
1207 string asm, list<dag> pattern>
1208 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1209class T2JTI<dag oops, dag iops, InstrItinClass itin,
1210 string asm, list<dag> pattern>
1211 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001212
Evan Cheng5adb66a2009-09-28 09:14:39 +00001213class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001214 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001215 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1216
Bob Wilson815baeb2010-03-13 01:08:20 +00001217// Two-address instructions
1218class T2XIt<dag oops, dag iops, InstrItinClass itin,
1219 string asm, string cstr, list<dag> pattern>
1220 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001221
Evan Chenge88d5ce2009-07-02 07:28:31 +00001222// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001223class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1224 dag oops, dag iops,
1225 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001226 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001227 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001228 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001229 let InOperandList = !con(iops, (ins pred:$p));
Evan Chenge88d5ce2009-07-02 07:28:31 +00001230 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1231 let Pattern = pattern;
1232 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001233 let Inst{31-27} = 0b11111;
1234 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001235 let Inst{24} = signed;
1236 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001237 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001238 let Inst{20} = load;
1239 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001240 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001241 let Inst{10} = pre; // The P bit.
1242 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001243}
1244
Johnny Chenadc77332010-02-26 22:04:29 +00001245// Helper class for disassembly only
1246// A6.3.16 & A6.3.17
1247// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1248class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1249 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1250 : T2I<oops, iops, itin, opc, asm, pattern> {
1251 let Inst{31-27} = 0b11111;
1252 let Inst{26-24} = 0b011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001253 let Inst{23} = long;
Johnny Chenadc77332010-02-26 22:04:29 +00001254 let Inst{22-20} = op22_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001255 let Inst{7-4} = op7_4;
Johnny Chenadc77332010-02-26 22:04:29 +00001256}
1257
David Goodwinc9d138f2009-07-27 19:59:26 +00001258// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1259class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1260 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1261}
1262
1263// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1264class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1265 list<Predicate> Predicates = [IsThumb1Only];
1266}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001267
Evan Cheng9cb9e672009-06-27 02:26:13 +00001268// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1269class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001270 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001271}
1272
Evan Cheng13096642008-08-29 06:41:12 +00001273//===----------------------------------------------------------------------===//
1274
Evan Cheng96581d32008-11-11 02:11:05 +00001275//===----------------------------------------------------------------------===//
1276// ARM VFP Instruction templates.
1277//
1278
David Goodwin3ca524e2009-07-10 17:03:29 +00001279// Almost all VFP instructions are predicable.
1280class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001281 IndexMode im, Format f, InstrItinClass itin,
1282 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001283 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001284 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001285 let InOperandList = !con(iops, (ins pred:$p));
Bob Wilsond3038462010-05-24 20:08:34 +00001286 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
David Goodwin3ca524e2009-07-10 17:03:29 +00001287 let Pattern = pattern;
1288 list<Predicate> Predicates = [HasVFP2];
1289}
1290
1291// Special cases
1292class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001293 IndexMode im, Format f, InstrItinClass itin,
1294 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001295 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001296 let OutOperandList = oops;
1297 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001298 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001299 let Pattern = pattern;
1300 list<Predicate> Predicates = [HasVFP2];
1301}
1302
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001303class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1304 string opc, string asm, list<dag> pattern>
1305 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1306 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001307
Evan Chengcd8e66a2008-11-11 21:48:44 +00001308// ARM VFP addrmode5 loads and stores
1309class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001310 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001311 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001312 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001313 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001314 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001315 let Inst{27-24} = opcod1;
1316 let Inst{21-20} = opcod2;
1317 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001318
1319 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001320 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001321}
1322
Evan Chengcd8e66a2008-11-11 21:48:44 +00001323class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001324 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001325 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001326 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001327 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001328 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001329 let Inst{27-24} = opcod1;
1330 let Inst{21-20} = opcod2;
1331 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001332}
1333
Evan Chengcd8e66a2008-11-11 21:48:44 +00001334// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001335class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001336 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001337 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001338 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001339 // TODO: Mark the instructions with the appropriate subtarget info.
1340 let Inst{27-25} = 0b110;
1341 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001342
1343 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001344 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001345}
1346
Jim Grosbach72db1822010-09-08 00:25:50 +00001347class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001348 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001349 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001350 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001351 // TODO: Mark the instructions with the appropriate subtarget info.
1352 let Inst{27-25} = 0b110;
1353 let Inst{11-8} = 0b1010;
1354}
1355
Evan Cheng96581d32008-11-11 02:11:05 +00001356// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001357class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1358 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1359 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001360 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001361 let Inst{27-23} = opcod1;
1362 let Inst{21-20} = opcod2;
1363 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001364 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001365 let Inst{7-6} = opcod4;
1366 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001367}
1368
1369// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001370class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001371 dag iops, InstrItinClass itin, string opc, string asm,
1372 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001373 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001374 let Inst{27-23} = opcod1;
1375 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001376 let Inst{11-8} = 0b1011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001377 let Inst{6} = op6;
1378 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001379}
1380
Jim Grosbach26767372010-03-24 22:31:46 +00001381// Double precision, binary, VML[AS] (for additional predicate)
1382class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1383 dag iops, InstrItinClass itin, string opc, string asm,
1384 list<dag> pattern>
1385 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1386 let Inst{27-23} = opcod1;
1387 let Inst{21-20} = opcod2;
1388 let Inst{11-8} = 0b1011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001389 let Inst{6} = op6;
1390 let Inst{4} = op4;
Jim Grosbach26767372010-03-24 22:31:46 +00001391 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1392}
1393
Evan Cheng96581d32008-11-11 02:11:05 +00001394// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001395class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1396 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1397 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001398 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001399 let Inst{27-23} = opcod1;
1400 let Inst{21-20} = opcod2;
1401 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001402 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001403 let Inst{7-6} = opcod4;
1404 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001405}
1406
David Goodwin338268c2009-08-10 22:17:39 +00001407// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001408// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001409class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1410 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1411 string asm, list<dag> pattern>
1412 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1413 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001414 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1415}
1416
Evan Cheng96581d32008-11-11 02:11:05 +00001417// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001418class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1419 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001420 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001421 let Inst{27-23} = opcod1;
1422 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001423 let Inst{11-8} = 0b1010;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001424 let Inst{6} = op6;
1425 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001426}
1427
David Goodwin338268c2009-08-10 22:17:39 +00001428// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001429// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001430class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001431 dag iops, InstrItinClass itin, string opc, string asm,
1432 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001433 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001434 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1435}
1436
Evan Cheng80a11982008-11-12 06:41:41 +00001437// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001438class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1439 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1440 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001441 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001442 let Inst{27-23} = opcod1;
1443 let Inst{21-20} = opcod2;
1444 let Inst{19-16} = opcod3;
1445 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001446 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001447 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001448}
1449
Johnny Chen811663f2010-02-11 18:47:03 +00001450// VFP conversion between floating-point and fixed-point
1451class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001452 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1453 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001454 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1455 // size (fixed-point number): sx == 0 ? 16 : 32
1456 let Inst{7} = op5; // sx
1457}
1458
David Goodwin338268c2009-08-10 22:17:39 +00001459// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001460class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001461 dag oops, dag iops, InstrItinClass itin,
1462 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001463 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1464 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001465 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1466}
1467
Evan Cheng80a11982008-11-12 06:41:41 +00001468class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001469 InstrItinClass itin,
1470 string opc, string asm, list<dag> pattern>
1471 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001472 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001473 let Inst{11-8} = opcod2;
1474 let Inst{4} = 1;
1475}
1476
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001477class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1478 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1479 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001480
Bob Wilson01135592010-03-23 17:23:59 +00001481class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001482 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1483 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001484
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001485class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1486 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1487 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001488
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001489class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1490 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1491 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001492
Evan Cheng96581d32008-11-11 02:11:05 +00001493//===----------------------------------------------------------------------===//
1494
Bob Wilson5bafff32009-06-22 23:27:02 +00001495//===----------------------------------------------------------------------===//
1496// ARM NEON Instruction templates.
1497//
Evan Cheng13096642008-08-29 06:41:12 +00001498
Johnny Chencaa608e2010-03-20 00:17:00 +00001499class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1500 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1501 list<dag> pattern>
1502 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001503 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001504 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001505 let AsmString = !strconcat(
1506 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1507 !strconcat("\t", asm));
1508 let Pattern = pattern;
1509 list<Predicate> Predicates = [HasNEON];
1510}
1511
1512// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001513class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1514 InstrItinClass itin, string opc, string asm, string cstr,
1515 list<dag> pattern>
1516 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001517 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001518 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001519 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001520 let Pattern = pattern;
1521 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001522}
1523
Bob Wilsonb07c1712009-10-07 21:53:04 +00001524class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1525 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001526 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001527 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1528 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001529 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001530 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001531 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001532 let Inst{11-8} = op11_8;
1533 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001534}
1535
Bob Wilson709d5922010-08-25 23:27:42 +00001536class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1537 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1538 itin> {
1539 let OutOperandList = oops;
1540 let InOperandList = !con(iops, (ins pred:$p));
1541 list<Predicate> Predicates = [HasNEON];
1542}
1543
Bob Wilsonbd916c52010-09-13 23:55:10 +00001544class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr>
1545 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1546 itin> {
1547 let OutOperandList = oops;
1548 let InOperandList = !con(iops, (ins pred:$p));
1549 list<Predicate> Predicates = [HasNEON];
1550}
1551
Johnny Chen785516a2010-03-23 16:43:47 +00001552class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001553 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001554 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1555 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001556 let Inst{31-25} = 0b1111001;
1557}
1558
Johnny Chen927b88f2010-03-23 20:40:44 +00001559class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001560 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001561 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001562 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001563 let Inst{31-25} = 0b1111001;
1564}
1565
1566// NEON "one register and a modified immediate" format.
1567class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1568 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001569 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001570 string opc, string dt, string asm, string cstr,
1571 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001572 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001573 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001574 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001575 let Inst{11-8} = op11_8;
1576 let Inst{7} = op7;
1577 let Inst{6} = op6;
1578 let Inst{5} = op5;
1579 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001580}
1581
1582// NEON 2 vector register format.
1583class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1584 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001585 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001586 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001587 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001588 let Inst{24-23} = op24_23;
1589 let Inst{21-20} = op21_20;
1590 let Inst{19-18} = op19_18;
1591 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001592 let Inst{11-7} = op11_7;
1593 let Inst{6} = op6;
1594 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001595}
1596
1597// Same as N2V except it doesn't have a datatype suffix.
1598class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001599 bits<5> op11_7, bit op6, bit op4,
1600 dag oops, dag iops, InstrItinClass itin,
1601 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001602 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001603 let Inst{24-23} = op24_23;
1604 let Inst{21-20} = op21_20;
1605 let Inst{19-18} = op19_18;
1606 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001607 let Inst{11-7} = op11_7;
1608 let Inst{6} = op6;
1609 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001610}
1611
1612// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001613class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001614 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001615 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001616 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001617 let Inst{24} = op24;
1618 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001619 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001620 let Inst{7} = op7;
1621 let Inst{6} = op6;
1622 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001623}
1624
Bob Wilson10bc69c2010-03-27 03:56:52 +00001625// NEON 3 vector register format.
1626class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1627 dag oops, dag iops, Format f, InstrItinClass itin,
1628 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001629 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001630 let Inst{24} = op24;
1631 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001632 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001633 let Inst{11-8} = op11_8;
1634 let Inst{6} = op6;
1635 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001636}
1637
Johnny Chen841e8282010-03-23 21:35:03 +00001638// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001639class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1640 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001641 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001642 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001643 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001644 let Inst{24} = op24;
1645 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001646 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001647 let Inst{11-8} = op11_8;
1648 let Inst{6} = op6;
1649 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001650}
1651
1652// NEON VMOVs between scalar and core registers.
1653class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001654 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001655 string opc, string dt, string asm, list<dag> pattern>
1656 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001657 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001658 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001659 let Inst{11-8} = opcod2;
1660 let Inst{6-5} = opcod3;
1661 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001662
1663 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001664 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001665 let AsmString = !strconcat(
1666 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1667 !strconcat("\t", asm));
1668 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001669 list<Predicate> Predicates = [HasNEON];
1670}
1671class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001672 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001673 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001674 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001675 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001676class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001677 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001678 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001679 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001680 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001681class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001682 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001683 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001684 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001685 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001686
Johnny Chene4614f72010-03-25 17:01:27 +00001687// Vector Duplicate Lane (from scalar to all elements)
1688class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1689 InstrItinClass itin, string opc, string dt, string asm,
1690 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001691 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001692 let Inst{24-23} = 0b11;
1693 let Inst{21-20} = 0b11;
1694 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001695 let Inst{11-7} = 0b11000;
1696 let Inst{6} = op6;
1697 let Inst{4} = 0;
Johnny Chene4614f72010-03-25 17:01:27 +00001698}
1699
David Goodwin42a83f22009-08-04 17:53:06 +00001700// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1701// for single-precision FP.
1702class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1703 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1704}