blob: 278bd5bda79c810cf12c1795929e54b5c859fb5e [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>;
Owen Anderson152d4a42011-07-21 23:38:37 +000028def DPSoRegRegFrm : 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>;
Owen Anderson152d4a42011-07-21 23:38:37 +000071def DPSoRegImmFrm : Format<42>;
Johnny Chencaa608e2010-03-20 00:17:00 +000072
Evan Cheng34a0fa32009-07-08 01:46:35 +000073// Misc flags.
74
Bill Wendling43f7b2d2010-12-01 02:42:55 +000075// The instruction has an Rn register operand.
Evan Cheng34a0fa32009-07-08 01:46:35 +000076// UnaryDP - Indicates this is a unary data processing instruction, i.e.
77// it doesn't have a Rn operand.
78class UnaryDP { bit isUnaryDataProc = 1; }
79
80// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
81// a 16-bit Thumb instruction if certain conditions are met.
82class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng37f25d92008-08-28 23:39:26 +000083
Evan Cheng37f25d92008-08-28 23:39:26 +000084//===----------------------------------------------------------------------===//
Bob Wilson50622ce2010-03-18 23:57:57 +000085// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Cheng055b0312009-06-29 07:51:04 +000086//
87
Jim Grosbachff12a8b2011-01-18 19:59:19 +000088// FIXME: Once the JIT is MC-ized, these can go away.
Evan Cheng055b0312009-06-29 07:51:04 +000089// Addressing mode.
Jim Grosbachd86609f2010-10-05 18:14:55 +000090class AddrMode<bits<5> val> {
91 bits<5> Value = val;
Evan Cheng055b0312009-06-29 07:51:04 +000092}
Bill Wendlingda2ae632010-08-31 07:50:46 +000093def AddrModeNone : AddrMode<0>;
94def AddrMode1 : AddrMode<1>;
95def AddrMode2 : AddrMode<2>;
96def AddrMode3 : AddrMode<3>;
97def AddrMode4 : AddrMode<4>;
98def AddrMode5 : AddrMode<5>;
99def AddrMode6 : AddrMode<6>;
100def AddrModeT1_1 : AddrMode<7>;
101def AddrModeT1_2 : AddrMode<8>;
102def AddrModeT1_4 : AddrMode<9>;
103def AddrModeT1_s : AddrMode<10>;
104def AddrModeT2_i12 : AddrMode<11>;
105def AddrModeT2_i8 : AddrMode<12>;
106def AddrModeT2_so : AddrMode<13>;
107def AddrModeT2_pc : AddrMode<14>;
Bob Wilson8b024a52009-07-01 23:16:05 +0000108def AddrModeT2_i8s4 : AddrMode<15>;
Jim Grosbach3e556122010-10-26 22:37:02 +0000109def AddrMode_i12 : AddrMode<16>;
Evan Cheng055b0312009-06-29 07:51:04 +0000110
Evan Cheng055b0312009-06-29 07:51:04 +0000111// Load / store index mode.
112class IndexMode<bits<2> val> {
113 bits<2> Value = val;
114}
115def IndexModeNone : IndexMode<0>;
116def IndexModePre : IndexMode<1>;
117def IndexModePost : IndexMode<2>;
Bob Wilsonbffb5b32010-03-13 07:34:35 +0000118def IndexModeUpd : IndexMode<3>;
Evan Cheng055b0312009-06-29 07:51:04 +0000119
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000120// Instruction execution domain.
Evan Cheng6557bce2011-02-22 19:53:14 +0000121class Domain<bits<3> val> {
122 bits<3> Value = val;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000123}
124def GenericDomain : Domain<0>;
125def VFPDomain : Domain<1>; // Instructions in VFP domain only
126def NeonDomain : Domain<2>; // Instructions in Neon domain only
127def VFPNeonDomain : Domain<3>; // Instructions in both VFP & Neon domains
Evan Cheng2b943562011-02-23 02:35:33 +0000128def VFPNeonA8Domain : Domain<5>; // Instructions in VFP & Neon under A8
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000129
Evan Cheng055b0312009-06-29 07:51:04 +0000130//===----------------------------------------------------------------------===//
Evan Cheng446c4282009-07-11 06:43:01 +0000131// ARM special operands.
132//
133
Daniel Dunbar8462b302010-08-11 06:36:53 +0000134def CondCodeOperand : AsmOperandClass {
135 let Name = "CondCode";
136 let SuperClasses = [];
137}
138
Jim Grosbachd67641b2010-12-06 18:21:12 +0000139def CCOutOperand : AsmOperandClass {
140 let Name = "CCOut";
141 let SuperClasses = [];
142}
143
Bruno Cardoso Lopes706d9462011-02-07 22:09:15 +0000144def MemBarrierOptOperand : AsmOperandClass {
145 let Name = "MemBarrierOpt";
146 let SuperClasses = [];
Jim Grosbachf922c472011-02-12 01:34:40 +0000147 let ParserMethod = "tryParseMemBarrierOptOperand";
Bruno Cardoso Lopes706d9462011-02-07 22:09:15 +0000148}
149
Bruno Cardoso Lopesa2b6e412011-02-14 13:09:44 +0000150def ProcIFlagsOperand : AsmOperandClass {
151 let Name = "ProcIFlags";
152 let SuperClasses = [];
153 let ParserMethod = "tryParseProcIFlagsOperand";
154}
155
Bruno Cardoso Lopes584bf7b2011-02-18 19:45:59 +0000156def MSRMaskOperand : AsmOperandClass {
157 let Name = "MSRMask";
158 let SuperClasses = [];
159 let ParserMethod = "tryParseMSRMaskOperand";
160}
161
Bruno Cardoso Lopesa2b6e412011-02-14 13:09:44 +0000162// ARM imod and iflag operands, used only by the CPS instruction.
163def imod_op : Operand<i32> {
164 let PrintMethod = "printCPSIMod";
165}
166
167def iflags_op : Operand<i32> {
168 let PrintMethod = "printCPSIFlag";
169 let ParserMatchClass = ProcIFlagsOperand;
170}
171
Evan Cheng446c4282009-07-11 06:43:01 +0000172// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
173// register whose default is 0 (no register).
174def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
175 (ops (i32 14), (i32 zero_reg))> {
176 let PrintMethod = "printPredicateOperand";
Daniel Dunbar8462b302010-08-11 06:36:53 +0000177 let ParserMatchClass = CondCodeOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000178}
179
180// Conditional code result for instructions whose 's' bit is set, e.g. subs.
181def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000182 let EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000183 let PrintMethod = "printSBitModifierOperand";
Jim Grosbachd67641b2010-12-06 18:21:12 +0000184 let ParserMatchClass = CCOutOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000185}
186
187// Same as cc_out except it defaults to setting CPSR.
188def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000189 let EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000190 let PrintMethod = "printSBitModifierOperand";
Jim Grosbachd67641b2010-12-06 18:21:12 +0000191 let ParserMatchClass = CCOutOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000192}
193
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000194// ARM special operands for disassembly only.
195//
Jim Grosbachc27d4f92011-07-22 17:44:50 +0000196def SetEndAsmOperand : AsmOperandClass {
197 let Name = "SetEndImm";
198 let ParserMethod = "parseSetEndImm";
199}
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000200def setend_op : Operand<i32> {
201 let PrintMethod = "printSetendOperand";
Jim Grosbachc27d4f92011-07-22 17:44:50 +0000202 let ParserMatchClass = SetEndAsmOperand;
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000203}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000204
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000205def msr_mask : Operand<i32> {
206 let PrintMethod = "printMSRMaskOperand";
Bruno Cardoso Lopes584bf7b2011-02-18 19:45:59 +0000207 let ParserMatchClass = MSRMaskOperand;
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000208}
209
Bill Wendling3116dce2011-03-07 23:38:41 +0000210// Shift Right Immediate - A shift right immediate is encoded differently from
211// other shift immediates. The imm6 field is encoded like so:
Bill Wendlinga656b632011-03-01 01:00:59 +0000212//
Bill Wendling3116dce2011-03-07 23:38:41 +0000213// Offset Encoding
214// 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
215// 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
216// 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
217// 64 64 - <imm> is encoded in imm6<5:0>
218def shr_imm8 : Operand<i32> {
219 let EncoderMethod = "getShiftRight8Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000220}
Bill Wendling3116dce2011-03-07 23:38:41 +0000221def shr_imm16 : Operand<i32> {
222 let EncoderMethod = "getShiftRight16Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000223}
Bill Wendling3116dce2011-03-07 23:38:41 +0000224def shr_imm32 : Operand<i32> {
225 let EncoderMethod = "getShiftRight32Imm";
226}
227def shr_imm64 : Operand<i32> {
228 let EncoderMethod = "getShiftRight64Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000229}
230
Evan Cheng446c4282009-07-11 06:43:01 +0000231//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000232// ARM Instruction templates.
233//
234
Owen Anderson16884412011-07-13 23:22:26 +0000235class InstTemplate<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000236 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000237 : Instruction {
238 let Namespace = "ARM";
239
Evan Cheng37f25d92008-08-28 23:39:26 +0000240 AddrMode AM = am;
Owen Anderson16884412011-07-13 23:22:26 +0000241 int Size = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000242 IndexMode IM = im;
243 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000244 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000245 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000246 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000247 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000248 bit canXformTo16Bit = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +0000249
Chris Lattner150d20e2010-10-31 19:22:57 +0000250 // If this is a pseudo instruction, mark it isCodeGenOnly.
251 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson01135592010-03-23 17:23:59 +0000252
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000253 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000254 let TSFlags{4-0} = AM.Value;
Owen Anderson16884412011-07-13 23:22:26 +0000255 let TSFlags{6-5} = IndexModeBits;
256 let TSFlags{12-7} = Form;
257 let TSFlags{13} = isUnaryDataProc;
258 let TSFlags{14} = canXformTo16Bit;
259 let TSFlags{17-15} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000260
Evan Cheng37f25d92008-08-28 23:39:26 +0000261 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000262 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000263}
264
Johnny Chend68e1192009-12-15 17:24:14 +0000265class Encoding {
266 field bits<32> Inst;
267}
268
Owen Anderson16884412011-07-13 23:22:26 +0000269class InstARM<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000270 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000271 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
272 let DecoderNamespace = "ARM";
273}
Johnny Chend68e1192009-12-15 17:24:14 +0000274
275// This Encoding-less class is used by Thumb1 to specify the encoding bits later
276// on by adding flavors to specific instructions.
Owen Anderson16884412011-07-13 23:22:26 +0000277class InstThumb<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000278 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000279 : InstTemplate<am, sz, im, f, d, cstr, itin> {
280 let DecoderNamespace = "Thumb";
281}
Johnny Chend68e1192009-12-15 17:24:14 +0000282
Jim Grosbach99594eb2010-11-18 01:38:26 +0000283class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000284 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000285 GenericDomain, "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000286 let OutOperandList = oops;
287 let InOperandList = iops;
Evan Cheng37f25d92008-08-28 23:39:26 +0000288 let Pattern = pattern;
Jim Grosbacha768c3d2011-03-10 19:06:39 +0000289 let isCodeGenOnly = 1;
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000290 let isPseudo = 1;
Evan Cheng37f25d92008-08-28 23:39:26 +0000291}
292
Jim Grosbach53694262010-11-18 01:15:56 +0000293// PseudoInst that's ARM-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000294class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach99594eb2010-11-18 01:38:26 +0000295 list<dag> pattern>
296 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000297 let Size = sz;
Jim Grosbach53694262010-11-18 01:15:56 +0000298 list<Predicate> Predicates = [IsARM];
299}
300
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000301// PseudoInst that's Thumb-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000302class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000303 list<dag> pattern>
304 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000305 let Size = sz;
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000306 list<Predicate> Predicates = [IsThumb];
307}
Jim Grosbach53694262010-11-18 01:15:56 +0000308
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000309// PseudoInst that's Thumb2-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000310class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000311 list<dag> pattern>
312 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000313 let Size = sz;
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000314 list<Predicate> Predicates = [IsThumb2];
315}
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000316
Owen Anderson16884412011-07-13 23:22:26 +0000317class ARMPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000318 InstrItinClass itin, list<dag> pattern,
319 dag Result>
320 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
321 PseudoInstExpansion<Result>;
322
Owen Anderson16884412011-07-13 23:22:26 +0000323class tPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000324 InstrItinClass itin, list<dag> pattern,
325 dag Result>
326 : tPseudoInst<oops, iops, sz, itin, pattern>,
327 PseudoInstExpansion<Result>;
328
Owen Anderson16884412011-07-13 23:22:26 +0000329class t2PseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000330 InstrItinClass itin, list<dag> pattern,
331 dag Result>
332 : t2PseudoInst<oops, iops, sz, itin, pattern>,
333 PseudoInstExpansion<Result>;
334
Evan Cheng37f25d92008-08-28 23:39:26 +0000335// Almost all ARM instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +0000336class I<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000337 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000338 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000339 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000340 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000341 bits<4> p;
342 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000343 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000344 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000345 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000346 let Pattern = pattern;
347 list<Predicate> Predicates = [IsARM];
348}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000349
Jim Grosbachf6b28622009-12-14 18:31:20 +0000350// A few are not predicable
Owen Anderson16884412011-07-13 23:22:26 +0000351class InoP<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000352 IndexMode im, Format f, InstrItinClass itin,
353 string opc, string asm, string cstr,
354 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000355 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
356 let OutOperandList = oops;
357 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000358 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000359 let Pattern = pattern;
360 let isPredicable = 0;
361 list<Predicate> Predicates = [IsARM];
362}
Evan Cheng37f25d92008-08-28 23:39:26 +0000363
Bill Wendling4822bce2010-08-30 01:47:35 +0000364// Same as I except it can optionally modify CPSR. Note it's modeled as an input
365// operand since by default it's a zero register. It will become an implicit def
366// once it's "flipped".
Owen Anderson16884412011-07-13 23:22:26 +0000367class sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000368 IndexMode im, Format f, InstrItinClass itin,
369 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000370 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000371 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000372 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000373 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000374 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000375 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000376
Evan Cheng37f25d92008-08-28 23:39:26 +0000377 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000378 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000379 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000380 let Pattern = pattern;
381 list<Predicate> Predicates = [IsARM];
382}
383
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000384// Special cases
Owen Anderson16884412011-07-13 23:22:26 +0000385class XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000386 IndexMode im, Format f, InstrItinClass itin,
387 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000388 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000389 let OutOperandList = oops;
390 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000391 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000392 let Pattern = pattern;
393 list<Predicate> Predicates = [IsARM];
394}
395
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000396class AI<dag oops, dag iops, Format f, InstrItinClass itin,
397 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000398 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000399 opc, asm, "", pattern>;
400class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
401 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000402 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000403 opc, asm, "", pattern>;
404class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000405 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000406 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000407 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000408class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000409 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000410 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000411 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000412
413// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000414class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
415 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000416 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000417 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000418 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000419}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000420class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
421 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000422 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000423 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000424 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000425}
Evan Cheng3aac7882008-09-01 08:25:56 +0000426
427// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000428class JTI<dag oops, dag iops, InstrItinClass itin,
429 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000430 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000431 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000432
Jim Grosbach5278eb82009-12-11 01:42:04 +0000433// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000434class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
435 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000436 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000437 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000438 bits<4> Rt;
439 bits<4> Rn;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000440 let Inst{27-23} = 0b00011;
441 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000442 let Inst{20} = 1;
Jim Grosbach86875a22010-10-29 19:58:57 +0000443 let Inst{19-16} = Rn;
444 let Inst{15-12} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000445 let Inst{11-0} = 0b111110011111;
446}
447class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
448 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000449 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000450 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000451 bits<4> Rd;
452 bits<4> Rt;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000453 bits<4> addr;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000454 let Inst{27-23} = 0b00011;
455 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000456 let Inst{20} = 0;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000457 let Inst{19-16} = addr;
Jim Grosbach86875a22010-10-29 19:58:57 +0000458 let Inst{15-12} = Rd;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000459 let Inst{11-4} = 0b11111001;
Jim Grosbach86875a22010-10-29 19:58:57 +0000460 let Inst{3-0} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000461}
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000462class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
463 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, [$Rn]", pattern> {
464 bits<4> Rt;
465 bits<4> Rt2;
466 bits<4> Rn;
467 let Inst{27-23} = 0b00010;
468 let Inst{22} = b;
469 let Inst{21-20} = 0b00;
470 let Inst{19-16} = Rn;
471 let Inst{15-12} = Rt;
472 let Inst{11-4} = 0b00001001;
473 let Inst{3-0} = Rt2;
474}
Jim Grosbach5278eb82009-12-11 01:42:04 +0000475
Evan Cheng0d14fc82008-09-01 01:51:14 +0000476// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000477class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
478 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000479 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000480 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000481 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000482 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000483}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000484class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
485 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000486 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000487 opc, asm, "", pattern> {
488 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000489 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000490}
491class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000492 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000493 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000494 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000495 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000496 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000497}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000498
Evan Cheng93912732008-09-01 01:27:33 +0000499// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000500
Jim Grosbach9558b4c2010-11-19 21:07:51 +0000501// LDR/LDRB/STR/STRB/...
502class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000503 Format f, InstrItinClass itin, string opc, string asm,
504 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000505 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
Jim Grosbach3e556122010-10-26 22:37:02 +0000506 "", pattern> {
507 let Inst{27-25} = op;
508 let Inst{24} = 1; // 24 == P
509 // 23 == U
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000510 let Inst{22} = isByte;
Jim Grosbach3e556122010-10-26 22:37:02 +0000511 let Inst{21} = 0; // 21 == W
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000512 let Inst{20} = isLd;
Jim Grosbach3e556122010-10-26 22:37:02 +0000513}
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000514// Indexed load/stores
515class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000516 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000517 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000518 : I<oops, iops, AddrMode2, 4, im, f, itin,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000519 opc, asm, cstr, pattern> {
Jim Grosbach99f53d12010-11-15 20:47:07 +0000520 bits<4> Rt;
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000521 let Inst{27-26} = 0b01;
522 let Inst{24} = isPre; // P bit
523 let Inst{22} = isByte; // B bit
524 let Inst{21} = isPre; // W bit
525 let Inst{20} = isLd; // L bit
Jim Grosbach99f53d12010-11-15 20:47:07 +0000526 let Inst{15-12} = Rt;
Jim Grosbach3e556122010-10-26 22:37:02 +0000527}
Jim Grosbach953557f42010-11-19 21:35:06 +0000528class AI2stridx<bit isByte, bit isPre, dag oops, dag iops,
529 IndexMode im, Format f, InstrItinClass itin, string opc,
530 string asm, string cstr, list<dag> pattern>
531 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
532 pattern> {
533 // AM2 store w/ two operands: (GPR, am2offset)
534 // {13} 1 == Rm, 0 == imm12
535 // {12} isAdd
536 // {11-0} imm12/Rm
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000537 bits<14> offset;
538 bits<4> Rn;
539 let Inst{25} = offset{13};
540 let Inst{23} = offset{12};
541 let Inst{19-16} = Rn;
542 let Inst{11-0} = offset{11-0};
Jim Grosbach953557f42010-11-19 21:35:06 +0000543}
Bruno Cardoso Lopesae085542011-03-31 23:26:08 +0000544// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
545// but for now use this class for STRT and STRBT.
546class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
547 IndexMode im, Format f, InstrItinClass itin, string opc,
548 string asm, string cstr, list<dag> pattern>
549 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
550 pattern> {
551 // AM2 store w/ two operands: (GPR, am2offset)
552 // {17-14} Rn
553 // {13} 1 == Rm, 0 == imm12
554 // {12} isAdd
555 // {11-0} imm12/Rm
556 bits<18> addr;
557 let Inst{25} = addr{13};
558 let Inst{23} = addr{12};
559 let Inst{19-16} = addr{17-14};
560 let Inst{11-0} = addr{11-0};
561}
Jim Grosbach3e556122010-10-26 22:37:02 +0000562
Evan Cheng0d14fc82008-09-01 01:51:14 +0000563// addrmode3 instructions
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000564class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
565 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000566 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach160f8f02010-11-18 00:46:58 +0000567 opc, asm, "", pattern> {
568 bits<14> addr;
569 bits<4> Rt;
570 let Inst{27-25} = 0b000;
571 let Inst{24} = 1; // P bit
572 let Inst{23} = addr{8}; // U bit
573 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
574 let Inst{21} = 0; // W bit
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000575 let Inst{20} = op20; // L bit
Jim Grosbach160f8f02010-11-18 00:46:58 +0000576 let Inst{19-16} = addr{12-9}; // Rn
577 let Inst{15-12} = Rt; // Rt
578 let Inst{11-8} = addr{7-4}; // imm7_4/zero
579 let Inst{7-4} = op;
580 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
581}
Evan Cheng840917b2008-09-01 07:00:14 +0000582
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000583class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
584 IndexMode im, Format f, InstrItinClass itin, string opc,
585 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000586 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000587 opc, asm, cstr, pattern> {
588 bits<4> Rt;
589 let Inst{27-25} = 0b000;
590 let Inst{24} = isPre; // P bit
591 let Inst{21} = isPre; // W bit
592 let Inst{20} = op20; // L bit
593 let Inst{15-12} = Rt; // Rt
594 let Inst{7-4} = op;
595}
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000596
597// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
598// but for now use this class for LDRSBT, LDRHT, LDSHT.
599class AI3ldstidxT<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
600 IndexMode im, Format f, InstrItinClass itin, string opc,
601 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000602 : I<oops, iops, AddrMode3, 4, im, f, itin,
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000603 opc, asm, cstr, pattern> {
604 // {13} 1 == imm8, 0 == Rm
605 // {12-9} Rn
606 // {8} isAdd
607 // {7-4} imm7_4/zero
608 // {3-0} imm3_0/Rm
609 bits<14> addr;
610 bits<4> Rt;
611 let Inst{27-25} = 0b000;
612 let Inst{24} = isPre; // P bit
613 let Inst{23} = addr{8}; // U bit
614 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
615 let Inst{20} = op20; // L bit
616 let Inst{19-16} = addr{12-9}; // Rn
617 let Inst{15-12} = Rt; // Rt
618 let Inst{11-8} = addr{7-4}; // imm7_4/zero
619 let Inst{7-4} = op;
620 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
621 let AsmMatchConverter = "CvtLdWriteBackRegAddrMode3";
622}
623
Jim Grosbach2dc77682010-11-29 18:37:44 +0000624class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
625 IndexMode im, Format f, InstrItinClass itin, string opc,
626 string asm, string cstr, list<dag> pattern>
627 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
628 pattern> {
629 // AM3 store w/ two operands: (GPR, am3offset)
630 bits<14> offset;
631 bits<4> Rt;
632 bits<4> Rn;
633 let Inst{27-25} = 0b000;
634 let Inst{23} = offset{8};
635 let Inst{22} = offset{9};
636 let Inst{19-16} = Rn;
637 let Inst{15-12} = Rt; // Rt
638 let Inst{11-8} = offset{7-4}; // imm7_4/zero
639 let Inst{7-4} = op;
640 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
641}
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000642
Evan Cheng840917b2008-09-01 07:00:14 +0000643// stores
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000644class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000645 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000646 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000647 opc, asm, "", pattern> {
Jim Grosbach570a9222010-11-11 01:09:40 +0000648 bits<14> addr;
649 bits<4> Rt;
Evan Chengdda0f4c2009-07-08 22:51:32 +0000650 let Inst{27-25} = 0b000;
Jim Grosbach570a9222010-11-11 01:09:40 +0000651 let Inst{24} = 1; // P bit
652 let Inst{23} = addr{8}; // U bit
653 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
654 let Inst{21} = 0; // W bit
655 let Inst{20} = 0; // L bit
656 let Inst{19-16} = addr{12-9}; // Rn
657 let Inst{15-12} = Rt; // Rt
658 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000659 let Inst{7-4} = op;
Jim Grosbach570a9222010-11-11 01:09:40 +0000660 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng840917b2008-09-01 07:00:14 +0000661}
Evan Cheng840917b2008-09-01 07:00:14 +0000662
Evan Cheng840917b2008-09-01 07:00:14 +0000663// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000664class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
665 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000666 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000667 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000668 let Inst{4} = 1;
669 let Inst{5} = 1; // H bit
670 let Inst{6} = 0; // S bit
671 let Inst{7} = 1;
672 let Inst{20} = 0; // L bit
673 let Inst{21} = 1; // W bit
674 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000675 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000676}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000677class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
678 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000679 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
Johnny Chen39a4bb32010-02-18 22:31:18 +0000680 opc, asm, cstr, pattern> {
681 let Inst{4} = 1;
682 let Inst{5} = 1; // H bit
683 let Inst{6} = 1; // S bit
684 let Inst{7} = 1;
685 let Inst{20} = 0; // L bit
686 let Inst{21} = 1; // W bit
687 let Inst{24} = 1; // P bit
688 let Inst{27-25} = 0b000;
689}
Evan Cheng840917b2008-09-01 07:00:14 +0000690
Evan Cheng840917b2008-09-01 07:00:14 +0000691// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000692class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
693 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000694 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000695 opc, asm, cstr,pattern> {
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000696 // {13} 1 == imm8, 0 == Rm
697 // {12-9} Rn
698 // {8} isAdd
699 // {7-4} imm7_4/zero
700 // {3-0} imm3_0/Rm
701 bits<14> addr;
702 bits<4> Rt;
703 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng840917b2008-09-01 07:00:14 +0000704 let Inst{4} = 1;
705 let Inst{5} = 1; // H bit
706 let Inst{6} = 0; // S bit
707 let Inst{7} = 1;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000708 let Inst{11-8} = addr{7-4}; // imm7_4/zero
709 let Inst{15-12} = Rt; // Rt
710 let Inst{19-16} = addr{12-9}; // Rn
Evan Cheng840917b2008-09-01 07:00:14 +0000711 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000712 let Inst{21} = 0; // W bit
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000713 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
714 let Inst{23} = addr{8}; // U bit
Evan Cheng840917b2008-09-01 07:00:14 +0000715 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000716 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000717}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000718class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
719 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000720 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
Johnny Chen39a4bb32010-02-18 22:31:18 +0000721 opc, asm, cstr, pattern> {
722 let Inst{4} = 1;
723 let Inst{5} = 1; // H bit
724 let Inst{6} = 1; // S bit
725 let Inst{7} = 1;
726 let Inst{20} = 0; // L bit
727 let Inst{21} = 0; // W bit
728 let Inst{24} = 0; // P bit
729 let Inst{27-25} = 0b000;
730}
Evan Cheng840917b2008-09-01 07:00:14 +0000731
Evan Cheng0d14fc82008-09-01 01:51:14 +0000732// addrmode4 instructions
Bill Wendling6c470b82010-11-13 09:09:38 +0000733class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
734 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000735 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000736 bits<4> p;
737 bits<16> regs;
738 bits<4> Rn;
739 let Inst{31-28} = p;
740 let Inst{27-25} = 0b100;
741 let Inst{22} = 0; // S bit
742 let Inst{19-16} = Rn;
743 let Inst{15-0} = regs;
744}
Evan Cheng37f25d92008-08-28 23:39:26 +0000745
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000746// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000747class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
748 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000749 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000750 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000751 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000752 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000753 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000754}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000755class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
756 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000757 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000758 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000759 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000760 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000761}
762
763// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000764class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
765 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000766 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000767 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000768 bits<4> Rd;
769 bits<4> Rn;
770 bits<4> Rm;
771 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000772 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000773 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000774 let Inst{19-16} = Rd;
775 let Inst{11-8} = Rm;
776 let Inst{3-0} = Rn;
777}
778// MSW multiple w/ Ra operand
779class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
780 InstrItinClass itin, string opc, string asm, list<dag> pattern>
781 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
782 bits<4> Ra;
783 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000784}
Evan Cheng37f25d92008-08-28 23:39:26 +0000785
Evan Chengeb4f52e2008-11-06 03:35:07 +0000786// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000787class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000788 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000789 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000790 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000791 bits<4> Rn;
792 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000793 let Inst{4} = 0;
794 let Inst{7} = 1;
795 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000796 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000797 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000798 let Inst{11-8} = Rm;
799 let Inst{3-0} = Rn;
800}
801class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
802 InstrItinClass itin, string opc, string asm, list<dag> pattern>
803 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
804 bits<4> Rd;
805 let Inst{19-16} = Rd;
806}
807
808// AMulxyI with Ra operand
809class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
810 InstrItinClass itin, string opc, string asm, list<dag> pattern>
811 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
812 bits<4> Ra;
813 let Inst{15-12} = Ra;
814}
815// SMLAL*
816class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
817 InstrItinClass itin, string opc, string asm, list<dag> pattern>
818 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
819 bits<4> RdLo;
820 bits<4> RdHi;
821 let Inst{19-16} = RdHi;
822 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000823}
824
Evan Cheng97f48c32008-11-06 22:15:19 +0000825// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000826class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
827 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000828 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000829 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000830 // All AExtI instructions have Rd and Rm register operands.
831 bits<4> Rd;
832 bits<4> Rm;
833 let Inst{15-12} = Rd;
834 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000835 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000836 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000837 let Inst{27-20} = opcod;
838}
839
Evan Cheng8b59db32008-11-07 01:41:35 +0000840// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000841class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
842 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000843 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000844 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000845 bits<4> Rd;
846 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000847 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000848 let Inst{19-16} = 0b1111;
849 let Inst{15-12} = Rd;
850 let Inst{11-8} = 0b1111;
851 let Inst{7-4} = opc7_4;
852 let Inst{3-0} = Rm;
853}
854
855// PKH instructions
Jim Grosbachf6c05252011-07-21 17:23:04 +0000856def PKHLSLAsmOperand : AsmOperandClass {
857 let Name = "PKHLSLImm";
858 let ParserMethod = "parsePKHLSLImm";
859}
Jim Grosbachdde038a2011-07-20 21:40:26 +0000860def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
861 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000862 let ParserMatchClass = PKHLSLAsmOperand;
863}
864def PKHASRAsmOperand : AsmOperandClass {
865 let Name = "PKHASRImm";
866 let ParserMethod = "parsePKHASRImm";
Jim Grosbachdde038a2011-07-20 21:40:26 +0000867}
868def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
869 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000870 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbachdde038a2011-07-20 21:40:26 +0000871}
Jim Grosbach1769a3d2011-07-20 20:49:03 +0000872
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000873class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
874 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000875 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000876 opc, asm, "", pattern> {
877 bits<4> Rd;
878 bits<4> Rn;
879 bits<4> Rm;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000880 bits<5> sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000881 let Inst{27-20} = opcod;
882 let Inst{19-16} = Rn;
883 let Inst{15-12} = Rd;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000884 let Inst{11-7} = sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000885 let Inst{6} = tb;
886 let Inst{5-4} = 0b01;
887 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000888}
889
Evan Cheng37f25d92008-08-28 23:39:26 +0000890//===----------------------------------------------------------------------===//
891
892// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
893class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
894 list<Predicate> Predicates = [IsARM];
895}
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +0000896class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
897 list<Predicate> Predicates = [IsARM, HasV5T];
898}
Evan Cheng37f25d92008-08-28 23:39:26 +0000899class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
900 list<Predicate> Predicates = [IsARM, HasV5TE];
901}
902class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
903 list<Predicate> Predicates = [IsARM, HasV6];
904}
Evan Cheng13096642008-08-29 06:41:12 +0000905
906//===----------------------------------------------------------------------===//
Evan Cheng13096642008-08-29 06:41:12 +0000907// Thumb Instruction Format Definitions.
908//
909
Owen Anderson16884412011-07-13 23:22:26 +0000910class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000911 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000912 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000913 let OutOperandList = oops;
914 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000915 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000916 let Pattern = pattern;
917 list<Predicate> Predicates = [IsThumb];
918}
919
Bill Wendling43f7b2d2010-12-01 02:42:55 +0000920// TI - Thumb instruction.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000921class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000922 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000923
Evan Cheng35d6c412009-08-04 23:47:55 +0000924// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000925class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
926 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000927 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson01135592010-03-23 17:23:59 +0000928 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000929
Johnny Chend68e1192009-12-15 17:24:14 +0000930// tBL, tBX 32-bit instructions
931class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000932 dag oops, dag iops, InstrItinClass itin, string asm,
933 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000934 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson01135592010-03-23 17:23:59 +0000935 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000936 let Inst{31-27} = opcod1;
937 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000938 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000939}
Evan Cheng13096642008-08-29 06:41:12 +0000940
941// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000942class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
943 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000944 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000945
Evan Cheng09c39fc2009-06-23 19:38:13 +0000946// Thumb1 only
Owen Anderson16884412011-07-13 23:22:26 +0000947class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000948 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000949 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000950 let OutOperandList = oops;
951 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000952 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000953 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000954 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng09c39fc2009-06-23 19:38:13 +0000955}
956
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000957class T1I<dag oops, dag iops, InstrItinClass itin,
958 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000959 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000960class T1Ix2<dag oops, dag iops, InstrItinClass itin,
961 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000962 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000963
964// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000965class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000966 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000967 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000968 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000969
970// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson16884412011-07-13 23:22:26 +0000971class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000972 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000973 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000974 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +0000975 let OutOperandList = !con(oops, (outs s_cc_out:$s));
976 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000977 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000978 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000979 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000980}
981
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000982class T1sI<dag oops, dag iops, InstrItinClass itin,
983 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000984 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000985
986// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000987class T1sIt<dag oops, dag iops, InstrItinClass itin,
988 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000989 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling3f8c1102010-11-30 23:54:45 +0000990 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000991
992// Thumb1 instruction that can be predicated.
Owen Anderson16884412011-07-13 23:22:26 +0000993class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000994 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000995 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000996 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000997 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000998 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000999 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +00001000 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +00001001 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +00001002}
1003
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001004class T1pI<dag oops, dag iops, InstrItinClass itin,
1005 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001006 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001007
1008// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001009class T1pIt<dag oops, dag iops, InstrItinClass itin,
1010 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001011 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling0b424dc2010-12-01 01:32:02 +00001012 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +00001013
Bob Wilson01135592010-03-23 17:23:59 +00001014class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001015 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001016 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +00001017
Johnny Chenbbc71b22009-12-16 02:32:54 +00001018class Encoding16 : Encoding {
1019 let Inst{31-16} = 0x0000;
1020}
1021
Johnny Chend68e1192009-12-15 17:24:14 +00001022// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001023class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001024 let Inst{15-10} = opcode;
1025}
1026
1027// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001028class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001029 let Inst{15-14} = 0b00;
1030 let Inst{13-9} = opcode;
1031}
1032
1033// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001034class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001035 let Inst{15-10} = 0b010000;
1036 let Inst{9-6} = opcode;
1037}
1038
1039// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001040class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001041 let Inst{15-10} = 0b010001;
Bill Wendling6bc105a2010-11-17 00:45:23 +00001042 let Inst{9-6} = opcode;
Johnny Chend68e1192009-12-15 17:24:14 +00001043}
1044
1045// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001046class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001047 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001048 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001049}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001050class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001051
Eric Christopher33281b22011-05-27 03:50:53 +00001052class T1BranchCond<bits<4> opcode> : Encoding16 {
1053 let Inst{15-12} = opcode;
1054}
1055
Bill Wendling1fd374e2010-11-30 22:57:21 +00001056// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling3f8c1102010-11-30 23:54:45 +00001057// following bits are used for "opA" (see A6.2.4):
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001058//
Bill Wendling1fd374e2010-11-30 22:57:21 +00001059// 0b0110 => Immediate, 4 bytes
1060// 0b1000 => Immediate, 2 bytes
1061// 0b0111 => Immediate, 1 byte
Bill Wendling40062fb2010-12-01 01:38:08 +00001062class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1063 InstrItinClass itin, string opc, string asm,
1064 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001065 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001066 T1LoadStore<0b0101, opcode> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001067 bits<3> Rt;
1068 bits<8> addr;
1069 let Inst{8-6} = addr{5-3}; // Rm
1070 let Inst{5-3} = addr{2-0}; // Rn
1071 let Inst{2-0} = Rt;
1072}
Bill Wendling40062fb2010-12-01 01:38:08 +00001073class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1074 InstrItinClass itin, string opc, string asm,
1075 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001076 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001077 T1LoadStore<opA, {opB,?,?}> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001078 bits<3> Rt;
1079 bits<8> addr;
1080 let Inst{10-6} = addr{7-3}; // imm5
1081 let Inst{5-3} = addr{2-0}; // Rn
1082 let Inst{2-0} = Rt;
1083}
1084
Johnny Chend68e1192009-12-15 17:24:14 +00001085// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001086class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001087 let Inst{15-12} = 0b1011;
1088 let Inst{11-5} = opcode;
1089}
1090
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001091// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001092class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001093 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001094 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001095 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001096 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001097 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001098 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001099 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001100 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001101 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001102}
1103
Bill Wendlingda2ae632010-08-31 07:50:46 +00001104// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1105// input operand since by default it's a zero register. It will become an
1106// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001107//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001108// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1109// more consistent.
Owen Anderson16884412011-07-13 23:22:26 +00001110class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001111 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001112 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001113 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersonbdf71442010-12-07 20:50:15 +00001114 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1115 let Inst{20} = s;
1116
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001117 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001118 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001119 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001120 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001121 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001122 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001123}
1124
1125// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001126class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001127 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001128 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001129 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001130 let OutOperandList = oops;
1131 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001132 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001133 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001134 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001135 let DecoderNamespace = "Thumb2";
Evan Chengf49810c2009-06-23 17:48:47 +00001136}
1137
Owen Anderson16884412011-07-13 23:22:26 +00001138class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +00001139 InstrItinClass itin,
1140 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001141 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1142 let OutOperandList = oops;
1143 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001144 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001145 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +00001146 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonf1a00902011-07-19 21:06:00 +00001147 let DecoderNamespace = "Thumb";
Jim Grosbachd1228742009-12-01 18:10:36 +00001148}
1149
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001150class T2I<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, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001153class T2Ii12<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_i12, 4, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001156class T2Ii8<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_i8, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001159class T2Iso<dag oops, dag iops, InstrItinClass itin,
1160 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001161 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001162class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1163 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001164 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001165class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001166 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001167 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
Johnny Chend68e1192009-12-15 17:24:14 +00001168 pattern> {
Owen Anderson9d63d902010-12-01 19:18:46 +00001169 bits<4> Rt;
1170 bits<4> Rt2;
1171 bits<13> addr;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001172 let Inst{31-25} = 0b1110100;
1173 let Inst{24} = P;
1174 let Inst{23} = addr{8};
1175 let Inst{22} = 1;
1176 let Inst{21} = W;
1177 let Inst{20} = isLoad;
1178 let Inst{19-16} = addr{12-9};
Owen Anderson9d63d902010-12-01 19:18:46 +00001179 let Inst{15-12} = Rt{3-0};
1180 let Inst{11-8} = Rt2{3-0};
Owen Anderson9d63d902010-12-01 19:18:46 +00001181 let Inst{7-0} = addr{7-0};
Johnny Chend68e1192009-12-15 17:24:14 +00001182}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001183
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001184class T2sI<dag oops, dag iops, InstrItinClass itin,
1185 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001186 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001187
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001188class T2XI<dag oops, dag iops, InstrItinClass itin,
1189 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001190 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001191class T2JTI<dag oops, dag iops, InstrItinClass itin,
1192 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001193 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001194
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001195// Move to/from coprocessor instructions
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001196class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
Jim Grosbach9bb098a2011-07-13 21:14:23 +00001197 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001198 let Inst{31-28} = opc;
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001199}
1200
Bob Wilson815baeb2010-03-13 01:08:20 +00001201// Two-address instructions
1202class T2XIt<dag oops, dag iops, InstrItinClass itin,
1203 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001204 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001205
Evan Chenge88d5ce2009-07-02 07:28:31 +00001206// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001207class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1208 dag oops, dag iops,
1209 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001210 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001211 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001212 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001213 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001214 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001215 let Pattern = pattern;
1216 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001217 let DecoderNamespace = "Thumb2";
Johnny Chend68e1192009-12-15 17:24:14 +00001218 let Inst{31-27} = 0b11111;
1219 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001220 let Inst{24} = signed;
1221 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001222 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001223 let Inst{20} = load;
1224 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001225 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001226 let Inst{10} = pre; // The P bit.
1227 let Inst{8} = 1; // The W bit.
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001228
Owen Anderson6af50f72010-11-30 00:14:31 +00001229 bits<9> addr;
1230 let Inst{7-0} = addr{7-0};
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001231 let Inst{9} = addr{8}; // Sign bit
1232
Owen Anderson6af50f72010-11-30 00:14:31 +00001233 bits<4> Rt;
1234 bits<4> Rn;
1235 let Inst{15-12} = Rt{3-0};
1236 let Inst{19-16} = Rn{3-0};
Evan Chenge88d5ce2009-07-02 07:28:31 +00001237}
1238
David Goodwinc9d138f2009-07-27 19:59:26 +00001239// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1240class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001241 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwinc9d138f2009-07-27 19:59:26 +00001242}
1243
1244// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1245class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001246 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwinc9d138f2009-07-27 19:59:26 +00001247}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001248
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +00001249// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1250class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1251 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1252}
1253
Evan Cheng9cb9e672009-06-27 02:26:13 +00001254// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1255class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001256 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001257}
1258
Evan Cheng13096642008-08-29 06:41:12 +00001259//===----------------------------------------------------------------------===//
1260
Evan Cheng96581d32008-11-11 02:11:05 +00001261//===----------------------------------------------------------------------===//
1262// ARM VFP Instruction templates.
1263//
1264
David Goodwin3ca524e2009-07-10 17:03:29 +00001265// Almost all VFP instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001266class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001267 IndexMode im, Format f, InstrItinClass itin,
1268 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001269 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001270 bits<4> p;
1271 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001272 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001273 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001274 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001275 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001276 let PostEncoderMethod = "VFPThumb2PostEncoder";
David Goodwin3ca524e2009-07-10 17:03:29 +00001277 list<Predicate> Predicates = [HasVFP2];
1278}
1279
1280// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001281class VFPXI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001282 IndexMode im, Format f, InstrItinClass itin,
1283 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001284 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001285 bits<4> p;
1286 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001287 let OutOperandList = oops;
1288 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001289 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001290 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001291 let PostEncoderMethod = "VFPThumb2PostEncoder";
David Goodwin3ca524e2009-07-10 17:03:29 +00001292 list<Predicate> Predicates = [HasVFP2];
1293}
1294
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001295class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1296 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001297 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendlingcf590262010-12-01 21:54:50 +00001298 opc, asm, "", pattern> {
1299 let PostEncoderMethod = "VFPThumb2PostEncoder";
1300}
David Goodwin3ca524e2009-07-10 17:03:29 +00001301
Evan Chengcd8e66a2008-11-11 21:48:44 +00001302// ARM VFP addrmode5 loads and stores
1303class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001304 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001305 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001306 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001307 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001308 // Instruction operands.
1309 bits<5> Dd;
1310 bits<13> addr;
1311
1312 // Encode instruction operands.
1313 let Inst{23} = addr{8}; // U (add = (U == '1'))
1314 let Inst{22} = Dd{4};
1315 let Inst{19-16} = addr{12-9}; // Rn
1316 let Inst{15-12} = Dd{3-0};
1317 let Inst{7-0} = addr{7-0}; // imm8
1318
Evan Cheng96581d32008-11-11 02:11:05 +00001319 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001320 let Inst{27-24} = opcod1;
1321 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001322 let Inst{11-9} = 0b101;
1323 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001324
Evan Cheng5eda2822011-02-16 00:35:02 +00001325 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001326 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001327}
1328
Evan Chengcd8e66a2008-11-11 21:48:44 +00001329class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001330 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001331 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001332 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001333 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001334 // Instruction operands.
1335 bits<5> Sd;
1336 bits<13> addr;
1337
1338 // Encode instruction operands.
1339 let Inst{23} = addr{8}; // U (add = (U == '1'))
1340 let Inst{22} = Sd{0};
1341 let Inst{19-16} = addr{12-9}; // Rn
1342 let Inst{15-12} = Sd{4-1};
1343 let Inst{7-0} = addr{7-0}; // imm8
1344
Evan Cheng96581d32008-11-11 02:11:05 +00001345 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001346 let Inst{27-24} = opcod1;
1347 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001348 let Inst{11-9} = 0b101;
1349 let Inst{8} = 0; // Single precision
Evan Cheng5eda2822011-02-16 00:35:02 +00001350
1351 // Loads & stores operate on both NEON and VFP pipelines.
1352 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001353}
1354
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001355// VFP Load / store multiple pseudo instructions.
1356class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1357 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001358 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001359 cstr, itin> {
1360 let OutOperandList = oops;
1361 let InOperandList = !con(iops, (ins pred:$p));
1362 let Pattern = pattern;
1363 list<Predicate> Predicates = [HasVFP2];
1364}
1365
Evan Chengcd8e66a2008-11-11 21:48:44 +00001366// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001367class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001368 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001369 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001370 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001371 // Instruction operands.
1372 bits<4> Rn;
1373 bits<13> regs;
1374
1375 // Encode instruction operands.
1376 let Inst{19-16} = Rn;
1377 let Inst{22} = regs{12};
1378 let Inst{15-12} = regs{11-8};
1379 let Inst{7-0} = regs{7-0};
1380
Evan Chengcd8e66a2008-11-11 21:48:44 +00001381 // TODO: Mark the instructions with the appropriate subtarget info.
1382 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001383 let Inst{11-9} = 0b101;
1384 let Inst{8} = 1; // Double precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001385}
1386
Jim Grosbach72db1822010-09-08 00:25:50 +00001387class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001388 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001389 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001390 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001391 // Instruction operands.
1392 bits<4> Rn;
1393 bits<13> regs;
1394
1395 // Encode instruction operands.
1396 let Inst{19-16} = Rn;
1397 let Inst{22} = regs{8};
1398 let Inst{15-12} = regs{12-9};
1399 let Inst{7-0} = regs{7-0};
1400
Evan Chengcd8e66a2008-11-11 21:48:44 +00001401 // TODO: Mark the instructions with the appropriate subtarget info.
1402 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001403 let Inst{11-9} = 0b101;
1404 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001405}
1406
Evan Cheng96581d32008-11-11 02:11:05 +00001407// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001408class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1409 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1410 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001411 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001412 // Instruction operands.
1413 bits<5> Dd;
1414 bits<5> Dm;
1415
1416 // Encode instruction operands.
1417 let Inst{3-0} = Dm{3-0};
1418 let Inst{5} = Dm{4};
1419 let Inst{15-12} = Dd{3-0};
1420 let Inst{22} = Dd{4};
1421
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001422 let Inst{27-23} = opcod1;
1423 let Inst{21-20} = opcod2;
1424 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001425 let Inst{11-9} = 0b101;
1426 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001427 let Inst{7-6} = opcod4;
1428 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001429}
1430
1431// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001432class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001433 dag iops, InstrItinClass itin, string opc, string asm,
1434 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001435 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001436 // Instruction operands.
1437 bits<5> Dd;
1438 bits<5> Dn;
1439 bits<5> Dm;
1440
1441 // Encode instruction operands.
1442 let Inst{3-0} = Dm{3-0};
1443 let Inst{5} = Dm{4};
1444 let Inst{19-16} = Dn{3-0};
1445 let Inst{7} = Dn{4};
1446 let Inst{15-12} = Dd{3-0};
1447 let Inst{22} = Dd{4};
1448
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001449 let Inst{27-23} = opcod1;
1450 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001451 let Inst{11-9} = 0b101;
1452 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001453 let Inst{6} = op6;
1454 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001455}
1456
1457// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001458class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1459 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1460 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001461 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001462 // Instruction operands.
1463 bits<5> Sd;
1464 bits<5> Sm;
1465
1466 // Encode instruction operands.
1467 let Inst{3-0} = Sm{4-1};
1468 let Inst{5} = Sm{0};
1469 let Inst{15-12} = Sd{4-1};
1470 let Inst{22} = Sd{0};
1471
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001472 let Inst{27-23} = opcod1;
1473 let Inst{21-20} = opcod2;
1474 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001475 let Inst{11-9} = 0b101;
1476 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001477 let Inst{7-6} = opcod4;
1478 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001479}
1480
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001481// Single precision unary, if no NEON. Same as ASuI except not available if
1482// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001483class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1484 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1485 string asm, list<dag> pattern>
1486 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1487 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001488 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1489}
1490
Evan Cheng96581d32008-11-11 02:11:05 +00001491// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001492class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1493 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001494 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001495 // Instruction operands.
1496 bits<5> Sd;
1497 bits<5> Sn;
1498 bits<5> Sm;
1499
1500 // Encode instruction operands.
1501 let Inst{3-0} = Sm{4-1};
1502 let Inst{5} = Sm{0};
1503 let Inst{19-16} = Sn{4-1};
1504 let Inst{7} = Sn{0};
1505 let Inst{15-12} = Sd{4-1};
1506 let Inst{22} = Sd{0};
1507
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001508 let Inst{27-23} = opcod1;
1509 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001510 let Inst{11-9} = 0b101;
1511 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001512 let Inst{6} = op6;
1513 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001514}
1515
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001516// Single precision binary, if no NEON. Same as ASbI except not available if
1517// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001518class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001519 dag iops, InstrItinClass itin, string opc, string asm,
1520 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001521 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001522 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling69661192010-11-01 06:00:39 +00001523
1524 // Instruction operands.
1525 bits<5> Sd;
1526 bits<5> Sn;
1527 bits<5> Sm;
1528
1529 // Encode instruction operands.
1530 let Inst{3-0} = Sm{4-1};
1531 let Inst{5} = Sm{0};
1532 let Inst{19-16} = Sn{4-1};
1533 let Inst{7} = Sn{0};
1534 let Inst{15-12} = Sd{4-1};
1535 let Inst{22} = Sd{0};
David Goodwin42a83f22009-08-04 17:53:06 +00001536}
1537
Evan Cheng80a11982008-11-12 06:41:41 +00001538// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001539class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1540 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1541 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001542 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001543 let Inst{27-23} = opcod1;
1544 let Inst{21-20} = opcod2;
1545 let Inst{19-16} = opcod3;
1546 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001547 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001548 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001549}
1550
Johnny Chen811663f2010-02-11 18:47:03 +00001551// VFP conversion between floating-point and fixed-point
1552class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001553 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1554 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001555 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1556 // size (fixed-point number): sx == 0 ? 16 : 32
1557 let Inst{7} = op5; // sx
1558}
1559
David Goodwin338268c2009-08-10 22:17:39 +00001560// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001561class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001562 dag oops, dag iops, InstrItinClass itin,
1563 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001564 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1565 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001566 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1567}
1568
Evan Cheng80a11982008-11-12 06:41:41 +00001569class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001570 InstrItinClass itin,
1571 string opc, string asm, list<dag> pattern>
1572 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001573 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001574 let Inst{11-8} = opcod2;
1575 let Inst{4} = 1;
1576}
1577
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001578class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1579 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1580 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001581
Bob Wilson01135592010-03-23 17:23:59 +00001582class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001583 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1584 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001585
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001586class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1587 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1588 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001589
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001590class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1591 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1592 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001593
Evan Cheng96581d32008-11-11 02:11:05 +00001594//===----------------------------------------------------------------------===//
1595
Bob Wilson5bafff32009-06-22 23:27:02 +00001596//===----------------------------------------------------------------------===//
1597// ARM NEON Instruction templates.
1598//
Evan Cheng13096642008-08-29 06:41:12 +00001599
Johnny Chencaa608e2010-03-20 00:17:00 +00001600class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1601 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1602 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001603 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001604 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001605 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001606 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001607 let Pattern = pattern;
1608 list<Predicate> Predicates = [HasNEON];
1609}
1610
1611// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001612class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1613 InstrItinClass itin, string opc, string asm, string cstr,
1614 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001615 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001616 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001617 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001618 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001619 let Pattern = pattern;
1620 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001621}
1622
Bob Wilsonb07c1712009-10-07 21:53:04 +00001623class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1624 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001625 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001626 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1627 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001628 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001629 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001630 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001631 let Inst{11-8} = op11_8;
1632 let Inst{7-4} = op7_4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001633
Chris Lattner2ac19022010-11-15 05:19:05 +00001634 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001635
Owen Andersond9aa7d32010-11-02 00:05:05 +00001636 bits<5> Vd;
Owen Andersonf431eda2010-11-02 23:47:29 +00001637 bits<6> Rn;
1638 bits<4> Rm;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001639
Owen Andersond9aa7d32010-11-02 00:05:05 +00001640 let Inst{22} = Vd{4};
1641 let Inst{15-12} = Vd{3-0};
Owen Andersonf431eda2010-11-02 23:47:29 +00001642 let Inst{19-16} = Rn{3-0};
1643 let Inst{3-0} = Rm{3-0};
Bob Wilson205a5ca2009-07-08 18:11:30 +00001644}
1645
Owen Andersond138d702010-11-02 20:47:39 +00001646class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1647 dag oops, dag iops, InstrItinClass itin,
1648 string opc, string dt, string asm, string cstr, list<dag> pattern>
1649 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1650 dt, asm, cstr, pattern> {
1651 bits<3> lane;
1652}
1653
Bob Wilson709d5922010-08-25 23:27:42 +00001654class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson16884412011-07-13 23:22:26 +00001655 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson709d5922010-08-25 23:27:42 +00001656 itin> {
1657 let OutOperandList = oops;
1658 let InOperandList = !con(iops, (ins pred:$p));
1659 list<Predicate> Predicates = [HasNEON];
1660}
1661
Jim Grosbach7cd27292010-10-06 20:36:55 +00001662class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1663 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001664 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonbd916c52010-09-13 23:55:10 +00001665 itin> {
1666 let OutOperandList = oops;
1667 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001668 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001669 list<Predicate> Predicates = [HasNEON];
1670}
1671
Johnny Chen785516a2010-03-23 16:43:47 +00001672class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001673 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001674 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1675 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001676 let Inst{31-25} = 0b1111001;
Chris Lattner2ac19022010-11-15 05:19:05 +00001677 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Evan Chengf81bf152009-11-23 21:57:23 +00001678}
1679
Johnny Chen927b88f2010-03-23 20:40:44 +00001680class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001681 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001682 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001683 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001684 let Inst{31-25} = 0b1111001;
Owen Andersonac00e962010-12-10 22:32:08 +00001685 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Bob Wilson5bafff32009-06-22 23:27:02 +00001686}
1687
1688// NEON "one register and a modified immediate" format.
1689class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1690 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001691 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001692 string opc, string dt, string asm, string cstr,
1693 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001694 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001695 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001696 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001697 let Inst{11-8} = op11_8;
1698 let Inst{7} = op7;
1699 let Inst{6} = op6;
1700 let Inst{5} = op5;
1701 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001702
Owen Andersona88ea032010-10-26 17:40:54 +00001703 // Instruction operands.
1704 bits<5> Vd;
1705 bits<13> SIMM;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001706
Owen Andersona88ea032010-10-26 17:40:54 +00001707 let Inst{15-12} = Vd{3-0};
1708 let Inst{22} = Vd{4};
1709 let Inst{24} = SIMM{7};
1710 let Inst{18-16} = SIMM{6-4};
1711 let Inst{3-0} = SIMM{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001712}
1713
1714// NEON 2 vector register format.
1715class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1716 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001717 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001718 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001719 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001720 let Inst{24-23} = op24_23;
1721 let Inst{21-20} = op21_20;
1722 let Inst{19-18} = op19_18;
1723 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001724 let Inst{11-7} = op11_7;
1725 let Inst{6} = op6;
1726 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001727
Owen Anderson162875a2010-10-25 18:43:52 +00001728 // Instruction operands.
1729 bits<5> Vd;
1730 bits<5> Vm;
1731
1732 let Inst{15-12} = Vd{3-0};
1733 let Inst{22} = Vd{4};
1734 let Inst{3-0} = Vm{3-0};
1735 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001736}
1737
1738// Same as N2V except it doesn't have a datatype suffix.
1739class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001740 bits<5> op11_7, bit op6, bit op4,
1741 dag oops, dag iops, InstrItinClass itin,
1742 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001743 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001744 let Inst{24-23} = op24_23;
1745 let Inst{21-20} = op21_20;
1746 let Inst{19-18} = op19_18;
1747 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001748 let Inst{11-7} = op11_7;
1749 let Inst{6} = op6;
1750 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001751
Owen Anderson162875a2010-10-25 18:43:52 +00001752 // Instruction operands.
1753 bits<5> Vd;
1754 bits<5> Vm;
1755
1756 let Inst{15-12} = Vd{3-0};
1757 let Inst{22} = Vd{4};
1758 let Inst{3-0} = Vm{3-0};
1759 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001760}
1761
1762// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001763class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001764 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001765 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001766 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001767 let Inst{24} = op24;
1768 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001769 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001770 let Inst{7} = op7;
1771 let Inst{6} = op6;
1772 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001773
Owen Anderson3557d002010-10-26 20:56:57 +00001774 // Instruction operands.
1775 bits<5> Vd;
1776 bits<5> Vm;
1777 bits<6> SIMM;
1778
1779 let Inst{15-12} = Vd{3-0};
1780 let Inst{22} = Vd{4};
1781 let Inst{3-0} = Vm{3-0};
1782 let Inst{5} = Vm{4};
1783 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001784}
1785
Bob Wilson10bc69c2010-03-27 03:56:52 +00001786// NEON 3 vector register format.
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001787
Jim Grosbach6635b042011-05-19 17:34:53 +00001788class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1789 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1790 string opc, string dt, string asm, string cstr,
1791 list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001792 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001793 let Inst{24} = op24;
1794 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001795 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001796 let Inst{11-8} = op11_8;
1797 let Inst{6} = op6;
1798 let Inst{4} = op4;
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001799}
1800
1801class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1802 dag oops, dag iops, Format f, InstrItinClass itin,
1803 string opc, string dt, string asm, string cstr, list<dag> pattern>
1804 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1805 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001806
Owen Andersond451f882010-10-21 20:21:49 +00001807 // Instruction operands.
1808 bits<5> Vd;
1809 bits<5> Vn;
1810 bits<5> Vm;
1811
1812 let Inst{15-12} = Vd{3-0};
1813 let Inst{22} = Vd{4};
1814 let Inst{19-16} = Vn{3-0};
1815 let Inst{7} = Vn{4};
1816 let Inst{3-0} = Vm{3-0};
1817 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001818}
1819
Jim Grosbach6635b042011-05-19 17:34:53 +00001820class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1821 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1822 string opc, string dt, string asm, string cstr,
1823 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001824 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1825 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1826
1827 // Instruction operands.
1828 bits<5> Vd;
1829 bits<5> Vn;
1830 bits<5> Vm;
1831 bit lane;
1832
1833 let Inst{15-12} = Vd{3-0};
1834 let Inst{22} = Vd{4};
1835 let Inst{19-16} = Vn{3-0};
1836 let Inst{7} = Vn{4};
1837 let Inst{3-0} = Vm{3-0};
1838 let Inst{5} = lane;
1839}
1840
Jim Grosbach6635b042011-05-19 17:34:53 +00001841class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1842 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1843 string opc, string dt, string asm, string cstr,
1844 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001845 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1846 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1847
1848 // Instruction operands.
1849 bits<5> Vd;
1850 bits<5> Vn;
1851 bits<5> Vm;
1852 bits<2> lane;
1853
1854 let Inst{15-12} = Vd{3-0};
1855 let Inst{22} = Vd{4};
1856 let Inst{19-16} = Vn{3-0};
1857 let Inst{7} = Vn{4};
1858 let Inst{2-0} = Vm{2-0};
1859 let Inst{5} = lane{1};
1860 let Inst{3} = lane{0};
1861}
1862
Johnny Chen841e8282010-03-23 21:35:03 +00001863// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001864class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1865 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001866 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001867 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001868 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001869 let Inst{24} = op24;
1870 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001871 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001872 let Inst{11-8} = op11_8;
1873 let Inst{6} = op6;
1874 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001875
Owen Anderson8c71eff2010-10-25 18:28:30 +00001876 // Instruction operands.
1877 bits<5> Vd;
1878 bits<5> Vn;
1879 bits<5> Vm;
1880
1881 let Inst{15-12} = Vd{3-0};
1882 let Inst{22} = Vd{4};
1883 let Inst{19-16} = Vn{3-0};
1884 let Inst{7} = Vn{4};
1885 let Inst{3-0} = Vm{3-0};
1886 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001887}
1888
1889// NEON VMOVs between scalar and core registers.
1890class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001891 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001892 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001893 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001894 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001895 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001896 let Inst{11-8} = opcod2;
1897 let Inst{6-5} = opcod3;
1898 let Inst{4} = 1;
Johnny Chena9611542011-04-06 18:27:46 +00001899 // A8.6.303, A8.6.328, A8.6.329
1900 let Inst{3-0} = 0b0000;
Evan Chengf81bf152009-11-23 21:57:23 +00001901
1902 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001903 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001904 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001905 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001906 list<Predicate> Predicates = [HasNEON];
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001907
Chris Lattner2ac19022010-11-15 05:19:05 +00001908 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001909
Owen Andersond2fbdb72010-10-27 21:28:09 +00001910 bits<5> V;
1911 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001912 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001913 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001914
Owen Andersonf587a9352010-10-27 19:25:54 +00001915 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001916 let Inst{7} = V{4};
1917 let Inst{19-16} = V{3-0};
1918 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001919}
1920class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001921 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001922 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001923 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001924 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001925class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001926 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001927 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001928 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001929 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001930class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001931 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001932 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001933 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001934 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001935
Johnny Chene4614f72010-03-25 17:01:27 +00001936// Vector Duplicate Lane (from scalar to all elements)
1937class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1938 InstrItinClass itin, string opc, string dt, string asm,
1939 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001940 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001941 let Inst{24-23} = 0b11;
1942 let Inst{21-20} = 0b11;
1943 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001944 let Inst{11-7} = 0b11000;
1945 let Inst{6} = op6;
1946 let Inst{4} = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001947
Owen Andersonf587a9352010-10-27 19:25:54 +00001948 bits<5> Vd;
1949 bits<5> Vm;
1950 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001951
Owen Andersonf587a9352010-10-27 19:25:54 +00001952 let Inst{22} = Vd{4};
1953 let Inst{15-12} = Vd{3-0};
1954 let Inst{5} = Vm{4};
1955 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001956}
1957
David Goodwin42a83f22009-08-04 17:53:06 +00001958// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1959// for single-precision FP.
1960class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1961 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1962}