blob: b8d7b99d5a89e362a4475b2a95fac73230b28203 [file] [log] [blame]
Bill Wendlingcbb08ca2010-12-01 02:42:55 +00001//===- ARMInstrFormats.td - ARM Instruction Formats ----------*- tablegen -*-=//
Bob Wilson3968c6a2010-03-23 17:23:59 +00002//
Evan Cheng2d37f192008-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 Wilson3968c6a2010-03-23 17:23:59 +00007//
Evan Cheng2d37f192008-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 Wilson69ba1bc2010-03-17 21:13:43 +000018class Format<bits<6> val> {
19 bits<6> Value = val;
Evan Cheng2d37f192008-08-28 23:39:26 +000020}
21
Evan Chengfabdcce2008-11-13 23:36:57 +000022def Pseudo : Format<0>;
23def MulFrm : Format<1>;
24def BrFrm : Format<2>;
25def BrMiscFrm : Format<3>;
Evan Cheng2d37f192008-08-28 23:39:26 +000026
Evan Chengfabdcce2008-11-13 23:36:57 +000027def DPFrm : Format<4>;
Owen Anderson04912702011-07-21 23:38:37 +000028def DPSoRegRegFrm : Format<5>;
Evan Cheng2d37f192008-08-28 23:39:26 +000029
Evan Chengfabdcce2008-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 Cheng2d37f192008-08-28 23:39:26 +000035
Johnny Chen0dab68f2010-03-19 17:39:00 +000036def LdStExFrm : Format<11>;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +000037
Johnny Chen0dab68f2010-03-19 17:39:00 +000038def ArithMiscFrm : Format<12>;
Bob Wilson96649842010-08-11 00:01:18 +000039def SatFrm : Format<13>;
40def ExtFrm : Format<14>;
Evan Cheng8cbbcb12008-11-11 21:48:44 +000041
Bob Wilson96649842010-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 Cheng8cbbcb12008-11-11 21:48:44 +000052
Bob Wilson96649842010-08-11 00:01:18 +000053def ThumbFrm : Format<25>;
54def MiscFrm : Format<26>;
Evan Cheng2d37f192008-08-28 23:39:26 +000055
Bob Wilson96649842010-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 Anderson04912702011-07-21 23:38:37 +000071def DPSoRegImmFrm : Format<42>;
Johnny Chenf833fad2010-03-20 00:17:00 +000072
Evan Cheng14965762009-07-08 01:46:35 +000073// Misc flags.
74
Bill Wendlingcbb08ca2010-12-01 02:42:55 +000075// The instruction has an Rn register operand.
Evan Cheng14965762009-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 Cheng2d37f192008-08-28 23:39:26 +000083
Evan Cheng2d37f192008-08-28 23:39:26 +000084//===----------------------------------------------------------------------===//
Bob Wilsona4d86b62010-03-18 23:57:57 +000085// ARM Instruction flags. These need to match ARMBaseInstrInfo.h.
Evan Chengb23b50d2009-06-29 07:51:04 +000086//
87
Jim Grosbachec86bac2011-01-18 19:59:19 +000088// FIXME: Once the JIT is MC-ized, these can go away.
Evan Chengb23b50d2009-06-29 07:51:04 +000089// Addressing mode.
Jim Grosbache9298992010-10-05 18:14:55 +000090class AddrMode<bits<5> val> {
91 bits<5> Value = val;
Evan Chengb23b50d2009-06-29 07:51:04 +000092}
Bill Wendlingb70dc872010-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 Wilsondeb35af2009-07-01 23:16:05 +0000108def AddrModeT2_i8s4 : AddrMode<15>;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000109def AddrMode_i12 : AddrMode<16>;
Evan Chengb23b50d2009-06-29 07:51:04 +0000110
Evan Chengb23b50d2009-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 Wilsonf1e8f7f2010-03-13 07:34:35 +0000118def IndexModeUpd : IndexMode<3>;
Evan Chengb23b50d2009-06-29 07:51:04 +0000119
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000120// Instruction execution domain.
Evan Cheng04ad35b2011-02-22 19:53:14 +0000121class Domain<bits<3> val> {
122 bits<3> Value = val;
Anton Korobeynikov14635da2009-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 Cheng97e64282011-02-23 02:35:33 +0000128def VFPNeonA8Domain : Domain<5>; // Instructions in VFP & Neon under A8
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000129
Evan Chengb23b50d2009-06-29 07:51:04 +0000130//===----------------------------------------------------------------------===//
Evan Chengcd4cdd12009-07-11 06:43:01 +0000131// ARM special operands.
132//
133
Bruno Cardoso Lopes90d1dfe2011-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 Grosbacheeaab222011-07-25 20:38:18 +0000139def ProcIFlagsOperand : AsmOperandClass {
140 let Name = "ProcIFlags";
141 let ParserMethod = "parseProcIFlagsOperand";
142}
Bruno Cardoso Lopes90d1dfe2011-02-14 13:09:44 +0000143def iflags_op : Operand<i32> {
144 let PrintMethod = "printCPSIFlag";
145 let ParserMatchClass = ProcIFlagsOperand;
146}
147
Evan Chengcd4cdd12009-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 Grosbacheeaab222011-07-25 20:38:18 +0000150def CondCodeOperand : AsmOperandClass { let Name = "CondCode"; }
Evan Chengcd4cdd12009-07-11 06:43:01 +0000151def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
152 (ops (i32 14), (i32 zero_reg))> {
153 let PrintMethod = "printPredicateOperand";
Daniel Dunbard8042b72010-08-11 06:36:53 +0000154 let ParserMatchClass = CondCodeOperand;
Owen Andersone0152a72011-08-09 20:55:18 +0000155 let DecoderMethod = "DecodePredicateOperand";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000156}
157
158// Conditional code result for instructions whose 's' bit is set, e.g. subs.
Jim Grosbacheeaab222011-07-25 20:38:18 +0000159def CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
Evan Chengcd4cdd12009-07-11 06:43:01 +0000160def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Chris Lattner63274cb2010-11-15 05:19:05 +0000161 let EncoderMethod = "getCCOutOpValue";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000162 let PrintMethod = "printSBitModifierOperand";
Jim Grosbach0bfb4d52010-12-06 18:21:12 +0000163 let ParserMatchClass = CCOutOperand;
Owen Andersone0152a72011-08-09 20:55:18 +0000164 let DecoderMethod = "DecodeCCOutOperand";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000165}
166
167// Same as cc_out except it defaults to setting CPSR.
168def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Chris Lattner63274cb2010-11-15 05:19:05 +0000169 let EncoderMethod = "getCCOutOpValue";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000170 let PrintMethod = "printSBitModifierOperand";
Jim Grosbach0bfb4d52010-12-06 18:21:12 +0000171 let ParserMatchClass = CCOutOperand;
Owen Andersone0152a72011-08-09 20:55:18 +0000172 let DecoderMethod = "DecodeCCOutOperand";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000173}
174
Johnny Chen9a3e2392010-03-10 18:59:38 +0000175// ARM special operands for disassembly only.
176//
Jim Grosbach0a547702011-07-22 17:44:50 +0000177def SetEndAsmOperand : AsmOperandClass {
178 let Name = "SetEndImm";
179 let ParserMethod = "parseSetEndImm";
180}
Jim Grosbach7e72ec62010-10-13 21:00:04 +0000181def setend_op : Operand<i32> {
182 let PrintMethod = "printSetendOperand";
Jim Grosbach0a547702011-07-22 17:44:50 +0000183 let ParserMatchClass = SetEndAsmOperand;
Jim Grosbach7e72ec62010-10-13 21:00:04 +0000184}
Johnny Chen9a3e2392010-03-10 18:59:38 +0000185
Jim Grosbacheeaab222011-07-25 20:38:18 +0000186def MSRMaskOperand : AsmOperandClass {
187 let Name = "MSRMask";
188 let ParserMethod = "parseMSRMaskOperand";
189}
Johnny Chen9a3e2392010-03-10 18:59:38 +0000190def msr_mask : Operand<i32> {
191 let PrintMethod = "printMSRMaskOperand";
Bruno Cardoso Lopes9cd43972011-02-18 19:45:59 +0000192 let ParserMatchClass = MSRMaskOperand;
Johnny Chen9a3e2392010-03-10 18:59:38 +0000193}
194
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000195// Shift Right Immediate - A shift right immediate is encoded differently from
196// other shift immediates. The imm6 field is encoded like so:
Bill Wendling3b1459b2011-03-01 01:00:59 +0000197//
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000198// Offset Encoding
199// 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
200// 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
201// 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
202// 64 64 - <imm> is encoded in imm6<5:0>
203def shr_imm8 : Operand<i32> {
204 let EncoderMethod = "getShiftRight8Imm";
Owen Andersone0152a72011-08-09 20:55:18 +0000205 let DecoderMethod = "DecodeShiftRight8Imm";
Bill Wendling3b1459b2011-03-01 01:00:59 +0000206}
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000207def shr_imm16 : Operand<i32> {
208 let EncoderMethod = "getShiftRight16Imm";
Owen Andersone0152a72011-08-09 20:55:18 +0000209 let DecoderMethod = "DecodeShiftRight16Imm";
Bill Wendling3b1459b2011-03-01 01:00:59 +0000210}
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000211def shr_imm32 : Operand<i32> {
212 let EncoderMethod = "getShiftRight32Imm";
Owen Andersone0152a72011-08-09 20:55:18 +0000213 let DecoderMethod = "DecodeShiftRight32Imm";
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000214}
215def shr_imm64 : Operand<i32> {
216 let EncoderMethod = "getShiftRight64Imm";
Owen Andersone0152a72011-08-09 20:55:18 +0000217 let DecoderMethod = "DecodeShiftRight64Imm";
Bill Wendling3b1459b2011-03-01 01:00:59 +0000218}
219
Evan Chengcd4cdd12009-07-11 06:43:01 +0000220//===----------------------------------------------------------------------===//
Evan Cheng2d37f192008-08-28 23:39:26 +0000221// ARM Instruction templates.
222//
223
Owen Anderson651b2302011-07-13 23:22:26 +0000224class InstTemplate<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000225 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng2d37f192008-08-28 23:39:26 +0000226 : Instruction {
227 let Namespace = "ARM";
228
Evan Cheng2d37f192008-08-28 23:39:26 +0000229 AddrMode AM = am;
Owen Anderson651b2302011-07-13 23:22:26 +0000230 int Size = sz;
Evan Cheng2d37f192008-08-28 23:39:26 +0000231 IndexMode IM = im;
232 bits<2> IndexModeBits = IM.Value;
Evan Cheng2d37f192008-08-28 23:39:26 +0000233 Format F = f;
Bob Wilson69ba1bc2010-03-17 21:13:43 +0000234 bits<6> Form = F.Value;
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000235 Domain D = d;
Evan Cheng81889d012008-11-05 18:35:52 +0000236 bit isUnaryDataProc = 0;
Evan Cheng14965762009-07-08 01:46:35 +0000237 bit canXformTo16Bit = 0;
Jim Grosbach5876e412010-11-19 22:42:55 +0000238
Chris Lattner7ff33462010-10-31 19:22:57 +0000239 // If this is a pseudo instruction, mark it isCodeGenOnly.
240 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson3968c6a2010-03-23 17:23:59 +0000241
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000242 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbache9298992010-10-05 18:14:55 +0000243 let TSFlags{4-0} = AM.Value;
Owen Anderson651b2302011-07-13 23:22:26 +0000244 let TSFlags{6-5} = IndexModeBits;
245 let TSFlags{12-7} = Form;
246 let TSFlags{13} = isUnaryDataProc;
247 let TSFlags{14} = canXformTo16Bit;
248 let TSFlags{17-15} = D.Value;
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000249
Evan Cheng2d37f192008-08-28 23:39:26 +0000250 let Constraints = cstr;
David Goodwinb062c232009-08-06 16:52:47 +0000251 let Itinerary = itin;
Evan Cheng2d37f192008-08-28 23:39:26 +0000252}
253
Johnny Chenc28e6292009-12-15 17:24:14 +0000254class Encoding {
255 field bits<32> Inst;
256}
257
Owen Anderson651b2302011-07-13 23:22:26 +0000258class InstARM<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000259 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonc78e03c2011-07-19 21:06:00 +0000260 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
261 let DecoderNamespace = "ARM";
262}
Johnny Chenc28e6292009-12-15 17:24:14 +0000263
264// This Encoding-less class is used by Thumb1 to specify the encoding bits later
265// on by adding flavors to specific instructions.
Owen Anderson651b2302011-07-13 23:22:26 +0000266class InstThumb<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000267 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonc78e03c2011-07-19 21:06:00 +0000268 : InstTemplate<am, sz, im, f, d, cstr, itin> {
269 let DecoderNamespace = "Thumb";
270}
Johnny Chenc28e6292009-12-15 17:24:14 +0000271
Jim Grosbacha74c7ccd2010-11-18 01:38:26 +0000272class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000273 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
Jim Grosbach7c301ea2011-07-06 21:35:46 +0000274 GenericDomain, "", itin> {
Evan Cheng2d37f192008-08-28 23:39:26 +0000275 let OutOperandList = oops;
276 let InOperandList = iops;
Evan Cheng2d37f192008-08-28 23:39:26 +0000277 let Pattern = pattern;
Jim Grosbache1756822011-03-10 19:06:39 +0000278 let isCodeGenOnly = 1;
Jim Grosbach7c301ea2011-07-06 21:35:46 +0000279 let isPseudo = 1;
Evan Cheng2d37f192008-08-28 23:39:26 +0000280}
281
Jim Grosbachcfb66202010-11-18 01:15:56 +0000282// PseudoInst that's ARM-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000283class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbacha74c7ccd2010-11-18 01:38:26 +0000284 list<dag> pattern>
285 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000286 let Size = sz;
Jim Grosbachcfb66202010-11-18 01:15:56 +0000287 list<Predicate> Predicates = [IsARM];
288}
289
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000290// PseudoInst that's Thumb-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000291class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000292 list<dag> pattern>
293 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000294 let Size = sz;
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000295 list<Predicate> Predicates = [IsThumb];
296}
Jim Grosbachcfb66202010-11-18 01:15:56 +0000297
Jim Grosbachd42257c2010-12-15 18:48:45 +0000298// PseudoInst that's Thumb2-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000299class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbachd42257c2010-12-15 18:48:45 +0000300 list<dag> pattern>
301 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000302 let Size = sz;
Jim Grosbachd42257c2010-12-15 18:48:45 +0000303 list<Predicate> Predicates = [IsThumb2];
304}
Jim Grosbach95dee402011-07-08 17:40:42 +0000305
Owen Anderson651b2302011-07-13 23:22:26 +0000306class ARMPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000307 InstrItinClass itin, list<dag> pattern,
308 dag Result>
309 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
310 PseudoInstExpansion<Result>;
311
Owen Anderson651b2302011-07-13 23:22:26 +0000312class tPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000313 InstrItinClass itin, list<dag> pattern,
314 dag Result>
315 : tPseudoInst<oops, iops, sz, itin, pattern>,
316 PseudoInstExpansion<Result>;
317
Owen Anderson651b2302011-07-13 23:22:26 +0000318class t2PseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000319 InstrItinClass itin, list<dag> pattern,
320 dag Result>
321 : t2PseudoInst<oops, iops, sz, itin, pattern>,
322 PseudoInstExpansion<Result>;
323
Evan Cheng2d37f192008-08-28 23:39:26 +0000324// Almost all ARM instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +0000325class I<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000326 IndexMode im, Format f, InstrItinClass itin,
David Goodwinb062c232009-08-06 16:52:47 +0000327 string opc, string asm, string cstr,
Evan Cheng2d37f192008-08-28 23:39:26 +0000328 list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000329 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach5476a272010-10-11 18:51:51 +0000330 bits<4> p;
331 let Inst{31-28} = p;
Evan Cheng2d37f192008-08-28 23:39:26 +0000332 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000333 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +0000334 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng2d37f192008-08-28 23:39:26 +0000335 let Pattern = pattern;
336 list<Predicate> Predicates = [IsARM];
337}
Bill Wendlingb70dc872010-08-31 07:50:46 +0000338
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000339// A few are not predicable
Owen Anderson651b2302011-07-13 23:22:26 +0000340class InoP<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000341 IndexMode im, Format f, InstrItinClass itin,
342 string opc, string asm, string cstr,
343 list<dag> pattern>
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000344 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
345 let OutOperandList = oops;
346 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000347 let AsmString = !strconcat(opc, asm);
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000348 let Pattern = pattern;
349 let isPredicable = 0;
350 list<Predicate> Predicates = [IsARM];
351}
Evan Cheng2d37f192008-08-28 23:39:26 +0000352
Bill Wendlingf8dfa462010-08-30 01:47:35 +0000353// Same as I except it can optionally modify CPSR. Note it's modeled as an input
354// operand since by default it's a zero register. It will become an implicit def
355// once it's "flipped".
Owen Anderson651b2302011-07-13 23:22:26 +0000356class sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000357 IndexMode im, Format f, InstrItinClass itin,
358 string opc, string asm, string cstr,
Evan Cheng2d37f192008-08-28 23:39:26 +0000359 list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000360 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach5476a272010-10-11 18:51:51 +0000361 bits<4> p; // Predicate operand
Jim Grosbachd9d31da2010-10-12 23:00:24 +0000362 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach5476a272010-10-11 18:51:51 +0000363 let Inst{31-28} = p;
Jim Grosbachd9d31da2010-10-12 23:00:24 +0000364 let Inst{20} = s;
Jim Grosbach5476a272010-10-11 18:51:51 +0000365
Evan Cheng2d37f192008-08-28 23:39:26 +0000366 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000367 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilson59351842010-10-15 03:23:44 +0000368 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng2d37f192008-08-28 23:39:26 +0000369 let Pattern = pattern;
370 list<Predicate> Predicates = [IsARM];
371}
372
Evan Chenga2827232008-09-01 07:19:00 +0000373// Special cases
Owen Anderson651b2302011-07-13 23:22:26 +0000374class XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000375 IndexMode im, Format f, InstrItinClass itin,
376 string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000377 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Chenga2827232008-09-01 07:19:00 +0000378 let OutOperandList = oops;
379 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000380 let AsmString = asm;
Evan Chenga2827232008-09-01 07:19:00 +0000381 let Pattern = pattern;
382 list<Predicate> Predicates = [IsARM];
383}
384
David Goodwinb062c232009-08-06 16:52:47 +0000385class AI<dag oops, dag iops, Format f, InstrItinClass itin,
386 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000387 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000388 opc, asm, "", pattern>;
389class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
390 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000391 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000392 opc, asm, "", pattern>;
393class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng2d37f192008-08-28 23:39:26 +0000394 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000395 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Evan Cheng49d66522008-11-06 22:15:19 +0000396 asm, "", pattern>;
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000397class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000398 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000399 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000400 opc, asm, "", pattern>;
Evan Chengfa558782008-09-01 08:25:56 +0000401
402// Ctrl flow instructions
David Goodwinb062c232009-08-06 16:52:47 +0000403class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
404 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000405 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000406 opc, asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000407 let Inst{27-24} = opcod;
Evan Chengfa558782008-09-01 08:25:56 +0000408}
David Goodwinb062c232009-08-06 16:52:47 +0000409class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
410 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000411 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000412 asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000413 let Inst{27-24} = opcod;
Evan Chengfa558782008-09-01 08:25:56 +0000414}
Evan Chengfa558782008-09-01 08:25:56 +0000415
416// BR_JT instructions
David Goodwinb062c232009-08-06 16:52:47 +0000417class JTI<dag oops, dag iops, InstrItinClass itin,
418 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000419 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
Evan Cheng7095cd22008-11-07 09:06:08 +0000420 asm, "", pattern>;
Evan Cheng624844b2008-09-01 01:51:14 +0000421
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000422// Atomic load/store instructions
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000423class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
424 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000425 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000426 opc, asm, "", pattern> {
Jim Grosbach4e57b522010-10-29 19:58:57 +0000427 bits<4> Rt;
Jim Grosbachcb311932011-07-26 17:44:46 +0000428 bits<4> addr;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000429 let Inst{27-23} = 0b00011;
430 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000431 let Inst{20} = 1;
Jim Grosbachcb311932011-07-26 17:44:46 +0000432 let Inst{19-16} = addr;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000433 let Inst{15-12} = Rt;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000434 let Inst{11-0} = 0b111110011111;
435}
436class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
437 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000438 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000439 opc, asm, "", pattern> {
Jim Grosbach4e57b522010-10-29 19:58:57 +0000440 bits<4> Rd;
441 bits<4> Rt;
Bruno Cardoso Lopesf170f8b2011-03-24 21:04:58 +0000442 bits<4> addr;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000443 let Inst{27-23} = 0b00011;
444 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000445 let Inst{20} = 0;
Bruno Cardoso Lopesf170f8b2011-03-24 21:04:58 +0000446 let Inst{19-16} = addr;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000447 let Inst{15-12} = Rd;
Johnny Chen098bd1b2009-12-11 19:37:26 +0000448 let Inst{11-4} = 0b11111001;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000449 let Inst{3-0} = Rt;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000450}
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000451class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
Jim Grosbach15e8d742011-07-26 17:15:11 +0000452 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000453 bits<4> Rt;
454 bits<4> Rt2;
Jim Grosbach15e8d742011-07-26 17:15:11 +0000455 bits<4> addr;
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000456 let Inst{27-23} = 0b00010;
457 let Inst{22} = b;
458 let Inst{21-20} = 0b00;
Jim Grosbach15e8d742011-07-26 17:15:11 +0000459 let Inst{19-16} = addr;
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000460 let Inst{15-12} = Rt;
461 let Inst{11-4} = 0b00001001;
462 let Inst{3-0} = Rt2;
463}
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000464
Evan Cheng624844b2008-09-01 01:51:14 +0000465// addrmode1 instructions
David Goodwinb062c232009-08-06 16:52:47 +0000466class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
467 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000468 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000469 opc, asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000470 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000471 let Inst{27-26} = 0b00;
Evan Chengc139c222008-08-29 07:40:52 +0000472}
David Goodwinb062c232009-08-06 16:52:47 +0000473class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
474 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000475 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000476 opc, asm, "", pattern> {
477 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000478 let Inst{27-26} = 0b00;
David Goodwinb062c232009-08-06 16:52:47 +0000479}
480class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng2d37f192008-08-28 23:39:26 +0000481 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000482 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
Evan Chengc139c222008-08-29 07:40:52 +0000483 asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000484 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000485 let Inst{27-26} = 0b00;
Evan Chengc139c222008-08-29 07:40:52 +0000486}
Evan Cheng624844b2008-09-01 01:51:14 +0000487
Evan Chengcccca872008-09-01 01:27:33 +0000488// loads
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000489
Jim Grosbach4a22eba2010-11-19 21:07:51 +0000490// LDR/LDRB/STR/STRB/...
491class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach338de3e2010-10-27 23:12:14 +0000492 Format f, InstrItinClass itin, string opc, string asm,
493 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000494 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000495 "", pattern> {
496 let Inst{27-25} = op;
497 let Inst{24} = 1; // 24 == P
498 // 23 == U
Jim Grosbach2f790742010-11-13 00:35:48 +0000499 let Inst{22} = isByte;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000500 let Inst{21} = 0; // 21 == W
Jim Grosbach338de3e2010-10-27 23:12:14 +0000501 let Inst{20} = isLd;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000502}
Jim Grosbach2f790742010-11-13 00:35:48 +0000503// Indexed load/stores
504class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000505 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach2f790742010-11-13 00:35:48 +0000506 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000507 : I<oops, iops, AddrMode2, 4, im, f, itin,
Jim Grosbach2f790742010-11-13 00:35:48 +0000508 opc, asm, cstr, pattern> {
Jim Grosbach38b469e2010-11-15 20:47:07 +0000509 bits<4> Rt;
Jim Grosbach2f790742010-11-13 00:35:48 +0000510 let Inst{27-26} = 0b01;
511 let Inst{24} = isPre; // P bit
512 let Inst{22} = isByte; // B bit
513 let Inst{21} = isPre; // W bit
514 let Inst{20} = isLd; // L bit
Jim Grosbach38b469e2010-11-15 20:47:07 +0000515 let Inst{15-12} = Rt;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000516}
Owen Anderson2aedba62011-07-26 20:54:26 +0000517class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000518 IndexMode im, Format f, InstrItinClass itin, string opc,
519 string asm, string cstr, list<dag> pattern>
520 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
521 pattern> {
522 // AM2 store w/ two operands: (GPR, am2offset)
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000523 // {12} isAdd
524 // {11-0} imm12/Rm
Bruno Cardoso Lopesc2452a62011-03-31 15:54:36 +0000525 bits<14> offset;
526 bits<4> Rn;
Owen Anderson2aedba62011-07-26 20:54:26 +0000527 let Inst{25} = 1;
528 let Inst{23} = offset{12};
529 let Inst{19-16} = Rn;
530 let Inst{11-5} = offset{11-5};
531 let Inst{4} = 0;
532 let Inst{3-0} = offset{3-0};
533}
534
535class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
536 IndexMode im, Format f, InstrItinClass itin, string opc,
537 string asm, string cstr, list<dag> pattern>
538 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
539 pattern> {
540 // AM2 store w/ two operands: (GPR, am2offset)
541 // {12} isAdd
542 // {11-0} imm12/Rm
543 bits<14> offset;
544 bits<4> Rn;
545 let Inst{25} = 0;
Bruno Cardoso Lopesc2452a62011-03-31 15:54:36 +0000546 let Inst{23} = offset{12};
547 let Inst{19-16} = Rn;
548 let Inst{11-0} = offset{11-0};
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000549}
Owen Anderson2aedba62011-07-26 20:54:26 +0000550
551
Bruno Cardoso Lopesab830502011-03-31 23:26:08 +0000552// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
553// but for now use this class for STRT and STRBT.
554class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
555 IndexMode im, Format f, InstrItinClass itin, string opc,
556 string asm, string cstr, list<dag> pattern>
557 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
558 pattern> {
559 // AM2 store w/ two operands: (GPR, am2offset)
560 // {17-14} Rn
561 // {13} 1 == Rm, 0 == imm12
562 // {12} isAdd
563 // {11-0} imm12/Rm
564 bits<18> addr;
565 let Inst{25} = addr{13};
566 let Inst{23} = addr{12};
567 let Inst{19-16} = addr{17-14};
568 let Inst{11-0} = addr{11-0};
569}
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000570
Evan Cheng624844b2008-09-01 01:51:14 +0000571// addrmode3 instructions
Jim Grosbach76aed402010-11-19 18:16:46 +0000572class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
573 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000574 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach8e7f8df2010-11-18 00:46:58 +0000575 opc, asm, "", pattern> {
576 bits<14> addr;
577 bits<4> Rt;
578 let Inst{27-25} = 0b000;
579 let Inst{24} = 1; // P bit
580 let Inst{23} = addr{8}; // U bit
581 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
582 let Inst{21} = 0; // W bit
Jim Grosbach76aed402010-11-19 18:16:46 +0000583 let Inst{20} = op20; // L bit
Jim Grosbach8e7f8df2010-11-18 00:46:58 +0000584 let Inst{19-16} = addr{12-9}; // Rn
585 let Inst{15-12} = Rt; // Rt
586 let Inst{11-8} = addr{7-4}; // imm7_4/zero
587 let Inst{7-4} = op;
588 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Owen Andersone0152a72011-08-09 20:55:18 +0000589
590 let DecoderMethod = "DecodeAddrMode3Instruction";
Jim Grosbach8e7f8df2010-11-18 00:46:58 +0000591}
Evan Cheng169eccc2008-09-01 07:00:14 +0000592
Jim Grosbach003c6e72010-11-19 19:41:26 +0000593class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
594 IndexMode im, Format f, InstrItinClass itin, string opc,
595 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000596 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach003c6e72010-11-19 19:41:26 +0000597 opc, asm, cstr, pattern> {
598 bits<4> Rt;
599 let Inst{27-25} = 0b000;
600 let Inst{24} = isPre; // P bit
601 let Inst{21} = isPre; // W bit
602 let Inst{20} = op20; // L bit
603 let Inst{15-12} = Rt; // Rt
604 let Inst{7-4} = op;
605}
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000606
607// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
608// but for now use this class for LDRSBT, LDRHT, LDSHT.
Jim Grosbachd3595712011-08-03 23:50:40 +0000609class AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000610 IndexMode im, Format f, InstrItinClass itin, string opc,
611 string asm, string cstr, list<dag> pattern>
Jim Grosbachd3595712011-08-03 23:50:40 +0000612 : I<oops, iops, AddrMode3, 4, im, f, itin, opc, asm, cstr, pattern> {
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000613 // {13} 1 == imm8, 0 == Rm
614 // {12-9} Rn
615 // {8} isAdd
616 // {7-4} imm7_4/zero
617 // {3-0} imm3_0/Rm
Jim Grosbachd3595712011-08-03 23:50:40 +0000618 bits<4> addr;
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000619 bits<4> Rt;
620 let Inst{27-25} = 0b000;
Jim Grosbachd3595712011-08-03 23:50:40 +0000621 let Inst{24} = 0; // P bit
622 let Inst{21} = 1;
623 let Inst{20} = isLoad; // L bit
624 let Inst{19-16} = addr; // Rn
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000625 let Inst{15-12} = Rt; // Rt
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000626 let Inst{7-4} = op;
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000627}
628
Jim Grosbach150b1ad2010-11-29 18:37:44 +0000629class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
630 IndexMode im, Format f, InstrItinClass itin, string opc,
631 string asm, string cstr, list<dag> pattern>
632 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
633 pattern> {
634 // AM3 store w/ two operands: (GPR, am3offset)
635 bits<14> offset;
636 bits<4> Rt;
637 bits<4> Rn;
638 let Inst{27-25} = 0b000;
639 let Inst{23} = offset{8};
640 let Inst{22} = offset{9};
641 let Inst{19-16} = Rn;
642 let Inst{15-12} = Rt; // Rt
643 let Inst{11-8} = offset{7-4}; // imm7_4/zero
644 let Inst{7-4} = op;
645 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
646}
Jim Grosbach003c6e72010-11-19 19:41:26 +0000647
Evan Cheng169eccc2008-09-01 07:00:14 +0000648// stores
Jim Grosbach09d7bfd2010-11-19 22:14:31 +0000649class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwinb062c232009-08-06 16:52:47 +0000650 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000651 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000652 opc, asm, "", pattern> {
Jim Grosbach607efcb2010-11-11 01:09:40 +0000653 bits<14> addr;
654 bits<4> Rt;
Evan Cheng5edd90c2009-07-08 22:51:32 +0000655 let Inst{27-25} = 0b000;
Jim Grosbach607efcb2010-11-11 01:09:40 +0000656 let Inst{24} = 1; // P bit
657 let Inst{23} = addr{8}; // U bit
658 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
659 let Inst{21} = 0; // W bit
660 let Inst{20} = 0; // L bit
661 let Inst{19-16} = addr{12-9}; // Rn
662 let Inst{15-12} = Rt; // Rt
663 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach09d7bfd2010-11-19 22:14:31 +0000664 let Inst{7-4} = op;
Jim Grosbach607efcb2010-11-11 01:09:40 +0000665 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng169eccc2008-09-01 07:00:14 +0000666}
Evan Cheng169eccc2008-09-01 07:00:14 +0000667
Evan Cheng169eccc2008-09-01 07:00:14 +0000668// Pre-indexed stores
David Goodwinb062c232009-08-06 16:52:47 +0000669class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
670 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000671 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000672 opc, asm, cstr, pattern> {
Evan Cheng169eccc2008-09-01 07:00:14 +0000673 let Inst{4} = 1;
674 let Inst{5} = 1; // H bit
675 let Inst{6} = 0; // S bit
676 let Inst{7} = 1;
677 let Inst{20} = 0; // L bit
678 let Inst{21} = 1; // W bit
679 let Inst{24} = 1; // P bit
Evan Cheng5edd90c2009-07-08 22:51:32 +0000680 let Inst{27-25} = 0b000;
Evan Cheng169eccc2008-09-01 07:00:14 +0000681}
Johnny Chen688a90e2010-02-18 22:31:18 +0000682class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
683 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000684 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
Johnny Chen688a90e2010-02-18 22:31:18 +0000685 opc, asm, cstr, pattern> {
686 let Inst{4} = 1;
687 let Inst{5} = 1; // H bit
688 let Inst{6} = 1; // S bit
689 let Inst{7} = 1;
690 let Inst{20} = 0; // L bit
691 let Inst{21} = 1; // W bit
692 let Inst{24} = 1; // P bit
693 let Inst{27-25} = 0b000;
694}
Evan Cheng169eccc2008-09-01 07:00:14 +0000695
Evan Cheng169eccc2008-09-01 07:00:14 +0000696// Post-indexed stores
Johnny Chen688a90e2010-02-18 22:31:18 +0000697class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
698 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000699 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
Johnny Chen688a90e2010-02-18 22:31:18 +0000700 opc, asm, cstr, pattern> {
701 let Inst{4} = 1;
702 let Inst{5} = 1; // H bit
703 let Inst{6} = 1; // S bit
704 let Inst{7} = 1;
705 let Inst{20} = 0; // L bit
706 let Inst{21} = 0; // W bit
707 let Inst{24} = 0; // P bit
708 let Inst{27-25} = 0b000;
709}
Evan Cheng169eccc2008-09-01 07:00:14 +0000710
Evan Cheng624844b2008-09-01 01:51:14 +0000711// addrmode4 instructions
Bill Wendlinge69afc62010-11-13 09:09:38 +0000712class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
713 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000714 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendlinge69afc62010-11-13 09:09:38 +0000715 bits<4> p;
716 bits<16> regs;
717 bits<4> Rn;
718 let Inst{31-28} = p;
719 let Inst{27-25} = 0b100;
720 let Inst{22} = 0; // S bit
721 let Inst{19-16} = Rn;
722 let Inst{15-0} = regs;
723}
Evan Cheng2d37f192008-08-28 23:39:26 +0000724
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000725// Unsigned multiply, multiply-accumulate instructions.
David Goodwinb062c232009-08-06 16:52:47 +0000726class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
727 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000728 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000729 opc, asm, "", pattern> {
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000730 let Inst{7-4} = 0b1001;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000731 let Inst{20} = 0; // S bit
Evan Cheng47b546d2008-11-06 08:47:38 +0000732 let Inst{27-21} = opcod;
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000733}
David Goodwinb062c232009-08-06 16:52:47 +0000734class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
735 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000736 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000737 opc, asm, "", pattern> {
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000738 let Inst{7-4} = 0b1001;
Evan Cheng47b546d2008-11-06 08:47:38 +0000739 let Inst{27-21} = opcod;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000740}
741
742// Most significant word multiply
Jim Grosbach22261602010-10-22 17:16:17 +0000743class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
744 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000745 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000746 opc, asm, "", pattern> {
Jim Grosbach22261602010-10-22 17:16:17 +0000747 bits<4> Rd;
748 bits<4> Rn;
749 bits<4> Rm;
750 let Inst{7-4} = opc7_4;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000751 let Inst{20} = 1;
Evan Cheng47b546d2008-11-06 08:47:38 +0000752 let Inst{27-21} = opcod;
Jim Grosbach22261602010-10-22 17:16:17 +0000753 let Inst{19-16} = Rd;
754 let Inst{11-8} = Rm;
755 let Inst{3-0} = Rn;
756}
757// MSW multiple w/ Ra operand
758class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
759 InstrItinClass itin, string opc, string asm, list<dag> pattern>
760 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
761 bits<4> Ra;
762 let Inst{15-12} = Ra;
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000763}
Evan Cheng2d37f192008-08-28 23:39:26 +0000764
Evan Cheng36ae4032008-11-06 03:35:07 +0000765// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach6956a602010-10-22 18:35:16 +0000766class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbachf98df082010-10-22 17:42:06 +0000767 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000768 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000769 opc, asm, "", pattern> {
Jim Grosbach6956a602010-10-22 18:35:16 +0000770 bits<4> Rn;
771 bits<4> Rm;
Evan Cheng36ae4032008-11-06 03:35:07 +0000772 let Inst{4} = 0;
773 let Inst{7} = 1;
774 let Inst{20} = 0;
Evan Cheng47b546d2008-11-06 08:47:38 +0000775 let Inst{27-21} = opcod;
Jim Grosbachf98df082010-10-22 17:42:06 +0000776 let Inst{6-5} = bit6_5;
Jim Grosbach6956a602010-10-22 18:35:16 +0000777 let Inst{11-8} = Rm;
778 let Inst{3-0} = Rn;
779}
780class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
781 InstrItinClass itin, string opc, string asm, list<dag> pattern>
782 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
783 bits<4> Rd;
784 let Inst{19-16} = Rd;
785}
786
787// AMulxyI with Ra operand
788class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
789 InstrItinClass itin, string opc, string asm, list<dag> pattern>
790 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
791 bits<4> Ra;
792 let Inst{15-12} = Ra;
793}
794// SMLAL*
795class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
796 InstrItinClass itin, string opc, string asm, list<dag> pattern>
797 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
798 bits<4> RdLo;
799 bits<4> RdHi;
800 let Inst{19-16} = RdHi;
801 let Inst{15-12} = RdLo;
Evan Cheng36ae4032008-11-06 03:35:07 +0000802}
803
Evan Cheng49d66522008-11-06 22:15:19 +0000804// Extend instructions.
David Goodwinb062c232009-08-06 16:52:47 +0000805class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
806 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000807 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000808 opc, asm, "", pattern> {
Jim Grosbach1e7db682010-10-13 19:56:10 +0000809 // All AExtI instructions have Rd and Rm register operands.
810 bits<4> Rd;
811 bits<4> Rm;
812 let Inst{15-12} = Rd;
813 let Inst{3-0} = Rm;
Evan Cheng49d66522008-11-06 22:15:19 +0000814 let Inst{7-4} = 0b0111;
Jim Grosbach1e7db682010-10-13 19:56:10 +0000815 let Inst{9-8} = 0b00;
Evan Cheng49d66522008-11-06 22:15:19 +0000816 let Inst{27-20} = opcod;
817}
818
Evan Cheng98dc53e2008-11-07 01:41:35 +0000819// Misc Arithmetic instructions.
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000820class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
821 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000822 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000823 opc, asm, "", pattern> {
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000824 bits<4> Rd;
825 bits<4> Rm;
Evan Cheng98dc53e2008-11-07 01:41:35 +0000826 let Inst{27-20} = opcod;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000827 let Inst{19-16} = 0b1111;
828 let Inst{15-12} = Rd;
829 let Inst{11-8} = 0b1111;
830 let Inst{7-4} = opc7_4;
831 let Inst{3-0} = Rm;
832}
833
834// PKH instructions
Jim Grosbach27c1e252011-07-21 17:23:04 +0000835def PKHLSLAsmOperand : AsmOperandClass {
836 let Name = "PKHLSLImm";
837 let ParserMethod = "parsePKHLSLImm";
838}
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000839def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
840 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbach27c1e252011-07-21 17:23:04 +0000841 let ParserMatchClass = PKHLSLAsmOperand;
842}
843def PKHASRAsmOperand : AsmOperandClass {
844 let Name = "PKHASRImm";
845 let ParserMethod = "parsePKHASRImm";
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000846}
847def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
848 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbach27c1e252011-07-21 17:23:04 +0000849 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000850}
Jim Grosbach94df3be2011-07-20 20:49:03 +0000851
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000852class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
853 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000854 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000855 opc, asm, "", pattern> {
856 bits<4> Rd;
857 bits<4> Rn;
858 bits<4> Rm;
Jim Grosbacha98f8002011-07-20 20:32:09 +0000859 bits<5> sh;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000860 let Inst{27-20} = opcod;
861 let Inst{19-16} = Rn;
862 let Inst{15-12} = Rd;
Jim Grosbacha98f8002011-07-20 20:32:09 +0000863 let Inst{11-7} = sh;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000864 let Inst{6} = tb;
865 let Inst{5-4} = 0b01;
866 let Inst{3-0} = Rm;
Evan Cheng98dc53e2008-11-07 01:41:35 +0000867}
868
Evan Cheng2d37f192008-08-28 23:39:26 +0000869//===----------------------------------------------------------------------===//
870
871// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
872class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
873 list<Predicate> Predicates = [IsARM];
874}
Bruno Cardoso Lopes168c9002011-05-03 17:29:22 +0000875class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
876 list<Predicate> Predicates = [IsARM, HasV5T];
877}
Evan Cheng2d37f192008-08-28 23:39:26 +0000878class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
879 list<Predicate> Predicates = [IsARM, HasV5TE];
880}
881class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
882 list<Predicate> Predicates = [IsARM, HasV6];
883}
Evan Chengee98fa92008-08-29 06:41:12 +0000884
885//===----------------------------------------------------------------------===//
Evan Chengee98fa92008-08-29 06:41:12 +0000886// Thumb Instruction Format Definitions.
887//
888
Owen Anderson651b2302011-07-13 23:22:26 +0000889class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000890 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000891 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +0000892 let OutOperandList = oops;
893 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000894 let AsmString = asm;
Evan Chengee98fa92008-08-29 06:41:12 +0000895 let Pattern = pattern;
896 list<Predicate> Predicates = [IsThumb];
897}
898
Bill Wendlingcbb08ca2010-12-01 02:42:55 +0000899// TI - Thumb instruction.
David Goodwinb062c232009-08-06 16:52:47 +0000900class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000901 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Chengee98fa92008-08-29 06:41:12 +0000902
Evan Cheng7cc6aca2009-08-04 23:47:55 +0000903// Two-address instructions
Bob Wilson3968c6a2010-03-23 17:23:59 +0000904class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
905 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000906 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson3968c6a2010-03-23 17:23:59 +0000907 pattern>;
Evan Cheng7cc6aca2009-08-04 23:47:55 +0000908
Johnny Chenc28e6292009-12-15 17:24:14 +0000909// tBL, tBX 32-bit instructions
910class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000911 dag oops, dag iops, InstrItinClass itin, string asm,
912 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000913 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000914 Encoding {
Johnny Chenc28e6292009-12-15 17:24:14 +0000915 let Inst{31-27} = opcod1;
916 let Inst{15-14} = opcod2;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000917 let Inst{12} = opcod3;
Johnny Chenc28e6292009-12-15 17:24:14 +0000918}
Evan Chengee98fa92008-08-29 06:41:12 +0000919
920// BR_JT instructions
Bob Wilson3968c6a2010-03-23 17:23:59 +0000921class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
922 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000923 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengee98fa92008-08-29 06:41:12 +0000924
Evan Chengbec1dba892009-06-23 19:38:13 +0000925// Thumb1 only
Owen Anderson651b2302011-07-13 23:22:26 +0000926class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000927 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000928 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +0000929 let OutOperandList = oops;
930 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000931 let AsmString = asm;
Evan Chengbec1dba892009-06-23 19:38:13 +0000932 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +0000933 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Chengbec1dba892009-06-23 19:38:13 +0000934}
935
David Goodwinb062c232009-08-06 16:52:47 +0000936class T1I<dag oops, dag iops, InstrItinClass itin,
937 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000938 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +0000939class T1Ix2<dag oops, dag iops, InstrItinClass itin,
940 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000941 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Chengbec1dba892009-06-23 19:38:13 +0000942
943// Two-address instructions
David Goodwinb062c232009-08-06 16:52:47 +0000944class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +0000945 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000946 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson947f04b2010-03-13 01:08:20 +0000947 asm, cstr, pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000948
949// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson651b2302011-07-13 23:22:26 +0000950class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000951 InstrItinClass itin,
Evan Chengcd4cdd12009-07-11 06:43:01 +0000952 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000953 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000954 let OutOperandList = !con(oops, (outs s_cc_out:$s));
955 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +0000956 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Chengcd4cdd12009-07-11 06:43:01 +0000957 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +0000958 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Chengcd4cdd12009-07-11 06:43:01 +0000959}
960
David Goodwinb062c232009-08-06 16:52:47 +0000961class T1sI<dag oops, dag iops, InstrItinClass itin,
962 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000963 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000964
965// Two-address instructions
David Goodwinb062c232009-08-06 16:52:47 +0000966class T1sIt<dag oops, dag iops, InstrItinClass itin,
967 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000968 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling05632cb2010-11-30 23:54:45 +0000969 "$Rn = $Rdn", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000970
971// Thumb1 instruction that can be predicated.
Owen Anderson651b2302011-07-13 23:22:26 +0000972class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000973 InstrItinClass itin,
Evan Chengcd4cdd12009-07-11 06:43:01 +0000974 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000975 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +0000976 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000977 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +0000978 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chengcd4cdd12009-07-11 06:43:01 +0000979 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +0000980 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Chengcd4cdd12009-07-11 06:43:01 +0000981}
982
David Goodwinb062c232009-08-06 16:52:47 +0000983class T1pI<dag oops, dag iops, InstrItinClass itin,
984 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000985 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000986
987// Two-address instructions
David Goodwinb062c232009-08-06 16:52:47 +0000988class T1pIt<dag oops, dag iops, InstrItinClass itin,
989 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000990 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling7c646b92010-12-01 01:32:02 +0000991 "$Rn = $Rdn", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000992
Bob Wilson3968c6a2010-03-23 17:23:59 +0000993class T1pIs<dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +0000994 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000995 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Chengbec1dba892009-06-23 19:38:13 +0000996
Johnny Chen466231a2009-12-16 02:32:54 +0000997class Encoding16 : Encoding {
998 let Inst{31-16} = 0x0000;
999}
1000
Johnny Chenc28e6292009-12-15 17:24:14 +00001001// A6.2 16-bit Thumb instruction encoding
Johnny Chen466231a2009-12-16 02:32:54 +00001002class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001003 let Inst{15-10} = opcode;
1004}
1005
1006// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001007class T1General<bits<5> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001008 let Inst{15-14} = 0b00;
1009 let Inst{13-9} = opcode;
1010}
1011
1012// A6.2.2 Data-processing encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001013class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001014 let Inst{15-10} = 0b010000;
1015 let Inst{9-6} = opcode;
1016}
1017
1018// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001019class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001020 let Inst{15-10} = 0b010001;
Bill Wendling345b48f2010-11-17 00:45:23 +00001021 let Inst{9-6} = opcode;
Johnny Chenc28e6292009-12-15 17:24:14 +00001022}
1023
1024// A6.2.4 Load/store single data item encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001025class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001026 let Inst{15-12} = opA;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001027 let Inst{11-9} = opB;
Johnny Chenc28e6292009-12-15 17:24:14 +00001028}
Bill Wendlingb70dc872010-08-31 07:50:46 +00001029class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chenc28e6292009-12-15 17:24:14 +00001030
Eric Christopher9b67db82011-05-27 03:50:53 +00001031class T1BranchCond<bits<4> opcode> : Encoding16 {
1032 let Inst{15-12} = opcode;
1033}
1034
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001035// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling05632cb2010-11-30 23:54:45 +00001036// following bits are used for "opA" (see A6.2.4):
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001037//
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001038// 0b0110 => Immediate, 4 bytes
1039// 0b1000 => Immediate, 2 bytes
1040// 0b0111 => Immediate, 1 byte
Bill Wendlingc25545a2010-12-01 01:38:08 +00001041class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1042 InstrItinClass itin, string opc, string asm,
1043 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001044 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling5c51fcd2010-11-30 23:16:25 +00001045 T1LoadStore<0b0101, opcode> {
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001046 bits<3> Rt;
1047 bits<8> addr;
1048 let Inst{8-6} = addr{5-3}; // Rm
1049 let Inst{5-3} = addr{2-0}; // Rn
1050 let Inst{2-0} = Rt;
1051}
Bill Wendlingc25545a2010-12-01 01:38:08 +00001052class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1053 InstrItinClass itin, string opc, string asm,
1054 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001055 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling5c51fcd2010-11-30 23:16:25 +00001056 T1LoadStore<opA, {opB,?,?}> {
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001057 bits<3> Rt;
1058 bits<8> addr;
1059 let Inst{10-6} = addr{7-3}; // imm5
1060 let Inst{5-3} = addr{2-0}; // Rn
1061 let Inst{2-0} = Rt;
1062}
1063
Johnny Chenc28e6292009-12-15 17:24:14 +00001064// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001065class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001066 let Inst{15-12} = 0b1011;
1067 let Inst{11-5} = opcode;
1068}
1069
Evan Chengd76f0be2009-06-25 02:08:06 +00001070// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +00001071class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001072 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001073 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001074 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengd76f0be2009-06-25 02:08:06 +00001075 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001076 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001077 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chengd76f0be2009-06-25 02:08:06 +00001078 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001079 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001080 let DecoderNamespace = "Thumb2";
Evan Chengd76f0be2009-06-25 02:08:06 +00001081}
1082
Bill Wendlingb70dc872010-08-31 07:50:46 +00001083// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1084// input operand since by default it's a zero register. It will become an
1085// implicit def once it's "flipped".
Jim Grosbachb9386552010-10-13 23:12:26 +00001086//
Evan Chengd76f0be2009-06-25 02:08:06 +00001087// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1088// more consistent.
Owen Anderson651b2302011-07-13 23:22:26 +00001089class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001090 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001091 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001092 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersoncf096a42010-12-07 20:50:15 +00001093 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1094 let Inst{20} = s;
1095
Evan Chengd76f0be2009-06-25 02:08:06 +00001096 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001097 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner04c342e2010-10-06 00:05:18 +00001098 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Chengd76f0be2009-06-25 02:08:06 +00001099 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001100 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001101 let DecoderNamespace = "Thumb2";
Evan Chengd76f0be2009-06-25 02:08:06 +00001102}
1103
1104// Special cases
Owen Anderson651b2302011-07-13 23:22:26 +00001105class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001106 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001107 string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001108 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengd76f0be2009-06-25 02:08:06 +00001109 let OutOperandList = oops;
1110 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +00001111 let AsmString = asm;
Evan Cheng431cf562009-06-23 17:48:47 +00001112 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001113 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001114 let DecoderNamespace = "Thumb2";
Evan Cheng431cf562009-06-23 17:48:47 +00001115}
1116
Owen Anderson651b2302011-07-13 23:22:26 +00001117class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001118 InstrItinClass itin,
1119 string asm, string cstr, list<dag> pattern>
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001120 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1121 let OutOperandList = oops;
1122 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +00001123 let AsmString = asm;
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001124 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001125 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001126 let DecoderNamespace = "Thumb";
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001127}
1128
David Goodwinb062c232009-08-06 16:52:47 +00001129class T2I<dag oops, dag iops, InstrItinClass itin,
1130 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001131 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001132class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1133 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001134 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001135class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1136 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001137 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001138class T2Iso<dag oops, dag iops, InstrItinClass itin,
1139 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001140 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001141class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1142 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001143 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach95bd6b72010-12-10 20:51:35 +00001144class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
David Goodwinb062c232009-08-06 16:52:47 +00001145 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001146 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
Johnny Chenc28e6292009-12-15 17:24:14 +00001147 pattern> {
Owen Anderson943fb602010-12-01 19:18:46 +00001148 bits<4> Rt;
1149 bits<4> Rt2;
1150 bits<13> addr;
Jim Grosbach95bd6b72010-12-10 20:51:35 +00001151 let Inst{31-25} = 0b1110100;
1152 let Inst{24} = P;
1153 let Inst{23} = addr{8};
1154 let Inst{22} = 1;
1155 let Inst{21} = W;
1156 let Inst{20} = isLoad;
1157 let Inst{19-16} = addr{12-9};
Owen Anderson943fb602010-12-01 19:18:46 +00001158 let Inst{15-12} = Rt{3-0};
1159 let Inst{11-8} = Rt2{3-0};
Owen Anderson943fb602010-12-01 19:18:46 +00001160 let Inst{7-0} = addr{7-0};
Johnny Chenc28e6292009-12-15 17:24:14 +00001161}
Evan Chengd76f0be2009-06-25 02:08:06 +00001162
Owen Anderson08d4bb02011-08-04 23:18:05 +00001163class T2Ii8s4Tied<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
1164 string opc, string asm, list<dag> pattern>
1165 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "$base = $wb",
1166 pattern> {
1167 bits<4> Rt;
1168 bits<4> Rt2;
1169 bits<4> base;
1170 bits<9> imm;
1171 let Inst{31-25} = 0b1110100;
1172 let Inst{24} = P;
1173 let Inst{23} = imm{8};
1174 let Inst{22} = 1;
1175 let Inst{21} = W;
1176 let Inst{20} = isLoad;
1177 let Inst{19-16} = base{3-0};
1178 let Inst{15-12} = Rt{3-0};
1179 let Inst{11-8} = Rt2{3-0};
1180 let Inst{7-0} = imm{7-0};
1181}
1182
1183
David Goodwinb062c232009-08-06 16:52:47 +00001184class T2sI<dag oops, dag iops, InstrItinClass itin,
1185 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001186 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Chengd76f0be2009-06-25 02:08:06 +00001187
David Goodwinb062c232009-08-06 16:52:47 +00001188class T2XI<dag oops, dag iops, InstrItinClass itin,
1189 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001190 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001191class T2JTI<dag oops, dag iops, InstrItinClass itin,
1192 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001193 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng431cf562009-06-23 17:48:47 +00001194
Bruno Cardoso Lopes4d4b4902011-01-20 16:58:48 +00001195// Move to/from coprocessor instructions
Jim Grosbachcabb48d2011-07-13 21:17:59 +00001196class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
Jim Grosbachadb29b62011-07-13 21:14:23 +00001197 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbachcabb48d2011-07-13 21:17:59 +00001198 let Inst{31-28} = opc;
Bruno Cardoso Lopes4d4b4902011-01-20 16:58:48 +00001199}
1200
Bob Wilson947f04b2010-03-13 01:08:20 +00001201// Two-address instructions
1202class T2XIt<dag oops, dag iops, InstrItinClass itin,
1203 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001204 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng83e0d482009-09-28 09:14:39 +00001205
Evan Cheng84c6cda2009-07-02 07:28:31 +00001206// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chenc28e6292009-12-15 17:24:14 +00001207class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1208 dag oops, dag iops,
1209 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Cheng84c6cda2009-07-02 07:28:31 +00001210 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001211 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng84c6cda2009-07-02 07:28:31 +00001212 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001213 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001214 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng84c6cda2009-07-02 07:28:31 +00001215 let Pattern = pattern;
1216 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001217 let DecoderNamespace = "Thumb2";
Johnny Chenc28e6292009-12-15 17:24:14 +00001218 let Inst{31-27} = 0b11111;
1219 let Inst{26-25} = 0b00;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001220 let Inst{24} = signed;
1221 let Inst{23} = 0;
Johnny Chenc28e6292009-12-15 17:24:14 +00001222 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001223 let Inst{20} = load;
1224 let Inst{11} = 1;
Johnny Chenc28e6292009-12-15 17:24:14 +00001225 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingb70dc872010-08-31 07:50:46 +00001226 let Inst{10} = pre; // The P bit.
1227 let Inst{8} = 1; // The W bit.
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001228
Owen Andersone22c7322010-11-30 00:14:31 +00001229 bits<9> addr;
1230 let Inst{7-0} = addr{7-0};
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001231 let Inst{9} = addr{8}; // Sign bit
1232
Owen Andersone22c7322010-11-30 00:14:31 +00001233 bits<4> Rt;
1234 bits<4> Rn;
1235 let Inst{15-12} = Rt{3-0};
1236 let Inst{19-16} = Rn{3-0};
Evan Cheng84c6cda2009-07-02 07:28:31 +00001237}
1238
David Goodwine5b969f2009-07-27 19:59:26 +00001239// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1240class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001241 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwine5b969f2009-07-27 19:59:26 +00001242}
1243
1244// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1245class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001246 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwine5b969f2009-07-27 19:59:26 +00001247}
Evan Cheng84c6cda2009-07-02 07:28:31 +00001248
Bruno Cardoso Lopes168c9002011-05-03 17:29:22 +00001249// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1250class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1251 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1252}
1253
Evan Chengeab9ca72009-06-27 02:26:13 +00001254// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1255class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Cheng2c450d32009-07-02 06:38:40 +00001256 list<Predicate> Predicates = [IsThumb2];
Evan Cheng431cf562009-06-23 17:48:47 +00001257}
1258
Evan Chengee98fa92008-08-29 06:41:12 +00001259//===----------------------------------------------------------------------===//
1260
Evan Chengac2af2f2008-11-11 02:11:05 +00001261//===----------------------------------------------------------------------===//
1262// ARM VFP Instruction templates.
1263//
1264
David Goodwin81cdd212009-07-10 17:03:29 +00001265// Almost all VFP instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +00001266class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001267 IndexMode im, Format f, InstrItinClass itin,
1268 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001269 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach576640f2010-10-12 21:22:40 +00001270 bits<4> p;
1271 let Inst{31-28} = p;
David Goodwin81cdd212009-07-10 17:03:29 +00001272 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001273 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001274 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin81cdd212009-07-10 17:03:29 +00001275 let Pattern = pattern;
Bill Wendling87240d42010-12-01 21:54:50 +00001276 let PostEncoderMethod = "VFPThumb2PostEncoder";
Owen Andersone0152a72011-08-09 20:55:18 +00001277 let DecoderNamespace = "VFP";
David Goodwin81cdd212009-07-10 17:03:29 +00001278 list<Predicate> Predicates = [HasVFP2];
1279}
1280
1281// Special cases
Owen Anderson651b2302011-07-13 23:22:26 +00001282class VFPXI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001283 IndexMode im, Format f, InstrItinClass itin,
1284 string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001285 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling345b48f2010-11-17 00:45:23 +00001286 bits<4> p;
1287 let Inst{31-28} = p;
David Goodwin81cdd212009-07-10 17:03:29 +00001288 let OutOperandList = oops;
1289 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +00001290 let AsmString = asm;
David Goodwin81cdd212009-07-10 17:03:29 +00001291 let Pattern = pattern;
Bill Wendling87240d42010-12-01 21:54:50 +00001292 let PostEncoderMethod = "VFPThumb2PostEncoder";
Owen Andersone0152a72011-08-09 20:55:18 +00001293 let DecoderNamespace = "VFP";
David Goodwin81cdd212009-07-10 17:03:29 +00001294 list<Predicate> Predicates = [HasVFP2];
1295}
1296
David Goodwinb062c232009-08-06 16:52:47 +00001297class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1298 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001299 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendling87240d42010-12-01 21:54:50 +00001300 opc, asm, "", pattern> {
1301 let PostEncoderMethod = "VFPThumb2PostEncoder";
1302}
David Goodwin81cdd212009-07-10 17:03:29 +00001303
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001304// ARM VFP addrmode5 loads and stores
1305class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001306 InstrItinClass itin,
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001307 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001308 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001309 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendlingc0024632010-11-04 00:59:42 +00001310 // Instruction operands.
1311 bits<5> Dd;
1312 bits<13> addr;
1313
1314 // Encode instruction operands.
1315 let Inst{23} = addr{8}; // U (add = (U == '1'))
1316 let Inst{22} = Dd{4};
1317 let Inst{19-16} = addr{12-9}; // Rn
1318 let Inst{15-12} = Dd{3-0};
1319 let Inst{7-0} = addr{7-0}; // imm8
1320
Evan Chengac2af2f2008-11-11 02:11:05 +00001321 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001322 let Inst{27-24} = opcod1;
1323 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001324 let Inst{11-9} = 0b101;
1325 let Inst{8} = 1; // Double precision
Anton Korobeynikov8cce1eb2009-11-02 00:11:06 +00001326
Evan Cheng4a8c43f2011-02-16 00:35:02 +00001327 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +00001328 let D = VFPNeonDomain;
Evan Chengac2af2f2008-11-11 02:11:05 +00001329}
1330
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001331class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001332 InstrItinClass itin,
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001333 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001334 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001335 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendlingc0024632010-11-04 00:59:42 +00001336 // Instruction operands.
1337 bits<5> Sd;
1338 bits<13> addr;
1339
1340 // Encode instruction operands.
1341 let Inst{23} = addr{8}; // U (add = (U == '1'))
1342 let Inst{22} = Sd{0};
1343 let Inst{19-16} = addr{12-9}; // Rn
1344 let Inst{15-12} = Sd{4-1};
1345 let Inst{7-0} = addr{7-0}; // imm8
1346
Evan Chengac2af2f2008-11-11 02:11:05 +00001347 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001348 let Inst{27-24} = opcod1;
1349 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001350 let Inst{11-9} = 0b101;
1351 let Inst{8} = 0; // Single precision
Evan Cheng4a8c43f2011-02-16 00:35:02 +00001352
1353 // Loads & stores operate on both NEON and VFP pipelines.
1354 let D = VFPNeonDomain;
Evan Chengac2af2f2008-11-11 02:11:05 +00001355}
1356
Bob Wilson6b853c32010-09-16 00:31:02 +00001357// VFP Load / store multiple pseudo instructions.
1358class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1359 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001360 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson6b853c32010-09-16 00:31:02 +00001361 cstr, itin> {
1362 let OutOperandList = oops;
1363 let InOperandList = !con(iops, (ins pred:$p));
1364 let Pattern = pattern;
1365 list<Predicate> Predicates = [HasVFP2];
1366}
1367
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001368// Load / store multiple
Jim Grosbachabcbe242010-09-08 00:25:50 +00001369class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +00001370 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001371 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001372 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling345b48f2010-11-17 00:45:23 +00001373 // Instruction operands.
1374 bits<4> Rn;
1375 bits<13> regs;
1376
1377 // Encode instruction operands.
1378 let Inst{19-16} = Rn;
1379 let Inst{22} = regs{12};
1380 let Inst{15-12} = regs{11-8};
1381 let Inst{7-0} = regs{7-0};
1382
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001383 // TODO: Mark the instructions with the appropriate subtarget info.
1384 let Inst{27-25} = 0b110;
Bill Wendling98c29d72010-10-12 22:03:19 +00001385 let Inst{11-9} = 0b101;
1386 let Inst{8} = 1; // Double precision
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001387}
1388
Jim Grosbachabcbe242010-09-08 00:25:50 +00001389class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +00001390 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001391 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001392 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling345b48f2010-11-17 00:45:23 +00001393 // Instruction operands.
1394 bits<4> Rn;
1395 bits<13> regs;
1396
1397 // Encode instruction operands.
1398 let Inst{19-16} = Rn;
1399 let Inst{22} = regs{8};
1400 let Inst{15-12} = regs{12-9};
1401 let Inst{7-0} = regs{7-0};
1402
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001403 // TODO: Mark the instructions with the appropriate subtarget info.
1404 let Inst{27-25} = 0b110;
Bill Wendling98c29d72010-10-12 22:03:19 +00001405 let Inst{11-9} = 0b101;
1406 let Inst{8} = 0; // Single precision
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001407}
1408
Evan Chengac2af2f2008-11-11 02:11:05 +00001409// Double precision, unary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001410class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1411 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1412 string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001413 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001414 // Instruction operands.
1415 bits<5> Dd;
1416 bits<5> Dm;
1417
1418 // Encode instruction operands.
1419 let Inst{3-0} = Dm{3-0};
1420 let Inst{5} = Dm{4};
1421 let Inst{15-12} = Dd{3-0};
1422 let Inst{22} = Dd{4};
1423
Johnny Chen34a6afc2010-01-29 23:21:10 +00001424 let Inst{27-23} = opcod1;
1425 let Inst{21-20} = opcod2;
1426 let Inst{19-16} = opcod3;
Bill Wendling98c29d72010-10-12 22:03:19 +00001427 let Inst{11-9} = 0b101;
1428 let Inst{8} = 1; // Double precision
Johnny Chen34a6afc2010-01-29 23:21:10 +00001429 let Inst{7-6} = opcod4;
1430 let Inst{4} = opcod5;
Evan Chengac2af2f2008-11-11 02:11:05 +00001431}
1432
1433// Double precision, binary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001434class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001435 dag iops, InstrItinClass itin, string opc, string asm,
1436 list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001437 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001438 // Instruction operands.
1439 bits<5> Dd;
1440 bits<5> Dn;
1441 bits<5> Dm;
1442
1443 // Encode instruction operands.
1444 let Inst{3-0} = Dm{3-0};
1445 let Inst{5} = Dm{4};
1446 let Inst{19-16} = Dn{3-0};
1447 let Inst{7} = Dn{4};
1448 let Inst{15-12} = Dd{3-0};
1449 let Inst{22} = Dd{4};
1450
Johnny Chen34a6afc2010-01-29 23:21:10 +00001451 let Inst{27-23} = opcod1;
1452 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001453 let Inst{11-9} = 0b101;
1454 let Inst{8} = 1; // Double precision
Bill Wendlingb70dc872010-08-31 07:50:46 +00001455 let Inst{6} = op6;
1456 let Inst{4} = op4;
Evan Chengac2af2f2008-11-11 02:11:05 +00001457}
1458
1459// Single precision, unary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001460class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1461 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1462 string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001463 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001464 // Instruction operands.
1465 bits<5> Sd;
1466 bits<5> Sm;
1467
1468 // Encode instruction operands.
1469 let Inst{3-0} = Sm{4-1};
1470 let Inst{5} = Sm{0};
1471 let Inst{15-12} = Sd{4-1};
1472 let Inst{22} = Sd{0};
1473
Johnny Chen34a6afc2010-01-29 23:21:10 +00001474 let Inst{27-23} = opcod1;
1475 let Inst{21-20} = opcod2;
1476 let Inst{19-16} = opcod3;
Bill Wendling98c29d72010-10-12 22:03:19 +00001477 let Inst{11-9} = 0b101;
1478 let Inst{8} = 0; // Single precision
Johnny Chen34a6afc2010-01-29 23:21:10 +00001479 let Inst{7-6} = opcod4;
1480 let Inst{4} = opcod5;
Evan Chengac2af2f2008-11-11 02:11:05 +00001481}
1482
Bill Wendlingcbb08ca2010-12-01 02:42:55 +00001483// Single precision unary, if no NEON. Same as ASuI except not available if
1484// NEON is enabled.
Johnny Chen34a6afc2010-01-29 23:21:10 +00001485class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1486 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1487 string asm, list<dag> pattern>
1488 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1489 pattern> {
David Goodwin30bf6252009-08-04 20:39:05 +00001490 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1491}
1492
Evan Chengac2af2f2008-11-11 02:11:05 +00001493// Single precision, binary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001494class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1495 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001496 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001497 // Instruction operands.
1498 bits<5> Sd;
1499 bits<5> Sn;
1500 bits<5> Sm;
1501
1502 // Encode instruction operands.
1503 let Inst{3-0} = Sm{4-1};
1504 let Inst{5} = Sm{0};
1505 let Inst{19-16} = Sn{4-1};
1506 let Inst{7} = Sn{0};
1507 let Inst{15-12} = Sd{4-1};
1508 let Inst{22} = Sd{0};
1509
Johnny Chen34a6afc2010-01-29 23:21:10 +00001510 let Inst{27-23} = opcod1;
1511 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001512 let Inst{11-9} = 0b101;
1513 let Inst{8} = 0; // Single precision
Bill Wendlingb70dc872010-08-31 07:50:46 +00001514 let Inst{6} = op6;
1515 let Inst{4} = op4;
Evan Chengac2af2f2008-11-11 02:11:05 +00001516}
1517
Bill Wendlingcbb08ca2010-12-01 02:42:55 +00001518// Single precision binary, if no NEON. Same as ASbI except not available if
1519// NEON is enabled.
Johnny Chen34a6afc2010-01-29 23:21:10 +00001520class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001521 dag iops, InstrItinClass itin, string opc, string asm,
1522 list<dag> pattern>
Johnny Chen34a6afc2010-01-29 23:21:10 +00001523 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin3b9c52c2009-08-04 17:53:06 +00001524 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling26233432010-11-01 06:00:39 +00001525
1526 // Instruction operands.
1527 bits<5> Sd;
1528 bits<5> Sn;
1529 bits<5> Sm;
1530
1531 // Encode instruction operands.
1532 let Inst{3-0} = Sm{4-1};
1533 let Inst{5} = Sm{0};
1534 let Inst{19-16} = Sn{4-1};
1535 let Inst{7} = Sn{0};
1536 let Inst{15-12} = Sd{4-1};
1537 let Inst{22} = Sd{0};
David Goodwin3b9c52c2009-08-04 17:53:06 +00001538}
1539
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001540// VFP conversion instructions
Johnny Chen34a6afc2010-01-29 23:21:10 +00001541class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1542 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1543 list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001544 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen34a6afc2010-01-29 23:21:10 +00001545 let Inst{27-23} = opcod1;
1546 let Inst{21-20} = opcod2;
1547 let Inst{19-16} = opcod3;
1548 let Inst{11-8} = opcod4;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001549 let Inst{6} = 1;
Johnny Chen34a6afc2010-01-29 23:21:10 +00001550 let Inst{4} = 0;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001551}
1552
Johnny Chen39640592010-02-11 18:47:03 +00001553// VFP conversion between floating-point and fixed-point
1554class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001555 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1556 list<dag> pattern>
Johnny Chen39640592010-02-11 18:47:03 +00001557 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1558 // size (fixed-point number): sx == 0 ? 16 : 32
1559 let Inst{7} = op5; // sx
1560}
1561
David Goodwin85b5b022009-08-10 22:17:39 +00001562// VFP conversion instructions, if no NEON
Johnny Chen34a6afc2010-01-29 23:21:10 +00001563class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin85b5b022009-08-10 22:17:39 +00001564 dag oops, dag iops, InstrItinClass itin,
1565 string opc, string asm, list<dag> pattern>
Johnny Chen34a6afc2010-01-29 23:21:10 +00001566 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1567 pattern> {
David Goodwin85b5b022009-08-10 22:17:39 +00001568 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1569}
1570
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001571class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwinb062c232009-08-06 16:52:47 +00001572 InstrItinClass itin,
1573 string opc, string asm, list<dag> pattern>
1574 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001575 let Inst{27-20} = opcod1;
Evan Cheng38c9a142008-11-11 19:40:26 +00001576 let Inst{11-8} = opcod2;
1577 let Inst{4} = 1;
1578}
1579
David Goodwinb062c232009-08-06 16:52:47 +00001580class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1581 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1582 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng97ccab82008-11-11 22:46:12 +00001583
Bob Wilson3968c6a2010-03-23 17:23:59 +00001584class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001585 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1586 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001587
David Goodwinb062c232009-08-06 16:52:47 +00001588class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1589 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1590 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001591
David Goodwinb062c232009-08-06 16:52:47 +00001592class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1593 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1594 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng38c9a142008-11-11 19:40:26 +00001595
Evan Chengac2af2f2008-11-11 02:11:05 +00001596//===----------------------------------------------------------------------===//
1597
Bob Wilson2e076c42009-06-22 23:27:02 +00001598//===----------------------------------------------------------------------===//
1599// ARM NEON Instruction templates.
1600//
Evan Chengee98fa92008-08-29 06:41:12 +00001601
Johnny Chenf833fad2010-03-20 00:17:00 +00001602class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1603 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1604 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001605 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001606 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001607 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001608 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Cheng738a97a2009-11-23 21:57:23 +00001609 let Pattern = pattern;
1610 list<Predicate> Predicates = [HasNEON];
Owen Andersone0152a72011-08-09 20:55:18 +00001611 let DecoderNamespace = "NEON";
Evan Cheng738a97a2009-11-23 21:57:23 +00001612}
1613
1614// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen020023a2010-03-23 20:40:44 +00001615class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1616 InstrItinClass itin, string opc, string asm, string cstr,
1617 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001618 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001619 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001620 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001621 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson2e076c42009-06-22 23:27:02 +00001622 let Pattern = pattern;
1623 list<Predicate> Predicates = [HasNEON];
Owen Andersone0152a72011-08-09 20:55:18 +00001624 let DecoderNamespace = "NEON";
Evan Chengee98fa92008-08-29 06:41:12 +00001625}
1626
Bob Wilson50820a22009-10-07 21:53:04 +00001627class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1628 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001629 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenf833fad2010-03-20 00:17:00 +00001630 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1631 cstr, pattern> {
Bob Wilsonf731a2d2009-07-08 18:11:30 +00001632 let Inst{31-24} = 0b11110100;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001633 let Inst{23} = op23;
Jim Grosbach68f495c2009-10-20 00:19:08 +00001634 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001635 let Inst{11-8} = op11_8;
1636 let Inst{7-4} = op7_4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001637
Chris Lattner63274cb2010-11-15 05:19:05 +00001638 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Jim Grosbach5876e412010-11-19 22:42:55 +00001639
Owen Andersonad402342010-11-02 00:05:05 +00001640 bits<5> Vd;
Owen Anderson0ebd1fd2010-11-02 23:47:29 +00001641 bits<6> Rn;
1642 bits<4> Rm;
Jim Grosbach5876e412010-11-19 22:42:55 +00001643
Owen Andersonad402342010-11-02 00:05:05 +00001644 let Inst{22} = Vd{4};
1645 let Inst{15-12} = Vd{3-0};
Owen Anderson0ebd1fd2010-11-02 23:47:29 +00001646 let Inst{19-16} = Rn{3-0};
1647 let Inst{3-0} = Rm{3-0};
Bob Wilsonf731a2d2009-07-08 18:11:30 +00001648}
1649
Owen Anderson9f20daf2010-11-02 20:47:39 +00001650class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1651 dag oops, dag iops, InstrItinClass itin,
1652 string opc, string dt, string asm, string cstr, list<dag> pattern>
1653 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1654 dt, asm, cstr, pattern> {
1655 bits<3> lane;
1656}
1657
Bob Wilson9392b0e2010-08-25 23:27:42 +00001658class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson651b2302011-07-13 23:22:26 +00001659 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson9392b0e2010-08-25 23:27:42 +00001660 itin> {
1661 let OutOperandList = oops;
1662 let InOperandList = !con(iops, (ins pred:$p));
1663 list<Predicate> Predicates = [HasNEON];
1664}
1665
Jim Grosbach233b3a22010-10-06 20:36:55 +00001666class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1667 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001668 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonc597fd3b2010-09-13 23:55:10 +00001669 itin> {
1670 let OutOperandList = oops;
1671 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach233b3a22010-10-06 20:36:55 +00001672 let Pattern = pattern;
Bob Wilsonc597fd3b2010-09-13 23:55:10 +00001673 list<Predicate> Predicates = [HasNEON];
1674}
1675
Johnny Chenac5024b2010-03-23 16:43:47 +00001676class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001677 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenac5024b2010-03-23 16:43:47 +00001678 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1679 pattern> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001680 let Inst{31-25} = 0b1111001;
Chris Lattner63274cb2010-11-15 05:19:05 +00001681 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Evan Cheng738a97a2009-11-23 21:57:23 +00001682}
1683
Johnny Chen020023a2010-03-23 20:40:44 +00001684class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001685 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen020023a2010-03-23 20:40:44 +00001686 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001687 cstr, pattern> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001688 let Inst{31-25} = 0b1111001;
Owen Andersonb538a222010-12-10 22:32:08 +00001689 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Bob Wilson2e076c42009-06-22 23:27:02 +00001690}
1691
1692// NEON "one register and a modified immediate" format.
1693class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1694 bit op5, bit op4,
David Goodwinb062c232009-08-06 16:52:47 +00001695 dag oops, dag iops, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001696 string opc, string dt, string asm, string cstr,
1697 list<dag> pattern>
Johnny Chen6a643202010-03-23 23:09:14 +00001698 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001699 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00001700 let Inst{21-19} = op21_19;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001701 let Inst{11-8} = op11_8;
1702 let Inst{7} = op7;
1703 let Inst{6} = op6;
1704 let Inst{5} = op5;
1705 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001706
Owen Anderson284cb362010-10-26 17:40:54 +00001707 // Instruction operands.
1708 bits<5> Vd;
1709 bits<13> SIMM;
Jim Grosbach5876e412010-11-19 22:42:55 +00001710
Owen Anderson284cb362010-10-26 17:40:54 +00001711 let Inst{15-12} = Vd{3-0};
1712 let Inst{22} = Vd{4};
1713 let Inst{24} = SIMM{7};
1714 let Inst{18-16} = SIMM{6-4};
1715 let Inst{3-0} = SIMM{3-0};
Owen Andersone0152a72011-08-09 20:55:18 +00001716 let DecoderMethod = "DecodeNEONModImmInstruction";
Bob Wilson2e076c42009-06-22 23:27:02 +00001717}
1718
1719// NEON 2 vector register format.
1720class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1721 bits<5> op11_7, bit op6, bit op4,
David Goodwinb062c232009-08-06 16:52:47 +00001722 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001723 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen9b1f60a2010-03-24 00:57:50 +00001724 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001725 let Inst{24-23} = op24_23;
1726 let Inst{21-20} = op21_20;
1727 let Inst{19-18} = op19_18;
1728 let Inst{17-16} = op17_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001729 let Inst{11-7} = op11_7;
1730 let Inst{6} = op6;
1731 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001732
Owen Anderson24774462010-10-25 18:43:52 +00001733 // Instruction operands.
1734 bits<5> Vd;
1735 bits<5> Vm;
1736
1737 let Inst{15-12} = Vd{3-0};
1738 let Inst{22} = Vd{4};
1739 let Inst{3-0} = Vm{3-0};
1740 let Inst{5} = Vm{4};
Evan Cheng738a97a2009-11-23 21:57:23 +00001741}
1742
1743// Same as N2V except it doesn't have a datatype suffix.
1744class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001745 bits<5> op11_7, bit op6, bit op4,
1746 dag oops, dag iops, InstrItinClass itin,
1747 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen9b1f60a2010-03-24 00:57:50 +00001748 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001749 let Inst{24-23} = op24_23;
1750 let Inst{21-20} = op21_20;
1751 let Inst{19-18} = op19_18;
1752 let Inst{17-16} = op17_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001753 let Inst{11-7} = op11_7;
1754 let Inst{6} = op6;
1755 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001756
Owen Anderson24774462010-10-25 18:43:52 +00001757 // Instruction operands.
1758 bits<5> Vd;
1759 bits<5> Vm;
1760
1761 let Inst{15-12} = Vd{3-0};
1762 let Inst{22} = Vd{4};
1763 let Inst{3-0} = Vm{3-0};
1764 let Inst{5} = Vm{4};
Bob Wilson2e076c42009-06-22 23:27:02 +00001765}
1766
1767// NEON 2 vector register with immediate.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001768class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chend82f9002010-03-25 20:39:04 +00001769 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001770 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chend82f9002010-03-25 20:39:04 +00001771 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001772 let Inst{24} = op24;
1773 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00001774 let Inst{11-8} = op11_8;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001775 let Inst{7} = op7;
1776 let Inst{6} = op6;
1777 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001778
Owen Anderson3665fee2010-10-26 20:56:57 +00001779 // Instruction operands.
1780 bits<5> Vd;
1781 bits<5> Vm;
1782 bits<6> SIMM;
1783
1784 let Inst{15-12} = Vd{3-0};
1785 let Inst{22} = Vd{4};
1786 let Inst{3-0} = Vm{3-0};
1787 let Inst{5} = Vm{4};
1788 let Inst{21-16} = SIMM{5-0};
Bob Wilson2e076c42009-06-22 23:27:02 +00001789}
1790
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001791// NEON 3 vector register format.
Owen Andersonabda3ca2011-03-30 23:45:29 +00001792
Jim Grosbacheca54e42011-05-19 17:34:53 +00001793class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1794 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1795 string opc, string dt, string asm, string cstr,
1796 list<dag> pattern>
Johnny Chen2cf04952010-03-26 21:26:28 +00001797 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001798 let Inst{24} = op24;
1799 let Inst{23} = op23;
Evan Cheng738a97a2009-11-23 21:57:23 +00001800 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001801 let Inst{11-8} = op11_8;
1802 let Inst{6} = op6;
1803 let Inst{4} = op4;
Owen Andersonabda3ca2011-03-30 23:45:29 +00001804}
1805
1806class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1807 dag oops, dag iops, Format f, InstrItinClass itin,
1808 string opc, string dt, string asm, string cstr, list<dag> pattern>
1809 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1810 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Jim Grosbach5876e412010-11-19 22:42:55 +00001811
Owen Anderson9e44cf22010-10-21 20:21:49 +00001812 // Instruction operands.
1813 bits<5> Vd;
1814 bits<5> Vn;
1815 bits<5> Vm;
1816
1817 let Inst{15-12} = Vd{3-0};
1818 let Inst{22} = Vd{4};
1819 let Inst{19-16} = Vn{3-0};
1820 let Inst{7} = Vn{4};
1821 let Inst{3-0} = Vm{3-0};
1822 let Inst{5} = Vm{4};
Evan Cheng738a97a2009-11-23 21:57:23 +00001823}
1824
Jim Grosbacheca54e42011-05-19 17:34:53 +00001825class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1826 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1827 string opc, string dt, string asm, string cstr,
1828 list<dag> pattern>
Owen Andersonabda3ca2011-03-30 23:45:29 +00001829 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1830 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1831
1832 // Instruction operands.
1833 bits<5> Vd;
1834 bits<5> Vn;
1835 bits<5> Vm;
1836 bit lane;
1837
1838 let Inst{15-12} = Vd{3-0};
1839 let Inst{22} = Vd{4};
1840 let Inst{19-16} = Vn{3-0};
1841 let Inst{7} = Vn{4};
1842 let Inst{3-0} = Vm{3-0};
1843 let Inst{5} = lane;
1844}
1845
Jim Grosbacheca54e42011-05-19 17:34:53 +00001846class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1847 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1848 string opc, string dt, string asm, string cstr,
1849 list<dag> pattern>
Owen Andersonabda3ca2011-03-30 23:45:29 +00001850 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1851 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1852
1853 // Instruction operands.
1854 bits<5> Vd;
1855 bits<5> Vn;
1856 bits<5> Vm;
1857 bits<2> lane;
1858
1859 let Inst{15-12} = Vd{3-0};
1860 let Inst{22} = Vd{4};
1861 let Inst{19-16} = Vn{3-0};
1862 let Inst{7} = Vn{4};
1863 let Inst{2-0} = Vm{2-0};
1864 let Inst{5} = lane{1};
1865 let Inst{3} = lane{0};
1866}
1867
Johnny Chen8a687232010-03-23 21:35:03 +00001868// Same as N3V except it doesn't have a data type suffix.
Bob Wilson3968c6a2010-03-23 17:23:59 +00001869class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1870 bit op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001871 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001872 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001873 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001874 let Inst{24} = op24;
1875 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00001876 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001877 let Inst{11-8} = op11_8;
1878 let Inst{6} = op6;
1879 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001880
Owen Andersondff239c2010-10-25 18:28:30 +00001881 // Instruction operands.
1882 bits<5> Vd;
1883 bits<5> Vn;
1884 bits<5> Vm;
1885
1886 let Inst{15-12} = Vd{3-0};
1887 let Inst{22} = Vd{4};
1888 let Inst{19-16} = Vn{3-0};
1889 let Inst{7} = Vn{4};
1890 let Inst{3-0} = Vm{3-0};
1891 let Inst{5} = Vm{4};
Bob Wilson2e076c42009-06-22 23:27:02 +00001892}
1893
1894// NEON VMOVs between scalar and core registers.
1895class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00001896 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001897 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001898 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001899 "", itin> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001900 let Inst{27-20} = opcod1;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001901 let Inst{11-8} = opcod2;
1902 let Inst{6-5} = opcod3;
1903 let Inst{4} = 1;
Johnny Chen8bca1742011-04-06 18:27:46 +00001904 // A8.6.303, A8.6.328, A8.6.329
1905 let Inst{3-0} = 0b0000;
Evan Cheng738a97a2009-11-23 21:57:23 +00001906
1907 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001908 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001909 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Cheng738a97a2009-11-23 21:57:23 +00001910 let Pattern = pattern;
Bob Wilson2e076c42009-06-22 23:27:02 +00001911 list<Predicate> Predicates = [HasNEON];
Jim Grosbach5876e412010-11-19 22:42:55 +00001912
Chris Lattner63274cb2010-11-15 05:19:05 +00001913 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Jim Grosbach5876e412010-11-19 22:42:55 +00001914
Owen Andersoned9652f2010-10-27 21:28:09 +00001915 bits<5> V;
1916 bits<4> R;
Owen Anderson40d24a42010-10-27 19:25:54 +00001917 bits<4> p;
Owen Andersoned9652f2010-10-27 21:28:09 +00001918 bits<4> lane;
Jim Grosbach5876e412010-11-19 22:42:55 +00001919
Owen Anderson40d24a42010-10-27 19:25:54 +00001920 let Inst{31-28} = p{3-0};
Owen Andersoned9652f2010-10-27 21:28:09 +00001921 let Inst{7} = V{4};
1922 let Inst{19-16} = V{3-0};
1923 let Inst{15-12} = R{3-0};
Bob Wilson2e076c42009-06-22 23:27:02 +00001924}
1925class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00001926 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001927 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00001928 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001929 opc, dt, asm, pattern>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001930class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00001931 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001932 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00001933 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001934 opc, dt, asm, pattern>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001935class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00001936 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001937 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00001938 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001939 opc, dt, asm, pattern>;
David Goodwin3b9c52c2009-08-04 17:53:06 +00001940
Johnny Chen45ab3f32010-03-25 17:01:27 +00001941// Vector Duplicate Lane (from scalar to all elements)
1942class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1943 InstrItinClass itin, string opc, string dt, string asm,
1944 list<dag> pattern>
Johnny Chen91d27742010-03-25 21:49:12 +00001945 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chen45ab3f32010-03-25 17:01:27 +00001946 let Inst{24-23} = 0b11;
1947 let Inst{21-20} = 0b11;
1948 let Inst{19-16} = op19_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001949 let Inst{11-7} = 0b11000;
1950 let Inst{6} = op6;
1951 let Inst{4} = 0;
Jim Grosbach5876e412010-11-19 22:42:55 +00001952
Owen Anderson40d24a42010-10-27 19:25:54 +00001953 bits<5> Vd;
1954 bits<5> Vm;
1955 bits<4> lane;
Jim Grosbach5876e412010-11-19 22:42:55 +00001956
Owen Anderson40d24a42010-10-27 19:25:54 +00001957 let Inst{22} = Vd{4};
1958 let Inst{15-12} = Vd{3-0};
1959 let Inst{5} = Vm{4};
1960 let Inst{3-0} = Vm{3-0};
Johnny Chen45ab3f32010-03-25 17:01:27 +00001961}
1962
David Goodwin3b9c52c2009-08-04 17:53:06 +00001963// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1964// for single-precision FP.
1965class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1966 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1967}