blob: 769fecf6d876c37c79c72d873581573c4ceb07a7 [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;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000155}
156
157// Conditional code result for instructions whose 's' bit is set, e.g. subs.
Jim Grosbacheeaab222011-07-25 20:38:18 +0000158def CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
Evan Chengcd4cdd12009-07-11 06:43:01 +0000159def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Chris Lattner63274cb2010-11-15 05:19:05 +0000160 let EncoderMethod = "getCCOutOpValue";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000161 let PrintMethod = "printSBitModifierOperand";
Jim Grosbach0bfb4d52010-12-06 18:21:12 +0000162 let ParserMatchClass = CCOutOperand;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000163}
164
165// Same as cc_out except it defaults to setting CPSR.
166def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Chris Lattner63274cb2010-11-15 05:19:05 +0000167 let EncoderMethod = "getCCOutOpValue";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000168 let PrintMethod = "printSBitModifierOperand";
Jim Grosbach0bfb4d52010-12-06 18:21:12 +0000169 let ParserMatchClass = CCOutOperand;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000170}
171
Johnny Chen9a3e2392010-03-10 18:59:38 +0000172// ARM special operands for disassembly only.
173//
Jim Grosbach0a547702011-07-22 17:44:50 +0000174def SetEndAsmOperand : AsmOperandClass {
175 let Name = "SetEndImm";
176 let ParserMethod = "parseSetEndImm";
177}
Jim Grosbach7e72ec62010-10-13 21:00:04 +0000178def setend_op : Operand<i32> {
179 let PrintMethod = "printSetendOperand";
Jim Grosbach0a547702011-07-22 17:44:50 +0000180 let ParserMatchClass = SetEndAsmOperand;
Jim Grosbach7e72ec62010-10-13 21:00:04 +0000181}
Johnny Chen9a3e2392010-03-10 18:59:38 +0000182
Jim Grosbacheeaab222011-07-25 20:38:18 +0000183def MSRMaskOperand : AsmOperandClass {
184 let Name = "MSRMask";
185 let ParserMethod = "parseMSRMaskOperand";
186}
Johnny Chen9a3e2392010-03-10 18:59:38 +0000187def msr_mask : Operand<i32> {
188 let PrintMethod = "printMSRMaskOperand";
Bruno Cardoso Lopes9cd43972011-02-18 19:45:59 +0000189 let ParserMatchClass = MSRMaskOperand;
Johnny Chen9a3e2392010-03-10 18:59:38 +0000190}
191
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000192// Shift Right Immediate - A shift right immediate is encoded differently from
193// other shift immediates. The imm6 field is encoded like so:
Bill Wendling3b1459b2011-03-01 01:00:59 +0000194//
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000195// Offset Encoding
196// 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
197// 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
198// 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
199// 64 64 - <imm> is encoded in imm6<5:0>
200def shr_imm8 : Operand<i32> {
201 let EncoderMethod = "getShiftRight8Imm";
Bill Wendling3b1459b2011-03-01 01:00:59 +0000202}
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000203def shr_imm16 : Operand<i32> {
204 let EncoderMethod = "getShiftRight16Imm";
Bill Wendling3b1459b2011-03-01 01:00:59 +0000205}
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000206def shr_imm32 : Operand<i32> {
207 let EncoderMethod = "getShiftRight32Imm";
208}
209def shr_imm64 : Operand<i32> {
210 let EncoderMethod = "getShiftRight64Imm";
Bill Wendling3b1459b2011-03-01 01:00:59 +0000211}
212
Evan Chengcd4cdd12009-07-11 06:43:01 +0000213//===----------------------------------------------------------------------===//
Evan Cheng2d37f192008-08-28 23:39:26 +0000214// ARM Instruction templates.
215//
216
Owen Anderson651b2302011-07-13 23:22:26 +0000217class InstTemplate<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000218 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng2d37f192008-08-28 23:39:26 +0000219 : Instruction {
220 let Namespace = "ARM";
221
Evan Cheng2d37f192008-08-28 23:39:26 +0000222 AddrMode AM = am;
Owen Anderson651b2302011-07-13 23:22:26 +0000223 int Size = sz;
Evan Cheng2d37f192008-08-28 23:39:26 +0000224 IndexMode IM = im;
225 bits<2> IndexModeBits = IM.Value;
Evan Cheng2d37f192008-08-28 23:39:26 +0000226 Format F = f;
Bob Wilson69ba1bc2010-03-17 21:13:43 +0000227 bits<6> Form = F.Value;
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000228 Domain D = d;
Evan Cheng81889d012008-11-05 18:35:52 +0000229 bit isUnaryDataProc = 0;
Evan Cheng14965762009-07-08 01:46:35 +0000230 bit canXformTo16Bit = 0;
Jim Grosbach5876e412010-11-19 22:42:55 +0000231
Chris Lattner7ff33462010-10-31 19:22:57 +0000232 // If this is a pseudo instruction, mark it isCodeGenOnly.
233 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson3968c6a2010-03-23 17:23:59 +0000234
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000235 // The layout of TSFlags should be kept in sync with ARMBaseInstrInfo.h.
Jim Grosbache9298992010-10-05 18:14:55 +0000236 let TSFlags{4-0} = AM.Value;
Owen Anderson651b2302011-07-13 23:22:26 +0000237 let TSFlags{6-5} = IndexModeBits;
238 let TSFlags{12-7} = Form;
239 let TSFlags{13} = isUnaryDataProc;
240 let TSFlags{14} = canXformTo16Bit;
241 let TSFlags{17-15} = D.Value;
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000242
Evan Cheng2d37f192008-08-28 23:39:26 +0000243 let Constraints = cstr;
David Goodwinb062c232009-08-06 16:52:47 +0000244 let Itinerary = itin;
Evan Cheng2d37f192008-08-28 23:39:26 +0000245}
246
Johnny Chenc28e6292009-12-15 17:24:14 +0000247class Encoding {
248 field bits<32> Inst;
249}
250
Owen Anderson651b2302011-07-13 23:22:26 +0000251class InstARM<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000252 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonc78e03c2011-07-19 21:06:00 +0000253 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
254 let DecoderNamespace = "ARM";
255}
Johnny Chenc28e6292009-12-15 17:24:14 +0000256
257// This Encoding-less class is used by Thumb1 to specify the encoding bits later
258// on by adding flavors to specific instructions.
Owen Anderson651b2302011-07-13 23:22:26 +0000259class InstThumb<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000260 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonc78e03c2011-07-19 21:06:00 +0000261 : InstTemplate<am, sz, im, f, d, cstr, itin> {
262 let DecoderNamespace = "Thumb";
263}
Johnny Chenc28e6292009-12-15 17:24:14 +0000264
Jim Grosbacha74c7ccd2010-11-18 01:38:26 +0000265class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000266 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
Jim Grosbach7c301ea2011-07-06 21:35:46 +0000267 GenericDomain, "", itin> {
Evan Cheng2d37f192008-08-28 23:39:26 +0000268 let OutOperandList = oops;
269 let InOperandList = iops;
Evan Cheng2d37f192008-08-28 23:39:26 +0000270 let Pattern = pattern;
Jim Grosbache1756822011-03-10 19:06:39 +0000271 let isCodeGenOnly = 1;
Jim Grosbach7c301ea2011-07-06 21:35:46 +0000272 let isPseudo = 1;
Evan Cheng2d37f192008-08-28 23:39:26 +0000273}
274
Jim Grosbachcfb66202010-11-18 01:15:56 +0000275// PseudoInst that's ARM-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000276class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbacha74c7ccd2010-11-18 01:38:26 +0000277 list<dag> pattern>
278 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000279 let Size = sz;
Jim Grosbachcfb66202010-11-18 01:15:56 +0000280 list<Predicate> Predicates = [IsARM];
281}
282
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000283// PseudoInst that's Thumb-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000284class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000285 list<dag> pattern>
286 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000287 let Size = sz;
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000288 list<Predicate> Predicates = [IsThumb];
289}
Jim Grosbachcfb66202010-11-18 01:15:56 +0000290
Jim Grosbachd42257c2010-12-15 18:48:45 +0000291// PseudoInst that's Thumb2-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000292class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbachd42257c2010-12-15 18:48:45 +0000293 list<dag> pattern>
294 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000295 let Size = sz;
Jim Grosbachd42257c2010-12-15 18:48:45 +0000296 list<Predicate> Predicates = [IsThumb2];
297}
Jim Grosbach95dee402011-07-08 17:40:42 +0000298
Owen Anderson651b2302011-07-13 23:22:26 +0000299class ARMPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000300 InstrItinClass itin, list<dag> pattern,
301 dag Result>
302 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
303 PseudoInstExpansion<Result>;
304
Owen Anderson651b2302011-07-13 23:22:26 +0000305class tPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000306 InstrItinClass itin, list<dag> pattern,
307 dag Result>
308 : tPseudoInst<oops, iops, sz, itin, pattern>,
309 PseudoInstExpansion<Result>;
310
Owen Anderson651b2302011-07-13 23:22:26 +0000311class t2PseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000312 InstrItinClass itin, list<dag> pattern,
313 dag Result>
314 : t2PseudoInst<oops, iops, sz, itin, pattern>,
315 PseudoInstExpansion<Result>;
316
Evan Cheng2d37f192008-08-28 23:39:26 +0000317// Almost all ARM instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +0000318class I<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000319 IndexMode im, Format f, InstrItinClass itin,
David Goodwinb062c232009-08-06 16:52:47 +0000320 string opc, string asm, string cstr,
Evan Cheng2d37f192008-08-28 23:39:26 +0000321 list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000322 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach5476a272010-10-11 18:51:51 +0000323 bits<4> p;
324 let Inst{31-28} = p;
Evan Cheng2d37f192008-08-28 23:39:26 +0000325 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000326 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +0000327 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng2d37f192008-08-28 23:39:26 +0000328 let Pattern = pattern;
329 list<Predicate> Predicates = [IsARM];
330}
Bill Wendlingb70dc872010-08-31 07:50:46 +0000331
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000332// A few are not predicable
Owen Anderson651b2302011-07-13 23:22:26 +0000333class InoP<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000334 IndexMode im, Format f, InstrItinClass itin,
335 string opc, string asm, string cstr,
336 list<dag> pattern>
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000337 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
338 let OutOperandList = oops;
339 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000340 let AsmString = !strconcat(opc, asm);
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000341 let Pattern = pattern;
342 let isPredicable = 0;
343 list<Predicate> Predicates = [IsARM];
344}
Evan Cheng2d37f192008-08-28 23:39:26 +0000345
Bill Wendlingf8dfa462010-08-30 01:47:35 +0000346// Same as I except it can optionally modify CPSR. Note it's modeled as an input
347// operand since by default it's a zero register. It will become an implicit def
348// once it's "flipped".
Owen Anderson651b2302011-07-13 23:22:26 +0000349class sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000350 IndexMode im, Format f, InstrItinClass itin,
351 string opc, string asm, string cstr,
Evan Cheng2d37f192008-08-28 23:39:26 +0000352 list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000353 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach5476a272010-10-11 18:51:51 +0000354 bits<4> p; // Predicate operand
Jim Grosbachd9d31da2010-10-12 23:00:24 +0000355 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach5476a272010-10-11 18:51:51 +0000356 let Inst{31-28} = p;
Jim Grosbachd9d31da2010-10-12 23:00:24 +0000357 let Inst{20} = s;
Jim Grosbach5476a272010-10-11 18:51:51 +0000358
Evan Cheng2d37f192008-08-28 23:39:26 +0000359 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000360 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilson59351842010-10-15 03:23:44 +0000361 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng2d37f192008-08-28 23:39:26 +0000362 let Pattern = pattern;
363 list<Predicate> Predicates = [IsARM];
364}
365
Evan Chenga2827232008-09-01 07:19:00 +0000366// Special cases
Owen Anderson651b2302011-07-13 23:22:26 +0000367class XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000368 IndexMode im, Format f, InstrItinClass itin,
369 string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000370 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Chenga2827232008-09-01 07:19:00 +0000371 let OutOperandList = oops;
372 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000373 let AsmString = asm;
Evan Chenga2827232008-09-01 07:19:00 +0000374 let Pattern = pattern;
375 list<Predicate> Predicates = [IsARM];
376}
377
David Goodwinb062c232009-08-06 16:52:47 +0000378class AI<dag oops, dag iops, Format f, InstrItinClass itin,
379 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000380 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000381 opc, asm, "", pattern>;
382class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
383 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000384 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000385 opc, asm, "", pattern>;
386class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng2d37f192008-08-28 23:39:26 +0000387 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000388 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Evan Cheng49d66522008-11-06 22:15:19 +0000389 asm, "", pattern>;
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000390class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000391 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000392 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000393 opc, asm, "", pattern>;
Evan Chengfa558782008-09-01 08:25:56 +0000394
395// Ctrl flow instructions
David Goodwinb062c232009-08-06 16:52:47 +0000396class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
397 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000398 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000399 opc, asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000400 let Inst{27-24} = opcod;
Evan Chengfa558782008-09-01 08:25:56 +0000401}
David Goodwinb062c232009-08-06 16:52:47 +0000402class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
403 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000404 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000405 asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000406 let Inst{27-24} = opcod;
Evan Chengfa558782008-09-01 08:25:56 +0000407}
Evan Chengfa558782008-09-01 08:25:56 +0000408
409// BR_JT instructions
David Goodwinb062c232009-08-06 16:52:47 +0000410class JTI<dag oops, dag iops, InstrItinClass itin,
411 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000412 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
Evan Cheng7095cd22008-11-07 09:06:08 +0000413 asm, "", pattern>;
Evan Cheng624844b2008-09-01 01:51:14 +0000414
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000415// Atomic load/store instructions
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000416class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
417 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000418 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000419 opc, asm, "", pattern> {
Jim Grosbach4e57b522010-10-29 19:58:57 +0000420 bits<4> Rt;
Jim Grosbachcb311932011-07-26 17:44:46 +0000421 bits<4> addr;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000422 let Inst{27-23} = 0b00011;
423 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000424 let Inst{20} = 1;
Jim Grosbachcb311932011-07-26 17:44:46 +0000425 let Inst{19-16} = addr;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000426 let Inst{15-12} = Rt;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000427 let Inst{11-0} = 0b111110011111;
428}
429class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
430 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000431 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000432 opc, asm, "", pattern> {
Jim Grosbach4e57b522010-10-29 19:58:57 +0000433 bits<4> Rd;
434 bits<4> Rt;
Bruno Cardoso Lopesf170f8b2011-03-24 21:04:58 +0000435 bits<4> addr;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000436 let Inst{27-23} = 0b00011;
437 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000438 let Inst{20} = 0;
Bruno Cardoso Lopesf170f8b2011-03-24 21:04:58 +0000439 let Inst{19-16} = addr;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000440 let Inst{15-12} = Rd;
Johnny Chen098bd1b2009-12-11 19:37:26 +0000441 let Inst{11-4} = 0b11111001;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000442 let Inst{3-0} = Rt;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000443}
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000444class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
Jim Grosbach15e8d742011-07-26 17:15:11 +0000445 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000446 bits<4> Rt;
447 bits<4> Rt2;
Jim Grosbach15e8d742011-07-26 17:15:11 +0000448 bits<4> addr;
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000449 let Inst{27-23} = 0b00010;
450 let Inst{22} = b;
451 let Inst{21-20} = 0b00;
Jim Grosbach15e8d742011-07-26 17:15:11 +0000452 let Inst{19-16} = addr;
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000453 let Inst{15-12} = Rt;
454 let Inst{11-4} = 0b00001001;
455 let Inst{3-0} = Rt2;
456}
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000457
Evan Cheng624844b2008-09-01 01:51:14 +0000458// addrmode1 instructions
David Goodwinb062c232009-08-06 16:52:47 +0000459class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
460 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000461 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000462 opc, asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000463 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000464 let Inst{27-26} = 0b00;
Evan Chengc139c222008-08-29 07:40:52 +0000465}
David Goodwinb062c232009-08-06 16:52:47 +0000466class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
467 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000468 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000469 opc, asm, "", pattern> {
470 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000471 let Inst{27-26} = 0b00;
David Goodwinb062c232009-08-06 16:52:47 +0000472}
473class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng2d37f192008-08-28 23:39:26 +0000474 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000475 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
Evan Chengc139c222008-08-29 07:40:52 +0000476 asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000477 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000478 let Inst{27-26} = 0b00;
Evan Chengc139c222008-08-29 07:40:52 +0000479}
Evan Cheng624844b2008-09-01 01:51:14 +0000480
Evan Chengcccca872008-09-01 01:27:33 +0000481// loads
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000482
Jim Grosbach4a22eba2010-11-19 21:07:51 +0000483// LDR/LDRB/STR/STRB/...
484class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach338de3e2010-10-27 23:12:14 +0000485 Format f, InstrItinClass itin, string opc, string asm,
486 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000487 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000488 "", pattern> {
489 let Inst{27-25} = op;
490 let Inst{24} = 1; // 24 == P
491 // 23 == U
Jim Grosbach2f790742010-11-13 00:35:48 +0000492 let Inst{22} = isByte;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000493 let Inst{21} = 0; // 21 == W
Jim Grosbach338de3e2010-10-27 23:12:14 +0000494 let Inst{20} = isLd;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000495}
Jim Grosbach2f790742010-11-13 00:35:48 +0000496// Indexed load/stores
497class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000498 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach2f790742010-11-13 00:35:48 +0000499 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000500 : I<oops, iops, AddrMode2, 4, im, f, itin,
Jim Grosbach2f790742010-11-13 00:35:48 +0000501 opc, asm, cstr, pattern> {
Jim Grosbach38b469e2010-11-15 20:47:07 +0000502 bits<4> Rt;
Jim Grosbach2f790742010-11-13 00:35:48 +0000503 let Inst{27-26} = 0b01;
504 let Inst{24} = isPre; // P bit
505 let Inst{22} = isByte; // B bit
506 let Inst{21} = isPre; // W bit
507 let Inst{20} = isLd; // L bit
Jim Grosbach38b469e2010-11-15 20:47:07 +0000508 let Inst{15-12} = Rt;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000509}
Owen Anderson2aedba62011-07-26 20:54:26 +0000510class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000511 IndexMode im, Format f, InstrItinClass itin, string opc,
512 string asm, string cstr, list<dag> pattern>
513 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
514 pattern> {
515 // AM2 store w/ two operands: (GPR, am2offset)
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000516 // {12} isAdd
517 // {11-0} imm12/Rm
Bruno Cardoso Lopesc2452a62011-03-31 15:54:36 +0000518 bits<14> offset;
519 bits<4> Rn;
Owen Anderson2aedba62011-07-26 20:54:26 +0000520 let Inst{25} = 1;
521 let Inst{23} = offset{12};
522 let Inst{19-16} = Rn;
523 let Inst{11-5} = offset{11-5};
524 let Inst{4} = 0;
525 let Inst{3-0} = offset{3-0};
526}
527
528class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
529 IndexMode im, Format f, InstrItinClass itin, string opc,
530 string asm, string cstr, list<dag> pattern>
531 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
532 pattern> {
533 // AM2 store w/ two operands: (GPR, am2offset)
534 // {12} isAdd
535 // {11-0} imm12/Rm
536 bits<14> offset;
537 bits<4> Rn;
538 let Inst{25} = 0;
Bruno Cardoso Lopesc2452a62011-03-31 15:54:36 +0000539 let Inst{23} = offset{12};
540 let Inst{19-16} = Rn;
541 let Inst{11-0} = offset{11-0};
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000542}
Owen Anderson2aedba62011-07-26 20:54:26 +0000543
544
Bruno Cardoso Lopesab830502011-03-31 23:26:08 +0000545// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
546// but for now use this class for STRT and STRBT.
547class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
548 IndexMode im, Format f, InstrItinClass itin, string opc,
549 string asm, string cstr, list<dag> pattern>
550 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
551 pattern> {
552 // AM2 store w/ two operands: (GPR, am2offset)
553 // {17-14} Rn
554 // {13} 1 == Rm, 0 == imm12
555 // {12} isAdd
556 // {11-0} imm12/Rm
557 bits<18> addr;
558 let Inst{25} = addr{13};
559 let Inst{23} = addr{12};
560 let Inst{19-16} = addr{17-14};
561 let Inst{11-0} = addr{11-0};
562}
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000563
Evan Cheng624844b2008-09-01 01:51:14 +0000564// addrmode3 instructions
Jim Grosbach76aed402010-11-19 18:16:46 +0000565class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
566 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000567 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach8e7f8df2010-11-18 00:46:58 +0000568 opc, asm, "", pattern> {
569 bits<14> addr;
570 bits<4> Rt;
571 let Inst{27-25} = 0b000;
572 let Inst{24} = 1; // P bit
573 let Inst{23} = addr{8}; // U bit
574 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
575 let Inst{21} = 0; // W bit
Jim Grosbach76aed402010-11-19 18:16:46 +0000576 let Inst{20} = op20; // L bit
Jim Grosbach8e7f8df2010-11-18 00:46:58 +0000577 let Inst{19-16} = addr{12-9}; // Rn
578 let Inst{15-12} = Rt; // Rt
579 let Inst{11-8} = addr{7-4}; // imm7_4/zero
580 let Inst{7-4} = op;
581 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
582}
Evan Cheng169eccc2008-09-01 07:00:14 +0000583
Jim Grosbach003c6e72010-11-19 19:41:26 +0000584class AI3ldstidx<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
585 IndexMode im, Format f, InstrItinClass itin, string opc,
586 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000587 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach003c6e72010-11-19 19:41:26 +0000588 opc, asm, cstr, pattern> {
589 bits<4> Rt;
590 let Inst{27-25} = 0b000;
591 let Inst{24} = isPre; // P bit
592 let Inst{21} = isPre; // W bit
593 let Inst{20} = op20; // L bit
594 let Inst{15-12} = Rt; // Rt
595 let Inst{7-4} = op;
596}
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000597
598// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
599// but for now use this class for LDRSBT, LDRHT, LDSHT.
600class AI3ldstidxT<bits<4> op, bit op20, bit isLd, bit isPre, dag oops, dag iops,
601 IndexMode im, Format f, InstrItinClass itin, string opc,
602 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000603 : I<oops, iops, AddrMode3, 4, im, f, itin,
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000604 opc, asm, cstr, pattern> {
605 // {13} 1 == imm8, 0 == Rm
606 // {12-9} Rn
607 // {8} isAdd
608 // {7-4} imm7_4/zero
609 // {3-0} imm3_0/Rm
610 bits<14> addr;
611 bits<4> Rt;
612 let Inst{27-25} = 0b000;
613 let Inst{24} = isPre; // P bit
614 let Inst{23} = addr{8}; // U bit
615 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
616 let Inst{20} = op20; // L bit
617 let Inst{19-16} = addr{12-9}; // Rn
618 let Inst{15-12} = Rt; // Rt
619 let Inst{11-8} = addr{7-4}; // imm7_4/zero
620 let Inst{7-4} = op;
621 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Jim Grosbacheab1c0d2011-07-26 17:10:22 +0000622 let AsmMatchConverter = "cvtLdWriteBackRegAddrMode3";
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000623}
624
Jim Grosbach150b1ad2010-11-29 18:37:44 +0000625class AI3stridx<bits<4> op, bit isByte, bit isPre, dag oops, dag iops,
626 IndexMode im, Format f, InstrItinClass itin, string opc,
627 string asm, string cstr, list<dag> pattern>
628 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
629 pattern> {
630 // AM3 store w/ two operands: (GPR, am3offset)
631 bits<14> offset;
632 bits<4> Rt;
633 bits<4> Rn;
634 let Inst{27-25} = 0b000;
635 let Inst{23} = offset{8};
636 let Inst{22} = offset{9};
637 let Inst{19-16} = Rn;
638 let Inst{15-12} = Rt; // Rt
639 let Inst{11-8} = offset{7-4}; // imm7_4/zero
640 let Inst{7-4} = op;
641 let Inst{3-0} = offset{3-0}; // imm3_0/Rm
642}
Jim Grosbach003c6e72010-11-19 19:41:26 +0000643
Evan Cheng169eccc2008-09-01 07:00:14 +0000644// stores
Jim Grosbach09d7bfd2010-11-19 22:14:31 +0000645class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwinb062c232009-08-06 16:52:47 +0000646 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000647 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000648 opc, asm, "", pattern> {
Jim Grosbach607efcb2010-11-11 01:09:40 +0000649 bits<14> addr;
650 bits<4> Rt;
Evan Cheng5edd90c2009-07-08 22:51:32 +0000651 let Inst{27-25} = 0b000;
Jim Grosbach607efcb2010-11-11 01:09:40 +0000652 let Inst{24} = 1; // P bit
653 let Inst{23} = addr{8}; // U bit
654 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
655 let Inst{21} = 0; // W bit
656 let Inst{20} = 0; // L bit
657 let Inst{19-16} = addr{12-9}; // Rn
658 let Inst{15-12} = Rt; // Rt
659 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach09d7bfd2010-11-19 22:14:31 +0000660 let Inst{7-4} = op;
Jim Grosbach607efcb2010-11-11 01:09:40 +0000661 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng169eccc2008-09-01 07:00:14 +0000662}
Evan Cheng169eccc2008-09-01 07:00:14 +0000663
Evan Cheng169eccc2008-09-01 07:00:14 +0000664// Pre-indexed stores
David Goodwinb062c232009-08-06 16:52:47 +0000665class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
666 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000667 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000668 opc, asm, cstr, pattern> {
Evan Cheng169eccc2008-09-01 07:00:14 +0000669 let Inst{4} = 1;
670 let Inst{5} = 1; // H bit
671 let Inst{6} = 0; // S bit
672 let Inst{7} = 1;
673 let Inst{20} = 0; // L bit
674 let Inst{21} = 1; // W bit
675 let Inst{24} = 1; // P bit
Evan Cheng5edd90c2009-07-08 22:51:32 +0000676 let Inst{27-25} = 0b000;
Evan Cheng169eccc2008-09-01 07:00:14 +0000677}
Johnny Chen688a90e2010-02-18 22:31:18 +0000678class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
679 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000680 : I<oops, iops, AddrMode3, 4, IndexModePre, f, itin,
Johnny Chen688a90e2010-02-18 22:31:18 +0000681 opc, asm, cstr, pattern> {
682 let Inst{4} = 1;
683 let Inst{5} = 1; // H bit
684 let Inst{6} = 1; // S bit
685 let Inst{7} = 1;
686 let Inst{20} = 0; // L bit
687 let Inst{21} = 1; // W bit
688 let Inst{24} = 1; // P bit
689 let Inst{27-25} = 0b000;
690}
Evan Cheng169eccc2008-09-01 07:00:14 +0000691
Evan Cheng169eccc2008-09-01 07:00:14 +0000692// Post-indexed stores
David Goodwinb062c232009-08-06 16:52:47 +0000693class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
694 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000695 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000696 opc, asm, cstr,pattern> {
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000697 // {13} 1 == imm8, 0 == Rm
698 // {12-9} Rn
699 // {8} isAdd
700 // {7-4} imm7_4/zero
701 // {3-0} imm3_0/Rm
702 bits<14> addr;
703 bits<4> Rt;
704 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Evan Cheng169eccc2008-09-01 07:00:14 +0000705 let Inst{4} = 1;
706 let Inst{5} = 1; // H bit
707 let Inst{6} = 0; // S bit
708 let Inst{7} = 1;
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000709 let Inst{11-8} = addr{7-4}; // imm7_4/zero
710 let Inst{15-12} = Rt; // Rt
711 let Inst{19-16} = addr{12-9}; // Rn
Evan Cheng169eccc2008-09-01 07:00:14 +0000712 let Inst{20} = 0; // L bit
Johnny Chen718ed8a2010-03-01 19:22:00 +0000713 let Inst{21} = 0; // W bit
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000714 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
715 let Inst{23} = addr{8}; // U bit
Evan Cheng169eccc2008-09-01 07:00:14 +0000716 let Inst{24} = 0; // P bit
Evan Cheng5edd90c2009-07-08 22:51:32 +0000717 let Inst{27-25} = 0b000;
Evan Cheng169eccc2008-09-01 07:00:14 +0000718}
Johnny Chen688a90e2010-02-18 22:31:18 +0000719class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
720 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000721 : I<oops, iops, AddrMode3, 4, IndexModePost, f, itin,
Johnny Chen688a90e2010-02-18 22:31:18 +0000722 opc, asm, cstr, pattern> {
723 let Inst{4} = 1;
724 let Inst{5} = 1; // H bit
725 let Inst{6} = 1; // S bit
726 let Inst{7} = 1;
727 let Inst{20} = 0; // L bit
728 let Inst{21} = 0; // W bit
729 let Inst{24} = 0; // P bit
730 let Inst{27-25} = 0b000;
731}
Evan Cheng169eccc2008-09-01 07:00:14 +0000732
Evan Cheng624844b2008-09-01 01:51:14 +0000733// addrmode4 instructions
Bill Wendlinge69afc62010-11-13 09:09:38 +0000734class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
735 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000736 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendlinge69afc62010-11-13 09:09:38 +0000737 bits<4> p;
738 bits<16> regs;
739 bits<4> Rn;
740 let Inst{31-28} = p;
741 let Inst{27-25} = 0b100;
742 let Inst{22} = 0; // S bit
743 let Inst{19-16} = Rn;
744 let Inst{15-0} = regs;
745}
Evan Cheng2d37f192008-08-28 23:39:26 +0000746
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000747// Unsigned multiply, multiply-accumulate instructions.
David Goodwinb062c232009-08-06 16:52:47 +0000748class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
749 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000750 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000751 opc, asm, "", pattern> {
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000752 let Inst{7-4} = 0b1001;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000753 let Inst{20} = 0; // S bit
Evan Cheng47b546d2008-11-06 08:47:38 +0000754 let Inst{27-21} = opcod;
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000755}
David Goodwinb062c232009-08-06 16:52:47 +0000756class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
757 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000758 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000759 opc, asm, "", pattern> {
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000760 let Inst{7-4} = 0b1001;
Evan Cheng47b546d2008-11-06 08:47:38 +0000761 let Inst{27-21} = opcod;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000762}
763
764// Most significant word multiply
Jim Grosbach22261602010-10-22 17:16:17 +0000765class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
766 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000767 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000768 opc, asm, "", pattern> {
Jim Grosbach22261602010-10-22 17:16:17 +0000769 bits<4> Rd;
770 bits<4> Rn;
771 bits<4> Rm;
772 let Inst{7-4} = opc7_4;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000773 let Inst{20} = 1;
Evan Cheng47b546d2008-11-06 08:47:38 +0000774 let Inst{27-21} = opcod;
Jim Grosbach22261602010-10-22 17:16:17 +0000775 let Inst{19-16} = Rd;
776 let Inst{11-8} = Rm;
777 let Inst{3-0} = Rn;
778}
779// MSW multiple w/ Ra operand
780class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
781 InstrItinClass itin, string opc, string asm, list<dag> pattern>
782 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
783 bits<4> Ra;
784 let Inst{15-12} = Ra;
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000785}
Evan Cheng2d37f192008-08-28 23:39:26 +0000786
Evan Cheng36ae4032008-11-06 03:35:07 +0000787// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach6956a602010-10-22 18:35:16 +0000788class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbachf98df082010-10-22 17:42:06 +0000789 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000790 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000791 opc, asm, "", pattern> {
Jim Grosbach6956a602010-10-22 18:35:16 +0000792 bits<4> Rn;
793 bits<4> Rm;
Evan Cheng36ae4032008-11-06 03:35:07 +0000794 let Inst{4} = 0;
795 let Inst{7} = 1;
796 let Inst{20} = 0;
Evan Cheng47b546d2008-11-06 08:47:38 +0000797 let Inst{27-21} = opcod;
Jim Grosbachf98df082010-10-22 17:42:06 +0000798 let Inst{6-5} = bit6_5;
Jim Grosbach6956a602010-10-22 18:35:16 +0000799 let Inst{11-8} = Rm;
800 let Inst{3-0} = Rn;
801}
802class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
803 InstrItinClass itin, string opc, string asm, list<dag> pattern>
804 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
805 bits<4> Rd;
806 let Inst{19-16} = Rd;
807}
808
809// AMulxyI with Ra operand
810class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
811 InstrItinClass itin, string opc, string asm, list<dag> pattern>
812 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
813 bits<4> Ra;
814 let Inst{15-12} = Ra;
815}
816// SMLAL*
817class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
818 InstrItinClass itin, string opc, string asm, list<dag> pattern>
819 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
820 bits<4> RdLo;
821 bits<4> RdHi;
822 let Inst{19-16} = RdHi;
823 let Inst{15-12} = RdLo;
Evan Cheng36ae4032008-11-06 03:35:07 +0000824}
825
Evan Cheng49d66522008-11-06 22:15:19 +0000826// Extend instructions.
David Goodwinb062c232009-08-06 16:52:47 +0000827class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
828 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000829 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000830 opc, asm, "", pattern> {
Jim Grosbach1e7db682010-10-13 19:56:10 +0000831 // All AExtI instructions have Rd and Rm register operands.
832 bits<4> Rd;
833 bits<4> Rm;
834 let Inst{15-12} = Rd;
835 let Inst{3-0} = Rm;
Evan Cheng49d66522008-11-06 22:15:19 +0000836 let Inst{7-4} = 0b0111;
Jim Grosbach1e7db682010-10-13 19:56:10 +0000837 let Inst{9-8} = 0b00;
Evan Cheng49d66522008-11-06 22:15:19 +0000838 let Inst{27-20} = opcod;
839}
840
Evan Cheng98dc53e2008-11-07 01:41:35 +0000841// Misc Arithmetic instructions.
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000842class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
843 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000844 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000845 opc, asm, "", pattern> {
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000846 bits<4> Rd;
847 bits<4> Rm;
Evan Cheng98dc53e2008-11-07 01:41:35 +0000848 let Inst{27-20} = opcod;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000849 let Inst{19-16} = 0b1111;
850 let Inst{15-12} = Rd;
851 let Inst{11-8} = 0b1111;
852 let Inst{7-4} = opc7_4;
853 let Inst{3-0} = Rm;
854}
855
856// PKH instructions
Jim Grosbach27c1e252011-07-21 17:23:04 +0000857def PKHLSLAsmOperand : AsmOperandClass {
858 let Name = "PKHLSLImm";
859 let ParserMethod = "parsePKHLSLImm";
860}
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000861def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
862 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbach27c1e252011-07-21 17:23:04 +0000863 let ParserMatchClass = PKHLSLAsmOperand;
864}
865def PKHASRAsmOperand : AsmOperandClass {
866 let Name = "PKHASRImm";
867 let ParserMethod = "parsePKHASRImm";
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000868}
869def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
870 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbach27c1e252011-07-21 17:23:04 +0000871 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000872}
Jim Grosbach94df3be2011-07-20 20:49:03 +0000873
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000874class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
875 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000876 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000877 opc, asm, "", pattern> {
878 bits<4> Rd;
879 bits<4> Rn;
880 bits<4> Rm;
Jim Grosbacha98f8002011-07-20 20:32:09 +0000881 bits<5> sh;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000882 let Inst{27-20} = opcod;
883 let Inst{19-16} = Rn;
884 let Inst{15-12} = Rd;
Jim Grosbacha98f8002011-07-20 20:32:09 +0000885 let Inst{11-7} = sh;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000886 let Inst{6} = tb;
887 let Inst{5-4} = 0b01;
888 let Inst{3-0} = Rm;
Evan Cheng98dc53e2008-11-07 01:41:35 +0000889}
890
Evan Cheng2d37f192008-08-28 23:39:26 +0000891//===----------------------------------------------------------------------===//
892
893// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
894class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
895 list<Predicate> Predicates = [IsARM];
896}
Bruno Cardoso Lopes168c9002011-05-03 17:29:22 +0000897class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
898 list<Predicate> Predicates = [IsARM, HasV5T];
899}
Evan Cheng2d37f192008-08-28 23:39:26 +0000900class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
901 list<Predicate> Predicates = [IsARM, HasV5TE];
902}
903class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
904 list<Predicate> Predicates = [IsARM, HasV6];
905}
Evan Chengee98fa92008-08-29 06:41:12 +0000906
907//===----------------------------------------------------------------------===//
Evan Chengee98fa92008-08-29 06:41:12 +0000908// Thumb Instruction Format Definitions.
909//
910
Owen Anderson651b2302011-07-13 23:22:26 +0000911class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000912 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000913 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +0000914 let OutOperandList = oops;
915 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000916 let AsmString = asm;
Evan Chengee98fa92008-08-29 06:41:12 +0000917 let Pattern = pattern;
918 list<Predicate> Predicates = [IsThumb];
919}
920
Bill Wendlingcbb08ca2010-12-01 02:42:55 +0000921// TI - Thumb instruction.
David Goodwinb062c232009-08-06 16:52:47 +0000922class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000923 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Chengee98fa92008-08-29 06:41:12 +0000924
Evan Cheng7cc6aca2009-08-04 23:47:55 +0000925// Two-address instructions
Bob Wilson3968c6a2010-03-23 17:23:59 +0000926class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
927 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000928 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson3968c6a2010-03-23 17:23:59 +0000929 pattern>;
Evan Cheng7cc6aca2009-08-04 23:47:55 +0000930
Johnny Chenc28e6292009-12-15 17:24:14 +0000931// tBL, tBX 32-bit instructions
932class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000933 dag oops, dag iops, InstrItinClass itin, string asm,
934 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000935 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000936 Encoding {
Johnny Chenc28e6292009-12-15 17:24:14 +0000937 let Inst{31-27} = opcod1;
938 let Inst{15-14} = opcod2;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000939 let Inst{12} = opcod3;
Johnny Chenc28e6292009-12-15 17:24:14 +0000940}
Evan Chengee98fa92008-08-29 06:41:12 +0000941
942// BR_JT instructions
Bob Wilson3968c6a2010-03-23 17:23:59 +0000943class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
944 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000945 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengee98fa92008-08-29 06:41:12 +0000946
Evan Chengbec1dba892009-06-23 19:38:13 +0000947// Thumb1 only
Owen Anderson651b2302011-07-13 23:22:26 +0000948class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000949 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000950 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +0000951 let OutOperandList = oops;
952 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000953 let AsmString = asm;
Evan Chengbec1dba892009-06-23 19:38:13 +0000954 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +0000955 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Chengbec1dba892009-06-23 19:38:13 +0000956}
957
David Goodwinb062c232009-08-06 16:52:47 +0000958class T1I<dag oops, dag iops, InstrItinClass itin,
959 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000960 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +0000961class T1Ix2<dag oops, dag iops, InstrItinClass itin,
962 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000963 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Chengbec1dba892009-06-23 19:38:13 +0000964
965// Two-address instructions
David Goodwinb062c232009-08-06 16:52:47 +0000966class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +0000967 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000968 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson947f04b2010-03-13 01:08:20 +0000969 asm, cstr, pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000970
971// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson651b2302011-07-13 23:22:26 +0000972class Thumb1sI<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> {
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000976 let OutOperandList = !con(oops, (outs s_cc_out:$s));
977 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +0000978 let AsmString = !strconcat(opc, "${s}${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 T1sI<dag oops, dag iops, InstrItinClass itin,
984 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000985 : Thumb1sI<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 T1sIt<dag oops, dag iops, InstrItinClass itin,
989 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000990 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling05632cb2010-11-30 23:54:45 +0000991 "$Rn = $Rdn", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000992
993// Thumb1 instruction that can be predicated.
Owen Anderson651b2302011-07-13 23:22:26 +0000994class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000995 InstrItinClass itin,
Evan Chengcd4cdd12009-07-11 06:43:01 +0000996 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000997 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +0000998 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000999 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001000 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chengcd4cdd12009-07-11 06:43:01 +00001001 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001002 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Chengcd4cdd12009-07-11 06:43:01 +00001003}
1004
David Goodwinb062c232009-08-06 16:52:47 +00001005class T1pI<dag oops, dag iops, InstrItinClass itin,
1006 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001007 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +00001008
1009// Two-address instructions
David Goodwinb062c232009-08-06 16:52:47 +00001010class T1pIt<dag oops, dag iops, InstrItinClass itin,
1011 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001012 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling7c646b92010-12-01 01:32:02 +00001013 "$Rn = $Rdn", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +00001014
Bob Wilson3968c6a2010-03-23 17:23:59 +00001015class T1pIs<dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001016 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001017 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Chengbec1dba892009-06-23 19:38:13 +00001018
Johnny Chen466231a2009-12-16 02:32:54 +00001019class Encoding16 : Encoding {
1020 let Inst{31-16} = 0x0000;
1021}
1022
Johnny Chenc28e6292009-12-15 17:24:14 +00001023// A6.2 16-bit Thumb instruction encoding
Johnny Chen466231a2009-12-16 02:32:54 +00001024class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001025 let Inst{15-10} = opcode;
1026}
1027
1028// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001029class T1General<bits<5> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001030 let Inst{15-14} = 0b00;
1031 let Inst{13-9} = opcode;
1032}
1033
1034// A6.2.2 Data-processing encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001035class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001036 let Inst{15-10} = 0b010000;
1037 let Inst{9-6} = opcode;
1038}
1039
1040// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001041class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001042 let Inst{15-10} = 0b010001;
Bill Wendling345b48f2010-11-17 00:45:23 +00001043 let Inst{9-6} = opcode;
Johnny Chenc28e6292009-12-15 17:24:14 +00001044}
1045
1046// A6.2.4 Load/store single data item encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001047class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001048 let Inst{15-12} = opA;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001049 let Inst{11-9} = opB;
Johnny Chenc28e6292009-12-15 17:24:14 +00001050}
Bill Wendlingb70dc872010-08-31 07:50:46 +00001051class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chenc28e6292009-12-15 17:24:14 +00001052
Eric Christopher9b67db82011-05-27 03:50:53 +00001053class T1BranchCond<bits<4> opcode> : Encoding16 {
1054 let Inst{15-12} = opcode;
1055}
1056
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001057// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling05632cb2010-11-30 23:54:45 +00001058// following bits are used for "opA" (see A6.2.4):
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001059//
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001060// 0b0110 => Immediate, 4 bytes
1061// 0b1000 => Immediate, 2 bytes
1062// 0b0111 => Immediate, 1 byte
Bill Wendlingc25545a2010-12-01 01:38:08 +00001063class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1064 InstrItinClass itin, string opc, string asm,
1065 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001066 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling5c51fcd2010-11-30 23:16:25 +00001067 T1LoadStore<0b0101, opcode> {
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001068 bits<3> Rt;
1069 bits<8> addr;
1070 let Inst{8-6} = addr{5-3}; // Rm
1071 let Inst{5-3} = addr{2-0}; // Rn
1072 let Inst{2-0} = Rt;
1073}
Bill Wendlingc25545a2010-12-01 01:38:08 +00001074class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1075 InstrItinClass itin, string opc, string asm,
1076 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001077 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling5c51fcd2010-11-30 23:16:25 +00001078 T1LoadStore<opA, {opB,?,?}> {
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001079 bits<3> Rt;
1080 bits<8> addr;
1081 let Inst{10-6} = addr{7-3}; // imm5
1082 let Inst{5-3} = addr{2-0}; // Rn
1083 let Inst{2-0} = Rt;
1084}
1085
Johnny Chenc28e6292009-12-15 17:24:14 +00001086// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001087class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001088 let Inst{15-12} = 0b1011;
1089 let Inst{11-5} = opcode;
1090}
1091
Evan Chengd76f0be2009-06-25 02:08:06 +00001092// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +00001093class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001094 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001095 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001096 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengd76f0be2009-06-25 02:08:06 +00001097 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001098 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001099 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chengd76f0be2009-06-25 02:08:06 +00001100 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001101 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001102 let DecoderNamespace = "Thumb2";
Evan Chengd76f0be2009-06-25 02:08:06 +00001103}
1104
Bill Wendlingb70dc872010-08-31 07:50:46 +00001105// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1106// input operand since by default it's a zero register. It will become an
1107// implicit def once it's "flipped".
Jim Grosbachb9386552010-10-13 23:12:26 +00001108//
Evan Chengd76f0be2009-06-25 02:08:06 +00001109// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1110// more consistent.
Owen Anderson651b2302011-07-13 23:22:26 +00001111class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001112 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001113 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001114 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersoncf096a42010-12-07 20:50:15 +00001115 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1116 let Inst{20} = s;
1117
Evan Chengd76f0be2009-06-25 02:08:06 +00001118 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001119 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner04c342e2010-10-06 00:05:18 +00001120 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Chengd76f0be2009-06-25 02:08:06 +00001121 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001122 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001123 let DecoderNamespace = "Thumb2";
Evan Chengd76f0be2009-06-25 02:08:06 +00001124}
1125
1126// Special cases
Owen Anderson651b2302011-07-13 23:22:26 +00001127class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001128 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001129 string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001130 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengd76f0be2009-06-25 02:08:06 +00001131 let OutOperandList = oops;
1132 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +00001133 let AsmString = asm;
Evan Cheng431cf562009-06-23 17:48:47 +00001134 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001135 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001136 let DecoderNamespace = "Thumb2";
Evan Cheng431cf562009-06-23 17:48:47 +00001137}
1138
Owen Anderson651b2302011-07-13 23:22:26 +00001139class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001140 InstrItinClass itin,
1141 string asm, string cstr, list<dag> pattern>
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001142 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1143 let OutOperandList = oops;
1144 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +00001145 let AsmString = asm;
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001146 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001147 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001148 let DecoderNamespace = "Thumb";
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001149}
1150
David Goodwinb062c232009-08-06 16:52:47 +00001151class T2I<dag oops, dag iops, InstrItinClass itin,
1152 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001153 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001154class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1155 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001156 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001157class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1158 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001159 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001160class T2Iso<dag oops, dag iops, InstrItinClass itin,
1161 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001162 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001163class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1164 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001165 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach95bd6b72010-12-10 20:51:35 +00001166class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
David Goodwinb062c232009-08-06 16:52:47 +00001167 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001168 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, "",
Johnny Chenc28e6292009-12-15 17:24:14 +00001169 pattern> {
Owen Anderson943fb602010-12-01 19:18:46 +00001170 bits<4> Rt;
1171 bits<4> Rt2;
1172 bits<13> addr;
Jim Grosbach95bd6b72010-12-10 20:51:35 +00001173 let Inst{31-25} = 0b1110100;
1174 let Inst{24} = P;
1175 let Inst{23} = addr{8};
1176 let Inst{22} = 1;
1177 let Inst{21} = W;
1178 let Inst{20} = isLoad;
1179 let Inst{19-16} = addr{12-9};
Owen Anderson943fb602010-12-01 19:18:46 +00001180 let Inst{15-12} = Rt{3-0};
1181 let Inst{11-8} = Rt2{3-0};
Owen Anderson943fb602010-12-01 19:18:46 +00001182 let Inst{7-0} = addr{7-0};
Johnny Chenc28e6292009-12-15 17:24:14 +00001183}
Evan Chengd76f0be2009-06-25 02:08:06 +00001184
David Goodwinb062c232009-08-06 16:52:47 +00001185class T2sI<dag oops, dag iops, InstrItinClass itin,
1186 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001187 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Chengd76f0be2009-06-25 02:08:06 +00001188
David Goodwinb062c232009-08-06 16:52:47 +00001189class T2XI<dag oops, dag iops, InstrItinClass itin,
1190 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001191 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001192class T2JTI<dag oops, dag iops, InstrItinClass itin,
1193 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001194 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng431cf562009-06-23 17:48:47 +00001195
Bruno Cardoso Lopes4d4b4902011-01-20 16:58:48 +00001196// Move to/from coprocessor instructions
Jim Grosbachcabb48d2011-07-13 21:17:59 +00001197class T2Cop<bits<4> opc, dag oops, dag iops, string asm, list<dag> pattern>
Jim Grosbachadb29b62011-07-13 21:14:23 +00001198 : T2XI <oops, iops, NoItinerary, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbachcabb48d2011-07-13 21:17:59 +00001199 let Inst{31-28} = opc;
Bruno Cardoso Lopes4d4b4902011-01-20 16:58:48 +00001200}
1201
Bob Wilson947f04b2010-03-13 01:08:20 +00001202// Two-address instructions
1203class T2XIt<dag oops, dag iops, InstrItinClass itin,
1204 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001205 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng83e0d482009-09-28 09:14:39 +00001206
Evan Cheng84c6cda2009-07-02 07:28:31 +00001207// T2Iidxldst - Thumb2 indexed load / store instructions.
Johnny Chenc28e6292009-12-15 17:24:14 +00001208class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
1209 dag oops, dag iops,
1210 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Cheng84c6cda2009-07-02 07:28:31 +00001211 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001212 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng84c6cda2009-07-02 07:28:31 +00001213 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001214 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001215 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng84c6cda2009-07-02 07:28:31 +00001216 let Pattern = pattern;
1217 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001218 let DecoderNamespace = "Thumb2";
Johnny Chenc28e6292009-12-15 17:24:14 +00001219 let Inst{31-27} = 0b11111;
1220 let Inst{26-25} = 0b00;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001221 let Inst{24} = signed;
1222 let Inst{23} = 0;
Johnny Chenc28e6292009-12-15 17:24:14 +00001223 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001224 let Inst{20} = load;
1225 let Inst{11} = 1;
Johnny Chenc28e6292009-12-15 17:24:14 +00001226 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingb70dc872010-08-31 07:50:46 +00001227 let Inst{10} = pre; // The P bit.
1228 let Inst{8} = 1; // The W bit.
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001229
Owen Andersone22c7322010-11-30 00:14:31 +00001230 bits<9> addr;
1231 let Inst{7-0} = addr{7-0};
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001232 let Inst{9} = addr{8}; // Sign bit
1233
Owen Andersone22c7322010-11-30 00:14:31 +00001234 bits<4> Rt;
1235 bits<4> Rn;
1236 let Inst{15-12} = Rt{3-0};
1237 let Inst{19-16} = Rn{3-0};
Evan Cheng84c6cda2009-07-02 07:28:31 +00001238}
1239
David Goodwine5b969f2009-07-27 19:59:26 +00001240// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1241class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001242 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwine5b969f2009-07-27 19:59:26 +00001243}
1244
1245// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1246class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001247 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwine5b969f2009-07-27 19:59:26 +00001248}
Evan Cheng84c6cda2009-07-02 07:28:31 +00001249
Bruno Cardoso Lopes168c9002011-05-03 17:29:22 +00001250// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1251class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1252 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1253}
1254
Evan Chengeab9ca72009-06-27 02:26:13 +00001255// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1256class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Cheng2c450d32009-07-02 06:38:40 +00001257 list<Predicate> Predicates = [IsThumb2];
Evan Cheng431cf562009-06-23 17:48:47 +00001258}
1259
Evan Chengee98fa92008-08-29 06:41:12 +00001260//===----------------------------------------------------------------------===//
1261
Evan Chengac2af2f2008-11-11 02:11:05 +00001262//===----------------------------------------------------------------------===//
1263// ARM VFP Instruction templates.
1264//
1265
David Goodwin81cdd212009-07-10 17:03:29 +00001266// Almost all VFP instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +00001267class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001268 IndexMode im, Format f, InstrItinClass itin,
1269 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001270 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach576640f2010-10-12 21:22:40 +00001271 bits<4> p;
1272 let Inst{31-28} = p;
David Goodwin81cdd212009-07-10 17:03:29 +00001273 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001274 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001275 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin81cdd212009-07-10 17:03:29 +00001276 let Pattern = pattern;
Bill Wendling87240d42010-12-01 21:54:50 +00001277 let PostEncoderMethod = "VFPThumb2PostEncoder";
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";
David Goodwin81cdd212009-07-10 17:03:29 +00001293 list<Predicate> Predicates = [HasVFP2];
1294}
1295
David Goodwinb062c232009-08-06 16:52:47 +00001296class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1297 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001298 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendling87240d42010-12-01 21:54:50 +00001299 opc, asm, "", pattern> {
1300 let PostEncoderMethod = "VFPThumb2PostEncoder";
1301}
David Goodwin81cdd212009-07-10 17:03:29 +00001302
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001303// ARM VFP addrmode5 loads and stores
1304class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001305 InstrItinClass itin,
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001306 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001307 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001308 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendlingc0024632010-11-04 00:59:42 +00001309 // Instruction operands.
1310 bits<5> Dd;
1311 bits<13> addr;
1312
1313 // Encode instruction operands.
1314 let Inst{23} = addr{8}; // U (add = (U == '1'))
1315 let Inst{22} = Dd{4};
1316 let Inst{19-16} = addr{12-9}; // Rn
1317 let Inst{15-12} = Dd{3-0};
1318 let Inst{7-0} = addr{7-0}; // imm8
1319
Evan Chengac2af2f2008-11-11 02:11:05 +00001320 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001321 let Inst{27-24} = opcod1;
1322 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001323 let Inst{11-9} = 0b101;
1324 let Inst{8} = 1; // Double precision
Anton Korobeynikov8cce1eb2009-11-02 00:11:06 +00001325
Evan Cheng4a8c43f2011-02-16 00:35:02 +00001326 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +00001327 let D = VFPNeonDomain;
Evan Chengac2af2f2008-11-11 02:11:05 +00001328}
1329
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001330class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001331 InstrItinClass itin,
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001332 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001333 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001334 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendlingc0024632010-11-04 00:59:42 +00001335 // Instruction operands.
1336 bits<5> Sd;
1337 bits<13> addr;
1338
1339 // Encode instruction operands.
1340 let Inst{23} = addr{8}; // U (add = (U == '1'))
1341 let Inst{22} = Sd{0};
1342 let Inst{19-16} = addr{12-9}; // Rn
1343 let Inst{15-12} = Sd{4-1};
1344 let Inst{7-0} = addr{7-0}; // imm8
1345
Evan Chengac2af2f2008-11-11 02:11:05 +00001346 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001347 let Inst{27-24} = opcod1;
1348 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001349 let Inst{11-9} = 0b101;
1350 let Inst{8} = 0; // Single precision
Evan Cheng4a8c43f2011-02-16 00:35:02 +00001351
1352 // Loads & stores operate on both NEON and VFP pipelines.
1353 let D = VFPNeonDomain;
Evan Chengac2af2f2008-11-11 02:11:05 +00001354}
1355
Bob Wilson6b853c32010-09-16 00:31:02 +00001356// VFP Load / store multiple pseudo instructions.
1357class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1358 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001359 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson6b853c32010-09-16 00:31:02 +00001360 cstr, itin> {
1361 let OutOperandList = oops;
1362 let InOperandList = !con(iops, (ins pred:$p));
1363 let Pattern = pattern;
1364 list<Predicate> Predicates = [HasVFP2];
1365}
1366
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001367// Load / store multiple
Jim Grosbachabcbe242010-09-08 00:25:50 +00001368class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +00001369 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001370 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001371 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling345b48f2010-11-17 00:45:23 +00001372 // Instruction operands.
1373 bits<4> Rn;
1374 bits<13> regs;
1375
1376 // Encode instruction operands.
1377 let Inst{19-16} = Rn;
1378 let Inst{22} = regs{12};
1379 let Inst{15-12} = regs{11-8};
1380 let Inst{7-0} = regs{7-0};
1381
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001382 // TODO: Mark the instructions with the appropriate subtarget info.
1383 let Inst{27-25} = 0b110;
Bill Wendling98c29d72010-10-12 22:03:19 +00001384 let Inst{11-9} = 0b101;
1385 let Inst{8} = 1; // Double precision
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001386}
1387
Jim Grosbachabcbe242010-09-08 00:25:50 +00001388class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +00001389 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001390 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001391 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling345b48f2010-11-17 00:45:23 +00001392 // Instruction operands.
1393 bits<4> Rn;
1394 bits<13> regs;
1395
1396 // Encode instruction operands.
1397 let Inst{19-16} = Rn;
1398 let Inst{22} = regs{8};
1399 let Inst{15-12} = regs{12-9};
1400 let Inst{7-0} = regs{7-0};
1401
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001402 // TODO: Mark the instructions with the appropriate subtarget info.
1403 let Inst{27-25} = 0b110;
Bill Wendling98c29d72010-10-12 22:03:19 +00001404 let Inst{11-9} = 0b101;
1405 let Inst{8} = 0; // Single precision
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001406}
1407
Evan Chengac2af2f2008-11-11 02:11:05 +00001408// Double precision, unary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001409class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1410 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1411 string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001412 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001413 // Instruction operands.
1414 bits<5> Dd;
1415 bits<5> Dm;
1416
1417 // Encode instruction operands.
1418 let Inst{3-0} = Dm{3-0};
1419 let Inst{5} = Dm{4};
1420 let Inst{15-12} = Dd{3-0};
1421 let Inst{22} = Dd{4};
1422
Johnny Chen34a6afc2010-01-29 23:21:10 +00001423 let Inst{27-23} = opcod1;
1424 let Inst{21-20} = opcod2;
1425 let Inst{19-16} = opcod3;
Bill Wendling98c29d72010-10-12 22:03:19 +00001426 let Inst{11-9} = 0b101;
1427 let Inst{8} = 1; // Double precision
Johnny Chen34a6afc2010-01-29 23:21:10 +00001428 let Inst{7-6} = opcod4;
1429 let Inst{4} = opcod5;
Evan Chengac2af2f2008-11-11 02:11:05 +00001430}
1431
1432// Double precision, binary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001433class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001434 dag iops, InstrItinClass itin, string opc, string asm,
1435 list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001436 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001437 // Instruction operands.
1438 bits<5> Dd;
1439 bits<5> Dn;
1440 bits<5> Dm;
1441
1442 // Encode instruction operands.
1443 let Inst{3-0} = Dm{3-0};
1444 let Inst{5} = Dm{4};
1445 let Inst{19-16} = Dn{3-0};
1446 let Inst{7} = Dn{4};
1447 let Inst{15-12} = Dd{3-0};
1448 let Inst{22} = Dd{4};
1449
Johnny Chen34a6afc2010-01-29 23:21:10 +00001450 let Inst{27-23} = opcod1;
1451 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001452 let Inst{11-9} = 0b101;
1453 let Inst{8} = 1; // Double precision
Bill Wendlingb70dc872010-08-31 07:50:46 +00001454 let Inst{6} = op6;
1455 let Inst{4} = op4;
Evan Chengac2af2f2008-11-11 02:11:05 +00001456}
1457
1458// Single precision, unary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001459class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1460 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1461 string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001462 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001463 // Instruction operands.
1464 bits<5> Sd;
1465 bits<5> Sm;
1466
1467 // Encode instruction operands.
1468 let Inst{3-0} = Sm{4-1};
1469 let Inst{5} = Sm{0};
1470 let Inst{15-12} = Sd{4-1};
1471 let Inst{22} = Sd{0};
1472
Johnny Chen34a6afc2010-01-29 23:21:10 +00001473 let Inst{27-23} = opcod1;
1474 let Inst{21-20} = opcod2;
1475 let Inst{19-16} = opcod3;
Bill Wendling98c29d72010-10-12 22:03:19 +00001476 let Inst{11-9} = 0b101;
1477 let Inst{8} = 0; // Single precision
Johnny Chen34a6afc2010-01-29 23:21:10 +00001478 let Inst{7-6} = opcod4;
1479 let Inst{4} = opcod5;
Evan Chengac2af2f2008-11-11 02:11:05 +00001480}
1481
Bill Wendlingcbb08ca2010-12-01 02:42:55 +00001482// Single precision unary, if no NEON. Same as ASuI except not available if
1483// NEON is enabled.
Johnny Chen34a6afc2010-01-29 23:21:10 +00001484class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1485 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1486 string asm, list<dag> pattern>
1487 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1488 pattern> {
David Goodwin30bf6252009-08-04 20:39:05 +00001489 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1490}
1491
Evan Chengac2af2f2008-11-11 02:11:05 +00001492// Single precision, binary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001493class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1494 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001495 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001496 // Instruction operands.
1497 bits<5> Sd;
1498 bits<5> Sn;
1499 bits<5> Sm;
1500
1501 // Encode instruction operands.
1502 let Inst{3-0} = Sm{4-1};
1503 let Inst{5} = Sm{0};
1504 let Inst{19-16} = Sn{4-1};
1505 let Inst{7} = Sn{0};
1506 let Inst{15-12} = Sd{4-1};
1507 let Inst{22} = Sd{0};
1508
Johnny Chen34a6afc2010-01-29 23:21:10 +00001509 let Inst{27-23} = opcod1;
1510 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001511 let Inst{11-9} = 0b101;
1512 let Inst{8} = 0; // Single precision
Bill Wendlingb70dc872010-08-31 07:50:46 +00001513 let Inst{6} = op6;
1514 let Inst{4} = op4;
Evan Chengac2af2f2008-11-11 02:11:05 +00001515}
1516
Bill Wendlingcbb08ca2010-12-01 02:42:55 +00001517// Single precision binary, if no NEON. Same as ASbI except not available if
1518// NEON is enabled.
Johnny Chen34a6afc2010-01-29 23:21:10 +00001519class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001520 dag iops, InstrItinClass itin, string opc, string asm,
1521 list<dag> pattern>
Johnny Chen34a6afc2010-01-29 23:21:10 +00001522 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin3b9c52c2009-08-04 17:53:06 +00001523 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling26233432010-11-01 06:00:39 +00001524
1525 // Instruction operands.
1526 bits<5> Sd;
1527 bits<5> Sn;
1528 bits<5> Sm;
1529
1530 // Encode instruction operands.
1531 let Inst{3-0} = Sm{4-1};
1532 let Inst{5} = Sm{0};
1533 let Inst{19-16} = Sn{4-1};
1534 let Inst{7} = Sn{0};
1535 let Inst{15-12} = Sd{4-1};
1536 let Inst{22} = Sd{0};
David Goodwin3b9c52c2009-08-04 17:53:06 +00001537}
1538
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001539// VFP conversion instructions
Johnny Chen34a6afc2010-01-29 23:21:10 +00001540class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1541 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1542 list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001543 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen34a6afc2010-01-29 23:21:10 +00001544 let Inst{27-23} = opcod1;
1545 let Inst{21-20} = opcod2;
1546 let Inst{19-16} = opcod3;
1547 let Inst{11-8} = opcod4;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001548 let Inst{6} = 1;
Johnny Chen34a6afc2010-01-29 23:21:10 +00001549 let Inst{4} = 0;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001550}
1551
Johnny Chen39640592010-02-11 18:47:03 +00001552// VFP conversion between floating-point and fixed-point
1553class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001554 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1555 list<dag> pattern>
Johnny Chen39640592010-02-11 18:47:03 +00001556 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
1557 // size (fixed-point number): sx == 0 ? 16 : 32
1558 let Inst{7} = op5; // sx
1559}
1560
David Goodwin85b5b022009-08-10 22:17:39 +00001561// VFP conversion instructions, if no NEON
Johnny Chen34a6afc2010-01-29 23:21:10 +00001562class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin85b5b022009-08-10 22:17:39 +00001563 dag oops, dag iops, InstrItinClass itin,
1564 string opc, string asm, list<dag> pattern>
Johnny Chen34a6afc2010-01-29 23:21:10 +00001565 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1566 pattern> {
David Goodwin85b5b022009-08-10 22:17:39 +00001567 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1568}
1569
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001570class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwinb062c232009-08-06 16:52:47 +00001571 InstrItinClass itin,
1572 string opc, string asm, list<dag> pattern>
1573 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001574 let Inst{27-20} = opcod1;
Evan Cheng38c9a142008-11-11 19:40:26 +00001575 let Inst{11-8} = opcod2;
1576 let Inst{4} = 1;
1577}
1578
David Goodwinb062c232009-08-06 16:52:47 +00001579class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1580 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1581 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng97ccab82008-11-11 22:46:12 +00001582
Bob Wilson3968c6a2010-03-23 17:23:59 +00001583class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001584 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1585 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001586
David Goodwinb062c232009-08-06 16:52:47 +00001587class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1588 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1589 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001590
David Goodwinb062c232009-08-06 16:52:47 +00001591class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1592 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1593 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng38c9a142008-11-11 19:40:26 +00001594
Evan Chengac2af2f2008-11-11 02:11:05 +00001595//===----------------------------------------------------------------------===//
1596
Bob Wilson2e076c42009-06-22 23:27:02 +00001597//===----------------------------------------------------------------------===//
1598// ARM NEON Instruction templates.
1599//
Evan Chengee98fa92008-08-29 06:41:12 +00001600
Johnny Chenf833fad2010-03-20 00:17:00 +00001601class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1602 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1603 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001604 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001605 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001606 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001607 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Cheng738a97a2009-11-23 21:57:23 +00001608 let Pattern = pattern;
1609 list<Predicate> Predicates = [HasNEON];
1610}
1611
1612// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen020023a2010-03-23 20:40:44 +00001613class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1614 InstrItinClass itin, string opc, string asm, string cstr,
1615 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001616 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001617 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001618 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001619 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson2e076c42009-06-22 23:27:02 +00001620 let Pattern = pattern;
1621 list<Predicate> Predicates = [HasNEON];
Evan Chengee98fa92008-08-29 06:41:12 +00001622}
1623
Bob Wilson50820a22009-10-07 21:53:04 +00001624class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1625 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001626 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenf833fad2010-03-20 00:17:00 +00001627 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1628 cstr, pattern> {
Bob Wilsonf731a2d2009-07-08 18:11:30 +00001629 let Inst{31-24} = 0b11110100;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001630 let Inst{23} = op23;
Jim Grosbach68f495c2009-10-20 00:19:08 +00001631 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001632 let Inst{11-8} = op11_8;
1633 let Inst{7-4} = op7_4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001634
Chris Lattner63274cb2010-11-15 05:19:05 +00001635 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Jim Grosbach5876e412010-11-19 22:42:55 +00001636
Owen Andersonad402342010-11-02 00:05:05 +00001637 bits<5> Vd;
Owen Anderson0ebd1fd2010-11-02 23:47:29 +00001638 bits<6> Rn;
1639 bits<4> Rm;
Jim Grosbach5876e412010-11-19 22:42:55 +00001640
Owen Andersonad402342010-11-02 00:05:05 +00001641 let Inst{22} = Vd{4};
1642 let Inst{15-12} = Vd{3-0};
Owen Anderson0ebd1fd2010-11-02 23:47:29 +00001643 let Inst{19-16} = Rn{3-0};
1644 let Inst{3-0} = Rm{3-0};
Bob Wilsonf731a2d2009-07-08 18:11:30 +00001645}
1646
Owen Anderson9f20daf2010-11-02 20:47:39 +00001647class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1648 dag oops, dag iops, InstrItinClass itin,
1649 string opc, string dt, string asm, string cstr, list<dag> pattern>
1650 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1651 dt, asm, cstr, pattern> {
1652 bits<3> lane;
1653}
1654
Bob Wilson9392b0e2010-08-25 23:27:42 +00001655class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson651b2302011-07-13 23:22:26 +00001656 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson9392b0e2010-08-25 23:27:42 +00001657 itin> {
1658 let OutOperandList = oops;
1659 let InOperandList = !con(iops, (ins pred:$p));
1660 list<Predicate> Predicates = [HasNEON];
1661}
1662
Jim Grosbach233b3a22010-10-06 20:36:55 +00001663class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1664 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001665 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonc597fd3b2010-09-13 23:55:10 +00001666 itin> {
1667 let OutOperandList = oops;
1668 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach233b3a22010-10-06 20:36:55 +00001669 let Pattern = pattern;
Bob Wilsonc597fd3b2010-09-13 23:55:10 +00001670 list<Predicate> Predicates = [HasNEON];
1671}
1672
Johnny Chenac5024b2010-03-23 16:43:47 +00001673class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001674 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenac5024b2010-03-23 16:43:47 +00001675 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1676 pattern> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001677 let Inst{31-25} = 0b1111001;
Chris Lattner63274cb2010-11-15 05:19:05 +00001678 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Evan Cheng738a97a2009-11-23 21:57:23 +00001679}
1680
Johnny Chen020023a2010-03-23 20:40:44 +00001681class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001682 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen020023a2010-03-23 20:40:44 +00001683 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001684 cstr, pattern> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001685 let Inst{31-25} = 0b1111001;
Owen Andersonb538a222010-12-10 22:32:08 +00001686 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Bob Wilson2e076c42009-06-22 23:27:02 +00001687}
1688
1689// NEON "one register and a modified immediate" format.
1690class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1691 bit op5, bit op4,
David Goodwinb062c232009-08-06 16:52:47 +00001692 dag oops, dag iops, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001693 string opc, string dt, string asm, string cstr,
1694 list<dag> pattern>
Johnny Chen6a643202010-03-23 23:09:14 +00001695 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001696 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00001697 let Inst{21-19} = op21_19;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001698 let Inst{11-8} = op11_8;
1699 let Inst{7} = op7;
1700 let Inst{6} = op6;
1701 let Inst{5} = op5;
1702 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001703
Owen Anderson284cb362010-10-26 17:40:54 +00001704 // Instruction operands.
1705 bits<5> Vd;
1706 bits<13> SIMM;
Jim Grosbach5876e412010-11-19 22:42:55 +00001707
Owen Anderson284cb362010-10-26 17:40:54 +00001708 let Inst{15-12} = Vd{3-0};
1709 let Inst{22} = Vd{4};
1710 let Inst{24} = SIMM{7};
1711 let Inst{18-16} = SIMM{6-4};
1712 let Inst{3-0} = SIMM{3-0};
Bob Wilson2e076c42009-06-22 23:27:02 +00001713}
1714
1715// NEON 2 vector register format.
1716class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1717 bits<5> op11_7, bit op6, bit op4,
David Goodwinb062c232009-08-06 16:52:47 +00001718 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001719 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen9b1f60a2010-03-24 00:57:50 +00001720 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001721 let Inst{24-23} = op24_23;
1722 let Inst{21-20} = op21_20;
1723 let Inst{19-18} = op19_18;
1724 let Inst{17-16} = op17_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001725 let Inst{11-7} = op11_7;
1726 let Inst{6} = op6;
1727 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001728
Owen Anderson24774462010-10-25 18:43:52 +00001729 // Instruction operands.
1730 bits<5> Vd;
1731 bits<5> Vm;
1732
1733 let Inst{15-12} = Vd{3-0};
1734 let Inst{22} = Vd{4};
1735 let Inst{3-0} = Vm{3-0};
1736 let Inst{5} = Vm{4};
Evan Cheng738a97a2009-11-23 21:57:23 +00001737}
1738
1739// Same as N2V except it doesn't have a datatype suffix.
1740class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001741 bits<5> op11_7, bit op6, bit op4,
1742 dag oops, dag iops, InstrItinClass itin,
1743 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen9b1f60a2010-03-24 00:57:50 +00001744 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001745 let Inst{24-23} = op24_23;
1746 let Inst{21-20} = op21_20;
1747 let Inst{19-18} = op19_18;
1748 let Inst{17-16} = op17_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001749 let Inst{11-7} = op11_7;
1750 let Inst{6} = op6;
1751 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001752
Owen Anderson24774462010-10-25 18:43:52 +00001753 // Instruction operands.
1754 bits<5> Vd;
1755 bits<5> Vm;
1756
1757 let Inst{15-12} = Vd{3-0};
1758 let Inst{22} = Vd{4};
1759 let Inst{3-0} = Vm{3-0};
1760 let Inst{5} = Vm{4};
Bob Wilson2e076c42009-06-22 23:27:02 +00001761}
1762
1763// NEON 2 vector register with immediate.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00001764class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chend82f9002010-03-25 20:39:04 +00001765 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001766 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chend82f9002010-03-25 20:39:04 +00001767 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001768 let Inst{24} = op24;
1769 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00001770 let Inst{11-8} = op11_8;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001771 let Inst{7} = op7;
1772 let Inst{6} = op6;
1773 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001774
Owen Anderson3665fee2010-10-26 20:56:57 +00001775 // Instruction operands.
1776 bits<5> Vd;
1777 bits<5> Vm;
1778 bits<6> SIMM;
1779
1780 let Inst{15-12} = Vd{3-0};
1781 let Inst{22} = Vd{4};
1782 let Inst{3-0} = Vm{3-0};
1783 let Inst{5} = Vm{4};
1784 let Inst{21-16} = SIMM{5-0};
Bob Wilson2e076c42009-06-22 23:27:02 +00001785}
1786
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001787// NEON 3 vector register format.
Owen Andersonabda3ca2011-03-30 23:45:29 +00001788
Jim Grosbacheca54e42011-05-19 17:34:53 +00001789class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1790 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1791 string opc, string dt, string asm, string cstr,
1792 list<dag> pattern>
Johnny Chen2cf04952010-03-26 21:26:28 +00001793 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001794 let Inst{24} = op24;
1795 let Inst{23} = op23;
Evan Cheng738a97a2009-11-23 21:57:23 +00001796 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001797 let Inst{11-8} = op11_8;
1798 let Inst{6} = op6;
1799 let Inst{4} = op4;
Owen Andersonabda3ca2011-03-30 23:45:29 +00001800}
1801
1802class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1803 dag oops, dag iops, Format f, InstrItinClass itin,
1804 string opc, string dt, string asm, string cstr, list<dag> pattern>
1805 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1806 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Jim Grosbach5876e412010-11-19 22:42:55 +00001807
Owen Anderson9e44cf22010-10-21 20:21:49 +00001808 // Instruction operands.
1809 bits<5> Vd;
1810 bits<5> Vn;
1811 bits<5> Vm;
1812
1813 let Inst{15-12} = Vd{3-0};
1814 let Inst{22} = Vd{4};
1815 let Inst{19-16} = Vn{3-0};
1816 let Inst{7} = Vn{4};
1817 let Inst{3-0} = Vm{3-0};
1818 let Inst{5} = Vm{4};
Evan Cheng738a97a2009-11-23 21:57:23 +00001819}
1820
Jim Grosbacheca54e42011-05-19 17:34:53 +00001821class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1822 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1823 string opc, string dt, string asm, string cstr,
1824 list<dag> pattern>
Owen Andersonabda3ca2011-03-30 23:45:29 +00001825 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1826 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1827
1828 // Instruction operands.
1829 bits<5> Vd;
1830 bits<5> Vn;
1831 bits<5> Vm;
1832 bit lane;
1833
1834 let Inst{15-12} = Vd{3-0};
1835 let Inst{22} = Vd{4};
1836 let Inst{19-16} = Vn{3-0};
1837 let Inst{7} = Vn{4};
1838 let Inst{3-0} = Vm{3-0};
1839 let Inst{5} = lane;
1840}
1841
Jim Grosbacheca54e42011-05-19 17:34:53 +00001842class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1843 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
1844 string opc, string dt, string asm, string cstr,
1845 list<dag> pattern>
Owen Andersonabda3ca2011-03-30 23:45:29 +00001846 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
1847 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
1848
1849 // Instruction operands.
1850 bits<5> Vd;
1851 bits<5> Vn;
1852 bits<5> Vm;
1853 bits<2> lane;
1854
1855 let Inst{15-12} = Vd{3-0};
1856 let Inst{22} = Vd{4};
1857 let Inst{19-16} = Vn{3-0};
1858 let Inst{7} = Vn{4};
1859 let Inst{2-0} = Vm{2-0};
1860 let Inst{5} = lane{1};
1861 let Inst{3} = lane{0};
1862}
1863
Johnny Chen8a687232010-03-23 21:35:03 +00001864// Same as N3V except it doesn't have a data type suffix.
Bob Wilson3968c6a2010-03-23 17:23:59 +00001865class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
1866 bit op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001867 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001868 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00001869 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001870 let Inst{24} = op24;
1871 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00001872 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001873 let Inst{11-8} = op11_8;
1874 let Inst{6} = op6;
1875 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001876
Owen Andersondff239c2010-10-25 18:28:30 +00001877 // Instruction operands.
1878 bits<5> Vd;
1879 bits<5> Vn;
1880 bits<5> Vm;
1881
1882 let Inst{15-12} = Vd{3-0};
1883 let Inst{22} = Vd{4};
1884 let Inst{19-16} = Vn{3-0};
1885 let Inst{7} = Vn{4};
1886 let Inst{3-0} = Vm{3-0};
1887 let Inst{5} = Vm{4};
Bob Wilson2e076c42009-06-22 23:27:02 +00001888}
1889
1890// NEON VMOVs between scalar and core registers.
1891class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00001892 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001893 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001894 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001895 "", itin> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001896 let Inst{27-20} = opcod1;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001897 let Inst{11-8} = opcod2;
1898 let Inst{6-5} = opcod3;
1899 let Inst{4} = 1;
Johnny Chen8bca1742011-04-06 18:27:46 +00001900 // A8.6.303, A8.6.328, A8.6.329
1901 let Inst{3-0} = 0b0000;
Evan Cheng738a97a2009-11-23 21:57:23 +00001902
1903 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001904 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001905 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Cheng738a97a2009-11-23 21:57:23 +00001906 let Pattern = pattern;
Bob Wilson2e076c42009-06-22 23:27:02 +00001907 list<Predicate> Predicates = [HasNEON];
Jim Grosbach5876e412010-11-19 22:42:55 +00001908
Chris Lattner63274cb2010-11-15 05:19:05 +00001909 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Jim Grosbach5876e412010-11-19 22:42:55 +00001910
Owen Andersoned9652f2010-10-27 21:28:09 +00001911 bits<5> V;
1912 bits<4> R;
Owen Anderson40d24a42010-10-27 19:25:54 +00001913 bits<4> p;
Owen Andersoned9652f2010-10-27 21:28:09 +00001914 bits<4> lane;
Jim Grosbach5876e412010-11-19 22:42:55 +00001915
Owen Anderson40d24a42010-10-27 19:25:54 +00001916 let Inst{31-28} = p{3-0};
Owen Andersoned9652f2010-10-27 21:28:09 +00001917 let Inst{7} = V{4};
1918 let Inst{19-16} = V{3-0};
1919 let Inst{15-12} = R{3-0};
Bob Wilson2e076c42009-06-22 23:27:02 +00001920}
1921class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00001922 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001923 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00001924 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001925 opc, dt, asm, pattern>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001926class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00001927 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001928 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00001929 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001930 opc, dt, asm, pattern>;
Bob Wilson2e076c42009-06-22 23:27:02 +00001931class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00001932 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001933 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00001934 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001935 opc, dt, asm, pattern>;
David Goodwin3b9c52c2009-08-04 17:53:06 +00001936
Johnny Chen45ab3f32010-03-25 17:01:27 +00001937// Vector Duplicate Lane (from scalar to all elements)
1938class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
1939 InstrItinClass itin, string opc, string dt, string asm,
1940 list<dag> pattern>
Johnny Chen91d27742010-03-25 21:49:12 +00001941 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chen45ab3f32010-03-25 17:01:27 +00001942 let Inst{24-23} = 0b11;
1943 let Inst{21-20} = 0b11;
1944 let Inst{19-16} = op19_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001945 let Inst{11-7} = 0b11000;
1946 let Inst{6} = op6;
1947 let Inst{4} = 0;
Jim Grosbach5876e412010-11-19 22:42:55 +00001948
Owen Anderson40d24a42010-10-27 19:25:54 +00001949 bits<5> Vd;
1950 bits<5> Vm;
1951 bits<4> lane;
Jim Grosbach5876e412010-11-19 22:42:55 +00001952
Owen Anderson40d24a42010-10-27 19:25:54 +00001953 let Inst{22} = Vd{4};
1954 let Inst{15-12} = Vd{3-0};
1955 let Inst{5} = Vm{4};
1956 let Inst{3-0} = Vm{3-0};
Johnny Chen45ab3f32010-03-25 17:01:27 +00001957}
1958
David Goodwin3b9c52c2009-08-04 17:53:06 +00001959// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1960// for single-precision FP.
1961class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1962 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1963}