blob: 97e807ccc228a1aa844e41e6c988fd0cf0724944 [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;
Jim Grosbachdfdf02d2011-07-26 17:44:46 +0000421 bits<4> addr;
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 Grosbachdfdf02d2011-07-26 17:44:46 +0000425 let Inst{19-16} = addr;
Jim Grosbach86875a22010-10-29 19:58:57 +0000426 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>
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000445 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000446 bits<4> Rt;
447 bits<4> Rt2;
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000448 bits<4> addr;
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000449 let Inst{27-23} = 0b00010;
450 let Inst{22} = b;
451 let Inst{21-20} = 0b00;
Jim Grosbach4f6f13d2011-07-26 17:15:11 +0000452 let Inst{19-16} = addr;
Jim Grosbachf32ecc62010-10-29 20:21:36 +0000453 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}
Owen Anderson793e7962011-07-26 20:54:26 +0000510class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach953557f42010-11-19 21:35:06 +0000511 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)
Jim Grosbach953557f42010-11-19 21:35:06 +0000516 // {12} isAdd
517 // {11-0} imm12/Rm
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000518 bits<14> offset;
519 bits<4> Rn;
Owen Anderson793e7962011-07-26 20:54:26 +0000520 let Inst{25} = 1;
521 let Inst{23} = offset{12};
522 let Inst{19-16} = Rn;
523 let Inst{11-5} = offset{11-5};
524 let Inst{4} = 0;
525 let Inst{3-0} = offset{3-0};
526}
527
528class AI2stridx_imm<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 // {12} isAdd
535 // {11-0} imm12/Rm
536 bits<14> offset;
537 bits<4> Rn;
538 let Inst{25} = 0;
Bruno Cardoso Lopesb41aaab2011-03-31 15:54:36 +0000539 let Inst{23} = offset{12};
540 let Inst{19-16} = Rn;
541 let Inst{11-0} = offset{11-0};
Jim Grosbach953557f42010-11-19 21:35:06 +0000542}
Owen Anderson793e7962011-07-26 20:54:26 +0000543
544
Bruno Cardoso Lopesae085542011-03-31 23:26:08 +0000545// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
546// but for now use this class for STRT and STRBT.
547class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
548 IndexMode im, Format f, InstrItinClass itin, string opc,
549 string asm, string cstr, list<dag> pattern>
550 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
551 pattern> {
552 // AM2 store w/ two operands: (GPR, am2offset)
553 // {17-14} Rn
554 // {13} 1 == Rm, 0 == imm12
555 // {12} isAdd
556 // {11-0} imm12/Rm
557 bits<18> addr;
558 let Inst{25} = addr{13};
559 let Inst{23} = addr{12};
560 let Inst{19-16} = addr{17-14};
561 let Inst{11-0} = addr{11-0};
562}
Jim Grosbach3e556122010-10-26 22:37:02 +0000563
Evan Cheng0d14fc82008-09-01 01:51:14 +0000564// addrmode3 instructions
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000565class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
566 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000567 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach160f8f02010-11-18 00:46:58 +0000568 opc, asm, "", pattern> {
569 bits<14> addr;
570 bits<4> Rt;
571 let Inst{27-25} = 0b000;
572 let Inst{24} = 1; // P bit
573 let Inst{23} = addr{8}; // U bit
574 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
575 let Inst{21} = 0; // W bit
Jim Grosbachf1ce7cc2010-11-19 18:16:46 +0000576 let Inst{20} = op20; // L bit
Jim Grosbach160f8f02010-11-18 00:46:58 +0000577 let Inst{19-16} = addr{12-9}; // Rn
578 let Inst{15-12} = Rt; // Rt
579 let Inst{11-8} = addr{7-4}; // imm7_4/zero
580 let Inst{7-4} = op;
581 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
582}
Evan Cheng840917b2008-09-01 07:00:14 +0000583
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000584class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
585 IndexMode im, Format f, InstrItinClass itin, string opc,
586 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000587 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000588 opc, asm, cstr, pattern> {
589 bits<4> Rt;
590 let Inst{27-25} = 0b000;
591 let Inst{24} = isPre; // P bit
592 let Inst{21} = isPre; // W bit
593 let Inst{20} = op20; // L bit
594 let Inst{15-12} = Rt; // Rt
595 let Inst{7-4} = op;
596}
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000597
598// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
599// but for now use this class for LDRSBT, LDRHT, LDSHT.
Jim Grosbach7ce05792011-08-03 23:50:40 +0000600class AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000601 IndexMode im, Format f, InstrItinClass itin, string opc,
602 string asm, string cstr, list<dag> pattern>
Jim Grosbach7ce05792011-08-03 23:50:40 +0000603 : I<oops, iops, AddrMode3, 4, im, f, itin, opc, asm, cstr, pattern> {
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000604 // {13} 1 == imm8, 0 == Rm
605 // {12-9} Rn
606 // {8} isAdd
607 // {7-4} imm7_4/zero
608 // {3-0} imm3_0/Rm
Jim Grosbach7ce05792011-08-03 23:50:40 +0000609 bits<4> addr;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000610 bits<4> Rt;
611 let Inst{27-25} = 0b000;
Jim Grosbach7ce05792011-08-03 23:50:40 +0000612 let Inst{24} = 0; // P bit
613 let Inst{21} = 1;
614 let Inst{20} = isLoad; // L bit
615 let Inst{19-16} = addr; // Rn
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000616 let Inst{15-12} = Rt; // Rt
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000617 let Inst{7-4} = op;
Bruno Cardoso Lopesac79e4c2011-04-04 17:18:19 +0000618}
619
Jim Grosbach2dc77682010-11-29 18:37:44 +0000620class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
621 IndexMode im, Format f, InstrItinClass itin, string opc,
622 string asm, string cstr, list<dag> pattern>
623 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
624 pattern> {
625 // AM3 store w/ two operands: (GPR, am3offset)
626 bits<14> offset;
627 bits<4> Rt;
628 bits<4> Rn;
629 let Inst{27-25} = 0b000;
630 let Inst{23} = offset{8};
631 let Inst{22} = offset{9};
632 let Inst{19-16} = Rn;
633 let Inst{15-12} = Rt; // Rt
634 let Inst{11-8} = offset{7-4}; // imm7_4/zero
635 let Inst{7-4} = op;
636 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
637}
Jim Grosbach9cb15b52010-11-19 19:41:26 +0000638
Evan Cheng840917b2008-09-01 07:00:14 +0000639// stores
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000640class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000641 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000642 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000643 opc, asm, "", pattern> {
Jim Grosbach570a9222010-11-11 01:09:40 +0000644 bits<14> addr;
645 bits<4> Rt;
Evan Chengdda0f4c2009-07-08 22:51:32 +0000646 let Inst{27-25} = 0b000;
Jim Grosbach570a9222010-11-11 01:09:40 +0000647 let Inst{24} = 1; // P bit
648 let Inst{23} = addr{8}; // U bit
649 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
650 let Inst{21} = 0; // W bit
651 let Inst{20} = 0; // L bit
652 let Inst{19-16} = addr{12-9}; // Rn
653 let Inst{15-12} = Rt; // Rt
654 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach2aeb6122010-11-19 22:14:31 +0000655 let Inst{7-4} = op;
Jim Grosbach570a9222010-11-11 01:09:40 +0000656 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng840917b2008-09-01 07:00:14 +0000657}
Evan Cheng840917b2008-09-01 07:00:14 +0000658
Evan Cheng840917b2008-09-01 07:00:14 +0000659// Pre-indexed stores
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000660class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
661 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000662 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000663 opc, asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000664 let Inst{4} = 1;
665 let Inst{5} = 1; // H bit
666 let Inst{6} = 0; // S bit
667 let Inst{7} = 1;
668 let Inst{20} = 0; // L bit
669 let Inst{21} = 1; // W bit
670 let Inst{24} = 1; // P bit
Evan Chengdda0f4c2009-07-08 22:51:32 +0000671 let Inst{27-25} = 0b000;
Evan Cheng840917b2008-09-01 07:00:14 +0000672}
Johnny Chen39a4bb32010-02-18 22:31:18 +0000673class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
674 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000675 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
Johnny Chen39a4bb32010-02-18 22:31:18 +0000676 opc, asm, cstr, pattern> {
677 let Inst{4} = 1;
678 let Inst{5} = 1; // H bit
679 let Inst{6} = 1; // S bit
680 let Inst{7} = 1;
681 let Inst{20} = 0; // L bit
682 let Inst{21} = 1; // W bit
683 let Inst{24} = 1; // P bit
684 let Inst{27-25} = 0b000;
685}
Evan Cheng840917b2008-09-01 07:00:14 +0000686
Evan Cheng840917b2008-09-01 07:00:14 +0000687// Post-indexed stores
Johnny Chen39a4bb32010-02-18 22:31:18 +0000688class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
689 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000690 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
Johnny Chen39a4bb32010-02-18 22:31:18 +0000691 opc, asm, cstr, pattern> {
692 let Inst{4} = 1;
693 let Inst{5} = 1; // H bit
694 let Inst{6} = 1; // S bit
695 let Inst{7} = 1;
696 let Inst{20} = 0; // L bit
697 let Inst{21} = 0; // W bit
698 let Inst{24} = 0; // P bit
699 let Inst{27-25} = 0b000;
700}
Evan Cheng840917b2008-09-01 07:00:14 +0000701
Evan Cheng0d14fc82008-09-01 01:51:14 +0000702// addrmode4 instructions
Bill Wendling6c470b82010-11-13 09:09:38 +0000703class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
704 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000705 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendling6c470b82010-11-13 09:09:38 +0000706 bits<4> p;
707 bits<16> regs;
708 bits<4> Rn;
709 let Inst{31-28} = p;
710 let Inst{27-25} = 0b100;
711 let Inst{22} = 0; // S bit
712 let Inst{19-16} = Rn;
713 let Inst{15-0} = regs;
714}
Evan Cheng37f25d92008-08-28 23:39:26 +0000715
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000716// Unsigned multiply, multiply-accumulate instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000717class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
718 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000719 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000720 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000721 let Inst{7-4} = 0b1001;
Evan Chengfbc9d412008-11-06 01:21:28 +0000722 let Inst{20} = 0; // S bit
Evan Chengd87293c2008-11-06 08:47:38 +0000723 let Inst{27-21} = opcod;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000724}
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000725class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
726 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000727 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000728 opc, asm, "", pattern> {
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000729 let Inst{7-4} = 0b1001;
Evan Chengd87293c2008-11-06 08:47:38 +0000730 let Inst{27-21} = opcod;
Evan Chengfbc9d412008-11-06 01:21:28 +0000731}
732
733// Most significant word multiply
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000734class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
735 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000736 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000737 opc, asm, "", pattern> {
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000738 bits<4> Rd;
739 bits<4> Rn;
740 bits<4> Rm;
741 let Inst{7-4} = opc7_4;
Evan Chengfbc9d412008-11-06 01:21:28 +0000742 let Inst{20} = 1;
Evan Chengd87293c2008-11-06 08:47:38 +0000743 let Inst{27-21} = opcod;
Jim Grosbach9463d0e2010-10-22 17:16:17 +0000744 let Inst{19-16} = Rd;
745 let Inst{11-8} = Rm;
746 let Inst{3-0} = Rn;
747}
748// MSW multiple w/ Ra operand
749class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
750 InstrItinClass itin, string opc, string asm, list<dag> pattern>
751 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
752 bits<4> Ra;
753 let Inst{15-12} = Ra;
Jim Grosbach0a4b9dc2008-11-03 18:38:31 +0000754}
Evan Cheng37f25d92008-08-28 23:39:26 +0000755
Evan Chengeb4f52e2008-11-06 03:35:07 +0000756// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach3870b752010-10-22 18:35:16 +0000757class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbach929a7052010-10-22 17:42:06 +0000758 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000759 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000760 opc, asm, "", pattern> {
Jim Grosbach3870b752010-10-22 18:35:16 +0000761 bits<4> Rn;
762 bits<4> Rm;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000763 let Inst{4} = 0;
764 let Inst{7} = 1;
765 let Inst{20} = 0;
Evan Chengd87293c2008-11-06 08:47:38 +0000766 let Inst{27-21} = opcod;
Jim Grosbach929a7052010-10-22 17:42:06 +0000767 let Inst{6-5} = bit6_5;
Jim Grosbach3870b752010-10-22 18:35:16 +0000768 let Inst{11-8} = Rm;
769 let Inst{3-0} = Rn;
770}
771class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
772 InstrItinClass itin, string opc, string asm, list<dag> pattern>
773 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
774 bits<4> Rd;
775 let Inst{19-16} = Rd;
776}
777
778// AMulxyI with Ra operand
779class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
780 InstrItinClass itin, string opc, string asm, list<dag> pattern>
781 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
782 bits<4> Ra;
783 let Inst{15-12} = Ra;
784}
785// SMLAL*
786class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
787 InstrItinClass itin, string opc, string asm, list<dag> pattern>
788 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
789 bits<4> RdLo;
790 bits<4> RdHi;
791 let Inst{19-16} = RdHi;
792 let Inst{15-12} = RdLo;
Evan Chengeb4f52e2008-11-06 03:35:07 +0000793}
794
Evan Cheng97f48c32008-11-06 22:15:19 +0000795// Extend instructions.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000796class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
797 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000798 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000799 opc, asm, "", pattern> {
Jim Grosbachb35ad412010-10-13 19:56:10 +0000800 // All AExtI instructions have Rd and Rm register operands.
801 bits<4> Rd;
802 bits<4> Rm;
803 let Inst{15-12} = Rd;
804 let Inst{3-0} = Rm;
Evan Cheng97f48c32008-11-06 22:15:19 +0000805 let Inst{7-4} = 0b0111;
Jim Grosbachb35ad412010-10-13 19:56:10 +0000806 let Inst{9-8} = 0b00;
Evan Cheng97f48c32008-11-06 22:15:19 +0000807 let Inst{27-20} = opcod;
808}
809
Evan Cheng8b59db32008-11-07 01:41:35 +0000810// Misc Arithmetic instructions.
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000811class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
812 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000813 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000814 opc, asm, "", pattern> {
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000815 bits<4> Rd;
816 bits<4> Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000817 let Inst{27-20} = opcod;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000818 let Inst{19-16} = 0b1111;
819 let Inst{15-12} = Rd;
820 let Inst{11-8} = 0b1111;
821 let Inst{7-4} = opc7_4;
822 let Inst{3-0} = Rm;
823}
824
825// PKH instructions
Jim Grosbachf6c05252011-07-21 17:23:04 +0000826def PKHLSLAsmOperand : AsmOperandClass {
827 let Name = "PKHLSLImm";
828 let ParserMethod = "parsePKHLSLImm";
829}
Jim Grosbachdde038a2011-07-20 21:40:26 +0000830def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
831 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000832 let ParserMatchClass = PKHLSLAsmOperand;
833}
834def PKHASRAsmOperand : AsmOperandClass {
835 let Name = "PKHASRImm";
836 let ParserMethod = "parsePKHASRImm";
Jim Grosbachdde038a2011-07-20 21:40:26 +0000837}
838def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
839 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbachf6c05252011-07-21 17:23:04 +0000840 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbachdde038a2011-07-20 21:40:26 +0000841}
Jim Grosbach1769a3d2011-07-20 20:49:03 +0000842
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000843class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
844 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000845 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000846 opc, asm, "", pattern> {
847 bits<4> Rd;
848 bits<4> Rn;
849 bits<4> Rm;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000850 bits<5> sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000851 let Inst{27-20} = opcod;
852 let Inst{19-16} = Rn;
853 let Inst{15-12} = Rd;
Jim Grosbacha0472dc2011-07-20 20:32:09 +0000854 let Inst{11-7} = sh;
Jim Grosbachf8da5f52010-10-22 22:12:16 +0000855 let Inst{6} = tb;
856 let Inst{5-4} = 0b01;
857 let Inst{3-0} = Rm;
Evan Cheng8b59db32008-11-07 01:41:35 +0000858}
859
Evan Cheng37f25d92008-08-28 23:39:26 +0000860//===----------------------------------------------------------------------===//
861
862// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
863class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
864 list<Predicate> Predicates = [IsARM];
865}
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +0000866class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
867 list<Predicate> Predicates = [IsARM, HasV5T];
868}
Evan Cheng37f25d92008-08-28 23:39:26 +0000869class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
870 list<Predicate> Predicates = [IsARM, HasV5TE];
871}
872class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
873 list<Predicate> Predicates = [IsARM, HasV6];
874}
Evan Cheng13096642008-08-29 06:41:12 +0000875
876//===----------------------------------------------------------------------===//
Evan Cheng13096642008-08-29 06:41:12 +0000877// Thumb Instruction Format Definitions.
878//
879
Owen Anderson16884412011-07-13 23:22:26 +0000880class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000881 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000882 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000883 let OutOperandList = oops;
884 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000885 let AsmString = asm;
Evan Cheng13096642008-08-29 06:41:12 +0000886 let Pattern = pattern;
887 list<Predicate> Predicates = [IsThumb];
888}
889
Bill Wendling43f7b2d2010-12-01 02:42:55 +0000890// TI - Thumb instruction.
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000891class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000892 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000893
Evan Cheng35d6c412009-08-04 23:47:55 +0000894// Two-address instructions
Bob Wilson01135592010-03-23 17:23:59 +0000895class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
896 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000897 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson01135592010-03-23 17:23:59 +0000898 pattern>;
Evan Cheng35d6c412009-08-04 23:47:55 +0000899
Johnny Chend68e1192009-12-15 17:24:14 +0000900// tBL, tBX 32-bit instructions
901class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson01135592010-03-23 17:23:59 +0000902 dag oops, dag iops, InstrItinClass itin, string asm,
903 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000904 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson01135592010-03-23 17:23:59 +0000905 Encoding {
Johnny Chend68e1192009-12-15 17:24:14 +0000906 let Inst{31-27} = opcod1;
907 let Inst{15-14} = opcod2;
Bill Wendlingda2ae632010-08-31 07:50:46 +0000908 let Inst{12} = opcod3;
Johnny Chend68e1192009-12-15 17:24:14 +0000909}
Evan Cheng13096642008-08-29 06:41:12 +0000910
911// BR_JT instructions
Bob Wilson01135592010-03-23 17:23:59 +0000912class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
913 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000914 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng13096642008-08-29 06:41:12 +0000915
Evan Cheng09c39fc2009-06-23 19:38:13 +0000916// Thumb1 only
Owen Anderson16884412011-07-13 23:22:26 +0000917class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000918 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000919 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000920 let OutOperandList = oops;
921 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +0000922 let AsmString = asm;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000923 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000924 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng09c39fc2009-06-23 19:38:13 +0000925}
926
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000927class T1I<dag oops, dag iops, InstrItinClass itin,
928 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000929 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000930class T1Ix2<dag oops, dag iops, InstrItinClass itin,
931 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000932 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000933
934// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000935class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000936 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000937 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson815baeb2010-03-13 01:08:20 +0000938 asm, cstr, pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000939
940// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson16884412011-07-13 23:22:26 +0000941class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000942 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000943 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000944 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerb7d52262010-03-18 21:06:54 +0000945 let OutOperandList = !con(oops, (outs s_cc_out:$s));
946 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000947 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000948 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000949 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000950}
951
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000952class T1sI<dag oops, dag iops, InstrItinClass itin,
953 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000954 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000955
956// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000957class T1sIt<dag oops, dag iops, InstrItinClass itin,
958 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000959 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling3f8c1102010-11-30 23:54:45 +0000960 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000961
962// Thumb1 instruction that can be predicated.
Owen Anderson16884412011-07-13 23:22:26 +0000963class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000964 InstrItinClass itin,
Evan Cheng446c4282009-07-11 06:43:01 +0000965 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chend68e1192009-12-15 17:24:14 +0000966 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng446c4282009-07-11 06:43:01 +0000967 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +0000968 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +0000969 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng446c4282009-07-11 06:43:01 +0000970 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +0000971 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Cheng446c4282009-07-11 06:43:01 +0000972}
973
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000974class T1pI<dag oops, dag iops, InstrItinClass itin,
975 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000976 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000977
978// Two-address instructions
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000979class T1pIt<dag oops, dag iops, InstrItinClass itin,
980 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000981 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling0b424dc2010-12-01 01:32:02 +0000982 "$Rn = $Rdn", pattern>;
Evan Cheng446c4282009-07-11 06:43:01 +0000983
Bob Wilson01135592010-03-23 17:23:59 +0000984class T1pIs<dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +0000985 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +0000986 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Cheng09c39fc2009-06-23 19:38:13 +0000987
Johnny Chenbbc71b22009-12-16 02:32:54 +0000988class Encoding16 : Encoding {
989 let Inst{31-16} = 0x0000;
990}
991
Johnny Chend68e1192009-12-15 17:24:14 +0000992// A6.2 16-bit Thumb instruction encoding
Johnny Chenbbc71b22009-12-16 02:32:54 +0000993class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000994 let Inst{15-10} = opcode;
995}
996
997// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +0000998class T1General<bits<5> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +0000999 let Inst{15-14} = 0b00;
1000 let Inst{13-9} = opcode;
1001}
1002
1003// A6.2.2 Data-processing encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001004class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001005 let Inst{15-10} = 0b010000;
1006 let Inst{9-6} = opcode;
1007}
1008
1009// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001010class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001011 let Inst{15-10} = 0b010001;
Bill Wendling6bc105a2010-11-17 00:45:23 +00001012 let Inst{9-6} = opcode;
Johnny Chend68e1192009-12-15 17:24:14 +00001013}
1014
1015// A6.2.4 Load/store single data item encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001016class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001017 let Inst{15-12} = opA;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001018 let Inst{11-9} = opB;
Johnny Chend68e1192009-12-15 17:24:14 +00001019}
Bill Wendlingda2ae632010-08-31 07:50:46 +00001020class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chend68e1192009-12-15 17:24:14 +00001021
Eric Christopher33281b22011-05-27 03:50:53 +00001022class T1BranchCond<bits<4> opcode> : Encoding16 {
1023 let Inst{15-12} = opcode;
1024}
1025
Bill Wendling1fd374e2010-11-30 22:57:21 +00001026// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling3f8c1102010-11-30 23:54:45 +00001027// following bits are used for "opA" (see A6.2.4):
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001028//
Bill Wendling1fd374e2010-11-30 22:57:21 +00001029// 0b0110 => Immediate, 4 bytes
1030// 0b1000 => Immediate, 2 bytes
1031// 0b0111 => Immediate, 1 byte
Bill Wendling40062fb2010-12-01 01:38:08 +00001032class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1033 InstrItinClass itin, string opc, string asm,
1034 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001035 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001036 T1LoadStore<0b0101, opcode> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001037 bits<3> Rt;
1038 bits<8> addr;
1039 let Inst{8-6} = addr{5-3}; // Rm
1040 let Inst{5-3} = addr{2-0}; // Rn
1041 let Inst{2-0} = Rt;
1042}
Bill Wendling40062fb2010-12-01 01:38:08 +00001043class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1044 InstrItinClass itin, string opc, string asm,
1045 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001046 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling2cbc9fe2010-11-30 23:16:25 +00001047 T1LoadStore<opA, {opB,?,?}> {
Bill Wendling1fd374e2010-11-30 22:57:21 +00001048 bits<3> Rt;
1049 bits<8> addr;
1050 let Inst{10-6} = addr{7-3}; // imm5
1051 let Inst{5-3} = addr{2-0}; // Rn
1052 let Inst{2-0} = Rt;
1053}
1054
Johnny Chend68e1192009-12-15 17:24:14 +00001055// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chenbbc71b22009-12-16 02:32:54 +00001056class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chend68e1192009-12-15 17:24:14 +00001057 let Inst{15-12} = 0b1011;
1058 let Inst{11-5} = opcode;
1059}
1060
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001061// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001062class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001063 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001064 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001065 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001066 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001067 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001068 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001069 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001070 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001071 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001072}
1073
Bill Wendlingda2ae632010-08-31 07:50:46 +00001074// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1075// input operand since by default it's a zero register. It will become an
1076// implicit def once it's "flipped".
Jim Grosbach3a378662010-10-13 23:12:26 +00001077//
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001078// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1079// more consistent.
Owen Anderson16884412011-07-13 23:22:26 +00001080class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001081 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001082 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001083 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersonbdf71442010-12-07 20:50:15 +00001084 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1085 let Inst{20} = s;
1086
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001087 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001088 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner78caacc2010-10-06 00:05:18 +00001089 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001090 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001091 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001092 let DecoderNamespace = "Thumb2";
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001093}
1094
1095// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001096class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001097 InstrItinClass itin,
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001098 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001099 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001100 let OutOperandList = oops;
1101 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001102 let AsmString = asm;
Evan Chengf49810c2009-06-23 17:48:47 +00001103 let Pattern = pattern;
Evan Chengd770d9e2009-07-02 06:38:40 +00001104 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001105 let DecoderNamespace = "Thumb2";
Evan Chengf49810c2009-06-23 17:48:47 +00001106}
1107
Owen Anderson16884412011-07-13 23:22:26 +00001108class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson01135592010-03-23 17:23:59 +00001109 InstrItinClass itin,
1110 string asm, string cstr, list<dag> pattern>
Jim Grosbachd1228742009-12-01 18:10:36 +00001111 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1112 let OutOperandList = oops;
1113 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001114 let AsmString = asm;
Jim Grosbachd1228742009-12-01 18:10:36 +00001115 let Pattern = pattern;
Jim Grosbach6797f892010-11-01 17:08:58 +00001116 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonf1a00902011-07-19 21:06:00 +00001117 let DecoderNamespace = "Thumb";
Jim Grosbachd1228742009-12-01 18:10:36 +00001118}
1119
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001120class T2I<dag oops, dag iops, InstrItinClass itin,
1121 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001122 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001123class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1124 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001125 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001126class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1127 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001128 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001129class T2Iso<dag oops, dag iops, InstrItinClass itin,
1130 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001131 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001132class T2Ipc<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, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001135class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001136 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001137 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
Johnny Chend68e1192009-12-15 17:24:14 +00001138 pattern> {
Owen Anderson9d63d902010-12-01 19:18:46 +00001139 bits<4> Rt;
1140 bits<4> Rt2;
1141 bits<13> addr;
Jim Grosbach04da9bf2010-12-10 20:51:35 +00001142 let Inst{31-25} = 0b1110100;
1143 let Inst{24} = P;
1144 let Inst{23} = addr{8};
1145 let Inst{22} = 1;
1146 let Inst{21} = W;
1147 let Inst{20} = isLoad;
1148 let Inst{19-16} = addr{12-9};
Owen Anderson9d63d902010-12-01 19:18:46 +00001149 let Inst{15-12} = Rt{3-0};
1150 let Inst{11-8} = Rt2{3-0};
Owen Anderson9d63d902010-12-01 19:18:46 +00001151 let Inst{7-0} = addr{7-0};
Johnny Chend68e1192009-12-15 17:24:14 +00001152}
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001153
Owen Anderson14c903a2011-08-04 23:18:05 +00001154class T2Ii8s4Tied<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1155 string opc, string asm, list<dag> pattern>
1156 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "$base = $wb",
1157 pattern> {
1158 bits<4> Rt;
1159 bits<4> Rt2;
1160 bits<4> base;
1161 bits<9> imm;
1162 let Inst{31-25} = 0b1110100;
1163 let Inst{24} = P;
1164 let Inst{23} = imm{8};
1165 let Inst{22} = 1;
1166 let Inst{21} = W;
1167 let Inst{20} = isLoad;
1168 let Inst{19-16} = base{3-0};
1169 let Inst{15-12} = Rt{3-0};
1170 let Inst{11-8} = Rt2{3-0};
1171 let Inst{7-0} = imm{7-0};
1172}
1173
1174
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001175class T2sI<dag oops, dag iops, InstrItinClass itin,
1176 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001177 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Cheng0aa1d8c2009-06-25 02:08:06 +00001178
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001179class T2XI<dag oops, dag iops, InstrItinClass itin,
1180 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001181 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001182class T2JTI<dag oops, dag iops, InstrItinClass itin,
1183 string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001184 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengf49810c2009-06-23 17:48:47 +00001185
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001186// Move to/from coprocessor instructions
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001187class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
Jim Grosbach9bb098a2011-07-13 21:14:23 +00001188 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbach0d8dae22011-07-13 21:17:59 +00001189 let Inst{31-28} = opc;
Bruno Cardoso Lopes6b3a9992011-01-20 16:58:48 +00001190}
1191
Bob Wilson815baeb2010-03-13 01:08:20 +00001192// Two-address instructions
1193class T2XIt<dag oops, dag iops, InstrItinClass itin,
1194 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001195 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng5adb66a2009-09-28 09:14:39 +00001196
Evan Chenge88d5ce2009-07-02 07:28:31 +00001197// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chend68e1192009-12-15 17:24:14 +00001198class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1199 dag oops, dag iops,
1200 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Chenge88d5ce2009-07-02 07:28:31 +00001201 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001202 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chenge88d5ce2009-07-02 07:28:31 +00001203 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001204 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001205 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chenge88d5ce2009-07-02 07:28:31 +00001206 let Pattern = pattern;
1207 list<Predicate> Predicates = [IsThumb2];
Owen Andersonf1a00902011-07-19 21:06:00 +00001208 let DecoderNamespace = "Thumb2";
Johnny Chend68e1192009-12-15 17:24:14 +00001209 let Inst{31-27} = 0b11111;
1210 let Inst{26-25} = 0b00;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001211 let Inst{24} = signed;
1212 let Inst{23} = 0;
Johnny Chend68e1192009-12-15 17:24:14 +00001213 let Inst{22-21} = opcod;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001214 let Inst{20} = load;
1215 let Inst{11} = 1;
Johnny Chend68e1192009-12-15 17:24:14 +00001216 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingda2ae632010-08-31 07:50:46 +00001217 let Inst{10} = pre; // The P bit.
1218 let Inst{8} = 1; // The W bit.
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001219
Owen Anderson6af50f72010-11-30 00:14:31 +00001220 bits<9> addr;
1221 let Inst{7-0} = addr{7-0};
Jim Grosbacha79bd0e2010-12-10 20:47:29 +00001222 let Inst{9} = addr{8}; // Sign bit
1223
Owen Anderson6af50f72010-11-30 00:14:31 +00001224 bits<4> Rt;
1225 bits<4> Rn;
1226 let Inst{15-12} = Rt{3-0};
1227 let Inst{19-16} = Rn{3-0};
Evan Chenge88d5ce2009-07-02 07:28:31 +00001228}
1229
David Goodwinc9d138f2009-07-27 19:59:26 +00001230// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1231class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001232 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwinc9d138f2009-07-27 19:59:26 +00001233}
1234
1235// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1236class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbach6797f892010-11-01 17:08:58 +00001237 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwinc9d138f2009-07-27 19:59:26 +00001238}
Evan Chenge88d5ce2009-07-02 07:28:31 +00001239
Bruno Cardoso Lopes54ad87a2011-05-03 17:29:22 +00001240// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1241class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1242 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1243}
1244
Evan Cheng9cb9e672009-06-27 02:26:13 +00001245// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1246class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengd770d9e2009-07-02 06:38:40 +00001247 list<Predicate> Predicates = [IsThumb2];
Evan Chengf49810c2009-06-23 17:48:47 +00001248}
1249
Evan Cheng13096642008-08-29 06:41:12 +00001250//===----------------------------------------------------------------------===//
1251
Evan Cheng96581d32008-11-11 02:11:05 +00001252//===----------------------------------------------------------------------===//
1253// ARM VFP Instruction templates.
1254//
1255
David Goodwin3ca524e2009-07-10 17:03:29 +00001256// Almost all VFP instructions are predicable.
Owen Anderson16884412011-07-13 23:22:26 +00001257class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001258 IndexMode im, Format f, InstrItinClass itin,
1259 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001260 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach499e8862010-10-12 21:22:40 +00001261 bits<4> p;
1262 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001263 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001264 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001265 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin3ca524e2009-07-10 17:03:29 +00001266 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001267 let PostEncoderMethod = "VFPThumb2PostEncoder";
David Goodwin3ca524e2009-07-10 17:03:29 +00001268 list<Predicate> Predicates = [HasVFP2];
1269}
1270
1271// Special cases
Owen Anderson16884412011-07-13 23:22:26 +00001272class VFPXI<dag oops, dag iops, AddrMode am, int sz,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001273 IndexMode im, Format f, InstrItinClass itin,
1274 string asm, string cstr, list<dag> pattern>
Anton Korobeynikovf95215f2009-11-02 00:10:38 +00001275 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001276 bits<4> p;
1277 let Inst{31-28} = p;
David Goodwin3ca524e2009-07-10 17:03:29 +00001278 let OutOperandList = oops;
1279 let InOperandList = iops;
Bob Wilsond3038462010-05-24 20:08:34 +00001280 let AsmString = asm;
David Goodwin3ca524e2009-07-10 17:03:29 +00001281 let Pattern = pattern;
Bill Wendlingcf590262010-12-01 21:54:50 +00001282 let PostEncoderMethod = "VFPThumb2PostEncoder";
David Goodwin3ca524e2009-07-10 17:03:29 +00001283 list<Predicate> Predicates = [HasVFP2];
1284}
1285
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001286class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1287 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001288 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendlingcf590262010-12-01 21:54:50 +00001289 opc, asm, "", pattern> {
1290 let PostEncoderMethod = "VFPThumb2PostEncoder";
1291}
David Goodwin3ca524e2009-07-10 17:03:29 +00001292
Evan Chengcd8e66a2008-11-11 21:48:44 +00001293// ARM VFP addrmode5 loads and stores
1294class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001295 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001296 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001297 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001298 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001299 // Instruction operands.
1300 bits<5> Dd;
1301 bits<13> addr;
1302
1303 // Encode instruction operands.
1304 let Inst{23} = addr{8}; // U (add = (U == '1'))
1305 let Inst{22} = Dd{4};
1306 let Inst{19-16} = addr{12-9}; // Rn
1307 let Inst{15-12} = Dd{3-0};
1308 let Inst{7-0} = addr{7-0}; // imm8
1309
Evan Cheng96581d32008-11-11 02:11:05 +00001310 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001311 let Inst{27-24} = opcod1;
1312 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001313 let Inst{11-9} = 0b101;
1314 let Inst{8} = 1; // Double precision
Anton Korobeynikov2e1da9f2009-11-02 00:11:06 +00001315
Evan Cheng5eda2822011-02-16 00:35:02 +00001316 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenfddb7662010-04-05 03:10:20 +00001317 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001318}
1319
Evan Chengcd8e66a2008-11-11 21:48:44 +00001320class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001321 InstrItinClass itin,
Evan Chengcd8e66a2008-11-11 21:48:44 +00001322 string opc, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001323 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson01135592010-03-23 17:23:59 +00001324 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendling2f46f1f2010-11-04 00:59:42 +00001325 // Instruction operands.
1326 bits<5> Sd;
1327 bits<13> addr;
1328
1329 // Encode instruction operands.
1330 let Inst{23} = addr{8}; // U (add = (U == '1'))
1331 let Inst{22} = Sd{0};
1332 let Inst{19-16} = addr{12-9}; // Rn
1333 let Inst{15-12} = Sd{4-1};
1334 let Inst{7-0} = addr{7-0}; // imm8
1335
Evan Cheng96581d32008-11-11 02:11:05 +00001336 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengcd8e66a2008-11-11 21:48:44 +00001337 let Inst{27-24} = opcod1;
1338 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001339 let Inst{11-9} = 0b101;
1340 let Inst{8} = 0; // Single precision
Evan Cheng5eda2822011-02-16 00:35:02 +00001341
1342 // Loads & stores operate on both NEON and VFP pipelines.
1343 let D = VFPNeonDomain;
Evan Cheng96581d32008-11-11 02:11:05 +00001344}
1345
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001346// VFP Load / store multiple pseudo instructions.
1347class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1348 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001349 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson9d4ebc02010-09-16 00:31:02 +00001350 cstr, itin> {
1351 let OutOperandList = oops;
1352 let InOperandList = !con(iops, (ins pred:$p));
1353 let Pattern = pattern;
1354 list<Predicate> Predicates = [HasVFP2];
1355}
1356
Evan Chengcd8e66a2008-11-11 21:48:44 +00001357// Load / store multiple
Jim Grosbach72db1822010-09-08 00:25:50 +00001358class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001359 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001360 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001361 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001362 // Instruction operands.
1363 bits<4> Rn;
1364 bits<13> regs;
1365
1366 // Encode instruction operands.
1367 let Inst{19-16} = Rn;
1368 let Inst{22} = regs{12};
1369 let Inst{15-12} = regs{11-8};
1370 let Inst{7-0} = regs{7-0};
1371
Evan Chengcd8e66a2008-11-11 21:48:44 +00001372 // TODO: Mark the instructions with the appropriate subtarget info.
1373 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001374 let Inst{11-9} = 0b101;
1375 let Inst{8} = 1; // Double precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001376}
1377
Jim Grosbach72db1822010-09-08 00:25:50 +00001378class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson815baeb2010-03-13 01:08:20 +00001379 string asm, string cstr, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001380 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson01135592010-03-23 17:23:59 +00001381 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling6bc105a2010-11-17 00:45:23 +00001382 // Instruction operands.
1383 bits<4> Rn;
1384 bits<13> regs;
1385
1386 // Encode instruction operands.
1387 let Inst{19-16} = Rn;
1388 let Inst{22} = regs{8};
1389 let Inst{15-12} = regs{12-9};
1390 let Inst{7-0} = regs{7-0};
1391
Evan Chengcd8e66a2008-11-11 21:48:44 +00001392 // TODO: Mark the instructions with the appropriate subtarget info.
1393 let Inst{27-25} = 0b110;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001394 let Inst{11-9} = 0b101;
1395 let Inst{8} = 0; // Single precision
Evan Chengcd8e66a2008-11-11 21:48:44 +00001396}
1397
Evan Cheng96581d32008-11-11 02:11:05 +00001398// Double precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001399class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1400 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1401 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001402 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001403 // Instruction operands.
1404 bits<5> Dd;
1405 bits<5> Dm;
1406
1407 // Encode instruction operands.
1408 let Inst{3-0} = Dm{3-0};
1409 let Inst{5} = Dm{4};
1410 let Inst{15-12} = Dd{3-0};
1411 let Inst{22} = Dd{4};
1412
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001413 let Inst{27-23} = opcod1;
1414 let Inst{21-20} = opcod2;
1415 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001416 let Inst{11-9} = 0b101;
1417 let Inst{8} = 1; // Double precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001418 let Inst{7-6} = opcod4;
1419 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001420}
1421
1422// Double precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001423class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001424 dag iops, InstrItinClass itin, string opc, string asm,
1425 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001426 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001427 // Instruction operands.
1428 bits<5> Dd;
1429 bits<5> Dn;
1430 bits<5> Dm;
1431
1432 // Encode instruction operands.
1433 let Inst{3-0} = Dm{3-0};
1434 let Inst{5} = Dm{4};
1435 let Inst{19-16} = Dn{3-0};
1436 let Inst{7} = Dn{4};
1437 let Inst{15-12} = Dd{3-0};
1438 let Inst{22} = Dd{4};
1439
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001440 let Inst{27-23} = opcod1;
1441 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001442 let Inst{11-9} = 0b101;
1443 let Inst{8} = 1; // Double precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001444 let Inst{6} = op6;
1445 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001446}
1447
1448// Single precision, unary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001449class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1450 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1451 string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001452 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001453 // Instruction operands.
1454 bits<5> Sd;
1455 bits<5> Sm;
1456
1457 // Encode instruction operands.
1458 let Inst{3-0} = Sm{4-1};
1459 let Inst{5} = Sm{0};
1460 let Inst{15-12} = Sd{4-1};
1461 let Inst{22} = Sd{0};
1462
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001463 let Inst{27-23} = opcod1;
1464 let Inst{21-20} = opcod2;
1465 let Inst{19-16} = opcod3;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001466 let Inst{11-9} = 0b101;
1467 let Inst{8} = 0; // Single precision
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001468 let Inst{7-6} = opcod4;
1469 let Inst{4} = opcod5;
Evan Cheng96581d32008-11-11 02:11:05 +00001470}
1471
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001472// Single precision unary, if no NEON. Same as ASuI except not available if
1473// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001474class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1475 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1476 string asm, list<dag> pattern>
1477 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1478 pattern> {
David Goodwin53e44712009-08-04 20:39:05 +00001479 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1480}
1481
Evan Cheng96581d32008-11-11 02:11:05 +00001482// Single precision, binary
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001483class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1484 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001485 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling69661192010-11-01 06:00:39 +00001486 // Instruction operands.
1487 bits<5> Sd;
1488 bits<5> Sn;
1489 bits<5> Sm;
1490
1491 // Encode instruction operands.
1492 let Inst{3-0} = Sm{4-1};
1493 let Inst{5} = Sm{0};
1494 let Inst{19-16} = Sn{4-1};
1495 let Inst{7} = Sn{0};
1496 let Inst{15-12} = Sd{4-1};
1497 let Inst{22} = Sd{0};
1498
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001499 let Inst{27-23} = opcod1;
1500 let Inst{21-20} = opcod2;
Bill Wendlinga0c14ef2010-10-12 22:03:19 +00001501 let Inst{11-9} = 0b101;
1502 let Inst{8} = 0; // Single precision
Bill Wendlingda2ae632010-08-31 07:50:46 +00001503 let Inst{6} = op6;
1504 let Inst{4} = op4;
Evan Cheng96581d32008-11-11 02:11:05 +00001505}
1506
Bill Wendling43f7b2d2010-12-01 02:42:55 +00001507// Single precision binary, if no NEON. Same as ASbI except not available if
1508// NEON is enabled.
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001509class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson01135592010-03-23 17:23:59 +00001510 dag iops, InstrItinClass itin, string opc, string asm,
1511 list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001512 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin42a83f22009-08-04 17:53:06 +00001513 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling69661192010-11-01 06:00:39 +00001514
1515 // Instruction operands.
1516 bits<5> Sd;
1517 bits<5> Sn;
1518 bits<5> Sm;
1519
1520 // Encode instruction operands.
1521 let Inst{3-0} = Sm{4-1};
1522 let Inst{5} = Sm{0};
1523 let Inst{19-16} = Sn{4-1};
1524 let Inst{7} = Sn{0};
1525 let Inst{15-12} = Sd{4-1};
1526 let Inst{22} = Sd{0};
David Goodwin42a83f22009-08-04 17:53:06 +00001527}
1528
Evan Cheng80a11982008-11-12 06:41:41 +00001529// VFP conversion instructions
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001530class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1531 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1532 list<dag> pattern>
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001533 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001534 let Inst{27-23} = opcod1;
1535 let Inst{21-20} = opcod2;
1536 let Inst{19-16} = opcod3;
1537 let Inst{11-8} = opcod4;
Evan Cheng80a11982008-11-12 06:41:41 +00001538 let Inst{6} = 1;
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001539 let Inst{4} = 0;
Evan Cheng80a11982008-11-12 06:41:41 +00001540}
1541
Johnny Chen811663f2010-02-11 18:47:03 +00001542// VFP conversion between floating-point and fixed-point
1543class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson01135592010-03-23 17:23:59 +00001544 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1545 list<dag> pattern>
Johnny Chen811663f2010-02-11 18:47:03 +00001546 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1547 // size (fixed-point number): sx == 0 ? 16 : 32
1548 let Inst{7} = op5; // sx
1549}
1550
David Goodwin338268c2009-08-10 22:17:39 +00001551// VFP conversion instructions, if no NEON
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001552class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin338268c2009-08-10 22:17:39 +00001553 dag oops, dag iops, InstrItinClass itin,
1554 string opc, string asm, list<dag> pattern>
Johnny Chen69a8c7f2010-01-29 23:21:10 +00001555 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1556 pattern> {
David Goodwin338268c2009-08-10 22:17:39 +00001557 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1558}
1559
Evan Cheng80a11982008-11-12 06:41:41 +00001560class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001561 InstrItinClass itin,
1562 string opc, string asm, list<dag> pattern>
1563 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng80a11982008-11-12 06:41:41 +00001564 let Inst{27-20} = opcod1;
Evan Cheng78be83d2008-11-11 19:40:26 +00001565 let Inst{11-8} = opcod2;
1566 let Inst{4} = 1;
1567}
1568
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001569class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1570 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1571 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng0a0ab132008-11-11 22:46:12 +00001572
Bob Wilson01135592010-03-23 17:23:59 +00001573class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001574 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1575 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001576
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001577class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1578 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1579 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng80a11982008-11-12 06:41:41 +00001580
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001581class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1582 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1583 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng78be83d2008-11-11 19:40:26 +00001584
Evan Cheng96581d32008-11-11 02:11:05 +00001585//===----------------------------------------------------------------------===//
1586
Bob Wilson5bafff32009-06-22 23:27:02 +00001587//===----------------------------------------------------------------------===//
1588// ARM NEON Instruction templates.
1589//
Evan Cheng13096642008-08-29 06:41:12 +00001590
Johnny Chencaa608e2010-03-20 00:17:00 +00001591class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1592 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1593 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001594 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Chengf81bf152009-11-23 21:57:23 +00001595 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001596 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001597 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001598 let Pattern = pattern;
1599 list<Predicate> Predicates = [HasNEON];
1600}
1601
1602// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen927b88f2010-03-23 20:40:44 +00001603class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1604 InstrItinClass itin, string opc, string asm, string cstr,
1605 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001606 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001607 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001608 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001609 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson5bafff32009-06-22 23:27:02 +00001610 let Pattern = pattern;
1611 list<Predicate> Predicates = [HasNEON];
Evan Cheng13096642008-08-29 06:41:12 +00001612}
1613
Bob Wilsonb07c1712009-10-07 21:53:04 +00001614class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1615 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001616 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chencaa608e2010-03-20 00:17:00 +00001617 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1618 cstr, pattern> {
Bob Wilson205a5ca2009-07-08 18:11:30 +00001619 let Inst{31-24} = 0b11110100;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001620 let Inst{23} = op23;
Jim Grosbach780d2072009-10-20 00:19:08 +00001621 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001622 let Inst{11-8} = op11_8;
1623 let Inst{7-4} = op7_4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001624
Chris Lattner2ac19022010-11-15 05:19:05 +00001625 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001626
Owen Andersond9aa7d32010-11-02 00:05:05 +00001627 bits<5> Vd;
Owen Andersonf431eda2010-11-02 23:47:29 +00001628 bits<6> Rn;
1629 bits<4> Rm;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001630
Owen Andersond9aa7d32010-11-02 00:05:05 +00001631 let Inst{22} = Vd{4};
1632 let Inst{15-12} = Vd{3-0};
Owen Andersonf431eda2010-11-02 23:47:29 +00001633 let Inst{19-16} = Rn{3-0};
1634 let Inst{3-0} = Rm{3-0};
Bob Wilson205a5ca2009-07-08 18:11:30 +00001635}
1636
Owen Andersond138d702010-11-02 20:47:39 +00001637class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1638 dag oops, dag iops, InstrItinClass itin,
1639 string opc, string dt, string asm, string cstr, list<dag> pattern>
1640 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1641 dt, asm, cstr, pattern> {
1642 bits<3> lane;
1643}
1644
Bob Wilson709d5922010-08-25 23:27:42 +00001645class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson16884412011-07-13 23:22:26 +00001646 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson709d5922010-08-25 23:27:42 +00001647 itin> {
1648 let OutOperandList = oops;
1649 let InOperandList = !con(iops, (ins pred:$p));
1650 list<Predicate> Predicates = [HasNEON];
1651}
1652
Jim Grosbach7cd27292010-10-06 20:36:55 +00001653class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1654 list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001655 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonbd916c52010-09-13 23:55:10 +00001656 itin> {
1657 let OutOperandList = oops;
1658 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach7cd27292010-10-06 20:36:55 +00001659 let Pattern = pattern;
Bob Wilsonbd916c52010-09-13 23:55:10 +00001660 list<Predicate> Predicates = [HasNEON];
1661}
1662
Johnny Chen785516a2010-03-23 16:43:47 +00001663class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001664 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen785516a2010-03-23 16:43:47 +00001665 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1666 pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001667 let Inst{31-25} = 0b1111001;
Chris Lattner2ac19022010-11-15 05:19:05 +00001668 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Evan Chengf81bf152009-11-23 21:57:23 +00001669}
1670
Johnny Chen927b88f2010-03-23 20:40:44 +00001671class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001672 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen927b88f2010-03-23 20:40:44 +00001673 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson01135592010-03-23 17:23:59 +00001674 cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001675 let Inst{31-25} = 0b1111001;
Owen Andersonac00e962010-12-10 22:32:08 +00001676 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Bob Wilson5bafff32009-06-22 23:27:02 +00001677}
1678
1679// NEON "one register and a modified immediate" format.
1680class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1681 bit op5, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001682 dag oops, dag iops, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001683 string opc, string dt, string asm, string cstr,
1684 list<dag> pattern>
Johnny Chena2711742010-03-23 23:09:14 +00001685 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001686 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001687 let Inst{21-19} = op21_19;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001688 let Inst{11-8} = op11_8;
1689 let Inst{7} = op7;
1690 let Inst{6} = op6;
1691 let Inst{5} = op5;
1692 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001693
Owen Andersona88ea032010-10-26 17:40:54 +00001694 // Instruction operands.
1695 bits<5> Vd;
1696 bits<13> SIMM;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001697
Owen Andersona88ea032010-10-26 17:40:54 +00001698 let Inst{15-12} = Vd{3-0};
1699 let Inst{22} = Vd{4};
1700 let Inst{24} = SIMM{7};
1701 let Inst{18-16} = SIMM{6-4};
1702 let Inst{3-0} = SIMM{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001703}
1704
1705// NEON 2 vector register format.
1706class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1707 bits<5> op11_7, bit op6, bit op4,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001708 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001709 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001710 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Chengf81bf152009-11-23 21:57:23 +00001711 let Inst{24-23} = op24_23;
1712 let Inst{21-20} = op21_20;
1713 let Inst{19-18} = op19_18;
1714 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001715 let Inst{11-7} = op11_7;
1716 let Inst{6} = op6;
1717 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001718
Owen Anderson162875a2010-10-25 18:43:52 +00001719 // Instruction operands.
1720 bits<5> Vd;
1721 bits<5> Vm;
1722
1723 let Inst{15-12} = Vd{3-0};
1724 let Inst{22} = Vd{4};
1725 let Inst{3-0} = Vm{3-0};
1726 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001727}
1728
1729// Same as N2V except it doesn't have a datatype suffix.
1730class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson01135592010-03-23 17:23:59 +00001731 bits<5> op11_7, bit op6, bit op4,
1732 dag oops, dag iops, InstrItinClass itin,
1733 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc5f413a2010-03-24 00:57:50 +00001734 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001735 let Inst{24-23} = op24_23;
1736 let Inst{21-20} = op21_20;
1737 let Inst{19-18} = op19_18;
1738 let Inst{17-16} = op17_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001739 let Inst{11-7} = op11_7;
1740 let Inst{6} = op6;
1741 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001742
Owen Anderson162875a2010-10-25 18:43:52 +00001743 // Instruction operands.
1744 bits<5> Vd;
1745 bits<5> Vm;
1746
1747 let Inst{15-12} = Vd{3-0};
1748 let Inst{22} = Vd{4};
1749 let Inst{3-0} = Vm{3-0};
1750 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001751}
1752
1753// NEON 2 vector register with immediate.
Bob Wilson507df402009-10-21 02:15:46 +00001754class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chenfa80bec2010-03-25 20:39:04 +00001755 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001756 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenfa80bec2010-03-25 20:39:04 +00001757 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001758 let Inst{24} = op24;
1759 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001760 let Inst{11-8} = op11_8;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001761 let Inst{7} = op7;
1762 let Inst{6} = op6;
1763 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001764
Owen Anderson3557d002010-10-26 20:56:57 +00001765 // Instruction operands.
1766 bits<5> Vd;
1767 bits<5> Vm;
1768 bits<6> SIMM;
1769
1770 let Inst{15-12} = Vd{3-0};
1771 let Inst{22} = Vd{4};
1772 let Inst{3-0} = Vm{3-0};
1773 let Inst{5} = Vm{4};
1774 let Inst{21-16} = SIMM{5-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001775}
1776
Bob Wilson10bc69c2010-03-27 03:56:52 +00001777// NEON 3 vector register format.
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001778
Jim Grosbach6635b042011-05-19 17:34:53 +00001779class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1780 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1781 string opc, string dt, string asm, string cstr,
1782 list<dag> pattern>
Johnny Chenc6e704d2010-03-26 21:26:28 +00001783 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001784 let Inst{24} = op24;
1785 let Inst{23} = op23;
Evan Chengf81bf152009-11-23 21:57:23 +00001786 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001787 let Inst{11-8} = op11_8;
1788 let Inst{6} = op6;
1789 let Inst{4} = op4;
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001790}
1791
1792class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1793 dag oops, dag iops, Format f, InstrItinClass itin,
1794 string opc, string dt, string asm, string cstr, list<dag> pattern>
1795 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1796 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001797
Owen Andersond451f882010-10-21 20:21:49 +00001798 // Instruction operands.
1799 bits<5> Vd;
1800 bits<5> Vn;
1801 bits<5> Vm;
1802
1803 let Inst{15-12} = Vd{3-0};
1804 let Inst{22} = Vd{4};
1805 let Inst{19-16} = Vn{3-0};
1806 let Inst{7} = Vn{4};
1807 let Inst{3-0} = Vm{3-0};
1808 let Inst{5} = Vm{4};
Evan Chengf81bf152009-11-23 21:57:23 +00001809}
1810
Jim Grosbach6635b042011-05-19 17:34:53 +00001811class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1812 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1813 string opc, string dt, string asm, string cstr,
1814 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001815 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1816 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1817
1818 // Instruction operands.
1819 bits<5> Vd;
1820 bits<5> Vn;
1821 bits<5> Vm;
1822 bit lane;
1823
1824 let Inst{15-12} = Vd{3-0};
1825 let Inst{22} = Vd{4};
1826 let Inst{19-16} = Vn{3-0};
1827 let Inst{7} = Vn{4};
1828 let Inst{3-0} = Vm{3-0};
1829 let Inst{5} = lane;
1830}
1831
Jim Grosbach6635b042011-05-19 17:34:53 +00001832class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1833 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1834 string opc, string dt, string asm, string cstr,
1835 list<dag> pattern>
Owen Anderson6a7d36a2011-03-30 23:45:29 +00001836 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1837 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1838
1839 // Instruction operands.
1840 bits<5> Vd;
1841 bits<5> Vn;
1842 bits<5> Vm;
1843 bits<2> lane;
1844
1845 let Inst{15-12} = Vd{3-0};
1846 let Inst{22} = Vd{4};
1847 let Inst{19-16} = Vn{3-0};
1848 let Inst{7} = Vn{4};
1849 let Inst{2-0} = Vm{2-0};
1850 let Inst{5} = lane{1};
1851 let Inst{3} = lane{0};
1852}
1853
Johnny Chen841e8282010-03-23 21:35:03 +00001854// Same as N3V except it doesn't have a data type suffix.
Bob Wilson01135592010-03-23 17:23:59 +00001855class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1856 bit op4,
Bob Wilson10bc69c2010-03-27 03:56:52 +00001857 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson01135592010-03-23 17:23:59 +00001858 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilson10bc69c2010-03-27 03:56:52 +00001859 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingda2ae632010-08-31 07:50:46 +00001860 let Inst{24} = op24;
1861 let Inst{23} = op23;
Bob Wilson5bafff32009-06-22 23:27:02 +00001862 let Inst{21-20} = op21_20;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001863 let Inst{11-8} = op11_8;
1864 let Inst{6} = op6;
1865 let Inst{4} = op4;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001866
Owen Anderson8c71eff2010-10-25 18:28:30 +00001867 // Instruction operands.
1868 bits<5> Vd;
1869 bits<5> Vn;
1870 bits<5> Vm;
1871
1872 let Inst{15-12} = Vd{3-0};
1873 let Inst{22} = Vd{4};
1874 let Inst{19-16} = Vn{3-0};
1875 let Inst{7} = Vn{4};
1876 let Inst{3-0} = Vm{3-0};
1877 let Inst{5} = Vm{4};
Bob Wilson5bafff32009-06-22 23:27:02 +00001878}
1879
1880// NEON VMOVs between scalar and core registers.
1881class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001882 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001883 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson16884412011-07-13 23:22:26 +00001884 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson01135592010-03-23 17:23:59 +00001885 "", itin> {
Bob Wilson5bafff32009-06-22 23:27:02 +00001886 let Inst{27-20} = opcod1;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001887 let Inst{11-8} = opcod2;
1888 let Inst{6-5} = opcod3;
1889 let Inst{4} = 1;
Johnny Chena9611542011-04-06 18:27:46 +00001890 // A8.6.303, A8.6.328, A8.6.329
1891 let Inst{3-0} = 0b0000;
Evan Chengf81bf152009-11-23 21:57:23 +00001892
1893 let OutOperandList = oops;
Chris Lattnerb7d52262010-03-18 21:06:54 +00001894 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner78caacc2010-10-06 00:05:18 +00001895 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Chengf81bf152009-11-23 21:57:23 +00001896 let Pattern = pattern;
Bob Wilson5bafff32009-06-22 23:27:02 +00001897 list<Predicate> Predicates = [HasNEON];
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001898
Chris Lattner2ac19022010-11-15 05:19:05 +00001899 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001900
Owen Andersond2fbdb72010-10-27 21:28:09 +00001901 bits<5> V;
1902 bits<4> R;
Owen Andersonf587a9352010-10-27 19:25:54 +00001903 bits<4> p;
Owen Andersond2fbdb72010-10-27 21:28:09 +00001904 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001905
Owen Andersonf587a9352010-10-27 19:25:54 +00001906 let Inst{31-28} = p{3-0};
Owen Andersond2fbdb72010-10-27 21:28:09 +00001907 let Inst{7} = V{4};
1908 let Inst{19-16} = V{3-0};
1909 let Inst{15-12} = R{3-0};
Bob Wilson5bafff32009-06-22 23:27:02 +00001910}
1911class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001912 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001913 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001914 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001915 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001916class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001917 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001918 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001919 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001920 opc, dt, asm, pattern>;
Bob Wilson5bafff32009-06-22 23:27:02 +00001921class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwin8b7d7ad2009-08-06 16:52:47 +00001922 dag oops, dag iops, InstrItinClass itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001923 string opc, string dt, string asm, list<dag> pattern>
Bob Wilson184723d2010-06-25 23:56:05 +00001924 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Chengf81bf152009-11-23 21:57:23 +00001925 opc, dt, asm, pattern>;
David Goodwin42a83f22009-08-04 17:53:06 +00001926
Johnny Chene4614f72010-03-25 17:01:27 +00001927// Vector Duplicate Lane (from scalar to all elements)
1928class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1929 InstrItinClass itin, string opc, string dt, string asm,
1930 list<dag> pattern>
Johnny Chen2d2898e2010-03-25 21:49:12 +00001931 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chene4614f72010-03-25 17:01:27 +00001932 let Inst{24-23} = 0b11;
1933 let Inst{21-20} = 0b11;
1934 let Inst{19-16} = op19_16;
Bill Wendlingda2ae632010-08-31 07:50:46 +00001935 let Inst{11-7} = 0b11000;
1936 let Inst{6} = op6;
1937 let Inst{4} = 0;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001938
Owen Andersonf587a9352010-10-27 19:25:54 +00001939 bits<5> Vd;
1940 bits<5> Vm;
1941 bits<4> lane;
Jim Grosbacha30a51b2010-11-19 22:42:55 +00001942
Owen Andersonf587a9352010-10-27 19:25:54 +00001943 let Inst{22} = Vd{4};
1944 let Inst{15-12} = Vd{3-0};
1945 let Inst{5} = Vm{4};
1946 let Inst{3-0} = Vm{3-0};
Johnny Chene4614f72010-03-25 17:01:27 +00001947}
1948
David Goodwin42a83f22009-08-04 17:53:06 +00001949// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1950// for single-precision FP.
1951class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1952 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1953}