blob: fecc6bfdef8451a33c69559e58c844243f39f96e [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"; }
Evan Cheng446c4282009-07-11 06:43:01 +0000151def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
152 (ops (i32 14), (i32 zero_reg))> {
153 let PrintMethod = "printPredicateOperand";
Daniel Dunbar8462b302010-08-11 06:36:53 +0000154 let ParserMatchClass = CondCodeOperand;
Owen Anderson8d7d2e12011-08-09 20:55:18 +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;
Owen Anderson8d7d2e12011-08-09 20:55:18 +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;
Owen Anderson8d7d2e12011-08-09 20:55:18 +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//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000222// ARM Instruction templates.
223//
224
Owen Anderson16884412011-07-13 23:22:26 +0000225class InstTemplate<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000226 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000227 : Instruction {
228 let Namespace = "ARM";
229
Evan Cheng37f25d92008-08-28 23:39:26 +0000230 AddrMode AM = am;
Owen Anderson16884412011-07-13 23:22:26 +0000231 int Size = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000232 IndexMode IM = im;
233 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000234 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000235 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000236 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000237 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000238 bit canXformTo16Bit = 0;
Jim Grosbach47a0d522011-08-16 20:45:50 +0000239 // The instruction is a 16-bit flag setting Thumb instruction. Used
240 // by the parser to determine whether to require the 'S' suffix on the
241 // mnemonic (when not in an IT block) or preclude it (when in an IT block).
242 bit thumbArithFlagSetting = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +0000243
Chris Lattner150d20e2010-10-31 19:22:57 +0000244 // If this is a pseudo instruction, mark it isCodeGenOnly.
245 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson01135592010-03-23 17:23:59 +0000246
Jim Grosbach8757a4c2011-08-15 16:52:24 +0000247 // The layout of TSFlags should be kept in sync with ARMBaseInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000248 let TSFlags{4-0} = AM.Value;
Owen Anderson16884412011-07-13 23:22:26 +0000249 let TSFlags{6-5} = IndexModeBits;
250 let TSFlags{12-7} = Form;
251 let TSFlags{13} = isUnaryDataProc;
252 let TSFlags{14} = canXformTo16Bit;
253 let TSFlags{17-15} = D.Value;
Jim Grosbach47a0d522011-08-16 20:45:50 +0000254 let TSFlags{18} = thumbArithFlagSetting;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000255
Evan Cheng37f25d92008-08-28 23:39:26 +0000256 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000257 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000258}
259
Johnny Chend68e1192009-12-15 17:24:14 +0000260class Encoding {
261 field bits<32> Inst;
262}
263
Owen Anderson16884412011-07-13 23:22:26 +0000264class InstARM<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000265 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000266 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
267 let DecoderNamespace = "ARM";
268}
Johnny Chend68e1192009-12-15 17:24:14 +0000269
270// This Encoding-less class is used by Thumb1 to specify the encoding bits later
271// on by adding flavors to specific instructions.
Owen Anderson16884412011-07-13 23:22:26 +0000272class InstThumb<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000273 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000274 : InstTemplate<am, sz, im, f, d, cstr, itin> {
275 let DecoderNamespace = "Thumb";
276}
Johnny Chend68e1192009-12-15 17:24:14 +0000277
Jim Grosbach99594eb2010-11-18 01:38:26 +0000278class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000279 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000280 GenericDomain, "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000281 let OutOperandList = oops;
282 let InOperandList = iops;
Evan Cheng37f25d92008-08-28 23:39:26 +0000283 let Pattern = pattern;
Jim Grosbacha768c3d2011-03-10 19:06:39 +0000284 let isCodeGenOnly = 1;
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000285 let isPseudo = 1;
Evan Cheng37f25d92008-08-28 23:39:26 +0000286}
287
Jim Grosbach53694262010-11-18 01:15:56 +0000288// PseudoInst that's ARM-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000289class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach99594eb2010-11-18 01:38:26 +0000290 list<dag> pattern>
291 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000292 let Size = sz;
Jim Grosbach53694262010-11-18 01:15:56 +0000293 list<Predicate> Predicates = [IsARM];
294}
295
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000296// PseudoInst that's Thumb-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000297class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000298 list<dag> pattern>
299 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000300 let Size = sz;
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000301 list<Predicate> Predicates = [IsThumb];
302}
Jim Grosbach53694262010-11-18 01:15:56 +0000303
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000304// PseudoInst that's Thumb2-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000305class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000306 list<dag> pattern>
307 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000308 let Size = sz;
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000309 list<Predicate> Predicates = [IsThumb2];
310}
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000311
Owen Anderson16884412011-07-13 23:22:26 +0000312class ARMPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000313 InstrItinClass itin, list<dag> pattern,
314 dag Result>
315 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
316 PseudoInstExpansion<Result>;
317
Owen Anderson16884412011-07-13 23:22:26 +0000318class tPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000319 InstrItinClass itin, list<dag> pattern,
320 dag Result>
321 : tPseudoInst<oops, iops, sz, itin, pattern>,
322 PseudoInstExpansion<Result>;
323
Owen Anderson16884412011-07-13 23:22:26 +0000324class t2PseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000325 InstrItinClass itin, list<dag> pattern,
326 dag Result>
327 : t2PseudoInst<oops, iops, sz, itin, pattern>,
328 PseudoInstExpansion<Result>;
329
Evan Cheng37f25d92008-08-28 23:39:26 +0000330// Almost all ARM instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +0000331class I<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000332 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000333 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000334 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000335 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000336 bits<4> p;
337 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000338 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000339 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000340 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000341 let Pattern = pattern;
342 list<Predicate> Predicates = [IsARM];
343}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000344
Jim Grosbachf6b28622009-12-14 18:31:20 +0000345// A few are not predicable
Owen Anderson16884412011-07-13 23:22:26 +0000346class InoP<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000347 IndexMode im, Format f, InstrItinClass itin,
348 string opc, string asm, string cstr,
349 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000350 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
351 let OutOperandList = oops;
352 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000353 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000354 let Pattern = pattern;
355 let isPredicable = 0;
356 list<Predicate> Predicates = [IsARM];
357}
Evan Cheng37f25d92008-08-28 23:39:26 +0000358
Bill Wendling4822bce2010-08-30 01:47:35 +0000359// Same as I except it can optionally modify CPSR. Note it's modeled as an input
360// operand since by default it's a zero register. It will become an implicit def
361// once it's "flipped".
Owen Anderson16884412011-07-13 23:22:26 +0000362class sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000363 IndexMode im, Format f, InstrItinClass itin,
364 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000365 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000366 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000367 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000368 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000369 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000370 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000371
Evan Cheng37f25d92008-08-28 23:39:26 +0000372 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000373 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000374 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000375 let Pattern = pattern;
376 list<Predicate> Predicates = [IsARM];
377}
378
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000379// Special cases
Owen Anderson16884412011-07-13 23:22:26 +0000380class XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000381 IndexMode im, Format f, InstrItinClass itin,
382 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000383 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000384 let OutOperandList = oops;
385 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000386 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000387 let Pattern = pattern;
388 list<Predicate> Predicates = [IsARM];
389}
390
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000391class AI<dag oops, dag iops, Format f, InstrItinClass itin,
392 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000393 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000394 opc, asm, "", pattern>;
395class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
396 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000397 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000398 opc, asm, "", pattern>;
399class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000400 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000401 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000402 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000403class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000404 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000405 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000406 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000407
408// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000409class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
410 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000411 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000412 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000413 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000414}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000415class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
416 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000417 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000418 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000419 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000420}
Evan Cheng3aac7882008-09-01 08:25:56 +0000421
422// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000423class JTI<dag oops, dag iops, InstrItinClass itin,
424 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000425 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000426 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000427
Jim Grosbach5278eb82009-12-11 01:42:04 +0000428// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000429class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
430 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000431 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000432 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000433 bits<4> Rt;
Jim Grosbachdfdf02d2011-07-26 17:44:46 +0000434 bits<4> addr;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000435 let Inst{27-23} = 0b00011;
436 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000437 let Inst{20} = 1;
Jim Grosbachdfdf02d2011-07-26 17:44:46 +0000438 let Inst{19-16} = addr;
Jim Grosbach86875a22010-10-29 19:58:57 +0000439 let Inst{15-12} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000440 let Inst{11-0} = 0b111110011111;
441}
442class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
443 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000444 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000445 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000446 bits<4> Rd;
447 bits<4> Rt;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000448 bits<4> addr;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000449 let Inst{27-23} = 0b00011;
450 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000451 let Inst{20} = 0;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000452 let Inst{19-16} = addr;
Jim Grosbach86875a22010-10-29 19:58:57 +0000453 let Inst{15-12} = Rd;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000454 let Inst{11-4} = 0b11111001;
Jim Grosbach86875a22010-10-29 19:58:57 +0000455 let Inst{3-0} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000456}
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000457class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000458 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000459 bits<4> Rt;
460 bits<4> Rt2;
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000461 bits<4> addr;
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000462 let Inst{27-23} = 0b00010;
463 let Inst{22} = b;
464 let Inst{21-20} = 0b00;
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000465 let Inst{19-16} = addr;
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000466 let Inst{15-12} = Rt;
467 let Inst{11-4} = 0b00001001;
468 let Inst{3-0} = Rt2;
469}
Jim Grosbach5278eb82009-12-11 01:42:04 +0000470
Evan Cheng0d14fc82008-09-01 01:51:14 +0000471// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000472class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
473 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000474 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000475 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000476 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000477 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000478}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000479class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
480 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000481 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000482 opc, asm, "", pattern> {
483 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000484 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000485}
486class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000487 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000488 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000489 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000490 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000491 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000492}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000493
Evan Cheng93912732008-09-01 01:27:33 +0000494// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000495
Jim Grosbach9558b4c2010-11-19 21:07:51 +0000496// LDR/LDRB/STR/STRB/...
497class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000498 Format f, InstrItinClass itin, string opc, string asm,
499 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000500 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
Jim Grosbach3e556122010-10-26 22:37:02 +0000501 "", pattern> {
502 let Inst{27-25} = op;
503 let Inst{24} = 1; // 24 == P
504 // 23 == U
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000505 let Inst{22} = isByte;
Jim Grosbach3e556122010-10-26 22:37:02 +0000506 let Inst{21} = 0; // 21 == W
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000507 let Inst{20} = isLd;
Jim Grosbach3e556122010-10-26 22:37:02 +0000508}
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000509// Indexed load/stores
510class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000511 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000512 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000513 : I<oops, iops, AddrMode2, 4, im, f, itin,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000514 opc, asm, cstr, pattern> {
Jim Grosbach99f53d12010-11-15 20:47:07 +0000515 bits<4> Rt;
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000516 let Inst{27-26} = 0b01;
517 let Inst{24} = isPre; // P bit
518 let Inst{22} = isByte; // B bit
519 let Inst{21} = isPre; // W bit
520 let Inst{20} = isLd; // L bit
Jim Grosbach99f53d12010-11-15 20:47:07 +0000521 let Inst{15-12} = Rt;
Jim Grosbach3e556122010-10-26 22:37:02 +0000522}
Owen Anderson793e7962011-07-26 20:54:26 +0000523class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000524 IndexMode im, Format f, InstrItinClass itin, string opc,
525 string asm, string cstr, list<dag> pattern>
526 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
527 pattern> {
528 // AM2 store w/ two operands: (GPR, am2offset)
Jim Grosbach953557f42010-11-19 21:35:06 +0000529 // {12} isAdd
530 // {11-0} imm12/Rm
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000531 bits<14> offset;
532 bits<4> Rn;
Owen Anderson793e7962011-07-26 20:54:26 +0000533 let Inst{25} = 1;
534 let Inst{23} = offset{12};
535 let Inst{19-16} = Rn;
536 let Inst{11-5} = offset{11-5};
537 let Inst{4} = 0;
538 let Inst{3-0} = offset{3-0};
539}
540
541class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
542 IndexMode im, Format f, InstrItinClass itin, string opc,
543 string asm, string cstr, list<dag> pattern>
544 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
545 pattern> {
546 // AM2 store w/ two operands: (GPR, am2offset)
547 // {12} isAdd
548 // {11-0} imm12/Rm
549 bits<14> offset;
550 bits<4> Rn;
551 let Inst{25} = 0;
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000552 let Inst{23} = offset{12};
553 let Inst{19-16} = Rn;
554 let Inst{11-0} = offset{11-0};
Jim Grosbach953557f42010-11-19 21:35:06 +0000555}
Owen Anderson793e7962011-07-26 20:54:26 +0000556
557
Bruno Cardoso Lopesae085542011-03-31 23:26:08 +0000558// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
559// but for now use this class for STRT and STRBT.
560class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
561 IndexMode im, Format f, InstrItinClass itin, string opc,
562 string asm, string cstr, list<dag> pattern>
563 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
564 pattern> {
565 // AM2 store w/ two operands: (GPR, am2offset)
566 // {17-14} Rn
567 // {13} 1 == Rm, 0 == imm12
568 // {12} isAdd
569 // {11-0} imm12/Rm
570 bits<18> addr;
571 let Inst{25} = addr{13};
572 let Inst{23} = addr{12};
573 let Inst{19-16} = addr{17-14};
574 let Inst{11-0} = addr{11-0};
575}
Jim Grosbach3e556122010-10-26 22:37:02 +0000576
Evan Cheng0d14fc82008-09-01 01:51:14 +0000577// addrmode3 instructions
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000578class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
579 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000580 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach160f8f02010-11-18 00:46:58 +0000581 opc, asm, "", pattern> {
582 bits<14> addr;
583 bits<4> Rt;
584 let Inst{27-25} = 0b000;
585 let Inst{24} = 1; // P bit
586 let Inst{23} = addr{8}; // U bit
587 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
588 let Inst{21} = 0; // W bit
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000589 let Inst{20} = op20; // L bit
Jim Grosbach160f8f02010-11-18 00:46:58 +0000590 let Inst{19-16} = addr{12-9}; // Rn
591 let Inst{15-12} = Rt; // Rt
592 let Inst{11-8} = addr{7-4}; // imm7_4/zero
593 let Inst{7-4} = op;
594 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Owen Anderson8d7d2e12011-08-09 20:55:18 +0000595
596 let DecoderMethod = "DecodeAddrMode3Instruction";
Jim Grosbach160f8f02010-11-18 00:46:58 +0000597}
Evan Cheng840917b2008-09-01 07:00:14 +0000598
Jim Grosbach45251b32011-08-11 20:41:13 +0000599class AI3ldstidx<bits<4> op, bit op20, bit isPre, dag oops, dag iops,
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000600 IndexMode im, Format f, InstrItinClass itin, string opc,
601 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000602 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000603 opc, asm, cstr, pattern> {
604 bits<4> Rt;
605 let Inst{27-25} = 0b000;
606 let Inst{24} = isPre; // P bit
607 let Inst{21} = isPre; // W bit
608 let Inst{20} = op20; // L bit
609 let Inst{15-12} = Rt; // Rt
610 let Inst{7-4} = op;
611}
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000612
613// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
614// but for now use this class for LDRSBT, LDRHT, LDSHT.
Jim Grosbach7ce05792011-08-03 23:50:40 +0000615class AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000616 IndexMode im, Format f, InstrItinClass itin, string opc,
617 string asm, string cstr, list<dag> pattern>
Jim Grosbach7ce05792011-08-03 23:50:40 +0000618 : I<oops, iops, AddrMode3, 4, im, f, itin, opc, asm, cstr, pattern> {
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000619 // {13} 1 == imm8, 0 == Rm
620 // {12-9} Rn
621 // {8} isAdd
622 // {7-4} imm7_4/zero
623 // {3-0} imm3_0/Rm
Jim Grosbach7ce05792011-08-03 23:50:40 +0000624 bits<4> addr;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000625 bits<4> Rt;
626 let Inst{27-25} = 0b000;
Jim Grosbach7ce05792011-08-03 23:50:40 +0000627 let Inst{24} = 0; // P bit
628 let Inst{21} = 1;
629 let Inst{20} = isLoad; // L bit
630 let Inst{19-16} = addr; // Rn
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000631 let Inst{15-12} = Rt; // Rt
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000632 let Inst{7-4} = op;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000633}
634
Evan Cheng840917b2008-09-01 07:00:14 +0000635// stores
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000636class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000637 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000638 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000639 opc, asm, "", pattern> {
Jim Grosbach570a9222010-11-11 01:09:40 +0000640 bits<14> addr;
641 bits<4> Rt;
Evan Chengdda0f4c2009-07-08 22:51:32 +0000642 let Inst{27-25} = 0b000;
Jim Grosbach570a9222010-11-11 01:09:40 +0000643 let Inst{24} = 1; // P bit
644 let Inst{23} = addr{8}; // U bit
645 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
646 let Inst{21} = 0; // W bit
647 let Inst{20} = 0; // L bit
648 let Inst{19-16} = addr{12-9}; // Rn
649 let Inst{15-12} = Rt; // Rt
650 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000651 let Inst{7-4} = op;
Jim Grosbach570a9222010-11-11 01:09:40 +0000652 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Owen Anderson79628e92011-08-12 20:02:50 +0000653 let DecoderMethod = "DecodeAddrMode3Instruction";
Evan Cheng840917b2008-09-01 07:00:14 +0000654}
Evan Cheng840917b2008-09-01 07:00:14 +0000655
Evan Cheng0d14fc82008-09-01 01:51:14 +0000656// addrmode4 instructions
Bill Wendling6c470b82010-11-13 09:09:38 +0000657class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
658 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000659 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000660 bits<4> p;
661 bits<16> regs;
662 bits<4> Rn;
663 let Inst{31-28} = p;
664 let Inst{27-25} = 0b100;
665 let Inst{22} = 0; // S bit
666 let Inst{19-16} = Rn;
667 let Inst{15-0} = regs;
668}
Evan Cheng37f25d92008-08-28 23:39:26 +0000669
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000670// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000671class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
672 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000673 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000674 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000675 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000676 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000677 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000678}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000679class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
680 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000681 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000682 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000683 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000684 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000685}
686
687// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000688class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
689 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000690 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000691 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000692 bits<4> Rd;
693 bits<4> Rn;
694 bits<4> Rm;
695 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000696 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000697 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000698 let Inst{19-16} = Rd;
699 let Inst{11-8} = Rm;
700 let Inst{3-0} = Rn;
701}
702// MSW multiple w/ Ra operand
703class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
704 InstrItinClass itin, string opc, string asm, list<dag> pattern>
705 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
706 bits<4> Ra;
707 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000708}
Evan Cheng37f25d92008-08-28 23:39:26 +0000709
Evan Chengeb4f52e2008-11-06 03:35:07 +0000710// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000711class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000712 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000713 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000714 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000715 bits<4> Rn;
716 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000717 let Inst{4} = 0;
718 let Inst{7} = 1;
719 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000720 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000721 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000722 let Inst{11-8} = Rm;
723 let Inst{3-0} = Rn;
724}
725class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
726 InstrItinClass itin, string opc, string asm, list<dag> pattern>
727 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
728 bits<4> Rd;
729 let Inst{19-16} = Rd;
730}
731
732// AMulxyI with Ra operand
733class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
734 InstrItinClass itin, string opc, string asm, list<dag> pattern>
735 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
736 bits<4> Ra;
737 let Inst{15-12} = Ra;
738}
739// SMLAL*
740class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
741 InstrItinClass itin, string opc, string asm, list<dag> pattern>
742 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
743 bits<4> RdLo;
744 bits<4> RdHi;
745 let Inst{19-16} = RdHi;
746 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000747}
748
Evan Cheng97f48c32008-11-06 22:15:19 +0000749// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000750class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
751 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000752 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000753 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000754 // All AExtI instructions have Rd and Rm register operands.
755 bits<4> Rd;
756 bits<4> Rm;
757 let Inst{15-12} = Rd;
758 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000759 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000760 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000761 let Inst{27-20} = opcod;
762}
763
Evan Cheng8b59db32008-11-07 01:41:35 +0000764// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000765class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
766 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000767 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000768 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000769 bits<4> Rd;
770 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000771 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000772 let Inst{19-16} = 0b1111;
773 let Inst{15-12} = Rd;
774 let Inst{11-8} = 0b1111;
775 let Inst{7-4} = opc7_4;
776 let Inst{3-0} = Rm;
777}
778
779// PKH instructions
Jim Grosbachf6c05252011-07-21 17:23:04 +0000780def PKHLSLAsmOperand : AsmOperandClass {
781 let Name = "PKHLSLImm";
782 let ParserMethod = "parsePKHLSLImm";
783}
Jim Grosbachdde038a2011-07-20 21:40:26 +0000784def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
785 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000786 let ParserMatchClass = PKHLSLAsmOperand;
787}
788def PKHASRAsmOperand : AsmOperandClass {
789 let Name = "PKHASRImm";
790 let ParserMethod = "parsePKHASRImm";
Jim Grosbachdde038a2011-07-20 21:40:26 +0000791}
792def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
793 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000794 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbachdde038a2011-07-20 21:40:26 +0000795}
Jim Grosbach1769a3d2011-07-20 20:49:03 +0000796
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000797class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
798 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000799 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000800 opc, asm, "", pattern> {
801 bits<4> Rd;
802 bits<4> Rn;
803 bits<4> Rm;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000804 bits<5> sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000805 let Inst{27-20} = opcod;
806 let Inst{19-16} = Rn;
807 let Inst{15-12} = Rd;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000808 let Inst{11-7} = sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000809 let Inst{6} = tb;
810 let Inst{5-4} = 0b01;
811 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000812}
813
Evan Cheng37f25d92008-08-28 23:39:26 +0000814//===----------------------------------------------------------------------===//
815
816// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
817class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
818 list<Predicate> Predicates = [IsARM];
819}
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +0000820class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
821 list<Predicate> Predicates = [IsARM, HasV5T];
822}
Evan Cheng37f25d92008-08-28 23:39:26 +0000823class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
824 list<Predicate> Predicates = [IsARM, HasV5TE];
825}
826class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
827 list<Predicate> Predicates = [IsARM, HasV6];
828}
Evan Cheng13096642008-08-29 06:41:12 +0000829
830//===----------------------------------------------------------------------===//
Evan Cheng13096642008-08-29 06:41:12 +0000831// Thumb Instruction Format Definitions.
832//
833
Owen Anderson16884412011-07-13 23:22:26 +0000834class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000835 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000836 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000837 let OutOperandList = oops;
838 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000839 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000840 let Pattern = pattern;
841 list<Predicate> Predicates = [IsThumb];
842}
843
Bill Wendling43f7b2d2010-12-01 02:42:55 +0000844// TI - Thumb instruction.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000845class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000846 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000847
Evan Cheng35d6c412009-08-04 23:47:55 +0000848// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000849class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
850 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000851 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson01135592010-03-23 17:23:59 +0000852 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000853
Johnny Chend68e1192009-12-15 17:24:14 +0000854// tBL, tBX 32-bit instructions
855class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000856 dag oops, dag iops, InstrItinClass itin, string asm,
857 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000858 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson01135592010-03-23 17:23:59 +0000859 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000860 let Inst{31-27} = opcod1;
861 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000862 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000863}
Evan Cheng13096642008-08-29 06:41:12 +0000864
865// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000866class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
867 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000868 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000869
Evan Cheng09c39fc2009-06-23 19:38:13 +0000870// Thumb1 only
Owen Anderson16884412011-07-13 23:22:26 +0000871class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000872 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000873 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000874 let OutOperandList = oops;
875 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000876 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000877 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000878 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng09c39fc2009-06-23 19:38:13 +0000879}
880
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000881class T1I<dag oops, dag iops, InstrItinClass itin,
882 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000883 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000884class T1Ix2<dag oops, dag iops, InstrItinClass itin,
885 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000886 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000887
888// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000889class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000890 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000891 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000892 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000893
894// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson16884412011-07-13 23:22:26 +0000895class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000896 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000897 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000898 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +0000899 let OutOperandList = !con(oops, (outs s_cc_out:$s));
900 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000901 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000902 let Pattern = pattern;
Jim Grosbach47a0d522011-08-16 20:45:50 +0000903 let thumbArithFlagSetting = 1;
Jim Grosbach6797f892010-11-01 17:08:58 +0000904 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000905}
906
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000907class T1sI<dag oops, dag iops, InstrItinClass itin,
908 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000909 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000910
911// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000912class T1sIt<dag oops, dag iops, InstrItinClass itin,
913 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000914 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling3f8c1102010-11-30 23:54:45 +0000915 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000916
917// Thumb1 instruction that can be predicated.
Owen Anderson16884412011-07-13 23:22:26 +0000918class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000919 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000920 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000921 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000922 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000923 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000924 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000925 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000926 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000927}
928
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000929class T1pI<dag oops, dag iops, InstrItinClass itin,
930 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000931 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000932
933// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000934class T1pIt<dag oops, dag iops, InstrItinClass itin,
935 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000936 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling0b424dc2010-12-01 01:32:02 +0000937 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000938
Bob Wilson01135592010-03-23 17:23:59 +0000939class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000940 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000941 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000942
Johnny Chenbbc71b22009-12-16 02:32:54 +0000943class Encoding16 : Encoding {
944 let Inst{31-16} = 0x0000;
945}
946
Johnny Chend68e1192009-12-15 17:24:14 +0000947// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +0000948class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000949 let Inst{15-10} = opcode;
950}
951
952// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000953class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000954 let Inst{15-14} = 0b00;
955 let Inst{13-9} = opcode;
956}
957
958// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000959class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000960 let Inst{15-10} = 0b010000;
961 let Inst{9-6} = opcode;
962}
963
964// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000965class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000966 let Inst{15-10} = 0b010001;
Bill Wendling6bc105a2010-11-17 00:45:23 +0000967 let Inst{9-6} = opcode;
Johnny Chend68e1192009-12-15 17:24:14 +0000968}
969
970// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000971class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000972 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000973 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +0000974}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000975class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +0000976
Eric Christopher33281b22011-05-27 03:50:53 +0000977class T1BranchCond<bits<4> opcode> : Encoding16 {
978 let Inst{15-12} = opcode;
979}
980
Bill Wendling1fd374e2010-11-30 22:57:21 +0000981// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling3f8c1102010-11-30 23:54:45 +0000982// following bits are used for "opA" (see A6.2.4):
Jim Grosbacha79bd0e2010-12-10 20:47:29 +0000983//
Bill Wendling1fd374e2010-11-30 22:57:21 +0000984// 0b0110 => Immediate, 4 bytes
985// 0b1000 => Immediate, 2 bytes
986// 0b0111 => Immediate, 1 byte
Bill Wendling40062fb2010-12-01 01:38:08 +0000987class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
988 InstrItinClass itin, string opc, string asm,
989 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000990 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +0000991 T1LoadStore<0b0101, opcode> {
Bill Wendling1fd374e2010-11-30 22:57:21 +0000992 bits<3> Rt;
993 bits<8> addr;
994 let Inst{8-6} = addr{5-3}; // Rm
995 let Inst{5-3} = addr{2-0}; // Rn
996 let Inst{2-0} = Rt;
997}
Bill Wendling40062fb2010-12-01 01:38:08 +0000998class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
999 InstrItinClass itin, string opc, string asm,
1000 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001001 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001002 T1LoadStore<opA, {opB,?,?}> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001003 bits<3> Rt;
1004 bits<8> addr;
1005 let Inst{10-6} = addr{7-3}; // imm5
1006 let Inst{5-3} = addr{2-0}; // Rn
1007 let Inst{2-0} = Rt;
1008}
1009
Johnny Chend68e1192009-12-15 17:24:14 +00001010// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001011class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001012 let Inst{15-12} = 0b1011;
1013 let Inst{11-5} = opcode;
1014}
1015
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001016// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001017class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001018 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001019 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001020 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001021 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001022 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001023 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001024 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001025 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001026 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001027}
1028
Bill Wendlingda2ae632010-08-31 07:50:46 +00001029// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1030// input operand since by default it's a zero register. It will become an
1031// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001032//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001033// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1034// more consistent.
Owen Anderson16884412011-07-13 23:22:26 +00001035class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001036 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001037 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001038 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersonbdf71442010-12-07 20:50:15 +00001039 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1040 let Inst{20} = s;
1041
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001042 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001043 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001044 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001045 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001046 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001047 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001048}
1049
1050// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001051class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001052 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001053 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001054 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001055 let OutOperandList = oops;
1056 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001057 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001058 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001059 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001060 let DecoderNamespace = "Thumb2";
Evan Chengf49810c2009-06-23 17:48:47 +00001061}
1062
Owen Anderson16884412011-07-13 23:22:26 +00001063class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +00001064 InstrItinClass itin,
1065 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001066 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1067 let OutOperandList = oops;
1068 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001069 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001070 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +00001071 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonf1a00902011-07-19 21:06:00 +00001072 let DecoderNamespace = "Thumb";
Jim Grosbachd1228742009-12-01 18:10:36 +00001073}
1074
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001075class T2I<dag oops, dag iops, InstrItinClass itin,
1076 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001077 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001078class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1079 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001080 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001081class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1082 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001083 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001084class T2Iso<dag oops, dag iops, InstrItinClass itin,
1085 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001086 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001087class T2Ipc<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, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001090class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001091 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001092 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
Johnny Chend68e1192009-12-15 17:24:14 +00001093 pattern> {
Owen Anderson9d63d902010-12-01 19:18:46 +00001094 bits<4> Rt;
1095 bits<4> Rt2;
1096 bits<13> addr;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001097 let Inst{31-25} = 0b1110100;
1098 let Inst{24} = P;
1099 let Inst{23} = addr{8};
1100 let Inst{22} = 1;
1101 let Inst{21} = W;
1102 let Inst{20} = isLoad;
1103 let Inst{19-16} = addr{12-9};
Owen Anderson9d63d902010-12-01 19:18:46 +00001104 let Inst{15-12} = Rt{3-0};
1105 let Inst{11-8} = Rt2{3-0};
Owen Anderson9d63d902010-12-01 19:18:46 +00001106 let Inst{7-0} = addr{7-0};
Johnny Chend68e1192009-12-15 17:24:14 +00001107}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001108
Owen Anderson14c903a2011-08-04 23:18:05 +00001109class T2Ii8s4Tied<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1110 string opc, string asm, list<dag> pattern>
1111 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "$base = $wb",
1112 pattern> {
1113 bits<4> Rt;
1114 bits<4> Rt2;
1115 bits<4> base;
1116 bits<9> imm;
1117 let Inst{31-25} = 0b1110100;
1118 let Inst{24} = P;
1119 let Inst{23} = imm{8};
1120 let Inst{22} = 1;
1121 let Inst{21} = W;
1122 let Inst{20} = isLoad;
1123 let Inst{19-16} = base{3-0};
1124 let Inst{15-12} = Rt{3-0};
1125 let Inst{11-8} = Rt2{3-0};
1126 let Inst{7-0} = imm{7-0};
1127}
1128
1129
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001130class T2sI<dag oops, dag iops, InstrItinClass itin,
1131 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001132 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001133
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001134class T2XI<dag oops, dag iops, InstrItinClass itin,
1135 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001136 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001137class T2JTI<dag oops, dag iops, InstrItinClass itin,
1138 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001139 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001140
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001141// Move to/from coprocessor instructions
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001142class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
Jim Grosbach9bb098a2011-07-13 21:14:23 +00001143 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001144 let Inst{31-28} = opc;
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001145}
1146
Bob Wilson815baeb2010-03-13 01:08:20 +00001147// Two-address instructions
1148class T2XIt<dag oops, dag iops, InstrItinClass itin,
1149 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001150 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001151
Evan Chenge88d5ce2009-07-02 07:28:31 +00001152// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001153class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1154 dag oops, dag iops,
1155 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001156 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001157 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001158 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001159 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001160 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001161 let Pattern = pattern;
1162 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001163 let DecoderNamespace = "Thumb2";
Johnny Chend68e1192009-12-15 17:24:14 +00001164 let Inst{31-27} = 0b11111;
1165 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001166 let Inst{24} = signed;
1167 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001168 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001169 let Inst{20} = load;
1170 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001171 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001172 let Inst{10} = pre; // The P bit.
1173 let Inst{8} = 1; // The W bit.
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001174
Owen Anderson6af50f72010-11-30 00:14:31 +00001175 bits<9> addr;
1176 let Inst{7-0} = addr{7-0};
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001177 let Inst{9} = addr{8}; // Sign bit
1178
Owen Anderson6af50f72010-11-30 00:14:31 +00001179 bits<4> Rt;
1180 bits<4> Rn;
1181 let Inst{15-12} = Rt{3-0};
1182 let Inst{19-16} = Rn{3-0};
Evan Chenge88d5ce2009-07-02 07:28:31 +00001183}
1184
David Goodwinc9d138f2009-07-27 19:59:26 +00001185// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1186class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001187 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwinc9d138f2009-07-27 19:59:26 +00001188}
1189
1190// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1191class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001192 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwinc9d138f2009-07-27 19:59:26 +00001193}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001194
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +00001195// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1196class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1197 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1198}
1199
Evan Cheng9cb9e672009-06-27 02:26:13 +00001200// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1201class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001202 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001203}
1204
Evan Cheng13096642008-08-29 06:41:12 +00001205//===----------------------------------------------------------------------===//
1206
Evan Cheng96581d32008-11-11 02:11:05 +00001207//===----------------------------------------------------------------------===//
1208// ARM VFP Instruction templates.
1209//
1210
David Goodwin3ca524e2009-07-10 17:03:29 +00001211// Almost all VFP instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001212class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001213 IndexMode im, Format f, InstrItinClass itin,
1214 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001215 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001216 bits<4> p;
1217 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001218 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001219 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001220 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001221 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001222 let PostEncoderMethod = "VFPThumb2PostEncoder";
Owen Anderson8d7d2e12011-08-09 20:55:18 +00001223 let DecoderNamespace = "VFP";
David Goodwin3ca524e2009-07-10 17:03:29 +00001224 list<Predicate> Predicates = [HasVFP2];
1225}
1226
1227// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001228class VFPXI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001229 IndexMode im, Format f, InstrItinClass itin,
1230 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001231 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001232 bits<4> p;
1233 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001234 let OutOperandList = oops;
1235 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001236 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001237 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001238 let PostEncoderMethod = "VFPThumb2PostEncoder";
Owen Anderson8d7d2e12011-08-09 20:55:18 +00001239 let DecoderNamespace = "VFP";
David Goodwin3ca524e2009-07-10 17:03:29 +00001240 list<Predicate> Predicates = [HasVFP2];
1241}
1242
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001243class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1244 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001245 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendlingcf590262010-12-01 21:54:50 +00001246 opc, asm, "", pattern> {
1247 let PostEncoderMethod = "VFPThumb2PostEncoder";
1248}
David Goodwin3ca524e2009-07-10 17:03:29 +00001249
Evan Chengcd8e66a2008-11-11 21:48:44 +00001250// ARM VFP addrmode5 loads and stores
1251class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001252 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001253 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001254 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001255 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001256 // Instruction operands.
1257 bits<5> Dd;
1258 bits<13> addr;
1259
1260 // Encode instruction operands.
1261 let Inst{23} = addr{8}; // U (add = (U == '1'))
1262 let Inst{22} = Dd{4};
1263 let Inst{19-16} = addr{12-9}; // Rn
1264 let Inst{15-12} = Dd{3-0};
1265 let Inst{7-0} = addr{7-0}; // imm8
1266
Evan Cheng96581d32008-11-11 02:11:05 +00001267 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001268 let Inst{27-24} = opcod1;
1269 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001270 let Inst{11-9} = 0b101;
1271 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001272
Evan Cheng5eda2822011-02-16 00:35:02 +00001273 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001274 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001275}
1276
Evan Chengcd8e66a2008-11-11 21:48:44 +00001277class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001278 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001279 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001280 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001281 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001282 // Instruction operands.
1283 bits<5> Sd;
1284 bits<13> addr;
1285
1286 // Encode instruction operands.
1287 let Inst{23} = addr{8}; // U (add = (U == '1'))
1288 let Inst{22} = Sd{0};
1289 let Inst{19-16} = addr{12-9}; // Rn
1290 let Inst{15-12} = Sd{4-1};
1291 let Inst{7-0} = addr{7-0}; // imm8
1292
Evan Cheng96581d32008-11-11 02:11:05 +00001293 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001294 let Inst{27-24} = opcod1;
1295 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001296 let Inst{11-9} = 0b101;
1297 let Inst{8} = 0; // Single precision
Evan Cheng5eda2822011-02-16 00:35:02 +00001298
1299 // Loads & stores operate on both NEON and VFP pipelines.
1300 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001301}
1302
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001303// VFP Load / store multiple pseudo instructions.
1304class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1305 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001306 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001307 cstr, itin> {
1308 let OutOperandList = oops;
1309 let InOperandList = !con(iops, (ins pred:$p));
1310 let Pattern = pattern;
1311 list<Predicate> Predicates = [HasVFP2];
1312}
1313
Evan Chengcd8e66a2008-11-11 21:48:44 +00001314// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001315class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001316 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001317 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001318 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001319 // Instruction operands.
1320 bits<4> Rn;
1321 bits<13> regs;
1322
1323 // Encode instruction operands.
1324 let Inst{19-16} = Rn;
1325 let Inst{22} = regs{12};
1326 let Inst{15-12} = regs{11-8};
1327 let Inst{7-0} = regs{7-0};
1328
Evan Chengcd8e66a2008-11-11 21:48:44 +00001329 // TODO: Mark the instructions with the appropriate subtarget info.
1330 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001331 let Inst{11-9} = 0b101;
1332 let Inst{8} = 1; // Double precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001333}
1334
Jim Grosbach72db1822010-09-08 00:25:50 +00001335class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001336 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001337 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001338 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001339 // Instruction operands.
1340 bits<4> Rn;
1341 bits<13> regs;
1342
1343 // Encode instruction operands.
1344 let Inst{19-16} = Rn;
1345 let Inst{22} = regs{8};
1346 let Inst{15-12} = regs{12-9};
1347 let Inst{7-0} = regs{7-0};
1348
Evan Chengcd8e66a2008-11-11 21:48:44 +00001349 // TODO: Mark the instructions with the appropriate subtarget info.
1350 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001351 let Inst{11-9} = 0b101;
1352 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001353}
1354
Evan Cheng96581d32008-11-11 02:11:05 +00001355// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001356class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1357 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1358 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001359 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001360 // Instruction operands.
1361 bits<5> Dd;
1362 bits<5> Dm;
1363
1364 // Encode instruction operands.
1365 let Inst{3-0} = Dm{3-0};
1366 let Inst{5} = Dm{4};
1367 let Inst{15-12} = Dd{3-0};
1368 let Inst{22} = Dd{4};
1369
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001370 let Inst{27-23} = opcod1;
1371 let Inst{21-20} = opcod2;
1372 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001373 let Inst{11-9} = 0b101;
1374 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001375 let Inst{7-6} = opcod4;
1376 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001377}
1378
1379// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001380class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001381 dag iops, InstrItinClass itin, string opc, string asm,
1382 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001383 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001384 // Instruction operands.
1385 bits<5> Dd;
1386 bits<5> Dn;
1387 bits<5> Dm;
1388
1389 // Encode instruction operands.
1390 let Inst{3-0} = Dm{3-0};
1391 let Inst{5} = Dm{4};
1392 let Inst{19-16} = Dn{3-0};
1393 let Inst{7} = Dn{4};
1394 let Inst{15-12} = Dd{3-0};
1395 let Inst{22} = Dd{4};
1396
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001397 let Inst{27-23} = opcod1;
1398 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001399 let Inst{11-9} = 0b101;
1400 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001401 let Inst{6} = op6;
1402 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001403}
1404
1405// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001406class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1407 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1408 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001409 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001410 // Instruction operands.
1411 bits<5> Sd;
1412 bits<5> Sm;
1413
1414 // Encode instruction operands.
1415 let Inst{3-0} = Sm{4-1};
1416 let Inst{5} = Sm{0};
1417 let Inst{15-12} = Sd{4-1};
1418 let Inst{22} = Sd{0};
1419
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001420 let Inst{27-23} = opcod1;
1421 let Inst{21-20} = opcod2;
1422 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001423 let Inst{11-9} = 0b101;
1424 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001425 let Inst{7-6} = opcod4;
1426 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001427}
1428
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001429// Single precision unary, if no NEON. Same as ASuI except not available if
1430// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001431class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1432 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1433 string asm, list<dag> pattern>
1434 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1435 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001436 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1437}
1438
Evan Cheng96581d32008-11-11 02:11:05 +00001439// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001440class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1441 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001442 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001443 // Instruction operands.
1444 bits<5> Sd;
1445 bits<5> Sn;
1446 bits<5> Sm;
1447
1448 // Encode instruction operands.
1449 let Inst{3-0} = Sm{4-1};
1450 let Inst{5} = Sm{0};
1451 let Inst{19-16} = Sn{4-1};
1452 let Inst{7} = Sn{0};
1453 let Inst{15-12} = Sd{4-1};
1454 let Inst{22} = Sd{0};
1455
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001456 let Inst{27-23} = opcod1;
1457 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001458 let Inst{11-9} = 0b101;
1459 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001460 let Inst{6} = op6;
1461 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001462}
1463
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001464// Single precision binary, if no NEON. Same as ASbI except not available if
1465// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001466class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001467 dag iops, InstrItinClass itin, string opc, string asm,
1468 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001469 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001470 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling69661192010-11-01 06:00:39 +00001471
1472 // Instruction operands.
1473 bits<5> Sd;
1474 bits<5> Sn;
1475 bits<5> Sm;
1476
1477 // Encode instruction operands.
1478 let Inst{3-0} = Sm{4-1};
1479 let Inst{5} = Sm{0};
1480 let Inst{19-16} = Sn{4-1};
1481 let Inst{7} = Sn{0};
1482 let Inst{15-12} = Sd{4-1};
1483 let Inst{22} = Sd{0};
David Goodwin42a83f22009-08-04 17:53:06 +00001484}
1485
Evan Cheng80a11982008-11-12 06:41:41 +00001486// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001487class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1488 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1489 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001490 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001491 let Inst{27-23} = opcod1;
1492 let Inst{21-20} = opcod2;
1493 let Inst{19-16} = opcod3;
1494 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001495 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001496 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001497}
1498
Johnny Chen811663f2010-02-11 18:47:03 +00001499// VFP conversion between floating-point and fixed-point
1500class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001501 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1502 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001503 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1504 // size (fixed-point number): sx == 0 ? 16 : 32
1505 let Inst{7} = op5; // sx
1506}
1507
David Goodwin338268c2009-08-10 22:17:39 +00001508// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001509class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001510 dag oops, dag iops, InstrItinClass itin,
1511 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001512 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1513 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001514 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1515}
1516
Evan Cheng80a11982008-11-12 06:41:41 +00001517class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001518 InstrItinClass itin,
1519 string opc, string asm, list<dag> pattern>
1520 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001521 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001522 let Inst{11-8} = opcod2;
1523 let Inst{4} = 1;
1524}
1525
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001526class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1527 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1528 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001529
Bob Wilson01135592010-03-23 17:23:59 +00001530class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001531 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1532 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001533
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001534class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1535 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1536 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001537
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001538class AVConv5I<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, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001541
Evan Cheng96581d32008-11-11 02:11:05 +00001542//===----------------------------------------------------------------------===//
1543
Bob Wilson5bafff32009-06-22 23:27:02 +00001544//===----------------------------------------------------------------------===//
1545// ARM NEON Instruction templates.
1546//
Evan Cheng13096642008-08-29 06:41:12 +00001547
Johnny Chencaa608e2010-03-20 00:17:00 +00001548class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1549 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1550 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001551 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001552 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001553 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001554 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001555 let Pattern = pattern;
1556 list<Predicate> Predicates = [HasNEON];
Owen Andersonef2865a2011-08-15 23:38:54 +00001557 let DecoderNamespace = "NEON";
Evan Chengf81bf152009-11-23 21:57:23 +00001558}
1559
1560// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001561class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1562 InstrItinClass itin, string opc, string asm, string cstr,
1563 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001564 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001565 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001566 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001567 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001568 let Pattern = pattern;
1569 list<Predicate> Predicates = [HasNEON];
Owen Andersonef2865a2011-08-15 23:38:54 +00001570 let DecoderNamespace = "NEON";
Evan Cheng13096642008-08-29 06:41:12 +00001571}
1572
Bob Wilsonb07c1712009-10-07 21:53:04 +00001573class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1574 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001575 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001576 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1577 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001578 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001579 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001580 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001581 let Inst{11-8} = op11_8;
1582 let Inst{7-4} = op7_4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001583
Chris Lattner2ac19022010-11-15 05:19:05 +00001584 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Owen Anderson8533eba2011-08-10 19:01:10 +00001585 let DecoderNamespace = "NEONLoadStore";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001586
Owen Andersond9aa7d32010-11-02 00:05:05 +00001587 bits<5> Vd;
Owen Andersonf431eda2010-11-02 23:47:29 +00001588 bits<6> Rn;
1589 bits<4> Rm;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001590
Owen Andersond9aa7d32010-11-02 00:05:05 +00001591 let Inst{22} = Vd{4};
1592 let Inst{15-12} = Vd{3-0};
Owen Andersonf431eda2010-11-02 23:47:29 +00001593 let Inst{19-16} = Rn{3-0};
1594 let Inst{3-0} = Rm{3-0};
Bob Wilson205a5ca2009-07-08 18:11:30 +00001595}
1596
Owen Andersond138d702010-11-02 20:47:39 +00001597class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1598 dag oops, dag iops, InstrItinClass itin,
1599 string opc, string dt, string asm, string cstr, list<dag> pattern>
1600 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1601 dt, asm, cstr, pattern> {
1602 bits<3> lane;
1603}
1604
Bob Wilson709d5922010-08-25 23:27:42 +00001605class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson16884412011-07-13 23:22:26 +00001606 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson709d5922010-08-25 23:27:42 +00001607 itin> {
1608 let OutOperandList = oops;
1609 let InOperandList = !con(iops, (ins pred:$p));
1610 list<Predicate> Predicates = [HasNEON];
1611}
1612
Jim Grosbach7cd27292010-10-06 20:36:55 +00001613class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1614 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001615 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonbd916c52010-09-13 23:55:10 +00001616 itin> {
1617 let OutOperandList = oops;
1618 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001619 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001620 list<Predicate> Predicates = [HasNEON];
1621}
1622
Johnny Chen785516a2010-03-23 16:43:47 +00001623class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001624 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001625 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1626 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001627 let Inst{31-25} = 0b1111001;
Chris Lattner2ac19022010-11-15 05:19:05 +00001628 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Owen Andersonef2865a2011-08-15 23:38:54 +00001629 let DecoderNamespace = "NEONData";
Evan Chengf81bf152009-11-23 21:57:23 +00001630}
1631
Johnny Chen927b88f2010-03-23 20:40:44 +00001632class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001633 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001634 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001635 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001636 let Inst{31-25} = 0b1111001;
Owen Andersonac00e962010-12-10 22:32:08 +00001637 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Owen Andersonef2865a2011-08-15 23:38:54 +00001638 let DecoderNamespace = "NEONData";
Bob Wilson5bafff32009-06-22 23:27:02 +00001639}
1640
1641// NEON "one register and a modified immediate" format.
1642class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1643 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001644 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001645 string opc, string dt, string asm, string cstr,
1646 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001647 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001648 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001649 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001650 let Inst{11-8} = op11_8;
1651 let Inst{7} = op7;
1652 let Inst{6} = op6;
1653 let Inst{5} = op5;
1654 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001655
Owen Andersona88ea032010-10-26 17:40:54 +00001656 // Instruction operands.
1657 bits<5> Vd;
1658 bits<13> SIMM;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001659
Owen Andersona88ea032010-10-26 17:40:54 +00001660 let Inst{15-12} = Vd{3-0};
1661 let Inst{22} = Vd{4};
1662 let Inst{24} = SIMM{7};
1663 let Inst{18-16} = SIMM{6-4};
1664 let Inst{3-0} = SIMM{3-0};
Owen Anderson8d7d2e12011-08-09 20:55:18 +00001665 let DecoderMethod = "DecodeNEONModImmInstruction";
Bob Wilson5bafff32009-06-22 23:27:02 +00001666}
1667
1668// NEON 2 vector register format.
1669class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1670 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001671 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001672 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001673 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001674 let Inst{24-23} = op24_23;
1675 let Inst{21-20} = op21_20;
1676 let Inst{19-18} = op19_18;
1677 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001678 let Inst{11-7} = op11_7;
1679 let Inst{6} = op6;
1680 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001681
Owen Anderson162875a2010-10-25 18:43:52 +00001682 // Instruction operands.
1683 bits<5> Vd;
1684 bits<5> Vm;
1685
1686 let Inst{15-12} = Vd{3-0};
1687 let Inst{22} = Vd{4};
1688 let Inst{3-0} = Vm{3-0};
1689 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001690}
1691
1692// Same as N2V except it doesn't have a datatype suffix.
1693class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001694 bits<5> op11_7, bit op6, bit op4,
1695 dag oops, dag iops, InstrItinClass itin,
1696 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001697 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001698 let Inst{24-23} = op24_23;
1699 let Inst{21-20} = op21_20;
1700 let Inst{19-18} = op19_18;
1701 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001702 let Inst{11-7} = op11_7;
1703 let Inst{6} = op6;
1704 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001705
Owen Anderson162875a2010-10-25 18:43:52 +00001706 // Instruction operands.
1707 bits<5> Vd;
1708 bits<5> Vm;
1709
1710 let Inst{15-12} = Vd{3-0};
1711 let Inst{22} = Vd{4};
1712 let Inst{3-0} = Vm{3-0};
1713 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001714}
1715
1716// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001717class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001718 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001719 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001720 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001721 let Inst{24} = op24;
1722 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001723 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001724 let Inst{7} = op7;
1725 let Inst{6} = op6;
1726 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001727
Owen Anderson3557d002010-10-26 20:56:57 +00001728 // Instruction operands.
1729 bits<5> Vd;
1730 bits<5> Vm;
1731 bits<6> SIMM;
1732
1733 let Inst{15-12} = Vd{3-0};
1734 let Inst{22} = Vd{4};
1735 let Inst{3-0} = Vm{3-0};
1736 let Inst{5} = Vm{4};
1737 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001738}
1739
Bob Wilson10bc69c2010-03-27 03:56:52 +00001740// NEON 3 vector register format.
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001741
Jim Grosbach6635b042011-05-19 17:34:53 +00001742class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1743 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1744 string opc, string dt, string asm, string cstr,
1745 list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001746 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001747 let Inst{24} = op24;
1748 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001749 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001750 let Inst{11-8} = op11_8;
1751 let Inst{6} = op6;
1752 let Inst{4} = op4;
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001753}
1754
1755class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1756 dag oops, dag iops, Format f, InstrItinClass itin,
1757 string opc, string dt, string asm, string cstr, list<dag> pattern>
1758 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1759 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001760
Owen Andersond451f882010-10-21 20:21:49 +00001761 // Instruction operands.
1762 bits<5> Vd;
1763 bits<5> Vn;
1764 bits<5> Vm;
1765
1766 let Inst{15-12} = Vd{3-0};
1767 let Inst{22} = Vd{4};
1768 let Inst{19-16} = Vn{3-0};
1769 let Inst{7} = Vn{4};
1770 let Inst{3-0} = Vm{3-0};
1771 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001772}
1773
Jim Grosbach6635b042011-05-19 17:34:53 +00001774class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1775 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1776 string opc, string dt, string asm, string cstr,
1777 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001778 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1779 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1780
1781 // Instruction operands.
1782 bits<5> Vd;
1783 bits<5> Vn;
1784 bits<5> Vm;
1785 bit lane;
1786
1787 let Inst{15-12} = Vd{3-0};
1788 let Inst{22} = Vd{4};
1789 let Inst{19-16} = Vn{3-0};
1790 let Inst{7} = Vn{4};
1791 let Inst{3-0} = Vm{3-0};
1792 let Inst{5} = lane;
1793}
1794
Jim Grosbach6635b042011-05-19 17:34:53 +00001795class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1796 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1797 string opc, string dt, string asm, string cstr,
1798 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001799 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1800 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1801
1802 // Instruction operands.
1803 bits<5> Vd;
1804 bits<5> Vn;
1805 bits<5> Vm;
1806 bits<2> lane;
1807
1808 let Inst{15-12} = Vd{3-0};
1809 let Inst{22} = Vd{4};
1810 let Inst{19-16} = Vn{3-0};
1811 let Inst{7} = Vn{4};
1812 let Inst{2-0} = Vm{2-0};
1813 let Inst{5} = lane{1};
1814 let Inst{3} = lane{0};
1815}
1816
Johnny Chen841e8282010-03-23 21:35:03 +00001817// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001818class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1819 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001820 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001821 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001822 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001823 let Inst{24} = op24;
1824 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001825 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001826 let Inst{11-8} = op11_8;
1827 let Inst{6} = op6;
1828 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001829
Owen Anderson8c71eff2010-10-25 18:28:30 +00001830 // Instruction operands.
1831 bits<5> Vd;
1832 bits<5> Vn;
1833 bits<5> Vm;
1834
1835 let Inst{15-12} = Vd{3-0};
1836 let Inst{22} = Vd{4};
1837 let Inst{19-16} = Vn{3-0};
1838 let Inst{7} = Vn{4};
1839 let Inst{3-0} = Vm{3-0};
1840 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001841}
1842
1843// NEON VMOVs between scalar and core registers.
1844class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001845 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001846 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001847 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001848 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001849 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001850 let Inst{11-8} = opcod2;
1851 let Inst{6-5} = opcod3;
1852 let Inst{4} = 1;
Johnny Chena9611542011-04-06 18:27:46 +00001853 // A8.6.303, A8.6.328, A8.6.329
1854 let Inst{3-0} = 0b0000;
Evan Chengf81bf152009-11-23 21:57:23 +00001855
1856 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001857 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001858 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001859 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001860 list<Predicate> Predicates = [HasNEON];
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001861
Chris Lattner2ac19022010-11-15 05:19:05 +00001862 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Owen Anderson8533eba2011-08-10 19:01:10 +00001863 let DecoderNamespace = "NEONDup";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001864
Owen Andersond2fbdb72010-10-27 21:28:09 +00001865 bits<5> V;
1866 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001867 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001868 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001869
Owen Andersonf587a9352010-10-27 19:25:54 +00001870 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001871 let Inst{7} = V{4};
1872 let Inst{19-16} = V{3-0};
1873 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001874}
1875class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001876 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001877 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001878 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001879 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001880class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001881 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001882 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001883 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001884 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001885class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001886 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001887 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001888 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001889 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001890
Johnny Chene4614f72010-03-25 17:01:27 +00001891// Vector Duplicate Lane (from scalar to all elements)
1892class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1893 InstrItinClass itin, string opc, string dt, string asm,
1894 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001895 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001896 let Inst{24-23} = 0b11;
1897 let Inst{21-20} = 0b11;
1898 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001899 let Inst{11-7} = 0b11000;
1900 let Inst{6} = op6;
1901 let Inst{4} = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001902
Owen Andersonf587a9352010-10-27 19:25:54 +00001903 bits<5> Vd;
1904 bits<5> Vm;
1905 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001906
Owen Andersonf587a9352010-10-27 19:25:54 +00001907 let Inst{22} = Vd{4};
1908 let Inst{15-12} = Vd{3-0};
1909 let Inst{5} = Vm{4};
1910 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001911}
1912
David Goodwin42a83f22009-08-04 17:53:06 +00001913// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1914// for single-precision FP.
1915class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1916 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1917}