blob: 3b0e17fd6605701e089d40d4f7c83807692271e0 [file] [log] [blame]
Bill Wendling43f7b2d2010-12-01 02:42:55 +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
Bill Wendling43f7b2d2010-12-01 02:42:55 +000074// The instruction has an 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
Jim Grosbachff12a8b2011-01-18 19:59:19 +000087// FIXME: Once the JIT is MC-ized, these can go away.
Evan Cheng055b0312009-06-29 07:51:04 +000088// Addressing mode.
Jim Grosbachd86609f2010-10-05 18:14:55 +000089class AddrMode<bits<5> val> {
90 bits<5> Value = val;
Evan Cheng055b0312009-06-29 07:51:04 +000091}
Bill Wendlingda2ae632010-08-31 07:50:46 +000092def AddrModeNone : AddrMode<0>;
93def AddrMode1 : AddrMode<1>;
94def AddrMode2 : AddrMode<2>;
95def AddrMode3 : AddrMode<3>;
96def AddrMode4 : AddrMode<4>;
97def AddrMode5 : AddrMode<5>;
98def AddrMode6 : AddrMode<6>;
99def AddrModeT1_1 : AddrMode<7>;
100def AddrModeT1_2 : AddrMode<8>;
101def AddrModeT1_4 : AddrMode<9>;
102def AddrModeT1_s : AddrMode<10>;
103def AddrModeT2_i12 : AddrMode<11>;
104def AddrModeT2_i8 : AddrMode<12>;
105def AddrModeT2_so : AddrMode<13>;
106def AddrModeT2_pc : AddrMode<14>;
Bob Wilson8b024a52009-07-01 23:16:05 +0000107def AddrModeT2_i8s4 : AddrMode<15>;
Jim Grosbach3e556122010-10-26 22:37:02 +0000108def AddrMode_i12 : AddrMode<16>;
Evan Cheng055b0312009-06-29 07:51:04 +0000109
Evan Cheng055b0312009-06-29 07:51:04 +0000110// Load / store index mode.
111class IndexMode<bits<2> val> {
112 bits<2> Value = val;
113}
114def IndexModeNone : IndexMode<0>;
115def IndexModePre : IndexMode<1>;
116def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000117def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000118
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000119// Instruction execution domain.
Evan Cheng6557bce2011-02-22 19:53:14 +0000120class Domain<bits<3> val> {
121 bits<3> Value = val;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000122}
123def GenericDomain : Domain<0>;
124def VFPDomain : Domain<1>; // Instructions in VFP domain only
125def NeonDomain : Domain<2>; // Instructions in Neon domain only
126def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
Evan Cheng2b943562011-02-23 02:35:33 +0000127def VFPNeonA8Domain : Domain<5>; // Instructions in VFP & Neon under A8
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000128
Evan Cheng055b0312009-06-29 07:51:04 +0000129//===----------------------------------------------------------------------===//
Evan Cheng446c4282009-07-11 06:43:01 +0000130// ARM special operands.
131//
132
Daniel Dunbar8462b302010-08-11 06:36:53 +0000133def CondCodeOperand : AsmOperandClass {
134 let Name = "CondCode";
135 let SuperClasses = [];
136}
137
Jim Grosbachd67641b2010-12-06 18:21:12 +0000138def CCOutOperand : AsmOperandClass {
139 let Name = "CCOut";
140 let SuperClasses = [];
141}
142
Bruno Cardoso Lopes706d9462011-02-07 22:09:15 +0000143def MemBarrierOptOperand : AsmOperandClass {
144 let Name = "MemBarrierOpt";
145 let SuperClasses = [];
Jim Grosbachf922c472011-02-12 01:34:40 +0000146 let ParserMethod = "tryParseMemBarrierOptOperand";
Bruno Cardoso Lopes706d9462011-02-07 22:09:15 +0000147}
148
Bruno Cardoso Lopesa2b6e412011-02-14 13:09:44 +0000149def ProcIFlagsOperand : AsmOperandClass {
150 let Name = "ProcIFlags";
151 let SuperClasses = [];
152 let ParserMethod = "tryParseProcIFlagsOperand";
153}
154
Bruno Cardoso Lopes584bf7b2011-02-18 19:45:59 +0000155def MSRMaskOperand : AsmOperandClass {
156 let Name = "MSRMask";
157 let SuperClasses = [];
158 let ParserMethod = "tryParseMSRMaskOperand";
159}
160
Bruno Cardoso Lopesa2b6e412011-02-14 13:09:44 +0000161// ARM imod and iflag operands, used only by the CPS instruction.
162def imod_op : Operand<i32> {
163 let PrintMethod = "printCPSIMod";
164}
165
166def iflags_op : Operand<i32> {
167 let PrintMethod = "printCPSIFlag";
168 let ParserMatchClass = ProcIFlagsOperand;
169}
170
Evan Cheng446c4282009-07-11 06:43:01 +0000171// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
172// register whose default is 0 (no register).
173def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
174 (ops (i32 14), (i32 zero_reg))> {
175 let PrintMethod = "printPredicateOperand";
Daniel Dunbar8462b302010-08-11 06:36:53 +0000176 let ParserMatchClass = CondCodeOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000177}
178
179// Conditional code result for instructions whose 's' bit is set, e.g. subs.
180def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000181 let EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000182 let PrintMethod = "printSBitModifierOperand";
Jim Grosbachd67641b2010-12-06 18:21:12 +0000183 let ParserMatchClass = CCOutOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000184}
185
186// Same as cc_out except it defaults to setting CPSR.
187def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000188 let EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000189 let PrintMethod = "printSBitModifierOperand";
Jim Grosbachd67641b2010-12-06 18:21:12 +0000190 let ParserMatchClass = CCOutOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000191}
192
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000193// ARM special operands for disassembly only.
194//
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000195def setend_op : Operand<i32> {
196 let PrintMethod = "printSetendOperand";
197}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000198
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000199def msr_mask : Operand<i32> {
200 let PrintMethod = "printMSRMaskOperand";
Bruno Cardoso Lopes584bf7b2011-02-18 19:45:59 +0000201 let ParserMatchClass = MSRMaskOperand;
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000202}
203
Bill Wendling3116dce2011-03-07 23:38:41 +0000204// Shift Right Immediate - A shift right immediate is encoded differently from
205// other shift immediates. The imm6 field is encoded like so:
Bill Wendlinga656b632011-03-01 01:00:59 +0000206//
Bill Wendling3116dce2011-03-07 23:38:41 +0000207// Offset Encoding
208// 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
209// 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
210// 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
211// 64 64 - <imm> is encoded in imm6<5:0>
212def shr_imm8 : Operand<i32> {
213 let EncoderMethod = "getShiftRight8Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000214}
Bill Wendling3116dce2011-03-07 23:38:41 +0000215def shr_imm16 : Operand<i32> {
216 let EncoderMethod = "getShiftRight16Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000217}
Bill Wendling3116dce2011-03-07 23:38:41 +0000218def shr_imm32 : Operand<i32> {
219 let EncoderMethod = "getShiftRight32Imm";
220}
221def shr_imm64 : Operand<i32> {
222 let EncoderMethod = "getShiftRight64Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000223}
224
Evan Cheng446c4282009-07-11 06:43:01 +0000225//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000226// ARM Instruction templates.
227//
228
Owen Anderson16884412011-07-13 23:22:26 +0000229class InstTemplate<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000230 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000231 : Instruction {
232 let Namespace = "ARM";
233
Evan Cheng37f25d92008-08-28 23:39:26 +0000234 AddrMode AM = am;
Owen Anderson16884412011-07-13 23:22:26 +0000235 int Size = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000236 IndexMode IM = im;
237 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000238 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000239 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000240 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000241 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000242 bit canXformTo16Bit = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +0000243
Chris Lattner150d20e2010-10-31 19:22:57 +0000244 // If this is a pseudo instruction, mark it isCodeGenOnly.
245 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson01135592010-03-23 17:23:59 +0000246
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000247 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000248 let TSFlags{4-0} = AM.Value;
Owen Anderson16884412011-07-13 23:22:26 +0000249 let TSFlags{6-5} = IndexModeBits;
250 let TSFlags{12-7} = Form;
251 let TSFlags{13} = isUnaryDataProc;
252 let TSFlags{14} = canXformTo16Bit;
253 let TSFlags{17-15} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000254
Evan Cheng37f25d92008-08-28 23:39:26 +0000255 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000256 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000257}
258
Johnny Chend68e1192009-12-15 17:24:14 +0000259class Encoding {
260 field bits<32> Inst;
261}
262
Owen Anderson16884412011-07-13 23:22:26 +0000263class InstARM<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000264 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000265 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
266 let DecoderNamespace = "ARM";
267}
Johnny Chend68e1192009-12-15 17:24:14 +0000268
269// This Encoding-less class is used by Thumb1 to specify the encoding bits later
270// on by adding flavors to specific instructions.
Owen Anderson16884412011-07-13 23:22:26 +0000271class InstThumb<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000272 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000273 : InstTemplate<am, sz, im, f, d, cstr, itin> {
274 let DecoderNamespace = "Thumb";
275}
Johnny Chend68e1192009-12-15 17:24:14 +0000276
Jim Grosbach99594eb2010-11-18 01:38:26 +0000277class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000278 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000279 GenericDomain, "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000280 let OutOperandList = oops;
281 let InOperandList = iops;
Evan Cheng37f25d92008-08-28 23:39:26 +0000282 let Pattern = pattern;
Jim Grosbacha768c3d2011-03-10 19:06:39 +0000283 let isCodeGenOnly = 1;
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000284 let isPseudo = 1;
Evan Cheng37f25d92008-08-28 23:39:26 +0000285}
286
Jim Grosbach53694262010-11-18 01:15:56 +0000287// PseudoInst that's ARM-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000288class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach99594eb2010-11-18 01:38:26 +0000289 list<dag> pattern>
290 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000291 let Size = sz;
Jim Grosbach53694262010-11-18 01:15:56 +0000292 list<Predicate> Predicates = [IsARM];
293}
294
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000295// PseudoInst that's Thumb-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000296class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000297 list<dag> pattern>
298 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000299 let Size = sz;
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000300 list<Predicate> Predicates = [IsThumb];
301}
Jim Grosbach53694262010-11-18 01:15:56 +0000302
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000303// PseudoInst that's Thumb2-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000304class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000305 list<dag> pattern>
306 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000307 let Size = sz;
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000308 list<Predicate> Predicates = [IsThumb2];
309}
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000310
Owen Anderson16884412011-07-13 23:22:26 +0000311class ARMPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000312 InstrItinClass itin, list<dag> pattern,
313 dag Result>
314 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
315 PseudoInstExpansion<Result>;
316
Owen Anderson16884412011-07-13 23:22:26 +0000317class tPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000318 InstrItinClass itin, list<dag> pattern,
319 dag Result>
320 : tPseudoInst<oops, iops, sz, itin, pattern>,
321 PseudoInstExpansion<Result>;
322
Owen Anderson16884412011-07-13 23:22:26 +0000323class t2PseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000324 InstrItinClass itin, list<dag> pattern,
325 dag Result>
326 : t2PseudoInst<oops, iops, sz, itin, pattern>,
327 PseudoInstExpansion<Result>;
328
Evan Cheng37f25d92008-08-28 23:39:26 +0000329// Almost all ARM instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +0000330class I<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000331 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000332 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000333 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000334 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000335 bits<4> p;
336 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000337 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000338 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000339 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000340 let Pattern = pattern;
341 list<Predicate> Predicates = [IsARM];
342}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000343
Jim Grosbachf6b28622009-12-14 18:31:20 +0000344// A few are not predicable
Owen Anderson16884412011-07-13 23:22:26 +0000345class InoP<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000346 IndexMode im, Format f, InstrItinClass itin,
347 string opc, string asm, string cstr,
348 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000349 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
350 let OutOperandList = oops;
351 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000352 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000353 let Pattern = pattern;
354 let isPredicable = 0;
355 list<Predicate> Predicates = [IsARM];
356}
Evan Cheng37f25d92008-08-28 23:39:26 +0000357
Bill Wendling4822bce2010-08-30 01:47:35 +0000358// Same as I except it can optionally modify CPSR. Note it's modeled as an input
359// operand since by default it's a zero register. It will become an implicit def
360// once it's "flipped".
Owen Anderson16884412011-07-13 23:22:26 +0000361class sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000362 IndexMode im, Format f, InstrItinClass itin,
363 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000364 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000365 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000366 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000367 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000368 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000369 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000370
Evan Cheng37f25d92008-08-28 23:39:26 +0000371 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000372 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000373 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000374 let Pattern = pattern;
375 list<Predicate> Predicates = [IsARM];
376}
377
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000378// Special cases
Owen Anderson16884412011-07-13 23:22:26 +0000379class XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000380 IndexMode im, Format f, InstrItinClass itin,
381 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000382 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000383 let OutOperandList = oops;
384 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000385 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000386 let Pattern = pattern;
387 list<Predicate> Predicates = [IsARM];
388}
389
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000390class AI<dag oops, dag iops, Format f, InstrItinClass itin,
391 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000392 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000393 opc, asm, "", pattern>;
394class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
395 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000396 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000397 opc, asm, "", pattern>;
398class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000399 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000400 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000401 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000402class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000403 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000404 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000405 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000406
407// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000408class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
409 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000410 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000411 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000412 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000413}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000414class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
415 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000416 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000417 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000418 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000419}
Evan Cheng3aac7882008-09-01 08:25:56 +0000420
421// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000422class JTI<dag oops, dag iops, InstrItinClass itin,
423 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000424 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000425 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000426
Jim Grosbach5278eb82009-12-11 01:42:04 +0000427// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000428class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
429 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000430 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000431 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000432 bits<4> Rt;
433 bits<4> Rn;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000434 let Inst{27-23} = 0b00011;
435 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000436 let Inst{20} = 1;
Jim Grosbach86875a22010-10-29 19:58:57 +0000437 let Inst{19-16} = Rn;
438 let Inst{15-12} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000439 let Inst{11-0} = 0b111110011111;
440}
441class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
442 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000443 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000444 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000445 bits<4> Rd;
446 bits<4> Rt;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000447 bits<4> addr;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000448 let Inst{27-23} = 0b00011;
449 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000450 let Inst{20} = 0;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000451 let Inst{19-16} = addr;
Jim Grosbach86875a22010-10-29 19:58:57 +0000452 let Inst{15-12} = Rd;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000453 let Inst{11-4} = 0b11111001;
Jim Grosbach86875a22010-10-29 19:58:57 +0000454 let Inst{3-0} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000455}
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000456class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
457 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, [$Rn]", pattern> {
458 bits<4> Rt;
459 bits<4> Rt2;
460 bits<4> Rn;
461 let Inst{27-23} = 0b00010;
462 let Inst{22} = b;
463 let Inst{21-20} = 0b00;
464 let Inst{19-16} = Rn;
465 let Inst{15-12} = Rt;
466 let Inst{11-4} = 0b00001001;
467 let Inst{3-0} = Rt2;
468}
Jim Grosbach5278eb82009-12-11 01:42:04 +0000469
Evan Cheng0d14fc82008-09-01 01:51:14 +0000470// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000471class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
472 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000473 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000474 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000475 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000476 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000477}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000478class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
479 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000480 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000481 opc, asm, "", pattern> {
482 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000483 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000484}
485class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000486 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000487 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000488 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000489 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000490 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000491}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000492
Evan Cheng93912732008-09-01 01:27:33 +0000493// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000494
Jim Grosbach9558b4c2010-11-19 21:07:51 +0000495// LDR/LDRB/STR/STRB/...
496class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000497 Format f, InstrItinClass itin, string opc, string asm,
498 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000499 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
Jim Grosbach3e556122010-10-26 22:37:02 +0000500 "", pattern> {
501 let Inst{27-25} = op;
502 let Inst{24} = 1; // 24 == P
503 // 23 == U
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000504 let Inst{22} = isByte;
Jim Grosbach3e556122010-10-26 22:37:02 +0000505 let Inst{21} = 0; // 21 == W
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000506 let Inst{20} = isLd;
Jim Grosbach3e556122010-10-26 22:37:02 +0000507}
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000508// Indexed load/stores
509class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000510 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000511 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000512 : I<oops, iops, AddrMode2, 4, im, f, itin,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000513 opc, asm, cstr, pattern> {
Jim Grosbach99f53d12010-11-15 20:47:07 +0000514 bits<4> Rt;
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000515 let Inst{27-26} = 0b01;
516 let Inst{24} = isPre; // P bit
517 let Inst{22} = isByte; // B bit
518 let Inst{21} = isPre; // W bit
519 let Inst{20} = isLd; // L bit
Jim Grosbach99f53d12010-11-15 20:47:07 +0000520 let Inst{15-12} = Rt;
Jim Grosbach3e556122010-10-26 22:37:02 +0000521}
Jim Grosbach953557f42010-11-19 21:35:06 +0000522class AI2stridx<bit isByte, bit isPre, dag oops, dag iops,
523 IndexMode im, Format f, InstrItinClass itin, string opc,
524 string asm, string cstr, list<dag> pattern>
525 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
526 pattern> {
527 // AM2 store w/ two operands: (GPR, am2offset)
528 // {13} 1 == Rm, 0 == imm12
529 // {12} isAdd
530 // {11-0} imm12/Rm
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000531 bits<14> offset;
532 bits<4> Rn;
533 let Inst{25} = offset{13};
534 let Inst{23} = offset{12};
535 let Inst{19-16} = Rn;
536 let Inst{11-0} = offset{11-0};
Jim Grosbach953557f42010-11-19 21:35:06 +0000537}
Bruno Cardoso Lopesae085542011-03-31 23:26:08 +0000538// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
539// but for now use this class for STRT and STRBT.
540class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
541 IndexMode im, Format f, InstrItinClass itin, string opc,
542 string asm, string cstr, list<dag> pattern>
543 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
544 pattern> {
545 // AM2 store w/ two operands: (GPR, am2offset)
546 // {17-14} Rn
547 // {13} 1 == Rm, 0 == imm12
548 // {12} isAdd
549 // {11-0} imm12/Rm
550 bits<18> addr;
551 let Inst{25} = addr{13};
552 let Inst{23} = addr{12};
553 let Inst{19-16} = addr{17-14};
554 let Inst{11-0} = addr{11-0};
555}
Jim Grosbach3e556122010-10-26 22:37:02 +0000556
Evan Cheng0d14fc82008-09-01 01:51:14 +0000557// addrmode3 instructions
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000558class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
559 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000560 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach160f8f02010-11-18 00:46:58 +0000561 opc, asm, "", pattern> {
562 bits<14> addr;
563 bits<4> Rt;
564 let Inst{27-25} = 0b000;
565 let Inst{24} = 1; // P bit
566 let Inst{23} = addr{8}; // U bit
567 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
568 let Inst{21} = 0; // W bit
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000569 let Inst{20} = op20; // L bit
Jim Grosbach160f8f02010-11-18 00:46:58 +0000570 let Inst{19-16} = addr{12-9}; // Rn
571 let Inst{15-12} = Rt; // Rt
572 let Inst{11-8} = addr{7-4}; // imm7_4/zero
573 let Inst{7-4} = op;
574 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
575}
Evan Cheng840917b2008-09-01 07:00:14 +0000576
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000577class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
578 IndexMode im, Format f, InstrItinClass itin, string opc,
579 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000580 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000581 opc, asm, cstr, pattern> {
582 bits<4> Rt;
583 let Inst{27-25} = 0b000;
584 let Inst{24} = isPre; // P bit
585 let Inst{21} = isPre; // W bit
586 let Inst{20} = op20; // L bit
587 let Inst{15-12} = Rt; // Rt
588 let Inst{7-4} = op;
589}
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000590
591// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
592// but for now use this class for LDRSBT, LDRHT, LDSHT.
593class AI3ldstidxT<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
594 IndexMode im, Format f, InstrItinClass itin, string opc,
595 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000596 : I<oops, iops, AddrMode3, 4, im, f, itin,
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000597 opc, asm, cstr, pattern> {
598 // {13} 1 == imm8, 0 == Rm
599 // {12-9} Rn
600 // {8} isAdd
601 // {7-4} imm7_4/zero
602 // {3-0} imm3_0/Rm
603 bits<14> addr;
604 bits<4> Rt;
605 let Inst{27-25} = 0b000;
606 let Inst{24} = isPre; // P bit
607 let Inst{23} = addr{8}; // U bit
608 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
609 let Inst{20} = op20; // L bit
610 let Inst{19-16} = addr{12-9}; // Rn
611 let Inst{15-12} = Rt; // Rt
612 let Inst{11-8} = addr{7-4}; // imm7_4/zero
613 let Inst{7-4} = op;
614 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
615 let AsmMatchConverter = "CvtLdWriteBackRegAddrMode3";
616}
617
Jim Grosbach2dc77682010-11-29 18:37:44 +0000618class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
619 IndexMode im, Format f, InstrItinClass itin, string opc,
620 string asm, string cstr, list<dag> pattern>
621 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
622 pattern> {
623 // AM3 store w/ two operands: (GPR, am3offset)
624 bits<14> offset;
625 bits<4> Rt;
626 bits<4> Rn;
627 let Inst{27-25} = 0b000;
628 let Inst{23} = offset{8};
629 let Inst{22} = offset{9};
630 let Inst{19-16} = Rn;
631 let Inst{15-12} = Rt; // Rt
632 let Inst{11-8} = offset{7-4}; // imm7_4/zero
633 let Inst{7-4} = op;
634 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
635}
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000636
Evan Cheng840917b2008-09-01 07:00:14 +0000637// stores
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000638class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000639 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000640 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000641 opc, asm, "", pattern> {
Jim Grosbach570a9222010-11-11 01:09:40 +0000642 bits<14> addr;
643 bits<4> Rt;
Evan Chengdda0f4c2009-07-08 22:51:32 +0000644 let Inst{27-25} = 0b000;
Jim Grosbach570a9222010-11-11 01:09:40 +0000645 let Inst{24} = 1; // P bit
646 let Inst{23} = addr{8}; // U bit
647 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
648 let Inst{21} = 0; // W bit
649 let Inst{20} = 0; // L bit
650 let Inst{19-16} = addr{12-9}; // Rn
651 let Inst{15-12} = Rt; // Rt
652 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000653 let Inst{7-4} = op;
Jim Grosbach570a9222010-11-11 01:09:40 +0000654 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng840917b2008-09-01 07:00:14 +0000655}
Evan Cheng840917b2008-09-01 07:00:14 +0000656
Evan Cheng840917b2008-09-01 07:00:14 +0000657// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000658class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
659 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000660 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000661 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000662 let Inst{4} = 1;
663 let Inst{5} = 1; // H bit
664 let Inst{6} = 0; // S bit
665 let Inst{7} = 1;
666 let Inst{20} = 0; // L bit
667 let Inst{21} = 1; // W bit
668 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000669 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000670}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000671class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
672 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000673 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
Johnny Chen39a4bb32010-02-18 22:31:18 +0000674 opc, asm, cstr, pattern> {
675 let Inst{4} = 1;
676 let Inst{5} = 1; // H bit
677 let Inst{6} = 1; // S bit
678 let Inst{7} = 1;
679 let Inst{20} = 0; // L bit
680 let Inst{21} = 1; // W bit
681 let Inst{24} = 1; // P bit
682 let Inst{27-25} = 0b000;
683}
Evan Cheng840917b2008-09-01 07:00:14 +0000684
Evan Cheng840917b2008-09-01 07:00:14 +0000685// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000686class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
687 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000688 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000689 opc, asm, cstr,pattern> {
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000690 // {13} 1 == imm8, 0 == Rm
691 // {12-9} Rn
692 // {8} isAdd
693 // {7-4} imm7_4/zero
694 // {3-0} imm3_0/Rm
695 bits<14> addr;
696 bits<4> Rt;
697 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng840917b2008-09-01 07:00:14 +0000698 let Inst{4} = 1;
699 let Inst{5} = 1; // H bit
700 let Inst{6} = 0; // S bit
701 let Inst{7} = 1;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000702 let Inst{11-8} = addr{7-4}; // imm7_4/zero
703 let Inst{15-12} = Rt; // Rt
704 let Inst{19-16} = addr{12-9}; // Rn
Evan Cheng840917b2008-09-01 07:00:14 +0000705 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000706 let Inst{21} = 0; // W bit
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000707 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
708 let Inst{23} = addr{8}; // U bit
Evan Cheng840917b2008-09-01 07:00:14 +0000709 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000710 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000711}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000712class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
713 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000714 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
Johnny Chen39a4bb32010-02-18 22:31:18 +0000715 opc, asm, cstr, pattern> {
716 let Inst{4} = 1;
717 let Inst{5} = 1; // H bit
718 let Inst{6} = 1; // S bit
719 let Inst{7} = 1;
720 let Inst{20} = 0; // L bit
721 let Inst{21} = 0; // W bit
722 let Inst{24} = 0; // P bit
723 let Inst{27-25} = 0b000;
724}
Evan Cheng840917b2008-09-01 07:00:14 +0000725
Evan Cheng0d14fc82008-09-01 01:51:14 +0000726// addrmode4 instructions
Bill Wendling6c470b82010-11-13 09:09:38 +0000727class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
728 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000729 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000730 bits<4> p;
731 bits<16> regs;
732 bits<4> Rn;
733 let Inst{31-28} = p;
734 let Inst{27-25} = 0b100;
735 let Inst{22} = 0; // S bit
736 let Inst{19-16} = Rn;
737 let Inst{15-0} = regs;
738}
Evan Cheng37f25d92008-08-28 23:39:26 +0000739
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000740// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000741class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
742 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000743 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000744 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000745 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000746 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000747 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000748}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000749class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
750 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000751 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000752 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000753 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000754 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000755}
756
757// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000758class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
759 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000760 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000761 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000762 bits<4> Rd;
763 bits<4> Rn;
764 bits<4> Rm;
765 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000766 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000767 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000768 let Inst{19-16} = Rd;
769 let Inst{11-8} = Rm;
770 let Inst{3-0} = Rn;
771}
772// MSW multiple w/ Ra operand
773class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
774 InstrItinClass itin, string opc, string asm, list<dag> pattern>
775 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
776 bits<4> Ra;
777 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000778}
Evan Cheng37f25d92008-08-28 23:39:26 +0000779
Evan Chengeb4f52e2008-11-06 03:35:07 +0000780// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000781class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000782 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000783 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000784 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000785 bits<4> Rn;
786 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000787 let Inst{4} = 0;
788 let Inst{7} = 1;
789 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000790 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000791 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000792 let Inst{11-8} = Rm;
793 let Inst{3-0} = Rn;
794}
795class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
796 InstrItinClass itin, string opc, string asm, list<dag> pattern>
797 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
798 bits<4> Rd;
799 let Inst{19-16} = Rd;
800}
801
802// AMulxyI with Ra operand
803class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
804 InstrItinClass itin, string opc, string asm, list<dag> pattern>
805 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
806 bits<4> Ra;
807 let Inst{15-12} = Ra;
808}
809// SMLAL*
810class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
811 InstrItinClass itin, string opc, string asm, list<dag> pattern>
812 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
813 bits<4> RdLo;
814 bits<4> RdHi;
815 let Inst{19-16} = RdHi;
816 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000817}
818
Evan Cheng97f48c32008-11-06 22:15:19 +0000819// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000820class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
821 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000822 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000823 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000824 // All AExtI instructions have Rd and Rm register operands.
825 bits<4> Rd;
826 bits<4> Rm;
827 let Inst{15-12} = Rd;
828 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000829 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000830 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000831 let Inst{27-20} = opcod;
832}
833
Evan Cheng8b59db32008-11-07 01:41:35 +0000834// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000835class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
836 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000837 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000838 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000839 bits<4> Rd;
840 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000841 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000842 let Inst{19-16} = 0b1111;
843 let Inst{15-12} = Rd;
844 let Inst{11-8} = 0b1111;
845 let Inst{7-4} = opc7_4;
846 let Inst{3-0} = Rm;
847}
848
849// PKH instructions
Jim Grosbachf6c05252011-07-21 17:23:04 +0000850def PKHLSLAsmOperand : AsmOperandClass {
851 let Name = "PKHLSLImm";
852 let ParserMethod = "parsePKHLSLImm";
853}
Jim Grosbachdde038a2011-07-20 21:40:26 +0000854def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
855 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000856 let ParserMatchClass = PKHLSLAsmOperand;
857}
858def PKHASRAsmOperand : AsmOperandClass {
859 let Name = "PKHASRImm";
860 let ParserMethod = "parsePKHASRImm";
Jim Grosbachdde038a2011-07-20 21:40:26 +0000861}
862def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
863 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000864 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbachdde038a2011-07-20 21:40:26 +0000865}
Jim Grosbach1769a3d2011-07-20 20:49:03 +0000866
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000867class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
868 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000869 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000870 opc, asm, "", pattern> {
871 bits<4> Rd;
872 bits<4> Rn;
873 bits<4> Rm;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000874 bits<5> sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000875 let Inst{27-20} = opcod;
876 let Inst{19-16} = Rn;
877 let Inst{15-12} = Rd;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000878 let Inst{11-7} = sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000879 let Inst{6} = tb;
880 let Inst{5-4} = 0b01;
881 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000882}
883
Evan Cheng37f25d92008-08-28 23:39:26 +0000884//===----------------------------------------------------------------------===//
885
886// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
887class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
888 list<Predicate> Predicates = [IsARM];
889}
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +0000890class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
891 list<Predicate> Predicates = [IsARM, HasV5T];
892}
Evan Cheng37f25d92008-08-28 23:39:26 +0000893class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
894 list<Predicate> Predicates = [IsARM, HasV5TE];
895}
896class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
897 list<Predicate> Predicates = [IsARM, HasV6];
898}
Evan Cheng13096642008-08-29 06:41:12 +0000899
900//===----------------------------------------------------------------------===//
Evan Cheng13096642008-08-29 06:41:12 +0000901// Thumb Instruction Format Definitions.
902//
903
Owen Anderson16884412011-07-13 23:22:26 +0000904class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000905 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000906 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000907 let OutOperandList = oops;
908 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000909 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000910 let Pattern = pattern;
911 list<Predicate> Predicates = [IsThumb];
912}
913
Bill Wendling43f7b2d2010-12-01 02:42:55 +0000914// TI - Thumb instruction.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000915class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000916 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000917
Evan Cheng35d6c412009-08-04 23:47:55 +0000918// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000919class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
920 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000921 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson01135592010-03-23 17:23:59 +0000922 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000923
Johnny Chend68e1192009-12-15 17:24:14 +0000924// tBL, tBX 32-bit instructions
925class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000926 dag oops, dag iops, InstrItinClass itin, string asm,
927 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000928 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson01135592010-03-23 17:23:59 +0000929 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000930 let Inst{31-27} = opcod1;
931 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000932 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000933}
Evan Cheng13096642008-08-29 06:41:12 +0000934
935// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000936class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
937 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000938 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000939
Evan Cheng09c39fc2009-06-23 19:38:13 +0000940// Thumb1 only
Owen Anderson16884412011-07-13 23:22:26 +0000941class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000942 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000943 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000944 let OutOperandList = oops;
945 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000946 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000947 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000948 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng09c39fc2009-06-23 19:38:13 +0000949}
950
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000951class T1I<dag oops, dag iops, InstrItinClass itin,
952 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000953 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000954class T1Ix2<dag oops, dag iops, InstrItinClass itin,
955 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000956 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000957
958// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000959class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000960 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000961 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000962 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000963
964// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson16884412011-07-13 23:22:26 +0000965class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000966 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000967 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000968 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +0000969 let OutOperandList = !con(oops, (outs s_cc_out:$s));
970 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000971 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000972 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000973 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000974}
975
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000976class T1sI<dag oops, dag iops, InstrItinClass itin,
977 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000978 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000979
980// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000981class T1sIt<dag oops, dag iops, InstrItinClass itin,
982 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000983 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling3f8c1102010-11-30 23:54:45 +0000984 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000985
986// Thumb1 instruction that can be predicated.
Owen Anderson16884412011-07-13 23:22:26 +0000987class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000988 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000989 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000990 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000991 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000992 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000993 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000994 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000995 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000996}
997
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000998class T1pI<dag oops, dag iops, InstrItinClass itin,
999 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001000 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001001
1002// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001003class T1pIt<dag oops, dag iops, InstrItinClass itin,
1004 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001005 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling0b424dc2010-12-01 01:32:02 +00001006 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001007
Bob Wilson01135592010-03-23 17:23:59 +00001008class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001009 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001010 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001011
Johnny Chenbbc71b22009-12-16 02:32:54 +00001012class Encoding16 : Encoding {
1013 let Inst{31-16} = 0x0000;
1014}
1015
Johnny Chend68e1192009-12-15 17:24:14 +00001016// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001017class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001018 let Inst{15-10} = opcode;
1019}
1020
1021// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001022class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001023 let Inst{15-14} = 0b00;
1024 let Inst{13-9} = opcode;
1025}
1026
1027// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001028class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001029 let Inst{15-10} = 0b010000;
1030 let Inst{9-6} = opcode;
1031}
1032
1033// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001034class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001035 let Inst{15-10} = 0b010001;
Bill Wendling6bc105a2010-11-17 00:45:23 +00001036 let Inst{9-6} = opcode;
Johnny Chend68e1192009-12-15 17:24:14 +00001037}
1038
1039// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001040class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001041 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001042 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001043}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001044class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001045
Eric Christopher33281b22011-05-27 03:50:53 +00001046class T1BranchCond<bits<4> opcode> : Encoding16 {
1047 let Inst{15-12} = opcode;
1048}
1049
Bill Wendling1fd374e2010-11-30 22:57:21 +00001050// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling3f8c1102010-11-30 23:54:45 +00001051// following bits are used for "opA" (see A6.2.4):
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001052//
Bill Wendling1fd374e2010-11-30 22:57:21 +00001053// 0b0110 => Immediate, 4 bytes
1054// 0b1000 => Immediate, 2 bytes
1055// 0b0111 => Immediate, 1 byte
Bill Wendling40062fb2010-12-01 01:38:08 +00001056class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1057 InstrItinClass itin, string opc, string asm,
1058 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001059 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001060 T1LoadStore<0b0101, opcode> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001061 bits<3> Rt;
1062 bits<8> addr;
1063 let Inst{8-6} = addr{5-3}; // Rm
1064 let Inst{5-3} = addr{2-0}; // Rn
1065 let Inst{2-0} = Rt;
1066}
Bill Wendling40062fb2010-12-01 01:38:08 +00001067class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1068 InstrItinClass itin, string opc, string asm,
1069 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001070 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001071 T1LoadStore<opA, {opB,?,?}> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001072 bits<3> Rt;
1073 bits<8> addr;
1074 let Inst{10-6} = addr{7-3}; // imm5
1075 let Inst{5-3} = addr{2-0}; // Rn
1076 let Inst{2-0} = Rt;
1077}
1078
Johnny Chend68e1192009-12-15 17:24:14 +00001079// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001080class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001081 let Inst{15-12} = 0b1011;
1082 let Inst{11-5} = opcode;
1083}
1084
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001085// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001086class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001087 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001088 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001089 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001090 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001091 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001092 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001093 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001094 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001095 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001096}
1097
Bill Wendlingda2ae632010-08-31 07:50:46 +00001098// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1099// input operand since by default it's a zero register. It will become an
1100// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001101//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001102// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1103// more consistent.
Owen Anderson16884412011-07-13 23:22:26 +00001104class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001105 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001106 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001107 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersonbdf71442010-12-07 20:50:15 +00001108 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1109 let Inst{20} = s;
1110
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001111 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001112 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001113 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001114 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001115 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001116 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001117}
1118
1119// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001120class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001121 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001122 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001123 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001124 let OutOperandList = oops;
1125 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001126 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001127 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001128 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001129 let DecoderNamespace = "Thumb2";
Evan Chengf49810c2009-06-23 17:48:47 +00001130}
1131
Owen Anderson16884412011-07-13 23:22:26 +00001132class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +00001133 InstrItinClass itin,
1134 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001135 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1136 let OutOperandList = oops;
1137 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001138 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001139 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +00001140 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonf1a00902011-07-19 21:06:00 +00001141 let DecoderNamespace = "Thumb";
Jim Grosbachd1228742009-12-01 18:10:36 +00001142}
1143
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001144class T2I<dag oops, dag iops, InstrItinClass itin,
1145 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001146 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001147class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1148 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001149 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001150class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1151 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001152 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001153class T2Iso<dag oops, dag iops, InstrItinClass itin,
1154 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001155 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001156class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1157 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001158 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001159class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001160 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001161 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
Johnny Chend68e1192009-12-15 17:24:14 +00001162 pattern> {
Owen Anderson9d63d902010-12-01 19:18:46 +00001163 bits<4> Rt;
1164 bits<4> Rt2;
1165 bits<13> addr;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001166 let Inst{31-25} = 0b1110100;
1167 let Inst{24} = P;
1168 let Inst{23} = addr{8};
1169 let Inst{22} = 1;
1170 let Inst{21} = W;
1171 let Inst{20} = isLoad;
1172 let Inst{19-16} = addr{12-9};
Owen Anderson9d63d902010-12-01 19:18:46 +00001173 let Inst{15-12} = Rt{3-0};
1174 let Inst{11-8} = Rt2{3-0};
Owen Anderson9d63d902010-12-01 19:18:46 +00001175 let Inst{7-0} = addr{7-0};
Johnny Chend68e1192009-12-15 17:24:14 +00001176}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001177
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001178class T2sI<dag oops, dag iops, InstrItinClass itin,
1179 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001180 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001181
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001182class T2XI<dag oops, dag iops, InstrItinClass itin,
1183 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001184 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001185class T2JTI<dag oops, dag iops, InstrItinClass itin,
1186 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001187 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001188
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001189// Move to/from coprocessor instructions
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001190class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
Jim Grosbach9bb098a2011-07-13 21:14:23 +00001191 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001192 let Inst{31-28} = opc;
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001193}
1194
Bob Wilson815baeb2010-03-13 01:08:20 +00001195// Two-address instructions
1196class T2XIt<dag oops, dag iops, InstrItinClass itin,
1197 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001198 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001199
Evan Chenge88d5ce2009-07-02 07:28:31 +00001200// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001201class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1202 dag oops, dag iops,
1203 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001204 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001205 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001206 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001207 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001208 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001209 let Pattern = pattern;
1210 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001211 let DecoderNamespace = "Thumb2";
Johnny Chend68e1192009-12-15 17:24:14 +00001212 let Inst{31-27} = 0b11111;
1213 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001214 let Inst{24} = signed;
1215 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001216 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001217 let Inst{20} = load;
1218 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001219 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001220 let Inst{10} = pre; // The P bit.
1221 let Inst{8} = 1; // The W bit.
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001222
Owen Anderson6af50f72010-11-30 00:14:31 +00001223 bits<9> addr;
1224 let Inst{7-0} = addr{7-0};
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001225 let Inst{9} = addr{8}; // Sign bit
1226
Owen Anderson6af50f72010-11-30 00:14:31 +00001227 bits<4> Rt;
1228 bits<4> Rn;
1229 let Inst{15-12} = Rt{3-0};
1230 let Inst{19-16} = Rn{3-0};
Evan Chenge88d5ce2009-07-02 07:28:31 +00001231}
1232
David Goodwinc9d138f2009-07-27 19:59:26 +00001233// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1234class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001235 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwinc9d138f2009-07-27 19:59:26 +00001236}
1237
1238// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1239class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001240 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwinc9d138f2009-07-27 19:59:26 +00001241}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001242
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +00001243// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1244class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1245 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1246}
1247
Evan Cheng9cb9e672009-06-27 02:26:13 +00001248// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1249class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001250 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001251}
1252
Evan Cheng13096642008-08-29 06:41:12 +00001253//===----------------------------------------------------------------------===//
1254
Evan Cheng96581d32008-11-11 02:11:05 +00001255//===----------------------------------------------------------------------===//
1256// ARM VFP Instruction templates.
1257//
1258
David Goodwin3ca524e2009-07-10 17:03:29 +00001259// Almost all VFP instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001260class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001261 IndexMode im, Format f, InstrItinClass itin,
1262 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001263 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001264 bits<4> p;
1265 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001266 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001267 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001268 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001269 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001270 let PostEncoderMethod = "VFPThumb2PostEncoder";
David Goodwin3ca524e2009-07-10 17:03:29 +00001271 list<Predicate> Predicates = [HasVFP2];
1272}
1273
1274// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001275class VFPXI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001276 IndexMode im, Format f, InstrItinClass itin,
1277 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001278 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001279 bits<4> p;
1280 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001281 let OutOperandList = oops;
1282 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001283 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001284 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001285 let PostEncoderMethod = "VFPThumb2PostEncoder";
David Goodwin3ca524e2009-07-10 17:03:29 +00001286 list<Predicate> Predicates = [HasVFP2];
1287}
1288
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001289class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1290 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001291 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendlingcf590262010-12-01 21:54:50 +00001292 opc, asm, "", pattern> {
1293 let PostEncoderMethod = "VFPThumb2PostEncoder";
1294}
David Goodwin3ca524e2009-07-10 17:03:29 +00001295
Evan Chengcd8e66a2008-11-11 21:48:44 +00001296// ARM VFP addrmode5 loads and stores
1297class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001298 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001299 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001300 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001301 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001302 // Instruction operands.
1303 bits<5> Dd;
1304 bits<13> addr;
1305
1306 // Encode instruction operands.
1307 let Inst{23} = addr{8}; // U (add = (U == '1'))
1308 let Inst{22} = Dd{4};
1309 let Inst{19-16} = addr{12-9}; // Rn
1310 let Inst{15-12} = Dd{3-0};
1311 let Inst{7-0} = addr{7-0}; // imm8
1312
Evan Cheng96581d32008-11-11 02:11:05 +00001313 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001314 let Inst{27-24} = opcod1;
1315 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001316 let Inst{11-9} = 0b101;
1317 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001318
Evan Cheng5eda2822011-02-16 00:35:02 +00001319 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001320 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001321}
1322
Evan Chengcd8e66a2008-11-11 21:48:44 +00001323class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001324 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001325 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001326 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001327 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001328 // Instruction operands.
1329 bits<5> Sd;
1330 bits<13> addr;
1331
1332 // Encode instruction operands.
1333 let Inst{23} = addr{8}; // U (add = (U == '1'))
1334 let Inst{22} = Sd{0};
1335 let Inst{19-16} = addr{12-9}; // Rn
1336 let Inst{15-12} = Sd{4-1};
1337 let Inst{7-0} = addr{7-0}; // imm8
1338
Evan Cheng96581d32008-11-11 02:11:05 +00001339 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001340 let Inst{27-24} = opcod1;
1341 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001342 let Inst{11-9} = 0b101;
1343 let Inst{8} = 0; // Single precision
Evan Cheng5eda2822011-02-16 00:35:02 +00001344
1345 // Loads & stores operate on both NEON and VFP pipelines.
1346 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001347}
1348
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001349// VFP Load / store multiple pseudo instructions.
1350class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1351 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001352 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001353 cstr, itin> {
1354 let OutOperandList = oops;
1355 let InOperandList = !con(iops, (ins pred:$p));
1356 let Pattern = pattern;
1357 list<Predicate> Predicates = [HasVFP2];
1358}
1359
Evan Chengcd8e66a2008-11-11 21:48:44 +00001360// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001361class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001362 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001363 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001364 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001365 // Instruction operands.
1366 bits<4> Rn;
1367 bits<13> regs;
1368
1369 // Encode instruction operands.
1370 let Inst{19-16} = Rn;
1371 let Inst{22} = regs{12};
1372 let Inst{15-12} = regs{11-8};
1373 let Inst{7-0} = regs{7-0};
1374
Evan Chengcd8e66a2008-11-11 21:48:44 +00001375 // TODO: Mark the instructions with the appropriate subtarget info.
1376 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001377 let Inst{11-9} = 0b101;
1378 let Inst{8} = 1; // Double precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001379}
1380
Jim Grosbach72db1822010-09-08 00:25:50 +00001381class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001382 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001383 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001384 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001385 // Instruction operands.
1386 bits<4> Rn;
1387 bits<13> regs;
1388
1389 // Encode instruction operands.
1390 let Inst{19-16} = Rn;
1391 let Inst{22} = regs{8};
1392 let Inst{15-12} = regs{12-9};
1393 let Inst{7-0} = regs{7-0};
1394
Evan Chengcd8e66a2008-11-11 21:48:44 +00001395 // TODO: Mark the instructions with the appropriate subtarget info.
1396 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001397 let Inst{11-9} = 0b101;
1398 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001399}
1400
Evan Cheng96581d32008-11-11 02:11:05 +00001401// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001402class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1403 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1404 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001405 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001406 // Instruction operands.
1407 bits<5> Dd;
1408 bits<5> Dm;
1409
1410 // Encode instruction operands.
1411 let Inst{3-0} = Dm{3-0};
1412 let Inst{5} = Dm{4};
1413 let Inst{15-12} = Dd{3-0};
1414 let Inst{22} = Dd{4};
1415
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001416 let Inst{27-23} = opcod1;
1417 let Inst{21-20} = opcod2;
1418 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001419 let Inst{11-9} = 0b101;
1420 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001421 let Inst{7-6} = opcod4;
1422 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001423}
1424
1425// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001426class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001427 dag iops, InstrItinClass itin, string opc, string asm,
1428 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001429 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001430 // Instruction operands.
1431 bits<5> Dd;
1432 bits<5> Dn;
1433 bits<5> Dm;
1434
1435 // Encode instruction operands.
1436 let Inst{3-0} = Dm{3-0};
1437 let Inst{5} = Dm{4};
1438 let Inst{19-16} = Dn{3-0};
1439 let Inst{7} = Dn{4};
1440 let Inst{15-12} = Dd{3-0};
1441 let Inst{22} = Dd{4};
1442
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001443 let Inst{27-23} = opcod1;
1444 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001445 let Inst{11-9} = 0b101;
1446 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001447 let Inst{6} = op6;
1448 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001449}
1450
1451// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001452class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1453 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1454 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001455 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001456 // Instruction operands.
1457 bits<5> Sd;
1458 bits<5> Sm;
1459
1460 // Encode instruction operands.
1461 let Inst{3-0} = Sm{4-1};
1462 let Inst{5} = Sm{0};
1463 let Inst{15-12} = Sd{4-1};
1464 let Inst{22} = Sd{0};
1465
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001466 let Inst{27-23} = opcod1;
1467 let Inst{21-20} = opcod2;
1468 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001469 let Inst{11-9} = 0b101;
1470 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001471 let Inst{7-6} = opcod4;
1472 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001473}
1474
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001475// Single precision unary, if no NEON. Same as ASuI except not available if
1476// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001477class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1478 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1479 string asm, list<dag> pattern>
1480 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1481 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001482 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1483}
1484
Evan Cheng96581d32008-11-11 02:11:05 +00001485// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001486class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1487 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001488 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001489 // Instruction operands.
1490 bits<5> Sd;
1491 bits<5> Sn;
1492 bits<5> Sm;
1493
1494 // Encode instruction operands.
1495 let Inst{3-0} = Sm{4-1};
1496 let Inst{5} = Sm{0};
1497 let Inst{19-16} = Sn{4-1};
1498 let Inst{7} = Sn{0};
1499 let Inst{15-12} = Sd{4-1};
1500 let Inst{22} = Sd{0};
1501
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001502 let Inst{27-23} = opcod1;
1503 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001504 let Inst{11-9} = 0b101;
1505 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001506 let Inst{6} = op6;
1507 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001508}
1509
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001510// Single precision binary, if no NEON. Same as ASbI except not available if
1511// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001512class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001513 dag iops, InstrItinClass itin, string opc, string asm,
1514 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001515 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001516 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling69661192010-11-01 06:00:39 +00001517
1518 // Instruction operands.
1519 bits<5> Sd;
1520 bits<5> Sn;
1521 bits<5> Sm;
1522
1523 // Encode instruction operands.
1524 let Inst{3-0} = Sm{4-1};
1525 let Inst{5} = Sm{0};
1526 let Inst{19-16} = Sn{4-1};
1527 let Inst{7} = Sn{0};
1528 let Inst{15-12} = Sd{4-1};
1529 let Inst{22} = Sd{0};
David Goodwin42a83f22009-08-04 17:53:06 +00001530}
1531
Evan Cheng80a11982008-11-12 06:41:41 +00001532// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001533class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1534 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1535 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001536 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001537 let Inst{27-23} = opcod1;
1538 let Inst{21-20} = opcod2;
1539 let Inst{19-16} = opcod3;
1540 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001541 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001542 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001543}
1544
Johnny Chen811663f2010-02-11 18:47:03 +00001545// VFP conversion between floating-point and fixed-point
1546class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001547 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1548 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001549 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1550 // size (fixed-point number): sx == 0 ? 16 : 32
1551 let Inst{7} = op5; // sx
1552}
1553
David Goodwin338268c2009-08-10 22:17:39 +00001554// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001555class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001556 dag oops, dag iops, InstrItinClass itin,
1557 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001558 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1559 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001560 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1561}
1562
Evan Cheng80a11982008-11-12 06:41:41 +00001563class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001564 InstrItinClass itin,
1565 string opc, string asm, list<dag> pattern>
1566 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001567 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001568 let Inst{11-8} = opcod2;
1569 let Inst{4} = 1;
1570}
1571
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001572class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1573 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1574 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001575
Bob Wilson01135592010-03-23 17:23:59 +00001576class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001577 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1578 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001579
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001580class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1581 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1582 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001583
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001584class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1585 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1586 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001587
Evan Cheng96581d32008-11-11 02:11:05 +00001588//===----------------------------------------------------------------------===//
1589
Bob Wilson5bafff32009-06-22 23:27:02 +00001590//===----------------------------------------------------------------------===//
1591// ARM NEON Instruction templates.
1592//
Evan Cheng13096642008-08-29 06:41:12 +00001593
Johnny Chencaa608e2010-03-20 00:17:00 +00001594class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1595 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1596 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001597 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001598 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001599 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001600 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001601 let Pattern = pattern;
1602 list<Predicate> Predicates = [HasNEON];
1603}
1604
1605// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001606class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1607 InstrItinClass itin, string opc, string asm, string cstr,
1608 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001609 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001610 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001611 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001612 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001613 let Pattern = pattern;
1614 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001615}
1616
Bob Wilsonb07c1712009-10-07 21:53:04 +00001617class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1618 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001619 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001620 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1621 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001622 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001623 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001624 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001625 let Inst{11-8} = op11_8;
1626 let Inst{7-4} = op7_4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001627
Chris Lattner2ac19022010-11-15 05:19:05 +00001628 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001629
Owen Andersond9aa7d32010-11-02 00:05:05 +00001630 bits<5> Vd;
Owen Andersonf431eda2010-11-02 23:47:29 +00001631 bits<6> Rn;
1632 bits<4> Rm;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001633
Owen Andersond9aa7d32010-11-02 00:05:05 +00001634 let Inst{22} = Vd{4};
1635 let Inst{15-12} = Vd{3-0};
Owen Andersonf431eda2010-11-02 23:47:29 +00001636 let Inst{19-16} = Rn{3-0};
1637 let Inst{3-0} = Rm{3-0};
Bob Wilson205a5ca2009-07-08 18:11:30 +00001638}
1639
Owen Andersond138d702010-11-02 20:47:39 +00001640class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1641 dag oops, dag iops, InstrItinClass itin,
1642 string opc, string dt, string asm, string cstr, list<dag> pattern>
1643 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1644 dt, asm, cstr, pattern> {
1645 bits<3> lane;
1646}
1647
Bob Wilson709d5922010-08-25 23:27:42 +00001648class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson16884412011-07-13 23:22:26 +00001649 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson709d5922010-08-25 23:27:42 +00001650 itin> {
1651 let OutOperandList = oops;
1652 let InOperandList = !con(iops, (ins pred:$p));
1653 list<Predicate> Predicates = [HasNEON];
1654}
1655
Jim Grosbach7cd27292010-10-06 20:36:55 +00001656class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1657 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001658 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonbd916c52010-09-13 23:55:10 +00001659 itin> {
1660 let OutOperandList = oops;
1661 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001662 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001663 list<Predicate> Predicates = [HasNEON];
1664}
1665
Johnny Chen785516a2010-03-23 16:43:47 +00001666class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001667 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001668 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1669 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001670 let Inst{31-25} = 0b1111001;
Chris Lattner2ac19022010-11-15 05:19:05 +00001671 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Evan Chengf81bf152009-11-23 21:57:23 +00001672}
1673
Johnny Chen927b88f2010-03-23 20:40:44 +00001674class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001675 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001676 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001677 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001678 let Inst{31-25} = 0b1111001;
Owen Andersonac00e962010-12-10 22:32:08 +00001679 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Bob Wilson5bafff32009-06-22 23:27:02 +00001680}
1681
1682// NEON "one register and a modified immediate" format.
1683class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1684 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001685 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001686 string opc, string dt, string asm, string cstr,
1687 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001688 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001689 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001690 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001691 let Inst{11-8} = op11_8;
1692 let Inst{7} = op7;
1693 let Inst{6} = op6;
1694 let Inst{5} = op5;
1695 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001696
Owen Andersona88ea032010-10-26 17:40:54 +00001697 // Instruction operands.
1698 bits<5> Vd;
1699 bits<13> SIMM;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001700
Owen Andersona88ea032010-10-26 17:40:54 +00001701 let Inst{15-12} = Vd{3-0};
1702 let Inst{22} = Vd{4};
1703 let Inst{24} = SIMM{7};
1704 let Inst{18-16} = SIMM{6-4};
1705 let Inst{3-0} = SIMM{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001706}
1707
1708// NEON 2 vector register format.
1709class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1710 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001711 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001712 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001713 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001714 let Inst{24-23} = op24_23;
1715 let Inst{21-20} = op21_20;
1716 let Inst{19-18} = op19_18;
1717 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001718 let Inst{11-7} = op11_7;
1719 let Inst{6} = op6;
1720 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001721
Owen Anderson162875a2010-10-25 18:43:52 +00001722 // Instruction operands.
1723 bits<5> Vd;
1724 bits<5> Vm;
1725
1726 let Inst{15-12} = Vd{3-0};
1727 let Inst{22} = Vd{4};
1728 let Inst{3-0} = Vm{3-0};
1729 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001730}
1731
1732// Same as N2V except it doesn't have a datatype suffix.
1733class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001734 bits<5> op11_7, bit op6, bit op4,
1735 dag oops, dag iops, InstrItinClass itin,
1736 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001737 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001738 let Inst{24-23} = op24_23;
1739 let Inst{21-20} = op21_20;
1740 let Inst{19-18} = op19_18;
1741 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001742 let Inst{11-7} = op11_7;
1743 let Inst{6} = op6;
1744 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001745
Owen Anderson162875a2010-10-25 18:43:52 +00001746 // Instruction operands.
1747 bits<5> Vd;
1748 bits<5> Vm;
1749
1750 let Inst{15-12} = Vd{3-0};
1751 let Inst{22} = Vd{4};
1752 let Inst{3-0} = Vm{3-0};
1753 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001754}
1755
1756// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001757class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001758 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001759 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001760 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001761 let Inst{24} = op24;
1762 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001763 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001764 let Inst{7} = op7;
1765 let Inst{6} = op6;
1766 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001767
Owen Anderson3557d002010-10-26 20:56:57 +00001768 // Instruction operands.
1769 bits<5> Vd;
1770 bits<5> Vm;
1771 bits<6> SIMM;
1772
1773 let Inst{15-12} = Vd{3-0};
1774 let Inst{22} = Vd{4};
1775 let Inst{3-0} = Vm{3-0};
1776 let Inst{5} = Vm{4};
1777 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001778}
1779
Bob Wilson10bc69c2010-03-27 03:56:52 +00001780// NEON 3 vector register format.
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001781
Jim Grosbach6635b042011-05-19 17:34:53 +00001782class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1783 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1784 string opc, string dt, string asm, string cstr,
1785 list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001786 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001787 let Inst{24} = op24;
1788 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001789 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001790 let Inst{11-8} = op11_8;
1791 let Inst{6} = op6;
1792 let Inst{4} = op4;
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001793}
1794
1795class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1796 dag oops, dag iops, Format f, InstrItinClass itin,
1797 string opc, string dt, string asm, string cstr, list<dag> pattern>
1798 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1799 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001800
Owen Andersond451f882010-10-21 20:21:49 +00001801 // Instruction operands.
1802 bits<5> Vd;
1803 bits<5> Vn;
1804 bits<5> Vm;
1805
1806 let Inst{15-12} = Vd{3-0};
1807 let Inst{22} = Vd{4};
1808 let Inst{19-16} = Vn{3-0};
1809 let Inst{7} = Vn{4};
1810 let Inst{3-0} = Vm{3-0};
1811 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001812}
1813
Jim Grosbach6635b042011-05-19 17:34:53 +00001814class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1815 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1816 string opc, string dt, string asm, string cstr,
1817 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001818 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1819 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1820
1821 // Instruction operands.
1822 bits<5> Vd;
1823 bits<5> Vn;
1824 bits<5> Vm;
1825 bit lane;
1826
1827 let Inst{15-12} = Vd{3-0};
1828 let Inst{22} = Vd{4};
1829 let Inst{19-16} = Vn{3-0};
1830 let Inst{7} = Vn{4};
1831 let Inst{3-0} = Vm{3-0};
1832 let Inst{5} = lane;
1833}
1834
Jim Grosbach6635b042011-05-19 17:34:53 +00001835class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1836 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1837 string opc, string dt, string asm, string cstr,
1838 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001839 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1840 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1841
1842 // Instruction operands.
1843 bits<5> Vd;
1844 bits<5> Vn;
1845 bits<5> Vm;
1846 bits<2> lane;
1847
1848 let Inst{15-12} = Vd{3-0};
1849 let Inst{22} = Vd{4};
1850 let Inst{19-16} = Vn{3-0};
1851 let Inst{7} = Vn{4};
1852 let Inst{2-0} = Vm{2-0};
1853 let Inst{5} = lane{1};
1854 let Inst{3} = lane{0};
1855}
1856
Johnny Chen841e8282010-03-23 21:35:03 +00001857// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001858class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1859 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001860 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001861 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001862 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001863 let Inst{24} = op24;
1864 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001865 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001866 let Inst{11-8} = op11_8;
1867 let Inst{6} = op6;
1868 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001869
Owen Anderson8c71eff2010-10-25 18:28:30 +00001870 // Instruction operands.
1871 bits<5> Vd;
1872 bits<5> Vn;
1873 bits<5> Vm;
1874
1875 let Inst{15-12} = Vd{3-0};
1876 let Inst{22} = Vd{4};
1877 let Inst{19-16} = Vn{3-0};
1878 let Inst{7} = Vn{4};
1879 let Inst{3-0} = Vm{3-0};
1880 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001881}
1882
1883// NEON VMOVs between scalar and core registers.
1884class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001885 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001886 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001887 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001888 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001889 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001890 let Inst{11-8} = opcod2;
1891 let Inst{6-5} = opcod3;
1892 let Inst{4} = 1;
Johnny Chena9611542011-04-06 18:27:46 +00001893 // A8.6.303, A8.6.328, A8.6.329
1894 let Inst{3-0} = 0b0000;
Evan Chengf81bf152009-11-23 21:57:23 +00001895
1896 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001897 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001898 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001899 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001900 list<Predicate> Predicates = [HasNEON];
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001901
Chris Lattner2ac19022010-11-15 05:19:05 +00001902 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001903
Owen Andersond2fbdb72010-10-27 21:28:09 +00001904 bits<5> V;
1905 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001906 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001907 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001908
Owen Andersonf587a9352010-10-27 19:25:54 +00001909 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001910 let Inst{7} = V{4};
1911 let Inst{19-16} = V{3-0};
1912 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001913}
1914class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001915 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001916 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001917 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001918 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001919class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001920 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001921 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001922 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001923 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001924class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001925 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001926 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001927 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001928 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001929
Johnny Chene4614f72010-03-25 17:01:27 +00001930// Vector Duplicate Lane (from scalar to all elements)
1931class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1932 InstrItinClass itin, string opc, string dt, string asm,
1933 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001934 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001935 let Inst{24-23} = 0b11;
1936 let Inst{21-20} = 0b11;
1937 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001938 let Inst{11-7} = 0b11000;
1939 let Inst{6} = op6;
1940 let Inst{4} = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001941
Owen Andersonf587a9352010-10-27 19:25:54 +00001942 bits<5> Vd;
1943 bits<5> Vm;
1944 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001945
Owen Andersonf587a9352010-10-27 19:25:54 +00001946 let Inst{22} = Vd{4};
1947 let Inst{15-12} = Vd{3-0};
1948 let Inst{5} = Vm{4};
1949 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001950}
1951
David Goodwin42a83f22009-08-04 17:53:06 +00001952// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1953// for single-precision FP.
1954class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1955 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1956}