blob: 6d4de3dd99b73d4a9f0c64bb573fba40cc4eb13e [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +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"; }
Jim Grosbachf86cd372011-08-19 20:46:54 +0000151def pred : PredicateOperand<OtherVT, (ops i32imm, i32imm),
Evan Chengcd4cdd12009-07-11 06:43:01 +0000152 (ops (i32 14), (i32 zero_reg))> {
153 let PrintMethod = "printPredicateOperand";
Daniel Dunbard8042b72010-08-11 06:36:53 +0000154 let ParserMatchClass = CondCodeOperand;
Jim Grosbachdbb60f92011-08-19 20:30:19 +0000155 let DecoderMethod = "DecodePredicateOperand";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000156}
157
Tim Northover42180442013-08-22 09:57:11 +0000158// Selectable predicate operand for CMOV instructions. We can't use a normal
159// predicate because the default values interfere with instruction selection. In
160// all other respects it is identical though: pseudo-instruction expansion
161// relies on the MachineOperands being compatible.
162def cmovpred : Operand<i32>, PredicateOp,
163 ComplexPattern<i32, 2, "SelectCMOVPred"> {
164 let MIOperandInfo = (ops i32imm, i32imm);
165 let PrintMethod = "printPredicateOperand";
166}
167
Evan Chengcd4cdd12009-07-11 06:43:01 +0000168// Conditional code result for instructions whose 's' bit is set, e.g. subs.
Jim Grosbacheeaab222011-07-25 20:38:18 +0000169def CCOutOperand : AsmOperandClass { let Name = "CCOut"; }
Evan Chengcd4cdd12009-07-11 06:43:01 +0000170def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
Chris Lattner63274cb2010-11-15 05:19:05 +0000171 let EncoderMethod = "getCCOutOpValue";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000172 let PrintMethod = "printSBitModifierOperand";
Jim Grosbach0bfb4d52010-12-06 18:21:12 +0000173 let ParserMatchClass = CCOutOperand;
Jim Grosbach9c920492011-08-19 19:41:46 +0000174 let DecoderMethod = "DecodeCCOutOperand";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000175}
176
177// Same as cc_out except it defaults to setting CPSR.
178def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
Chris Lattner63274cb2010-11-15 05:19:05 +0000179 let EncoderMethod = "getCCOutOpValue";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000180 let PrintMethod = "printSBitModifierOperand";
Jim Grosbach0bfb4d52010-12-06 18:21:12 +0000181 let ParserMatchClass = CCOutOperand;
Jim Grosbach9c920492011-08-19 19:41:46 +0000182 let DecoderMethod = "DecodeCCOutOperand";
Evan Chengcd4cdd12009-07-11 06:43:01 +0000183}
184
Johnny Chen9a3e2392010-03-10 18:59:38 +0000185// ARM special operands for disassembly only.
186//
Jim Grosbach3a3d8e82011-11-12 00:58:43 +0000187def SetEndAsmOperand : ImmAsmOperand {
Jim Grosbach0a547702011-07-22 17:44:50 +0000188 let Name = "SetEndImm";
189 let ParserMethod = "parseSetEndImm";
190}
Jim Grosbach7e72ec62010-10-13 21:00:04 +0000191def setend_op : Operand<i32> {
192 let PrintMethod = "printSetendOperand";
Jim Grosbach0a547702011-07-22 17:44:50 +0000193 let ParserMatchClass = SetEndAsmOperand;
Jim Grosbach7e72ec62010-10-13 21:00:04 +0000194}
Johnny Chen9a3e2392010-03-10 18:59:38 +0000195
Jim Grosbacheeaab222011-07-25 20:38:18 +0000196def MSRMaskOperand : AsmOperandClass {
197 let Name = "MSRMask";
198 let ParserMethod = "parseMSRMaskOperand";
199}
Johnny Chen9a3e2392010-03-10 18:59:38 +0000200def msr_mask : Operand<i32> {
201 let PrintMethod = "printMSRMaskOperand";
Owen Anderson60663402011-08-11 20:21:46 +0000202 let DecoderMethod = "DecodeMSRMask";
Bruno Cardoso Lopes9cd43972011-02-18 19:45:59 +0000203 let ParserMatchClass = MSRMaskOperand;
Johnny Chen9a3e2392010-03-10 18:59:38 +0000204}
205
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000206// Shift Right Immediate - A shift right immediate is encoded differently from
207// other shift immediates. The imm6 field is encoded like so:
Bill Wendling3b1459b2011-03-01 01:00:59 +0000208//
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000209// Offset Encoding
210// 8 imm6<5:3> = '001', 8 - <imm> is encoded in imm6<2:0>
211// 16 imm6<5:4> = '01', 16 - <imm> is encoded in imm6<3:0>
212// 32 imm6<5> = '1', 32 - <imm> is encoded in imm6<4:0>
213// 64 64 - <imm> is encoded in imm6<5:0>
Jim Grosbachba7d6ed2011-12-08 22:06:06 +0000214def shr_imm8_asm_operand : ImmAsmOperand { let Name = "ShrImm8"; }
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000215def shr_imm8 : Operand<i32> {
216 let EncoderMethod = "getShiftRight8Imm";
Owen Andersone0152a72011-08-09 20:55:18 +0000217 let DecoderMethod = "DecodeShiftRight8Imm";
Jim Grosbachba7d6ed2011-12-08 22:06:06 +0000218 let ParserMatchClass = shr_imm8_asm_operand;
Bill Wendling3b1459b2011-03-01 01:00:59 +0000219}
Jim Grosbachba7d6ed2011-12-08 22:06:06 +0000220def shr_imm16_asm_operand : ImmAsmOperand { let Name = "ShrImm16"; }
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000221def shr_imm16 : Operand<i32> {
222 let EncoderMethod = "getShiftRight16Imm";
Owen Andersone0152a72011-08-09 20:55:18 +0000223 let DecoderMethod = "DecodeShiftRight16Imm";
Jim Grosbachba7d6ed2011-12-08 22:06:06 +0000224 let ParserMatchClass = shr_imm16_asm_operand;
Bill Wendling3b1459b2011-03-01 01:00:59 +0000225}
Jim Grosbachba7d6ed2011-12-08 22:06:06 +0000226def shr_imm32_asm_operand : ImmAsmOperand { let Name = "ShrImm32"; }
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000227def shr_imm32 : Operand<i32> {
228 let EncoderMethod = "getShiftRight32Imm";
Owen Andersone0152a72011-08-09 20:55:18 +0000229 let DecoderMethod = "DecodeShiftRight32Imm";
Jim Grosbachba7d6ed2011-12-08 22:06:06 +0000230 let ParserMatchClass = shr_imm32_asm_operand;
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000231}
Jim Grosbachba7d6ed2011-12-08 22:06:06 +0000232def shr_imm64_asm_operand : ImmAsmOperand { let Name = "ShrImm64"; }
Bill Wendling77ad1dc2011-03-07 23:38:41 +0000233def shr_imm64 : Operand<i32> {
234 let EncoderMethod = "getShiftRight64Imm";
Owen Andersone0152a72011-08-09 20:55:18 +0000235 let DecoderMethod = "DecodeShiftRight64Imm";
Jim Grosbachba7d6ed2011-12-08 22:06:06 +0000236 let ParserMatchClass = shr_imm64_asm_operand;
Bill Wendling3b1459b2011-03-01 01:00:59 +0000237}
238
Evan Chengcd4cdd12009-07-11 06:43:01 +0000239//===----------------------------------------------------------------------===//
Jim Grosbach6caa5572011-08-22 18:04:24 +0000240// ARM Assembler alias templates.
241//
242class ARMInstAlias<string Asm, dag Result, bit Emit = 0b1>
243 : InstAlias<Asm, Result, Emit>, Requires<[IsARM]>;
244class tInstAlias<string Asm, dag Result, bit Emit = 0b1>
245 : InstAlias<Asm, Result, Emit>, Requires<[IsThumb]>;
246class t2InstAlias<string Asm, dag Result, bit Emit = 0b1>
247 : InstAlias<Asm, Result, Emit>, Requires<[IsThumb2]>;
Jim Grosbach4ab23b52011-10-03 21:12:43 +0000248class VFP2InstAlias<string Asm, dag Result, bit Emit = 0b1>
249 : InstAlias<Asm, Result, Emit>, Requires<[HasVFP2]>;
250class VFP3InstAlias<string Asm, dag Result, bit Emit = 0b1>
251 : InstAlias<Asm, Result, Emit>, Requires<[HasVFP3]>;
Jim Grosbach0a978ef2011-12-05 19:55:46 +0000252class NEONInstAlias<string Asm, dag Result, bit Emit = 0b1>
253 : InstAlias<Asm, Result, Emit>, Requires<[HasNEON]>;
Jim Grosbach6caa5572011-08-22 18:04:24 +0000254
Jim Grosbach9227f392011-12-13 20:08:32 +0000255
256class VFP2MnemonicAlias<string src, string dst> : MnemonicAlias<src, dst>,
257 Requires<[HasVFP2]>;
258class NEONMnemonicAlias<string src, string dst> : MnemonicAlias<src, dst>,
259 Requires<[HasNEON]>;
260
Jim Grosbach6caa5572011-08-22 18:04:24 +0000261//===----------------------------------------------------------------------===//
Evan Cheng2d37f192008-08-28 23:39:26 +0000262// ARM Instruction templates.
263//
264
Jim Grosbach6caa5572011-08-22 18:04:24 +0000265
Owen Anderson651b2302011-07-13 23:22:26 +0000266class InstTemplate<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000267 Format f, Domain d, string cstr, InstrItinClass itin>
Evan Cheng2d37f192008-08-28 23:39:26 +0000268 : Instruction {
269 let Namespace = "ARM";
270
Evan Cheng2d37f192008-08-28 23:39:26 +0000271 AddrMode AM = am;
Owen Anderson651b2302011-07-13 23:22:26 +0000272 int Size = sz;
Evan Cheng2d37f192008-08-28 23:39:26 +0000273 IndexMode IM = im;
274 bits<2> IndexModeBits = IM.Value;
Evan Cheng2d37f192008-08-28 23:39:26 +0000275 Format F = f;
Bob Wilson69ba1bc2010-03-17 21:13:43 +0000276 bits<6> Form = F.Value;
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000277 Domain D = d;
Evan Cheng81889d012008-11-05 18:35:52 +0000278 bit isUnaryDataProc = 0;
Evan Cheng14965762009-07-08 01:46:35 +0000279 bit canXformTo16Bit = 0;
Jim Grosbach3e941ae2011-08-16 20:45:50 +0000280 // The instruction is a 16-bit flag setting Thumb instruction. Used
281 // by the parser to determine whether to require the 'S' suffix on the
282 // mnemonic (when not in an IT block) or preclude it (when in an IT block).
283 bit thumbArithFlagSetting = 0;
Jim Grosbach5876e412010-11-19 22:42:55 +0000284
Chris Lattner7ff33462010-10-31 19:22:57 +0000285 // If this is a pseudo instruction, mark it isCodeGenOnly.
286 let isCodeGenOnly = !eq(!cast<string>(f), "Pseudo");
Bob Wilson3968c6a2010-03-23 17:23:59 +0000287
Jim Grosbach30694dc2011-08-15 16:52:24 +0000288 // The layout of TSFlags should be kept in sync with ARMBaseInfo.h.
Jim Grosbache9298992010-10-05 18:14:55 +0000289 let TSFlags{4-0} = AM.Value;
Owen Anderson651b2302011-07-13 23:22:26 +0000290 let TSFlags{6-5} = IndexModeBits;
291 let TSFlags{12-7} = Form;
292 let TSFlags{13} = isUnaryDataProc;
293 let TSFlags{14} = canXformTo16Bit;
294 let TSFlags{17-15} = D.Value;
Jim Grosbach3e941ae2011-08-16 20:45:50 +0000295 let TSFlags{18} = thumbArithFlagSetting;
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000296
Evan Cheng2d37f192008-08-28 23:39:26 +0000297 let Constraints = cstr;
David Goodwinb062c232009-08-06 16:52:47 +0000298 let Itinerary = itin;
Evan Cheng2d37f192008-08-28 23:39:26 +0000299}
300
Johnny Chenc28e6292009-12-15 17:24:14 +0000301class Encoding {
302 field bits<32> Inst;
James Molloyd9ba4fd2012-02-09 10:56:31 +0000303 // Mask of bits that cause an encoding to be UNPREDICTABLE.
304 // If a bit is set, then if the corresponding bit in the
305 // target encoding differs from its value in the "Inst" field,
306 // the instruction is UNPREDICTABLE (SoftFail in abstract parlance).
307 field bits<32> Unpredictable = 0;
308 // SoftFail is the generic name for this field, but we alias it so
309 // as to make it more obvious what it means in ARM-land.
310 field bits<32> SoftFail = Unpredictable;
Johnny Chenc28e6292009-12-15 17:24:14 +0000311}
312
Owen Anderson651b2302011-07-13 23:22:26 +0000313class InstARM<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000314 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonc78e03c2011-07-19 21:06:00 +0000315 : InstTemplate<am, sz, im, f, d, cstr, itin>, Encoding {
316 let DecoderNamespace = "ARM";
317}
Johnny Chenc28e6292009-12-15 17:24:14 +0000318
319// This Encoding-less class is used by Thumb1 to specify the encoding bits later
320// on by adding flavors to specific instructions.
Owen Anderson651b2302011-07-13 23:22:26 +0000321class InstThumb<AddrMode am, int sz, IndexMode im,
Johnny Chenc28e6292009-12-15 17:24:14 +0000322 Format f, Domain d, string cstr, InstrItinClass itin>
Owen Andersonc78e03c2011-07-19 21:06:00 +0000323 : InstTemplate<am, sz, im, f, d, cstr, itin> {
324 let DecoderNamespace = "Thumb";
325}
Johnny Chenc28e6292009-12-15 17:24:14 +0000326
Jim Grosbachfb2f1d62011-11-01 01:24:45 +0000327// Pseudo-instructions for alternate assembly syntax (never used by codegen).
328// These are aliases that require C++ handling to convert to the target
329// instruction, while InstAliases can be handled directly by tblgen.
Jim Grosbach61db5a52011-11-10 16:44:55 +0000330class AsmPseudoInst<string asm, dag iops>
Jim Grosbachfb2f1d62011-11-01 01:24:45 +0000331 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo, GenericDomain,
332 "", NoItinerary> {
Jim Grosbach61db5a52011-11-10 16:44:55 +0000333 let OutOperandList = (outs);
Jim Grosbachfb2f1d62011-11-01 01:24:45 +0000334 let InOperandList = iops;
335 let Pattern = [];
336 let isCodeGenOnly = 0; // So we get asm matcher for it.
Jim Grosbach61db5a52011-11-10 16:44:55 +0000337 let AsmString = asm;
Jim Grosbachfb2f1d62011-11-01 01:24:45 +0000338 let isPseudo = 1;
339}
340
Jim Grosbach61db5a52011-11-10 16:44:55 +0000341class ARMAsmPseudo<string asm, dag iops> : AsmPseudoInst<asm, iops>,
342 Requires<[IsARM]>;
343class tAsmPseudo<string asm, dag iops> : AsmPseudoInst<asm, iops>,
344 Requires<[IsThumb]>;
345class t2AsmPseudo<string asm, dag iops> : AsmPseudoInst<asm, iops>,
346 Requires<[IsThumb2]>;
347class VFP2AsmPseudo<string asm, dag iops> : AsmPseudoInst<asm, iops>,
348 Requires<[HasVFP2]>;
349class NEONAsmPseudo<string asm, dag iops> : AsmPseudoInst<asm, iops>,
350 Requires<[HasNEON]>;
Jim Grosbachfb2f1d62011-11-01 01:24:45 +0000351
352// Pseudo instructions for the code generator.
Jim Grosbacha74c7ccd2010-11-18 01:38:26 +0000353class PseudoInst<dag oops, dag iops, InstrItinClass itin, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000354 : InstTemplate<AddrModeNone, 0, IndexModeNone, Pseudo,
Jim Grosbach7c301ea2011-07-06 21:35:46 +0000355 GenericDomain, "", itin> {
Evan Cheng2d37f192008-08-28 23:39:26 +0000356 let OutOperandList = oops;
357 let InOperandList = iops;
Evan Cheng2d37f192008-08-28 23:39:26 +0000358 let Pattern = pattern;
Jim Grosbache1756822011-03-10 19:06:39 +0000359 let isCodeGenOnly = 1;
Jim Grosbach7c301ea2011-07-06 21:35:46 +0000360 let isPseudo = 1;
Evan Cheng2d37f192008-08-28 23:39:26 +0000361}
362
Jim Grosbachcfb66202010-11-18 01:15:56 +0000363// PseudoInst that's ARM-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000364class ARMPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbacha74c7ccd2010-11-18 01:38:26 +0000365 list<dag> pattern>
366 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000367 let Size = sz;
Jim Grosbachcfb66202010-11-18 01:15:56 +0000368 list<Predicate> Predicates = [IsARM];
369}
370
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000371// PseudoInst that's Thumb-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000372class tPseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000373 list<dag> pattern>
374 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000375 let Size = sz;
Jim Grosbach58bc36a2010-11-29 19:32:47 +0000376 list<Predicate> Predicates = [IsThumb];
377}
Jim Grosbachcfb66202010-11-18 01:15:56 +0000378
Jim Grosbachd42257c2010-12-15 18:48:45 +0000379// PseudoInst that's Thumb2-mode only.
Owen Anderson651b2302011-07-13 23:22:26 +0000380class t2PseudoInst<dag oops, dag iops, int sz, InstrItinClass itin,
Jim Grosbachd42257c2010-12-15 18:48:45 +0000381 list<dag> pattern>
382 : PseudoInst<oops, iops, itin, pattern> {
Owen Anderson651b2302011-07-13 23:22:26 +0000383 let Size = sz;
Jim Grosbachd42257c2010-12-15 18:48:45 +0000384 list<Predicate> Predicates = [IsThumb2];
385}
Jim Grosbach95dee402011-07-08 17:40:42 +0000386
Owen Anderson651b2302011-07-13 23:22:26 +0000387class ARMPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000388 InstrItinClass itin, list<dag> pattern,
389 dag Result>
390 : ARMPseudoInst<oops, iops, sz, itin, pattern>,
391 PseudoInstExpansion<Result>;
392
Owen Anderson651b2302011-07-13 23:22:26 +0000393class tPseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000394 InstrItinClass itin, list<dag> pattern,
395 dag Result>
396 : tPseudoInst<oops, iops, sz, itin, pattern>,
397 PseudoInstExpansion<Result>;
398
Owen Anderson651b2302011-07-13 23:22:26 +0000399class t2PseudoExpand<dag oops, dag iops, int sz,
Jim Grosbach95dee402011-07-08 17:40:42 +0000400 InstrItinClass itin, list<dag> pattern,
401 dag Result>
402 : t2PseudoInst<oops, iops, sz, itin, pattern>,
403 PseudoInstExpansion<Result>;
404
Evan Cheng2d37f192008-08-28 23:39:26 +0000405// Almost all ARM instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +0000406class I<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000407 IndexMode im, Format f, InstrItinClass itin,
David Goodwinb062c232009-08-06 16:52:47 +0000408 string opc, string asm, string cstr,
Evan Cheng2d37f192008-08-28 23:39:26 +0000409 list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000410 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach5476a272010-10-11 18:51:51 +0000411 bits<4> p;
412 let Inst{31-28} = p;
Evan Cheng2d37f192008-08-28 23:39:26 +0000413 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000414 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +0000415 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng2d37f192008-08-28 23:39:26 +0000416 let Pattern = pattern;
417 list<Predicate> Predicates = [IsARM];
418}
Bill Wendlingb70dc872010-08-31 07:50:46 +0000419
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000420// A few are not predicable
Owen Anderson651b2302011-07-13 23:22:26 +0000421class InoP<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000422 IndexMode im, Format f, InstrItinClass itin,
423 string opc, string asm, string cstr,
424 list<dag> pattern>
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000425 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
426 let OutOperandList = oops;
427 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000428 let AsmString = !strconcat(opc, asm);
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000429 let Pattern = pattern;
430 let isPredicable = 0;
431 list<Predicate> Predicates = [IsARM];
432}
Evan Cheng2d37f192008-08-28 23:39:26 +0000433
Bill Wendlingf8dfa462010-08-30 01:47:35 +0000434// Same as I except it can optionally modify CPSR. Note it's modeled as an input
435// operand since by default it's a zero register. It will become an implicit def
436// once it's "flipped".
Owen Anderson651b2302011-07-13 23:22:26 +0000437class sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000438 IndexMode im, Format f, InstrItinClass itin,
439 string opc, string asm, string cstr,
Evan Cheng2d37f192008-08-28 23:39:26 +0000440 list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000441 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Jim Grosbach5476a272010-10-11 18:51:51 +0000442 bits<4> p; // Predicate operand
Jim Grosbachd9d31da2010-10-12 23:00:24 +0000443 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
Jim Grosbach5476a272010-10-11 18:51:51 +0000444 let Inst{31-28} = p;
Jim Grosbachd9d31da2010-10-12 23:00:24 +0000445 let Inst{20} = s;
Jim Grosbach5476a272010-10-11 18:51:51 +0000446
Evan Cheng2d37f192008-08-28 23:39:26 +0000447 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +0000448 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Bob Wilson59351842010-10-15 03:23:44 +0000449 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Cheng2d37f192008-08-28 23:39:26 +0000450 let Pattern = pattern;
451 list<Predicate> Predicates = [IsARM];
452}
453
Evan Chenga2827232008-09-01 07:19:00 +0000454// Special cases
Owen Anderson651b2302011-07-13 23:22:26 +0000455class XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000456 IndexMode im, Format f, InstrItinClass itin,
457 string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +0000458 : InstARM<am, sz, im, f, GenericDomain, cstr, itin> {
Evan Chenga2827232008-09-01 07:19:00 +0000459 let OutOperandList = oops;
460 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000461 let AsmString = asm;
Evan Chenga2827232008-09-01 07:19:00 +0000462 let Pattern = pattern;
463 list<Predicate> Predicates = [IsARM];
464}
465
David Goodwinb062c232009-08-06 16:52:47 +0000466class AI<dag oops, dag iops, Format f, InstrItinClass itin,
467 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000468 : I<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000469 opc, asm, "", pattern>;
470class AsI<dag oops, dag iops, Format f, InstrItinClass itin,
471 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000472 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000473 opc, asm, "", pattern>;
474class AXI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng2d37f192008-08-28 23:39:26 +0000475 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000476 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Evan Cheng49d66522008-11-06 22:15:19 +0000477 asm, "", pattern>;
Jim Grosbach5e0d2a22009-12-14 18:31:20 +0000478class AInoP<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000479 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000480 : InoP<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000481 opc, asm, "", pattern>;
Evan Chengfa558782008-09-01 08:25:56 +0000482
483// Ctrl flow instructions
David Goodwinb062c232009-08-06 16:52:47 +0000484class ABI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
485 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000486 : I<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000487 opc, asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000488 let Inst{27-24} = opcod;
Evan Chengfa558782008-09-01 08:25:56 +0000489}
David Goodwinb062c232009-08-06 16:52:47 +0000490class ABXI<bits<4> opcod, dag oops, dag iops, InstrItinClass itin,
491 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000492 : XI<oops, iops, AddrModeNone, 4, IndexModeNone, BrFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000493 asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000494 let Inst{27-24} = opcod;
Evan Chengfa558782008-09-01 08:25:56 +0000495}
Evan Chengfa558782008-09-01 08:25:56 +0000496
497// BR_JT instructions
David Goodwinb062c232009-08-06 16:52:47 +0000498class JTI<dag oops, dag iops, InstrItinClass itin,
499 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000500 : XI<oops, iops, AddrModeNone, 0, IndexModeNone, BrMiscFrm, itin,
Evan Cheng7095cd22008-11-07 09:06:08 +0000501 asm, "", pattern>;
Evan Cheng624844b2008-09-01 01:51:14 +0000502
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000503// Atomic load/store instructions
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000504class AIldrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
505 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000506 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000507 opc, asm, "", pattern> {
Jim Grosbach4e57b522010-10-29 19:58:57 +0000508 bits<4> Rt;
Jim Grosbachcb311932011-07-26 17:44:46 +0000509 bits<4> addr;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000510 let Inst{27-23} = 0b00011;
511 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000512 let Inst{20} = 1;
Jim Grosbachcb311932011-07-26 17:44:46 +0000513 let Inst{19-16} = addr;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000514 let Inst{15-12} = Rt;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000515 let Inst{11-0} = 0b111110011111;
516}
517class AIstrex<bits<2> opcod, dag oops, dag iops, InstrItinClass itin,
518 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000519 : I<oops, iops, AddrModeNone, 4, IndexModeNone, LdStExFrm, itin,
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000520 opc, asm, "", pattern> {
Jim Grosbach4e57b522010-10-29 19:58:57 +0000521 bits<4> Rd;
522 bits<4> Rt;
Bruno Cardoso Lopesf170f8b2011-03-24 21:04:58 +0000523 bits<4> addr;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000524 let Inst{27-23} = 0b00011;
525 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000526 let Inst{20} = 0;
Bruno Cardoso Lopesf170f8b2011-03-24 21:04:58 +0000527 let Inst{19-16} = addr;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000528 let Inst{15-12} = Rd;
Johnny Chen098bd1b2009-12-11 19:37:26 +0000529 let Inst{11-4} = 0b11111001;
Jim Grosbach4e57b522010-10-29 19:58:57 +0000530 let Inst{3-0} = Rt;
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000531}
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000532class AIswp<bit b, dag oops, dag iops, string opc, list<dag> pattern>
Jim Grosbach15e8d742011-07-26 17:15:11 +0000533 : AI<oops, iops, MiscFrm, NoItinerary, opc, "\t$Rt, $Rt2, $addr", pattern> {
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000534 bits<4> Rt;
535 bits<4> Rt2;
Jim Grosbach15e8d742011-07-26 17:15:11 +0000536 bits<4> addr;
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000537 let Inst{27-23} = 0b00010;
538 let Inst{22} = b;
539 let Inst{21-20} = 0b00;
Jim Grosbach15e8d742011-07-26 17:15:11 +0000540 let Inst{19-16} = addr;
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000541 let Inst{15-12} = Rt;
542 let Inst{11-4} = 0b00001001;
543 let Inst{3-0} = Rt2;
Owen Andersondde461c2011-10-28 18:02:13 +0000544
Silviu Barangaca45af92012-04-18 14:18:57 +0000545 let Unpredictable{11-8} = 0b1111;
Owen Andersondde461c2011-10-28 18:02:13 +0000546 let DecoderMethod = "DecodeSwap";
Jim Grosbach3b7e05b2010-10-29 20:21:36 +0000547}
Jim Grosbach5c4e99f2009-12-11 01:42:04 +0000548
Evan Cheng624844b2008-09-01 01:51:14 +0000549// addrmode1 instructions
David Goodwinb062c232009-08-06 16:52:47 +0000550class AI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
551 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000552 : I<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000553 opc, asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000554 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000555 let Inst{27-26} = 0b00;
Evan Chengc139c222008-08-29 07:40:52 +0000556}
David Goodwinb062c232009-08-06 16:52:47 +0000557class AsI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
558 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000559 : sI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000560 opc, asm, "", pattern> {
561 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000562 let Inst{27-26} = 0b00;
David Goodwinb062c232009-08-06 16:52:47 +0000563}
564class AXI1<bits<4> opcod, dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng2d37f192008-08-28 23:39:26 +0000565 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000566 : XI<oops, iops, AddrMode1, 4, IndexModeNone, f, itin,
Evan Chengc139c222008-08-29 07:40:52 +0000567 asm, "", pattern> {
Jim Grosbachb7c01f52008-10-14 20:36:24 +0000568 let Inst{24-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000569 let Inst{27-26} = 0b00;
Evan Chengc139c222008-08-29 07:40:52 +0000570}
Evan Cheng624844b2008-09-01 01:51:14 +0000571
Evan Chengcccca872008-09-01 01:27:33 +0000572// loads
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000573
Jim Grosbach4a22eba2010-11-19 21:07:51 +0000574// LDR/LDRB/STR/STRB/...
575class AI2ldst<bits<3> op, bit isLd, bit isByte, dag oops, dag iops, AddrMode am,
Jim Grosbach338de3e2010-10-27 23:12:14 +0000576 Format f, InstrItinClass itin, string opc, string asm,
577 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000578 : I<oops, iops, am, 4, IndexModeNone, f, itin, opc, asm,
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000579 "", pattern> {
580 let Inst{27-25} = op;
581 let Inst{24} = 1; // 24 == P
582 // 23 == U
Jim Grosbach2f790742010-11-13 00:35:48 +0000583 let Inst{22} = isByte;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000584 let Inst{21} = 0; // 21 == W
Jim Grosbach338de3e2010-10-27 23:12:14 +0000585 let Inst{20} = isLd;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000586}
Jim Grosbach2f790742010-11-13 00:35:48 +0000587// Indexed load/stores
588class AI2ldstidx<bit isLd, bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000589 IndexMode im, Format f, InstrItinClass itin, string opc,
Jim Grosbach2f790742010-11-13 00:35:48 +0000590 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000591 : I<oops, iops, AddrMode2, 4, im, f, itin,
Jim Grosbach2f790742010-11-13 00:35:48 +0000592 opc, asm, cstr, pattern> {
Jim Grosbach38b469e2010-11-15 20:47:07 +0000593 bits<4> Rt;
Jim Grosbach2f790742010-11-13 00:35:48 +0000594 let Inst{27-26} = 0b01;
595 let Inst{24} = isPre; // P bit
596 let Inst{22} = isByte; // B bit
597 let Inst{21} = isPre; // W bit
598 let Inst{20} = isLd; // L bit
Jim Grosbach38b469e2010-11-15 20:47:07 +0000599 let Inst{15-12} = Rt;
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000600}
Owen Anderson2aedba62011-07-26 20:54:26 +0000601class AI2stridx_reg<bit isByte, bit isPre, dag oops, dag iops,
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000602 IndexMode im, Format f, InstrItinClass itin, string opc,
603 string asm, string cstr, list<dag> pattern>
604 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
605 pattern> {
606 // AM2 store w/ two operands: (GPR, am2offset)
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000607 // {12} isAdd
608 // {11-0} imm12/Rm
Bruno Cardoso Lopesc2452a62011-03-31 15:54:36 +0000609 bits<14> offset;
610 bits<4> Rn;
Owen Anderson2aedba62011-07-26 20:54:26 +0000611 let Inst{25} = 1;
612 let Inst{23} = offset{12};
613 let Inst{19-16} = Rn;
614 let Inst{11-5} = offset{11-5};
615 let Inst{4} = 0;
616 let Inst{3-0} = offset{3-0};
617}
618
619class AI2stridx_imm<bit isByte, bit isPre, dag oops, dag iops,
620 IndexMode im, Format f, InstrItinClass itin, string opc,
621 string asm, string cstr, list<dag> pattern>
622 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
623 pattern> {
624 // AM2 store w/ two operands: (GPR, am2offset)
625 // {12} isAdd
626 // {11-0} imm12/Rm
627 bits<14> offset;
628 bits<4> Rn;
629 let Inst{25} = 0;
Bruno Cardoso Lopesc2452a62011-03-31 15:54:36 +0000630 let Inst{23} = offset{12};
631 let Inst{19-16} = Rn;
632 let Inst{11-0} = offset{11-0};
Jim Grosbach6e9aace2010-11-19 21:35:06 +0000633}
Owen Anderson2aedba62011-07-26 20:54:26 +0000634
635
Bruno Cardoso Lopesab830502011-03-31 23:26:08 +0000636// FIXME: Merge with the above class when addrmode2 gets used for STR, STRB
637// but for now use this class for STRT and STRBT.
638class AI2stridxT<bit isByte, bit isPre, dag oops, dag iops,
639 IndexMode im, Format f, InstrItinClass itin, string opc,
640 string asm, string cstr, list<dag> pattern>
641 : AI2ldstidx<0, isByte, isPre, oops, iops, im, f, itin, opc, asm, cstr,
642 pattern> {
643 // AM2 store w/ two operands: (GPR, am2offset)
644 // {17-14} Rn
645 // {13} 1 == Rm, 0 == imm12
646 // {12} isAdd
647 // {11-0} imm12/Rm
648 bits<18> addr;
649 let Inst{25} = addr{13};
650 let Inst{23} = addr{12};
651 let Inst{19-16} = addr{17-14};
652 let Inst{11-0} = addr{11-0};
653}
Jim Grosbach1e4d9a12010-10-26 22:37:02 +0000654
Evan Cheng624844b2008-09-01 01:51:14 +0000655// addrmode3 instructions
Jim Grosbach76aed402010-11-19 18:16:46 +0000656class AI3ld<bits<4> op, bit op20, dag oops, dag iops, Format f,
657 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000658 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
Jim Grosbach8e7f8df2010-11-18 00:46:58 +0000659 opc, asm, "", pattern> {
660 bits<14> addr;
661 bits<4> Rt;
662 let Inst{27-25} = 0b000;
663 let Inst{24} = 1; // P bit
664 let Inst{23} = addr{8}; // U bit
665 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
666 let Inst{21} = 0; // W bit
Jim Grosbach76aed402010-11-19 18:16:46 +0000667 let Inst{20} = op20; // L bit
Jim Grosbach8e7f8df2010-11-18 00:46:58 +0000668 let Inst{19-16} = addr{12-9}; // Rn
669 let Inst{15-12} = Rt; // Rt
670 let Inst{11-8} = addr{7-4}; // imm7_4/zero
671 let Inst{7-4} = op;
672 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Owen Andersone0152a72011-08-09 20:55:18 +0000673
674 let DecoderMethod = "DecodeAddrMode3Instruction";
Jim Grosbach8e7f8df2010-11-18 00:46:58 +0000675}
Evan Cheng169eccc2008-09-01 07:00:14 +0000676
Jim Grosbach2ea19d12011-08-11 20:41:13 +0000677class AI3ldstidx<bits<4> op, bit op20, bit isPre, dag oops, dag iops,
Jim Grosbach003c6e72010-11-19 19:41:26 +0000678 IndexMode im, Format f, InstrItinClass itin, string opc,
679 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000680 : I<oops, iops, AddrMode3, 4, im, f, itin,
Jim Grosbach003c6e72010-11-19 19:41:26 +0000681 opc, asm, cstr, pattern> {
682 bits<4> Rt;
683 let Inst{27-25} = 0b000;
684 let Inst{24} = isPre; // P bit
685 let Inst{21} = isPre; // W bit
686 let Inst{20} = op20; // L bit
687 let Inst{15-12} = Rt; // Rt
688 let Inst{7-4} = op;
689}
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000690
691// FIXME: Merge with the above class when addrmode2 gets used for LDR, LDRB
692// but for now use this class for LDRSBT, LDRHT, LDSHT.
Jim Grosbachd3595712011-08-03 23:50:40 +0000693class AI3ldstidxT<bits<4> op, bit isLoad, dag oops, dag iops,
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000694 IndexMode im, Format f, InstrItinClass itin, string opc,
695 string asm, string cstr, list<dag> pattern>
Jim Grosbachd3595712011-08-03 23:50:40 +0000696 : I<oops, iops, AddrMode3, 4, im, f, itin, 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
Jim Grosbachd3595712011-08-03 23:50:40 +0000702 bits<4> addr;
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000703 bits<4> Rt;
704 let Inst{27-25} = 0b000;
Jim Grosbachd3595712011-08-03 23:50:40 +0000705 let Inst{24} = 0; // P bit
706 let Inst{21} = 1;
707 let Inst{20} = isLoad; // L bit
708 let Inst{19-16} = addr; // Rn
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000709 let Inst{15-12} = Rt; // Rt
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000710 let Inst{7-4} = op;
Bruno Cardoso Lopesbda36322011-04-04 17:18:19 +0000711}
712
Evan Cheng169eccc2008-09-01 07:00:14 +0000713// stores
Jim Grosbach09d7bfd2010-11-19 22:14:31 +0000714class AI3str<bits<4> op, dag oops, dag iops, Format f, InstrItinClass itin,
David Goodwinb062c232009-08-06 16:52:47 +0000715 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000716 : I<oops, iops, AddrMode3, 4, IndexModeNone, f, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000717 opc, asm, "", pattern> {
Jim Grosbach607efcb2010-11-11 01:09:40 +0000718 bits<14> addr;
719 bits<4> Rt;
Evan Cheng5edd90c2009-07-08 22:51:32 +0000720 let Inst{27-25} = 0b000;
Jim Grosbach607efcb2010-11-11 01:09:40 +0000721 let Inst{24} = 1; // P bit
722 let Inst{23} = addr{8}; // U bit
723 let Inst{22} = addr{13}; // 1 == imm8, 0 == Rm
724 let Inst{21} = 0; // W bit
725 let Inst{20} = 0; // L bit
726 let Inst{19-16} = addr{12-9}; // Rn
727 let Inst{15-12} = Rt; // Rt
728 let Inst{11-8} = addr{7-4}; // imm7_4/zero
Jim Grosbach09d7bfd2010-11-19 22:14:31 +0000729 let Inst{7-4} = op;
Jim Grosbach607efcb2010-11-11 01:09:40 +0000730 let Inst{3-0} = addr{3-0}; // imm3_0/Rm
Owen Anderson60138ea2011-08-12 20:02:50 +0000731 let DecoderMethod = "DecodeAddrMode3Instruction";
Evan Cheng169eccc2008-09-01 07:00:14 +0000732}
Evan Cheng169eccc2008-09-01 07:00:14 +0000733
Evan Cheng624844b2008-09-01 01:51:14 +0000734// addrmode4 instructions
Bill Wendlinge69afc62010-11-13 09:09:38 +0000735class AXI4<dag oops, dag iops, IndexMode im, Format f, InstrItinClass itin,
736 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000737 : XI<oops, iops, AddrMode4, 4, im, f, itin, asm, cstr, pattern> {
Bill Wendlinge69afc62010-11-13 09:09:38 +0000738 bits<4> p;
739 bits<16> regs;
740 bits<4> Rn;
741 let Inst{31-28} = p;
742 let Inst{27-25} = 0b100;
743 let Inst{22} = 0; // S bit
744 let Inst{19-16} = Rn;
745 let Inst{15-0} = regs;
746}
Evan Cheng2d37f192008-08-28 23:39:26 +0000747
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000748// Unsigned multiply, multiply-accumulate instructions.
David Goodwinb062c232009-08-06 16:52:47 +0000749class AMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
750 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000751 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000752 opc, asm, "", pattern> {
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000753 let Inst{7-4} = 0b1001;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000754 let Inst{20} = 0; // S bit
Evan Cheng47b546d2008-11-06 08:47:38 +0000755 let Inst{27-21} = opcod;
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000756}
David Goodwinb062c232009-08-06 16:52:47 +0000757class AsMul1I<bits<7> opcod, dag oops, dag iops, InstrItinClass itin,
758 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000759 : sI<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000760 opc, asm, "", pattern> {
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000761 let Inst{7-4} = 0b1001;
Evan Cheng47b546d2008-11-06 08:47:38 +0000762 let Inst{27-21} = opcod;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000763}
764
765// Most significant word multiply
Jim Grosbach22261602010-10-22 17:16:17 +0000766class AMul2I<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
767 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000768 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000769 opc, asm, "", pattern> {
Jim Grosbach22261602010-10-22 17:16:17 +0000770 bits<4> Rd;
771 bits<4> Rn;
772 bits<4> Rm;
773 let Inst{7-4} = opc7_4;
Evan Cheng2686c8f2008-11-06 01:21:28 +0000774 let Inst{20} = 1;
Evan Cheng47b546d2008-11-06 08:47:38 +0000775 let Inst{27-21} = opcod;
Jim Grosbach22261602010-10-22 17:16:17 +0000776 let Inst{19-16} = Rd;
777 let Inst{11-8} = Rm;
778 let Inst{3-0} = Rn;
779}
780// MSW multiple w/ Ra operand
781class AMul2Ia<bits<7> opcod, bits<4> opc7_4, dag oops, dag iops,
782 InstrItinClass itin, string opc, string asm, list<dag> pattern>
783 : AMul2I<opcod, opc7_4, oops, iops, itin, opc, asm, pattern> {
784 bits<4> Ra;
785 let Inst{15-12} = Ra;
Jim Grosbach4d0549e2008-11-03 18:38:31 +0000786}
Evan Cheng2d37f192008-08-28 23:39:26 +0000787
Evan Cheng36ae4032008-11-06 03:35:07 +0000788// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Jim Grosbach6956a602010-10-22 18:35:16 +0000789class AMulxyIbase<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
Jim Grosbachf98df082010-10-22 17:42:06 +0000790 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000791 : I<oops, iops, AddrModeNone, 4, IndexModeNone, MulFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000792 opc, asm, "", pattern> {
Jim Grosbach6956a602010-10-22 18:35:16 +0000793 bits<4> Rn;
794 bits<4> Rm;
Evan Cheng36ae4032008-11-06 03:35:07 +0000795 let Inst{4} = 0;
796 let Inst{7} = 1;
797 let Inst{20} = 0;
Evan Cheng47b546d2008-11-06 08:47:38 +0000798 let Inst{27-21} = opcod;
Jim Grosbachf98df082010-10-22 17:42:06 +0000799 let Inst{6-5} = bit6_5;
Jim Grosbach6956a602010-10-22 18:35:16 +0000800 let Inst{11-8} = Rm;
801 let Inst{3-0} = Rn;
802}
803class AMulxyI<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
804 InstrItinClass itin, string opc, string asm, list<dag> pattern>
805 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
806 bits<4> Rd;
807 let Inst{19-16} = Rd;
808}
809
810// AMulxyI with Ra operand
811class AMulxyIa<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
812 InstrItinClass itin, string opc, string asm, list<dag> pattern>
813 : AMulxyI<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
814 bits<4> Ra;
815 let Inst{15-12} = Ra;
816}
817// SMLAL*
818class AMulxyI64<bits<7> opcod, bits<2> bit6_5, dag oops, dag iops,
819 InstrItinClass itin, string opc, string asm, list<dag> pattern>
820 : AMulxyIbase<opcod, bit6_5, oops, iops, itin, opc, asm, pattern> {
821 bits<4> RdLo;
822 bits<4> RdHi;
823 let Inst{19-16} = RdHi;
824 let Inst{15-12} = RdLo;
Evan Cheng36ae4032008-11-06 03:35:07 +0000825}
826
Evan Cheng49d66522008-11-06 22:15:19 +0000827// Extend instructions.
David Goodwinb062c232009-08-06 16:52:47 +0000828class AExtI<bits<8> opcod, dag oops, dag iops, InstrItinClass itin,
829 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000830 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ExtFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000831 opc, asm, "", pattern> {
Jim Grosbach1e7db682010-10-13 19:56:10 +0000832 // All AExtI instructions have Rd and Rm register operands.
833 bits<4> Rd;
834 bits<4> Rm;
835 let Inst{15-12} = Rd;
836 let Inst{3-0} = Rm;
Evan Cheng49d66522008-11-06 22:15:19 +0000837 let Inst{7-4} = 0b0111;
Jim Grosbach1e7db682010-10-13 19:56:10 +0000838 let Inst{9-8} = 0b00;
Evan Cheng49d66522008-11-06 22:15:19 +0000839 let Inst{27-20} = opcod;
Silviu Barangaddc67a72012-05-11 09:28:27 +0000840
841 let Unpredictable{9-8} = 0b11;
Evan Cheng49d66522008-11-06 22:15:19 +0000842}
843
Evan Cheng98dc53e2008-11-07 01:41:35 +0000844// Misc Arithmetic instructions.
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000845class AMiscA1I<bits<8> opcod, bits<4> opc7_4, dag oops, dag iops,
846 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000847 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
David Goodwinb062c232009-08-06 16:52:47 +0000848 opc, asm, "", pattern> {
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000849 bits<4> Rd;
850 bits<4> Rm;
Evan Cheng98dc53e2008-11-07 01:41:35 +0000851 let Inst{27-20} = opcod;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000852 let Inst{19-16} = 0b1111;
853 let Inst{15-12} = Rd;
854 let Inst{11-8} = 0b1111;
855 let Inst{7-4} = opc7_4;
856 let Inst{3-0} = Rm;
857}
858
Bob Wilsone8a549c2012-09-29 21:43:49 +0000859// Division instructions.
860class ADivA1I<bits<3> opcod, dag oops, dag iops,
861 InstrItinClass itin, string opc, string asm, list<dag> pattern>
862 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
863 opc, asm, "", pattern> {
864 bits<4> Rd;
865 bits<4> Rn;
866 bits<4> Rm;
867 let Inst{27-23} = 0b01110;
868 let Inst{22-20} = opcod;
869 let Inst{19-16} = Rd;
870 let Inst{15-12} = 0b1111;
871 let Inst{11-8} = Rm;
872 let Inst{7-4} = 0b0001;
873 let Inst{3-0} = Rn;
874}
875
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000876// PKH instructions
Jim Grosbach3a3d8e82011-11-12 00:58:43 +0000877def PKHLSLAsmOperand : ImmAsmOperand {
Jim Grosbach27c1e252011-07-21 17:23:04 +0000878 let Name = "PKHLSLImm";
879 let ParserMethod = "parsePKHLSLImm";
880}
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000881def pkh_lsl_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm >= 0 && Imm < 32; }]>{
882 let PrintMethod = "printPKHLSLShiftImm";
Jim Grosbach27c1e252011-07-21 17:23:04 +0000883 let ParserMatchClass = PKHLSLAsmOperand;
884}
885def PKHASRAsmOperand : AsmOperandClass {
886 let Name = "PKHASRImm";
887 let ParserMethod = "parsePKHASRImm";
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000888}
889def pkh_asr_amt: Operand<i32>, ImmLeaf<i32, [{ return Imm > 0 && Imm <= 32; }]>{
890 let PrintMethod = "printPKHASRShiftImm";
Jim Grosbach27c1e252011-07-21 17:23:04 +0000891 let ParserMatchClass = PKHASRAsmOperand;
Jim Grosbacha288b1c2011-07-20 21:40:26 +0000892}
Jim Grosbach94df3be2011-07-20 20:49:03 +0000893
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000894class APKHI<bits<8> opcod, bit tb, dag oops, dag iops, InstrItinClass itin,
895 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000896 : I<oops, iops, AddrModeNone, 4, IndexModeNone, ArithMiscFrm, itin,
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000897 opc, asm, "", pattern> {
898 bits<4> Rd;
899 bits<4> Rn;
900 bits<4> Rm;
Jim Grosbacha98f8002011-07-20 20:32:09 +0000901 bits<5> sh;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000902 let Inst{27-20} = opcod;
903 let Inst{19-16} = Rn;
904 let Inst{15-12} = Rd;
Jim Grosbacha98f8002011-07-20 20:32:09 +0000905 let Inst{11-7} = sh;
Jim Grosbach2c9ae052010-10-22 22:12:16 +0000906 let Inst{6} = tb;
907 let Inst{5-4} = 0b01;
908 let Inst{3-0} = Rm;
Evan Cheng98dc53e2008-11-07 01:41:35 +0000909}
910
Evan Cheng2d37f192008-08-28 23:39:26 +0000911//===----------------------------------------------------------------------===//
912
913// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
914class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
915 list<Predicate> Predicates = [IsARM];
916}
Bruno Cardoso Lopes168c9002011-05-03 17:29:22 +0000917class ARMV5TPat<dag pattern, dag result> : Pat<pattern, result> {
918 list<Predicate> Predicates = [IsARM, HasV5T];
919}
Evan Cheng2d37f192008-08-28 23:39:26 +0000920class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
921 list<Predicate> Predicates = [IsARM, HasV5TE];
922}
Bob Wilsone8a549c2012-09-29 21:43:49 +0000923// ARMV5MOPat - Same as ARMV5TEPat with UseMulOps.
924class ARMV5MOPat<dag pattern, dag result> : Pat<pattern, result> {
925 list<Predicate> Predicates = [IsARM, HasV5TE, UseMulOps];
926}
Evan Cheng2d37f192008-08-28 23:39:26 +0000927class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
928 list<Predicate> Predicates = [IsARM, HasV6];
929}
Evan Chengee98fa92008-08-29 06:41:12 +0000930
931//===----------------------------------------------------------------------===//
Evan Chengee98fa92008-08-29 06:41:12 +0000932// Thumb Instruction Format Definitions.
933//
934
Owen Anderson651b2302011-07-13 23:22:26 +0000935class ThumbI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000936 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000937 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +0000938 let OutOperandList = oops;
939 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000940 let AsmString = asm;
Evan Chengee98fa92008-08-29 06:41:12 +0000941 let Pattern = pattern;
942 list<Predicate> Predicates = [IsThumb];
943}
944
Bill Wendlingcbb08ca2010-12-01 02:42:55 +0000945// TI - Thumb instruction.
David Goodwinb062c232009-08-06 16:52:47 +0000946class TI<dag oops, dag iops, InstrItinClass itin, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000947 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
Evan Chengee98fa92008-08-29 06:41:12 +0000948
Evan Cheng7cc6aca2009-08-04 23:47:55 +0000949// Two-address instructions
Bob Wilson3968c6a2010-03-23 17:23:59 +0000950class TIt<dag oops, dag iops, InstrItinClass itin, string asm,
951 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000952 : ThumbI<oops, iops, AddrModeNone, 2, itin, asm, "$lhs = $dst",
Bob Wilson3968c6a2010-03-23 17:23:59 +0000953 pattern>;
Evan Cheng7cc6aca2009-08-04 23:47:55 +0000954
Johnny Chenc28e6292009-12-15 17:24:14 +0000955// tBL, tBX 32-bit instructions
956class TIx2<bits<5> opcod1, bits<2> opcod2, bit opcod3,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000957 dag oops, dag iops, InstrItinClass itin, string asm,
958 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000959 : ThumbI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>,
Bob Wilson3968c6a2010-03-23 17:23:59 +0000960 Encoding {
Johnny Chenc28e6292009-12-15 17:24:14 +0000961 let Inst{31-27} = opcod1;
962 let Inst{15-14} = opcod2;
Bill Wendlingb70dc872010-08-31 07:50:46 +0000963 let Inst{12} = opcod3;
Johnny Chenc28e6292009-12-15 17:24:14 +0000964}
Evan Chengee98fa92008-08-29 06:41:12 +0000965
966// BR_JT instructions
Bob Wilson3968c6a2010-03-23 17:23:59 +0000967class TJTI<dag oops, dag iops, InstrItinClass itin, string asm,
968 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000969 : ThumbI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Chengee98fa92008-08-29 06:41:12 +0000970
Evan Chengbec1dba892009-06-23 19:38:13 +0000971// Thumb1 only
Owen Anderson651b2302011-07-13 23:22:26 +0000972class Thumb1I<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000973 InstrItinClass itin, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000974 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +0000975 let OutOperandList = oops;
976 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +0000977 let AsmString = asm;
Evan Chengbec1dba892009-06-23 19:38:13 +0000978 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +0000979 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Chengbec1dba892009-06-23 19:38:13 +0000980}
981
David Goodwinb062c232009-08-06 16:52:47 +0000982class T1I<dag oops, dag iops, InstrItinClass itin,
983 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000984 : Thumb1I<oops, iops, AddrModeNone, 2, itin, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +0000985class T1Ix2<dag oops, dag iops, InstrItinClass itin,
986 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000987 : Thumb1I<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
Evan Chengbec1dba892009-06-23 19:38:13 +0000988
989// Two-address instructions
David Goodwinb062c232009-08-06 16:52:47 +0000990class T1It<dag oops, dag iops, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +0000991 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +0000992 : Thumb1I<oops, iops, AddrModeNone, 2, itin,
Bob Wilson947f04b2010-03-13 01:08:20 +0000993 asm, cstr, pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +0000994
995// Thumb1 instruction that can either be predicated or set CPSR.
Owen Anderson651b2302011-07-13 23:22:26 +0000996class Thumb1sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +0000997 InstrItinClass itin,
Evan Chengcd4cdd12009-07-11 06:43:01 +0000998 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +0000999 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001000 let OutOperandList = !con(oops, (outs s_cc_out:$s));
1001 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001002 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Chengcd4cdd12009-07-11 06:43:01 +00001003 let Pattern = pattern;
Jim Grosbach3e941ae2011-08-16 20:45:50 +00001004 let thumbArithFlagSetting = 1;
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001005 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Anderson91a8f9b2011-08-16 23:45:44 +00001006 let DecoderNamespace = "ThumbSBit";
Evan Chengcd4cdd12009-07-11 06:43:01 +00001007}
1008
David Goodwinb062c232009-08-06 16:52:47 +00001009class T1sI<dag oops, dag iops, InstrItinClass itin,
1010 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001011 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +00001012
1013// Two-address instructions
David Goodwinb062c232009-08-06 16:52:47 +00001014class T1sIt<dag oops, dag iops, InstrItinClass itin,
1015 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001016 : Thumb1sI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling05632cb2010-11-30 23:54:45 +00001017 "$Rn = $Rdn", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +00001018
1019// Thumb1 instruction that can be predicated.
Owen Anderson651b2302011-07-13 23:22:26 +00001020class Thumb1pI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001021 InstrItinClass itin,
Evan Chengcd4cdd12009-07-11 06:43:01 +00001022 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chenc28e6292009-12-15 17:24:14 +00001023 : InstThumb<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengcd4cdd12009-07-11 06:43:01 +00001024 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001025 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001026 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chengcd4cdd12009-07-11 06:43:01 +00001027 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001028 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Evan Chengcd4cdd12009-07-11 06:43:01 +00001029}
1030
David Goodwinb062c232009-08-06 16:52:47 +00001031class T1pI<dag oops, dag iops, InstrItinClass itin,
1032 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001033 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm, "", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +00001034
1035// Two-address instructions
David Goodwinb062c232009-08-06 16:52:47 +00001036class T1pIt<dag oops, dag iops, InstrItinClass itin,
1037 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001038 : Thumb1pI<oops, iops, AddrModeNone, 2, itin, opc, asm,
Bill Wendling7c646b92010-12-01 01:32:02 +00001039 "$Rn = $Rdn", pattern>;
Evan Chengcd4cdd12009-07-11 06:43:01 +00001040
Bob Wilson3968c6a2010-03-23 17:23:59 +00001041class T1pIs<dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001042 InstrItinClass itin, string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001043 : Thumb1pI<oops, iops, AddrModeT1_s, 2, itin, opc, asm, "", pattern>;
Evan Chengbec1dba892009-06-23 19:38:13 +00001044
Johnny Chen466231a2009-12-16 02:32:54 +00001045class Encoding16 : Encoding {
1046 let Inst{31-16} = 0x0000;
1047}
1048
Johnny Chenc28e6292009-12-15 17:24:14 +00001049// A6.2 16-bit Thumb instruction encoding
Johnny Chen466231a2009-12-16 02:32:54 +00001050class T1Encoding<bits<6> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001051 let Inst{15-10} = opcode;
1052}
1053
1054// A6.2.1 Shift (immediate), add, subtract, move, and compare encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001055class T1General<bits<5> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001056 let Inst{15-14} = 0b00;
1057 let Inst{13-9} = opcode;
1058}
1059
1060// A6.2.2 Data-processing encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001061class T1DataProcessing<bits<4> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001062 let Inst{15-10} = 0b010000;
1063 let Inst{9-6} = opcode;
1064}
1065
1066// A6.2.3 Special data instructions and branch and exchange encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001067class T1Special<bits<4> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001068 let Inst{15-10} = 0b010001;
Bill Wendling345b48f2010-11-17 00:45:23 +00001069 let Inst{9-6} = opcode;
Johnny Chenc28e6292009-12-15 17:24:14 +00001070}
1071
1072// A6.2.4 Load/store single data item encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001073class T1LoadStore<bits<4> opA, bits<3> opB> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001074 let Inst{15-12} = opA;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001075 let Inst{11-9} = opB;
Johnny Chenc28e6292009-12-15 17:24:14 +00001076}
Bill Wendlingb70dc872010-08-31 07:50:46 +00001077class T1LdStSP<bits<3> opB> : T1LoadStore<0b1001, opB>; // SP relative
Johnny Chenc28e6292009-12-15 17:24:14 +00001078
Eric Christopher9b67db82011-05-27 03:50:53 +00001079class T1BranchCond<bits<4> opcode> : Encoding16 {
1080 let Inst{15-12} = opcode;
1081}
1082
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001083// Helper classes to encode Thumb1 loads and stores. For immediates, the
Bill Wendling05632cb2010-11-30 23:54:45 +00001084// following bits are used for "opA" (see A6.2.4):
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001085//
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001086// 0b0110 => Immediate, 4 bytes
1087// 0b1000 => Immediate, 2 bytes
1088// 0b0111 => Immediate, 1 byte
Bill Wendlingc25545a2010-12-01 01:38:08 +00001089class T1pILdStEncode<bits<3> opcode, dag oops, dag iops, AddrMode am,
1090 InstrItinClass itin, string opc, string asm,
1091 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001092 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling5c51fcd2010-11-30 23:16:25 +00001093 T1LoadStore<0b0101, opcode> {
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001094 bits<3> Rt;
1095 bits<8> addr;
1096 let Inst{8-6} = addr{5-3}; // Rm
1097 let Inst{5-3} = addr{2-0}; // Rn
1098 let Inst{2-0} = Rt;
1099}
Bill Wendlingc25545a2010-12-01 01:38:08 +00001100class T1pILdStEncodeImm<bits<4> opA, bit opB, dag oops, dag iops, AddrMode am,
1101 InstrItinClass itin, string opc, string asm,
1102 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001103 : Thumb1pI<oops, iops, am, 2, itin, opc, asm, "", pattern>,
Bill Wendling5c51fcd2010-11-30 23:16:25 +00001104 T1LoadStore<opA, {opB,?,?}> {
Bill Wendlinga9e3df72010-11-30 22:57:21 +00001105 bits<3> Rt;
1106 bits<8> addr;
1107 let Inst{10-6} = addr{7-3}; // imm5
1108 let Inst{5-3} = addr{2-0}; // Rn
1109 let Inst{2-0} = Rt;
1110}
1111
Johnny Chenc28e6292009-12-15 17:24:14 +00001112// A6.2.5 Miscellaneous 16-bit instructions encoding.
Johnny Chen466231a2009-12-16 02:32:54 +00001113class T1Misc<bits<7> opcode> : Encoding16 {
Johnny Chenc28e6292009-12-15 17:24:14 +00001114 let Inst{15-12} = 0b1011;
1115 let Inst{11-5} = opcode;
1116}
1117
Evan Chengd76f0be2009-06-25 02:08:06 +00001118// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +00001119class Thumb2I<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001120 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001121 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001122 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengd76f0be2009-06-25 02:08:06 +00001123 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001124 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001125 let AsmString = !strconcat(opc, "${p}", asm);
Evan Chengd76f0be2009-06-25 02:08:06 +00001126 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001127 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001128 let DecoderNamespace = "Thumb2";
Evan Chengd76f0be2009-06-25 02:08:06 +00001129}
1130
Bill Wendlingb70dc872010-08-31 07:50:46 +00001131// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as an
1132// input operand since by default it's a zero register. It will become an
1133// implicit def once it's "flipped".
Jim Grosbachb9386552010-10-13 23:12:26 +00001134//
Evan Chengd76f0be2009-06-25 02:08:06 +00001135// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
1136// more consistent.
Owen Anderson651b2302011-07-13 23:22:26 +00001137class Thumb2sI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001138 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001139 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001140 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Owen Andersoncf096a42010-12-07 20:50:15 +00001141 bits<1> s; // condition-code set flag ('1' if the insn should set the flags)
1142 let Inst{20} = s;
1143
Evan Chengd76f0be2009-06-25 02:08:06 +00001144 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001145 let InOperandList = !con(iops, (ins pred:$p, cc_out:$s));
Chris Lattner04c342e2010-10-06 00:05:18 +00001146 let AsmString = !strconcat(opc, "${s}${p}", asm);
Evan Chengd76f0be2009-06-25 02:08:06 +00001147 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001148 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001149 let DecoderNamespace = "Thumb2";
Evan Chengd76f0be2009-06-25 02:08:06 +00001150}
1151
1152// Special cases
Owen Anderson651b2302011-07-13 23:22:26 +00001153class Thumb2XI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001154 InstrItinClass itin,
Evan Chengd76f0be2009-06-25 02:08:06 +00001155 string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001156 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
Evan Chengd76f0be2009-06-25 02:08:06 +00001157 let OutOperandList = oops;
1158 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +00001159 let AsmString = asm;
Evan Cheng431cf562009-06-23 17:48:47 +00001160 let Pattern = pattern;
Evan Cheng2c450d32009-07-02 06:38:40 +00001161 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001162 let DecoderNamespace = "Thumb2";
Evan Cheng431cf562009-06-23 17:48:47 +00001163}
1164
Owen Anderson651b2302011-07-13 23:22:26 +00001165class ThumbXI<dag oops, dag iops, AddrMode am, int sz,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001166 InstrItinClass itin,
1167 string asm, string cstr, list<dag> pattern>
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001168 : InstARM<am, sz, IndexModeNone, ThumbFrm, GenericDomain, cstr, itin> {
1169 let OutOperandList = oops;
1170 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +00001171 let AsmString = asm;
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001172 let Pattern = pattern;
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001173 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001174 let DecoderNamespace = "Thumb";
Jim Grosbach36d4dec2009-12-01 18:10:36 +00001175}
1176
David Goodwinb062c232009-08-06 16:52:47 +00001177class T2I<dag oops, dag iops, InstrItinClass itin,
1178 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001179 : Thumb2I<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001180class T2Ii12<dag oops, dag iops, InstrItinClass itin,
1181 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001182 : Thumb2I<oops, iops, AddrModeT2_i12, 4, itin, opc, asm, "",pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001183class T2Ii8<dag oops, dag iops, InstrItinClass itin,
1184 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001185 : Thumb2I<oops, iops, AddrModeT2_i8, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001186class T2Iso<dag oops, dag iops, InstrItinClass itin,
1187 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001188 : Thumb2I<oops, iops, AddrModeT2_so, 4, itin, opc, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001189class T2Ipc<dag oops, dag iops, InstrItinClass itin,
1190 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001191 : Thumb2I<oops, iops, AddrModeT2_pc, 4, itin, opc, asm, "", pattern>;
Jim Grosbach95bd6b72010-12-10 20:51:35 +00001192class T2Ii8s4<bit P, bit W, bit isLoad, dag oops, dag iops, InstrItinClass itin,
Jim Grosbach7db8d692011-09-08 22:07:06 +00001193 string opc, string asm, string cstr, list<dag> pattern>
1194 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, cstr,
Johnny Chenc28e6292009-12-15 17:24:14 +00001195 pattern> {
Owen Anderson943fb602010-12-01 19:18:46 +00001196 bits<4> Rt;
1197 bits<4> Rt2;
1198 bits<13> addr;
Jim Grosbach95bd6b72010-12-10 20:51:35 +00001199 let Inst{31-25} = 0b1110100;
1200 let Inst{24} = P;
1201 let Inst{23} = addr{8};
1202 let Inst{22} = 1;
1203 let Inst{21} = W;
1204 let Inst{20} = isLoad;
1205 let Inst{19-16} = addr{12-9};
Owen Anderson943fb602010-12-01 19:18:46 +00001206 let Inst{15-12} = Rt{3-0};
1207 let Inst{11-8} = Rt2{3-0};
Owen Anderson943fb602010-12-01 19:18:46 +00001208 let Inst{7-0} = addr{7-0};
Johnny Chenc28e6292009-12-15 17:24:14 +00001209}
Jim Grosbach7db8d692011-09-08 22:07:06 +00001210class T2Ii8s4post<bit P, bit W, bit isLoad, dag oops, dag iops,
1211 InstrItinClass itin, string opc, string asm, string cstr,
1212 list<dag> pattern>
1213 : Thumb2I<oops, iops, AddrModeT2_i8s4, 4, itin, opc, asm, cstr,
Owen Anderson08d4bb02011-08-04 23:18:05 +00001214 pattern> {
1215 bits<4> Rt;
1216 bits<4> Rt2;
Jim Grosbach7db8d692011-09-08 22:07:06 +00001217 bits<4> addr;
Owen Anderson08d4bb02011-08-04 23:18:05 +00001218 bits<9> imm;
1219 let Inst{31-25} = 0b1110100;
1220 let Inst{24} = P;
1221 let Inst{23} = imm{8};
1222 let Inst{22} = 1;
1223 let Inst{21} = W;
1224 let Inst{20} = isLoad;
Jim Grosbach7db8d692011-09-08 22:07:06 +00001225 let Inst{19-16} = addr;
Owen Anderson08d4bb02011-08-04 23:18:05 +00001226 let Inst{15-12} = Rt{3-0};
1227 let Inst{11-8} = Rt2{3-0};
1228 let Inst{7-0} = imm{7-0};
1229}
1230
David Goodwinb062c232009-08-06 16:52:47 +00001231class T2sI<dag oops, dag iops, InstrItinClass itin,
1232 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001233 : Thumb2sI<oops, iops, AddrModeNone, 4, itin, opc, asm, "", pattern>;
Evan Chengd76f0be2009-06-25 02:08:06 +00001234
David Goodwinb062c232009-08-06 16:52:47 +00001235class T2XI<dag oops, dag iops, InstrItinClass itin,
1236 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001237 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, "", pattern>;
David Goodwinb062c232009-08-06 16:52:47 +00001238class T2JTI<dag oops, dag iops, InstrItinClass itin,
1239 string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001240 : Thumb2XI<oops, iops, AddrModeNone, 0, itin, asm, "", pattern>;
Evan Cheng431cf562009-06-23 17:48:47 +00001241
Bruno Cardoso Lopes4d4b4902011-01-20 16:58:48 +00001242// Move to/from coprocessor instructions
Tim Northover2c45a382013-06-26 16:52:40 +00001243class T2Cop<bits<4> opc, dag oops, dag iops, string opcstr, string asm,
1244 list<dag> pattern>
1245 : T2I <oops, iops, NoItinerary, opcstr, asm, pattern>, Requires<[IsThumb2]> {
Jim Grosbachcabb48d2011-07-13 21:17:59 +00001246 let Inst{31-28} = opc;
Bruno Cardoso Lopes4d4b4902011-01-20 16:58:48 +00001247}
1248
Bob Wilson947f04b2010-03-13 01:08:20 +00001249// Two-address instructions
1250class T2XIt<dag oops, dag iops, InstrItinClass itin,
1251 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001252 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, asm, cstr, pattern>;
Evan Cheng83e0d482009-09-28 09:14:39 +00001253
Jim Grosbachc086f682011-09-08 00:39:19 +00001254// T2Ipreldst - Thumb2 pre-indexed load / store instructions.
1255class T2Ipreldst<bit signed, bits<2> opcod, bit load, bit pre,
Johnny Chenc28e6292009-12-15 17:24:14 +00001256 dag oops, dag iops,
1257 AddrMode am, IndexMode im, InstrItinClass itin,
Evan Cheng84c6cda2009-07-02 07:28:31 +00001258 string opc, string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001259 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
Evan Cheng84c6cda2009-07-02 07:28:31 +00001260 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001261 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001262 let AsmString = !strconcat(opc, "${p}", asm);
Evan Cheng84c6cda2009-07-02 07:28:31 +00001263 let Pattern = pattern;
1264 list<Predicate> Predicates = [IsThumb2];
Owen Andersonc78e03c2011-07-19 21:06:00 +00001265 let DecoderNamespace = "Thumb2";
Jim Grosbachc086f682011-09-08 00:39:19 +00001266
1267 bits<4> Rt;
1268 bits<13> addr;
Johnny Chenc28e6292009-12-15 17:24:14 +00001269 let Inst{31-27} = 0b11111;
1270 let Inst{26-25} = 0b00;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001271 let Inst{24} = signed;
1272 let Inst{23} = 0;
Johnny Chenc28e6292009-12-15 17:24:14 +00001273 let Inst{22-21} = opcod;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001274 let Inst{20} = load;
Jim Grosbachc086f682011-09-08 00:39:19 +00001275 let Inst{19-16} = addr{12-9};
1276 let Inst{15-12} = Rt{3-0};
Bill Wendlingb70dc872010-08-31 07:50:46 +00001277 let Inst{11} = 1;
Johnny Chenc28e6292009-12-15 17:24:14 +00001278 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
Bill Wendlingb70dc872010-08-31 07:50:46 +00001279 let Inst{10} = pre; // The P bit.
Jim Grosbachc086f682011-09-08 00:39:19 +00001280 let Inst{9} = addr{8}; // Sign bit
Bill Wendlingb70dc872010-08-31 07:50:46 +00001281 let Inst{8} = 1; // The W bit.
Jim Grosbachc086f682011-09-08 00:39:19 +00001282 let Inst{7-0} = addr{7-0};
Owen Andersona9ebf6f2011-09-12 18:56:30 +00001283
1284 let DecoderMethod = "DecodeT2LdStPre";
Jim Grosbachc086f682011-09-08 00:39:19 +00001285}
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001286
Jim Grosbachc086f682011-09-08 00:39:19 +00001287// T2Ipostldst - Thumb2 post-indexed load / store instructions.
1288class T2Ipostldst<bit signed, bits<2> opcod, bit load, bit pre,
1289 dag oops, dag iops,
1290 AddrMode am, IndexMode im, InstrItinClass itin,
1291 string opc, string asm, string cstr, list<dag> pattern>
1292 : InstARM<am, 4, im, ThumbFrm, GenericDomain, cstr, itin> {
1293 let OutOperandList = oops;
1294 let InOperandList = !con(iops, (ins pred:$p));
1295 let AsmString = !strconcat(opc, "${p}", asm);
1296 let Pattern = pattern;
1297 list<Predicate> Predicates = [IsThumb2];
1298 let DecoderNamespace = "Thumb2";
Jim Grosbachc4669ed2010-12-10 20:47:29 +00001299
Owen Andersone22c7322010-11-30 00:14:31 +00001300 bits<4> Rt;
1301 bits<4> Rn;
Jim Grosbach3343da52011-09-08 01:01:32 +00001302 bits<9> offset;
Jim Grosbachc086f682011-09-08 00:39:19 +00001303 let Inst{31-27} = 0b11111;
1304 let Inst{26-25} = 0b00;
1305 let Inst{24} = signed;
1306 let Inst{23} = 0;
1307 let Inst{22-21} = opcod;
1308 let Inst{20} = load;
1309 let Inst{19-16} = Rn;
Owen Andersone22c7322010-11-30 00:14:31 +00001310 let Inst{15-12} = Rt{3-0};
Jim Grosbachc086f682011-09-08 00:39:19 +00001311 let Inst{11} = 1;
1312 // (P, W) = (1, 1) Pre-indexed or (0, 1) Post-indexed
1313 let Inst{10} = pre; // The P bit.
Jim Grosbach3343da52011-09-08 01:01:32 +00001314 let Inst{9} = offset{8}; // Sign bit
Jim Grosbachc086f682011-09-08 00:39:19 +00001315 let Inst{8} = 1; // The W bit.
Jim Grosbach3343da52011-09-08 01:01:32 +00001316 let Inst{7-0} = offset{7-0};
Owen Andersona9ebf6f2011-09-12 18:56:30 +00001317
1318 let DecoderMethod = "DecodeT2LdStPre";
Evan Cheng84c6cda2009-07-02 07:28:31 +00001319}
1320
David Goodwine5b969f2009-07-27 19:59:26 +00001321// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
1322class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001323 list<Predicate> Predicates = [IsThumb, IsThumb1Only, HasV5T];
David Goodwine5b969f2009-07-27 19:59:26 +00001324}
1325
1326// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
1327class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Jim Grosbachfddf36d2010-11-01 17:08:58 +00001328 list<Predicate> Predicates = [IsThumb, IsThumb1Only];
David Goodwine5b969f2009-07-27 19:59:26 +00001329}
Evan Cheng84c6cda2009-07-02 07:28:31 +00001330
Bruno Cardoso Lopes168c9002011-05-03 17:29:22 +00001331// T2v6Pat - Same as Pat<>, but requires V6T2 Thumb2 mode.
1332class T2v6Pat<dag pattern, dag result> : Pat<pattern, result> {
1333 list<Predicate> Predicates = [IsThumb2, HasV6T2];
1334}
1335
Evan Chengeab9ca72009-06-27 02:26:13 +00001336// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
1337class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Cheng2c450d32009-07-02 06:38:40 +00001338 list<Predicate> Predicates = [IsThumb2];
Evan Cheng431cf562009-06-23 17:48:47 +00001339}
1340
Evan Chengee98fa92008-08-29 06:41:12 +00001341//===----------------------------------------------------------------------===//
1342
Evan Chengac2af2f2008-11-11 02:11:05 +00001343//===----------------------------------------------------------------------===//
1344// ARM VFP Instruction templates.
1345//
1346
David Goodwin81cdd212009-07-10 17:03:29 +00001347// Almost all VFP instructions are predicable.
Owen Anderson651b2302011-07-13 23:22:26 +00001348class VFPI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001349 IndexMode im, Format f, InstrItinClass itin,
1350 string opc, string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001351 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Jim Grosbach576640f2010-10-12 21:22:40 +00001352 bits<4> p;
1353 let Inst{31-28} = p;
David Goodwin81cdd212009-07-10 17:03:29 +00001354 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001355 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001356 let AsmString = !strconcat(opc, "${p}", asm);
David Goodwin81cdd212009-07-10 17:03:29 +00001357 let Pattern = pattern;
Bill Wendling87240d42010-12-01 21:54:50 +00001358 let PostEncoderMethod = "VFPThumb2PostEncoder";
Owen Andersone0152a72011-08-09 20:55:18 +00001359 let DecoderNamespace = "VFP";
David Goodwin81cdd212009-07-10 17:03:29 +00001360 list<Predicate> Predicates = [HasVFP2];
1361}
1362
1363// Special cases
Owen Anderson651b2302011-07-13 23:22:26 +00001364class VFPXI<dag oops, dag iops, AddrMode am, int sz,
David Goodwinb062c232009-08-06 16:52:47 +00001365 IndexMode im, Format f, InstrItinClass itin,
1366 string asm, string cstr, list<dag> pattern>
Anton Korobeynikov14635da2009-11-02 00:10:38 +00001367 : InstARM<am, sz, im, f, VFPDomain, cstr, itin> {
Bill Wendling345b48f2010-11-17 00:45:23 +00001368 bits<4> p;
1369 let Inst{31-28} = p;
David Goodwin81cdd212009-07-10 17:03:29 +00001370 let OutOperandList = oops;
1371 let InOperandList = iops;
Bob Wilson722bff22010-05-24 20:08:34 +00001372 let AsmString = asm;
David Goodwin81cdd212009-07-10 17:03:29 +00001373 let Pattern = pattern;
Bill Wendling87240d42010-12-01 21:54:50 +00001374 let PostEncoderMethod = "VFPThumb2PostEncoder";
Owen Andersone0152a72011-08-09 20:55:18 +00001375 let DecoderNamespace = "VFP";
David Goodwin81cdd212009-07-10 17:03:29 +00001376 list<Predicate> Predicates = [HasVFP2];
1377}
1378
David Goodwinb062c232009-08-06 16:52:47 +00001379class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
1380 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001381 : VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
Bill Wendling87240d42010-12-01 21:54:50 +00001382 opc, asm, "", pattern> {
1383 let PostEncoderMethod = "VFPThumb2PostEncoder";
1384}
David Goodwin81cdd212009-07-10 17:03:29 +00001385
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001386// ARM VFP addrmode5 loads and stores
1387class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001388 InstrItinClass itin,
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001389 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001390 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001391 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendlingc0024632010-11-04 00:59:42 +00001392 // Instruction operands.
1393 bits<5> Dd;
1394 bits<13> addr;
1395
1396 // Encode instruction operands.
1397 let Inst{23} = addr{8}; // U (add = (U == '1'))
1398 let Inst{22} = Dd{4};
1399 let Inst{19-16} = addr{12-9}; // Rn
1400 let Inst{15-12} = Dd{3-0};
1401 let Inst{7-0} = addr{7-0}; // imm8
1402
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001403 let Inst{27-24} = opcod1;
1404 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001405 let Inst{11-9} = 0b101;
1406 let Inst{8} = 1; // Double precision
Anton Korobeynikov8cce1eb2009-11-02 00:11:06 +00001407
Evan Cheng4a8c43f2011-02-16 00:35:02 +00001408 // Loads & stores operate on both NEON and VFP pipelines.
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +00001409 let D = VFPNeonDomain;
Evan Chengac2af2f2008-11-11 02:11:05 +00001410}
1411
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001412class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001413 InstrItinClass itin,
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001414 string opc, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001415 : VFPI<oops, iops, AddrMode5, 4, IndexModeNone,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001416 VFPLdStFrm, itin, opc, asm, "", pattern> {
Bill Wendlingc0024632010-11-04 00:59:42 +00001417 // Instruction operands.
1418 bits<5> Sd;
1419 bits<13> addr;
1420
1421 // Encode instruction operands.
1422 let Inst{23} = addr{8}; // U (add = (U == '1'))
1423 let Inst{22} = Sd{0};
1424 let Inst{19-16} = addr{12-9}; // Rn
1425 let Inst{15-12} = Sd{4-1};
1426 let Inst{7-0} = addr{7-0}; // imm8
1427
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001428 let Inst{27-24} = opcod1;
1429 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001430 let Inst{11-9} = 0b101;
1431 let Inst{8} = 0; // Single precision
Evan Cheng4a8c43f2011-02-16 00:35:02 +00001432
1433 // Loads & stores operate on both NEON and VFP pipelines.
1434 let D = VFPNeonDomain;
Evan Chengac2af2f2008-11-11 02:11:05 +00001435}
1436
Bob Wilson6b853c32010-09-16 00:31:02 +00001437// VFP Load / store multiple pseudo instructions.
1438class PseudoVFPLdStM<dag oops, dag iops, InstrItinClass itin, string cstr,
1439 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001440 : InstARM<AddrMode4, 4, IndexModeNone, Pseudo, VFPNeonDomain,
Bob Wilson6b853c32010-09-16 00:31:02 +00001441 cstr, itin> {
1442 let OutOperandList = oops;
1443 let InOperandList = !con(iops, (ins pred:$p));
1444 let Pattern = pattern;
1445 list<Predicate> Predicates = [HasVFP2];
1446}
1447
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001448// Load / store multiple
Tim Northover4173e292013-05-31 15:55:51 +00001449
1450// Unknown precision
1451class AXXI4<dag oops, dag iops, IndexMode im,
1452 string asm, string cstr, list<dag> pattern>
1453 : VFPXI<oops, iops, AddrMode4, 4, im,
1454 VFPLdStFrm, NoItinerary, asm, cstr, pattern> {
1455 // Instruction operands.
1456 bits<4> Rn;
1457 bits<13> regs;
1458
1459 // Encode instruction operands.
1460 let Inst{19-16} = Rn;
1461 let Inst{22} = 0;
1462 let Inst{15-12} = regs{11-8};
1463 let Inst{7-1} = regs{7-1};
1464
1465 let Inst{27-25} = 0b110;
1466 let Inst{11-8} = 0b1011;
1467 let Inst{0} = 1;
1468}
1469
1470// Double precision
Jim Grosbachabcbe242010-09-08 00:25:50 +00001471class AXDI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +00001472 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001473 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001474 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling345b48f2010-11-17 00:45:23 +00001475 // Instruction operands.
1476 bits<4> Rn;
1477 bits<13> regs;
1478
1479 // Encode instruction operands.
1480 let Inst{19-16} = Rn;
1481 let Inst{22} = regs{12};
1482 let Inst{15-12} = regs{11-8};
Tim Northover4173e292013-05-31 15:55:51 +00001483 let Inst{7-1} = regs{7-1};
Bill Wendling345b48f2010-11-17 00:45:23 +00001484
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001485 let Inst{27-25} = 0b110;
Bill Wendling98c29d72010-10-12 22:03:19 +00001486 let Inst{11-9} = 0b101;
1487 let Inst{8} = 1; // Double precision
Tim Northover4173e292013-05-31 15:55:51 +00001488 let Inst{0} = 0;
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001489}
1490
Tim Northover4173e292013-05-31 15:55:51 +00001491// Single Precision
Jim Grosbachabcbe242010-09-08 00:25:50 +00001492class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
Bob Wilson947f04b2010-03-13 01:08:20 +00001493 string asm, string cstr, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001494 : VFPXI<oops, iops, AddrMode4, 4, im,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001495 VFPLdStMulFrm, itin, asm, cstr, pattern> {
Bill Wendling345b48f2010-11-17 00:45:23 +00001496 // Instruction operands.
1497 bits<4> Rn;
1498 bits<13> regs;
1499
1500 // Encode instruction operands.
1501 let Inst{19-16} = Rn;
1502 let Inst{22} = regs{8};
1503 let Inst{15-12} = regs{12-9};
1504 let Inst{7-0} = regs{7-0};
1505
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001506 let Inst{27-25} = 0b110;
Bill Wendling98c29d72010-10-12 22:03:19 +00001507 let Inst{11-9} = 0b101;
1508 let Inst{8} = 0; // Single precision
Evan Cheng8cbbcb12008-11-11 21:48:44 +00001509}
1510
Evan Chengac2af2f2008-11-11 02:11:05 +00001511// Double precision, unary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001512class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1513 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1514 string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001515 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001516 // Instruction operands.
1517 bits<5> Dd;
1518 bits<5> Dm;
1519
1520 // Encode instruction operands.
1521 let Inst{3-0} = Dm{3-0};
1522 let Inst{5} = Dm{4};
1523 let Inst{15-12} = Dd{3-0};
1524 let Inst{22} = Dd{4};
1525
Johnny Chen34a6afc2010-01-29 23:21:10 +00001526 let Inst{27-23} = opcod1;
1527 let Inst{21-20} = opcod2;
1528 let Inst{19-16} = opcod3;
Bill Wendling98c29d72010-10-12 22:03:19 +00001529 let Inst{11-9} = 0b101;
1530 let Inst{8} = 1; // Double precision
Johnny Chen34a6afc2010-01-29 23:21:10 +00001531 let Inst{7-6} = opcod4;
1532 let Inst{4} = opcod5;
Evan Chengac2af2f2008-11-11 02:11:05 +00001533}
1534
Joey Gouly0f12aa22013-07-09 11:26:18 +00001535// Double precision, unary, not-predicated
1536class ADuInp<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1537 bit opcod5, dag oops, dag iops, InstrItinClass itin,
1538 string asm, list<dag> pattern>
1539 : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone, VFPUnaryFrm, itin, asm, "", pattern> {
1540 // Instruction operands.
1541 bits<5> Dd;
1542 bits<5> Dm;
1543
1544 let Inst{31-28} = 0b1111;
1545
1546 // Encode instruction operands.
1547 let Inst{3-0} = Dm{3-0};
1548 let Inst{5} = Dm{4};
1549 let Inst{15-12} = Dd{3-0};
1550 let Inst{22} = Dd{4};
1551
1552 let Inst{27-23} = opcod1;
1553 let Inst{21-20} = opcod2;
1554 let Inst{19-16} = opcod3;
1555 let Inst{11-9} = 0b101;
1556 let Inst{8} = 1; // Double precision
1557 let Inst{7-6} = opcod4;
1558 let Inst{4} = opcod5;
1559}
1560
Evan Chengac2af2f2008-11-11 02:11:05 +00001561// Double precision, binary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001562class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001563 dag iops, InstrItinClass itin, string opc, string asm,
1564 list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001565 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001566 // Instruction operands.
1567 bits<5> Dd;
1568 bits<5> Dn;
1569 bits<5> Dm;
1570
1571 // Encode instruction operands.
1572 let Inst{3-0} = Dm{3-0};
1573 let Inst{5} = Dm{4};
1574 let Inst{19-16} = Dn{3-0};
1575 let Inst{7} = Dn{4};
1576 let Inst{15-12} = Dd{3-0};
1577 let Inst{22} = Dd{4};
1578
Johnny Chen34a6afc2010-01-29 23:21:10 +00001579 let Inst{27-23} = opcod1;
1580 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001581 let Inst{11-9} = 0b101;
1582 let Inst{8} = 1; // Double precision
Bill Wendlingb70dc872010-08-31 07:50:46 +00001583 let Inst{6} = op6;
1584 let Inst{4} = op4;
Evan Chengac2af2f2008-11-11 02:11:05 +00001585}
1586
Joey Goulycc4ff9e2013-07-04 14:57:20 +00001587// FP, binary, not predicated
Joey Gouly2efaa732013-07-06 20:50:18 +00001588class ADbInp<bits<5> opcod1, bits<2> opcod2, bit opcod3, dag oops, dag iops,
Joey Goulycc4ff9e2013-07-04 14:57:20 +00001589 InstrItinClass itin, string asm, list<dag> pattern>
Joey Gouly2d0175e2013-07-09 09:59:04 +00001590 : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone, VFPBinaryFrm, itin,
1591 asm, "", pattern>
Joey Goulycc4ff9e2013-07-04 14:57:20 +00001592{
1593 // Instruction operands.
1594 bits<5> Dd;
1595 bits<5> Dn;
1596 bits<5> Dm;
1597
1598 let Inst{31-28} = 0b1111;
1599
1600 // Encode instruction operands.
1601 let Inst{3-0} = Dm{3-0};
1602 let Inst{5} = Dm{4};
1603 let Inst{19-16} = Dn{3-0};
1604 let Inst{7} = Dn{4};
1605 let Inst{15-12} = Dd{3-0};
1606 let Inst{22} = Dd{4};
1607
1608 let Inst{27-23} = opcod1;
1609 let Inst{21-20} = opcod2;
1610 let Inst{11-9} = 0b101;
1611 let Inst{8} = 1; // double precision
Joey Gouly2efaa732013-07-06 20:50:18 +00001612 let Inst{6} = opcod3;
Joey Goulycc4ff9e2013-07-04 14:57:20 +00001613 let Inst{4} = 0;
1614}
1615
Joey Gouly2d0175e2013-07-09 09:59:04 +00001616// Single precision, unary, predicated
Johnny Chen34a6afc2010-01-29 23:21:10 +00001617class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1618 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1619 string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001620 : VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001621 // Instruction operands.
1622 bits<5> Sd;
1623 bits<5> Sm;
1624
1625 // Encode instruction operands.
1626 let Inst{3-0} = Sm{4-1};
1627 let Inst{5} = Sm{0};
1628 let Inst{15-12} = Sd{4-1};
1629 let Inst{22} = Sd{0};
1630
Johnny Chen34a6afc2010-01-29 23:21:10 +00001631 let Inst{27-23} = opcod1;
1632 let Inst{21-20} = opcod2;
1633 let Inst{19-16} = opcod3;
Bill Wendling98c29d72010-10-12 22:03:19 +00001634 let Inst{11-9} = 0b101;
1635 let Inst{8} = 0; // Single precision
Johnny Chen34a6afc2010-01-29 23:21:10 +00001636 let Inst{7-6} = opcod4;
1637 let Inst{4} = opcod5;
Evan Chengac2af2f2008-11-11 02:11:05 +00001638}
1639
Joey Gouly2d0175e2013-07-09 09:59:04 +00001640// Single precision, unary, non-predicated
1641class ASuInp<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1642 bit opcod5, dag oops, dag iops, InstrItinClass itin,
1643 string asm, list<dag> pattern>
1644 : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone,
1645 VFPUnaryFrm, itin, asm, "", pattern> {
1646 // Instruction operands.
1647 bits<5> Sd;
1648 bits<5> Sm;
1649
1650 let Inst{31-28} = 0b1111;
1651
1652 // Encode instruction operands.
1653 let Inst{3-0} = Sm{4-1};
1654 let Inst{5} = Sm{0};
1655 let Inst{15-12} = Sd{4-1};
1656 let Inst{22} = Sd{0};
1657
1658 let Inst{27-23} = opcod1;
1659 let Inst{21-20} = opcod2;
1660 let Inst{19-16} = opcod3;
1661 let Inst{11-9} = 0b101;
1662 let Inst{8} = 0; // Single precision
1663 let Inst{7-6} = opcod4;
1664 let Inst{4} = opcod5;
1665}
1666
Bill Wendlingcbb08ca2010-12-01 02:42:55 +00001667// Single precision unary, if no NEON. Same as ASuI except not available if
1668// NEON is enabled.
Johnny Chen34a6afc2010-01-29 23:21:10 +00001669class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
1670 bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
1671 string asm, list<dag> pattern>
1672 : ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
1673 pattern> {
David Goodwin30bf6252009-08-04 20:39:05 +00001674 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1675}
1676
Evan Chengac2af2f2008-11-11 02:11:05 +00001677// Single precision, binary
Johnny Chen34a6afc2010-01-29 23:21:10 +00001678class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
1679 InstrItinClass itin, string opc, string asm, list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001680 : VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
Bill Wendling26233432010-11-01 06:00:39 +00001681 // Instruction operands.
1682 bits<5> Sd;
1683 bits<5> Sn;
1684 bits<5> Sm;
1685
1686 // Encode instruction operands.
1687 let Inst{3-0} = Sm{4-1};
1688 let Inst{5} = Sm{0};
1689 let Inst{19-16} = Sn{4-1};
1690 let Inst{7} = Sn{0};
1691 let Inst{15-12} = Sd{4-1};
1692 let Inst{22} = Sd{0};
1693
Johnny Chen34a6afc2010-01-29 23:21:10 +00001694 let Inst{27-23} = opcod1;
1695 let Inst{21-20} = opcod2;
Bill Wendling98c29d72010-10-12 22:03:19 +00001696 let Inst{11-9} = 0b101;
1697 let Inst{8} = 0; // Single precision
Bill Wendlingb70dc872010-08-31 07:50:46 +00001698 let Inst{6} = op6;
1699 let Inst{4} = op4;
Evan Chengac2af2f2008-11-11 02:11:05 +00001700}
1701
Joey Goulycc4ff9e2013-07-04 14:57:20 +00001702// Single precision, binary, not predicated
Joey Gouly2efaa732013-07-06 20:50:18 +00001703class ASbInp<bits<5> opcod1, bits<2> opcod2, bit opcod3, dag oops, dag iops,
Joey Goulycc4ff9e2013-07-04 14:57:20 +00001704 InstrItinClass itin, string asm, list<dag> pattern>
1705 : VFPXI<oops, iops, AddrModeNone, 4, IndexModeNone,
1706 VFPBinaryFrm, itin, asm, "", pattern>
1707{
1708 // Instruction operands.
1709 bits<5> Sd;
1710 bits<5> Sn;
1711 bits<5> Sm;
1712
1713 let Inst{31-28} = 0b1111;
1714
1715 // Encode instruction operands.
1716 let Inst{3-0} = Sm{4-1};
1717 let Inst{5} = Sm{0};
1718 let Inst{19-16} = Sn{4-1};
1719 let Inst{7} = Sn{0};
1720 let Inst{15-12} = Sd{4-1};
1721 let Inst{22} = Sd{0};
1722
1723 let Inst{27-23} = opcod1;
1724 let Inst{21-20} = opcod2;
1725 let Inst{11-9} = 0b101;
1726 let Inst{8} = 0; // Single precision
Joey Gouly2efaa732013-07-06 20:50:18 +00001727 let Inst{6} = opcod3;
Joey Goulycc4ff9e2013-07-04 14:57:20 +00001728 let Inst{4} = 0;
1729}
1730
Bill Wendlingcbb08ca2010-12-01 02:42:55 +00001731// Single precision binary, if no NEON. Same as ASbI except not available if
1732// NEON is enabled.
Johnny Chen34a6afc2010-01-29 23:21:10 +00001733class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001734 dag iops, InstrItinClass itin, string opc, string asm,
1735 list<dag> pattern>
Johnny Chen34a6afc2010-01-29 23:21:10 +00001736 : ASbI<opcod1, opcod2, op6, op4, oops, iops, itin, opc, asm, pattern> {
David Goodwin3b9c52c2009-08-04 17:53:06 +00001737 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
Bill Wendling26233432010-11-01 06:00:39 +00001738
1739 // Instruction operands.
1740 bits<5> Sd;
1741 bits<5> Sn;
1742 bits<5> Sm;
1743
1744 // Encode instruction operands.
1745 let Inst{3-0} = Sm{4-1};
1746 let Inst{5} = Sm{0};
1747 let Inst{19-16} = Sn{4-1};
1748 let Inst{7} = Sn{0};
1749 let Inst{15-12} = Sd{4-1};
1750 let Inst{22} = Sd{0};
David Goodwin3b9c52c2009-08-04 17:53:06 +00001751}
1752
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001753// VFP conversion instructions
Johnny Chen34a6afc2010-01-29 23:21:10 +00001754class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
1755 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1756 list<dag> pattern>
David Goodwinb062c232009-08-06 16:52:47 +00001757 : VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
Johnny Chen34a6afc2010-01-29 23:21:10 +00001758 let Inst{27-23} = opcod1;
1759 let Inst{21-20} = opcod2;
1760 let Inst{19-16} = opcod3;
1761 let Inst{11-8} = opcod4;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001762 let Inst{6} = 1;
Johnny Chen34a6afc2010-01-29 23:21:10 +00001763 let Inst{4} = 0;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001764}
1765
Johnny Chen39640592010-02-11 18:47:03 +00001766// VFP conversion between floating-point and fixed-point
1767class AVConv1XI<bits<5> op1, bits<2> op2, bits<4> op3, bits<4> op4, bit op5,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001768 dag oops, dag iops, InstrItinClass itin, string opc, string asm,
1769 list<dag> pattern>
Johnny Chen39640592010-02-11 18:47:03 +00001770 : AVConv1I<op1, op2, op3, op4, oops, iops, itin, opc, asm, pattern> {
Jim Grosbachf0d25112011-12-22 19:55:21 +00001771 bits<5> fbits;
Johnny Chen39640592010-02-11 18:47:03 +00001772 // size (fixed-point number): sx == 0 ? 16 : 32
1773 let Inst{7} = op5; // sx
Jim Grosbachf0d25112011-12-22 19:55:21 +00001774 let Inst{5} = fbits{0};
1775 let Inst{3-0} = fbits{4-1};
Johnny Chen39640592010-02-11 18:47:03 +00001776}
1777
David Goodwin85b5b022009-08-10 22:17:39 +00001778// VFP conversion instructions, if no NEON
Johnny Chen34a6afc2010-01-29 23:21:10 +00001779class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
David Goodwin85b5b022009-08-10 22:17:39 +00001780 dag oops, dag iops, InstrItinClass itin,
1781 string opc, string asm, list<dag> pattern>
Johnny Chen34a6afc2010-01-29 23:21:10 +00001782 : AVConv1I<opcod1, opcod2, opcod3, opcod4, oops, iops, itin, opc, asm,
1783 pattern> {
David Goodwin85b5b022009-08-10 22:17:39 +00001784 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1785}
1786
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001787class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
David Goodwinb062c232009-08-06 16:52:47 +00001788 InstrItinClass itin,
1789 string opc, string asm, list<dag> pattern>
1790 : VFPAI<oops, iops, f, itin, opc, asm, pattern> {
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001791 let Inst{27-20} = opcod1;
Evan Cheng38c9a142008-11-11 19:40:26 +00001792 let Inst{11-8} = opcod2;
1793 let Inst{4} = 1;
1794}
1795
David Goodwinb062c232009-08-06 16:52:47 +00001796class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1797 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1798 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, itin, opc, asm, pattern>;
Evan Cheng97ccab82008-11-11 22:46:12 +00001799
Bob Wilson3968c6a2010-03-23 17:23:59 +00001800class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
David Goodwinb062c232009-08-06 16:52:47 +00001801 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1802 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, itin, opc, asm, pattern>;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001803
David Goodwinb062c232009-08-06 16:52:47 +00001804class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1805 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1806 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, itin, opc, asm, pattern>;
Evan Cheng4b6c7ef2008-11-12 06:41:41 +00001807
David Goodwinb062c232009-08-06 16:52:47 +00001808class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops,
1809 InstrItinClass itin, string opc, string asm, list<dag> pattern>
1810 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, itin, opc, asm, pattern>;
Evan Cheng38c9a142008-11-11 19:40:26 +00001811
Evan Chengac2af2f2008-11-11 02:11:05 +00001812//===----------------------------------------------------------------------===//
1813
Bob Wilson2e076c42009-06-22 23:27:02 +00001814//===----------------------------------------------------------------------===//
1815// ARM NEON Instruction templates.
1816//
Evan Chengee98fa92008-08-29 06:41:12 +00001817
Johnny Chenf833fad2010-03-20 00:17:00 +00001818class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1819 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1820 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001821 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001822 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001823 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001824 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Cheng738a97a2009-11-23 21:57:23 +00001825 let Pattern = pattern;
1826 list<Predicate> Predicates = [HasNEON];
Owen Andersona6201f02011-08-15 23:38:54 +00001827 let DecoderNamespace = "NEON";
Evan Cheng738a97a2009-11-23 21:57:23 +00001828}
1829
1830// Same as NeonI except it does not have a "data type" specifier.
Johnny Chen020023a2010-03-23 20:40:44 +00001831class NeonXI<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1832 InstrItinClass itin, string opc, string asm, string cstr,
1833 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001834 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001835 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00001836 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00001837 let AsmString = !strconcat(opc, "${p}", "\t", asm);
Bob Wilson2e076c42009-06-22 23:27:02 +00001838 let Pattern = pattern;
1839 list<Predicate> Predicates = [HasNEON];
Owen Andersona6201f02011-08-15 23:38:54 +00001840 let DecoderNamespace = "NEON";
Evan Chengee98fa92008-08-29 06:41:12 +00001841}
1842
Joey Goulydf686002013-07-17 13:59:38 +00001843// Same as NeonI except it is not predicated
1844class NeonInp<dag oops, dag iops, AddrMode am, IndexMode im, Format f,
1845 InstrItinClass itin, string opc, string dt, string asm, string cstr,
1846 list<dag> pattern>
1847 : InstARM<am, 4, im, f, NeonDomain, cstr, itin> {
1848 let OutOperandList = oops;
1849 let InOperandList = iops;
1850 let AsmString = !strconcat(opc, ".", dt, "\t", asm);
1851 let Pattern = pattern;
1852 list<Predicate> Predicates = [HasNEON];
1853 let DecoderNamespace = "NEON";
1854
1855 let Inst{31-28} = 0b1111;
1856}
1857
Bob Wilson50820a22009-10-07 21:53:04 +00001858class NLdSt<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1859 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001860 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenf833fad2010-03-20 00:17:00 +00001861 : NeonI<oops, iops, AddrMode6, IndexModeNone, NLdStFrm, itin, opc, dt, asm,
1862 cstr, pattern> {
Bob Wilsonf731a2d2009-07-08 18:11:30 +00001863 let Inst{31-24} = 0b11110100;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001864 let Inst{23} = op23;
Jim Grosbach68f495c2009-10-20 00:19:08 +00001865 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001866 let Inst{11-8} = op11_8;
1867 let Inst{7-4} = op7_4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001868
Chris Lattner63274cb2010-11-15 05:19:05 +00001869 let PostEncoderMethod = "NEONThumb2LoadStorePostEncoder";
Owen Andersonc86a5bd2011-08-10 19:01:10 +00001870 let DecoderNamespace = "NEONLoadStore";
Jim Grosbach5876e412010-11-19 22:42:55 +00001871
Owen Andersonad402342010-11-02 00:05:05 +00001872 bits<5> Vd;
Owen Anderson0ebd1fd2010-11-02 23:47:29 +00001873 bits<6> Rn;
1874 bits<4> Rm;
Jim Grosbach5876e412010-11-19 22:42:55 +00001875
Owen Andersonad402342010-11-02 00:05:05 +00001876 let Inst{22} = Vd{4};
1877 let Inst{15-12} = Vd{3-0};
Owen Anderson0ebd1fd2010-11-02 23:47:29 +00001878 let Inst{19-16} = Rn{3-0};
1879 let Inst{3-0} = Rm{3-0};
Bob Wilsonf731a2d2009-07-08 18:11:30 +00001880}
1881
Owen Anderson9f20daf2010-11-02 20:47:39 +00001882class NLdStLn<bit op23, bits<2> op21_20, bits<4> op11_8, bits<4> op7_4,
1883 dag oops, dag iops, InstrItinClass itin,
1884 string opc, string dt, string asm, string cstr, list<dag> pattern>
1885 : NLdSt<op23, op21_20, op11_8, op7_4, oops, iops, itin, opc,
1886 dt, asm, cstr, pattern> {
1887 bits<3> lane;
1888}
1889
Bob Wilson9392b0e2010-08-25 23:27:42 +00001890class PseudoNLdSt<dag oops, dag iops, InstrItinClass itin, string cstr>
Owen Anderson651b2302011-07-13 23:22:26 +00001891 : InstARM<AddrMode6, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilson9392b0e2010-08-25 23:27:42 +00001892 itin> {
1893 let OutOperandList = oops;
1894 let InOperandList = !con(iops, (ins pred:$p));
1895 list<Predicate> Predicates = [HasNEON];
1896}
1897
Jim Grosbach233b3a22010-10-06 20:36:55 +00001898class PseudoNeonI<dag oops, dag iops, InstrItinClass itin, string cstr,
1899 list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00001900 : InstARM<AddrModeNone, 4, IndexModeNone, Pseudo, NeonDomain, cstr,
Bob Wilsonc597fd3b2010-09-13 23:55:10 +00001901 itin> {
1902 let OutOperandList = oops;
1903 let InOperandList = !con(iops, (ins pred:$p));
Jim Grosbach233b3a22010-10-06 20:36:55 +00001904 let Pattern = pattern;
Bob Wilsonc597fd3b2010-09-13 23:55:10 +00001905 list<Predicate> Predicates = [HasNEON];
1906}
1907
Johnny Chenac5024b2010-03-23 16:43:47 +00001908class NDataI<dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001909 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chenac5024b2010-03-23 16:43:47 +00001910 : NeonI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, dt, asm, cstr,
1911 pattern> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001912 let Inst{31-25} = 0b1111001;
Chris Lattner63274cb2010-11-15 05:19:05 +00001913 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Owen Andersona6201f02011-08-15 23:38:54 +00001914 let DecoderNamespace = "NEONData";
Evan Cheng738a97a2009-11-23 21:57:23 +00001915}
1916
Johnny Chen020023a2010-03-23 20:40:44 +00001917class NDataXI<dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001918 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen020023a2010-03-23 20:40:44 +00001919 : NeonXI<oops, iops, AddrModeNone, IndexModeNone, f, itin, opc, asm,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001920 cstr, pattern> {
Bob Wilson2e076c42009-06-22 23:27:02 +00001921 let Inst{31-25} = 0b1111001;
Owen Andersonb538a222010-12-10 22:32:08 +00001922 let PostEncoderMethod = "NEONThumb2DataIPostEncoder";
Owen Andersona6201f02011-08-15 23:38:54 +00001923 let DecoderNamespace = "NEONData";
Bob Wilson2e076c42009-06-22 23:27:02 +00001924}
1925
1926// NEON "one register and a modified immediate" format.
1927class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1928 bit op5, bit op4,
David Goodwinb062c232009-08-06 16:52:47 +00001929 dag oops, dag iops, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00001930 string opc, string dt, string asm, string cstr,
1931 list<dag> pattern>
Johnny Chen6a643202010-03-23 23:09:14 +00001932 : NDataI<oops, iops, N1RegModImmFrm, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00001933 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00001934 let Inst{21-19} = op21_19;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001935 let Inst{11-8} = op11_8;
1936 let Inst{7} = op7;
1937 let Inst{6} = op6;
1938 let Inst{5} = op5;
1939 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001940
Owen Anderson284cb362010-10-26 17:40:54 +00001941 // Instruction operands.
1942 bits<5> Vd;
1943 bits<13> SIMM;
Jim Grosbach5876e412010-11-19 22:42:55 +00001944
Owen Anderson284cb362010-10-26 17:40:54 +00001945 let Inst{15-12} = Vd{3-0};
1946 let Inst{22} = Vd{4};
1947 let Inst{24} = SIMM{7};
1948 let Inst{18-16} = SIMM{6-4};
1949 let Inst{3-0} = SIMM{3-0};
Owen Andersone0152a72011-08-09 20:55:18 +00001950 let DecoderMethod = "DecodeNEONModImmInstruction";
Bob Wilson2e076c42009-06-22 23:27:02 +00001951}
1952
1953// NEON 2 vector register format.
1954class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1955 bits<5> op11_7, bit op6, bit op4,
David Goodwinb062c232009-08-06 16:52:47 +00001956 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00001957 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chen9b1f60a2010-03-24 00:57:50 +00001958 : NDataI<oops, iops, N2RegFrm, itin, opc, dt, asm, cstr, pattern> {
Evan Cheng738a97a2009-11-23 21:57:23 +00001959 let Inst{24-23} = op24_23;
1960 let Inst{21-20} = op21_20;
1961 let Inst{19-18} = op19_18;
1962 let Inst{17-16} = op17_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00001963 let Inst{11-7} = op11_7;
1964 let Inst{6} = op6;
1965 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00001966
Owen Anderson24774462010-10-25 18:43:52 +00001967 // Instruction operands.
1968 bits<5> Vd;
1969 bits<5> Vm;
1970
1971 let Inst{15-12} = Vd{3-0};
1972 let Inst{22} = Vd{4};
1973 let Inst{3-0} = Vm{3-0};
1974 let Inst{5} = Vm{4};
Evan Cheng738a97a2009-11-23 21:57:23 +00001975}
1976
Joey Gouly943dd592013-07-18 11:53:22 +00001977// Same as N2V but not predicated.
1978class N2Vnp<bits<2> op17_16, bits<3> op10_8, bit op7, bit op6,
1979 dag oops, dag iops, InstrItinClass itin, string OpcodeStr,
1980 string Dt, ValueType ResTy, ValueType OpTy, list<dag> pattern>
1981 : NeonInp<oops, iops, AddrModeNone, IndexModeNone, N2RegFrm, itin,
1982 OpcodeStr, Dt, "$Vd, $Vm", "", pattern> {
1983 bits<5> Vd;
1984 bits<5> Vm;
1985
1986 // Encode instruction operands
1987 let Inst{22} = Vd{4};
1988 let Inst{15-12} = Vd{3-0};
1989 let Inst{5} = Vm{4};
1990 let Inst{3-0} = Vm{3-0};
1991
1992 // Encode constant bits
1993 let Inst{27-23} = 0b00111;
1994 let Inst{21-20} = 0b11;
1995 let Inst{19-18} = 0b10;
1996 let Inst{17-16} = op17_16;
1997 let Inst{11} = 0;
1998 let Inst{10-8} = op10_8;
1999 let Inst{7} = op7;
2000 let Inst{6} = op6;
2001 let Inst{4} = 0;
2002
2003 let DecoderNamespace = "NEON";
2004}
2005
Evan Cheng738a97a2009-11-23 21:57:23 +00002006// Same as N2V except it doesn't have a datatype suffix.
2007class N2VX<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
Bob Wilson3968c6a2010-03-23 17:23:59 +00002008 bits<5> op11_7, bit op6, bit op4,
2009 dag oops, dag iops, InstrItinClass itin,
2010 string opc, string asm, string cstr, list<dag> pattern>
Johnny Chen9b1f60a2010-03-24 00:57:50 +00002011 : NDataXI<oops, iops, N2RegFrm, itin, opc, asm, cstr, pattern> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002012 let Inst{24-23} = op24_23;
2013 let Inst{21-20} = op21_20;
2014 let Inst{19-18} = op19_18;
2015 let Inst{17-16} = op17_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00002016 let Inst{11-7} = op11_7;
2017 let Inst{6} = op6;
2018 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00002019
Owen Anderson24774462010-10-25 18:43:52 +00002020 // Instruction operands.
2021 bits<5> Vd;
2022 bits<5> Vm;
2023
2024 let Inst{15-12} = Vd{3-0};
2025 let Inst{22} = Vd{4};
2026 let Inst{3-0} = Vm{3-0};
2027 let Inst{5} = Vm{4};
Bob Wilson2e076c42009-06-22 23:27:02 +00002028}
2029
2030// NEON 2 vector register with immediate.
Bob Wilsonbd3650c2009-10-21 02:15:46 +00002031class N2VImm<bit op24, bit op23, bits<4> op11_8, bit op7, bit op6, bit op4,
Johnny Chend82f9002010-03-25 20:39:04 +00002032 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002033 string opc, string dt, string asm, string cstr, list<dag> pattern>
Johnny Chend82f9002010-03-25 20:39:04 +00002034 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00002035 let Inst{24} = op24;
2036 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00002037 let Inst{11-8} = op11_8;
Bill Wendlingb70dc872010-08-31 07:50:46 +00002038 let Inst{7} = op7;
2039 let Inst{6} = op6;
2040 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00002041
Owen Anderson3665fee2010-10-26 20:56:57 +00002042 // Instruction operands.
2043 bits<5> Vd;
2044 bits<5> Vm;
2045 bits<6> SIMM;
2046
2047 let Inst{15-12} = Vd{3-0};
2048 let Inst{22} = Vd{4};
2049 let Inst{3-0} = Vm{3-0};
2050 let Inst{5} = Vm{4};
2051 let Inst{21-16} = SIMM{5-0};
Bob Wilson2e076c42009-06-22 23:27:02 +00002052}
2053
Bob Wilsoncf603fb2010-03-27 03:56:52 +00002054// NEON 3 vector register format.
Owen Andersonabda3ca2011-03-30 23:45:29 +00002055
Jim Grosbacheca54e42011-05-19 17:34:53 +00002056class N3VCommon<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
2057 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
2058 string opc, string dt, string asm, string cstr,
2059 list<dag> pattern>
Johnny Chen2cf04952010-03-26 21:26:28 +00002060 : NDataI<oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00002061 let Inst{24} = op24;
2062 let Inst{23} = op23;
Evan Cheng738a97a2009-11-23 21:57:23 +00002063 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00002064 let Inst{11-8} = op11_8;
2065 let Inst{6} = op6;
2066 let Inst{4} = op4;
Owen Andersonabda3ca2011-03-30 23:45:29 +00002067}
2068
2069class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
2070 dag oops, dag iops, Format f, InstrItinClass itin,
2071 string opc, string dt, string asm, string cstr, list<dag> pattern>
2072 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
2073 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
Owen Anderson9e44cf22010-10-21 20:21:49 +00002074 // Instruction operands.
2075 bits<5> Vd;
2076 bits<5> Vn;
2077 bits<5> Vm;
2078
2079 let Inst{15-12} = Vd{3-0};
2080 let Inst{22} = Vd{4};
2081 let Inst{19-16} = Vn{3-0};
2082 let Inst{7} = Vn{4};
2083 let Inst{3-0} = Vm{3-0};
2084 let Inst{5} = Vm{4};
Evan Cheng738a97a2009-11-23 21:57:23 +00002085}
2086
Joey Goulydf686002013-07-17 13:59:38 +00002087class N3Vnp<bits<5> op27_23, bits<2> op21_20, bits<4> op11_8, bit op6,
2088 bit op4, dag oops, dag iops,Format f, InstrItinClass itin,
2089 string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
2090 SDPatternOperator IntOp, bit Commutable, list<dag> pattern>
2091 : NeonInp<oops, iops, AddrModeNone, IndexModeNone, f, itin, OpcodeStr,
2092 Dt, "$Vd, $Vn, $Vm", "", pattern> {
2093 bits<5> Vd;
2094 bits<5> Vn;
2095 bits<5> Vm;
2096
2097 // Encode instruction operands
2098 let Inst{22} = Vd{4};
2099 let Inst{15-12} = Vd{3-0};
2100 let Inst{19-16} = Vn{3-0};
2101 let Inst{7} = Vn{4};
2102 let Inst{5} = Vm{4};
2103 let Inst{3-0} = Vm{3-0};
2104
2105 // Encode constant bits
2106 let Inst{27-23} = op27_23;
2107 let Inst{21-20} = op21_20;
2108 let Inst{11-8} = op11_8;
2109 let Inst{6} = op6;
2110 let Inst{4} = op4;
2111}
2112
Jim Grosbacheca54e42011-05-19 17:34:53 +00002113class N3VLane32<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
2114 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
2115 string opc, string dt, string asm, string cstr,
2116 list<dag> pattern>
Owen Andersonabda3ca2011-03-30 23:45:29 +00002117 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
2118 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
2119
2120 // Instruction operands.
2121 bits<5> Vd;
2122 bits<5> Vn;
2123 bits<5> Vm;
2124 bit lane;
2125
2126 let Inst{15-12} = Vd{3-0};
2127 let Inst{22} = Vd{4};
2128 let Inst{19-16} = Vn{3-0};
2129 let Inst{7} = Vn{4};
2130 let Inst{3-0} = Vm{3-0};
2131 let Inst{5} = lane;
2132}
2133
Jim Grosbacheca54e42011-05-19 17:34:53 +00002134class N3VLane16<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
2135 bit op4, dag oops, dag iops, Format f, InstrItinClass itin,
2136 string opc, string dt, string asm, string cstr,
2137 list<dag> pattern>
Owen Andersonabda3ca2011-03-30 23:45:29 +00002138 : N3VCommon<op24, op23, op21_20, op11_8, op6, op4,
2139 oops, iops, f, itin, opc, dt, asm, cstr, pattern> {
2140
2141 // Instruction operands.
2142 bits<5> Vd;
2143 bits<5> Vn;
2144 bits<5> Vm;
2145 bits<2> lane;
2146
2147 let Inst{15-12} = Vd{3-0};
2148 let Inst{22} = Vd{4};
2149 let Inst{19-16} = Vn{3-0};
2150 let Inst{7} = Vn{4};
2151 let Inst{2-0} = Vm{2-0};
2152 let Inst{5} = lane{1};
2153 let Inst{3} = lane{0};
2154}
2155
Johnny Chen8a687232010-03-23 21:35:03 +00002156// Same as N3V except it doesn't have a data type suffix.
Bob Wilson3968c6a2010-03-23 17:23:59 +00002157class N3VX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6,
2158 bit op4,
Bob Wilsoncf603fb2010-03-27 03:56:52 +00002159 dag oops, dag iops, Format f, InstrItinClass itin,
Bob Wilson3968c6a2010-03-23 17:23:59 +00002160 string opc, string asm, string cstr, list<dag> pattern>
Bob Wilsoncf603fb2010-03-27 03:56:52 +00002161 : NDataXI<oops, iops, f, itin, opc, asm, cstr, pattern> {
Bill Wendlingb70dc872010-08-31 07:50:46 +00002162 let Inst{24} = op24;
2163 let Inst{23} = op23;
Bob Wilson2e076c42009-06-22 23:27:02 +00002164 let Inst{21-20} = op21_20;
Bill Wendlingb70dc872010-08-31 07:50:46 +00002165 let Inst{11-8} = op11_8;
2166 let Inst{6} = op6;
2167 let Inst{4} = op4;
Jim Grosbach5876e412010-11-19 22:42:55 +00002168
Owen Andersondff239c2010-10-25 18:28:30 +00002169 // Instruction operands.
2170 bits<5> Vd;
2171 bits<5> Vn;
2172 bits<5> Vm;
2173
2174 let Inst{15-12} = Vd{3-0};
2175 let Inst{22} = Vd{4};
2176 let Inst{19-16} = Vn{3-0};
2177 let Inst{7} = Vn{4};
2178 let Inst{3-0} = Vm{3-0};
2179 let Inst{5} = Vm{4};
Bob Wilson2e076c42009-06-22 23:27:02 +00002180}
2181
2182// NEON VMOVs between scalar and core registers.
2183class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00002184 dag oops, dag iops, Format f, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002185 string opc, string dt, string asm, list<dag> pattern>
Owen Anderson651b2302011-07-13 23:22:26 +00002186 : InstARM<AddrModeNone, 4, IndexModeNone, f, NeonDomain,
Bob Wilson3968c6a2010-03-23 17:23:59 +00002187 "", itin> {
Bob Wilson2e076c42009-06-22 23:27:02 +00002188 let Inst{27-20} = opcod1;
Bill Wendlingb70dc872010-08-31 07:50:46 +00002189 let Inst{11-8} = opcod2;
2190 let Inst{6-5} = opcod3;
2191 let Inst{4} = 1;
Johnny Chen8bca1742011-04-06 18:27:46 +00002192 // A8.6.303, A8.6.328, A8.6.329
2193 let Inst{3-0} = 0b0000;
Evan Cheng738a97a2009-11-23 21:57:23 +00002194
2195 let OutOperandList = oops;
Chris Lattnerfb2ceed2010-03-18 21:06:54 +00002196 let InOperandList = !con(iops, (ins pred:$p));
Chris Lattner04c342e2010-10-06 00:05:18 +00002197 let AsmString = !strconcat(opc, "${p}", ".", dt, "\t", asm);
Evan Cheng738a97a2009-11-23 21:57:23 +00002198 let Pattern = pattern;
Bob Wilson2e076c42009-06-22 23:27:02 +00002199 list<Predicate> Predicates = [HasNEON];
Jim Grosbach5876e412010-11-19 22:42:55 +00002200
Chris Lattner63274cb2010-11-15 05:19:05 +00002201 let PostEncoderMethod = "NEONThumb2DupPostEncoder";
Owen Andersonc86a5bd2011-08-10 19:01:10 +00002202 let DecoderNamespace = "NEONDup";
Jim Grosbach5876e412010-11-19 22:42:55 +00002203
Owen Andersoned9652f2010-10-27 21:28:09 +00002204 bits<5> V;
2205 bits<4> R;
Owen Anderson40d24a42010-10-27 19:25:54 +00002206 bits<4> p;
Owen Andersoned9652f2010-10-27 21:28:09 +00002207 bits<4> lane;
Jim Grosbach5876e412010-11-19 22:42:55 +00002208
Owen Anderson40d24a42010-10-27 19:25:54 +00002209 let Inst{31-28} = p{3-0};
Owen Andersoned9652f2010-10-27 21:28:09 +00002210 let Inst{7} = V{4};
2211 let Inst{19-16} = V{3-0};
2212 let Inst{15-12} = R{3-0};
Bob Wilson2e076c42009-06-22 23:27:02 +00002213}
2214class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00002215 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002216 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00002217 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NGetLnFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002218 opc, dt, asm, pattern>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002219class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00002220 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002221 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00002222 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NSetLnFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002223 opc, dt, asm, pattern>;
Bob Wilson2e076c42009-06-22 23:27:02 +00002224class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
David Goodwinb062c232009-08-06 16:52:47 +00002225 dag oops, dag iops, InstrItinClass itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002226 string opc, string dt, string asm, list<dag> pattern>
Bob Wilsoncc386fb2010-06-25 23:56:05 +00002227 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NDupFrm, itin,
Evan Cheng738a97a2009-11-23 21:57:23 +00002228 opc, dt, asm, pattern>;
David Goodwin3b9c52c2009-08-04 17:53:06 +00002229
Johnny Chen45ab3f32010-03-25 17:01:27 +00002230// Vector Duplicate Lane (from scalar to all elements)
2231class NVDupLane<bits<4> op19_16, bit op6, dag oops, dag iops,
2232 InstrItinClass itin, string opc, string dt, string asm,
2233 list<dag> pattern>
Johnny Chen91d27742010-03-25 21:49:12 +00002234 : NDataI<oops, iops, NVDupLnFrm, itin, opc, dt, asm, "", pattern> {
Johnny Chen45ab3f32010-03-25 17:01:27 +00002235 let Inst{24-23} = 0b11;
2236 let Inst{21-20} = 0b11;
2237 let Inst{19-16} = op19_16;
Bill Wendlingb70dc872010-08-31 07:50:46 +00002238 let Inst{11-7} = 0b11000;
2239 let Inst{6} = op6;
2240 let Inst{4} = 0;
Jim Grosbach5876e412010-11-19 22:42:55 +00002241
Owen Anderson40d24a42010-10-27 19:25:54 +00002242 bits<5> Vd;
2243 bits<5> Vm;
Jim Grosbach5876e412010-11-19 22:42:55 +00002244
Owen Anderson40d24a42010-10-27 19:25:54 +00002245 let Inst{22} = Vd{4};
2246 let Inst{15-12} = Vd{3-0};
2247 let Inst{5} = Vm{4};
2248 let Inst{3-0} = Vm{3-0};
Johnny Chen45ab3f32010-03-25 17:01:27 +00002249}
2250
David Goodwin3b9c52c2009-08-04 17:53:06 +00002251// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
2252// for single-precision FP.
2253class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
2254 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
2255}
Jim Grosbach7996b152011-11-14 22:28:39 +00002256
2257// VFP/NEON Instruction aliases for type suffices.
2258class VFPDataTypeInstAlias<string opc, string dt, string asm, dag Result> :
Jim Grosbachfdf9e152011-12-05 20:29:59 +00002259 InstAlias<!strconcat(opc, dt, "\t", asm), Result>, Requires<[HasVFP2]>;
Jim Grosbach2cf294a2011-12-07 01:50:36 +00002260
Jim Grosbach3d6c0e02011-11-14 23:11:19 +00002261multiclass VFPDTAnyInstAlias<string opc, string asm, dag Result> {
Jim Grosbach2cf294a2011-12-07 01:50:36 +00002262 def : VFPDataTypeInstAlias<opc, ".8", asm, Result>;
2263 def : VFPDataTypeInstAlias<opc, ".16", asm, Result>;
2264 def : VFPDataTypeInstAlias<opc, ".32", asm, Result>;
2265 def : VFPDataTypeInstAlias<opc, ".64", asm, Result>;
Jim Grosbache7dcbc82011-12-02 18:52:30 +00002266}
2267
Jim Grosbach681db342012-01-24 17:23:29 +00002268multiclass NEONDTAnyInstAlias<string opc, string asm, dag Result> {
2269 let Predicates = [HasNEON] in {
2270 def : VFPDataTypeInstAlias<opc, ".8", asm, Result>;
2271 def : VFPDataTypeInstAlias<opc, ".16", asm, Result>;
2272 def : VFPDataTypeInstAlias<opc, ".32", asm, Result>;
2273 def : VFPDataTypeInstAlias<opc, ".64", asm, Result>;
2274}
2275}
2276
Jim Grosbache7dcbc82011-12-02 18:52:30 +00002277// The same alias classes using AsmPseudo instead, for the more complex
2278// stuff in NEON that InstAlias can't quite handle.
2279// Note that we can't use anonymous defm references here like we can
2280// above, as we care about the ultimate instruction enum names generated, unlike
2281// for instalias defs.
2282class NEONDataTypeAsmPseudoInst<string opc, string dt, string asm, dag iops> :
Jim Grosbachdda976b2011-12-02 22:01:52 +00002283 AsmPseudoInst<!strconcat(opc, dt, "\t", asm), iops>, Requires<[HasNEON]>;
Jim Grosbach585ce302011-12-07 01:17:58 +00002284
2285// Data type suffix token aliases. Implements Table A7-3 in the ARM ARM.
2286def : TokenAlias<".s8", ".i8">;
2287def : TokenAlias<".u8", ".i8">;
2288def : TokenAlias<".s16", ".i16">;
2289def : TokenAlias<".u16", ".i16">;
2290def : TokenAlias<".s32", ".i32">;
2291def : TokenAlias<".u32", ".i32">;
Jim Grosbach2cf294a2011-12-07 01:50:36 +00002292def : TokenAlias<".s64", ".i64">;
2293def : TokenAlias<".u64", ".i64">;
Jim Grosbach585ce302011-12-07 01:17:58 +00002294
2295def : TokenAlias<".i8", ".8">;
2296def : TokenAlias<".i16", ".16">;
2297def : TokenAlias<".i32", ".32">;
Jim Grosbach2cf294a2011-12-07 01:50:36 +00002298def : TokenAlias<".i64", ".64">;
Jim Grosbach585ce302011-12-07 01:17:58 +00002299
2300def : TokenAlias<".p8", ".8">;
2301def : TokenAlias<".p16", ".16">;
2302
2303def : TokenAlias<".f32", ".32">;
2304def : TokenAlias<".f64", ".64">;
2305def : TokenAlias<".f", ".f32">;
2306def : TokenAlias<".d", ".f64">;