blob: a0f9a4b29fb18665811f56cf06385e25757b264b [file] [log] [blame]
Evan Cheng37f25d92008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
Bob Wilson01135592010-03-23 17:23:59 +00002//
Evan Cheng37f25d92008-08-28 23:39:26 +00003// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bob Wilson01135592010-03-23 17:23:59 +00007//
Evan Cheng37f25d92008-08-28 23:39:26 +00008//===----------------------------------------------------------------------===//
9
10//===----------------------------------------------------------------------===//
11//
12// ARM Instruction Format Definitions.
13//
14
15// Format specifies the encoding used by the instruction. This is part of the
16// ad-hoc solution used to emit machine instruction encodings by our machine
17// code emitter.
Bob Wilson89ef7b72010-03-17 21:13:43 +000018class Format<bits<6> val> {
19 bits<6> Value = val;
Evan Cheng37f25d92008-08-28 23:39:26 +000020}
21
Evan Chengffa6d962008-11-13 23:36:57 +000022def Pseudo : Format<0>;
23def MulFrm : Format<1>;
24def BrFrm : Format<2>;
25def BrMiscFrm : Format<3>;
Evan Cheng37f25d92008-08-28 23:39:26 +000026
Evan Chengffa6d962008-11-13 23:36:57 +000027def DPFrm : Format<4>;
28def DPSoRegFrm : Format<5>;
Evan Cheng37f25d92008-08-28 23:39:26 +000029
Evan Chengffa6d962008-11-13 23:36:57 +000030def LdFrm : Format<6>;
31def StFrm : Format<7>;
32def LdMiscFrm : Format<8>;
33def StMiscFrm : Format<9>;
34def LdStMulFrm : Format<10>;
Evan Cheng37f25d92008-08-28 23:39:26 +000035
Johnny Chen81f04d52010-03-19 17:39:00 +000036def LdStExFrm : Format<11>;
Jim Grosbach5278eb82009-12-11 01:42:04 +000037
Johnny Chen81f04d52010-03-19 17:39:00 +000038def ArithMiscFrm : Format<12>;
Bob Wilson9a1c1892010-08-11 00:01:18 +000039def SatFrm : Format<13>;
40def ExtFrm : Format<14>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000041
Bob Wilson9a1c1892010-08-11 00:01:18 +000042def VFPUnaryFrm : Format<15>;
43def VFPBinaryFrm : Format<16>;
44def VFPConv1Frm : Format<17>;
45def VFPConv2Frm : Format<18>;
46def VFPConv3Frm : Format<19>;
47def VFPConv4Frm : Format<20>;
48def VFPConv5Frm : Format<21>;
49def VFPLdStFrm : Format<22>;
50def VFPLdStMulFrm : Format<23>;
51def VFPMiscFrm : Format<24>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000052
Bob Wilson9a1c1892010-08-11 00:01:18 +000053def ThumbFrm : Format<25>;
54def MiscFrm : Format<26>;
Evan Cheng37f25d92008-08-28 23:39:26 +000055
Bob Wilson9a1c1892010-08-11 00:01:18 +000056def NGetLnFrm : Format<27>;
57def NSetLnFrm : Format<28>;
58def NDupFrm : Format<29>;
59def NLdStFrm : Format<30>;
60def N1RegModImmFrm: Format<31>;
61def N2RegFrm : Format<32>;
62def NVCVTFrm : Format<33>;
63def NVDupLnFrm : Format<34>;
64def N2RegVShLFrm : Format<35>;
65def N2RegVShRFrm : Format<36>;
66def N3RegFrm : Format<37>;
67def N3RegVShFrm : Format<38>;
68def NVExtFrm : Format<39>;
69def NVMulSLFrm : Format<40>;
70def NVTBLFrm : Format<41>;
Johnny Chencaa608e2010-03-20 00:17:00 +000071
Evan Cheng34a0fa32009-07-08 01:46:35 +000072// Misc flags.
73
Evan Chengedda31c2008-11-05 18:35:52 +000074// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000075// UnaryDP - Indicates this is a unary data processing instruction, i.e.
76// it doesn't have a Rn operand.
77class UnaryDP { bit isUnaryDataProc = 1; }
78
79// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
80// a 16-bit Thumb instruction if certain conditions are met.
81class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000082
Evan Cheng37f25d92008-08-28 23:39:26 +000083//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000084// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000085//
86
87// Addressing mode.
Jim Grosbachd86609f2010-10-05 18:14:55 +000088class AddrMode<bits<5> val> {
89 bits<5> Value = val;
Evan Cheng055b0312009-06-29 07:51:04 +000090}
Bill Wendlingda2ae632010-08-31 07:50:46 +000091def AddrModeNone : AddrMode<0>;
92def AddrMode1 : AddrMode<1>;
93def AddrMode2 : AddrMode<2>;
94def AddrMode3 : AddrMode<3>;
95def AddrMode4 : AddrMode<4>;
96def AddrMode5 : AddrMode<5>;
97def AddrMode6 : AddrMode<6>;
98def AddrModeT1_1 : AddrMode<7>;
99def AddrModeT1_2 : AddrMode<8>;
100def AddrModeT1_4 : AddrMode<9>;
101def AddrModeT1_s : AddrMode<10>;
102def AddrModeT2_i12 : AddrMode<11>;
103def AddrModeT2_i8 : AddrMode<12>;
104def AddrModeT2_so : AddrMode<13>;
105def AddrModeT2_pc : AddrMode<14>;
Bob Wilson8b024a52009-07-01 23:16:05 +0000106def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng055b0312009-06-29 07:51:04 +0000107
108// Instruction size.
109class SizeFlagVal<bits<3> val> {
110 bits<3> Value = val;
111}
112def SizeInvalid : SizeFlagVal<0>; // Unset.
113def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
114def Size8Bytes : SizeFlagVal<2>;
115def Size4Bytes : SizeFlagVal<3>;
116def Size2Bytes : SizeFlagVal<4>;
117
118// Load / store index mode.
119class IndexMode<bits<2> val> {
120 bits<2> Value = val;
121}
122def IndexModeNone : IndexMode<0>;
123def IndexModePre : IndexMode<1>;
124def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000125def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000126
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000127// Instruction execution domain.
128class Domain<bits<2> val> {
129 bits<2> Value = val;
130}
131def GenericDomain : Domain<0>;
132def VFPDomain : Domain<1>; // Instructions in VFP domain only
133def NeonDomain : Domain<2>; // Instructions in Neon domain only
134def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
135
Evan Cheng055b0312009-06-29 07:51:04 +0000136//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000137
Evan Cheng446c4282009-07-11 06:43:01 +0000138// ARM special operands.
139//
140
Daniel Dunbar8462b302010-08-11 06:36:53 +0000141def CondCodeOperand : AsmOperandClass {
142 let Name = "CondCode";
143 let SuperClasses = [];
144}
145
Evan Cheng446c4282009-07-11 06:43:01 +0000146// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
147// register whose default is 0 (no register).
148def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
149 (ops (i32 14), (i32 zero_reg))> {
150 let PrintMethod = "printPredicateOperand";
Daniel Dunbar8462b302010-08-11 06:36:53 +0000151 let ParserMatchClass = CondCodeOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000152}
153
154// Conditional code result for instructions whose 's' bit is set, e.g. subs.
155def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Jim Grosbach08bd5492010-10-12 23:00:24 +0000156 string EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000157 let PrintMethod = "printSBitModifierOperand";
158}
159
160// Same as cc_out except it defaults to setting CPSR.
161def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Jim Grosbach08bd5492010-10-12 23:00:24 +0000162 string EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000163 let PrintMethod = "printSBitModifierOperand";
164}
165
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000166// ARM special operands for disassembly only.
167//
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000168def setend_op : Operand<i32> {
169 let PrintMethod = "printSetendOperand";
170}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000171
172def cps_opt : Operand<i32> {
173 let PrintMethod = "printCPSOptionOperand";
174}
175
176def msr_mask : Operand<i32> {
177 let PrintMethod = "printMSRMaskOperand";
178}
179
180// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
181// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
182def neg_zero : Operand<i32> {
183 let PrintMethod = "printNegZeroOperand";
184}
185
Evan Cheng446c4282009-07-11 06:43:01 +0000186//===----------------------------------------------------------------------===//
187
Evan Cheng37f25d92008-08-28 23:39:26 +0000188// ARM Instruction templates.
189//
190
Johnny Chend68e1192009-12-15 17:24:14 +0000191class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
192 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000193 : Instruction {
194 let Namespace = "ARM";
195
Evan Cheng37f25d92008-08-28 23:39:26 +0000196 AddrMode AM = am;
Evan Cheng37f25d92008-08-28 23:39:26 +0000197 SizeFlagVal SZ = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000198 IndexMode IM = im;
199 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000200 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000201 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000202 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000203 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000204 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000205
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000206 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000207 let TSFlags{4-0} = AM.Value;
208 let TSFlags{7-5} = SZ.Value;
209 let TSFlags{9-8} = IndexModeBits;
210 let TSFlags{15-10} = Form;
211 let TSFlags{16} = isUnaryDataProc;
212 let TSFlags{17} = canXformTo16Bit;
213 let TSFlags{19-18} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000214
Evan Cheng37f25d92008-08-28 23:39:26 +0000215 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000216 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000217}
218
Johnny Chend68e1192009-12-15 17:24:14 +0000219class Encoding {
220 field bits<32> Inst;
221}
222
223class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
224 Format f, Domain d, string cstr, InstrItinClass itin>
225 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
226
227// This Encoding-less class is used by Thumb1 to specify the encoding bits later
228// on by adding flavors to specific instructions.
229class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
230 Format f, Domain d, string cstr, InstrItinClass itin>
231 : InstTemplate<am, sz, im, f, d, cstr, itin>;
232
Bob Wilson01135592010-03-23 17:23:59 +0000233class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000234 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000235 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000236 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000237 let OutOperandList = oops;
238 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000239 let AsmString = asm;
Evan Cheng37f25d92008-08-28 23:39:26 +0000240 let Pattern = pattern;
241}
242
243// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000244class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000245 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000246 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000247 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000248 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000249 bits<4> p;
250 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000251 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000252 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000253 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000254 let Pattern = pattern;
255 list<Predicate> Predicates = [IsARM];
256}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000257
Jim Grosbachf6b28622009-12-14 18:31:20 +0000258// A few are not predicable
259class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000260 IndexMode im, Format f, InstrItinClass itin,
261 string opc, string asm, string cstr,
262 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000263 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
264 let OutOperandList = oops;
265 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000266 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000267 let Pattern = pattern;
268 let isPredicable = 0;
269 list<Predicate> Predicates = [IsARM];
270}
Evan Cheng37f25d92008-08-28 23:39:26 +0000271
Bill Wendling4822bce2010-08-30 01:47:35 +0000272// Same as I except it can optionally modify CPSR. Note it's modeled as an input
273// operand since by default it's a zero register. It will become an implicit def
274// once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000275class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000276 IndexMode im, Format f, InstrItinClass itin,
277 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000278 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000279 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000280 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000281 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000282 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000283 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000284
Evan Cheng37f25d92008-08-28 23:39:26 +0000285 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000286 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000287 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000288 let Pattern = pattern;
289 list<Predicate> Predicates = [IsARM];
290}
291
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000292// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000293class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000294 IndexMode im, Format f, InstrItinClass itin,
295 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000296 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000297 let OutOperandList = oops;
298 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000299 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000300 let Pattern = pattern;
301 list<Predicate> Predicates = [IsARM];
302}
303
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000304class AI<dag oops, dag iops, Format f, InstrItinClass itin,
305 string opc, string asm, list<dag> pattern>
306 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
307 opc, asm, "", pattern>;
308class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
309 string opc, string asm, list<dag> pattern>
310 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
311 opc, asm, "", pattern>;
312class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000313 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000314 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000315 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000316class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000317 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000318 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000319 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000320
321// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000322class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
323 string opc, string asm, list<dag> pattern>
324 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
325 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000326 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000327}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000328class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
329 string asm, list<dag> pattern>
330 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
331 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000332 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000333}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000334class ABXIx2<dag oops, dag iops, InstrItinClass itin,
335 string asm, list<dag> pattern>
Xerxes Ranby99ccffe2010-07-22 17:28:34 +0000336 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000337 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000338
339// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000340class JTI<dag oops, dag iops, InstrItinClass itin,
341 string asm, list<dag> pattern>
342 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000343 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000344
Jim Grosbach5278eb82009-12-11 01:42:04 +0000345// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000346class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
347 string opc, string asm, list<dag> pattern>
348 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
349 opc, asm, "", pattern> {
350 let Inst{27-23} = 0b00011;
351 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000352 let Inst{20} = 1;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000353 let Inst{11-0} = 0b111110011111;
354}
355class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
356 string opc, string asm, list<dag> pattern>
357 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
358 opc, asm, "", pattern> {
359 let Inst{27-23} = 0b00011;
360 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000361 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000362 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000363}
364
Evan Cheng0d14fc82008-09-01 01:51:14 +0000365// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000366class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
367 string opc, string asm, list<dag> pattern>
368 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
369 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000370 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000371 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000372}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000373class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
374 string opc, string asm, list<dag> pattern>
375 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
376 opc, asm, "", pattern> {
377 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000378 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000379}
380class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000381 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000382 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000383 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000384 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000385 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000386}
Bob Wilson01135592010-03-23 17:23:59 +0000387class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000388 string opc, string asm, list<dag> pattern>
389 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
390 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000391
Evan Cheng0d14fc82008-09-01 01:51:14 +0000392
393// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000394class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
395 string opc, string asm, list<dag> pattern>
396 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
397 opc, asm, "", pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +0000398 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000399}
Evan Cheng93912732008-09-01 01:27:33 +0000400
401// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000402class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
403 string opc, string asm, list<dag> pattern>
404 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
405 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000406 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000407 let Inst{21} = 0; // W bit
408 let Inst{22} = 0; // B bit
409 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000410 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000411}
Bob Wilson01135592010-03-23 17:23:59 +0000412class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000413 string asm, list<dag> pattern>
414 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000415 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000416 let Inst{20} = 1; // L bit
417 let Inst{21} = 0; // W bit
418 let Inst{22} = 0; // B bit
419 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000420 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000421}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000422class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
423 string opc, string asm, list<dag> pattern>
424 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
425 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000426 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000427 let Inst{21} = 0; // W bit
428 let Inst{22} = 1; // B bit
429 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000430 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000431}
Bob Wilson01135592010-03-23 17:23:59 +0000432class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000433 string asm, list<dag> pattern>
434 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000435 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000436 let Inst{20} = 1; // L bit
437 let Inst{21} = 0; // W bit
438 let Inst{22} = 1; // B bit
439 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000440 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000441}
Evan Cheng17222df2008-08-31 19:02:21 +0000442
Evan Cheng93912732008-09-01 01:27:33 +0000443// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000444class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
445 string opc, string asm, list<dag> pattern>
446 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
447 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000448 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000449 let Inst{21} = 0; // W bit
450 let Inst{22} = 0; // B bit
451 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000452 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000453}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000454class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
455 string asm, list<dag> pattern>
456 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000457 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000458 let Inst{20} = 0; // L bit
459 let Inst{21} = 0; // W bit
460 let Inst{22} = 0; // B bit
461 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000462 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000463}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000464class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
465 string opc, string asm, list<dag> pattern>
466 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
467 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000468 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000469 let Inst{21} = 0; // W bit
470 let Inst{22} = 1; // B bit
471 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000472 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000473}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000474class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
475 string asm, list<dag> pattern>
476 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000477 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000478 let Inst{20} = 0; // L bit
479 let Inst{21} = 0; // W bit
480 let Inst{22} = 1; // B bit
481 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000482 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000483}
Evan Cheng93912732008-09-01 01:27:33 +0000484
Evan Cheng840917b2008-09-01 07:00:14 +0000485// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000486class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
487 string opc, string asm, string cstr, list<dag> pattern>
488 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
489 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000490 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000491 let Inst{21} = 1; // W bit
492 let Inst{22} = 0; // B bit
493 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000494 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000495}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000496class AI2ldbpr<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} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000501 let Inst{21} = 1; // W bit
502 let Inst{22} = 1; // 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}
506
Evan Cheng840917b2008-09-01 07:00:14 +0000507// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000508class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
509 string opc, string asm, string cstr, list<dag> pattern>
510 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
511 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000512 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000513 let Inst{21} = 1; // W bit
514 let Inst{22} = 0; // B bit
515 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000516 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000517}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000518class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
519 string opc, string asm, string cstr, list<dag> pattern>
520 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
521 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000522 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000523 let Inst{21} = 1; // W bit
524 let Inst{22} = 1; // B bit
525 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000526 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000527}
528
Evan Cheng840917b2008-09-01 07:00:14 +0000529// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000530class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
531 string opc, string asm, string cstr, list<dag> pattern>
532 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
533 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000534 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000535 let Inst{21} = 0; // W bit
536 let Inst{22} = 0; // B bit
537 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000538 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000539}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000540class AI2ldbpo<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} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000545 let Inst{21} = 0; // W bit
546 let Inst{22} = 1; // 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}
550
Evan Cheng840917b2008-09-01 07:00:14 +0000551// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000552class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
553 string opc, string asm, string cstr, list<dag> pattern>
554 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
555 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000556 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000557 let Inst{21} = 0; // W bit
558 let Inst{22} = 0; // B bit
559 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000560 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000561}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000562class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
563 string opc, string asm, string cstr, list<dag> pattern>
564 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
565 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000566 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000567 let Inst{21} = 0; // W bit
568 let Inst{22} = 1; // B bit
569 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000570 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000571}
572
Evan Cheng0d14fc82008-09-01 01:51:14 +0000573// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000574class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000575 string opc, string asm, list<dag> pattern>
576 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
577 opc, asm, "", pattern>;
578class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
579 string asm, list<dag> pattern>
580 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
581 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000582
Evan Cheng840917b2008-09-01 07:00:14 +0000583// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000584class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
585 string opc, string asm, list<dag> pattern>
586 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
587 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000588 let Inst{4} = 1;
589 let Inst{5} = 1; // H bit
590 let Inst{6} = 0; // S bit
591 let Inst{7} = 1;
592 let Inst{20} = 1; // L bit
593 let Inst{21} = 0; // W bit
594 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000595 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000596}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000597class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
598 string asm, list<dag> pattern>
599 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000600 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000601 let Inst{4} = 1;
602 let Inst{5} = 1; // H bit
603 let Inst{6} = 0; // 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
608}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000609class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
610 string opc, string asm, list<dag> pattern>
611 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
612 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000613 let Inst{4} = 1;
614 let Inst{5} = 1; // H bit
615 let Inst{6} = 1; // S bit
616 let Inst{7} = 1;
617 let Inst{20} = 1; // L bit
618 let Inst{21} = 0; // W bit
619 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000620 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000621}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000622class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
623 string asm, list<dag> pattern>
624 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000625 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000626 let Inst{4} = 1;
627 let Inst{5} = 1; // 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
633}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000634class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
635 string opc, string asm, list<dag> pattern>
636 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
637 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000638 let Inst{4} = 1;
639 let Inst{5} = 0; // H bit
640 let Inst{6} = 1; // S bit
641 let Inst{7} = 1;
642 let Inst{20} = 1; // L bit
643 let Inst{21} = 0; // W bit
644 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000645 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000646}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000647class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
648 string asm, list<dag> pattern>
649 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000650 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +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} = 1; // L bit
656 let Inst{21} = 0; // W bit
657 let Inst{24} = 1; // P bit
658}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000659class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
660 string opc, string asm, list<dag> pattern>
661 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
662 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000663 let Inst{4} = 1;
664 let Inst{5} = 0; // H bit
665 let Inst{6} = 1; // S bit
666 let Inst{7} = 1;
667 let Inst{20} = 0; // L bit
668 let Inst{21} = 0; // W bit
669 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000670 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000671}
672
673// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000674class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
675 string opc, string asm, list<dag> pattern>
676 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
677 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000678 let Inst{4} = 1;
679 let Inst{5} = 1; // H bit
680 let Inst{6} = 0; // S bit
681 let Inst{7} = 1;
682 let Inst{20} = 0; // L bit
683 let Inst{21} = 0; // W bit
684 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000685 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000686}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000687class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
688 string asm, list<dag> pattern>
689 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000690 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000691 let Inst{4} = 1;
692 let Inst{5} = 1; // H bit
693 let Inst{6} = 0; // 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
698}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000699class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
700 string opc, string asm, list<dag> pattern>
701 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
702 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000703 let Inst{4} = 1;
704 let Inst{5} = 1; // H bit
705 let Inst{6} = 1; // S bit
706 let Inst{7} = 1;
707 let Inst{20} = 0; // L bit
708 let Inst{21} = 0; // W bit
709 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000710 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000711}
712
713// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000714class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
715 string opc, string asm, string cstr, list<dag> pattern>
716 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
717 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000718 let Inst{4} = 1;
719 let Inst{5} = 1; // H bit
720 let Inst{6} = 0; // S bit
721 let Inst{7} = 1;
722 let Inst{20} = 1; // L bit
723 let Inst{21} = 1; // W bit
724 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000725 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000726}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000727class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
728 string opc, string asm, string cstr, list<dag> pattern>
729 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
730 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000731 let Inst{4} = 1;
732 let Inst{5} = 1; // H bit
733 let Inst{6} = 1; // S bit
734 let Inst{7} = 1;
735 let Inst{20} = 1; // L bit
736 let Inst{21} = 1; // W bit
737 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000738 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000739}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000740class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
741 string opc, string asm, string cstr, list<dag> pattern>
742 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
743 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000744 let Inst{4} = 1;
745 let Inst{5} = 0; // H bit
746 let Inst{6} = 1; // S bit
747 let Inst{7} = 1;
748 let Inst{20} = 1; // L bit
749 let Inst{21} = 1; // W bit
750 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000751 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000752}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000753class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
754 string opc, string asm, string cstr, list<dag> pattern>
755 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
756 opc, asm, cstr, pattern> {
757 let Inst{4} = 1;
758 let Inst{5} = 0; // H bit
759 let Inst{6} = 1; // S bit
760 let Inst{7} = 1;
761 let Inst{20} = 0; // L bit
762 let Inst{21} = 1; // W bit
763 let Inst{24} = 1; // P bit
764 let Inst{27-25} = 0b000;
765}
766
Evan Cheng840917b2008-09-01 07:00:14 +0000767
768// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000769class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
770 string opc, string asm, string cstr, list<dag> pattern>
771 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
772 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000773 let Inst{4} = 1;
774 let Inst{5} = 1; // H bit
775 let Inst{6} = 0; // S bit
776 let Inst{7} = 1;
777 let Inst{20} = 0; // L bit
778 let Inst{21} = 1; // W bit
779 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000780 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000781}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000782class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
783 string opc, string asm, string cstr, list<dag> pattern>
784 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
785 opc, asm, cstr, pattern> {
786 let Inst{4} = 1;
787 let Inst{5} = 1; // H bit
788 let Inst{6} = 1; // S bit
789 let Inst{7} = 1;
790 let Inst{20} = 0; // L bit
791 let Inst{21} = 1; // W bit
792 let Inst{24} = 1; // P bit
793 let Inst{27-25} = 0b000;
794}
Evan Cheng840917b2008-09-01 07:00:14 +0000795
796// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000797class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
798 string opc, string asm, string cstr, list<dag> pattern>
799 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
800 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000801 let Inst{4} = 1;
802 let Inst{5} = 1; // H bit
803 let Inst{6} = 0; // S bit
804 let Inst{7} = 1;
805 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000806 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000807 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000808 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000809}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000810class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
811 string opc, string asm, string cstr, list<dag> pattern>
812 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
813 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000814 let Inst{4} = 1;
815 let Inst{5} = 1; // H bit
816 let Inst{6} = 1; // S bit
817 let Inst{7} = 1;
818 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000819 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000820 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000821 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000822}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000823class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
824 string opc, string asm, string cstr, list<dag> pattern>
825 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
826 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000827 let Inst{4} = 1;
828 let Inst{5} = 0; // H bit
829 let Inst{6} = 1; // S bit
830 let Inst{7} = 1;
831 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000832 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000833 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000834 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000835}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000836class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
837 string opc, string asm, string cstr, list<dag> pattern>
838 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
839 opc, asm, cstr, pattern> {
840 let Inst{4} = 1;
841 let Inst{5} = 0; // H bit
842 let Inst{6} = 1; // S bit
843 let Inst{7} = 1;
844 let Inst{20} = 0; // L bit
845 let Inst{21} = 0; // W bit
846 let Inst{24} = 0; // P bit
847 let Inst{27-25} = 0b000;
848}
Evan Cheng840917b2008-09-01 07:00:14 +0000849
850// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000851class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
852 string opc, string asm, string cstr, list<dag> pattern>
853 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
854 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000855 let Inst{4} = 1;
856 let Inst{5} = 1; // H bit
857 let Inst{6} = 0; // S bit
858 let Inst{7} = 1;
859 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000860 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000861 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000862 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000863}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000864class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
865 string opc, string asm, string cstr, list<dag> pattern>
866 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
867 opc, asm, cstr, pattern> {
868 let Inst{4} = 1;
869 let Inst{5} = 1; // H bit
870 let Inst{6} = 1; // S bit
871 let Inst{7} = 1;
872 let Inst{20} = 0; // L bit
873 let Inst{21} = 0; // W bit
874 let Inst{24} = 0; // P bit
875 let Inst{27-25} = 0b000;
876}
Evan Cheng840917b2008-09-01 07:00:14 +0000877
Evan Cheng0d14fc82008-09-01 01:51:14 +0000878// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000879class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000880 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000881 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000882 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000883 let Inst{20} = 1; // L bit
884 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000885 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000886}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000887class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000888 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000889 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000890 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000891 let Inst{20} = 0; // L bit
892 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000893 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000894}
Evan Cheng37f25d92008-08-28 23:39:26 +0000895
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000896// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000897class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
898 string opc, string asm, list<dag> pattern>
899 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
900 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000901 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000902 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000903 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000904}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000905class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
906 string opc, string asm, list<dag> pattern>
907 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
908 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000909 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000910 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000911}
912
913// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000914class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
915 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000916 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
917 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000918 bits<4> Rd;
919 bits<4> Rn;
920 bits<4> Rm;
921 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000922 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000923 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000924 let Inst{19-16} = Rd;
925 let Inst{11-8} = Rm;
926 let Inst{3-0} = Rn;
927}
928// MSW multiple w/ Ra operand
929class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
930 InstrItinClass itin, string opc, string asm, list<dag> pattern>
931 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
932 bits<4> Ra;
933 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000934}
Evan Cheng37f25d92008-08-28 23:39:26 +0000935
Evan Chengeb4f52e2008-11-06 03:35:07 +0000936// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000937class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000938 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000939 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
940 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000941 bits<4> Rn;
942 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000943 let Inst{4} = 0;
944 let Inst{7} = 1;
945 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000946 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000947 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000948 let Inst{11-8} = Rm;
949 let Inst{3-0} = Rn;
950}
951class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
952 InstrItinClass itin, string opc, string asm, list<dag> pattern>
953 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
954 bits<4> Rd;
955 let Inst{19-16} = Rd;
956}
957
958// AMulxyI with Ra operand
959class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
960 InstrItinClass itin, string opc, string asm, list<dag> pattern>
961 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
962 bits<4> Ra;
963 let Inst{15-12} = Ra;
964}
965// SMLAL*
966class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
967 InstrItinClass itin, string opc, string asm, list<dag> pattern>
968 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
969 bits<4> RdLo;
970 bits<4> RdHi;
971 let Inst{19-16} = RdHi;
972 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000973}
974
Evan Cheng97f48c32008-11-06 22:15:19 +0000975// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000976class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
977 string opc, string asm, list<dag> pattern>
978 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
979 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000980 // All AExtI instructions have Rd and Rm register operands.
981 bits<4> Rd;
982 bits<4> Rm;
983 let Inst{15-12} = Rd;
984 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000985 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000986 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000987 let Inst{27-20} = opcod;
988}
989
Evan Cheng8b59db32008-11-07 01:41:35 +0000990// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000991class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
992 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000993 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
994 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000995 bits<4> Rd;
996 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000997 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000998 let Inst{19-16} = 0b1111;
999 let Inst{15-12} = Rd;
1000 let Inst{11-8} = 0b1111;
1001 let Inst{7-4} = opc7_4;
1002 let Inst{3-0} = Rm;
1003}
1004
1005// PKH instructions
1006class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
1007 string opc, string asm, list<dag> pattern>
1008 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
1009 opc, asm, "", pattern> {
1010 bits<4> Rd;
1011 bits<4> Rn;
1012 bits<4> Rm;
1013 bits<8> sh;
1014 let Inst{27-20} = opcod;
1015 let Inst{19-16} = Rn;
1016 let Inst{15-12} = Rd;
1017 let Inst{11-7} = sh{7-3};
1018 let Inst{6} = tb;
1019 let Inst{5-4} = 0b01;
1020 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +00001021}
1022
Evan Cheng37f25d92008-08-28 23:39:26 +00001023//===----------------------------------------------------------------------===//
1024
1025// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
1026class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
1027 list<Predicate> Predicates = [IsARM];
1028}
1029class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
1030 list<Predicate> Predicates = [IsARM, HasV5TE];
1031}
1032class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
1033 list<Predicate> Predicates = [IsARM, HasV6];
1034}
Evan Cheng13096642008-08-29 06:41:12 +00001035
1036//===----------------------------------------------------------------------===//
1037//
1038// Thumb Instruction Format Definitions.
1039//
1040
Evan Cheng13096642008-08-29 06:41:12 +00001041// TI - Thumb instruction.
1042
Evan Cheng446c4282009-07-11 06:43:01 +00001043class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001044 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001045 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001046 let OutOperandList = oops;
1047 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001048 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +00001049 let Pattern = pattern;
1050 list<Predicate> Predicates = [IsThumb];
1051}
1052
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001053class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
1054 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001055
Evan Cheng35d6c412009-08-04 23:47:55 +00001056// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +00001057class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
1058 list<dag> pattern>
1059 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
1060 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +00001061
Johnny Chend68e1192009-12-15 17:24:14 +00001062// tBL, tBX 32-bit instructions
1063class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +00001064 dag oops, dag iops, InstrItinClass itin, string asm,
1065 list<dag> pattern>
1066 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
1067 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +00001068 let Inst{31-27} = opcod1;
1069 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001070 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +00001071}
Evan Cheng13096642008-08-29 06:41:12 +00001072
1073// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +00001074class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
1075 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001076 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001077
Evan Cheng09c39fc2009-06-23 19:38:13 +00001078// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +00001079class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001080 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001081 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001082 let OutOperandList = oops;
1083 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001084 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001085 let Pattern = pattern;
1086 list<Predicate> Predicates = [IsThumb1Only];
1087}
1088
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001089class T1I<dag oops, dag iops, InstrItinClass itin,
1090 string asm, list<dag> pattern>
1091 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1092class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1093 string asm, list<dag> pattern>
1094 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1095class T1JTI<dag oops, dag iops, InstrItinClass itin,
1096 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001097 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001098
1099// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001100class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001101 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001102 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001103 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001104
1105// Thumb1 instruction that can either be predicated or set CPSR.
1106class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001107 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001108 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001109 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001110 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1111 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001112 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001113 let Pattern = pattern;
1114 list<Predicate> Predicates = [IsThumb1Only];
1115}
1116
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001117class T1sI<dag oops, dag iops, InstrItinClass itin,
1118 string opc, string asm, list<dag> pattern>
1119 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001120
1121// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001122class T1sIt<dag oops, dag iops, InstrItinClass itin,
1123 string opc, string asm, list<dag> pattern>
1124 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001125 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001126
1127// Thumb1 instruction that can be predicated.
1128class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001129 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001130 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001131 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001132 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001133 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001134 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001135 let Pattern = pattern;
1136 list<Predicate> Predicates = [IsThumb1Only];
1137}
1138
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001139class T1pI<dag oops, dag iops, InstrItinClass itin,
1140 string opc, string asm, list<dag> pattern>
1141 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001142
1143// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001144class T1pIt<dag oops, dag iops, InstrItinClass itin,
1145 string opc, string asm, list<dag> pattern>
1146 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001147 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001148
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001149class T1pI1<dag oops, dag iops, InstrItinClass itin,
1150 string opc, string asm, list<dag> pattern>
1151 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1152class T1pI2<dag oops, dag iops, InstrItinClass itin,
1153 string opc, string asm, list<dag> pattern>
1154 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1155class T1pI4<dag oops, dag iops, InstrItinClass itin,
1156 string opc, string asm, list<dag> pattern>
1157 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001158class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001159 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1160 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001161
Johnny Chenbbc71b22009-12-16 02:32:54 +00001162class Encoding16 : Encoding {
1163 let Inst{31-16} = 0x0000;
1164}
1165
Johnny Chend68e1192009-12-15 17:24:14 +00001166// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001167class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001168 let Inst{15-10} = opcode;
1169}
1170
1171// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001172class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001173 let Inst{15-14} = 0b00;
1174 let Inst{13-9} = opcode;
1175}
1176
1177// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001178class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001179 let Inst{15-10} = 0b010000;
1180 let Inst{9-6} = opcode;
1181}
1182
1183// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001184class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001185 let Inst{15-10} = 0b010001;
1186 let Inst{9-6} = opcode;
1187}
1188
1189// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001190class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001191 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001192 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001193}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001194class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +00001195class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1196class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1197class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +00001198class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001199
1200// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001201class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001202 let Inst{15-12} = 0b1011;
1203 let Inst{11-5} = opcode;
1204}
1205
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001206// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1207class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001208 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001209 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001210 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001211 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001212 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001213 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001214 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001215 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001216}
1217
Bill Wendlingda2ae632010-08-31 07:50:46 +00001218// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1219// input operand since by default it's a zero register. It will become an
1220// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001221//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001222// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1223// more consistent.
1224class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001225 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001226 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001227 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001228 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001229 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001230 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001231 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001232 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001233}
1234
1235// Special cases
1236class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001237 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001238 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001239 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001240 let OutOperandList = oops;
1241 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001242 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001243 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001244 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001245}
1246
Jim Grosbachd1228742009-12-01 18:10:36 +00001247class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001248 InstrItinClass itin,
1249 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001250 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1251 let OutOperandList = oops;
1252 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001253 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001254 let Pattern = pattern;
1255 list<Predicate> Predicates = [IsThumb1Only];
1256}
1257
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001258class T2I<dag oops, dag iops, InstrItinClass itin,
1259 string opc, string asm, list<dag> pattern>
1260 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1261class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1262 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001263 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001264class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1265 string opc, string asm, list<dag> pattern>
1266 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1267class T2Iso<dag oops, dag iops, InstrItinClass itin,
1268 string opc, string asm, list<dag> pattern>
1269 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1270class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1271 string opc, string asm, list<dag> pattern>
1272 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001273class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001274 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001275 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1276 pattern> {
1277 let Inst{31-27} = 0b11101;
1278 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001279 let Inst{24} = P;
1280 let Inst{23} = ?; // The U bit.
1281 let Inst{22} = 1;
1282 let Inst{21} = W;
1283 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001284}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001285
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001286class T2sI<dag oops, dag iops, InstrItinClass itin,
1287 string opc, string asm, list<dag> pattern>
1288 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001289
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001290class T2XI<dag oops, dag iops, InstrItinClass itin,
1291 string asm, list<dag> pattern>
1292 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1293class T2JTI<dag oops, dag iops, InstrItinClass itin,
1294 string asm, list<dag> pattern>
1295 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001296
Evan Cheng5adb66a2009-09-28 09:14:39 +00001297class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001298 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001299 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1300
Bob Wilson815baeb2010-03-13 01:08:20 +00001301// Two-address instructions
1302class T2XIt<dag oops, dag iops, InstrItinClass itin,
1303 string asm, string cstr, list<dag> pattern>
1304 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001305
Evan Chenge88d5ce2009-07-02 07:28:31 +00001306// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001307class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1308 dag oops, dag iops,
1309 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001310 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001311 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001312 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001313 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001314 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001315 let Pattern = pattern;
1316 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001317 let Inst{31-27} = 0b11111;
1318 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001319 let Inst{24} = signed;
1320 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001321 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001322 let Inst{20} = load;
1323 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001324 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001325 let Inst{10} = pre; // The P bit.
1326 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001327}
1328
Johnny Chenadc77332010-02-26 22:04:29 +00001329// Helper class for disassembly only
1330// A6.3.16 & A6.3.17
1331// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1332class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1333 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1334 : T2I<oops, iops, itin, opc, asm, pattern> {
1335 let Inst{31-27} = 0b11111;
1336 let Inst{26-24} = 0b011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001337 let Inst{23} = long;
Johnny Chenadc77332010-02-26 22:04:29 +00001338 let Inst{22-20} = op22_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001339 let Inst{7-4} = op7_4;
Johnny Chenadc77332010-02-26 22:04:29 +00001340}
1341
David Goodwinc9d138f2009-07-27 19:59:26 +00001342// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1343class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1344 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1345}
1346
1347// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1348class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1349 list<Predicate> Predicates = [IsThumb1Only];
1350}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001351
Evan Cheng9cb9e672009-06-27 02:26:13 +00001352// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1353class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001354 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001355}
1356
Evan Cheng13096642008-08-29 06:41:12 +00001357//===----------------------------------------------------------------------===//
1358
Evan Cheng96581d32008-11-11 02:11:05 +00001359//===----------------------------------------------------------------------===//
1360// ARM VFP Instruction templates.
1361//
1362
David Goodwin3ca524e2009-07-10 17:03:29 +00001363// Almost all VFP instructions are predicable.
1364class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001365 IndexMode im, Format f, InstrItinClass itin,
1366 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001367 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001368 bits<4> p;
1369 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001370 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001371 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001372 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001373 let Pattern = pattern;
1374 list<Predicate> Predicates = [HasVFP2];
1375}
1376
1377// Special cases
1378class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001379 IndexMode im, Format f, InstrItinClass itin,
1380 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001381 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001382 let OutOperandList = oops;
1383 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001384 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001385 let Pattern = pattern;
1386 list<Predicate> Predicates = [HasVFP2];
1387}
1388
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001389class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1390 string opc, string asm, list<dag> pattern>
1391 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1392 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001393
Evan Chengcd8e66a2008-11-11 21:48:44 +00001394// ARM VFP addrmode5 loads and stores
1395class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001396 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001397 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001398 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001399 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001400 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001401 let Inst{27-24} = opcod1;
1402 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001403 let Inst{11-9} = 0b101;
1404 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001405
1406 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001407 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001408}
1409
Evan Chengcd8e66a2008-11-11 21:48:44 +00001410class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001411 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001412 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001413 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001414 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001415 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001416 let Inst{27-24} = opcod1;
1417 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001418 let Inst{11-9} = 0b101;
1419 let Inst{8} = 0; // Single precision
Evan Cheng96581d32008-11-11 02:11:05 +00001420}
1421
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001422// VFP Load / store multiple pseudo instructions.
1423class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1424 list<dag> pattern>
1425 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1426 cstr, itin> {
1427 let OutOperandList = oops;
1428 let InOperandList = !con(iops, (ins pred:$p));
1429 let Pattern = pattern;
1430 list<Predicate> Predicates = [HasVFP2];
1431}
1432
Evan Chengcd8e66a2008-11-11 21:48:44 +00001433// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001434class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001435 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001436 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001437 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001438 // TODO: Mark the instructions with the appropriate subtarget info.
1439 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001440 let Inst{11-9} = 0b101;
1441 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001442
1443 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001444 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001445}
1446
Jim Grosbach72db1822010-09-08 00:25:50 +00001447class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001448 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001449 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001450 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001451 // TODO: Mark the instructions with the appropriate subtarget info.
1452 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001453 let Inst{11-9} = 0b101;
1454 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001455}
1456
Evan Cheng96581d32008-11-11 02:11:05 +00001457// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001458class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1459 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1460 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001461 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001462 let Inst{27-23} = opcod1;
1463 let Inst{21-20} = opcod2;
1464 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001465 let Inst{11-9} = 0b101;
1466 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001467 let Inst{7-6} = opcod4;
1468 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001469}
1470
1471// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001472class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001473 dag iops, InstrItinClass itin, string opc, string asm,
1474 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001475 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001476 let Inst{27-23} = opcod1;
1477 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001478 let Inst{11-9} = 0b101;
1479 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001480 let Inst{6} = op6;
1481 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001482}
1483
Jim Grosbach26767372010-03-24 22:31:46 +00001484// Double precision, binary, VML[AS] (for additional predicate)
1485class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1486 dag iops, InstrItinClass itin, string opc, string asm,
1487 list<dag> pattern>
1488 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1489 let Inst{27-23} = opcod1;
1490 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001491 let Inst{11-9} = 0b101;
1492 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001493 let Inst{6} = op6;
1494 let Inst{4} = op4;
Jim Grosbach26767372010-03-24 22:31:46 +00001495 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1496}
1497
Evan Cheng96581d32008-11-11 02:11:05 +00001498// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001499class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1500 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1501 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001502 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001503 let Inst{27-23} = opcod1;
1504 let Inst{21-20} = opcod2;
1505 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001506 let Inst{11-9} = 0b101;
1507 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001508 let Inst{7-6} = opcod4;
1509 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001510}
1511
David Goodwin338268c2009-08-10 22:17:39 +00001512// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001513// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001514class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1515 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1516 string asm, list<dag> pattern>
1517 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1518 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001519 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1520}
1521
Evan Cheng96581d32008-11-11 02:11:05 +00001522// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001523class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1524 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001525 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001526 let Inst{27-23} = opcod1;
1527 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001528 let Inst{11-9} = 0b101;
1529 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001530 let Inst{6} = op6;
1531 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001532}
1533
David Goodwin338268c2009-08-10 22:17:39 +00001534// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001535// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001536class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001537 dag iops, InstrItinClass itin, string opc, string asm,
1538 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001539 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001540 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1541}
1542
Evan Cheng80a11982008-11-12 06:41:41 +00001543// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001544class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1545 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1546 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001547 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001548 let Inst{27-23} = opcod1;
1549 let Inst{21-20} = opcod2;
1550 let Inst{19-16} = opcod3;
1551 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001552 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001553 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001554}
1555
Johnny Chen811663f2010-02-11 18:47:03 +00001556// VFP conversion between floating-point and fixed-point
1557class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001558 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1559 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001560 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1561 // size (fixed-point number): sx == 0 ? 16 : 32
1562 let Inst{7} = op5; // sx
1563}
1564
David Goodwin338268c2009-08-10 22:17:39 +00001565// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001566class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001567 dag oops, dag iops, InstrItinClass itin,
1568 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001569 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1570 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001571 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1572}
1573
Evan Cheng80a11982008-11-12 06:41:41 +00001574class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001575 InstrItinClass itin,
1576 string opc, string asm, list<dag> pattern>
1577 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001578 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001579 let Inst{11-8} = opcod2;
1580 let Inst{4} = 1;
1581}
1582
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001583class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1584 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1585 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001586
Bob Wilson01135592010-03-23 17:23:59 +00001587class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001588 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1589 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001590
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001591class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1592 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1593 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001594
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001595class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1596 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1597 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001598
Evan Cheng96581d32008-11-11 02:11:05 +00001599//===----------------------------------------------------------------------===//
1600
Bob Wilson5bafff32009-06-22 23:27:02 +00001601//===----------------------------------------------------------------------===//
1602// ARM NEON Instruction templates.
1603//
Evan Cheng13096642008-08-29 06:41:12 +00001604
Johnny Chencaa608e2010-03-20 00:17:00 +00001605class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1606 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1607 list<dag> pattern>
1608 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001609 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001610 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001611 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001612 let Pattern = pattern;
1613 list<Predicate> Predicates = [HasNEON];
1614}
1615
1616// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001617class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1618 InstrItinClass itin, string opc, string asm, string cstr,
1619 list<dag> pattern>
1620 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001621 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001622 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001623 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001624 let Pattern = pattern;
1625 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001626}
1627
Bob Wilsonb07c1712009-10-07 21:53:04 +00001628class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1629 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001630 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001631 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1632 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001633 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001634 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001635 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001636 let Inst{11-8} = op11_8;
1637 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001638}
1639
Bob Wilson709d5922010-08-25 23:27:42 +00001640class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1641 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1642 itin> {
1643 let OutOperandList = oops;
1644 let InOperandList = !con(iops, (ins pred:$p));
1645 list<Predicate> Predicates = [HasNEON];
1646}
1647
Jim Grosbach7cd27292010-10-06 20:36:55 +00001648class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1649 list<dag> pattern>
Bob Wilsonbd916c52010-09-13 23:55:10 +00001650 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1651 itin> {
1652 let OutOperandList = oops;
1653 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001654 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001655 list<Predicate> Predicates = [HasNEON];
1656}
1657
Johnny Chen785516a2010-03-23 16:43:47 +00001658class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001659 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001660 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1661 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001662 let Inst{31-25} = 0b1111001;
1663}
1664
Johnny Chen927b88f2010-03-23 20:40:44 +00001665class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001666 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001667 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001668 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001669 let Inst{31-25} = 0b1111001;
1670}
1671
1672// NEON "one register and a modified immediate" format.
1673class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1674 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001675 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001676 string opc, string dt, string asm, string cstr,
1677 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001678 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001679 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001680 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001681 let Inst{11-8} = op11_8;
1682 let Inst{7} = op7;
1683 let Inst{6} = op6;
1684 let Inst{5} = op5;
1685 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001686}
1687
1688// NEON 2 vector register format.
1689class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1690 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001691 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001692 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001693 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001694 let Inst{24-23} = op24_23;
1695 let Inst{21-20} = op21_20;
1696 let Inst{19-18} = op19_18;
1697 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001698 let Inst{11-7} = op11_7;
1699 let Inst{6} = op6;
1700 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001701}
1702
1703// Same as N2V except it doesn't have a datatype suffix.
1704class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001705 bits<5> op11_7, bit op6, bit op4,
1706 dag oops, dag iops, InstrItinClass itin,
1707 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001708 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001709 let Inst{24-23} = op24_23;
1710 let Inst{21-20} = op21_20;
1711 let Inst{19-18} = op19_18;
1712 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001713 let Inst{11-7} = op11_7;
1714 let Inst{6} = op6;
1715 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001716}
1717
1718// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001719class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001720 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001721 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001722 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001723 let Inst{24} = op24;
1724 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001725 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001726 let Inst{7} = op7;
1727 let Inst{6} = op6;
1728 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001729}
1730
Bob Wilson10bc69c2010-03-27 03:56:52 +00001731// NEON 3 vector register format.
1732class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1733 dag oops, dag iops, Format f, InstrItinClass itin,
1734 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001735 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001736 let Inst{24} = op24;
1737 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001738 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001739 let Inst{11-8} = op11_8;
1740 let Inst{6} = op6;
1741 let Inst{4} = op4;
Owen Andersond451f882010-10-21 20:21:49 +00001742
1743 // Instruction operands.
1744 bits<5> Vd;
1745 bits<5> Vn;
1746 bits<5> Vm;
1747
1748 let Inst{15-12} = Vd{3-0};
1749 let Inst{22} = Vd{4};
1750 let Inst{19-16} = Vn{3-0};
1751 let Inst{7} = Vn{4};
1752 let Inst{3-0} = Vm{3-0};
1753 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001754}
1755
Johnny Chen841e8282010-03-23 21:35:03 +00001756// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001757class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1758 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001759 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001760 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001761 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001762 let Inst{24} = op24;
1763 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001764 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001765 let Inst{11-8} = op11_8;
1766 let Inst{6} = op6;
1767 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001768}
1769
1770// NEON VMOVs between scalar and core registers.
1771class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001772 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001773 string opc, string dt, string asm, list<dag> pattern>
1774 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001775 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001776 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001777 let Inst{11-8} = opcod2;
1778 let Inst{6-5} = opcod3;
1779 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001780
1781 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001782 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001783 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001784 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001785 list<Predicate> Predicates = [HasNEON];
1786}
1787class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001788 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001789 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001790 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001791 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001792class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001793 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001794 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001795 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001796 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001797class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001798 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001799 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001800 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001801 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001802
Johnny Chene4614f72010-03-25 17:01:27 +00001803// Vector Duplicate Lane (from scalar to all elements)
1804class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1805 InstrItinClass itin, string opc, string dt, string asm,
1806 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001807 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001808 let Inst{24-23} = 0b11;
1809 let Inst{21-20} = 0b11;
1810 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001811 let Inst{11-7} = 0b11000;
1812 let Inst{6} = op6;
1813 let Inst{4} = 0;
Johnny Chene4614f72010-03-25 17:01:27 +00001814}
1815
David Goodwin42a83f22009-08-04 17:53:06 +00001816// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1817// for single-precision FP.
1818class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1819 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1820}