blob: d754579dbabe79923e89ccf926d5d71a71a66c9c [file] [log] [blame]
Evan Cheng37f25d92008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
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
Jim Grosbach5278eb82009-12-11 01:42:04 +000036def LdStExFrm : Format<28>;
37
Evan Chengffa6d962008-11-13 23:36:57 +000038def ArithMiscFrm : Format<11>;
39def ExtFrm : Format<12>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000040
Evan Chengffa6d962008-11-13 23:36:57 +000041def VFPUnaryFrm : Format<13>;
42def VFPBinaryFrm : Format<14>;
43def VFPConv1Frm : Format<15>;
44def VFPConv2Frm : Format<16>;
45def VFPConv3Frm : Format<17>;
46def VFPConv4Frm : Format<18>;
47def VFPConv5Frm : Format<19>;
48def VFPLdStFrm : Format<20>;
49def VFPLdStMulFrm : Format<21>;
50def VFPMiscFrm : Format<22>;
Evan Chengcd8e66a2008-11-11 21:48:44 +000051
Evan Chengffa6d962008-11-13 23:36:57 +000052def ThumbFrm : Format<23>;
Evan Cheng37f25d92008-08-28 23:39:26 +000053
Bob Wilson5bafff32009-06-22 23:27:02 +000054def NEONFrm : Format<24>;
55def NEONGetLnFrm : Format<25>;
56def NEONSetLnFrm : Format<26>;
57def NEONDupFrm : Format<27>;
58
Johnny Chenf4d81052010-02-12 22:53:19 +000059def MiscFrm : Format<29>;
60def ThumbMiscFrm : Format<30>;
61
Evan Cheng34a0fa32009-07-08 01:46:35 +000062// Misc flags.
63
Evan Chengedda31c2008-11-05 18:35:52 +000064// the instruction has a Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000065// UnaryDP - Indicates this is a unary data processing instruction, i.e.
66// it doesn't have a Rn operand.
67class UnaryDP { bit isUnaryDataProc = 1; }
68
69// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
70// a 16-bit Thumb instruction if certain conditions are met.
71class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000072
Evan Cheng37f25d92008-08-28 23:39:26 +000073//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000074// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000075//
76
77// Addressing mode.
78class AddrMode<bits<4> val> {
79 bits<4> Value = val;
80}
81def AddrModeNone : AddrMode<0>;
82def AddrMode1 : AddrMode<1>;
83def AddrMode2 : AddrMode<2>;
84def AddrMode3 : AddrMode<3>;
85def AddrMode4 : AddrMode<4>;
86def AddrMode5 : AddrMode<5>;
Bob Wilson8b024a52009-07-01 23:16:05 +000087def AddrMode6 : AddrMode<6>;
88def AddrModeT1_1 : AddrMode<7>;
89def AddrModeT1_2 : AddrMode<8>;
90def AddrModeT1_4 : AddrMode<9>;
91def AddrModeT1_s : AddrMode<10>;
David Goodwine1e52ed2009-07-22 22:24:31 +000092def AddrModeT2_i12: AddrMode<11>;
Bob Wilson8b024a52009-07-01 23:16:05 +000093def AddrModeT2_i8 : AddrMode<12>;
94def AddrModeT2_so : AddrMode<13>;
95def AddrModeT2_pc : AddrMode<14>;
96def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng055b0312009-06-29 07:51:04 +000097
98// Instruction size.
99class SizeFlagVal<bits<3> val> {
100 bits<3> Value = val;
101}
102def SizeInvalid : SizeFlagVal<0>; // Unset.
103def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
104def Size8Bytes : SizeFlagVal<2>;
105def Size4Bytes : SizeFlagVal<3>;
106def Size2Bytes : SizeFlagVal<4>;
107
108// Load / store index mode.
109class IndexMode<bits<2> val> {
110 bits<2> Value = val;
111}
112def IndexModeNone : IndexMode<0>;
113def IndexModePre : IndexMode<1>;
114def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000115def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000116
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000117// Instruction execution domain.
118class Domain<bits<2> val> {
119 bits<2> Value = val;
120}
121def GenericDomain : Domain<0>;
122def VFPDomain : Domain<1>; // Instructions in VFP domain only
123def NeonDomain : Domain<2>; // Instructions in Neon domain only
124def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
125
Evan Cheng055b0312009-06-29 07:51:04 +0000126//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000127
Evan Cheng446c4282009-07-11 06:43:01 +0000128// ARM special operands.
129//
130
131// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
132// register whose default is 0 (no register).
133def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
134 (ops (i32 14), (i32 zero_reg))> {
135 let PrintMethod = "printPredicateOperand";
136}
137
138// Conditional code result for instructions whose 's' bit is set, e.g. subs.
139def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
140 let PrintMethod = "printSBitModifierOperand";
141}
142
143// Same as cc_out except it defaults to setting CPSR.
144def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
145 let PrintMethod = "printSBitModifierOperand";
146}
147
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000148// ARM special operands for disassembly only.
149//
150
151def cps_opt : Operand<i32> {
152 let PrintMethod = "printCPSOptionOperand";
153}
154
155def msr_mask : Operand<i32> {
156 let PrintMethod = "printMSRMaskOperand";
157}
158
159// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
160// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
161def neg_zero : Operand<i32> {
162 let PrintMethod = "printNegZeroOperand";
163}
164
Evan Cheng446c4282009-07-11 06:43:01 +0000165//===----------------------------------------------------------------------===//
166
Evan Cheng37f25d92008-08-28 23:39:26 +0000167// ARM Instruction templates.
168//
169
Johnny Chend68e1192009-12-15 17:24:14 +0000170class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
171 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000172 : Instruction {
173 let Namespace = "ARM";
174
Evan Chengedda31c2008-11-05 18:35:52 +0000175 // TSFlagsFields
Evan Cheng37f25d92008-08-28 23:39:26 +0000176 AddrMode AM = am;
177 bits<4> AddrModeBits = AM.Value;
178
179 SizeFlagVal SZ = sz;
180 bits<3> SizeFlag = SZ.Value;
181
182 IndexMode IM = im;
183 bits<2> IndexModeBits = IM.Value;
184
185 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000186 bits<6> Form = F.Value;
Evan Chengedda31c2008-11-05 18:35:52 +0000187
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000188 Domain D = d;
189 bits<2> Dom = D.Value;
190
Evan Chengedda31c2008-11-05 18:35:52 +0000191 //
192 // Attributes specific to ARM instructions...
193 //
194 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000195 bit canXformTo16Bit = 0;
Evan Cheng37f25d92008-08-28 23:39:26 +0000196
197 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000198 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000199}
200
Johnny Chend68e1192009-12-15 17:24:14 +0000201class Encoding {
202 field bits<32> Inst;
203}
204
205class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
206 Format f, Domain d, string cstr, InstrItinClass itin>
207 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
208
209// This Encoding-less class is used by Thumb1 to specify the encoding bits later
210// on by adding flavors to specific instructions.
211class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
212 Format f, Domain d, string cstr, InstrItinClass itin>
213 : InstTemplate<am, sz, im, f, d, cstr, itin>;
214
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000215class PseudoInst<dag oops, dag iops, InstrItinClass itin,
216 string asm, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000217 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
218 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000219 let OutOperandList = oops;
220 let InOperandList = iops;
221 let AsmString = asm;
222 let Pattern = pattern;
223}
224
225// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000226class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000227 IndexMode im, Format f, InstrItinClass itin,
228 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000229 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000230 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000231 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000232 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng37f25d92008-08-28 23:39:26 +0000233 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
234 let Pattern = pattern;
235 list<Predicate> Predicates = [IsARM];
236}
Jim Grosbachf6b28622009-12-14 18:31:20 +0000237// A few are not predicable
238class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
239 IndexMode im, Format f, InstrItinClass itin,
240 string opc, string asm, string cstr,
241 list<dag> pattern>
242 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
243 let OutOperandList = oops;
244 let InOperandList = iops;
245 let AsmString = !strconcat(opc, asm);
246 let Pattern = pattern;
247 let isPredicable = 0;
248 list<Predicate> Predicates = [IsARM];
249}
Evan Cheng37f25d92008-08-28 23:39:26 +0000250
251// Same as I except it can optionally modify CPSR. Note it's modeled as
252// an input operand since by default it's a zero register. It will
253// become an implicit def once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000254class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000255 IndexMode im, Format f, InstrItinClass itin,
256 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000257 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000258 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000259 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000260 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng37f25d92008-08-28 23:39:26 +0000261 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
262 let Pattern = pattern;
263 list<Predicate> Predicates = [IsARM];
264}
265
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000266// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000267class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000268 IndexMode im, Format f, InstrItinClass itin,
269 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000270 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000271 let OutOperandList = oops;
272 let InOperandList = iops;
273 let AsmString = asm;
274 let Pattern = pattern;
275 list<Predicate> Predicates = [IsARM];
276}
277
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000278class AI<dag oops, dag iops, Format f, InstrItinClass itin,
279 string opc, string asm, list<dag> pattern>
280 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
281 opc, asm, "", pattern>;
282class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
283 string opc, string asm, list<dag> pattern>
284 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
285 opc, asm, "", pattern>;
286class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000287 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000288 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000289 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000290class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
291 string opc, string asm, list<dag> pattern>
292 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
293 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000294
295// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000296class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
297 string opc, string asm, list<dag> pattern>
298 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
299 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000300 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000301}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000302class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
303 string asm, list<dag> pattern>
304 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
305 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000306 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000307}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000308class ABXIx2<dag oops, dag iops, InstrItinClass itin,
309 string asm, list<dag> pattern>
310 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, itin,
311 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000312
313// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000314class JTI<dag oops, dag iops, InstrItinClass itin,
315 string asm, list<dag> pattern>
316 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000317 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000318
Jim Grosbach5278eb82009-12-11 01:42:04 +0000319
320// Atomic load/store instructions
321
322class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
323 string opc, string asm, list<dag> pattern>
324 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
325 opc, asm, "", pattern> {
326 let Inst{27-23} = 0b00011;
327 let Inst{22-21} = opcod;
328 let Inst{20} = 1;
329 let Inst{11-0} = 0b111110011111;
330}
331class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
332 string opc, string asm, list<dag> pattern>
333 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
334 opc, asm, "", pattern> {
335 let Inst{27-23} = 0b00011;
336 let Inst{22-21} = opcod;
337 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000338 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000339}
340
Evan Cheng0d14fc82008-09-01 01:51:14 +0000341// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000342class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
343 string opc, string asm, list<dag> pattern>
344 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
345 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000346 let Inst{24-21} = opcod;
347 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000348}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000349class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
350 string opc, string asm, list<dag> pattern>
351 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
352 opc, asm, "", pattern> {
353 let Inst{24-21} = opcod;
354 let Inst{27-26} = {0,0};
355}
356class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000357 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000358 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000359 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000360 let Inst{24-21} = opcod;
361 let Inst{27-26} = {0,0};
Evan Cheng612b79e2008-08-29 07:40:52 +0000362}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000363class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
364 string opc, string asm, list<dag> pattern>
365 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
366 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000367
Evan Cheng0d14fc82008-09-01 01:51:14 +0000368
369// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000370class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
371 string opc, string asm, list<dag> pattern>
372 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
373 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000374 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000375}
Evan Cheng93912732008-09-01 01:27:33 +0000376
377// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000378class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
379 string opc, string asm, list<dag> pattern>
380 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
381 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000382 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000383 let Inst{21} = 0; // W bit
384 let Inst{22} = 0; // B bit
385 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000386 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000387}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000388class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
389 string asm, list<dag> pattern>
390 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000391 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000392 let Inst{20} = 1; // L bit
393 let Inst{21} = 0; // W bit
394 let Inst{22} = 0; // B bit
395 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000396 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000397}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000398class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
399 string opc, string asm, list<dag> pattern>
400 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
401 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000402 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000403 let Inst{21} = 0; // W bit
404 let Inst{22} = 1; // B bit
405 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000406 let Inst{27-26} = {0,1};
Evan Cheng17222df2008-08-31 19:02:21 +0000407}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000408class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
409 string asm, list<dag> pattern>
410 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000411 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000412 let Inst{20} = 1; // L bit
413 let Inst{21} = 0; // W bit
414 let Inst{22} = 1; // B bit
415 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000416 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000417}
Evan Cheng17222df2008-08-31 19:02:21 +0000418
Evan Cheng93912732008-09-01 01:27:33 +0000419// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000420class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
421 string opc, string asm, list<dag> pattern>
422 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
423 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000424 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000425 let Inst{21} = 0; // W bit
426 let Inst{22} = 0; // B bit
427 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000428 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000429}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000430class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
431 string asm, list<dag> pattern>
432 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000433 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000434 let Inst{20} = 0; // L bit
435 let Inst{21} = 0; // W bit
436 let Inst{22} = 0; // B bit
437 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000438 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000439}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000440class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
441 string opc, string asm, list<dag> pattern>
442 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
443 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000444 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000445 let Inst{21} = 0; // W bit
446 let Inst{22} = 1; // B bit
447 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000448 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000449}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000450class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
451 string asm, list<dag> pattern>
452 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000453 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000454 let Inst{20} = 0; // L bit
455 let Inst{21} = 0; // W bit
456 let Inst{22} = 1; // B bit
457 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000458 let Inst{27-26} = {0,1};
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000459}
Evan Cheng93912732008-09-01 01:27:33 +0000460
Evan Cheng840917b2008-09-01 07:00:14 +0000461// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000462class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
463 string opc, string asm, string cstr, list<dag> pattern>
464 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
465 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000466 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000467 let Inst{21} = 1; // W bit
468 let Inst{22} = 0; // B bit
469 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000470 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000471}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000472class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
473 string opc, string asm, string cstr, list<dag> pattern>
474 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
475 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000476 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000477 let Inst{21} = 1; // W bit
478 let Inst{22} = 1; // B bit
479 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000480 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000481}
482
Evan Cheng840917b2008-09-01 07:00:14 +0000483// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000484class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
485 string opc, string asm, string cstr, list<dag> pattern>
486 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
487 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000488 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000489 let Inst{21} = 1; // W bit
490 let Inst{22} = 0; // B bit
491 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000492 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000493}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000494class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
495 string opc, string asm, string cstr, list<dag> pattern>
496 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
497 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000498 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000499 let Inst{21} = 1; // W bit
500 let Inst{22} = 1; // B bit
501 let Inst{24} = 1; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000502 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000503}
504
Evan Cheng840917b2008-09-01 07:00:14 +0000505// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000506class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
507 string opc, string asm, string cstr, list<dag> pattern>
508 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
509 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000510 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000511 let Inst{21} = 0; // W bit
512 let Inst{22} = 0; // B bit
513 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000514 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000515}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000516class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
517 string opc, string asm, string cstr, list<dag> pattern>
518 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
519 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000520 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000521 let Inst{21} = 0; // W bit
522 let Inst{22} = 1; // B bit
523 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000524 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000525}
526
Evan Cheng840917b2008-09-01 07:00:14 +0000527// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000528class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
529 string opc, string asm, string cstr, list<dag> pattern>
530 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
531 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000532 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000533 let Inst{21} = 0; // W bit
534 let Inst{22} = 0; // B bit
535 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000536 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000537}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000538class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
539 string opc, string asm, string cstr, list<dag> pattern>
540 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
541 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000542 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000543 let Inst{21} = 0; // W bit
544 let Inst{22} = 1; // B bit
545 let Inst{24} = 0; // P bit
Evan Cheng83b5cf02008-11-05 23:22:34 +0000546 let Inst{27-26} = {0,1};
Evan Cheng93912732008-09-01 01:27:33 +0000547}
548
Evan Cheng0d14fc82008-09-01 01:51:14 +0000549// addrmode3 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000550class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
551 string opc, string asm, list<dag> pattern>
552 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
553 opc, asm, "", pattern>;
554class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
555 string asm, list<dag> pattern>
556 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
557 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000558
Evan Cheng840917b2008-09-01 07:00:14 +0000559// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000560class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
561 string opc, string asm, list<dag> pattern>
562 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
563 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000564 let Inst{4} = 1;
565 let Inst{5} = 1; // H bit
566 let Inst{6} = 0; // S bit
567 let Inst{7} = 1;
568 let Inst{20} = 1; // L bit
569 let Inst{21} = 0; // W bit
570 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000571 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000572}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000573class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
574 string asm, list<dag> pattern>
575 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000576 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000577 let Inst{4} = 1;
578 let Inst{5} = 1; // H bit
579 let Inst{6} = 0; // S bit
580 let Inst{7} = 1;
581 let Inst{20} = 1; // L bit
582 let Inst{21} = 0; // W bit
583 let Inst{24} = 1; // P bit
584}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000585class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
586 string opc, string asm, list<dag> pattern>
587 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
588 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000589 let Inst{4} = 1;
590 let Inst{5} = 1; // H bit
591 let Inst{6} = 1; // S bit
592 let Inst{7} = 1;
593 let Inst{20} = 1; // L bit
594 let Inst{21} = 0; // W bit
595 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000596 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000597}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000598class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
599 string asm, list<dag> pattern>
600 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000601 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000602 let Inst{4} = 1;
603 let Inst{5} = 1; // H bit
604 let Inst{6} = 1; // S bit
605 let Inst{7} = 1;
606 let Inst{20} = 1; // L bit
607 let Inst{21} = 0; // W bit
608 let Inst{24} = 1; // P bit
609}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000610class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
611 string opc, string asm, list<dag> pattern>
612 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
613 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000614 let Inst{4} = 1;
615 let Inst{5} = 0; // H bit
616 let Inst{6} = 1; // S bit
617 let Inst{7} = 1;
618 let Inst{20} = 1; // L bit
619 let Inst{21} = 0; // W bit
620 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000621 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000622}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000623class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
624 string asm, list<dag> pattern>
625 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000626 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000627 let Inst{4} = 1;
628 let Inst{5} = 0; // H bit
629 let Inst{6} = 1; // S bit
630 let Inst{7} = 1;
631 let Inst{20} = 1; // L bit
632 let Inst{21} = 0; // W bit
633 let Inst{24} = 1; // P bit
634}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000635class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
636 string opc, string asm, list<dag> pattern>
637 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
638 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000639 let Inst{4} = 1;
640 let Inst{5} = 0; // H bit
641 let Inst{6} = 1; // S bit
642 let Inst{7} = 1;
643 let Inst{20} = 0; // L bit
644 let Inst{21} = 0; // W bit
645 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000646 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000647}
648
649// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000650class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
651 string opc, string asm, list<dag> pattern>
652 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
653 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000654 let Inst{4} = 1;
655 let Inst{5} = 1; // H bit
656 let Inst{6} = 0; // S bit
657 let Inst{7} = 1;
658 let Inst{20} = 0; // L bit
659 let Inst{21} = 0; // W bit
660 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000661 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000662}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000663class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
664 string asm, list<dag> pattern>
665 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000666 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000667 let Inst{4} = 1;
668 let Inst{5} = 1; // H bit
669 let Inst{6} = 0; // S bit
670 let Inst{7} = 1;
671 let Inst{20} = 0; // L bit
672 let Inst{21} = 0; // W bit
673 let Inst{24} = 1; // P bit
674}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000675class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
676 string opc, string asm, list<dag> pattern>
677 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
678 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000679 let Inst{4} = 1;
680 let Inst{5} = 1; // H bit
681 let Inst{6} = 1; // S bit
682 let Inst{7} = 1;
683 let Inst{20} = 0; // L bit
684 let Inst{21} = 0; // W bit
685 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000686 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000687}
688
689// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000690class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
691 string opc, string asm, string cstr, list<dag> pattern>
692 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
693 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000694 let Inst{4} = 1;
695 let Inst{5} = 1; // H bit
696 let Inst{6} = 0; // S bit
697 let Inst{7} = 1;
698 let Inst{20} = 1; // L bit
699 let Inst{21} = 1; // W bit
700 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000701 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000702}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000703class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
704 string opc, string asm, string cstr, list<dag> pattern>
705 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
706 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000707 let Inst{4} = 1;
708 let Inst{5} = 1; // H bit
709 let Inst{6} = 1; // S bit
710 let Inst{7} = 1;
711 let Inst{20} = 1; // L bit
712 let Inst{21} = 1; // W bit
713 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000714 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000715}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000716class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
717 string opc, string asm, string cstr, list<dag> pattern>
718 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
719 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000720 let Inst{4} = 1;
721 let Inst{5} = 0; // H bit
722 let Inst{6} = 1; // S bit
723 let Inst{7} = 1;
724 let Inst{20} = 1; // L bit
725 let Inst{21} = 1; // W bit
726 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000727 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000728}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000729class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
730 string opc, string asm, string cstr, list<dag> pattern>
731 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
732 opc, asm, cstr, pattern> {
733 let Inst{4} = 1;
734 let Inst{5} = 0; // H bit
735 let Inst{6} = 1; // S bit
736 let Inst{7} = 1;
737 let Inst{20} = 0; // L bit
738 let Inst{21} = 1; // W bit
739 let Inst{24} = 1; // P bit
740 let Inst{27-25} = 0b000;
741}
742
Evan Cheng840917b2008-09-01 07:00:14 +0000743
744// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000745class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
746 string opc, string asm, string cstr, list<dag> pattern>
747 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
748 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000749 let Inst{4} = 1;
750 let Inst{5} = 1; // H bit
751 let Inst{6} = 0; // S bit
752 let Inst{7} = 1;
753 let Inst{20} = 0; // L bit
754 let Inst{21} = 1; // W bit
755 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000756 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000757}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000758class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
759 string opc, string asm, string cstr, list<dag> pattern>
760 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
761 opc, asm, cstr, pattern> {
762 let Inst{4} = 1;
763 let Inst{5} = 1; // H bit
764 let Inst{6} = 1; // S bit
765 let Inst{7} = 1;
766 let Inst{20} = 0; // L bit
767 let Inst{21} = 1; // W bit
768 let Inst{24} = 1; // P bit
769 let Inst{27-25} = 0b000;
770}
Evan Cheng840917b2008-09-01 07:00:14 +0000771
772// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000773class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
774 string opc, string asm, string cstr, list<dag> pattern>
775 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
776 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000777 let Inst{4} = 1;
778 let Inst{5} = 1; // H bit
779 let Inst{6} = 0; // S bit
780 let Inst{7} = 1;
781 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000782 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000783 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000784 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000785}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000786class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
787 string opc, string asm, string cstr, list<dag> pattern>
788 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
789 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000790 let Inst{4} = 1;
791 let Inst{5} = 1; // H bit
792 let Inst{6} = 1; // S bit
793 let Inst{7} = 1;
794 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000795 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000796 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000797 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000798}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000799class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
800 string opc, string asm, string cstr, list<dag> pattern>
801 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
802 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000803 let Inst{4} = 1;
804 let Inst{5} = 0; // H bit
805 let Inst{6} = 1; // S bit
806 let Inst{7} = 1;
807 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000808 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000809 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000810 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000811}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000812class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
813 string opc, string asm, string cstr, list<dag> pattern>
814 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
815 opc, asm, cstr, pattern> {
816 let Inst{4} = 1;
817 let Inst{5} = 0; // H bit
818 let Inst{6} = 1; // S bit
819 let Inst{7} = 1;
820 let Inst{20} = 0; // L bit
821 let Inst{21} = 0; // W bit
822 let Inst{24} = 0; // P bit
823 let Inst{27-25} = 0b000;
824}
Evan Cheng840917b2008-09-01 07:00:14 +0000825
826// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000827class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
828 string opc, string asm, string cstr, list<dag> pattern>
829 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
830 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000831 let Inst{4} = 1;
832 let Inst{5} = 1; // H bit
833 let Inst{6} = 0; // S bit
834 let Inst{7} = 1;
835 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000836 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000837 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000838 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000839}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000840class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
841 string opc, string asm, string cstr, list<dag> pattern>
842 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
843 opc, asm, cstr, pattern> {
844 let Inst{4} = 1;
845 let Inst{5} = 1; // H bit
846 let Inst{6} = 1; // S bit
847 let Inst{7} = 1;
848 let Inst{20} = 0; // L bit
849 let Inst{21} = 0; // W bit
850 let Inst{24} = 0; // P bit
851 let Inst{27-25} = 0b000;
852}
Evan Cheng840917b2008-09-01 07:00:14 +0000853
854
Evan Cheng0d14fc82008-09-01 01:51:14 +0000855// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000856class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000857 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000858 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000859 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000860 let Inst{20} = 1; // L bit
861 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000862 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000863}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000864class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000865 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000866 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000867 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000868 let Inst{20} = 0; // L bit
869 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000870 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000871}
Evan Cheng37f25d92008-08-28 23:39:26 +0000872
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000873// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000874class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
875 string opc, string asm, list<dag> pattern>
876 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
877 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000878 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000879 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000880 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000881}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000882class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
883 string opc, string asm, list<dag> pattern>
884 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
885 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000886 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000887 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000888}
889
890// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000891class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
892 string opc, string asm, list<dag> pattern>
893 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
894 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000895 let Inst{7-4} = 0b1001;
896 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000897 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000898}
Evan Cheng37f25d92008-08-28 23:39:26 +0000899
Evan Chengeb4f52e2008-11-06 03:35:07 +0000900// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000901class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
902 string opc, string asm, list<dag> pattern>
903 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
904 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000905 let Inst{4} = 0;
906 let Inst{7} = 1;
907 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000908 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000909}
910
Evan Cheng97f48c32008-11-06 22:15:19 +0000911// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000912class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
913 string opc, string asm, list<dag> pattern>
914 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
915 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000916 let Inst{7-4} = 0b0111;
917 let Inst{27-20} = opcod;
918}
919
Evan Cheng8b59db32008-11-07 01:41:35 +0000920// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000921class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
922 string opc, string asm, list<dag> pattern>
923 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
924 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000925 let Inst{27-20} = opcod;
926}
927
Evan Cheng37f25d92008-08-28 23:39:26 +0000928//===----------------------------------------------------------------------===//
929
930// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
931class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
932 list<Predicate> Predicates = [IsARM];
933}
934class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
935 list<Predicate> Predicates = [IsARM, HasV5TE];
936}
937class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
938 list<Predicate> Predicates = [IsARM, HasV6];
939}
Anton Korobeynikov341ab132010-03-18 22:35:45 +0000940class VFPPat<dag pattern, dag result> : Pat<pattern, result> {
941 list<Predicate> Predicates = [HasVFP2];
942}
Evan Cheng13096642008-08-29 06:41:12 +0000943
944//===----------------------------------------------------------------------===//
945//
946// Thumb Instruction Format Definitions.
947//
948
Evan Cheng13096642008-08-29 06:41:12 +0000949// TI - Thumb instruction.
950
Evan Cheng446c4282009-07-11 06:43:01 +0000951class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000952 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000953 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000954 let OutOperandList = oops;
955 let InOperandList = iops;
Evan Cheng13096642008-08-29 06:41:12 +0000956 let AsmString = asm;
957 let Pattern = pattern;
958 list<Predicate> Predicates = [IsThumb];
959}
960
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000961class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
962 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000963
Evan Cheng35d6c412009-08-04 23:47:55 +0000964// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000965class TIt<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
966 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst", pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000967
Johnny Chend68e1192009-12-15 17:24:14 +0000968// tBL, tBX 32-bit instructions
969class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
970 dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
971 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>, Encoding {
972 let Inst{31-27} = opcod1;
973 let Inst{15-14} = opcod2;
974 let Inst{12} = opcod3;
975}
Evan Cheng13096642008-08-29 06:41:12 +0000976
977// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000978class TJTI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
979 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000980
Evan Cheng09c39fc2009-06-23 19:38:13 +0000981// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +0000982class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000983 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000984 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000985 let OutOperandList = oops;
986 let InOperandList = iops;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000987 let AsmString = asm;
988 let Pattern = pattern;
989 list<Predicate> Predicates = [IsThumb1Only];
990}
991
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000992class T1I<dag oops, dag iops, InstrItinClass itin,
993 string asm, list<dag> pattern>
994 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
995class T1Ix2<dag oops, dag iops, InstrItinClass itin,
996 string asm, list<dag> pattern>
997 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
998class T1JTI<dag oops, dag iops, InstrItinClass itin,
999 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001000 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001001
1002// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001003class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001004 string asm, string cstr, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001005 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001006 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001007
1008// Thumb1 instruction that can either be predicated or set CPSR.
1009class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001010 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001011 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001012 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001013 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1014 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001015 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1016 let Pattern = pattern;
1017 list<Predicate> Predicates = [IsThumb1Only];
1018}
1019
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001020class T1sI<dag oops, dag iops, InstrItinClass itin,
1021 string opc, string asm, list<dag> pattern>
1022 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001023
1024// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001025class T1sIt<dag oops, dag iops, InstrItinClass itin,
1026 string opc, string asm, list<dag> pattern>
1027 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001028 "$lhs = $dst", pattern>;
1029
1030// Thumb1 instruction that can be predicated.
1031class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001032 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001033 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001034 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001035 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001036 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng446c4282009-07-11 06:43:01 +00001037 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1038 let Pattern = pattern;
1039 list<Predicate> Predicates = [IsThumb1Only];
1040}
1041
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001042class T1pI<dag oops, dag iops, InstrItinClass itin,
1043 string opc, string asm, list<dag> pattern>
1044 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001045
1046// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001047class T1pIt<dag oops, dag iops, InstrItinClass itin,
1048 string opc, string asm, list<dag> pattern>
1049 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Evan Cheng446c4282009-07-11 06:43:01 +00001050 "$lhs = $dst", pattern>;
1051
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001052class T1pI1<dag oops, dag iops, InstrItinClass itin,
1053 string opc, string asm, list<dag> pattern>
1054 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1055class T1pI2<dag oops, dag iops, InstrItinClass itin,
1056 string opc, string asm, list<dag> pattern>
1057 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1058class T1pI4<dag oops, dag iops, InstrItinClass itin,
1059 string opc, string asm, list<dag> pattern>
1060 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
1061class T1pIs<dag oops, dag iops,
1062 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1063 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001064
Johnny Chenbbc71b22009-12-16 02:32:54 +00001065class Encoding16 : Encoding {
1066 let Inst{31-16} = 0x0000;
1067}
1068
Johnny Chend68e1192009-12-15 17:24:14 +00001069// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001070class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001071 let Inst{15-10} = opcode;
1072}
1073
1074// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001075class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001076 let Inst{15-14} = 0b00;
1077 let Inst{13-9} = opcode;
1078}
1079
1080// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001081class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001082 let Inst{15-10} = 0b010000;
1083 let Inst{9-6} = opcode;
1084}
1085
1086// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001087class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001088 let Inst{15-10} = 0b010001;
1089 let Inst{9-6} = opcode;
1090}
1091
1092// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001093class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001094 let Inst{15-12} = opA;
1095 let Inst{11-9} = opB;
1096}
1097class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
1098class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1099class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1100class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
1101class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
1102
1103// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001104class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001105 let Inst{15-12} = 0b1011;
1106 let Inst{11-5} = opcode;
1107}
1108
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001109// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1110class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001111 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001112 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001113 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001114 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001115 let InOperandList = !con(iops, (ins pred:$p));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001116 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1117 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001118 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001119}
1120
1121// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
1122// an input operand since by default it's a zero register. It will
1123// become an implicit def once it's "flipped".
1124// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1125// more consistent.
1126class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001127 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001128 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001129 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001130 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001131 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001132 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
1133 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001134 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001135}
1136
1137// Special cases
1138class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001139 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001140 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001141 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001142 let OutOperandList = oops;
1143 let InOperandList = iops;
Evan Chengf49810c2009-06-23 17:48:47 +00001144 let AsmString = asm;
1145 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001146 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001147}
1148
Jim Grosbachd1228742009-12-01 18:10:36 +00001149class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
1150 InstrItinClass itin,
1151 string asm, string cstr, list<dag> pattern>
1152 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1153 let OutOperandList = oops;
1154 let InOperandList = iops;
1155 let AsmString = asm;
1156 let Pattern = pattern;
1157 list<Predicate> Predicates = [IsThumb1Only];
1158}
1159
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001160class T2I<dag oops, dag iops, InstrItinClass itin,
1161 string opc, string asm, list<dag> pattern>
1162 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1163class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1164 string opc, string asm, list<dag> pattern>
1165 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "", pattern>;
1166class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1167 string opc, string asm, list<dag> pattern>
1168 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1169class T2Iso<dag oops, dag iops, InstrItinClass itin,
1170 string opc, string asm, list<dag> pattern>
1171 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1172class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1173 string opc, string asm, list<dag> pattern>
1174 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001175class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001176 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001177 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1178 pattern> {
1179 let Inst{31-27} = 0b11101;
1180 let Inst{26-25} = 0b00;
1181 let Inst{24} = P;
1182 let Inst{23} = ?; // The U bit.
1183 let Inst{22} = 1;
1184 let Inst{21} = W;
1185 let Inst{20} = load;
1186}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001187
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001188class T2sI<dag oops, dag iops, InstrItinClass itin,
1189 string opc, string asm, list<dag> pattern>
1190 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001191
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001192class T2XI<dag oops, dag iops, InstrItinClass itin,
1193 string asm, list<dag> pattern>
1194 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1195class T2JTI<dag oops, dag iops, InstrItinClass itin,
1196 string asm, list<dag> pattern>
1197 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001198
Evan Cheng5adb66a2009-09-28 09:14:39 +00001199class T2Ix2<dag oops, dag iops, InstrItinClass itin,
1200 string opc, string asm, list<dag> pattern>
1201 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1202
Bob Wilson815baeb2010-03-13 01:08:20 +00001203// Two-address instructions
1204class T2XIt<dag oops, dag iops, InstrItinClass itin,
1205 string asm, string cstr, list<dag> pattern>
1206 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001207
Evan Chenge88d5ce2009-07-02 07:28:31 +00001208// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001209class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1210 dag oops, dag iops,
1211 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001212 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001213 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001214 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001215 let InOperandList = !con(iops, (ins pred:$p));
Evan Chenge88d5ce2009-07-02 07:28:31 +00001216 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1217 let Pattern = pattern;
1218 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001219 let Inst{31-27} = 0b11111;
1220 let Inst{26-25} = 0b00;
1221 let Inst{24} = signed;
1222 let Inst{23} = 0;
1223 let Inst{22-21} = opcod;
1224 let Inst{20} = load;
1225 let Inst{11} = 1;
1226 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1227 let Inst{10} = pre; // The P bit.
1228 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001229}
1230
Johnny Chenadc77332010-02-26 22:04:29 +00001231// Helper class for disassembly only
1232// A6.3.16 & A6.3.17
1233// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1234class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1235 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1236 : T2I<oops, iops, itin, opc, asm, pattern> {
1237 let Inst{31-27} = 0b11111;
1238 let Inst{26-24} = 0b011;
1239 let Inst{23} = long;
1240 let Inst{22-20} = op22_20;
1241 let Inst{7-4} = op7_4;
1242}
1243
David Goodwinc9d138f2009-07-27 19:59:26 +00001244// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1245class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1246 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1247}
1248
1249// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1250class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1251 list<Predicate> Predicates = [IsThumb1Only];
1252}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001253
Evan Cheng9cb9e672009-06-27 02:26:13 +00001254// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1255class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001256 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001257}
1258
Evan Cheng13096642008-08-29 06:41:12 +00001259//===----------------------------------------------------------------------===//
1260
Evan Cheng96581d32008-11-11 02:11:05 +00001261//===----------------------------------------------------------------------===//
1262// ARM VFP Instruction templates.
1263//
1264
David Goodwin3ca524e2009-07-10 17:03:29 +00001265// Almost all VFP instructions are predicable.
1266class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001267 IndexMode im, Format f, InstrItinClass itin,
1268 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001269 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001270 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001271 let InOperandList = !con(iops, (ins pred:$p));
David Goodwin3ca524e2009-07-10 17:03:29 +00001272 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
1273 let Pattern = pattern;
1274 list<Predicate> Predicates = [HasVFP2];
1275}
1276
1277// Special cases
1278class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001279 IndexMode im, Format f, InstrItinClass itin,
1280 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001281 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001282 let OutOperandList = oops;
1283 let InOperandList = iops;
1284 let AsmString = asm;
1285 let Pattern = pattern;
1286 list<Predicate> Predicates = [HasVFP2];
1287}
1288
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001289class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1290 string opc, string asm, list<dag> pattern>
1291 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1292 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001293
Evan Chengcd8e66a2008-11-11 21:48:44 +00001294// ARM VFP addrmode5 loads and stores
1295class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001296 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001297 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001298 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001299 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001300 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001301 let Inst{27-24} = opcod1;
1302 let Inst{21-20} = opcod2;
1303 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001304
1305 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1306 let Dom = VFPNeonDomain.Value;
Evan Cheng96581d32008-11-11 02:11:05 +00001307}
1308
Evan Chengcd8e66a2008-11-11 21:48:44 +00001309class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001310 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001311 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001312 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001313 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001314 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001315 let Inst{27-24} = opcod1;
1316 let Inst{21-20} = opcod2;
1317 let Inst{11-8} = 0b1010;
Evan Cheng96581d32008-11-11 02:11:05 +00001318}
1319
Evan Chengcd8e66a2008-11-11 21:48:44 +00001320// Load / store multiple
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001321class AXDI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001322 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001323 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson815baeb2010-03-13 01:08:20 +00001324 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001325 // TODO: Mark the instructions with the appropriate subtarget info.
1326 let Inst{27-25} = 0b110;
1327 let Inst{11-8} = 0b1011;
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001328
1329 // 64-bit loads & stores operate on both NEON and VFP pipelines.
1330 let Dom = VFPNeonDomain.Value;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001331}
1332
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001333class AXSI5<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001334 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +00001335 : VFPXI<oops, iops, AddrMode5, Size4Bytes, im,
Bob Wilson815baeb2010-03-13 01:08:20 +00001336 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001337 // TODO: Mark the instructions with the appropriate subtarget info.
1338 let Inst{27-25} = 0b110;
1339 let Inst{11-8} = 0b1010;
1340}
1341
Evan Cheng96581d32008-11-11 02:11:05 +00001342// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001343class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1344 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1345 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001346 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001347 let Inst{27-23} = opcod1;
1348 let Inst{21-20} = opcod2;
1349 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001350 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001351 let Inst{7-6} = opcod4;
1352 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001353}
1354
1355// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001356class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1357 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001358 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001359 let Inst{27-23} = opcod1;
1360 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001361 let Inst{11-8} = 0b1011;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001362 let Inst{6} = op6;
1363 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001364}
1365
1366// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001367class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1368 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1369 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001370 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001371 let Inst{27-23} = opcod1;
1372 let Inst{21-20} = opcod2;
1373 let Inst{19-16} = opcod3;
Evan Cheng96581d32008-11-11 02:11:05 +00001374 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001375 let Inst{7-6} = opcod4;
1376 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001377}
1378
David Goodwin338268c2009-08-10 22:17:39 +00001379// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001380// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001381class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1382 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1383 string asm, list<dag> pattern>
1384 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1385 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001386 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1387}
1388
Evan Cheng96581d32008-11-11 02:11:05 +00001389// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001390class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1391 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001392 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001393 let Inst{27-23} = opcod1;
1394 let Inst{21-20} = opcod2;
Evan Cheng96581d32008-11-11 02:11:05 +00001395 let Inst{11-8} = 0b1010;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001396 let Inst{6} = op6;
1397 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001398}
1399
David Goodwin338268c2009-08-10 22:17:39 +00001400// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001401// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001402class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1403 dag iops, InstrItinClass itin, string opc, string asm, list<dag> pattern>
1404 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001405 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1406}
1407
Evan Cheng80a11982008-11-12 06:41:41 +00001408// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001409class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1410 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1411 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001412 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001413 let Inst{27-23} = opcod1;
1414 let Inst{21-20} = opcod2;
1415 let Inst{19-16} = opcod3;
1416 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001417 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001418 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001419}
1420
Johnny Chen811663f2010-02-11 18:47:03 +00001421// VFP conversion between floating-point and fixed-point
1422class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
1423 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1424 list<dag> pattern>
1425 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1426 // size (fixed-point number): sx == 0 ? 16 : 32
1427 let Inst{7} = op5; // sx
1428}
1429
David Goodwin338268c2009-08-10 22:17:39 +00001430// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001431class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001432 dag oops, dag iops, InstrItinClass itin,
1433 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001434 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1435 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001436 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1437}
1438
Evan Cheng80a11982008-11-12 06:41:41 +00001439class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001440 InstrItinClass itin,
1441 string opc, string asm, list<dag> pattern>
1442 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001443 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001444 let Inst{11-8} = opcod2;
1445 let Inst{4} = 1;
1446}
1447
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001448class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1449 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1450 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001451
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001452class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1453 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1454 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001455
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001456class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1457 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1458 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001459
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001460class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1461 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1462 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001463
Evan Cheng96581d32008-11-11 02:11:05 +00001464//===----------------------------------------------------------------------===//
1465
Bob Wilson5bafff32009-06-22 23:27:02 +00001466//===----------------------------------------------------------------------===//
1467// ARM NEON Instruction templates.
1468//
Evan Cheng13096642008-08-29 06:41:12 +00001469
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001470class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001471 string opc, string dt, string asm, string cstr, list<dag> pattern>
1472 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
1473 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001474 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001475 let AsmString = !strconcat(
1476 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1477 !strconcat("\t", asm));
1478 let Pattern = pattern;
1479 list<Predicate> Predicates = [HasNEON];
1480}
1481
1482// Same as NeonI except it does not have a "data type" specifier.
1483class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001484 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001485 : InstARM<am, Size4Bytes, im, NEONFrm, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001486 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001487 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001488 let AsmString = !strconcat(!strconcat(opc, "${p}"), !strconcat("\t", asm));
Bob Wilson5bafff32009-06-22 23:27:02 +00001489 let Pattern = pattern;
1490 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001491}
1492
Evan Chengac0869d2009-11-21 06:21:52 +00001493class NI<dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1494 list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001495 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm, "",
Evan Chengac0869d2009-11-21 06:21:52 +00001496 pattern> {
Evan Cheng13096642008-08-29 06:41:12 +00001497}
Bob Wilson5bafff32009-06-22 23:27:02 +00001498
Evan Chengf81bf152009-11-23 21:57:23 +00001499class NI4<dag oops, dag iops, InstrItinClass itin, string opc,
1500 string asm, list<dag> pattern>
1501 : NeonXI<oops, iops, AddrMode4, IndexModeNone, itin, opc, asm, "",
1502 pattern> {
Anton Korobeynikovbaf31082009-08-08 13:35:48 +00001503}
1504
Bob Wilsonb07c1712009-10-07 21:53:04 +00001505class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1506 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001507 string opc, string dt, string asm, string cstr, list<dag> pattern>
1508 : NeonI<oops, iops, AddrMode6, IndexModeNone, itin, opc, dt, asm, cstr,
1509 pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001510 let Inst{31-24} = 0b11110100;
Jim Grosbach780d2072009-10-20 00:19:08 +00001511 let Inst{23} = op23;
1512 let Inst{21-20} = op21_20;
1513 let Inst{11-8} = op11_8;
1514 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001515}
1516
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001517class NDataI<dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001518 string opc, string dt, string asm, string cstr, list<dag> pattern>
1519 : NeonI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, dt, asm,
1520 cstr, pattern> {
1521 let Inst{31-25} = 0b1111001;
1522}
1523
1524class NDataXI<dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001525 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001526 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, itin, opc, asm,
Evan Chengac0869d2009-11-21 06:21:52 +00001527 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001528 let Inst{31-25} = 0b1111001;
1529}
1530
1531// NEON "one register and a modified immediate" format.
1532class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1533 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001534 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001535 string opc, string dt, string asm, string cstr, list<dag> pattern>
1536 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001537 let Inst{23} = op23;
1538 let Inst{21-19} = op21_19;
1539 let Inst{11-8} = op11_8;
1540 let Inst{7} = op7;
1541 let Inst{6} = op6;
1542 let Inst{5} = op5;
1543 let Inst{4} = op4;
1544}
1545
1546// NEON 2 vector register format.
1547class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1548 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001549 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001550 string opc, string dt, string asm, string cstr, list<dag> pattern>
1551 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1552 let Inst{24-23} = op24_23;
1553 let Inst{21-20} = op21_20;
1554 let Inst{19-18} = op19_18;
1555 let Inst{17-16} = op17_16;
1556 let Inst{11-7} = op11_7;
1557 let Inst{6} = op6;
1558 let Inst{4} = op4;
1559}
1560
1561// Same as N2V except it doesn't have a datatype suffix.
1562class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1563 bits<5> op11_7, bit op6, bit op4,
1564 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001565 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001566 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001567 let Inst{24-23} = op24_23;
1568 let Inst{21-20} = op21_20;
1569 let Inst{19-18} = op19_18;
1570 let Inst{17-16} = op17_16;
1571 let Inst{11-7} = op11_7;
1572 let Inst{6} = op6;
1573 let Inst{4} = op4;
1574}
1575
1576// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001577class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001578 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001579 string opc, string dt, string asm, string cstr, list<dag> pattern>
1580 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001581 let Inst{24} = op24;
1582 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001583 let Inst{11-8} = op11_8;
1584 let Inst{7} = op7;
1585 let Inst{6} = op6;
1586 let Inst{4} = op4;
1587}
1588
1589// NEON 3 vector register format.
1590class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001591 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001592 string opc, string dt, string asm, string cstr, list<dag> pattern>
1593 : NDataI<oops, iops, itin, opc, dt, asm, cstr, pattern> {
1594 let Inst{24} = op24;
1595 let Inst{23} = op23;
1596 let Inst{21-20} = op21_20;
1597 let Inst{11-8} = op11_8;
1598 let Inst{6} = op6;
1599 let Inst{4} = op4;
1600}
1601
1602// Same as N3VX except it doesn't have a data type suffix.
1603class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1604 dag oops, dag iops, InstrItinClass itin,
Evan Chengac0869d2009-11-21 06:21:52 +00001605 string opc, string asm, string cstr, list<dag> pattern>
Evan Chengf81bf152009-11-23 21:57:23 +00001606 : NDataXI<oops, iops, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001607 let Inst{24} = op24;
1608 let Inst{23} = op23;
1609 let Inst{21-20} = op21_20;
1610 let Inst{11-8} = op11_8;
1611 let Inst{6} = op6;
1612 let Inst{4} = op4;
1613}
1614
1615// NEON VMOVs between scalar and core registers.
1616class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001617 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001618 string opc, string dt, string asm, list<dag> pattern>
1619 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
1620 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001621 let Inst{27-20} = opcod1;
1622 let Inst{11-8} = opcod2;
1623 let Inst{6-5} = opcod3;
1624 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001625
1626 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001627 let InOperandList = !con(iops, (ins pred:$p));
Evan Chengf81bf152009-11-23 21:57:23 +00001628 let AsmString = !strconcat(
1629 !strconcat(!strconcat(opc, "${p}"), !strconcat(".", dt)),
1630 !strconcat("\t", asm));
1631 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001632 list<Predicate> Predicates = [HasNEON];
1633}
1634class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001635 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001636 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001637 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001638 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001639class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001640 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001641 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001642 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001643 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001644class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001645 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001646 string opc, string dt, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001647 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001648 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001649
1650// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1651// for single-precision FP.
1652class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1653 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1654}