blob: eba55944d2ddf0ba83d4cf497f30a074ba180477 [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
Bruno Cardoso Lopesa2b6e412011-02-14 13:09:44 +0000134// ARM imod and iflag operands, used only by the CPS instruction.
135def imod_op : Operand<i32> {
136 let PrintMethod = "printCPSIMod";
137}
138
Jim Grosbach5f6c1332011-07-25 20:38:18 +0000139def ProcIFlagsOperand : AsmOperandClass {
140 let Name = "ProcIFlags";
141 let ParserMethod = "parseProcIFlagsOperand";
142}
Bruno Cardoso Lopesa2b6e412011-02-14 13:09:44 +0000143def iflags_op : Operand<i32> {
144 let PrintMethod = "printCPSIFlag";
145 let ParserMatchClass = ProcIFlagsOperand;
146}
147
Evan Cheng446c4282009-07-11 06:43:01 +0000148// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
149// register whose default is 0 (no register).
Jim Grosbach5f6c1332011-07-25 20:38:18 +0000150def CondCodeOperand : AsmOperandClass { let Name = "CondCode"; }
Jim Grosbach4ec6e882011-08-19 20:46:54 +0000151def pred : PredicateOperand<OtherVT, (ops i32imm, i32imm),
Evan Cheng446c4282009-07-11 06:43:01 +0000152 (ops (i32 14), (i32 zero_reg))> {
153 let PrintMethod = "printPredicateOperand";
Daniel Dunbar8462b302010-08-11 06:36:53 +0000154 let ParserMatchClass = CondCodeOperand;
Jim Grosbach73a1c2c2011-08-19 20:30:19 +0000155 let DecoderMethod = "DecodePredicateOperand";
Evan Cheng446c4282009-07-11 06:43:01 +0000156}
157
158// Conditional code result for instructions whose 's' bit is set, e.g. subs.
Jim Grosbach5f6c1332011-07-25 20:38:18 +0000159def CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
Evan Cheng446c4282009-07-11 06:43:01 +0000160def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000161 let EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000162 let PrintMethod = "printSBitModifierOperand";
Jim Grosbachd67641b2010-12-06 18:21:12 +0000163 let ParserMatchClass = CCOutOperand;
Jim Grosbachb86e2db2011-08-19 19:41:46 +0000164 let DecoderMethod = "DecodeCCOutOperand";
Evan Cheng446c4282009-07-11 06:43:01 +0000165}
166
167// Same as cc_out except it defaults to setting CPSR.
168def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000169 let EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000170 let PrintMethod = "printSBitModifierOperand";
Jim Grosbachd67641b2010-12-06 18:21:12 +0000171 let ParserMatchClass = CCOutOperand;
Jim Grosbachb86e2db2011-08-19 19:41:46 +0000172 let DecoderMethod = "DecodeCCOutOperand";
Evan Cheng446c4282009-07-11 06:43:01 +0000173}
174
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000175// ARM special operands for disassembly only.
176//
Jim Grosbachc27d4f92011-07-22 17:44:50 +0000177def SetEndAsmOperand : AsmOperandClass {
178 let Name = "SetEndImm";
179 let ParserMethod = "parseSetEndImm";
180}
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000181def setend_op : Operand<i32> {
182 let PrintMethod = "printSetendOperand";
Jim Grosbachc27d4f92011-07-22 17:44:50 +0000183 let ParserMatchClass = SetEndAsmOperand;
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000184}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000185
Jim Grosbach5f6c1332011-07-25 20:38:18 +0000186def MSRMaskOperand : AsmOperandClass {
187 let Name = "MSRMask";
188 let ParserMethod = "parseMSRMaskOperand";
189}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000190def msr_mask : Operand<i32> {
191 let PrintMethod = "printMSRMaskOperand";
Owen Anderson26d2f0a2011-08-11 20:21:46 +0000192 let DecoderMethod = "DecodeMSRMask";
Bruno Cardoso Lopes584bf7b2011-02-18 19:45:59 +0000193 let ParserMatchClass = MSRMaskOperand;
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000194}
195
Bill Wendling3116dce2011-03-07 23:38:41 +0000196// Shift Right Immediate - A shift right immediate is encoded differently from
197// other shift immediates. The imm6 field is encoded like so:
Bill Wendlinga656b632011-03-01 01:00:59 +0000198//
Bill Wendling3116dce2011-03-07 23:38:41 +0000199// Offset Encoding
200// 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
201// 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
202// 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
203// 64 64 - <imm> is encoded in imm6<5:0>
204def shr_imm8 : Operand<i32> {
205 let EncoderMethod = "getShiftRight8Imm";
Owen Anderson8d7d2e12011-08-09 20:55:18 +0000206 let DecoderMethod = "DecodeShiftRight8Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000207}
Bill Wendling3116dce2011-03-07 23:38:41 +0000208def shr_imm16 : Operand<i32> {
209 let EncoderMethod = "getShiftRight16Imm";
Owen Anderson8d7d2e12011-08-09 20:55:18 +0000210 let DecoderMethod = "DecodeShiftRight16Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000211}
Bill Wendling3116dce2011-03-07 23:38:41 +0000212def shr_imm32 : Operand<i32> {
213 let EncoderMethod = "getShiftRight32Imm";
Owen Anderson8d7d2e12011-08-09 20:55:18 +0000214 let DecoderMethod = "DecodeShiftRight32Imm";
Bill Wendling3116dce2011-03-07 23:38:41 +0000215}
216def shr_imm64 : Operand<i32> {
217 let EncoderMethod = "getShiftRight64Imm";
Owen Anderson8d7d2e12011-08-09 20:55:18 +0000218 let DecoderMethod = "DecodeShiftRight64Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000219}
220
Evan Cheng446c4282009-07-11 06:43:01 +0000221//===----------------------------------------------------------------------===//
Jim Grosbacha33b31b2011-08-22 18:04:24 +0000222// ARM Assembler alias templates.
223//
224class ARMInstAlias<string Asm, dag Result, bit Emit = 0b1>
225 : InstAlias<Asm, Result, Emit>, Requires<[IsARM]>;
226class tInstAlias<string Asm, dag Result, bit Emit = 0b1>
227 : InstAlias<Asm, Result, Emit>, Requires<[IsThumb]>;
228class t2InstAlias<string Asm, dag Result, bit Emit = 0b1>
229 : InstAlias<Asm, Result, Emit>, Requires<[IsThumb2]>;
230
231//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000232// ARM Instruction templates.
233//
234
Jim Grosbacha33b31b2011-08-22 18:04:24 +0000235
Owen Anderson16884412011-07-13 23:22:26 +0000236class InstTemplate<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000237 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000238 : Instruction {
239 let Namespace = "ARM";
240
Evan Cheng37f25d92008-08-28 23:39:26 +0000241 AddrMode AM = am;
Owen Anderson16884412011-07-13 23:22:26 +0000242 int Size = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000243 IndexMode IM = im;
244 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000245 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000246 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000247 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000248 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000249 bit canXformTo16Bit = 0;
Jim Grosbach47a0d522011-08-16 20:45:50 +0000250 // The instruction is a 16-bit flag setting Thumb instruction. Used
251 // by the parser to determine whether to require the 'S' suffix on the
252 // mnemonic (when not in an IT block) or preclude it (when in an IT block).
253 bit thumbArithFlagSetting = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +0000254
Chris Lattner150d20e2010-10-31 19:22:57 +0000255 // If this is a pseudo instruction, mark it isCodeGenOnly.
256 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson01135592010-03-23 17:23:59 +0000257
Jim Grosbach8757a4c2011-08-15 16:52:24 +0000258 // The layout of TSFlags should be kept in sync with ARMBaseInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000259 let TSFlags{4-0} = AM.Value;
Owen Anderson16884412011-07-13 23:22:26 +0000260 let TSFlags{6-5} = IndexModeBits;
261 let TSFlags{12-7} = Form;
262 let TSFlags{13} = isUnaryDataProc;
263 let TSFlags{14} = canXformTo16Bit;
264 let TSFlags{17-15} = D.Value;
Jim Grosbach47a0d522011-08-16 20:45:50 +0000265 let TSFlags{18} = thumbArithFlagSetting;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000266
Evan Cheng37f25d92008-08-28 23:39:26 +0000267 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000268 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000269}
270
Johnny Chend68e1192009-12-15 17:24:14 +0000271class Encoding {
272 field bits<32> Inst;
273}
274
Owen Anderson16884412011-07-13 23:22:26 +0000275class InstARM<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000276 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000277 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
278 let DecoderNamespace = "ARM";
279}
Johnny Chend68e1192009-12-15 17:24:14 +0000280
281// This Encoding-less class is used by Thumb1 to specify the encoding bits later
282// on by adding flavors to specific instructions.
Owen Anderson16884412011-07-13 23:22:26 +0000283class InstThumb<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000284 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000285 : InstTemplate<am, sz, im, f, d, cstr, itin> {
286 let DecoderNamespace = "Thumb";
287}
Johnny Chend68e1192009-12-15 17:24:14 +0000288
Jim Grosbach99594eb2010-11-18 01:38:26 +0000289class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000290 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000291 GenericDomain, "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000292 let OutOperandList = oops;
293 let InOperandList = iops;
Evan Cheng37f25d92008-08-28 23:39:26 +0000294 let Pattern = pattern;
Jim Grosbacha768c3d2011-03-10 19:06:39 +0000295 let isCodeGenOnly = 1;
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000296 let isPseudo = 1;
Evan Cheng37f25d92008-08-28 23:39:26 +0000297}
298
Jim Grosbach53694262010-11-18 01:15:56 +0000299// PseudoInst that's ARM-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000300class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach99594eb2010-11-18 01:38:26 +0000301 list<dag> pattern>
302 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000303 let Size = sz;
Jim Grosbach53694262010-11-18 01:15:56 +0000304 list<Predicate> Predicates = [IsARM];
305}
306
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000307// PseudoInst that's Thumb-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000308class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000309 list<dag> pattern>
310 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000311 let Size = sz;
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000312 list<Predicate> Predicates = [IsThumb];
313}
Jim Grosbach53694262010-11-18 01:15:56 +0000314
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000315// PseudoInst that's Thumb2-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000316class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000317 list<dag> pattern>
318 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000319 let Size = sz;
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000320 list<Predicate> Predicates = [IsThumb2];
321}
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000322
Owen Anderson16884412011-07-13 23:22:26 +0000323class ARMPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000324 InstrItinClass itin, list<dag> pattern,
325 dag Result>
326 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
327 PseudoInstExpansion<Result>;
328
Owen Anderson16884412011-07-13 23:22:26 +0000329class tPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000330 InstrItinClass itin, list<dag> pattern,
331 dag Result>
332 : tPseudoInst<oops, iops, sz, itin, pattern>,
333 PseudoInstExpansion<Result>;
334
Owen Anderson16884412011-07-13 23:22:26 +0000335class t2PseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000336 InstrItinClass itin, list<dag> pattern,
337 dag Result>
338 : t2PseudoInst<oops, iops, sz, itin, pattern>,
339 PseudoInstExpansion<Result>;
340
Evan Cheng37f25d92008-08-28 23:39:26 +0000341// Almost all ARM instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +0000342class I<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000343 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000344 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000345 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000346 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000347 bits<4> p;
348 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000349 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000350 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000351 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000352 let Pattern = pattern;
353 list<Predicate> Predicates = [IsARM];
354}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000355
Jim Grosbachf6b28622009-12-14 18:31:20 +0000356// A few are not predicable
Owen Anderson16884412011-07-13 23:22:26 +0000357class InoP<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000358 IndexMode im, Format f, InstrItinClass itin,
359 string opc, string asm, string cstr,
360 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000361 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
362 let OutOperandList = oops;
363 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000364 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000365 let Pattern = pattern;
366 let isPredicable = 0;
367 list<Predicate> Predicates = [IsARM];
368}
Evan Cheng37f25d92008-08-28 23:39:26 +0000369
Bill Wendling4822bce2010-08-30 01:47:35 +0000370// Same as I except it can optionally modify CPSR. Note it's modeled as an input
371// operand since by default it's a zero register. It will become an implicit def
372// once it's "flipped".
Owen Anderson16884412011-07-13 23:22:26 +0000373class sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000374 IndexMode im, Format f, InstrItinClass itin,
375 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000376 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000377 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000378 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000379 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000380 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000381 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000382
Evan Cheng37f25d92008-08-28 23:39:26 +0000383 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000384 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000385 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000386 let Pattern = pattern;
387 list<Predicate> Predicates = [IsARM];
388}
389
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000390// Special cases
Owen Anderson16884412011-07-13 23:22:26 +0000391class XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000392 IndexMode im, Format f, InstrItinClass itin,
393 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000394 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000395 let OutOperandList = oops;
396 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000397 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000398 let Pattern = pattern;
399 list<Predicate> Predicates = [IsARM];
400}
401
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000402class AI<dag oops, dag iops, Format f, InstrItinClass itin,
403 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000404 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000405 opc, asm, "", pattern>;
406class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
407 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000408 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000409 opc, asm, "", pattern>;
410class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000411 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000412 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000413 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000414class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000415 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000416 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000417 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000418
419// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000420class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
421 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000422 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000423 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000424 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000425}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000426class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
427 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000428 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000429 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000430 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000431}
Evan Cheng3aac7882008-09-01 08:25:56 +0000432
433// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000434class JTI<dag oops, dag iops, InstrItinClass itin,
435 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000436 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000437 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000438
Jim Grosbach5278eb82009-12-11 01:42:04 +0000439// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000440class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
441 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000442 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000443 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000444 bits<4> Rt;
Jim Grosbachdfdf02d2011-07-26 17:44:46 +0000445 bits<4> addr;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000446 let Inst{27-23} = 0b00011;
447 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000448 let Inst{20} = 1;
Jim Grosbachdfdf02d2011-07-26 17:44:46 +0000449 let Inst{19-16} = addr;
Jim Grosbach86875a22010-10-29 19:58:57 +0000450 let Inst{15-12} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000451 let Inst{11-0} = 0b111110011111;
452}
453class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
454 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000455 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000456 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000457 bits<4> Rd;
458 bits<4> Rt;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000459 bits<4> addr;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000460 let Inst{27-23} = 0b00011;
461 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000462 let Inst{20} = 0;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000463 let Inst{19-16} = addr;
Jim Grosbach86875a22010-10-29 19:58:57 +0000464 let Inst{15-12} = Rd;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000465 let Inst{11-4} = 0b11111001;
Jim Grosbach86875a22010-10-29 19:58:57 +0000466 let Inst{3-0} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000467}
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000468class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000469 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000470 bits<4> Rt;
471 bits<4> Rt2;
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000472 bits<4> addr;
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000473 let Inst{27-23} = 0b00010;
474 let Inst{22} = b;
475 let Inst{21-20} = 0b00;
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000476 let Inst{19-16} = addr;
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000477 let Inst{15-12} = Rt;
478 let Inst{11-4} = 0b00001001;
479 let Inst{3-0} = Rt2;
480}
Jim Grosbach5278eb82009-12-11 01:42:04 +0000481
Evan Cheng0d14fc82008-09-01 01:51:14 +0000482// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000483class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
484 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000485 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000486 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000487 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000488 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000489}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000490class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
491 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000492 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000493 opc, asm, "", pattern> {
494 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000495 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000496}
497class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000498 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000499 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000500 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000501 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000502 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000503}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000504
Evan Cheng93912732008-09-01 01:27:33 +0000505// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000506
Jim Grosbach9558b4c2010-11-19 21:07:51 +0000507// LDR/LDRB/STR/STRB/...
508class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000509 Format f, InstrItinClass itin, string opc, string asm,
510 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000511 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
Jim Grosbach3e556122010-10-26 22:37:02 +0000512 "", pattern> {
513 let Inst{27-25} = op;
514 let Inst{24} = 1; // 24 == P
515 // 23 == U
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000516 let Inst{22} = isByte;
Jim Grosbach3e556122010-10-26 22:37:02 +0000517 let Inst{21} = 0; // 21 == W
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000518 let Inst{20} = isLd;
Jim Grosbach3e556122010-10-26 22:37:02 +0000519}
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000520// Indexed load/stores
521class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000522 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000523 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000524 : I<oops, iops, AddrMode2, 4, im, f, itin,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000525 opc, asm, cstr, pattern> {
Jim Grosbach99f53d12010-11-15 20:47:07 +0000526 bits<4> Rt;
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000527 let Inst{27-26} = 0b01;
528 let Inst{24} = isPre; // P bit
529 let Inst{22} = isByte; // B bit
530 let Inst{21} = isPre; // W bit
531 let Inst{20} = isLd; // L bit
Jim Grosbach99f53d12010-11-15 20:47:07 +0000532 let Inst{15-12} = Rt;
Jim Grosbach3e556122010-10-26 22:37:02 +0000533}
Owen Anderson793e7962011-07-26 20:54:26 +0000534class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000535 IndexMode im, Format f, InstrItinClass itin, string opc,
536 string asm, string cstr, list<dag> pattern>
537 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
538 pattern> {
539 // AM2 store w/ two operands: (GPR, am2offset)
Jim Grosbach953557f42010-11-19 21:35:06 +0000540 // {12} isAdd
541 // {11-0} imm12/Rm
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000542 bits<14> offset;
543 bits<4> Rn;
Owen Anderson793e7962011-07-26 20:54:26 +0000544 let Inst{25} = 1;
545 let Inst{23} = offset{12};
546 let Inst{19-16} = Rn;
547 let Inst{11-5} = offset{11-5};
548 let Inst{4} = 0;
549 let Inst{3-0} = offset{3-0};
550}
551
552class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
553 IndexMode im, Format f, InstrItinClass itin, string opc,
554 string asm, string cstr, list<dag> pattern>
555 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
556 pattern> {
557 // AM2 store w/ two operands: (GPR, am2offset)
558 // {12} isAdd
559 // {11-0} imm12/Rm
560 bits<14> offset;
561 bits<4> Rn;
562 let Inst{25} = 0;
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000563 let Inst{23} = offset{12};
564 let Inst{19-16} = Rn;
565 let Inst{11-0} = offset{11-0};
Jim Grosbach953557f42010-11-19 21:35:06 +0000566}
Owen Anderson793e7962011-07-26 20:54:26 +0000567
568
Bruno Cardoso Lopesae085542011-03-31 23:26:08 +0000569// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
570// but for now use this class for STRT and STRBT.
571class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
572 IndexMode im, Format f, InstrItinClass itin, string opc,
573 string asm, string cstr, list<dag> pattern>
574 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
575 pattern> {
576 // AM2 store w/ two operands: (GPR, am2offset)
577 // {17-14} Rn
578 // {13} 1 == Rm, 0 == imm12
579 // {12} isAdd
580 // {11-0} imm12/Rm
581 bits<18> addr;
582 let Inst{25} = addr{13};
583 let Inst{23} = addr{12};
584 let Inst{19-16} = addr{17-14};
585 let Inst{11-0} = addr{11-0};
586}
Jim Grosbach3e556122010-10-26 22:37:02 +0000587
Evan Cheng0d14fc82008-09-01 01:51:14 +0000588// addrmode3 instructions
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000589class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
590 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000591 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach160f8f02010-11-18 00:46:58 +0000592 opc, asm, "", pattern> {
593 bits<14> addr;
594 bits<4> Rt;
595 let Inst{27-25} = 0b000;
596 let Inst{24} = 1; // P bit
597 let Inst{23} = addr{8}; // U bit
598 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
599 let Inst{21} = 0; // W bit
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000600 let Inst{20} = op20; // L bit
Jim Grosbach160f8f02010-11-18 00:46:58 +0000601 let Inst{19-16} = addr{12-9}; // Rn
602 let Inst{15-12} = Rt; // Rt
603 let Inst{11-8} = addr{7-4}; // imm7_4/zero
604 let Inst{7-4} = op;
605 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Owen Anderson8d7d2e12011-08-09 20:55:18 +0000606
607 let DecoderMethod = "DecodeAddrMode3Instruction";
Jim Grosbach160f8f02010-11-18 00:46:58 +0000608}
Evan Cheng840917b2008-09-01 07:00:14 +0000609
Jim Grosbach45251b32011-08-11 20:41:13 +0000610class AI3ldstidx<bits<4> op, bit op20, bit isPre, dag oops, dag iops,
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000611 IndexMode im, Format f, InstrItinClass itin, string opc,
612 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000613 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000614 opc, asm, cstr, pattern> {
615 bits<4> Rt;
616 let Inst{27-25} = 0b000;
617 let Inst{24} = isPre; // P bit
618 let Inst{21} = isPre; // W bit
619 let Inst{20} = op20; // L bit
620 let Inst{15-12} = Rt; // Rt
621 let Inst{7-4} = op;
622}
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000623
624// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
625// but for now use this class for LDRSBT, LDRHT, LDSHT.
Jim Grosbach7ce05792011-08-03 23:50:40 +0000626class AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000627 IndexMode im, Format f, InstrItinClass itin, string opc,
628 string asm, string cstr, list<dag> pattern>
Jim Grosbach7ce05792011-08-03 23:50:40 +0000629 : I<oops, iops, AddrMode3, 4, im, f, itin, opc, asm, cstr, pattern> {
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000630 // {13} 1 == imm8, 0 == Rm
631 // {12-9} Rn
632 // {8} isAdd
633 // {7-4} imm7_4/zero
634 // {3-0} imm3_0/Rm
Jim Grosbach7ce05792011-08-03 23:50:40 +0000635 bits<4> addr;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000636 bits<4> Rt;
637 let Inst{27-25} = 0b000;
Jim Grosbach7ce05792011-08-03 23:50:40 +0000638 let Inst{24} = 0; // P bit
639 let Inst{21} = 1;
640 let Inst{20} = isLoad; // L bit
641 let Inst{19-16} = addr; // Rn
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000642 let Inst{15-12} = Rt; // Rt
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000643 let Inst{7-4} = op;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000644}
645
Evan Cheng840917b2008-09-01 07:00:14 +0000646// stores
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000647class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000648 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000649 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000650 opc, asm, "", pattern> {
Jim Grosbach570a9222010-11-11 01:09:40 +0000651 bits<14> addr;
652 bits<4> Rt;
Evan Chengdda0f4c2009-07-08 22:51:32 +0000653 let Inst{27-25} = 0b000;
Jim Grosbach570a9222010-11-11 01:09:40 +0000654 let Inst{24} = 1; // P bit
655 let Inst{23} = addr{8}; // U bit
656 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
657 let Inst{21} = 0; // W bit
658 let Inst{20} = 0; // L bit
659 let Inst{19-16} = addr{12-9}; // Rn
660 let Inst{15-12} = Rt; // Rt
661 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000662 let Inst{7-4} = op;
Jim Grosbach570a9222010-11-11 01:09:40 +0000663 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Owen Anderson79628e92011-08-12 20:02:50 +0000664 let DecoderMethod = "DecodeAddrMode3Instruction";
Evan Cheng840917b2008-09-01 07:00:14 +0000665}
Evan Cheng840917b2008-09-01 07:00:14 +0000666
Evan Cheng0d14fc82008-09-01 01:51:14 +0000667// addrmode4 instructions
Bill Wendling6c470b82010-11-13 09:09:38 +0000668class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
669 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000670 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000671 bits<4> p;
672 bits<16> regs;
673 bits<4> Rn;
674 let Inst{31-28} = p;
675 let Inst{27-25} = 0b100;
676 let Inst{22} = 0; // S bit
677 let Inst{19-16} = Rn;
678 let Inst{15-0} = regs;
679}
Evan Cheng37f25d92008-08-28 23:39:26 +0000680
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000681// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000682class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
683 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000684 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000685 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000686 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000687 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000688 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000689}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000690class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
691 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000692 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000693 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000694 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000695 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000696}
697
698// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000699class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
700 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000701 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000702 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000703 bits<4> Rd;
704 bits<4> Rn;
705 bits<4> Rm;
706 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000707 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000708 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000709 let Inst{19-16} = Rd;
710 let Inst{11-8} = Rm;
711 let Inst{3-0} = Rn;
712}
713// MSW multiple w/ Ra operand
714class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
715 InstrItinClass itin, string opc, string asm, list<dag> pattern>
716 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
717 bits<4> Ra;
718 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000719}
Evan Cheng37f25d92008-08-28 23:39:26 +0000720
Evan Chengeb4f52e2008-11-06 03:35:07 +0000721// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000722class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000723 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000724 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000725 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000726 bits<4> Rn;
727 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000728 let Inst{4} = 0;
729 let Inst{7} = 1;
730 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000731 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000732 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000733 let Inst{11-8} = Rm;
734 let Inst{3-0} = Rn;
735}
736class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
737 InstrItinClass itin, string opc, string asm, list<dag> pattern>
738 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
739 bits<4> Rd;
740 let Inst{19-16} = Rd;
741}
742
743// AMulxyI with Ra operand
744class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
745 InstrItinClass itin, string opc, string asm, list<dag> pattern>
746 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
747 bits<4> Ra;
748 let Inst{15-12} = Ra;
749}
750// SMLAL*
751class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
752 InstrItinClass itin, string opc, string asm, list<dag> pattern>
753 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
754 bits<4> RdLo;
755 bits<4> RdHi;
756 let Inst{19-16} = RdHi;
757 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000758}
759
Evan Cheng97f48c32008-11-06 22:15:19 +0000760// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000761class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
762 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000763 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000764 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000765 // All AExtI instructions have Rd and Rm register operands.
766 bits<4> Rd;
767 bits<4> Rm;
768 let Inst{15-12} = Rd;
769 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000770 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000771 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000772 let Inst{27-20} = opcod;
773}
774
Evan Cheng8b59db32008-11-07 01:41:35 +0000775// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000776class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
777 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000778 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000779 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000780 bits<4> Rd;
781 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000782 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000783 let Inst{19-16} = 0b1111;
784 let Inst{15-12} = Rd;
785 let Inst{11-8} = 0b1111;
786 let Inst{7-4} = opc7_4;
787 let Inst{3-0} = Rm;
788}
789
790// PKH instructions
Jim Grosbachf6c05252011-07-21 17:23:04 +0000791def PKHLSLAsmOperand : AsmOperandClass {
792 let Name = "PKHLSLImm";
793 let ParserMethod = "parsePKHLSLImm";
794}
Jim Grosbachdde038a2011-07-20 21:40:26 +0000795def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
796 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000797 let ParserMatchClass = PKHLSLAsmOperand;
798}
799def PKHASRAsmOperand : AsmOperandClass {
800 let Name = "PKHASRImm";
801 let ParserMethod = "parsePKHASRImm";
Jim Grosbachdde038a2011-07-20 21:40:26 +0000802}
803def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
804 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000805 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbachdde038a2011-07-20 21:40:26 +0000806}
Jim Grosbach1769a3d2011-07-20 20:49:03 +0000807
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000808class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
809 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000810 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000811 opc, asm, "", pattern> {
812 bits<4> Rd;
813 bits<4> Rn;
814 bits<4> Rm;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000815 bits<5> sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000816 let Inst{27-20} = opcod;
817 let Inst{19-16} = Rn;
818 let Inst{15-12} = Rd;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000819 let Inst{11-7} = sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000820 let Inst{6} = tb;
821 let Inst{5-4} = 0b01;
822 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000823}
824
Evan Cheng37f25d92008-08-28 23:39:26 +0000825//===----------------------------------------------------------------------===//
826
827// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
828class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
829 list<Predicate> Predicates = [IsARM];
830}
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +0000831class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
832 list<Predicate> Predicates = [IsARM, HasV5T];
833}
Evan Cheng37f25d92008-08-28 23:39:26 +0000834class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
835 list<Predicate> Predicates = [IsARM, HasV5TE];
836}
837class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
838 list<Predicate> Predicates = [IsARM, HasV6];
839}
Evan Cheng13096642008-08-29 06:41:12 +0000840
841//===----------------------------------------------------------------------===//
Evan Cheng13096642008-08-29 06:41:12 +0000842// Thumb Instruction Format Definitions.
843//
844
Owen Anderson16884412011-07-13 23:22:26 +0000845class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000846 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000847 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000848 let OutOperandList = oops;
849 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000850 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000851 let Pattern = pattern;
852 list<Predicate> Predicates = [IsThumb];
853}
854
Bill Wendling43f7b2d2010-12-01 02:42:55 +0000855// TI - Thumb instruction.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000856class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000857 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000858
Evan Cheng35d6c412009-08-04 23:47:55 +0000859// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000860class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
861 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000862 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson01135592010-03-23 17:23:59 +0000863 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000864
Johnny Chend68e1192009-12-15 17:24:14 +0000865// tBL, tBX 32-bit instructions
866class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000867 dag oops, dag iops, InstrItinClass itin, string asm,
868 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000869 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson01135592010-03-23 17:23:59 +0000870 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000871 let Inst{31-27} = opcod1;
872 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000873 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000874}
Evan Cheng13096642008-08-29 06:41:12 +0000875
876// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000877class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
878 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000879 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000880
Evan Cheng09c39fc2009-06-23 19:38:13 +0000881// Thumb1 only
Owen Anderson16884412011-07-13 23:22:26 +0000882class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000883 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000884 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000885 let OutOperandList = oops;
886 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000887 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000888 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000889 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng09c39fc2009-06-23 19:38:13 +0000890}
891
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000892class T1I<dag oops, dag iops, InstrItinClass itin,
893 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000894 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000895class T1Ix2<dag oops, dag iops, InstrItinClass itin,
896 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000897 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000898
899// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000900class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000901 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000902 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000903 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000904
905// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson16884412011-07-13 23:22:26 +0000906class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000907 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000908 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000909 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +0000910 let OutOperandList = !con(oops, (outs s_cc_out:$s));
911 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000912 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000913 let Pattern = pattern;
Jim Grosbach47a0d522011-08-16 20:45:50 +0000914 let thumbArithFlagSetting = 1;
Jim Grosbach6797f892010-11-01 17:08:58 +0000915 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Anderson16280302011-08-16 23:45:44 +0000916 let DecoderNamespace = "ThumbSBit";
Evan Cheng446c4282009-07-11 06:43:01 +0000917}
918
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000919class T1sI<dag oops, dag iops, InstrItinClass itin,
920 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000921 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000922
923// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000924class T1sIt<dag oops, dag iops, InstrItinClass itin,
925 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000926 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling3f8c1102010-11-30 23:54:45 +0000927 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000928
929// Thumb1 instruction that can be predicated.
Owen Anderson16884412011-07-13 23:22:26 +0000930class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000931 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000932 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000933 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000934 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000935 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000936 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000937 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000938 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000939}
940
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000941class T1pI<dag oops, dag iops, InstrItinClass itin,
942 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000943 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000944
945// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000946class T1pIt<dag oops, dag iops, InstrItinClass itin,
947 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000948 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling0b424dc2010-12-01 01:32:02 +0000949 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000950
Bob Wilson01135592010-03-23 17:23:59 +0000951class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000952 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000953 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000954
Johnny Chenbbc71b22009-12-16 02:32:54 +0000955class Encoding16 : Encoding {
956 let Inst{31-16} = 0x0000;
957}
958
Johnny Chend68e1192009-12-15 17:24:14 +0000959// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +0000960class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000961 let Inst{15-10} = opcode;
962}
963
964// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000965class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000966 let Inst{15-14} = 0b00;
967 let Inst{13-9} = opcode;
968}
969
970// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000971class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000972 let Inst{15-10} = 0b010000;
973 let Inst{9-6} = opcode;
974}
975
976// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000977class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000978 let Inst{15-10} = 0b010001;
Bill Wendling6bc105a2010-11-17 00:45:23 +0000979 let Inst{9-6} = opcode;
Johnny Chend68e1192009-12-15 17:24:14 +0000980}
981
982// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000983class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000984 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000985 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +0000986}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000987class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +0000988
Eric Christopher33281b22011-05-27 03:50:53 +0000989class T1BranchCond<bits<4> opcode> : Encoding16 {
990 let Inst{15-12} = opcode;
991}
992
Bill Wendling1fd374e2010-11-30 22:57:21 +0000993// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling3f8c1102010-11-30 23:54:45 +0000994// following bits are used for "opA" (see A6.2.4):
Jim Grosbacha79bd0e2010-12-10 20:47:29 +0000995//
Bill Wendling1fd374e2010-11-30 22:57:21 +0000996// 0b0110 => Immediate, 4 bytes
997// 0b1000 => Immediate, 2 bytes
998// 0b0111 => Immediate, 1 byte
Bill Wendling40062fb2010-12-01 01:38:08 +0000999class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1000 InstrItinClass itin, string opc, string asm,
1001 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001002 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001003 T1LoadStore<0b0101, opcode> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001004 bits<3> Rt;
1005 bits<8> addr;
1006 let Inst{8-6} = addr{5-3}; // Rm
1007 let Inst{5-3} = addr{2-0}; // Rn
1008 let Inst{2-0} = Rt;
1009}
Bill Wendling40062fb2010-12-01 01:38:08 +00001010class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1011 InstrItinClass itin, string opc, string asm,
1012 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001013 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001014 T1LoadStore<opA, {opB,?,?}> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001015 bits<3> Rt;
1016 bits<8> addr;
1017 let Inst{10-6} = addr{7-3}; // imm5
1018 let Inst{5-3} = addr{2-0}; // Rn
1019 let Inst{2-0} = Rt;
1020}
1021
Johnny Chend68e1192009-12-15 17:24:14 +00001022// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001023class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001024 let Inst{15-12} = 0b1011;
1025 let Inst{11-5} = opcode;
1026}
1027
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001028// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001029class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001030 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001031 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001032 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001033 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001034 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001035 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001036 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001037 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001038 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001039}
1040
Bill Wendlingda2ae632010-08-31 07:50:46 +00001041// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1042// input operand since by default it's a zero register. It will become an
1043// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001044//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001045// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1046// more consistent.
Owen Anderson16884412011-07-13 23:22:26 +00001047class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001048 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001049 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001050 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersonbdf71442010-12-07 20:50:15 +00001051 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1052 let Inst{20} = s;
1053
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001054 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001055 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001056 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001057 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001058 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001059 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001060}
1061
1062// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001063class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001064 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001065 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001066 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001067 let OutOperandList = oops;
1068 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001069 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001070 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001071 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001072 let DecoderNamespace = "Thumb2";
Evan Chengf49810c2009-06-23 17:48:47 +00001073}
1074
Owen Anderson16884412011-07-13 23:22:26 +00001075class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +00001076 InstrItinClass itin,
1077 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001078 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1079 let OutOperandList = oops;
1080 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001081 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001082 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +00001083 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonf1a00902011-07-19 21:06:00 +00001084 let DecoderNamespace = "Thumb";
Jim Grosbachd1228742009-12-01 18:10:36 +00001085}
1086
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001087class T2I<dag oops, dag iops, InstrItinClass itin,
1088 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001089 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001090class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1091 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001092 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001093class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1094 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001095 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001096class T2Iso<dag oops, dag iops, InstrItinClass itin,
1097 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001098 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001099class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1100 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001101 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001102class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001103 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001104 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
Johnny Chend68e1192009-12-15 17:24:14 +00001105 pattern> {
Owen Anderson9d63d902010-12-01 19:18:46 +00001106 bits<4> Rt;
1107 bits<4> Rt2;
1108 bits<13> addr;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001109 let Inst{31-25} = 0b1110100;
1110 let Inst{24} = P;
1111 let Inst{23} = addr{8};
1112 let Inst{22} = 1;
1113 let Inst{21} = W;
1114 let Inst{20} = isLoad;
1115 let Inst{19-16} = addr{12-9};
Owen Anderson9d63d902010-12-01 19:18:46 +00001116 let Inst{15-12} = Rt{3-0};
1117 let Inst{11-8} = Rt2{3-0};
Owen Anderson9d63d902010-12-01 19:18:46 +00001118 let Inst{7-0} = addr{7-0};
Johnny Chend68e1192009-12-15 17:24:14 +00001119}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001120
Owen Anderson14c903a2011-08-04 23:18:05 +00001121class T2Ii8s4Tied<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1122 string opc, string asm, list<dag> pattern>
1123 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "$base = $wb",
1124 pattern> {
1125 bits<4> Rt;
1126 bits<4> Rt2;
1127 bits<4> base;
1128 bits<9> imm;
1129 let Inst{31-25} = 0b1110100;
1130 let Inst{24} = P;
1131 let Inst{23} = imm{8};
1132 let Inst{22} = 1;
1133 let Inst{21} = W;
1134 let Inst{20} = isLoad;
1135 let Inst{19-16} = base{3-0};
1136 let Inst{15-12} = Rt{3-0};
1137 let Inst{11-8} = Rt2{3-0};
1138 let Inst{7-0} = imm{7-0};
1139}
1140
1141
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001142class T2sI<dag oops, dag iops, InstrItinClass itin,
1143 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001144 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001145
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001146class T2XI<dag oops, dag iops, InstrItinClass itin,
1147 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001148 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001149class T2JTI<dag oops, dag iops, InstrItinClass itin,
1150 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001151 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001152
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001153// Move to/from coprocessor instructions
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001154class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
Jim Grosbach9bb098a2011-07-13 21:14:23 +00001155 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001156 let Inst{31-28} = opc;
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001157}
1158
Bob Wilson815baeb2010-03-13 01:08:20 +00001159// Two-address instructions
1160class T2XIt<dag oops, dag iops, InstrItinClass itin,
1161 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001162 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001163
Evan Chenge88d5ce2009-07-02 07:28:31 +00001164// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001165class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1166 dag oops, dag iops,
1167 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001168 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001169 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001170 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001171 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001172 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001173 let Pattern = pattern;
1174 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001175 let DecoderNamespace = "Thumb2";
Johnny Chend68e1192009-12-15 17:24:14 +00001176 let Inst{31-27} = 0b11111;
1177 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001178 let Inst{24} = signed;
1179 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001180 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001181 let Inst{20} = load;
1182 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001183 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001184 let Inst{10} = pre; // The P bit.
1185 let Inst{8} = 1; // The W bit.
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001186
Owen Anderson6af50f72010-11-30 00:14:31 +00001187 bits<9> addr;
1188 let Inst{7-0} = addr{7-0};
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001189 let Inst{9} = addr{8}; // Sign bit
1190
Owen Anderson6af50f72010-11-30 00:14:31 +00001191 bits<4> Rt;
1192 bits<4> Rn;
1193 let Inst{15-12} = Rt{3-0};
1194 let Inst{19-16} = Rn{3-0};
Evan Chenge88d5ce2009-07-02 07:28:31 +00001195}
1196
David Goodwinc9d138f2009-07-27 19:59:26 +00001197// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1198class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001199 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwinc9d138f2009-07-27 19:59:26 +00001200}
1201
1202// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1203class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001204 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwinc9d138f2009-07-27 19:59:26 +00001205}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001206
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +00001207// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1208class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1209 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1210}
1211
Evan Cheng9cb9e672009-06-27 02:26:13 +00001212// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1213class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001214 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001215}
1216
Evan Cheng13096642008-08-29 06:41:12 +00001217//===----------------------------------------------------------------------===//
1218
Evan Cheng96581d32008-11-11 02:11:05 +00001219//===----------------------------------------------------------------------===//
1220// ARM VFP Instruction templates.
1221//
1222
David Goodwin3ca524e2009-07-10 17:03:29 +00001223// Almost all VFP instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001224class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001225 IndexMode im, Format f, InstrItinClass itin,
1226 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001227 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001228 bits<4> p;
1229 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001230 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001231 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001232 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001233 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001234 let PostEncoderMethod = "VFPThumb2PostEncoder";
Owen Anderson8d7d2e12011-08-09 20:55:18 +00001235 let DecoderNamespace = "VFP";
David Goodwin3ca524e2009-07-10 17:03:29 +00001236 list<Predicate> Predicates = [HasVFP2];
1237}
1238
1239// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001240class VFPXI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001241 IndexMode im, Format f, InstrItinClass itin,
1242 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001243 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001244 bits<4> p;
1245 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001246 let OutOperandList = oops;
1247 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001248 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001249 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001250 let PostEncoderMethod = "VFPThumb2PostEncoder";
Owen Anderson8d7d2e12011-08-09 20:55:18 +00001251 let DecoderNamespace = "VFP";
David Goodwin3ca524e2009-07-10 17:03:29 +00001252 list<Predicate> Predicates = [HasVFP2];
1253}
1254
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001255class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1256 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001257 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendlingcf590262010-12-01 21:54:50 +00001258 opc, asm, "", pattern> {
1259 let PostEncoderMethod = "VFPThumb2PostEncoder";
1260}
David Goodwin3ca524e2009-07-10 17:03:29 +00001261
Evan Chengcd8e66a2008-11-11 21:48:44 +00001262// ARM VFP addrmode5 loads and stores
1263class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001264 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001265 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001266 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001267 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001268 // Instruction operands.
1269 bits<5> Dd;
1270 bits<13> addr;
1271
1272 // Encode instruction operands.
1273 let Inst{23} = addr{8}; // U (add = (U == '1'))
1274 let Inst{22} = Dd{4};
1275 let Inst{19-16} = addr{12-9}; // Rn
1276 let Inst{15-12} = Dd{3-0};
1277 let Inst{7-0} = addr{7-0}; // imm8
1278
Evan Cheng96581d32008-11-11 02:11:05 +00001279 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001280 let Inst{27-24} = opcod1;
1281 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001282 let Inst{11-9} = 0b101;
1283 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001284
Evan Cheng5eda2822011-02-16 00:35:02 +00001285 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001286 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001287}
1288
Evan Chengcd8e66a2008-11-11 21:48:44 +00001289class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001290 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001291 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001292 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001293 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001294 // Instruction operands.
1295 bits<5> Sd;
1296 bits<13> addr;
1297
1298 // Encode instruction operands.
1299 let Inst{23} = addr{8}; // U (add = (U == '1'))
1300 let Inst{22} = Sd{0};
1301 let Inst{19-16} = addr{12-9}; // Rn
1302 let Inst{15-12} = Sd{4-1};
1303 let Inst{7-0} = addr{7-0}; // imm8
1304
Evan Cheng96581d32008-11-11 02:11:05 +00001305 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001306 let Inst{27-24} = opcod1;
1307 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001308 let Inst{11-9} = 0b101;
1309 let Inst{8} = 0; // Single precision
Evan Cheng5eda2822011-02-16 00:35:02 +00001310
1311 // Loads & stores operate on both NEON and VFP pipelines.
1312 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001313}
1314
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001315// VFP Load / store multiple pseudo instructions.
1316class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1317 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001318 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001319 cstr, itin> {
1320 let OutOperandList = oops;
1321 let InOperandList = !con(iops, (ins pred:$p));
1322 let Pattern = pattern;
1323 list<Predicate> Predicates = [HasVFP2];
1324}
1325
Evan Chengcd8e66a2008-11-11 21:48:44 +00001326// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001327class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001328 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001329 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001330 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001331 // Instruction operands.
1332 bits<4> Rn;
1333 bits<13> regs;
1334
1335 // Encode instruction operands.
1336 let Inst{19-16} = Rn;
1337 let Inst{22} = regs{12};
1338 let Inst{15-12} = regs{11-8};
1339 let Inst{7-0} = regs{7-0};
1340
Evan Chengcd8e66a2008-11-11 21:48:44 +00001341 // TODO: Mark the instructions with the appropriate subtarget info.
1342 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001343 let Inst{11-9} = 0b101;
1344 let Inst{8} = 1; // Double precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001345}
1346
Jim Grosbach72db1822010-09-08 00:25:50 +00001347class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001348 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001349 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001350 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001351 // Instruction operands.
1352 bits<4> Rn;
1353 bits<13> regs;
1354
1355 // Encode instruction operands.
1356 let Inst{19-16} = Rn;
1357 let Inst{22} = regs{8};
1358 let Inst{15-12} = regs{12-9};
1359 let Inst{7-0} = regs{7-0};
1360
Evan Chengcd8e66a2008-11-11 21:48:44 +00001361 // TODO: Mark the instructions with the appropriate subtarget info.
1362 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001363 let Inst{11-9} = 0b101;
1364 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001365}
1366
Evan Cheng96581d32008-11-11 02:11:05 +00001367// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001368class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1369 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1370 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001371 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001372 // Instruction operands.
1373 bits<5> Dd;
1374 bits<5> Dm;
1375
1376 // Encode instruction operands.
1377 let Inst{3-0} = Dm{3-0};
1378 let Inst{5} = Dm{4};
1379 let Inst{15-12} = Dd{3-0};
1380 let Inst{22} = Dd{4};
1381
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001382 let Inst{27-23} = opcod1;
1383 let Inst{21-20} = opcod2;
1384 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001385 let Inst{11-9} = 0b101;
1386 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001387 let Inst{7-6} = opcod4;
1388 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001389}
1390
1391// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001392class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001393 dag iops, InstrItinClass itin, string opc, string asm,
1394 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001395 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001396 // Instruction operands.
1397 bits<5> Dd;
1398 bits<5> Dn;
1399 bits<5> Dm;
1400
1401 // Encode instruction operands.
1402 let Inst{3-0} = Dm{3-0};
1403 let Inst{5} = Dm{4};
1404 let Inst{19-16} = Dn{3-0};
1405 let Inst{7} = Dn{4};
1406 let Inst{15-12} = Dd{3-0};
1407 let Inst{22} = Dd{4};
1408
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001409 let Inst{27-23} = opcod1;
1410 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001411 let Inst{11-9} = 0b101;
1412 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001413 let Inst{6} = op6;
1414 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001415}
1416
1417// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001418class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1419 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1420 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001421 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001422 // Instruction operands.
1423 bits<5> Sd;
1424 bits<5> Sm;
1425
1426 // Encode instruction operands.
1427 let Inst{3-0} = Sm{4-1};
1428 let Inst{5} = Sm{0};
1429 let Inst{15-12} = Sd{4-1};
1430 let Inst{22} = Sd{0};
1431
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001432 let Inst{27-23} = opcod1;
1433 let Inst{21-20} = opcod2;
1434 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001435 let Inst{11-9} = 0b101;
1436 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001437 let Inst{7-6} = opcod4;
1438 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001439}
1440
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001441// Single precision unary, if no NEON. Same as ASuI except not available if
1442// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001443class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1444 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1445 string asm, list<dag> pattern>
1446 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1447 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001448 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1449}
1450
Evan Cheng96581d32008-11-11 02:11:05 +00001451// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001452class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1453 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001454 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001455 // Instruction operands.
1456 bits<5> Sd;
1457 bits<5> Sn;
1458 bits<5> Sm;
1459
1460 // Encode instruction operands.
1461 let Inst{3-0} = Sm{4-1};
1462 let Inst{5} = Sm{0};
1463 let Inst{19-16} = Sn{4-1};
1464 let Inst{7} = Sn{0};
1465 let Inst{15-12} = Sd{4-1};
1466 let Inst{22} = Sd{0};
1467
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001468 let Inst{27-23} = opcod1;
1469 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001470 let Inst{11-9} = 0b101;
1471 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001472 let Inst{6} = op6;
1473 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001474}
1475
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001476// Single precision binary, if no NEON. Same as ASbI except not available if
1477// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001478class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001479 dag iops, InstrItinClass itin, string opc, string asm,
1480 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001481 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001482 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling69661192010-11-01 06:00:39 +00001483
1484 // Instruction operands.
1485 bits<5> Sd;
1486 bits<5> Sn;
1487 bits<5> Sm;
1488
1489 // Encode instruction operands.
1490 let Inst{3-0} = Sm{4-1};
1491 let Inst{5} = Sm{0};
1492 let Inst{19-16} = Sn{4-1};
1493 let Inst{7} = Sn{0};
1494 let Inst{15-12} = Sd{4-1};
1495 let Inst{22} = Sd{0};
David Goodwin42a83f22009-08-04 17:53:06 +00001496}
1497
Evan Cheng80a11982008-11-12 06:41:41 +00001498// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001499class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1500 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1501 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001502 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001503 let Inst{27-23} = opcod1;
1504 let Inst{21-20} = opcod2;
1505 let Inst{19-16} = opcod3;
1506 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001507 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001508 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001509}
1510
Johnny Chen811663f2010-02-11 18:47:03 +00001511// VFP conversion between floating-point and fixed-point
1512class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001513 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1514 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001515 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1516 // size (fixed-point number): sx == 0 ? 16 : 32
1517 let Inst{7} = op5; // sx
1518}
1519
David Goodwin338268c2009-08-10 22:17:39 +00001520// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001521class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001522 dag oops, dag iops, InstrItinClass itin,
1523 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001524 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1525 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001526 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1527}
1528
Evan Cheng80a11982008-11-12 06:41:41 +00001529class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001530 InstrItinClass itin,
1531 string opc, string asm, list<dag> pattern>
1532 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001533 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001534 let Inst{11-8} = opcod2;
1535 let Inst{4} = 1;
1536}
1537
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001538class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1539 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1540 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001541
Bob Wilson01135592010-03-23 17:23:59 +00001542class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001543 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1544 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001545
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001546class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1547 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1548 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001549
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001550class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1551 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1552 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001553
Evan Cheng96581d32008-11-11 02:11:05 +00001554//===----------------------------------------------------------------------===//
1555
Bob Wilson5bafff32009-06-22 23:27:02 +00001556//===----------------------------------------------------------------------===//
1557// ARM NEON Instruction templates.
1558//
Evan Cheng13096642008-08-29 06:41:12 +00001559
Johnny Chencaa608e2010-03-20 00:17:00 +00001560class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1561 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1562 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001563 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001564 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001565 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001566 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001567 let Pattern = pattern;
1568 list<Predicate> Predicates = [HasNEON];
Owen Andersonef2865a2011-08-15 23:38:54 +00001569 let DecoderNamespace = "NEON";
Evan Chengf81bf152009-11-23 21:57:23 +00001570}
1571
1572// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001573class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1574 InstrItinClass itin, string opc, string asm, string cstr,
1575 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001576 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001577 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001578 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001579 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001580 let Pattern = pattern;
1581 list<Predicate> Predicates = [HasNEON];
Owen Andersonef2865a2011-08-15 23:38:54 +00001582 let DecoderNamespace = "NEON";
Evan Cheng13096642008-08-29 06:41:12 +00001583}
1584
Bob Wilsonb07c1712009-10-07 21:53:04 +00001585class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1586 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001587 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001588 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1589 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001590 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001591 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001592 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001593 let Inst{11-8} = op11_8;
1594 let Inst{7-4} = op7_4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001595
Chris Lattner2ac19022010-11-15 05:19:05 +00001596 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Owen Anderson8533eba2011-08-10 19:01:10 +00001597 let DecoderNamespace = "NEONLoadStore";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001598
Owen Andersond9aa7d32010-11-02 00:05:05 +00001599 bits<5> Vd;
Owen Andersonf431eda2010-11-02 23:47:29 +00001600 bits<6> Rn;
1601 bits<4> Rm;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001602
Owen Andersond9aa7d32010-11-02 00:05:05 +00001603 let Inst{22} = Vd{4};
1604 let Inst{15-12} = Vd{3-0};
Owen Andersonf431eda2010-11-02 23:47:29 +00001605 let Inst{19-16} = Rn{3-0};
1606 let Inst{3-0} = Rm{3-0};
Bob Wilson205a5ca2009-07-08 18:11:30 +00001607}
1608
Owen Andersond138d702010-11-02 20:47:39 +00001609class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1610 dag oops, dag iops, InstrItinClass itin,
1611 string opc, string dt, string asm, string cstr, list<dag> pattern>
1612 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1613 dt, asm, cstr, pattern> {
1614 bits<3> lane;
1615}
1616
Bob Wilson709d5922010-08-25 23:27:42 +00001617class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson16884412011-07-13 23:22:26 +00001618 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson709d5922010-08-25 23:27:42 +00001619 itin> {
1620 let OutOperandList = oops;
1621 let InOperandList = !con(iops, (ins pred:$p));
1622 list<Predicate> Predicates = [HasNEON];
1623}
1624
Jim Grosbach7cd27292010-10-06 20:36:55 +00001625class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1626 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001627 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonbd916c52010-09-13 23:55:10 +00001628 itin> {
1629 let OutOperandList = oops;
1630 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001631 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001632 list<Predicate> Predicates = [HasNEON];
1633}
1634
Johnny Chen785516a2010-03-23 16:43:47 +00001635class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001636 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001637 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1638 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001639 let Inst{31-25} = 0b1111001;
Chris Lattner2ac19022010-11-15 05:19:05 +00001640 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Owen Andersonef2865a2011-08-15 23:38:54 +00001641 let DecoderNamespace = "NEONData";
Evan Chengf81bf152009-11-23 21:57:23 +00001642}
1643
Johnny Chen927b88f2010-03-23 20:40:44 +00001644class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001645 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001646 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001647 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001648 let Inst{31-25} = 0b1111001;
Owen Andersonac00e962010-12-10 22:32:08 +00001649 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Owen Andersonef2865a2011-08-15 23:38:54 +00001650 let DecoderNamespace = "NEONData";
Bob Wilson5bafff32009-06-22 23:27:02 +00001651}
1652
1653// NEON "one register and a modified immediate" format.
1654class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1655 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001656 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001657 string opc, string dt, string asm, string cstr,
1658 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001659 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001660 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001661 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001662 let Inst{11-8} = op11_8;
1663 let Inst{7} = op7;
1664 let Inst{6} = op6;
1665 let Inst{5} = op5;
1666 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001667
Owen Andersona88ea032010-10-26 17:40:54 +00001668 // Instruction operands.
1669 bits<5> Vd;
1670 bits<13> SIMM;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001671
Owen Andersona88ea032010-10-26 17:40:54 +00001672 let Inst{15-12} = Vd{3-0};
1673 let Inst{22} = Vd{4};
1674 let Inst{24} = SIMM{7};
1675 let Inst{18-16} = SIMM{6-4};
1676 let Inst{3-0} = SIMM{3-0};
Owen Anderson8d7d2e12011-08-09 20:55:18 +00001677 let DecoderMethod = "DecodeNEONModImmInstruction";
Bob Wilson5bafff32009-06-22 23:27:02 +00001678}
1679
1680// NEON 2 vector register format.
1681class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1682 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001683 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001684 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001685 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001686 let Inst{24-23} = op24_23;
1687 let Inst{21-20} = op21_20;
1688 let Inst{19-18} = op19_18;
1689 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001690 let Inst{11-7} = op11_7;
1691 let Inst{6} = op6;
1692 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001693
Owen Anderson162875a2010-10-25 18:43:52 +00001694 // Instruction operands.
1695 bits<5> Vd;
1696 bits<5> Vm;
1697
1698 let Inst{15-12} = Vd{3-0};
1699 let Inst{22} = Vd{4};
1700 let Inst{3-0} = Vm{3-0};
1701 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001702}
1703
1704// Same as N2V except it doesn't have a datatype suffix.
1705class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001706 bits<5> op11_7, bit op6, bit op4,
1707 dag oops, dag iops, InstrItinClass itin,
1708 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001709 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001710 let Inst{24-23} = op24_23;
1711 let Inst{21-20} = op21_20;
1712 let Inst{19-18} = op19_18;
1713 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001714 let Inst{11-7} = op11_7;
1715 let Inst{6} = op6;
1716 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001717
Owen Anderson162875a2010-10-25 18:43:52 +00001718 // Instruction operands.
1719 bits<5> Vd;
1720 bits<5> Vm;
1721
1722 let Inst{15-12} = Vd{3-0};
1723 let Inst{22} = Vd{4};
1724 let Inst{3-0} = Vm{3-0};
1725 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001726}
1727
1728// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001729class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001730 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001731 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001732 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001733 let Inst{24} = op24;
1734 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001735 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001736 let Inst{7} = op7;
1737 let Inst{6} = op6;
1738 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001739
Owen Anderson3557d002010-10-26 20:56:57 +00001740 // Instruction operands.
1741 bits<5> Vd;
1742 bits<5> Vm;
1743 bits<6> SIMM;
1744
1745 let Inst{15-12} = Vd{3-0};
1746 let Inst{22} = Vd{4};
1747 let Inst{3-0} = Vm{3-0};
1748 let Inst{5} = Vm{4};
1749 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001750}
1751
Bob Wilson10bc69c2010-03-27 03:56:52 +00001752// NEON 3 vector register format.
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001753
Jim Grosbach6635b042011-05-19 17:34:53 +00001754class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1755 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1756 string opc, string dt, string asm, string cstr,
1757 list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001758 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001759 let Inst{24} = op24;
1760 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001761 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001762 let Inst{11-8} = op11_8;
1763 let Inst{6} = op6;
1764 let Inst{4} = op4;
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001765}
1766
1767class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1768 dag oops, dag iops, Format f, InstrItinClass itin,
1769 string opc, string dt, string asm, string cstr, list<dag> pattern>
1770 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1771 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001772
Owen Andersond451f882010-10-21 20:21:49 +00001773 // Instruction operands.
1774 bits<5> Vd;
1775 bits<5> Vn;
1776 bits<5> Vm;
1777
1778 let Inst{15-12} = Vd{3-0};
1779 let Inst{22} = Vd{4};
1780 let Inst{19-16} = Vn{3-0};
1781 let Inst{7} = Vn{4};
1782 let Inst{3-0} = Vm{3-0};
1783 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001784}
1785
Jim Grosbach6635b042011-05-19 17:34:53 +00001786class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1787 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1788 string opc, string dt, string asm, string cstr,
1789 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001790 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1791 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1792
1793 // Instruction operands.
1794 bits<5> Vd;
1795 bits<5> Vn;
1796 bits<5> Vm;
1797 bit lane;
1798
1799 let Inst{15-12} = Vd{3-0};
1800 let Inst{22} = Vd{4};
1801 let Inst{19-16} = Vn{3-0};
1802 let Inst{7} = Vn{4};
1803 let Inst{3-0} = Vm{3-0};
1804 let Inst{5} = lane;
1805}
1806
Jim Grosbach6635b042011-05-19 17:34:53 +00001807class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1808 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1809 string opc, string dt, string asm, string cstr,
1810 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001811 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1812 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1813
1814 // Instruction operands.
1815 bits<5> Vd;
1816 bits<5> Vn;
1817 bits<5> Vm;
1818 bits<2> lane;
1819
1820 let Inst{15-12} = Vd{3-0};
1821 let Inst{22} = Vd{4};
1822 let Inst{19-16} = Vn{3-0};
1823 let Inst{7} = Vn{4};
1824 let Inst{2-0} = Vm{2-0};
1825 let Inst{5} = lane{1};
1826 let Inst{3} = lane{0};
1827}
1828
Johnny Chen841e8282010-03-23 21:35:03 +00001829// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001830class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1831 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001832 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001833 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001834 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001835 let Inst{24} = op24;
1836 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001837 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001838 let Inst{11-8} = op11_8;
1839 let Inst{6} = op6;
1840 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001841
Owen Anderson8c71eff2010-10-25 18:28:30 +00001842 // Instruction operands.
1843 bits<5> Vd;
1844 bits<5> Vn;
1845 bits<5> Vm;
1846
1847 let Inst{15-12} = Vd{3-0};
1848 let Inst{22} = Vd{4};
1849 let Inst{19-16} = Vn{3-0};
1850 let Inst{7} = Vn{4};
1851 let Inst{3-0} = Vm{3-0};
1852 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001853}
1854
1855// NEON VMOVs between scalar and core registers.
1856class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001857 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001858 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001859 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001860 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001861 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001862 let Inst{11-8} = opcod2;
1863 let Inst{6-5} = opcod3;
1864 let Inst{4} = 1;
Johnny Chena9611542011-04-06 18:27:46 +00001865 // A8.6.303, A8.6.328, A8.6.329
1866 let Inst{3-0} = 0b0000;
Evan Chengf81bf152009-11-23 21:57:23 +00001867
1868 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001869 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001870 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001871 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001872 list<Predicate> Predicates = [HasNEON];
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001873
Chris Lattner2ac19022010-11-15 05:19:05 +00001874 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Owen Anderson8533eba2011-08-10 19:01:10 +00001875 let DecoderNamespace = "NEONDup";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001876
Owen Andersond2fbdb72010-10-27 21:28:09 +00001877 bits<5> V;
1878 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001879 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001880 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001881
Owen Andersonf587a9352010-10-27 19:25:54 +00001882 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001883 let Inst{7} = V{4};
1884 let Inst{19-16} = V{3-0};
1885 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001886}
1887class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001888 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001889 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001890 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001891 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001892class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001893 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001894 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001895 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001896 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001897class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001898 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001899 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001900 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001901 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001902
Johnny Chene4614f72010-03-25 17:01:27 +00001903// Vector Duplicate Lane (from scalar to all elements)
1904class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1905 InstrItinClass itin, string opc, string dt, string asm,
1906 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001907 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001908 let Inst{24-23} = 0b11;
1909 let Inst{21-20} = 0b11;
1910 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001911 let Inst{11-7} = 0b11000;
1912 let Inst{6} = op6;
1913 let Inst{4} = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001914
Owen Andersonf587a9352010-10-27 19:25:54 +00001915 bits<5> Vd;
1916 bits<5> Vm;
1917 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001918
Owen Andersonf587a9352010-10-27 19:25:54 +00001919 let Inst{22} = Vd{4};
1920 let Inst{15-12} = Vd{3-0};
1921 let Inst{5} = Vm{4};
1922 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001923}
1924
David Goodwin42a83f22009-08-04 17:53:06 +00001925// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1926// for single-precision FP.
1927class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1928 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1929}