blob: f79ce22f3a6f63e711cd0d279d42118912a5e41c [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;
Evan Cheng446c4282009-07-11 06:43:01 +0000155}
156
157// Conditional code result for instructions whose 's' bit is set, e.g. subs.
Jim Grosbach5f6c1332011-07-25 20:38:18 +0000158def CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
Evan Cheng446c4282009-07-11 06:43:01 +0000159def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000160 let EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000161 let PrintMethod = "printSBitModifierOperand";
Jim Grosbachd67641b2010-12-06 18:21:12 +0000162 let ParserMatchClass = CCOutOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000163}
164
165// Same as cc_out except it defaults to setting CPSR.
166def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Chris Lattner2ac19022010-11-15 05:19:05 +0000167 let EncoderMethod = "getCCOutOpValue";
Evan Cheng446c4282009-07-11 06:43:01 +0000168 let PrintMethod = "printSBitModifierOperand";
Jim Grosbachd67641b2010-12-06 18:21:12 +0000169 let ParserMatchClass = CCOutOperand;
Evan Cheng446c4282009-07-11 06:43:01 +0000170}
171
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000172// ARM special operands for disassembly only.
173//
Jim Grosbachc27d4f92011-07-22 17:44:50 +0000174def SetEndAsmOperand : AsmOperandClass {
175 let Name = "SetEndImm";
176 let ParserMethod = "parseSetEndImm";
177}
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000178def setend_op : Operand<i32> {
179 let PrintMethod = "printSetendOperand";
Jim Grosbachc27d4f92011-07-22 17:44:50 +0000180 let ParserMatchClass = SetEndAsmOperand;
Jim Grosbachb3af5de2010-10-13 21:00:04 +0000181}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000182
Jim Grosbach5f6c1332011-07-25 20:38:18 +0000183def MSRMaskOperand : AsmOperandClass {
184 let Name = "MSRMask";
185 let ParserMethod = "parseMSRMaskOperand";
186}
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000187def msr_mask : Operand<i32> {
188 let PrintMethod = "printMSRMaskOperand";
Bruno Cardoso Lopes584bf7b2011-02-18 19:45:59 +0000189 let ParserMatchClass = MSRMaskOperand;
Johnny Chendd0f3cf2010-03-10 18:59:38 +0000190}
191
Bill Wendling3116dce2011-03-07 23:38:41 +0000192// Shift Right Immediate - A shift right immediate is encoded differently from
193// other shift immediates. The imm6 field is encoded like so:
Bill Wendlinga656b632011-03-01 01:00:59 +0000194//
Bill Wendling3116dce2011-03-07 23:38:41 +0000195// Offset Encoding
196// 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
197// 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
198// 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
199// 64 64 - <imm> is encoded in imm6<5:0>
200def shr_imm8 : Operand<i32> {
201 let EncoderMethod = "getShiftRight8Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000202}
Bill Wendling3116dce2011-03-07 23:38:41 +0000203def shr_imm16 : Operand<i32> {
204 let EncoderMethod = "getShiftRight16Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000205}
Bill Wendling3116dce2011-03-07 23:38:41 +0000206def shr_imm32 : Operand<i32> {
207 let EncoderMethod = "getShiftRight32Imm";
208}
209def shr_imm64 : Operand<i32> {
210 let EncoderMethod = "getShiftRight64Imm";
Bill Wendlinga656b632011-03-01 01:00:59 +0000211}
212
Evan Cheng446c4282009-07-11 06:43:01 +0000213//===----------------------------------------------------------------------===//
Evan Cheng37f25d92008-08-28 23:39:26 +0000214// ARM Instruction templates.
215//
216
Owen Anderson16884412011-07-13 23:22:26 +0000217class InstTemplate<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000218 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng37f25d92008-08-28 23:39:26 +0000219 : Instruction {
220 let Namespace = "ARM";
221
Evan Cheng37f25d92008-08-28 23:39:26 +0000222 AddrMode AM = am;
Owen Anderson16884412011-07-13 23:22:26 +0000223 int Size = sz;
Evan Cheng37f25d92008-08-28 23:39:26 +0000224 IndexMode IM = im;
225 bits<2> IndexModeBits = IM.Value;
Evan Cheng37f25d92008-08-28 23:39:26 +0000226 Format F = f;
Bob Wilson89ef7b72010-03-17 21:13:43 +0000227 bits<6> Form = F.Value;
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000228 Domain D = d;
Evan Chengedda31c2008-11-05 18:35:52 +0000229 bit isUnaryDataProc = 0;
Evan Cheng34a0fa32009-07-08 01:46:35 +0000230 bit canXformTo16Bit = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +0000231
Chris Lattner150d20e2010-10-31 19:22:57 +0000232 // If this is a pseudo instruction, mark it isCodeGenOnly.
233 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson01135592010-03-23 17:23:59 +0000234
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000235 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbachd86609f2010-10-05 18:14:55 +0000236 let TSFlags{4-0} = AM.Value;
Owen Anderson16884412011-07-13 23:22:26 +0000237 let TSFlags{6-5} = IndexModeBits;
238 let TSFlags{12-7} = Form;
239 let TSFlags{13} = isUnaryDataProc;
240 let TSFlags{14} = canXformTo16Bit;
241 let TSFlags{17-15} = D.Value;
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +0000242
Evan Cheng37f25d92008-08-28 23:39:26 +0000243 let Constraints = cstr;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000244 let Itinerary = itin;
Evan Cheng37f25d92008-08-28 23:39:26 +0000245}
246
Johnny Chend68e1192009-12-15 17:24:14 +0000247class Encoding {
248 field bits<32> Inst;
249}
250
Owen Anderson16884412011-07-13 23:22:26 +0000251class InstARM<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000252 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000253 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
254 let DecoderNamespace = "ARM";
255}
Johnny Chend68e1192009-12-15 17:24:14 +0000256
257// This Encoding-less class is used by Thumb1 to specify the encoding bits later
258// on by adding flavors to specific instructions.
Owen Anderson16884412011-07-13 23:22:26 +0000259class InstThumb<AddrMode am, int sz, IndexMode im,
Johnny Chend68e1192009-12-15 17:24:14 +0000260 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonf1a00902011-07-19 21:06:00 +0000261 : InstTemplate<am, sz, im, f, d, cstr, itin> {
262 let DecoderNamespace = "Thumb";
263}
Johnny Chend68e1192009-12-15 17:24:14 +0000264
Jim Grosbach99594eb2010-11-18 01:38:26 +0000265class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000266 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000267 GenericDomain, "", itin> {
Evan Cheng37f25d92008-08-28 23:39:26 +0000268 let OutOperandList = oops;
269 let InOperandList = iops;
Evan Cheng37f25d92008-08-28 23:39:26 +0000270 let Pattern = pattern;
Jim Grosbacha768c3d2011-03-10 19:06:39 +0000271 let isCodeGenOnly = 1;
Jim Grosbachd1689ae2011-07-06 21:35:46 +0000272 let isPseudo = 1;
Evan Cheng37f25d92008-08-28 23:39:26 +0000273}
274
Jim Grosbach53694262010-11-18 01:15:56 +0000275// PseudoInst that's ARM-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000276class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach99594eb2010-11-18 01:38:26 +0000277 list<dag> pattern>
278 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000279 let Size = sz;
Jim Grosbach53694262010-11-18 01:15:56 +0000280 list<Predicate> Predicates = [IsARM];
281}
282
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000283// PseudoInst that's Thumb-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000284class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000285 list<dag> pattern>
286 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000287 let Size = sz;
Jim Grosbachf1aa47d2010-11-29 19:32:47 +0000288 list<Predicate> Predicates = [IsThumb];
289}
Jim Grosbach53694262010-11-18 01:15:56 +0000290
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000291// PseudoInst that's Thumb2-mode only.
Owen Anderson16884412011-07-13 23:22:26 +0000292class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000293 list<dag> pattern>
294 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson16884412011-07-13 23:22:26 +0000295 let Size = sz;
Jim Grosbach41b1d4e2010-12-15 18:48:45 +0000296 list<Predicate> Predicates = [IsThumb2];
297}
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000298
Owen Anderson16884412011-07-13 23:22:26 +0000299class ARMPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000300 InstrItinClass itin, list<dag> pattern,
301 dag Result>
302 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
303 PseudoInstExpansion<Result>;
304
Owen Anderson16884412011-07-13 23:22:26 +0000305class tPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000306 InstrItinClass itin, list<dag> pattern,
307 dag Result>
308 : tPseudoInst<oops, iops, sz, itin, pattern>,
309 PseudoInstExpansion<Result>;
310
Owen Anderson16884412011-07-13 23:22:26 +0000311class t2PseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach53e3fc42011-07-08 17:40:42 +0000312 InstrItinClass itin, list<dag> pattern,
313 dag Result>
314 : t2PseudoInst<oops, iops, sz, itin, pattern>,
315 PseudoInstExpansion<Result>;
316
Evan Cheng37f25d92008-08-28 23:39:26 +0000317// Almost all ARM instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +0000318class I<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000319 IndexMode im, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000320 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000321 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000322 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000323 bits<4> p;
324 let Inst{31-28} = p;
Evan Cheng37f25d92008-08-28 23:39:26 +0000325 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000326 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000327 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000328 let Pattern = pattern;
329 list<Predicate> Predicates = [IsARM];
330}
Bill Wendlingda2ae632010-08-31 07:50:46 +0000331
Jim Grosbachf6b28622009-12-14 18:31:20 +0000332// A few are not predicable
Owen Anderson16884412011-07-13 23:22:26 +0000333class InoP<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +0000334 IndexMode im, Format f, InstrItinClass itin,
335 string opc, string asm, string cstr,
336 list<dag> pattern>
Jim Grosbachf6b28622009-12-14 18:31:20 +0000337 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
338 let OutOperandList = oops;
339 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000340 let AsmString = !strconcat(opc, asm);
Jim Grosbachf6b28622009-12-14 18:31:20 +0000341 let Pattern = pattern;
342 let isPredicable = 0;
343 list<Predicate> Predicates = [IsARM];
344}
Evan Cheng37f25d92008-08-28 23:39:26 +0000345
Bill Wendling4822bce2010-08-30 01:47:35 +0000346// Same as I except it can optionally modify CPSR. Note it's modeled as an input
347// operand since by default it's a zero register. It will become an implicit def
348// once it's "flipped".
Owen Anderson16884412011-07-13 23:22:26 +0000349class sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000350 IndexMode im, Format f, InstrItinClass itin,
351 string opc, string asm, string cstr,
Evan Cheng37f25d92008-08-28 23:39:26 +0000352 list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000353 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach62547262010-10-11 18:51:51 +0000354 bits<4> p; // Predicate operand
Jim Grosbach08bd5492010-10-12 23:00:24 +0000355 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach62547262010-10-11 18:51:51 +0000356 let Inst{31-28} = p;
Jim Grosbach08bd5492010-10-12 23:00:24 +0000357 let Inst{20} = s;
Jim Grosbach62547262010-10-11 18:51:51 +0000358
Evan Cheng37f25d92008-08-28 23:39:26 +0000359 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000360 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilsoncfbece52010-10-15 03:23:44 +0000361 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng37f25d92008-08-28 23:39:26 +0000362 let Pattern = pattern;
363 list<Predicate> Predicates = [IsARM];
364}
365
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000366// Special cases
Owen Anderson16884412011-07-13 23:22:26 +0000367class XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000368 IndexMode im, Format f, InstrItinClass itin,
369 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +0000370 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000371 let OutOperandList = oops;
372 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000373 let AsmString = asm;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000374 let Pattern = pattern;
375 list<Predicate> Predicates = [IsARM];
376}
377
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000378class AI<dag oops, dag iops, Format f, InstrItinClass itin,
379 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000380 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000381 opc, asm, "", pattern>;
382class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
383 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000384 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000385 opc, asm, "", pattern>;
386class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000387 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000388 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Evan Cheng97f48c32008-11-06 22:15:19 +0000389 asm, "", pattern>;
Jim Grosbachf6b28622009-12-14 18:31:20 +0000390class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +0000391 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000392 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bob Wilson01135592010-03-23 17:23:59 +0000393 opc, asm, "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000394
395// Ctrl flow instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000396class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
397 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000398 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000399 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000400 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000401}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000402class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
403 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000404 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000405 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000406 let Inst{27-24} = opcod;
Evan Cheng3aac7882008-09-01 08:25:56 +0000407}
Evan Cheng3aac7882008-09-01 08:25:56 +0000408
409// BR_JT instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000410class JTI<dag oops, dag iops, InstrItinClass itin,
411 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000412 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
Evan Cheng4df60f52008-11-07 09:06:08 +0000413 asm, "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000414
Jim Grosbach5278eb82009-12-11 01:42:04 +0000415// Atomic load/store instructions
Jim Grosbach5278eb82009-12-11 01:42:04 +0000416class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
417 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000418 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5278eb82009-12-11 01:42:04 +0000419 opc, asm, "", pattern> {
Jim Grosbach86875a22010-10-29 19:58:57 +0000420 bits<4> Rt;
421 bits<4> Rn;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000422 let Inst{27-23} = 0b00011;
423 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000424 let Inst{20} = 1;
Jim Grosbach86875a22010-10-29 19:58:57 +0000425 let Inst{19-16} = Rn;
426 let Inst{15-12} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000427 let Inst{11-0} = 0b111110011111;
428}
429class AIstrex<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> Rd;
434 bits<4> Rt;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000435 bits<4> addr;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000436 let Inst{27-23} = 0b00011;
437 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000438 let Inst{20} = 0;
Bruno Cardoso Lopes505f3cd2011-03-24 21:04:58 +0000439 let Inst{19-16} = addr;
Jim Grosbach86875a22010-10-29 19:58:57 +0000440 let Inst{15-12} = Rd;
Johnny Chen0291d7e2009-12-11 19:37:26 +0000441 let Inst{11-4} = 0b11111001;
Jim Grosbach86875a22010-10-29 19:58:57 +0000442 let Inst{3-0} = Rt;
Jim Grosbach5278eb82009-12-11 01:42:04 +0000443}
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000444class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
445 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, [$Rn]", pattern> {
446 bits<4> Rt;
447 bits<4> Rt2;
448 bits<4> Rn;
449 let Inst{27-23} = 0b00010;
450 let Inst{22} = b;
451 let Inst{21-20} = 0b00;
452 let Inst{19-16} = Rn;
453 let Inst{15-12} = Rt;
454 let Inst{11-4} = 0b00001001;
455 let Inst{3-0} = Rt2;
456}
Jim Grosbach5278eb82009-12-11 01:42:04 +0000457
Evan Cheng0d14fc82008-09-01 01:51:14 +0000458// addrmode1 instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000459class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
460 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000461 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000462 opc, asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000463 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000464 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000465}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000466class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
467 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000468 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000469 opc, asm, "", pattern> {
470 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000471 let Inst{27-26} = 0b00;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000472}
473class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng37f25d92008-08-28 23:39:26 +0000474 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000475 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
Evan Cheng612b79e2008-08-29 07:40:52 +0000476 asm, "", pattern> {
Jim Grosbach26421962008-10-14 20:36:24 +0000477 let Inst{24-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000478 let Inst{27-26} = 0b00;
Evan Cheng612b79e2008-08-29 07:40:52 +0000479}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000480
Evan Cheng93912732008-09-01 01:27:33 +0000481// loads
Jim Grosbach3e556122010-10-26 22:37:02 +0000482
Jim Grosbach9558b4c2010-11-19 21:07:51 +0000483// LDR/LDRB/STR/STRB/...
484class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000485 Format f, InstrItinClass itin, string opc, string asm,
486 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000487 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
Jim Grosbach3e556122010-10-26 22:37:02 +0000488 "", pattern> {
489 let Inst{27-25} = op;
490 let Inst{24} = 1; // 24 == P
491 // 23 == U
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000492 let Inst{22} = isByte;
Jim Grosbach3e556122010-10-26 22:37:02 +0000493 let Inst{21} = 0; // 21 == W
Jim Grosbach7e3383c2010-10-27 23:12:14 +0000494 let Inst{20} = isLd;
Jim Grosbach3e556122010-10-26 22:37:02 +0000495}
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000496// Indexed load/stores
497class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000498 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000499 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000500 : I<oops, iops, AddrMode2, 4, im, f, itin,
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000501 opc, asm, cstr, pattern> {
Jim Grosbach99f53d12010-11-15 20:47:07 +0000502 bits<4> Rt;
Jim Grosbach9e0bfb52010-11-13 00:35:48 +0000503 let Inst{27-26} = 0b01;
504 let Inst{24} = isPre; // P bit
505 let Inst{22} = isByte; // B bit
506 let Inst{21} = isPre; // W bit
507 let Inst{20} = isLd; // L bit
Jim Grosbach99f53d12010-11-15 20:47:07 +0000508 let Inst{15-12} = Rt;
Jim Grosbach3e556122010-10-26 22:37:02 +0000509}
Jim Grosbach953557f42010-11-19 21:35:06 +0000510class AI2stridx<bit isByte, bit isPre, dag oops, dag iops,
511 IndexMode im, Format f, InstrItinClass itin, string opc,
512 string asm, string cstr, list<dag> pattern>
513 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
514 pattern> {
515 // AM2 store w/ two operands: (GPR, am2offset)
516 // {13} 1 == Rm, 0 == imm12
517 // {12} isAdd
518 // {11-0} imm12/Rm
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000519 bits<14> offset;
520 bits<4> Rn;
521 let Inst{25} = offset{13};
522 let Inst{23} = offset{12};
523 let Inst{19-16} = Rn;
524 let Inst{11-0} = offset{11-0};
Jim Grosbach953557f42010-11-19 21:35:06 +0000525}
Bruno Cardoso Lopesae085542011-03-31 23:26:08 +0000526// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
527// but for now use this class for STRT and STRBT.
528class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
529 IndexMode im, Format f, InstrItinClass itin, string opc,
530 string asm, string cstr, list<dag> pattern>
531 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
532 pattern> {
533 // AM2 store w/ two operands: (GPR, am2offset)
534 // {17-14} Rn
535 // {13} 1 == Rm, 0 == imm12
536 // {12} isAdd
537 // {11-0} imm12/Rm
538 bits<18> addr;
539 let Inst{25} = addr{13};
540 let Inst{23} = addr{12};
541 let Inst{19-16} = addr{17-14};
542 let Inst{11-0} = addr{11-0};
543}
Jim Grosbach3e556122010-10-26 22:37:02 +0000544
Evan Cheng0d14fc82008-09-01 01:51:14 +0000545// addrmode3 instructions
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000546class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
547 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000548 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach160f8f02010-11-18 00:46:58 +0000549 opc, asm, "", pattern> {
550 bits<14> addr;
551 bits<4> Rt;
552 let Inst{27-25} = 0b000;
553 let Inst{24} = 1; // P bit
554 let Inst{23} = addr{8}; // U bit
555 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
556 let Inst{21} = 0; // W bit
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000557 let Inst{20} = op20; // L bit
Jim Grosbach160f8f02010-11-18 00:46:58 +0000558 let Inst{19-16} = addr{12-9}; // Rn
559 let Inst{15-12} = Rt; // Rt
560 let Inst{11-8} = addr{7-4}; // imm7_4/zero
561 let Inst{7-4} = op;
562 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
563}
Evan Cheng840917b2008-09-01 07:00:14 +0000564
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000565class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
566 IndexMode im, Format f, InstrItinClass itin, string opc,
567 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000568 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000569 opc, asm, cstr, pattern> {
570 bits<4> Rt;
571 let Inst{27-25} = 0b000;
572 let Inst{24} = isPre; // P bit
573 let Inst{21} = isPre; // W bit
574 let Inst{20} = op20; // L bit
575 let Inst{15-12} = Rt; // Rt
576 let Inst{7-4} = op;
577}
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000578
579// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
580// but for now use this class for LDRSBT, LDRHT, LDSHT.
581class AI3ldstidxT<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
582 IndexMode im, Format f, InstrItinClass itin, string opc,
583 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000584 : I<oops, iops, AddrMode3, 4, im, f, itin,
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000585 opc, asm, cstr, pattern> {
586 // {13} 1 == imm8, 0 == Rm
587 // {12-9} Rn
588 // {8} isAdd
589 // {7-4} imm7_4/zero
590 // {3-0} imm3_0/Rm
591 bits<14> addr;
592 bits<4> Rt;
593 let Inst{27-25} = 0b000;
594 let Inst{24} = isPre; // P bit
595 let Inst{23} = addr{8}; // U bit
596 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
597 let Inst{20} = op20; // L bit
598 let Inst{19-16} = addr{12-9}; // Rn
599 let Inst{15-12} = Rt; // Rt
600 let Inst{11-8} = addr{7-4}; // imm7_4/zero
601 let Inst{7-4} = op;
602 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
603 let AsmMatchConverter = "CvtLdWriteBackRegAddrMode3";
604}
605
Jim Grosbach2dc77682010-11-29 18:37:44 +0000606class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
607 IndexMode im, Format f, InstrItinClass itin, string opc,
608 string asm, string cstr, list<dag> pattern>
609 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
610 pattern> {
611 // AM3 store w/ two operands: (GPR, am3offset)
612 bits<14> offset;
613 bits<4> Rt;
614 bits<4> Rn;
615 let Inst{27-25} = 0b000;
616 let Inst{23} = offset{8};
617 let Inst{22} = offset{9};
618 let Inst{19-16} = Rn;
619 let Inst{15-12} = Rt; // Rt
620 let Inst{11-8} = offset{7-4}; // imm7_4/zero
621 let Inst{7-4} = op;
622 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
623}
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000624
Evan Cheng840917b2008-09-01 07:00:14 +0000625// stores
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000626class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000627 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000628 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000629 opc, asm, "", pattern> {
Jim Grosbach570a9222010-11-11 01:09:40 +0000630 bits<14> addr;
631 bits<4> Rt;
Evan Chengdda0f4c2009-07-08 22:51:32 +0000632 let Inst{27-25} = 0b000;
Jim Grosbach570a9222010-11-11 01:09:40 +0000633 let Inst{24} = 1; // P bit
634 let Inst{23} = addr{8}; // U bit
635 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
636 let Inst{21} = 0; // W bit
637 let Inst{20} = 0; // L bit
638 let Inst{19-16} = addr{12-9}; // Rn
639 let Inst{15-12} = Rt; // Rt
640 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000641 let Inst{7-4} = op;
Jim Grosbach570a9222010-11-11 01:09:40 +0000642 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng840917b2008-09-01 07:00:14 +0000643}
Evan Cheng840917b2008-09-01 07:00:14 +0000644
Evan Cheng840917b2008-09-01 07:00:14 +0000645// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000646class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
647 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000648 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000649 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000650 let Inst{4} = 1;
651 let Inst{5} = 1; // H bit
652 let Inst{6} = 0; // S bit
653 let Inst{7} = 1;
654 let Inst{20} = 0; // L bit
655 let Inst{21} = 1; // W bit
656 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000657 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000658}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000659class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
660 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000661 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
Johnny Chen39a4bb32010-02-18 22:31:18 +0000662 opc, asm, cstr, pattern> {
663 let Inst{4} = 1;
664 let Inst{5} = 1; // H bit
665 let Inst{6} = 1; // S bit
666 let Inst{7} = 1;
667 let Inst{20} = 0; // L bit
668 let Inst{21} = 1; // W bit
669 let Inst{24} = 1; // P bit
670 let Inst{27-25} = 0b000;
671}
Evan Cheng840917b2008-09-01 07:00:14 +0000672
Evan Cheng840917b2008-09-01 07:00:14 +0000673// Post-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000674class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
675 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000676 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000677 opc, asm, cstr,pattern> {
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000678 // {13} 1 == imm8, 0 == Rm
679 // {12-9} Rn
680 // {8} isAdd
681 // {7-4} imm7_4/zero
682 // {3-0} imm3_0/Rm
683 bits<14> addr;
684 bits<4> Rt;
685 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng840917b2008-09-01 07:00:14 +0000686 let Inst{4} = 1;
687 let Inst{5} = 1; // H bit
688 let Inst{6} = 0; // S bit
689 let Inst{7} = 1;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000690 let Inst{11-8} = addr{7-4}; // imm7_4/zero
691 let Inst{15-12} = Rt; // Rt
692 let Inst{19-16} = addr{12-9}; // Rn
Evan Cheng840917b2008-09-01 07:00:14 +0000693 let Inst{20} = 0; // L bit
Johnny Chenad4df4c2010-03-01 19:22:00 +0000694 let Inst{21} = 0; // W bit
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000695 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
696 let Inst{23} = addr{8}; // U bit
Evan Cheng840917b2008-09-01 07:00:14 +0000697 let Inst{24} = 0; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000698 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000699}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000700class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
701 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000702 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
Johnny Chen39a4bb32010-02-18 22:31:18 +0000703 opc, asm, cstr, pattern> {
704 let Inst{4} = 1;
705 let Inst{5} = 1; // H bit
706 let Inst{6} = 1; // S bit
707 let Inst{7} = 1;
708 let Inst{20} = 0; // L bit
709 let Inst{21} = 0; // W bit
710 let Inst{24} = 0; // P bit
711 let Inst{27-25} = 0b000;
712}
Evan Cheng840917b2008-09-01 07:00:14 +0000713
Evan Cheng0d14fc82008-09-01 01:51:14 +0000714// addrmode4 instructions
Bill Wendling6c470b82010-11-13 09:09:38 +0000715class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
716 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000717 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000718 bits<4> p;
719 bits<16> regs;
720 bits<4> Rn;
721 let Inst{31-28} = p;
722 let Inst{27-25} = 0b100;
723 let Inst{22} = 0; // S bit
724 let Inst{19-16} = Rn;
725 let Inst{15-0} = regs;
726}
Evan Cheng37f25d92008-08-28 23:39:26 +0000727
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000728// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000729class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
730 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000731 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000732 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000733 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000734 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000735 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000736}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000737class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
738 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000739 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000740 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000741 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000742 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000743}
744
745// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000746class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
747 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000748 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000749 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000750 bits<4> Rd;
751 bits<4> Rn;
752 bits<4> Rm;
753 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000754 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000755 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000756 let Inst{19-16} = Rd;
757 let Inst{11-8} = Rm;
758 let Inst{3-0} = Rn;
759}
760// MSW multiple w/ Ra operand
761class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
762 InstrItinClass itin, string opc, string asm, list<dag> pattern>
763 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
764 bits<4> Ra;
765 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000766}
Evan Cheng37f25d92008-08-28 23:39:26 +0000767
Evan Chengeb4f52e2008-11-06 03:35:07 +0000768// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000769class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000770 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000771 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000772 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000773 bits<4> Rn;
774 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000775 let Inst{4} = 0;
776 let Inst{7} = 1;
777 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000778 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000779 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000780 let Inst{11-8} = Rm;
781 let Inst{3-0} = Rn;
782}
783class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
784 InstrItinClass itin, string opc, string asm, list<dag> pattern>
785 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
786 bits<4> Rd;
787 let Inst{19-16} = Rd;
788}
789
790// AMulxyI with Ra operand
791class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
792 InstrItinClass itin, string opc, string asm, list<dag> pattern>
793 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
794 bits<4> Ra;
795 let Inst{15-12} = Ra;
796}
797// SMLAL*
798class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
799 InstrItinClass itin, string opc, string asm, list<dag> pattern>
800 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
801 bits<4> RdLo;
802 bits<4> RdHi;
803 let Inst{19-16} = RdHi;
804 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000805}
806
Evan Cheng97f48c32008-11-06 22:15:19 +0000807// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000808class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
809 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000810 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000811 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000812 // All AExtI instructions have Rd and Rm register operands.
813 bits<4> Rd;
814 bits<4> Rm;
815 let Inst{15-12} = Rd;
816 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000817 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000818 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000819 let Inst{27-20} = opcod;
820}
821
Evan Cheng8b59db32008-11-07 01:41:35 +0000822// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000823class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
824 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000825 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000826 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000827 bits<4> Rd;
828 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000829 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000830 let Inst{19-16} = 0b1111;
831 let Inst{15-12} = Rd;
832 let Inst{11-8} = 0b1111;
833 let Inst{7-4} = opc7_4;
834 let Inst{3-0} = Rm;
835}
836
837// PKH instructions
Jim Grosbachf6c05252011-07-21 17:23:04 +0000838def PKHLSLAsmOperand : AsmOperandClass {
839 let Name = "PKHLSLImm";
840 let ParserMethod = "parsePKHLSLImm";
841}
Jim Grosbachdde038a2011-07-20 21:40:26 +0000842def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
843 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000844 let ParserMatchClass = PKHLSLAsmOperand;
845}
846def PKHASRAsmOperand : AsmOperandClass {
847 let Name = "PKHASRImm";
848 let ParserMethod = "parsePKHASRImm";
Jim Grosbachdde038a2011-07-20 21:40:26 +0000849}
850def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
851 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000852 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbachdde038a2011-07-20 21:40:26 +0000853}
Jim Grosbach1769a3d2011-07-20 20:49:03 +0000854
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000855class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
856 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000857 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000858 opc, asm, "", pattern> {
859 bits<4> Rd;
860 bits<4> Rn;
861 bits<4> Rm;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000862 bits<5> sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000863 let Inst{27-20} = opcod;
864 let Inst{19-16} = Rn;
865 let Inst{15-12} = Rd;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000866 let Inst{11-7} = sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000867 let Inst{6} = tb;
868 let Inst{5-4} = 0b01;
869 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000870}
871
Evan Cheng37f25d92008-08-28 23:39:26 +0000872//===----------------------------------------------------------------------===//
873
874// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
875class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
876 list<Predicate> Predicates = [IsARM];
877}
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +0000878class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
879 list<Predicate> Predicates = [IsARM, HasV5T];
880}
Evan Cheng37f25d92008-08-28 23:39:26 +0000881class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
882 list<Predicate> Predicates = [IsARM, HasV5TE];
883}
884class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
885 list<Predicate> Predicates = [IsARM, HasV6];
886}
Evan Cheng13096642008-08-29 06:41:12 +0000887
888//===----------------------------------------------------------------------===//
Evan Cheng13096642008-08-29 06:41:12 +0000889// Thumb Instruction Format Definitions.
890//
891
Owen Anderson16884412011-07-13 23:22:26 +0000892class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000893 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000894 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000895 let OutOperandList = oops;
896 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000897 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000898 let Pattern = pattern;
899 list<Predicate> Predicates = [IsThumb];
900}
901
Bill Wendling43f7b2d2010-12-01 02:42:55 +0000902// TI - Thumb instruction.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000903class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000904 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000905
Evan Cheng35d6c412009-08-04 23:47:55 +0000906// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000907class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
908 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000909 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson01135592010-03-23 17:23:59 +0000910 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000911
Johnny Chend68e1192009-12-15 17:24:14 +0000912// tBL, tBX 32-bit instructions
913class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000914 dag oops, dag iops, InstrItinClass itin, string asm,
915 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000916 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson01135592010-03-23 17:23:59 +0000917 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000918 let Inst{31-27} = opcod1;
919 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000920 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000921}
Evan Cheng13096642008-08-29 06:41:12 +0000922
923// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000924class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
925 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000926 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000927
Evan Cheng09c39fc2009-06-23 19:38:13 +0000928// Thumb1 only
Owen Anderson16884412011-07-13 23:22:26 +0000929class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000930 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000931 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000932 let OutOperandList = oops;
933 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000934 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000935 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000936 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng09c39fc2009-06-23 19:38:13 +0000937}
938
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000939class T1I<dag oops, dag iops, InstrItinClass itin,
940 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000941 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000942class T1Ix2<dag oops, dag iops, InstrItinClass itin,
943 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000944 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000945
946// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000947class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000948 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000949 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000950 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000951
952// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson16884412011-07-13 23:22:26 +0000953class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000954 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000955 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000956 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +0000957 let OutOperandList = !con(oops, (outs s_cc_out:$s));
958 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000959 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000960 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000961 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000962}
963
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000964class T1sI<dag oops, dag iops, InstrItinClass itin,
965 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000966 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000967
968// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000969class T1sIt<dag oops, dag iops, InstrItinClass itin,
970 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000971 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling3f8c1102010-11-30 23:54:45 +0000972 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000973
974// Thumb1 instruction that can be predicated.
Owen Anderson16884412011-07-13 23:22:26 +0000975class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000976 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000977 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000978 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000979 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000980 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000981 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000982 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000983 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000984}
985
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000986class T1pI<dag oops, dag iops, InstrItinClass itin,
987 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000988 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000989
990// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000991class T1pIt<dag oops, dag iops, InstrItinClass itin,
992 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000993 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling0b424dc2010-12-01 01:32:02 +0000994 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000995
Bob Wilson01135592010-03-23 17:23:59 +0000996class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000997 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000998 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000999
Johnny Chenbbc71b22009-12-16 02:32:54 +00001000class Encoding16 : Encoding {
1001 let Inst{31-16} = 0x0000;
1002}
1003
Johnny Chend68e1192009-12-15 17:24:14 +00001004// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +00001005class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001006 let Inst{15-10} = opcode;
1007}
1008
1009// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001010class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001011 let Inst{15-14} = 0b00;
1012 let Inst{13-9} = opcode;
1013}
1014
1015// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001016class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001017 let Inst{15-10} = 0b010000;
1018 let Inst{9-6} = opcode;
1019}
1020
1021// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001022class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001023 let Inst{15-10} = 0b010001;
Bill Wendling6bc105a2010-11-17 00:45:23 +00001024 let Inst{9-6} = opcode;
Johnny Chend68e1192009-12-15 17:24:14 +00001025}
1026
1027// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001028class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001029 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001030 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001031}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001032class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001033
Eric Christopher33281b22011-05-27 03:50:53 +00001034class T1BranchCond<bits<4> opcode> : Encoding16 {
1035 let Inst{15-12} = opcode;
1036}
1037
Bill Wendling1fd374e2010-11-30 22:57:21 +00001038// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling3f8c1102010-11-30 23:54:45 +00001039// following bits are used for "opA" (see A6.2.4):
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001040//
Bill Wendling1fd374e2010-11-30 22:57:21 +00001041// 0b0110 => Immediate, 4 bytes
1042// 0b1000 => Immediate, 2 bytes
1043// 0b0111 => Immediate, 1 byte
Bill Wendling40062fb2010-12-01 01:38:08 +00001044class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1045 InstrItinClass itin, string opc, string asm,
1046 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001047 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001048 T1LoadStore<0b0101, opcode> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001049 bits<3> Rt;
1050 bits<8> addr;
1051 let Inst{8-6} = addr{5-3}; // Rm
1052 let Inst{5-3} = addr{2-0}; // Rn
1053 let Inst{2-0} = Rt;
1054}
Bill Wendling40062fb2010-12-01 01:38:08 +00001055class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1056 InstrItinClass itin, string opc, string asm,
1057 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001058 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001059 T1LoadStore<opA, {opB,?,?}> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001060 bits<3> Rt;
1061 bits<8> addr;
1062 let Inst{10-6} = addr{7-3}; // imm5
1063 let Inst{5-3} = addr{2-0}; // Rn
1064 let Inst{2-0} = Rt;
1065}
1066
Johnny Chend68e1192009-12-15 17:24:14 +00001067// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001068class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001069 let Inst{15-12} = 0b1011;
1070 let Inst{11-5} = opcode;
1071}
1072
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001073// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001074class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001075 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001076 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001077 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001078 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001079 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001080 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001081 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001082 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001083 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001084}
1085
Bill Wendlingda2ae632010-08-31 07:50:46 +00001086// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1087// input operand since by default it's a zero register. It will become an
1088// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001089//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001090// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1091// more consistent.
Owen Anderson16884412011-07-13 23:22:26 +00001092class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001093 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001094 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001095 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersonbdf71442010-12-07 20:50:15 +00001096 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1097 let Inst{20} = s;
1098
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001099 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001100 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001101 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001102 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001103 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001104 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001105}
1106
1107// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001108class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001109 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001110 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001111 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001112 let OutOperandList = oops;
1113 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001114 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001115 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001116 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001117 let DecoderNamespace = "Thumb2";
Evan Chengf49810c2009-06-23 17:48:47 +00001118}
1119
Owen Anderson16884412011-07-13 23:22:26 +00001120class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +00001121 InstrItinClass itin,
1122 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001123 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1124 let OutOperandList = oops;
1125 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001126 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001127 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +00001128 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonf1a00902011-07-19 21:06:00 +00001129 let DecoderNamespace = "Thumb";
Jim Grosbachd1228742009-12-01 18:10:36 +00001130}
1131
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001132class T2I<dag oops, dag iops, InstrItinClass itin,
1133 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001134 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001135class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1136 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001137 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001138class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1139 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001140 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001141class T2Iso<dag oops, dag iops, InstrItinClass itin,
1142 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001143 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001144class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1145 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001146 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001147class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001148 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001149 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
Johnny Chend68e1192009-12-15 17:24:14 +00001150 pattern> {
Owen Anderson9d63d902010-12-01 19:18:46 +00001151 bits<4> Rt;
1152 bits<4> Rt2;
1153 bits<13> addr;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001154 let Inst{31-25} = 0b1110100;
1155 let Inst{24} = P;
1156 let Inst{23} = addr{8};
1157 let Inst{22} = 1;
1158 let Inst{21} = W;
1159 let Inst{20} = isLoad;
1160 let Inst{19-16} = addr{12-9};
Owen Anderson9d63d902010-12-01 19:18:46 +00001161 let Inst{15-12} = Rt{3-0};
1162 let Inst{11-8} = Rt2{3-0};
Owen Anderson9d63d902010-12-01 19:18:46 +00001163 let Inst{7-0} = addr{7-0};
Johnny Chend68e1192009-12-15 17:24:14 +00001164}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001165
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001166class T2sI<dag oops, dag iops, InstrItinClass itin,
1167 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001168 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001169
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001170class T2XI<dag oops, dag iops, InstrItinClass itin,
1171 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001172 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001173class T2JTI<dag oops, dag iops, InstrItinClass itin,
1174 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001175 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001176
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001177// Move to/from coprocessor instructions
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001178class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
Jim Grosbach9bb098a2011-07-13 21:14:23 +00001179 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001180 let Inst{31-28} = opc;
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001181}
1182
Bob Wilson815baeb2010-03-13 01:08:20 +00001183// Two-address instructions
1184class T2XIt<dag oops, dag iops, InstrItinClass itin,
1185 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001186 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001187
Evan Chenge88d5ce2009-07-02 07:28:31 +00001188// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001189class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1190 dag oops, dag iops,
1191 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001192 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001193 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001194 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001195 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001196 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001197 let Pattern = pattern;
1198 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001199 let DecoderNamespace = "Thumb2";
Johnny Chend68e1192009-12-15 17:24:14 +00001200 let Inst{31-27} = 0b11111;
1201 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001202 let Inst{24} = signed;
1203 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001204 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001205 let Inst{20} = load;
1206 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001207 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001208 let Inst{10} = pre; // The P bit.
1209 let Inst{8} = 1; // The W bit.
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001210
Owen Anderson6af50f72010-11-30 00:14:31 +00001211 bits<9> addr;
1212 let Inst{7-0} = addr{7-0};
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001213 let Inst{9} = addr{8}; // Sign bit
1214
Owen Anderson6af50f72010-11-30 00:14:31 +00001215 bits<4> Rt;
1216 bits<4> Rn;
1217 let Inst{15-12} = Rt{3-0};
1218 let Inst{19-16} = Rn{3-0};
Evan Chenge88d5ce2009-07-02 07:28:31 +00001219}
1220
David Goodwinc9d138f2009-07-27 19:59:26 +00001221// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1222class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001223 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwinc9d138f2009-07-27 19:59:26 +00001224}
1225
1226// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1227class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001228 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwinc9d138f2009-07-27 19:59:26 +00001229}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001230
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +00001231// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1232class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1233 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1234}
1235
Evan Cheng9cb9e672009-06-27 02:26:13 +00001236// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1237class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001238 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001239}
1240
Evan Cheng13096642008-08-29 06:41:12 +00001241//===----------------------------------------------------------------------===//
1242
Evan Cheng96581d32008-11-11 02:11:05 +00001243//===----------------------------------------------------------------------===//
1244// ARM VFP Instruction templates.
1245//
1246
David Goodwin3ca524e2009-07-10 17:03:29 +00001247// Almost all VFP instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001248class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001249 IndexMode im, Format f, InstrItinClass itin,
1250 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001251 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001252 bits<4> p;
1253 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001254 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001255 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001256 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001257 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001258 let PostEncoderMethod = "VFPThumb2PostEncoder";
David Goodwin3ca524e2009-07-10 17:03:29 +00001259 list<Predicate> Predicates = [HasVFP2];
1260}
1261
1262// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001263class VFPXI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001264 IndexMode im, Format f, InstrItinClass itin,
1265 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001266 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001267 bits<4> p;
1268 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001269 let OutOperandList = oops;
1270 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001271 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001272 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001273 let PostEncoderMethod = "VFPThumb2PostEncoder";
David Goodwin3ca524e2009-07-10 17:03:29 +00001274 list<Predicate> Predicates = [HasVFP2];
1275}
1276
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001277class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1278 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001279 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendlingcf590262010-12-01 21:54:50 +00001280 opc, asm, "", pattern> {
1281 let PostEncoderMethod = "VFPThumb2PostEncoder";
1282}
David Goodwin3ca524e2009-07-10 17:03:29 +00001283
Evan Chengcd8e66a2008-11-11 21:48:44 +00001284// ARM VFP addrmode5 loads and stores
1285class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001286 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001287 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001288 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001289 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001290 // Instruction operands.
1291 bits<5> Dd;
1292 bits<13> addr;
1293
1294 // Encode instruction operands.
1295 let Inst{23} = addr{8}; // U (add = (U == '1'))
1296 let Inst{22} = Dd{4};
1297 let Inst{19-16} = addr{12-9}; // Rn
1298 let Inst{15-12} = Dd{3-0};
1299 let Inst{7-0} = addr{7-0}; // imm8
1300
Evan Cheng96581d32008-11-11 02:11:05 +00001301 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001302 let Inst{27-24} = opcod1;
1303 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001304 let Inst{11-9} = 0b101;
1305 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001306
Evan Cheng5eda2822011-02-16 00:35:02 +00001307 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001308 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001309}
1310
Evan Chengcd8e66a2008-11-11 21:48:44 +00001311class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001312 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001313 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001314 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001315 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001316 // Instruction operands.
1317 bits<5> Sd;
1318 bits<13> addr;
1319
1320 // Encode instruction operands.
1321 let Inst{23} = addr{8}; // U (add = (U == '1'))
1322 let Inst{22} = Sd{0};
1323 let Inst{19-16} = addr{12-9}; // Rn
1324 let Inst{15-12} = Sd{4-1};
1325 let Inst{7-0} = addr{7-0}; // imm8
1326
Evan Cheng96581d32008-11-11 02:11:05 +00001327 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001328 let Inst{27-24} = opcod1;
1329 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001330 let Inst{11-9} = 0b101;
1331 let Inst{8} = 0; // Single precision
Evan Cheng5eda2822011-02-16 00:35:02 +00001332
1333 // Loads & stores operate on both NEON and VFP pipelines.
1334 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001335}
1336
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001337// VFP Load / store multiple pseudo instructions.
1338class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1339 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001340 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001341 cstr, itin> {
1342 let OutOperandList = oops;
1343 let InOperandList = !con(iops, (ins pred:$p));
1344 let Pattern = pattern;
1345 list<Predicate> Predicates = [HasVFP2];
1346}
1347
Evan Chengcd8e66a2008-11-11 21:48:44 +00001348// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001349class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001350 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001351 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001352 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001353 // Instruction operands.
1354 bits<4> Rn;
1355 bits<13> regs;
1356
1357 // Encode instruction operands.
1358 let Inst{19-16} = Rn;
1359 let Inst{22} = regs{12};
1360 let Inst{15-12} = regs{11-8};
1361 let Inst{7-0} = regs{7-0};
1362
Evan Chengcd8e66a2008-11-11 21:48:44 +00001363 // TODO: Mark the instructions with the appropriate subtarget info.
1364 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001365 let Inst{11-9} = 0b101;
1366 let Inst{8} = 1; // Double precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001367}
1368
Jim Grosbach72db1822010-09-08 00:25:50 +00001369class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001370 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001371 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001372 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001373 // Instruction operands.
1374 bits<4> Rn;
1375 bits<13> regs;
1376
1377 // Encode instruction operands.
1378 let Inst{19-16} = Rn;
1379 let Inst{22} = regs{8};
1380 let Inst{15-12} = regs{12-9};
1381 let Inst{7-0} = regs{7-0};
1382
Evan Chengcd8e66a2008-11-11 21:48:44 +00001383 // TODO: Mark the instructions with the appropriate subtarget info.
1384 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001385 let Inst{11-9} = 0b101;
1386 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001387}
1388
Evan Cheng96581d32008-11-11 02:11:05 +00001389// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001390class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1391 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1392 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001393 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001394 // Instruction operands.
1395 bits<5> Dd;
1396 bits<5> Dm;
1397
1398 // Encode instruction operands.
1399 let Inst{3-0} = Dm{3-0};
1400 let Inst{5} = Dm{4};
1401 let Inst{15-12} = Dd{3-0};
1402 let Inst{22} = Dd{4};
1403
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001404 let Inst{27-23} = opcod1;
1405 let Inst{21-20} = opcod2;
1406 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001407 let Inst{11-9} = 0b101;
1408 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001409 let Inst{7-6} = opcod4;
1410 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001411}
1412
1413// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001414class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001415 dag iops, InstrItinClass itin, string opc, string asm,
1416 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001417 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001418 // Instruction operands.
1419 bits<5> Dd;
1420 bits<5> Dn;
1421 bits<5> Dm;
1422
1423 // Encode instruction operands.
1424 let Inst{3-0} = Dm{3-0};
1425 let Inst{5} = Dm{4};
1426 let Inst{19-16} = Dn{3-0};
1427 let Inst{7} = Dn{4};
1428 let Inst{15-12} = Dd{3-0};
1429 let Inst{22} = Dd{4};
1430
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001431 let Inst{27-23} = opcod1;
1432 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001433 let Inst{11-9} = 0b101;
1434 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001435 let Inst{6} = op6;
1436 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001437}
1438
1439// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001440class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1441 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1442 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001443 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001444 // Instruction operands.
1445 bits<5> Sd;
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{15-12} = Sd{4-1};
1452 let Inst{22} = Sd{0};
1453
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001454 let Inst{27-23} = opcod1;
1455 let Inst{21-20} = opcod2;
1456 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001457 let Inst{11-9} = 0b101;
1458 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001459 let Inst{7-6} = opcod4;
1460 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001461}
1462
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001463// Single precision unary, if no NEON. Same as ASuI except not available if
1464// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001465class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1466 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1467 string asm, list<dag> pattern>
1468 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1469 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001470 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1471}
1472
Evan Cheng96581d32008-11-11 02:11:05 +00001473// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001474class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1475 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001476 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001477 // Instruction operands.
1478 bits<5> Sd;
1479 bits<5> Sn;
1480 bits<5> Sm;
1481
1482 // Encode instruction operands.
1483 let Inst{3-0} = Sm{4-1};
1484 let Inst{5} = Sm{0};
1485 let Inst{19-16} = Sn{4-1};
1486 let Inst{7} = Sn{0};
1487 let Inst{15-12} = Sd{4-1};
1488 let Inst{22} = Sd{0};
1489
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001490 let Inst{27-23} = opcod1;
1491 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001492 let Inst{11-9} = 0b101;
1493 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001494 let Inst{6} = op6;
1495 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001496}
1497
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001498// Single precision binary, if no NEON. Same as ASbI except not available if
1499// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001500class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001501 dag iops, InstrItinClass itin, string opc, string asm,
1502 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001503 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001504 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling69661192010-11-01 06:00:39 +00001505
1506 // Instruction operands.
1507 bits<5> Sd;
1508 bits<5> Sn;
1509 bits<5> Sm;
1510
1511 // Encode instruction operands.
1512 let Inst{3-0} = Sm{4-1};
1513 let Inst{5} = Sm{0};
1514 let Inst{19-16} = Sn{4-1};
1515 let Inst{7} = Sn{0};
1516 let Inst{15-12} = Sd{4-1};
1517 let Inst{22} = Sd{0};
David Goodwin42a83f22009-08-04 17:53:06 +00001518}
1519
Evan Cheng80a11982008-11-12 06:41:41 +00001520// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001521class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1522 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1523 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001524 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001525 let Inst{27-23} = opcod1;
1526 let Inst{21-20} = opcod2;
1527 let Inst{19-16} = opcod3;
1528 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001529 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001530 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001531}
1532
Johnny Chen811663f2010-02-11 18:47:03 +00001533// VFP conversion between floating-point and fixed-point
1534class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001535 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1536 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001537 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1538 // size (fixed-point number): sx == 0 ? 16 : 32
1539 let Inst{7} = op5; // sx
1540}
1541
David Goodwin338268c2009-08-10 22:17:39 +00001542// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001543class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001544 dag oops, dag iops, InstrItinClass itin,
1545 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001546 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1547 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001548 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1549}
1550
Evan Cheng80a11982008-11-12 06:41:41 +00001551class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001552 InstrItinClass itin,
1553 string opc, string asm, list<dag> pattern>
1554 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001555 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001556 let Inst{11-8} = opcod2;
1557 let Inst{4} = 1;
1558}
1559
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001560class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1561 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1562 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001563
Bob Wilson01135592010-03-23 17:23:59 +00001564class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001565 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1566 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001567
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001568class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1569 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1570 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001571
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001572class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1573 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1574 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001575
Evan Cheng96581d32008-11-11 02:11:05 +00001576//===----------------------------------------------------------------------===//
1577
Bob Wilson5bafff32009-06-22 23:27:02 +00001578//===----------------------------------------------------------------------===//
1579// ARM NEON Instruction templates.
1580//
Evan Cheng13096642008-08-29 06:41:12 +00001581
Johnny Chencaa608e2010-03-20 00:17:00 +00001582class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1583 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1584 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001585 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001586 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001587 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001588 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001589 let Pattern = pattern;
1590 list<Predicate> Predicates = [HasNEON];
1591}
1592
1593// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001594class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1595 InstrItinClass itin, string opc, string asm, string cstr,
1596 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001597 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001598 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001599 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001600 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001601 let Pattern = pattern;
1602 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001603}
1604
Bob Wilsonb07c1712009-10-07 21:53:04 +00001605class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1606 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001607 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001608 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1609 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001610 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001611 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001612 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001613 let Inst{11-8} = op11_8;
1614 let Inst{7-4} = op7_4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001615
Chris Lattner2ac19022010-11-15 05:19:05 +00001616 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001617
Owen Andersond9aa7d32010-11-02 00:05:05 +00001618 bits<5> Vd;
Owen Andersonf431eda2010-11-02 23:47:29 +00001619 bits<6> Rn;
1620 bits<4> Rm;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001621
Owen Andersond9aa7d32010-11-02 00:05:05 +00001622 let Inst{22} = Vd{4};
1623 let Inst{15-12} = Vd{3-0};
Owen Andersonf431eda2010-11-02 23:47:29 +00001624 let Inst{19-16} = Rn{3-0};
1625 let Inst{3-0} = Rm{3-0};
Bob Wilson205a5ca2009-07-08 18:11:30 +00001626}
1627
Owen Andersond138d702010-11-02 20:47:39 +00001628class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1629 dag oops, dag iops, InstrItinClass itin,
1630 string opc, string dt, string asm, string cstr, list<dag> pattern>
1631 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1632 dt, asm, cstr, pattern> {
1633 bits<3> lane;
1634}
1635
Bob Wilson709d5922010-08-25 23:27:42 +00001636class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson16884412011-07-13 23:22:26 +00001637 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson709d5922010-08-25 23:27:42 +00001638 itin> {
1639 let OutOperandList = oops;
1640 let InOperandList = !con(iops, (ins pred:$p));
1641 list<Predicate> Predicates = [HasNEON];
1642}
1643
Jim Grosbach7cd27292010-10-06 20:36:55 +00001644class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1645 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001646 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonbd916c52010-09-13 23:55:10 +00001647 itin> {
1648 let OutOperandList = oops;
1649 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001650 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001651 list<Predicate> Predicates = [HasNEON];
1652}
1653
Johnny Chen785516a2010-03-23 16:43:47 +00001654class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001655 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001656 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1657 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001658 let Inst{31-25} = 0b1111001;
Chris Lattner2ac19022010-11-15 05:19:05 +00001659 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Evan Chengf81bf152009-11-23 21:57:23 +00001660}
1661
Johnny Chen927b88f2010-03-23 20:40:44 +00001662class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001663 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001664 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001665 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001666 let Inst{31-25} = 0b1111001;
Owen Andersonac00e962010-12-10 22:32:08 +00001667 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Bob Wilson5bafff32009-06-22 23:27:02 +00001668}
1669
1670// NEON "one register and a modified immediate" format.
1671class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1672 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001673 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001674 string opc, string dt, string asm, string cstr,
1675 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001676 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001677 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001678 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001679 let Inst{11-8} = op11_8;
1680 let Inst{7} = op7;
1681 let Inst{6} = op6;
1682 let Inst{5} = op5;
1683 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001684
Owen Andersona88ea032010-10-26 17:40:54 +00001685 // Instruction operands.
1686 bits<5> Vd;
1687 bits<13> SIMM;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001688
Owen Andersona88ea032010-10-26 17:40:54 +00001689 let Inst{15-12} = Vd{3-0};
1690 let Inst{22} = Vd{4};
1691 let Inst{24} = SIMM{7};
1692 let Inst{18-16} = SIMM{6-4};
1693 let Inst{3-0} = SIMM{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001694}
1695
1696// NEON 2 vector register format.
1697class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1698 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001699 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001700 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001701 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001702 let Inst{24-23} = op24_23;
1703 let Inst{21-20} = op21_20;
1704 let Inst{19-18} = op19_18;
1705 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001706 let Inst{11-7} = op11_7;
1707 let Inst{6} = op6;
1708 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001709
Owen Anderson162875a2010-10-25 18:43:52 +00001710 // Instruction operands.
1711 bits<5> Vd;
1712 bits<5> Vm;
1713
1714 let Inst{15-12} = Vd{3-0};
1715 let Inst{22} = Vd{4};
1716 let Inst{3-0} = Vm{3-0};
1717 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001718}
1719
1720// Same as N2V except it doesn't have a datatype suffix.
1721class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001722 bits<5> op11_7, bit op6, bit op4,
1723 dag oops, dag iops, InstrItinClass itin,
1724 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001725 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001726 let Inst{24-23} = op24_23;
1727 let Inst{21-20} = op21_20;
1728 let Inst{19-18} = op19_18;
1729 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001730 let Inst{11-7} = op11_7;
1731 let Inst{6} = op6;
1732 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001733
Owen Anderson162875a2010-10-25 18:43:52 +00001734 // Instruction operands.
1735 bits<5> Vd;
1736 bits<5> Vm;
1737
1738 let Inst{15-12} = Vd{3-0};
1739 let Inst{22} = Vd{4};
1740 let Inst{3-0} = Vm{3-0};
1741 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001742}
1743
1744// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001745class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001746 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001747 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001748 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001749 let Inst{24} = op24;
1750 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001751 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001752 let Inst{7} = op7;
1753 let Inst{6} = op6;
1754 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001755
Owen Anderson3557d002010-10-26 20:56:57 +00001756 // Instruction operands.
1757 bits<5> Vd;
1758 bits<5> Vm;
1759 bits<6> SIMM;
1760
1761 let Inst{15-12} = Vd{3-0};
1762 let Inst{22} = Vd{4};
1763 let Inst{3-0} = Vm{3-0};
1764 let Inst{5} = Vm{4};
1765 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001766}
1767
Bob Wilson10bc69c2010-03-27 03:56:52 +00001768// NEON 3 vector register format.
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001769
Jim Grosbach6635b042011-05-19 17:34:53 +00001770class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1771 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1772 string opc, string dt, string asm, string cstr,
1773 list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001774 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001775 let Inst{24} = op24;
1776 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001777 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001778 let Inst{11-8} = op11_8;
1779 let Inst{6} = op6;
1780 let Inst{4} = op4;
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001781}
1782
1783class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1784 dag oops, dag iops, Format f, InstrItinClass itin,
1785 string opc, string dt, string asm, string cstr, list<dag> pattern>
1786 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1787 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001788
Owen Andersond451f882010-10-21 20:21:49 +00001789 // Instruction operands.
1790 bits<5> Vd;
1791 bits<5> Vn;
1792 bits<5> Vm;
1793
1794 let Inst{15-12} = Vd{3-0};
1795 let Inst{22} = Vd{4};
1796 let Inst{19-16} = Vn{3-0};
1797 let Inst{7} = Vn{4};
1798 let Inst{3-0} = Vm{3-0};
1799 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001800}
1801
Jim Grosbach6635b042011-05-19 17:34:53 +00001802class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1803 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1804 string opc, string dt, string asm, string cstr,
1805 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001806 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1807 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1808
1809 // Instruction operands.
1810 bits<5> Vd;
1811 bits<5> Vn;
1812 bits<5> Vm;
1813 bit lane;
1814
1815 let Inst{15-12} = Vd{3-0};
1816 let Inst{22} = Vd{4};
1817 let Inst{19-16} = Vn{3-0};
1818 let Inst{7} = Vn{4};
1819 let Inst{3-0} = Vm{3-0};
1820 let Inst{5} = lane;
1821}
1822
Jim Grosbach6635b042011-05-19 17:34:53 +00001823class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1824 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1825 string opc, string dt, string asm, string cstr,
1826 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001827 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1828 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1829
1830 // Instruction operands.
1831 bits<5> Vd;
1832 bits<5> Vn;
1833 bits<5> Vm;
1834 bits<2> lane;
1835
1836 let Inst{15-12} = Vd{3-0};
1837 let Inst{22} = Vd{4};
1838 let Inst{19-16} = Vn{3-0};
1839 let Inst{7} = Vn{4};
1840 let Inst{2-0} = Vm{2-0};
1841 let Inst{5} = lane{1};
1842 let Inst{3} = lane{0};
1843}
1844
Johnny Chen841e8282010-03-23 21:35:03 +00001845// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001846class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1847 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001848 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001849 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001850 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001851 let Inst{24} = op24;
1852 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001853 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001854 let Inst{11-8} = op11_8;
1855 let Inst{6} = op6;
1856 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001857
Owen Anderson8c71eff2010-10-25 18:28:30 +00001858 // Instruction operands.
1859 bits<5> Vd;
1860 bits<5> Vn;
1861 bits<5> Vm;
1862
1863 let Inst{15-12} = Vd{3-0};
1864 let Inst{22} = Vd{4};
1865 let Inst{19-16} = Vn{3-0};
1866 let Inst{7} = Vn{4};
1867 let Inst{3-0} = Vm{3-0};
1868 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001869}
1870
1871// NEON VMOVs between scalar and core registers.
1872class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001873 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001874 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001875 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001876 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001877 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001878 let Inst{11-8} = opcod2;
1879 let Inst{6-5} = opcod3;
1880 let Inst{4} = 1;
Johnny Chena9611542011-04-06 18:27:46 +00001881 // A8.6.303, A8.6.328, A8.6.329
1882 let Inst{3-0} = 0b0000;
Evan Chengf81bf152009-11-23 21:57:23 +00001883
1884 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001885 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001886 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001887 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001888 list<Predicate> Predicates = [HasNEON];
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001889
Chris Lattner2ac19022010-11-15 05:19:05 +00001890 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001891
Owen Andersond2fbdb72010-10-27 21:28:09 +00001892 bits<5> V;
1893 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001894 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001895 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001896
Owen Andersonf587a9352010-10-27 19:25:54 +00001897 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001898 let Inst{7} = V{4};
1899 let Inst{19-16} = V{3-0};
1900 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001901}
1902class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001903 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001904 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001905 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001906 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001907class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001908 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001909 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001910 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001911 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001912class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001913 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001914 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001915 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001916 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001917
Johnny Chene4614f72010-03-25 17:01:27 +00001918// Vector Duplicate Lane (from scalar to all elements)
1919class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1920 InstrItinClass itin, string opc, string dt, string asm,
1921 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001922 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001923 let Inst{24-23} = 0b11;
1924 let Inst{21-20} = 0b11;
1925 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001926 let Inst{11-7} = 0b11000;
1927 let Inst{6} = op6;
1928 let Inst{4} = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001929
Owen Andersonf587a9352010-10-27 19:25:54 +00001930 bits<5> Vd;
1931 bits<5> Vm;
1932 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001933
Owen Andersonf587a9352010-10-27 19:25:54 +00001934 let Inst{22} = Vd{4};
1935 let Inst{15-12} = Vd{3-0};
1936 let Inst{5} = Vm{4};
1937 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001938}
1939
David Goodwin42a83f22009-08-04 17:53:06 +00001940// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1941// for single-precision FP.
1942class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1943 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1944}