blob: eddb860044bd6564ae79d54fc575e27933abdb51 [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))> {
156 let PrintMethod = "printSBitModifierOperand";
157}
158
159// Same as cc_out except it defaults to setting CPSR.
160def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
161 let PrintMethod = "printSBitModifierOperand";
162}
163
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000164// ARM special operands for disassembly only.
165//
166
167def cps_opt : Operand<i32> {
168 let PrintMethod = "printCPSOptionOperand";
169}
170
171def msr_mask : Operand<i32> {
172 let PrintMethod = "printMSRMaskOperand";
173}
174
175// A8.6.117, A8.6.118. Different instructions are generated for #0 and #-0.
176// The neg_zero operand translates -0 to -1, -1 to -2, ..., etc.
177def neg_zero : Operand<i32> {
178 let PrintMethod = "printNegZeroOperand";
179}
180
Evan Cheng446c4282009-07-11 06:43:01 +0000181//===----------------------------------------------------------------------===//
182
Evan Cheng37f25d92008-08-28 23:39:26 +0000183// ARM Instruction templates.
184//
185
Johnny Chend68e1192009-12-15 17:24:14 +0000186class InstTemplate<AddrMode am, SizeFlagVal sz, IndexMode im,
187 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000188 : Instruction {
189 let Namespace = "ARM";
190
Evan Cheng37f25d92008-08-28 23:39:26 +0000191 AddrMode AM = am;
Evan Cheng37f25d92008-08-28 23:39:26 +0000192 SizeFlagVal SZ = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000193 IndexMode IM = im;
194 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000195 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000196 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000197 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000198 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000199 bit canXformTo16Bit = 0;
Bob Wilson01135592010-03-23 17:23:59 +0000200
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000201 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000202 let TSFlags{4-0} = AM.Value;
203 let TSFlags{7-5} = SZ.Value;
204 let TSFlags{9-8} = IndexModeBits;
205 let TSFlags{15-10} = Form;
206 let TSFlags{16} = isUnaryDataProc;
207 let TSFlags{17} = canXformTo16Bit;
208 let TSFlags{19-18} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000209
Evan Cheng37f25d92008-08-28 23:39:26 +0000210 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000211 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000212}
213
Johnny Chend68e1192009-12-15 17:24:14 +0000214class Encoding {
215 field bits<32> Inst;
216}
217
218class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
219 Format f, Domain d, string cstr, InstrItinClass itin>
220 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding;
221
222// This Encoding-less class is used by Thumb1 to specify the encoding bits later
223// on by adding flavors to specific instructions.
224class InstThumb<AddrMode am, SizeFlagVal sz, IndexMode im,
225 Format f, Domain d, string cstr, InstrItinClass itin>
226 : InstTemplate<am, sz, im, f, d, cstr, itin>;
227
Bob Wilson01135592010-03-23 17:23:59 +0000228class PseudoInst<dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000229 string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +0000230 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, GenericDomain,
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000231 "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000232 let OutOperandList = oops;
233 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000234 let AsmString = asm;
Evan Cheng37f25d92008-08-28 23:39:26 +0000235 let Pattern = pattern;
236}
237
238// Almost all ARM instructions are predicable.
Evan Chengd87293c2008-11-06 08:47:38 +0000239class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000240 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000241 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000242 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000243 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000244 bits<4> p;
245 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000246 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000247 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000248 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000249 let Pattern = pattern;
250 list<Predicate> Predicates = [IsARM];
251}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000252
Jim Grosbachf6b28622009-12-14 18:31:20 +0000253// A few are not predicable
254class InoP<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +0000255 IndexMode im, Format f, InstrItinClass itin,
256 string opc, string asm, string cstr,
257 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000258 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
259 let OutOperandList = oops;
260 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000261 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000262 let Pattern = pattern;
263 let isPredicable = 0;
264 list<Predicate> Predicates = [IsARM];
265}
Evan Cheng37f25d92008-08-28 23:39:26 +0000266
Bill Wendling4822bce2010-08-30 01:47:35 +0000267// Same as I except it can optionally modify CPSR. Note it's modeled as an input
268// operand since by default it's a zero register. It will become an implicit def
269// once it's "flipped".
Evan Chengd87293c2008-11-06 08:47:38 +0000270class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000271 IndexMode im, Format f, InstrItinClass itin,
272 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000273 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000274 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000275 bits<4> p; // Predicate operand
276 let Inst{31-28} = p;
277 // FIXME: The 's' operand needs to be handled, but the current generic
278 // get-value handlers don't know how to deal with it.
279
Evan Cheng37f25d92008-08-28 23:39:26 +0000280 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000281 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +0000282 let AsmString = !strconcat(opc, "${p}${s}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000283 let Pattern = pattern;
284 list<Predicate> Predicates = [IsARM];
285}
286
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000287// Special cases
Evan Chengd87293c2008-11-06 08:47:38 +0000288class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000289 IndexMode im, Format f, InstrItinClass itin,
290 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000291 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000292 let OutOperandList = oops;
293 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000294 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000295 let Pattern = pattern;
296 list<Predicate> Predicates = [IsARM];
297}
298
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000299class AI<dag oops, dag iops, Format f, InstrItinClass itin,
300 string opc, string asm, list<dag> pattern>
301 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
302 opc, asm, "", pattern>;
303class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
304 string opc, string asm, list<dag> pattern>
305 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
306 opc, asm, "", pattern>;
307class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000308 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000309 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000310 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000311class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000312 string opc, string asm, list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000313 : InoP<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000314 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000315
316// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000317class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
318 string opc, string asm, list<dag> pattern>
319 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
320 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000321 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000322}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000323class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
324 string asm, list<dag> pattern>
325 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, itin,
326 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000327 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000328}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000329class ABXIx2<dag oops, dag iops, InstrItinClass itin,
330 string asm, list<dag> pattern>
Xerxes Ranby99ccffe2010-07-22 17:28:34 +0000331 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, Pseudo, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000332 asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000333
334// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000335class JTI<dag oops, dag iops, InstrItinClass itin,
336 string asm, list<dag> pattern>
337 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000338 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000339
Jim Grosbach5278eb82009-12-11 01:42:04 +0000340// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000341class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
342 string opc, string asm, list<dag> pattern>
343 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
344 opc, asm, "", pattern> {
345 let Inst{27-23} = 0b00011;
346 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000347 let Inst{20} = 1;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000348 let Inst{11-0} = 0b111110011111;
349}
350class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
351 string opc, string asm, list<dag> pattern>
352 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, LdStExFrm, itin,
353 opc, asm, "", pattern> {
354 let Inst{27-23} = 0b00011;
355 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000356 let Inst{20} = 0;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000357 let Inst{11-4} = 0b11111001;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000358}
359
Evan Cheng0d14fc82008-09-01 01:51:14 +0000360// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000361class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
362 string opc, string asm, list<dag> pattern>
363 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
364 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000365 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000366 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000367}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000368class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
369 string opc, string asm, list<dag> pattern>
370 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
371 opc, asm, "", pattern> {
372 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000373 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000374}
375class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000376 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000377 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000378 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000379 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000380 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000381}
Bob Wilson01135592010-03-23 17:23:59 +0000382class AI1x2<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000383 string opc, string asm, list<dag> pattern>
384 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, itin,
385 opc, asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000386
Evan Cheng0d14fc82008-09-01 01:51:14 +0000387
388// addrmode2 loads and stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000389class AI2<dag oops, dag iops, Format f, InstrItinClass itin,
390 string opc, string asm, list<dag> pattern>
391 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
392 opc, asm, "", pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +0000393 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000394}
Evan Cheng93912732008-09-01 01:27:33 +0000395
396// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000397class AI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
398 string opc, string asm, list<dag> pattern>
399 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
400 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000401 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000402 let Inst{21} = 0; // W bit
403 let Inst{22} = 0; // B bit
404 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000405 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000406}
Bob Wilson01135592010-03-23 17:23:59 +0000407class AXI2ldw<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000408 string asm, list<dag> pattern>
409 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000410 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000411 let Inst{20} = 1; // L bit
412 let Inst{21} = 0; // W bit
413 let Inst{22} = 0; // B bit
414 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000415 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000416}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000417class AI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
418 string opc, string asm, list<dag> pattern>
419 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
420 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000421 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000422 let Inst{21} = 0; // W bit
423 let Inst{22} = 1; // B bit
424 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000425 let Inst{27-26} = 0b01;
Evan Cheng17222df2008-08-31 19:02:21 +0000426}
Bob Wilson01135592010-03-23 17:23:59 +0000427class AXI2ldb<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000428 string asm, list<dag> pattern>
429 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000430 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000431 let Inst{20} = 1; // L bit
432 let Inst{21} = 0; // W bit
433 let Inst{22} = 1; // B bit
434 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000435 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000436}
Evan Cheng17222df2008-08-31 19:02:21 +0000437
Evan Cheng93912732008-09-01 01:27:33 +0000438// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000439class AI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
440 string opc, string asm, list<dag> pattern>
441 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
442 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000443 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000444 let Inst{21} = 0; // W bit
445 let Inst{22} = 0; // B bit
446 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000447 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000448}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000449class AXI2stw<dag oops, dag iops, Format f, InstrItinClass itin,
450 string asm, list<dag> pattern>
451 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000452 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000453 let Inst{20} = 0; // L bit
454 let Inst{21} = 0; // W bit
455 let Inst{22} = 0; // B bit
456 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000457 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000458}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000459class AI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
460 string opc, string asm, list<dag> pattern>
461 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
462 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000463 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000464 let Inst{21} = 0; // W bit
465 let Inst{22} = 1; // B bit
466 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000467 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000468}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000469class AXI2stb<dag oops, dag iops, Format f, InstrItinClass itin,
470 string asm, list<dag> pattern>
471 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000472 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000473 let Inst{20} = 0; // L bit
474 let Inst{21} = 0; // W bit
475 let Inst{22} = 1; // B bit
476 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000477 let Inst{27-26} = 0b01;
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000478}
Evan Cheng93912732008-09-01 01:27:33 +0000479
Evan Cheng840917b2008-09-01 07:00:14 +0000480// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000481class AI2ldwpr<dag oops, dag iops, Format f, InstrItinClass itin,
482 string opc, string asm, string cstr, list<dag> pattern>
483 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
484 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000485 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000486 let Inst{21} = 1; // W bit
487 let Inst{22} = 0; // B bit
488 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000489 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000490}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000491class AI2ldbpr<dag oops, dag iops, Format f, InstrItinClass itin,
492 string opc, string asm, string cstr, list<dag> pattern>
493 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
494 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000495 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000496 let Inst{21} = 1; // W bit
497 let Inst{22} = 1; // B bit
498 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000499 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000500}
501
Evan Cheng840917b2008-09-01 07:00:14 +0000502// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000503class AI2stwpr<dag oops, dag iops, Format f, InstrItinClass itin,
504 string opc, string asm, string cstr, list<dag> pattern>
505 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
506 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000507 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000508 let Inst{21} = 1; // W bit
509 let Inst{22} = 0; // B bit
510 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000511 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000512}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000513class AI2stbpr<dag oops, dag iops, Format f, InstrItinClass itin,
514 string opc, string asm, string cstr, list<dag> pattern>
515 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, itin,
516 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000517 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000518 let Inst{21} = 1; // W bit
519 let Inst{22} = 1; // B bit
520 let Inst{24} = 1; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000521 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000522}
523
Evan Cheng840917b2008-09-01 07:00:14 +0000524// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000525class AI2ldwpo<dag oops, dag iops, Format f, InstrItinClass itin,
526 string opc, string asm, string cstr, list<dag> pattern>
527 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
528 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000529 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000530 let Inst{21} = 0; // W bit
531 let Inst{22} = 0; // B bit
532 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000533 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000534}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000535class AI2ldbpo<dag oops, dag iops, Format f, InstrItinClass itin,
536 string opc, string asm, string cstr, list<dag> pattern>
537 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
538 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000539 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000540 let Inst{21} = 0; // W bit
541 let Inst{22} = 1; // B bit
542 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000543 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000544}
545
Evan Cheng840917b2008-09-01 07:00:14 +0000546// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000547class AI2stwpo<dag oops, dag iops, Format f, InstrItinClass itin,
548 string opc, string asm, string cstr, list<dag> pattern>
549 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
550 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000551 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000552 let Inst{21} = 0; // W bit
553 let Inst{22} = 0; // B bit
554 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000555 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000556}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000557class AI2stbpo<dag oops, dag iops, Format f, InstrItinClass itin,
558 string opc, string asm, string cstr, list<dag> pattern>
559 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, itin,
560 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000561 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000562 let Inst{21} = 0; // W bit
563 let Inst{22} = 1; // B bit
564 let Inst{24} = 0; // P bit
Bill Wendlingda2ae632010-08-31 07:50:46 +0000565 let Inst{27-26} = 0b01;
Evan Cheng93912732008-09-01 01:27:33 +0000566}
567
Evan Cheng0d14fc82008-09-01 01:51:14 +0000568// addrmode3 instructions
Bob Wilson01135592010-03-23 17:23:59 +0000569class AI3<dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000570 string opc, string asm, list<dag> pattern>
571 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
572 opc, asm, "", pattern>;
573class AXI3<dag oops, dag iops, Format f, InstrItinClass itin,
574 string asm, list<dag> pattern>
575 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
576 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000577
Evan Cheng840917b2008-09-01 07:00:14 +0000578// loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000579class AI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
580 string opc, string asm, list<dag> pattern>
581 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
582 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000583 let Inst{4} = 1;
584 let Inst{5} = 1; // H bit
585 let Inst{6} = 0; // S bit
586 let Inst{7} = 1;
587 let Inst{20} = 1; // L bit
588 let Inst{21} = 0; // W bit
589 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000590 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000591}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000592class AXI3ldh<dag oops, dag iops, Format f, InstrItinClass itin,
593 string asm, list<dag> pattern>
594 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000595 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000596 let Inst{4} = 1;
597 let Inst{5} = 1; // H bit
598 let Inst{6} = 0; // S bit
599 let Inst{7} = 1;
600 let Inst{20} = 1; // L bit
601 let Inst{21} = 0; // W bit
602 let Inst{24} = 1; // P bit
603}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000604class AI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
605 string opc, string asm, list<dag> pattern>
606 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
607 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000608 let Inst{4} = 1;
609 let Inst{5} = 1; // H bit
610 let Inst{6} = 1; // S bit
611 let Inst{7} = 1;
612 let Inst{20} = 1; // L bit
613 let Inst{21} = 0; // W bit
614 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000615 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000616}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000617class AXI3ldsh<dag oops, dag iops, Format f, InstrItinClass itin,
618 string asm, list<dag> pattern>
619 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000620 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000621 let Inst{4} = 1;
622 let Inst{5} = 1; // H bit
623 let Inst{6} = 1; // S bit
624 let Inst{7} = 1;
625 let Inst{20} = 1; // L bit
626 let Inst{21} = 0; // W bit
627 let Inst{24} = 1; // P bit
628}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000629class AI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
630 string opc, string asm, list<dag> pattern>
631 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
632 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000633 let Inst{4} = 1;
634 let Inst{5} = 0; // H bit
635 let Inst{6} = 1; // S bit
636 let Inst{7} = 1;
637 let Inst{20} = 1; // L bit
638 let Inst{21} = 0; // W bit
639 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000640 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000641}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000642class AXI3ldsb<dag oops, dag iops, Format f, InstrItinClass itin,
643 string asm, list<dag> pattern>
644 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000645 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000646 let Inst{4} = 1;
647 let Inst{5} = 0; // H bit
648 let Inst{6} = 1; // S bit
649 let Inst{7} = 1;
650 let Inst{20} = 1; // L bit
651 let Inst{21} = 0; // W bit
652 let Inst{24} = 1; // P bit
653}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000654class AI3ldd<dag oops, dag iops, Format f, InstrItinClass itin,
655 string opc, string asm, list<dag> pattern>
656 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
657 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000658 let Inst{4} = 1;
659 let Inst{5} = 0; // H bit
660 let Inst{6} = 1; // S bit
661 let Inst{7} = 1;
662 let Inst{20} = 0; // L bit
663 let Inst{21} = 0; // W bit
664 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000665 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000666}
667
668// stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000669class AI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
670 string opc, string asm, list<dag> pattern>
671 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
672 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000673 let Inst{4} = 1;
674 let Inst{5} = 1; // H bit
675 let Inst{6} = 0; // S bit
676 let Inst{7} = 1;
677 let Inst{20} = 0; // L bit
678 let Inst{21} = 0; // W bit
679 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000680 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000681}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000682class AXI3sth<dag oops, dag iops, Format f, InstrItinClass itin,
683 string asm, list<dag> pattern>
684 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
Evan Cheng83b5cf02008-11-05 23:22:34 +0000685 asm, "", pattern> {
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000686 let Inst{4} = 1;
687 let Inst{5} = 1; // H bit
688 let Inst{6} = 0; // S bit
689 let Inst{7} = 1;
690 let Inst{20} = 0; // L bit
691 let Inst{21} = 0; // W bit
692 let Inst{24} = 1; // P bit
693}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000694class AI3std<dag oops, dag iops, Format f, InstrItinClass itin,
695 string opc, string asm, list<dag> pattern>
696 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, itin,
697 opc, asm, "", pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000698 let Inst{4} = 1;
699 let Inst{5} = 1; // H bit
700 let Inst{6} = 1; // S bit
701 let Inst{7} = 1;
702 let Inst{20} = 0; // L bit
703 let Inst{21} = 0; // W bit
704 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000705 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000706}
707
708// Pre-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000709class AI3ldhpr<dag oops, dag iops, Format f, InstrItinClass itin,
710 string opc, string asm, string cstr, list<dag> pattern>
711 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
712 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000713 let Inst{4} = 1;
714 let Inst{5} = 1; // H bit
715 let Inst{6} = 0; // S bit
716 let Inst{7} = 1;
717 let Inst{20} = 1; // L bit
718 let Inst{21} = 1; // W bit
719 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000720 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000721}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000722class AI3ldshpr<dag oops, dag iops, Format f, InstrItinClass itin,
723 string opc, string asm, string cstr, list<dag> pattern>
724 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
725 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000726 let Inst{4} = 1;
727 let Inst{5} = 1; // H bit
728 let Inst{6} = 1; // S bit
729 let Inst{7} = 1;
730 let Inst{20} = 1; // L bit
731 let Inst{21} = 1; // W bit
732 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000733 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000734}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000735class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
736 string opc, string asm, string cstr, list<dag> pattern>
737 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
738 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000739 let Inst{4} = 1;
740 let Inst{5} = 0; // H bit
741 let Inst{6} = 1; // S bit
742 let Inst{7} = 1;
743 let Inst{20} = 1; // L bit
744 let Inst{21} = 1; // W bit
745 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000746 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000747}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000748class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
749 string opc, string asm, string cstr, list<dag> pattern>
750 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
751 opc, asm, cstr, pattern> {
752 let Inst{4} = 1;
753 let Inst{5} = 0; // H bit
754 let Inst{6} = 1; // S bit
755 let Inst{7} = 1;
756 let Inst{20} = 0; // L bit
757 let Inst{21} = 1; // W bit
758 let Inst{24} = 1; // P bit
759 let Inst{27-25} = 0b000;
760}
761
Evan Cheng840917b2008-09-01 07:00:14 +0000762
763// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000764class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
765 string opc, string asm, string cstr, list<dag> pattern>
766 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
767 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000768 let Inst{4} = 1;
769 let Inst{5} = 1; // H bit
770 let Inst{6} = 0; // S bit
771 let Inst{7} = 1;
772 let Inst{20} = 0; // L bit
773 let Inst{21} = 1; // W bit
774 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000775 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000776}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000777class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
778 string opc, string asm, string cstr, list<dag> pattern>
779 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
780 opc, asm, cstr, pattern> {
781 let Inst{4} = 1;
782 let Inst{5} = 1; // H bit
783 let Inst{6} = 1; // S bit
784 let Inst{7} = 1;
785 let Inst{20} = 0; // L bit
786 let Inst{21} = 1; // W bit
787 let Inst{24} = 1; // P bit
788 let Inst{27-25} = 0b000;
789}
Evan Cheng840917b2008-09-01 07:00:14 +0000790
791// Post-indexed loads
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000792class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
793 string opc, string asm, string cstr, list<dag> pattern>
794 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
795 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000796 let Inst{4} = 1;
797 let Inst{5} = 1; // H bit
798 let Inst{6} = 0; // S bit
799 let Inst{7} = 1;
800 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000801 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000802 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000803 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000804}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000805class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
806 string opc, string asm, string cstr, list<dag> pattern>
807 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
808 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000809 let Inst{4} = 1;
810 let Inst{5} = 1; // H bit
811 let Inst{6} = 1; // S bit
812 let Inst{7} = 1;
813 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000814 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000815 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000816 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000817}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000818class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
819 string opc, string asm, string cstr, list<dag> pattern>
820 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
821 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000822 let Inst{4} = 1;
823 let Inst{5} = 0; // H bit
824 let Inst{6} = 1; // S bit
825 let Inst{7} = 1;
826 let Inst{20} = 1; // L bit
Johnny Chenadb561d2010-02-18 03:27:42 +0000827 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000828 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000829 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000830}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000831class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
832 string opc, string asm, string cstr, list<dag> pattern>
833 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
834 opc, asm, cstr, pattern> {
835 let Inst{4} = 1;
836 let Inst{5} = 0; // H bit
837 let Inst{6} = 1; // S bit
838 let Inst{7} = 1;
839 let Inst{20} = 0; // L bit
840 let Inst{21} = 0; // W bit
841 let Inst{24} = 0; // P bit
842 let Inst{27-25} = 0b000;
843}
Evan Cheng840917b2008-09-01 07:00:14 +0000844
845// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000846class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
847 string opc, string asm, string cstr, list<dag> pattern>
848 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
849 opc, asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000850 let Inst{4} = 1;
851 let Inst{5} = 1; // H bit
852 let Inst{6} = 0; // S bit
853 let Inst{7} = 1;
854 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000855 let Inst{21} = 0; // W bit
Evan Cheng840917b2008-09-01 07:00:14 +0000856 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000857 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000858}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000859class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
860 string opc, string asm, string cstr, list<dag> pattern>
861 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
862 opc, asm, cstr, pattern> {
863 let Inst{4} = 1;
864 let Inst{5} = 1; // H bit
865 let Inst{6} = 1; // S bit
866 let Inst{7} = 1;
867 let Inst{20} = 0; // L bit
868 let Inst{21} = 0; // W bit
869 let Inst{24} = 0; // P bit
870 let Inst{27-25} = 0b000;
871}
Evan Cheng840917b2008-09-01 07:00:14 +0000872
Evan Cheng0d14fc82008-09-01 01:51:14 +0000873// addrmode4 instructions
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000874class AXI4ld<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000875 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000876 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000877 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000878 let Inst{20} = 1; // L bit
879 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000880 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000881}
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000882class AXI4st<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000883 string asm, string cstr, list<dag> pattern>
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000884 : XI<oops, iops, AddrMode4, Size4Bytes, im, f, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000885 asm, cstr, pattern> {
Evan Cheng3c2ee492008-09-01 07:48:18 +0000886 let Inst{20} = 0; // L bit
887 let Inst{22} = 0; // S bit
Jim Grosbach26421962008-10-14 20:36:24 +0000888 let Inst{27-25} = 0b100;
Evan Cheng3c2ee492008-09-01 07:48:18 +0000889}
Evan Cheng37f25d92008-08-28 23:39:26 +0000890
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000891// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000892class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
893 string opc, string asm, list<dag> pattern>
894 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
895 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000896 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000897 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000898 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000899}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000900class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
901 string opc, string asm, list<dag> pattern>
902 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
903 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000904 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000905 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000906}
907
908// Most significant word multiply
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000909class AMul2I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
910 string opc, string asm, list<dag> pattern>
911 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
912 opc, asm, "", pattern> {
Evan Chengfbc9d412008-11-06 01:21:28 +0000913 let Inst{7-4} = 0b1001;
914 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000915 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000916}
Evan Cheng37f25d92008-08-28 23:39:26 +0000917
Evan Chengeb4f52e2008-11-06 03:35:07 +0000918// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000919class AMulxyI<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
920 string opc, string asm, list<dag> pattern>
921 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, itin,
922 opc, asm, "", pattern> {
Evan Chengeb4f52e2008-11-06 03:35:07 +0000923 let Inst{4} = 0;
924 let Inst{7} = 1;
925 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000926 let Inst{27-21} = opcod;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000927}
928
Evan Cheng97f48c32008-11-06 22:15:19 +0000929// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000930class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
931 string opc, string asm, list<dag> pattern>
932 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, itin,
933 opc, asm, "", pattern> {
Evan Cheng97f48c32008-11-06 22:15:19 +0000934 let Inst{7-4} = 0b0111;
935 let Inst{27-20} = opcod;
936}
937
Evan Cheng8b59db32008-11-07 01:41:35 +0000938// Misc Arithmetic instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000939class AMiscA1I<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
940 string opc, string asm, list<dag> pattern>
941 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, itin,
942 opc, asm, "", pattern> {
Evan Cheng8b59db32008-11-07 01:41:35 +0000943 let Inst{27-20} = opcod;
944}
945
Evan Cheng37f25d92008-08-28 23:39:26 +0000946//===----------------------------------------------------------------------===//
947
948// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
949class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
950 list<Predicate> Predicates = [IsARM];
951}
952class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
953 list<Predicate> Predicates = [IsARM, HasV5TE];
954}
955class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
956 list<Predicate> Predicates = [IsARM, HasV6];
957}
Evan Cheng13096642008-08-29 06:41:12 +0000958
959//===----------------------------------------------------------------------===//
960//
961// Thumb Instruction Format Definitions.
962//
963
Evan Cheng13096642008-08-29 06:41:12 +0000964// TI - Thumb instruction.
965
Evan Cheng446c4282009-07-11 06:43:01 +0000966class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000967 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000968 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000969 let OutOperandList = oops;
970 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000971 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000972 let Pattern = pattern;
973 list<Predicate> Predicates = [IsThumb];
974}
975
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000976class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
977 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000978
Evan Cheng35d6c412009-08-04 23:47:55 +0000979// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000980class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
981 list<dag> pattern>
982 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "$lhs = $dst",
983 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000984
Johnny Chend68e1192009-12-15 17:24:14 +0000985// tBL, tBX 32-bit instructions
986class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000987 dag oops, dag iops, InstrItinClass itin, string asm,
988 list<dag> pattern>
989 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>,
990 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000991 let Inst{31-27} = opcod1;
992 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000993 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000994}
Evan Cheng13096642008-08-29 06:41:12 +0000995
996// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000997class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
998 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000999 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +00001000
Evan Cheng09c39fc2009-06-23 19:38:13 +00001001// Thumb1 only
Evan Cheng446c4282009-07-11 06:43:01 +00001002class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001003 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001004 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001005 let OutOperandList = oops;
1006 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001007 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001008 let Pattern = pattern;
1009 list<Predicate> Predicates = [IsThumb1Only];
1010}
1011
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001012class T1I<dag oops, dag iops, InstrItinClass itin,
1013 string asm, list<dag> pattern>
1014 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin, asm, "", pattern>;
1015class T1Ix2<dag oops, dag iops, InstrItinClass itin,
1016 string asm, list<dag> pattern>
1017 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1018class T1JTI<dag oops, dag iops, InstrItinClass itin,
1019 string asm, list<dag> pattern>
Johnny Chenbbc71b22009-12-16 02:32:54 +00001020 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001021
1022// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001023class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001024 string asm, string cstr, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001025 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001026 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001027
1028// Thumb1 instruction that can either be predicated or set CPSR.
1029class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001030 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001031 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001032 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +00001033 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1034 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001035 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001036 let Pattern = pattern;
1037 list<Predicate> Predicates = [IsThumb1Only];
1038}
1039
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001040class T1sI<dag oops, dag iops, InstrItinClass itin,
1041 string opc, string asm, list<dag> pattern>
1042 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001043
1044// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001045class T1sIt<dag oops, dag iops, InstrItinClass itin,
1046 string opc, string asm, list<dag> pattern>
1047 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001048 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001049
1050// Thumb1 instruction that can be predicated.
1051class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001052 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +00001053 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001054 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +00001055 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001056 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001057 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001058 let Pattern = pattern;
1059 list<Predicate> Predicates = [IsThumb1Only];
1060}
1061
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001062class T1pI<dag oops, dag iops, InstrItinClass itin,
1063 string opc, string asm, list<dag> pattern>
1064 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001065
1066// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001067class T1pIt<dag oops, dag iops, InstrItinClass itin,
1068 string opc, string asm, list<dag> pattern>
1069 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001070 "$lhs = $dst", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001071
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001072class T1pI1<dag oops, dag iops, InstrItinClass itin,
1073 string opc, string asm, list<dag> pattern>
1074 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, itin, opc, asm, "", pattern>;
1075class T1pI2<dag oops, dag iops, InstrItinClass itin,
1076 string opc, string asm, list<dag> pattern>
1077 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, itin, opc, asm, "", pattern>;
1078class T1pI4<dag oops, dag iops, InstrItinClass itin,
1079 string opc, string asm, list<dag> pattern>
1080 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, itin, opc, asm, "", pattern>;
Bob Wilson01135592010-03-23 17:23:59 +00001081class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001082 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1083 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001084
Johnny Chenbbc71b22009-12-16 02:32:54 +00001085class Encoding16 : Encoding {
1086 let Inst{31-16} = 0x0000;
1087}
1088
Johnny Chend68e1192009-12-15 17:24:14 +00001089// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001090class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001091 let Inst{15-10} = opcode;
1092}
1093
1094// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001095class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001096 let Inst{15-14} = 0b00;
1097 let Inst{13-9} = opcode;
1098}
1099
1100// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001101class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001102 let Inst{15-10} = 0b010000;
1103 let Inst{9-6} = opcode;
1104}
1105
1106// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001107class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001108 let Inst{15-10} = 0b010001;
1109 let Inst{9-6} = opcode;
1110}
1111
1112// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001113class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001114 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001115 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001116}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001117class T1LdSt<bits<3> opB> : T1LoadStore<0b0101, opB>;
Johnny Chend68e1192009-12-15 17:24:14 +00001118class T1LdSt4Imm<bits<3> opB> : T1LoadStore<0b0110, opB>; // Immediate, 4 bytes
1119class T1LdSt1Imm<bits<3> opB> : T1LoadStore<0b0111, opB>; // Immediate, 1 byte
1120class T1LdSt2Imm<bits<3> opB> : T1LoadStore<0b1000, opB>; // Immediate, 2 bytes
Bill Wendlingda2ae632010-08-31 07:50:46 +00001121class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001122
1123// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001124class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001125 let Inst{15-12} = 0b1011;
1126 let Inst{11-5} = opcode;
1127}
1128
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001129// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
1130class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001131 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001132 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001133 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001134 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001135 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001136 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001137 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001138 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001139}
1140
Bill Wendlingda2ae632010-08-31 07:50:46 +00001141// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1142// input operand since by default it's a zero register. It will become an
1143// implicit def once it's "flipped".
1144//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001145// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1146// more consistent.
1147class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001148 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001149 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001150 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001151 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001152 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001153 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001154 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001155 list<Predicate> Predicates = [IsThumb2];
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001156}
1157
1158// Special cases
1159class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001160 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001161 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001162 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001163 let OutOperandList = oops;
1164 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001165 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001166 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001167 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001168}
1169
Jim Grosbachd1228742009-12-01 18:10:36 +00001170class ThumbXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Bob Wilson01135592010-03-23 17:23:59 +00001171 InstrItinClass itin,
1172 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001173 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1174 let OutOperandList = oops;
1175 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001176 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001177 let Pattern = pattern;
1178 list<Predicate> Predicates = [IsThumb1Only];
1179}
1180
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001181class T2I<dag oops, dag iops, InstrItinClass itin,
1182 string opc, string asm, list<dag> pattern>
1183 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
1184class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1185 string opc, string asm, list<dag> pattern>
Bob Wilson01135592010-03-23 17:23:59 +00001186 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001187class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1188 string opc, string asm, list<dag> pattern>
1189 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, itin, opc, asm, "", pattern>;
1190class T2Iso<dag oops, dag iops, InstrItinClass itin,
1191 string opc, string asm, list<dag> pattern>
1192 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, itin, opc, asm, "", pattern>;
1193class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1194 string opc, string asm, list<dag> pattern>
1195 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, itin, opc, asm, "", pattern>;
Johnny Chend68e1192009-12-15 17:24:14 +00001196class T2Ii8s4<bit P, bit W, bit load, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001197 string opc, string asm, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +00001198 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, itin, opc, asm, "",
1199 pattern> {
1200 let Inst{31-27} = 0b11101;
1201 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001202 let Inst{24} = P;
1203 let Inst{23} = ?; // The U bit.
1204 let Inst{22} = 1;
1205 let Inst{21} = W;
1206 let Inst{20} = load;
Johnny Chend68e1192009-12-15 17:24:14 +00001207}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001208
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001209class T2sI<dag oops, dag iops, InstrItinClass itin,
1210 string opc, string asm, list<dag> pattern>
1211 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001212
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001213class T2XI<dag oops, dag iops, InstrItinClass itin,
1214 string asm, list<dag> pattern>
1215 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, "", pattern>;
1216class T2JTI<dag oops, dag iops, InstrItinClass itin,
1217 string asm, list<dag> pattern>
1218 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001219
Evan Cheng5adb66a2009-09-28 09:14:39 +00001220class T2Ix2<dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001221 string opc, string asm, list<dag> pattern>
Evan Cheng5adb66a2009-09-28 09:14:39 +00001222 : Thumb2I<oops, iops, AddrModeNone, Size8Bytes, itin, opc, asm, "", pattern>;
1223
Bob Wilson815baeb2010-03-13 01:08:20 +00001224// Two-address instructions
1225class T2XIt<dag oops, dag iops, InstrItinClass itin,
1226 string asm, string cstr, list<dag> pattern>
1227 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001228
Evan Chenge88d5ce2009-07-02 07:28:31 +00001229// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001230class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1231 dag oops, dag iops,
1232 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001233 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001234 : InstARM<am, Size4Bytes, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001235 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001236 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001237 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001238 let Pattern = pattern;
1239 list<Predicate> Predicates = [IsThumb2];
Johnny Chend68e1192009-12-15 17:24:14 +00001240 let Inst{31-27} = 0b11111;
1241 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001242 let Inst{24} = signed;
1243 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001244 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001245 let Inst{20} = load;
1246 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001247 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001248 let Inst{10} = pre; // The P bit.
1249 let Inst{8} = 1; // The W bit.
Evan Chenge88d5ce2009-07-02 07:28:31 +00001250}
1251
Johnny Chenadc77332010-02-26 22:04:29 +00001252// Helper class for disassembly only
1253// A6.3.16 & A6.3.17
1254// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
1255class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
1256 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1257 : T2I<oops, iops, itin, opc, asm, pattern> {
1258 let Inst{31-27} = 0b11111;
1259 let Inst{26-24} = 0b011;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001260 let Inst{23} = long;
Johnny Chenadc77332010-02-26 22:04:29 +00001261 let Inst{22-20} = op22_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001262 let Inst{7-4} = op7_4;
Johnny Chenadc77332010-02-26 22:04:29 +00001263}
1264
David Goodwinc9d138f2009-07-27 19:59:26 +00001265// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1266class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
1267 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
1268}
1269
1270// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1271class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
1272 list<Predicate> Predicates = [IsThumb1Only];
1273}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001274
Evan Cheng9cb9e672009-06-27 02:26:13 +00001275// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1276class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001277 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001278}
1279
Evan Cheng13096642008-08-29 06:41:12 +00001280//===----------------------------------------------------------------------===//
1281
Evan Cheng96581d32008-11-11 02:11:05 +00001282//===----------------------------------------------------------------------===//
1283// ARM VFP Instruction templates.
1284//
1285
David Goodwin3ca524e2009-07-10 17:03:29 +00001286// Almost all VFP instructions are predicable.
1287class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001288 IndexMode im, Format f, InstrItinClass itin,
1289 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001290 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001291 bits<4> p;
1292 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001293 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001294 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001295 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001296 let Pattern = pattern;
1297 list<Predicate> Predicates = [HasVFP2];
1298}
1299
1300// Special cases
1301class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001302 IndexMode im, Format f, InstrItinClass itin,
1303 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001304 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
David Goodwin3ca524e2009-07-10 17:03:29 +00001305 let OutOperandList = oops;
1306 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001307 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001308 let Pattern = pattern;
1309 list<Predicate> Predicates = [HasVFP2];
1310}
1311
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001312class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1313 string opc, string asm, list<dag> pattern>
1314 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, itin,
1315 opc, asm, "", pattern>;
David Goodwin3ca524e2009-07-10 17:03:29 +00001316
Evan Chengcd8e66a2008-11-11 21:48:44 +00001317// ARM VFP addrmode5 loads and stores
1318class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001319 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001320 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001321 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001322 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001323 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001324 let Inst{27-24} = opcod1;
1325 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001326 let Inst{11-9} = 0b101;
1327 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001328
1329 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001330 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001331}
1332
Evan Chengcd8e66a2008-11-11 21:48:44 +00001333class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001334 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001335 string opc, string asm, list<dag> pattern>
David Goodwin3ca524e2009-07-10 17:03:29 +00001336 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001337 VFPLdStFrm, itin, opc, asm, "", pattern> {
Evan Cheng96581d32008-11-11 02:11:05 +00001338 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001339 let Inst{27-24} = opcod1;
1340 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001341 let Inst{11-9} = 0b101;
1342 let Inst{8} = 0; // Single precision
Evan Cheng96581d32008-11-11 02:11:05 +00001343}
1344
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001345// VFP Load / store multiple pseudo instructions.
1346class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1347 list<dag> pattern>
1348 : InstARM<AddrMode4, Size4Bytes, IndexModeNone, Pseudo, VFPNeonDomain,
1349 cstr, itin> {
1350 let OutOperandList = oops;
1351 let InOperandList = !con(iops, (ins pred:$p));
1352 let Pattern = pattern;
1353 list<Predicate> Predicates = [HasVFP2];
1354}
1355
Evan Chengcd8e66a2008-11-11 21:48:44 +00001356// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001357class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001358 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001359 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001360 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001361 // TODO: Mark the instructions with the appropriate subtarget info.
1362 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001363 let Inst{11-9} = 0b101;
1364 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001365
1366 // 64-bit loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001367 let D = VFPNeonDomain;
Evan Chengcd8e66a2008-11-11 21:48:44 +00001368}
1369
Jim Grosbach72db1822010-09-08 00:25:50 +00001370class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001371 string asm, string cstr, list<dag> pattern>
Jim Grosbach72db1822010-09-08 00:25:50 +00001372 : VFPXI<oops, iops, AddrMode4, Size4Bytes, im,
Bob Wilson01135592010-03-23 17:23:59 +00001373 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Evan Chengcd8e66a2008-11-11 21:48:44 +00001374 // TODO: Mark the instructions with the appropriate subtarget info.
1375 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001376 let Inst{11-9} = 0b101;
1377 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001378}
1379
Evan Cheng96581d32008-11-11 02:11:05 +00001380// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001381class ADuI<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>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001384 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001385 let Inst{27-23} = opcod1;
1386 let Inst{21-20} = opcod2;
1387 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001388 let Inst{11-9} = 0b101;
1389 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001390 let Inst{7-6} = opcod4;
1391 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001392}
1393
1394// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001395class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001396 dag iops, InstrItinClass itin, string opc, string asm,
1397 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001398 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001399 let Inst{27-23} = opcod1;
1400 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001401 let Inst{11-9} = 0b101;
1402 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001403 let Inst{6} = op6;
1404 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001405}
1406
Jim Grosbach26767372010-03-24 22:31:46 +00001407// Double precision, binary, VML[AS] (for additional predicate)
1408class ADbI_vmlX<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
1409 dag iops, InstrItinClass itin, string opc, string asm,
1410 list<dag> pattern>
1411 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
1412 let Inst{27-23} = opcod1;
1413 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001414 let Inst{11-9} = 0b101;
1415 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001416 let Inst{6} = op6;
1417 let Inst{4} = op4;
Jim Grosbach26767372010-03-24 22:31:46 +00001418 list<Predicate> Predicates = [HasVFP2, UseVMLx];
1419}
1420
Evan Cheng96581d32008-11-11 02:11:05 +00001421// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001422class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1423 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1424 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001425 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001426 let Inst{27-23} = opcod1;
1427 let Inst{21-20} = opcod2;
1428 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001429 let Inst{11-9} = 0b101;
1430 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001431 let Inst{7-6} = opcod4;
1432 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001433}
1434
David Goodwin338268c2009-08-10 22:17:39 +00001435// Single precision unary, if no NEON
David Goodwin53e44712009-08-04 20:39:05 +00001436// Same as ASuI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001437class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1438 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1439 string asm, list<dag> pattern>
1440 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1441 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001442 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1443}
1444
Evan Cheng96581d32008-11-11 02:11:05 +00001445// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001446class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1447 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001448 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001449 let Inst{27-23} = opcod1;
1450 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001451 let Inst{11-9} = 0b101;
1452 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001453 let Inst{6} = op6;
1454 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001455}
1456
David Goodwin338268c2009-08-10 22:17:39 +00001457// Single precision binary, if no NEON
David Goodwin42a83f22009-08-04 17:53:06 +00001458// Same as ASbI except not available if NEON is enabled
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001459class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001460 dag iops, InstrItinClass itin, string opc, string asm,
1461 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001462 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001463 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1464}
1465
Evan Cheng80a11982008-11-12 06:41:41 +00001466// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001467class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1468 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1469 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001470 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001471 let Inst{27-23} = opcod1;
1472 let Inst{21-20} = opcod2;
1473 let Inst{19-16} = opcod3;
1474 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001475 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001476 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001477}
1478
Johnny Chen811663f2010-02-11 18:47:03 +00001479// VFP conversion between floating-point and fixed-point
1480class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001481 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1482 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001483 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1484 // size (fixed-point number): sx == 0 ? 16 : 32
1485 let Inst{7} = op5; // sx
1486}
1487
David Goodwin338268c2009-08-10 22:17:39 +00001488// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001489class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001490 dag oops, dag iops, InstrItinClass itin,
1491 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001492 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1493 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001494 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1495}
1496
Evan Cheng80a11982008-11-12 06:41:41 +00001497class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001498 InstrItinClass itin,
1499 string opc, string asm, list<dag> pattern>
1500 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001501 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001502 let Inst{11-8} = opcod2;
1503 let Inst{4} = 1;
1504}
1505
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001506class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1507 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1508 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001509
Bob Wilson01135592010-03-23 17:23:59 +00001510class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001511 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1512 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001513
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001514class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1515 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1516 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001517
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001518class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1519 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1520 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001521
Evan Cheng96581d32008-11-11 02:11:05 +00001522//===----------------------------------------------------------------------===//
1523
Bob Wilson5bafff32009-06-22 23:27:02 +00001524//===----------------------------------------------------------------------===//
1525// ARM NEON Instruction templates.
1526//
Evan Cheng13096642008-08-29 06:41:12 +00001527
Johnny Chencaa608e2010-03-20 00:17:00 +00001528class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1529 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1530 list<dag> pattern>
1531 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001532 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001533 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001534 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001535 let Pattern = pattern;
1536 list<Predicate> Predicates = [HasNEON];
1537}
1538
1539// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001540class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1541 InstrItinClass itin, string opc, string asm, string cstr,
1542 list<dag> pattern>
1543 : InstARM<am, Size4Bytes, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001544 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001545 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001546 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001547 let Pattern = pattern;
1548 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001549}
1550
Bob Wilsonb07c1712009-10-07 21:53:04 +00001551class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1552 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001553 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001554 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1555 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001556 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001557 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001558 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001559 let Inst{11-8} = op11_8;
1560 let Inst{7-4} = op7_4;
Bob Wilson205a5ca2009-07-08 18:11:30 +00001561}
1562
Bob Wilson709d5922010-08-25 23:27:42 +00001563class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
1564 : InstARM<AddrMode6, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1565 itin> {
1566 let OutOperandList = oops;
1567 let InOperandList = !con(iops, (ins pred:$p));
1568 list<Predicate> Predicates = [HasNEON];
1569}
1570
Jim Grosbach7cd27292010-10-06 20:36:55 +00001571class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1572 list<dag> pattern>
Bob Wilsonbd916c52010-09-13 23:55:10 +00001573 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, Pseudo, NeonDomain, cstr,
1574 itin> {
1575 let OutOperandList = oops;
1576 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001577 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001578 list<Predicate> Predicates = [HasNEON];
1579}
1580
Johnny Chen785516a2010-03-23 16:43:47 +00001581class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001582 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001583 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1584 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001585 let Inst{31-25} = 0b1111001;
1586}
1587
Johnny Chen927b88f2010-03-23 20:40:44 +00001588class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001589 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001590 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001591 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001592 let Inst{31-25} = 0b1111001;
1593}
1594
1595// NEON "one register and a modified immediate" format.
1596class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1597 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001598 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001599 string opc, string dt, string asm, string cstr,
1600 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001601 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001602 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001603 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001604 let Inst{11-8} = op11_8;
1605 let Inst{7} = op7;
1606 let Inst{6} = op6;
1607 let Inst{5} = op5;
1608 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001609}
1610
1611// NEON 2 vector register format.
1612class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1613 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001614 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001615 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001616 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001617 let Inst{24-23} = op24_23;
1618 let Inst{21-20} = op21_20;
1619 let Inst{19-18} = op19_18;
1620 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001621 let Inst{11-7} = op11_7;
1622 let Inst{6} = op6;
1623 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001624}
1625
1626// Same as N2V except it doesn't have a datatype suffix.
1627class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001628 bits<5> op11_7, bit op6, bit op4,
1629 dag oops, dag iops, InstrItinClass itin,
1630 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001631 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001632 let Inst{24-23} = op24_23;
1633 let Inst{21-20} = op21_20;
1634 let Inst{19-18} = op19_18;
1635 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001636 let Inst{11-7} = op11_7;
1637 let Inst{6} = op6;
1638 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001639}
1640
1641// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001642class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001643 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001644 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001645 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001646 let Inst{24} = op24;
1647 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001648 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001649 let Inst{7} = op7;
1650 let Inst{6} = op6;
1651 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001652}
1653
Bob Wilson10bc69c2010-03-27 03:56:52 +00001654// NEON 3 vector register format.
1655class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1656 dag oops, dag iops, Format f, InstrItinClass itin,
1657 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001658 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001659 let Inst{24} = op24;
1660 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001661 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001662 let Inst{11-8} = op11_8;
1663 let Inst{6} = op6;
1664 let Inst{4} = op4;
Evan Chengf81bf152009-11-23 21:57:23 +00001665}
1666
Johnny Chen841e8282010-03-23 21:35:03 +00001667// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001668class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1669 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001670 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001671 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001672 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001673 let Inst{24} = op24;
1674 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001675 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001676 let Inst{11-8} = op11_8;
1677 let Inst{6} = op6;
1678 let Inst{4} = op4;
Bob Wilson5bafff32009-06-22 23:27:02 +00001679}
1680
1681// NEON VMOVs between scalar and core registers.
1682class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001683 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001684 string opc, string dt, string asm, list<dag> pattern>
1685 : InstARM<AddrModeNone, Size4Bytes, IndexModeNone, f, GenericDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001686 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001687 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001688 let Inst{11-8} = opcod2;
1689 let Inst{6-5} = opcod3;
1690 let Inst{4} = 1;
Evan Chengf81bf152009-11-23 21:57:23 +00001691
1692 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001693 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001694 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001695 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001696 list<Predicate> Predicates = [HasNEON];
1697}
1698class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001699 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001700 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001701 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001702 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001703class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001704 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001705 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001706 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001707 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001708class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001709 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001710 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001711 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001712 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001713
Johnny Chene4614f72010-03-25 17:01:27 +00001714// Vector Duplicate Lane (from scalar to all elements)
1715class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1716 InstrItinClass itin, string opc, string dt, string asm,
1717 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001718 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001719 let Inst{24-23} = 0b11;
1720 let Inst{21-20} = 0b11;
1721 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001722 let Inst{11-7} = 0b11000;
1723 let Inst{6} = op6;
1724 let Inst{4} = 0;
Johnny Chene4614f72010-03-25 17:01:27 +00001725}
1726
David Goodwin42a83f22009-08-04 17:53:06 +00001727// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1728// for single-precision FP.
1729class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1730 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1731}