blob: de2bb78bb419ad194de47570bce32ebd9d1a6981 [file] [log] [blame]
Evan Cheng7b0249b2008-08-28 23:39:26 +00001//===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
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.
18class Format<bits<5> val> {
19 bits<5> Value = val;
20}
21
Evan Cheng9d2c9232008-11-13 23:36:57 +000022def Pseudo : Format<0>;
23def MulFrm : Format<1>;
24def BrFrm : Format<2>;
25def BrMiscFrm : Format<3>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000026
Evan Cheng9d2c9232008-11-13 23:36:57 +000027def DPFrm : Format<4>;
28def DPSoRegFrm : Format<5>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000029
Evan Cheng9d2c9232008-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 Cheng7b0249b2008-08-28 23:39:26 +000035
Evan Cheng9d2c9232008-11-13 23:36:57 +000036def ArithMiscFrm : Format<11>;
37def ExtFrm : Format<12>;
Evan Chengbb786b32008-11-11 21:48:44 +000038
Evan Cheng9d2c9232008-11-13 23:36:57 +000039def VFPUnaryFrm : Format<13>;
40def VFPBinaryFrm : Format<14>;
41def VFPConv1Frm : Format<15>;
42def VFPConv2Frm : Format<16>;
43def VFPConv3Frm : Format<17>;
44def VFPConv4Frm : Format<18>;
45def VFPConv5Frm : Format<19>;
46def VFPLdStFrm : Format<20>;
47def VFPLdStMulFrm : Format<21>;
48def VFPMiscFrm : Format<22>;
Evan Chengbb786b32008-11-11 21:48:44 +000049
Evan Cheng9d2c9232008-11-13 23:36:57 +000050def ThumbFrm : Format<23>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000051
Bob Wilsone60fee02009-06-22 23:27:02 +000052def NEONFrm : Format<24>;
53def NEONGetLnFrm : Format<25>;
54def NEONSetLnFrm : Format<26>;
55def NEONDupFrm : Format<27>;
56
Evan Cheng9aa4cd32009-07-08 01:46:35 +000057// Misc flags.
58
Evan Cheng86a926a2008-11-05 18:35:52 +000059// the instruction has a Rn register operand.
Evan Cheng9aa4cd32009-07-08 01:46:35 +000060// UnaryDP - Indicates this is a unary data processing instruction, i.e.
61// it doesn't have a Rn operand.
62class UnaryDP { bit isUnaryDataProc = 1; }
63
64// Xform16Bit - Indicates this Thumb2 instruction may be transformed into
65// a 16-bit Thumb instruction if certain conditions are met.
66class Xform16Bit { bit canXformTo16Bit = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000067
Evan Cheng7b0249b2008-08-28 23:39:26 +000068//===----------------------------------------------------------------------===//
Evan Cheng532cdc52009-06-29 07:51:04 +000069// ARM Instruction flags. These need to match ARMInstrInfo.h.
70//
71
72// Addressing mode.
73class AddrMode<bits<4> val> {
74 bits<4> Value = val;
75}
76def AddrModeNone : AddrMode<0>;
77def AddrMode1 : AddrMode<1>;
78def AddrMode2 : AddrMode<2>;
79def AddrMode3 : AddrMode<3>;
80def AddrMode4 : AddrMode<4>;
81def AddrMode5 : AddrMode<5>;
Bob Wilson970a10d2009-07-01 23:16:05 +000082def AddrMode6 : AddrMode<6>;
83def AddrModeT1_1 : AddrMode<7>;
84def AddrModeT1_2 : AddrMode<8>;
85def AddrModeT1_4 : AddrMode<9>;
86def AddrModeT1_s : AddrMode<10>;
David Goodwind1147262009-07-22 22:24:31 +000087def AddrModeT2_i12: AddrMode<11>;
Bob Wilson970a10d2009-07-01 23:16:05 +000088def AddrModeT2_i8 : AddrMode<12>;
89def AddrModeT2_so : AddrMode<13>;
90def AddrModeT2_pc : AddrMode<14>;
91def AddrModeT2_i8s4 : AddrMode<15>;
Evan Cheng532cdc52009-06-29 07:51:04 +000092
93// Instruction size.
94class SizeFlagVal<bits<3> val> {
95 bits<3> Value = val;
96}
97def SizeInvalid : SizeFlagVal<0>; // Unset.
98def SizeSpecial : SizeFlagVal<1>; // Pseudo or special.
99def Size8Bytes : SizeFlagVal<2>;
100def Size4Bytes : SizeFlagVal<3>;
101def Size2Bytes : SizeFlagVal<4>;
102
103// Load / store index mode.
104class IndexMode<bits<2> val> {
105 bits<2> Value = val;
106}
107def IndexModeNone : IndexMode<0>;
108def IndexModePre : IndexMode<1>;
109def IndexModePost : IndexMode<2>;
110
111//===----------------------------------------------------------------------===//
Evan Cheng7b0249b2008-08-28 23:39:26 +0000112
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000113// ARM special operands.
114//
115
116// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
117// register whose default is 0 (no register).
118def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
119 (ops (i32 14), (i32 zero_reg))> {
120 let PrintMethod = "printPredicateOperand";
121}
122
123// Conditional code result for instructions whose 's' bit is set, e.g. subs.
124def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
125 let PrintMethod = "printSBitModifierOperand";
126}
127
128// Same as cc_out except it defaults to setting CPSR.
129def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
130 let PrintMethod = "printSBitModifierOperand";
131}
132
133//===----------------------------------------------------------------------===//
134
Evan Cheng7b0249b2008-08-28 23:39:26 +0000135// ARM Instruction templates.
136//
137
Evan Chengbe998242008-11-06 08:47:38 +0000138class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000139 Format f, string cstr>
140 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +0000141 field bits<32> Inst;
142
Evan Cheng7b0249b2008-08-28 23:39:26 +0000143 let Namespace = "ARM";
144
Evan Cheng86a926a2008-11-05 18:35:52 +0000145 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +0000146 AddrMode AM = am;
147 bits<4> AddrModeBits = AM.Value;
148
149 SizeFlagVal SZ = sz;
150 bits<3> SizeFlag = SZ.Value;
151
152 IndexMode IM = im;
153 bits<2> IndexModeBits = IM.Value;
154
155 Format F = f;
156 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +0000157
158 //
159 // Attributes specific to ARM instructions...
160 //
161 bit isUnaryDataProc = 0;
Evan Cheng9aa4cd32009-07-08 01:46:35 +0000162 bit canXformTo16Bit = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +0000163
164 let Constraints = cstr;
165}
166
167class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000168 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000169 let OutOperandList = oops;
170 let InOperandList = iops;
171 let AsmString = asm;
172 let Pattern = pattern;
173}
174
175// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +0000176class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000177 IndexMode im, Format f, string opc, string asm, string cstr,
178 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000179 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000180 let OutOperandList = oops;
181 let InOperandList = !con(iops, (ops pred:$p));
182 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
183 let Pattern = pattern;
184 list<Predicate> Predicates = [IsARM];
185}
186
187// Same as I except it can optionally modify CPSR. Note it's modeled as
188// an input operand since by default it's a zero register. It will
189// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000190class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000191 IndexMode im, Format f, string opc, string asm, string cstr,
192 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000193 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000194 let OutOperandList = oops;
195 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
196 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
197 let Pattern = pattern;
198 list<Predicate> Predicates = [IsARM];
199}
200
Evan Chengc5409a82008-09-01 07:19:00 +0000201// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000202class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000203 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000204 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000205 let OutOperandList = oops;
206 let InOperandList = iops;
207 let AsmString = asm;
208 let Pattern = pattern;
209 list<Predicate> Predicates = [IsARM];
210}
211
Evan Chengbe998242008-11-06 08:47:38 +0000212class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000213 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000214 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000215 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000216class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000217 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000218 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000219 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000220class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000221 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000222 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000223 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000224
225// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000226class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000227 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000228 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000229 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000230 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000231}
Evan Chengf8e8b622008-11-06 17:48:05 +0000232class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
233 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000234 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000235 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000236}
Evan Chengf8e8b622008-11-06 17:48:05 +0000237class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
238 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000239 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000240
241// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000242class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000243 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000244 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000245
246// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000247class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
248 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000249 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000250 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000251 let Inst{24-21} = opcod;
252 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000253}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000254class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
255 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000256 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000257 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000258 let Inst{24-21} = opcod;
259 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000260}
Evan Chengc5409a82008-09-01 07:19:00 +0000261class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
262 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000263 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000264 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000265 let Inst{24-21} = opcod;
266 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000267}
Evan Chengbe998242008-11-06 08:47:38 +0000268class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000269 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000270 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000271 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000272
Evan Cheng2e62b662008-09-01 01:51:14 +0000273
274// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000275class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000276 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000277 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000278 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000279 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000280}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000281
282// loads
Evan Chengbe998242008-11-06 08:47:38 +0000283class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000284 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000285 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000286 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000287 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000288 let Inst{21} = 0; // W bit
289 let Inst{22} = 0; // B bit
290 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000291 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000292}
Evan Chengbe998242008-11-06 08:47:38 +0000293class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000294 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000295 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000296 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000297 let Inst{20} = 1; // L bit
298 let Inst{21} = 0; // W bit
299 let Inst{22} = 0; // B bit
300 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000301 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000302}
Evan Chengbe998242008-11-06 08:47:38 +0000303class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000304 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000305 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000306 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000307 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000308 let Inst{21} = 0; // W bit
309 let Inst{22} = 1; // B bit
310 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000311 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000312}
Evan Chengbe998242008-11-06 08:47:38 +0000313class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000314 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000315 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000316 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000317 let Inst{20} = 1; // L bit
318 let Inst{21} = 0; // W bit
319 let Inst{22} = 1; // B bit
320 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000321 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000322}
Evan Chengda020022008-08-31 19:02:21 +0000323
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000324// stores
Evan Chengbe998242008-11-06 08:47:38 +0000325class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000326 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000327 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000328 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000329 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000330 let Inst{21} = 0; // W bit
331 let Inst{22} = 0; // B bit
332 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000333 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000334}
Evan Chengbe998242008-11-06 08:47:38 +0000335class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000336 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000337 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000338 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000339 let Inst{20} = 0; // L bit
340 let Inst{21} = 0; // W bit
341 let Inst{22} = 0; // B bit
342 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000343 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000344}
Evan Chengbe998242008-11-06 08:47:38 +0000345class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000346 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000347 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000348 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000349 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350 let Inst{21} = 0; // W bit
351 let Inst{22} = 1; // B bit
352 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000353 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000354}
Evan Chengbe998242008-11-06 08:47:38 +0000355class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000356 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000357 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000358 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000359 let Inst{20} = 0; // L bit
360 let Inst{21} = 0; // W bit
361 let Inst{22} = 1; // B bit
362 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000363 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000364}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000365
Evan Chengac92c3f2008-09-01 07:00:14 +0000366// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000367class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000368 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000369 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000370 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000371 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000372 let Inst{21} = 1; // W bit
373 let Inst{22} = 0; // B bit
374 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000375 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000376}
Evan Chengbe998242008-11-06 08:47:38 +0000377class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000378 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000379 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000380 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000381 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000382 let Inst{21} = 1; // W bit
383 let Inst{22} = 1; // B bit
384 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000385 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000386}
387
Evan Chengac92c3f2008-09-01 07:00:14 +0000388// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000389class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000390 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000391 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000392 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000393 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000394 let Inst{21} = 1; // W bit
395 let Inst{22} = 0; // B bit
396 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000397 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000398}
Evan Chengbe998242008-11-06 08:47:38 +0000399class AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000400 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000401 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000402 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000403 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000404 let Inst{21} = 1; // W bit
405 let Inst{22} = 1; // B bit
406 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000407 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000408}
409
Evan Chengac92c3f2008-09-01 07:00:14 +0000410// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000411class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000412 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000413 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000414 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000415 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000416 let Inst{21} = 0; // W bit
417 let Inst{22} = 0; // B bit
418 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000419 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000420}
Evan Chengbe998242008-11-06 08:47:38 +0000421class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000422 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000423 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000424 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000425 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000426 let Inst{21} = 0; // W bit
427 let Inst{22} = 1; // B bit
428 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000429 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000430}
431
Evan Chengac92c3f2008-09-01 07:00:14 +0000432// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000433class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000434 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000435 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000436 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000437 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000438 let Inst{21} = 0; // W bit
439 let Inst{22} = 0; // B bit
440 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000441 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000442}
Evan Chengbe998242008-11-06 08:47:38 +0000443class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000444 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000445 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000446 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000447 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000448 let Inst{21} = 0; // W bit
449 let Inst{22} = 1; // B bit
450 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000451 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000452}
453
Evan Cheng2e62b662008-09-01 01:51:14 +0000454// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000455class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000456 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000457 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000458 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000459class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000460 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000461 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000462 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000463
Evan Chengac92c3f2008-09-01 07:00:14 +0000464// loads
Evan Chengbe998242008-11-06 08:47:38 +0000465class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000466 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000467 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000468 asm, "", pattern> {
469 let Inst{4} = 1;
470 let Inst{5} = 1; // H bit
471 let Inst{6} = 0; // S bit
472 let Inst{7} = 1;
473 let Inst{20} = 1; // L bit
474 let Inst{21} = 0; // W bit
475 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000476 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000477}
Evan Chengbe998242008-11-06 08:47:38 +0000478class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000479 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000480 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000481 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000482 let Inst{4} = 1;
483 let Inst{5} = 1; // H bit
484 let Inst{6} = 0; // S bit
485 let Inst{7} = 1;
486 let Inst{20} = 1; // L bit
487 let Inst{21} = 0; // W bit
488 let Inst{24} = 1; // P bit
489}
Evan Chengbe998242008-11-06 08:47:38 +0000490class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000491 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000492 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000493 asm, "", pattern> {
494 let Inst{4} = 1;
495 let Inst{5} = 1; // H bit
496 let Inst{6} = 1; // S bit
497 let Inst{7} = 1;
498 let Inst{20} = 1; // L bit
499 let Inst{21} = 0; // W bit
500 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000501 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000502}
Evan Chengbe998242008-11-06 08:47:38 +0000503class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000504 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000505 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000506 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000507 let Inst{4} = 1;
508 let Inst{5} = 1; // H bit
509 let Inst{6} = 1; // S bit
510 let Inst{7} = 1;
511 let Inst{20} = 1; // L bit
512 let Inst{21} = 0; // W bit
513 let Inst{24} = 1; // P bit
514}
Evan Chengbe998242008-11-06 08:47:38 +0000515class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000516 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000517 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000518 asm, "", pattern> {
519 let Inst{4} = 1;
520 let Inst{5} = 0; // H bit
521 let Inst{6} = 1; // S bit
522 let Inst{7} = 1;
523 let Inst{20} = 1; // L bit
524 let Inst{21} = 0; // W bit
525 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000526 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000527}
Evan Chengbe998242008-11-06 08:47:38 +0000528class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000529 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000530 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000531 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000532 let Inst{4} = 1;
533 let Inst{5} = 0; // H bit
534 let Inst{6} = 1; // S bit
535 let Inst{7} = 1;
536 let Inst{20} = 1; // L bit
537 let Inst{21} = 0; // W bit
538 let Inst{24} = 1; // P bit
539}
Evan Chengbe998242008-11-06 08:47:38 +0000540class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000541 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000542 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000543 asm, "", pattern> {
544 let Inst{4} = 1;
545 let Inst{5} = 0; // H bit
546 let Inst{6} = 1; // S bit
547 let Inst{7} = 1;
548 let Inst{20} = 0; // L bit
549 let Inst{21} = 0; // W bit
550 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000551 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000552}
553
554// stores
Evan Chengbe998242008-11-06 08:47:38 +0000555class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000556 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000557 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000558 asm, "", pattern> {
559 let Inst{4} = 1;
560 let Inst{5} = 1; // H bit
561 let Inst{6} = 0; // S bit
562 let Inst{7} = 1;
563 let Inst{20} = 0; // L bit
564 let Inst{21} = 0; // W bit
565 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000566 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000567}
Evan Chengbe998242008-11-06 08:47:38 +0000568class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000569 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000570 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000571 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000572 let Inst{4} = 1;
573 let Inst{5} = 1; // H bit
574 let Inst{6} = 0; // S bit
575 let Inst{7} = 1;
576 let Inst{20} = 0; // L bit
577 let Inst{21} = 0; // W bit
578 let Inst{24} = 1; // P bit
579}
Evan Chengbe998242008-11-06 08:47:38 +0000580class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000581 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000582 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000583 asm, "", pattern> {
584 let Inst{4} = 1;
585 let Inst{5} = 1; // H bit
586 let Inst{6} = 1; // S bit
587 let Inst{7} = 1;
588 let Inst{20} = 0; // L bit
589 let Inst{21} = 0; // W bit
590 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000591 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000592}
593
594// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000595class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000596 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000597 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000598 asm, cstr, pattern> {
599 let Inst{4} = 1;
600 let Inst{5} = 1; // H bit
601 let Inst{6} = 0; // S bit
602 let Inst{7} = 1;
603 let Inst{20} = 1; // L bit
604 let Inst{21} = 1; // W bit
605 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000606 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000607}
Evan Chengbe998242008-11-06 08:47:38 +0000608class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000609 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000610 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000611 asm, cstr, pattern> {
612 let Inst{4} = 1;
613 let Inst{5} = 1; // H bit
614 let Inst{6} = 1; // S bit
615 let Inst{7} = 1;
616 let Inst{20} = 1; // L bit
617 let Inst{21} = 1; // W bit
618 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000619 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000620}
Evan Chengbe998242008-11-06 08:47:38 +0000621class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000622 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000623 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000624 asm, cstr, pattern> {
625 let Inst{4} = 1;
626 let Inst{5} = 0; // H bit
627 let Inst{6} = 1; // S bit
628 let Inst{7} = 1;
629 let Inst{20} = 1; // L bit
630 let Inst{21} = 1; // W bit
631 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000632 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000633}
634
635// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000636class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000637 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000638 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000639 asm, cstr, pattern> {
640 let Inst{4} = 1;
641 let Inst{5} = 1; // H bit
642 let Inst{6} = 0; // S bit
643 let Inst{7} = 1;
644 let Inst{20} = 0; // L bit
645 let Inst{21} = 1; // W bit
646 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000647 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000648}
649
650// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000651class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000652 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000653 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000654 asm, cstr,pattern> {
655 let Inst{4} = 1;
656 let Inst{5} = 1; // H bit
657 let Inst{6} = 0; // S bit
658 let Inst{7} = 1;
659 let Inst{20} = 1; // L bit
660 let Inst{21} = 1; // W bit
661 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000662 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000663}
Evan Chengbe998242008-11-06 08:47:38 +0000664class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000665 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000666 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000667 asm, cstr,pattern> {
668 let Inst{4} = 1;
669 let Inst{5} = 1; // H bit
670 let Inst{6} = 1; // S bit
671 let Inst{7} = 1;
672 let Inst{20} = 1; // L bit
673 let Inst{21} = 1; // W bit
674 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000675 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000676}
Evan Chengbe998242008-11-06 08:47:38 +0000677class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000678 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000679 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000680 asm, cstr,pattern> {
681 let Inst{4} = 1;
682 let Inst{5} = 0; // H bit
683 let Inst{6} = 1; // S bit
684 let Inst{7} = 1;
685 let Inst{20} = 1; // L bit
686 let Inst{21} = 1; // W bit
687 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000688 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000689}
690
691// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000692class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000693 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000694 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000695 asm, cstr,pattern> {
696 let Inst{4} = 1;
697 let Inst{5} = 1; // H bit
698 let Inst{6} = 0; // S bit
699 let Inst{7} = 1;
700 let Inst{20} = 0; // L bit
701 let Inst{21} = 1; // W bit
702 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000703 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000704}
705
706
Evan Cheng2e62b662008-09-01 01:51:14 +0000707// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000708class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000709 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000710 "", pattern> {
711 let Inst{20} = 1; // L bit
712 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000713 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000714}
Evan Chengf8e8b622008-11-06 17:48:05 +0000715class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000716 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000717 "", pattern> {
718 let Inst{20} = 0; // L bit
719 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000720 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000721}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000722
Jim Grosbach1feed042008-11-03 18:38:31 +0000723// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000724class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000725 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000726 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000727 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000728 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000729 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000730 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000731}
Evan Chengbe998242008-11-06 08:47:38 +0000732class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000733 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000734 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000735 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000736 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000737 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000738}
739
740// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000741class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000742 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000743 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000744 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000745 let Inst{7-4} = 0b1001;
746 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000747 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000748}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000749
Evan Cheng38396be2008-11-06 03:35:07 +0000750// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000751class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000752 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000753 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000754 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000755 let Inst{4} = 0;
756 let Inst{7} = 1;
757 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000758 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000759}
760
Evan Cheng37afa432008-11-06 22:15:19 +0000761// Extend instructions.
762class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
763 string asm, list<dag> pattern>
764 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
765 asm, "", pattern> {
766 let Inst{7-4} = 0b0111;
767 let Inst{27-20} = opcod;
768}
769
Evan Chengc2121a22008-11-07 01:41:35 +0000770// Misc Arithmetic instructions.
771class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
772 string asm, list<dag> pattern>
773 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
774 asm, "", pattern> {
775 let Inst{27-20} = opcod;
776}
777
Evan Cheng7b0249b2008-08-28 23:39:26 +0000778//===----------------------------------------------------------------------===//
779
780// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
781class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
782 list<Predicate> Predicates = [IsARM];
783}
784class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
785 list<Predicate> Predicates = [IsARM, HasV5TE];
786}
787class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
788 list<Predicate> Predicates = [IsARM, HasV6];
789}
Evan Cheng34a46e12008-08-29 06:41:12 +0000790
791//===----------------------------------------------------------------------===//
792//
793// Thumb Instruction Format Definitions.
794//
795
Evan Cheng34a46e12008-08-29 06:41:12 +0000796// TI - Thumb instruction.
797
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000798class ThumbI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng34a46e12008-08-29 06:41:12 +0000799 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000800 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000801 let OutOperandList = oops;
802 let InOperandList = iops;
Evan Cheng34a46e12008-08-29 06:41:12 +0000803 let AsmString = asm;
804 let Pattern = pattern;
805 list<Predicate> Predicates = [IsThumb];
806}
807
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000808class TI<dag oops, dag iops, string asm, list<dag> pattern>
809 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000810
Evan Cheng68e4b582009-08-01 00:16:10 +0000811// tBL, tBX instructions
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000812class TIx2<dag oops, dag iops, string asm, list<dag> pattern>
813 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000814
815// BR_JT instructions
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000816class TJTI<dag oops, dag iops, string asm, list<dag> pattern>
817 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000818
Evan Cheng6fc534c2009-06-23 19:38:13 +0000819// Thumb1 only
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000820class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng6fc534c2009-06-23 19:38:13 +0000821 string asm, string cstr, list<dag> pattern>
822 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000823 let OutOperandList = oops;
824 let InOperandList = iops;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000825 let AsmString = asm;
826 let Pattern = pattern;
827 list<Predicate> Predicates = [IsThumb1Only];
828}
829
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000830class T1I<dag oops, dag iops, string asm, list<dag> pattern>
831 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, asm, "", pattern>;
832class T1Ix2<dag oops, dag iops, string asm, list<dag> pattern>
833 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
834class T1JTI<dag oops, dag iops, string asm, list<dag> pattern>
835 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000836
837// Two-address instructions
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000838class T1It<dag oops, dag iops, string asm, list<dag> pattern>
839 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
840
841// Thumb1 instruction that can either be predicated or set CPSR.
842class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
843 string opc, string asm, string cstr, list<dag> pattern>
844 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
845 let OutOperandList = !con(oops, (ops s_cc_out:$s));
846 let InOperandList = !con(iops, (ops pred:$p));
847 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
848 let Pattern = pattern;
849 list<Predicate> Predicates = [IsThumb1Only];
850}
851
852class T1sI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
853 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, opc, asm, "", pattern>;
854
855// Two-address instructions
856class T1sIt<dag oops, dag iops, string opc, string asm, list<dag> pattern>
857 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, opc, asm,
858 "$lhs = $dst", pattern>;
859
860// Thumb1 instruction that can be predicated.
861class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
862 string opc, string asm, string cstr, list<dag> pattern>
863 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
864 let OutOperandList = oops;
865 let InOperandList = !con(iops, (ops pred:$p));
866 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
867 let Pattern = pattern;
868 list<Predicate> Predicates = [IsThumb1Only];
869}
870
871class T1pI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
872 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, opc, asm, "", pattern>;
873
874// Two-address instructions
875class T1pIt<dag oops, dag iops, string opc, string asm, list<dag> pattern>
876 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, opc, asm,
877 "$lhs = $dst", pattern>;
878
879class T1pI1<dag oops, dag iops, string opc, string asm, list<dag> pattern>
880 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, opc, asm, "", pattern>;
881class T1pI2<dag oops, dag iops, string opc, string asm, list<dag> pattern>
882 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, opc, asm, "", pattern>;
883class T1pI4<dag oops, dag iops, string opc, string asm, list<dag> pattern>
884 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, opc, asm, "", pattern>;
885class T1pIs<dag oops, dag iops, string opc, string asm, list<dag> pattern>
886 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, opc, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000887
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000888// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
889class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
890 string opc, string asm, string cstr, list<dag> pattern>
Evan Cheng36173712009-06-23 17:48:47 +0000891 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000892 let OutOperandList = oops;
893 let InOperandList = !con(iops, (ops pred:$p));
894 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
895 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000896 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000897}
898
899// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
900// an input operand since by default it's a zero register. It will
901// become an implicit def once it's "flipped".
902// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
903// more consistent.
904class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
905 string opc, string asm, string cstr, list<dag> pattern>
906 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
907 let OutOperandList = oops;
908 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
909 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
910 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000911 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000912}
913
914// Special cases
915class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
916 string asm, string cstr, list<dag> pattern>
917 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
918 let OutOperandList = oops;
919 let InOperandList = iops;
Evan Cheng36173712009-06-23 17:48:47 +0000920 let AsmString = asm;
921 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000922 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000923}
924
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000925class T2I<dag oops, dag iops, string opc, string asm, list<dag> pattern>
926 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng532cdc52009-06-29 07:51:04 +0000927class T2Ii12<dag oops, dag iops, string opc, string asm, list<dag> pattern>
928 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, opc, asm, "", pattern>;
929class T2Ii8<dag oops, dag iops, string opc, string asm, list<dag> pattern>
930 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, opc, asm, "", pattern>;
931class T2Iso<dag oops, dag iops, string opc, string asm, list<dag> pattern>
932 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, opc, asm, "", pattern>;
933class T2Ipc<dag oops, dag iops, string opc, string asm, list<dag> pattern>
934 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng503be112009-06-30 02:15:48 +0000935class T2Ii8s4<dag oops, dag iops, string opc, string asm, list<dag> pattern>
936 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000937
938class T2sI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
939 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, opc, asm, "", pattern>;
940
941class T2XI<dag oops, dag iops, string asm, list<dag> pattern>
942 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
David Goodwinf6154702009-06-30 18:04:13 +0000943class T2JTI<dag oops, dag iops, string asm, list<dag> pattern>
944 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng36173712009-06-23 17:48:47 +0000945
Evan Chenga90942e2009-07-02 07:28:31 +0000946// T2Iidxldst - Thumb2 indexed load / store instructions.
947class T2Iidxldst<dag oops, dag iops, AddrMode am, IndexMode im,
948 string opc, string asm, string cstr, list<dag> pattern>
949 : InstARM<am, Size4Bytes, im, ThumbFrm, cstr> {
950 let OutOperandList = oops;
951 let InOperandList = !con(iops, (ops pred:$p));
952 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
953 let Pattern = pattern;
954 list<Predicate> Predicates = [IsThumb2];
955}
956
David Goodwin27c016b2009-07-27 19:59:26 +0000957// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
958class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
959 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
960}
961
962// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
963class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
964 list<Predicate> Predicates = [IsThumb1Only];
965}
Evan Chenga90942e2009-07-02 07:28:31 +0000966
Evan Cheng19bb7c72009-06-27 02:26:13 +0000967// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
968class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengb1b2abc2009-07-02 06:38:40 +0000969 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000970}
971
Evan Cheng34a46e12008-08-29 06:41:12 +0000972//===----------------------------------------------------------------------===//
973
Evan Chengc63e15e2008-11-11 02:11:05 +0000974//===----------------------------------------------------------------------===//
975// ARM VFP Instruction templates.
976//
977
David Goodwince9fbbe2009-07-10 17:03:29 +0000978// Almost all VFP instructions are predicable.
979class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
980 IndexMode im, Format f, string opc, string asm, string cstr,
981 list<dag> pattern>
982 : InstARM<am, sz, im, f, cstr> {
983 let OutOperandList = oops;
984 let InOperandList = !con(iops, (ops pred:$p));
985 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
986 let Pattern = pattern;
987 list<Predicate> Predicates = [HasVFP2];
988}
989
990// Special cases
991class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
992 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
993 : InstARM<am, sz, im, f, cstr> {
994 let OutOperandList = oops;
995 let InOperandList = iops;
996 let AsmString = asm;
997 let Pattern = pattern;
998 list<Predicate> Predicates = [HasVFP2];
999}
1000
1001class VFPAI<dag oops, dag iops, Format f, string opc,
1002 string asm, list<dag> pattern>
1003 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
1004 asm, "", pattern>;
1005
Evan Chengbb786b32008-11-11 21:48:44 +00001006// ARM VFP addrmode5 loads and stores
1007class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1008 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001009 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +00001010 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001011 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001012 let Inst{27-24} = opcod1;
1013 let Inst{21-20} = opcod2;
1014 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +00001015}
1016
Evan Chengbb786b32008-11-11 21:48:44 +00001017class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1018 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001019 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +00001020 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001021 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001022 let Inst{27-24} = opcod1;
1023 let Inst{21-20} = opcod2;
1024 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +00001025}
1026
Evan Chengbb786b32008-11-11 21:48:44 +00001027// Load / store multiple
1028class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001029 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +00001030 VFPLdStMulFrm, asm, "", pattern> {
1031 // TODO: Mark the instructions with the appropriate subtarget info.
1032 let Inst{27-25} = 0b110;
1033 let Inst{11-8} = 0b1011;
1034}
1035
1036class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001037 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +00001038 VFPLdStMulFrm, asm, "", pattern> {
1039 // TODO: Mark the instructions with the appropriate subtarget info.
1040 let Inst{27-25} = 0b110;
1041 let Inst{11-8} = 0b1010;
1042}
1043
1044
Evan Chengc63e15e2008-11-11 02:11:05 +00001045// Double precision, unary
1046class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
1047 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001048 : VFPAI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001049 let Inst{27-20} = opcod1;
1050 let Inst{19-16} = opcod2;
1051 let Inst{11-8} = 0b1011;
1052 let Inst{7-4} = opcod3;
1053}
1054
1055// Double precision, binary
1056class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
1057 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001058 : VFPAI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001059 let Inst{27-20} = opcod;
1060 let Inst{11-8} = 0b1011;
1061}
1062
1063// Single precision, unary
1064class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
1065 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001066 : VFPAI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001067 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
1068 let Inst{27-20} = opcod1;
1069 let Inst{19-16} = opcod2;
1070 let Inst{11-8} = 0b1010;
1071 let Inst{7-4} = opcod3;
1072}
1073
1074// Single precision, binary
1075class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
1076 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001077 : VFPAI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001078 // Bit 22 (D bit) can be changed during instruction encoding.
1079 let Inst{27-20} = opcod;
1080 let Inst{11-8} = 0b1010;
1081}
1082
David Goodwindd19ce42009-08-04 17:53:06 +00001083// Single precision, binary if no NEON
1084// Same as ASbI except not available if NEON is enabled
1085class ASbIn<bits<8> opcod, dag oops, dag iops, string opc,
1086 string asm, list<dag> pattern>
1087 : ASbI<opcod, oops, iops, opc, asm, pattern> {
1088 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1089}
1090
Evan Cheng74273382008-11-12 06:41:41 +00001091// VFP conversion instructions
1092class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
1093 dag oops, dag iops, string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001094 : VFPAI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
Evan Cheng9d3cc182008-11-11 19:40:26 +00001095 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +00001096 let Inst{19-16} = opcod2;
1097 let Inst{11-8} = opcod3;
1098 let Inst{6} = 1;
1099}
1100
1101class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1102 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001103 : VFPAI<oops, iops, f, opc, asm, pattern> {
Evan Cheng74273382008-11-12 06:41:41 +00001104 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001105 let Inst{11-8} = opcod2;
1106 let Inst{4} = 1;
1107}
1108
Evan Cheng828ccdc2008-11-11 22:46:12 +00001109class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
Evan Cheng74273382008-11-12 06:41:41 +00001110 string asm, list<dag> pattern>
1111 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +00001112
Evan Cheng74273382008-11-12 06:41:41 +00001113class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1114 string asm, list<dag> pattern>
1115 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
1116
1117class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1118 string asm, list<dag> pattern>
1119 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
1120
1121class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1122 string asm, list<dag> pattern>
1123 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001124
Evan Chengc63e15e2008-11-11 02:11:05 +00001125//===----------------------------------------------------------------------===//
1126
Bob Wilsone60fee02009-06-22 23:27:02 +00001127//===----------------------------------------------------------------------===//
1128// ARM NEON Instruction templates.
1129//
Evan Cheng34a46e12008-08-29 06:41:12 +00001130
Bob Wilsone60fee02009-06-22 23:27:02 +00001131class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, string asm,
1132 string cstr, list<dag> pattern>
1133 : InstARM<am, Size4Bytes, im, NEONFrm, cstr> {
1134 let OutOperandList = oops;
1135 let InOperandList = iops;
1136 let AsmString = asm;
1137 let Pattern = pattern;
1138 list<Predicate> Predicates = [HasNEON];
Evan Cheng34a46e12008-08-29 06:41:12 +00001139}
1140
Bob Wilsone60fee02009-06-22 23:27:02 +00001141class NI<dag oops, dag iops, string asm, list<dag> pattern>
1142 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, "", pattern> {
Evan Cheng34a46e12008-08-29 06:41:12 +00001143}
Bob Wilsone60fee02009-06-22 23:27:02 +00001144
Bob Wilsoned592c02009-07-08 18:11:30 +00001145class NLdSt<dag oops, dag iops, string asm, list<dag> pattern>
1146 : NeonI<oops, iops, AddrMode6, IndexModeNone, asm, "", pattern> {
1147 let Inst{31-24} = 0b11110100;
1148}
1149
Bob Wilsone60fee02009-06-22 23:27:02 +00001150class NDataI<dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1151 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, cstr, pattern> {
1152 let Inst{31-25} = 0b1111001;
1153}
1154
1155// NEON "one register and a modified immediate" format.
1156class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1157 bit op5, bit op4,
1158 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1159 : NDataI<oops, iops, asm, cstr, pattern> {
1160 let Inst{23} = op23;
1161 let Inst{21-19} = op21_19;
1162 let Inst{11-8} = op11_8;
1163 let Inst{7} = op7;
1164 let Inst{6} = op6;
1165 let Inst{5} = op5;
1166 let Inst{4} = op4;
1167}
1168
1169// NEON 2 vector register format.
1170class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1171 bits<5> op11_7, bit op6, bit op4,
1172 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1173 : NDataI<oops, iops, asm, cstr, pattern> {
1174 let Inst{24-23} = op24_23;
1175 let Inst{21-20} = op21_20;
1176 let Inst{19-18} = op19_18;
1177 let Inst{17-16} = op17_16;
1178 let Inst{11-7} = op11_7;
1179 let Inst{6} = op6;
1180 let Inst{4} = op4;
1181}
1182
1183// NEON 2 vector register with immediate.
1184class N2VImm<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1185 bit op6, bit op4,
1186 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1187 : NDataI<oops, iops, asm, cstr, pattern> {
1188 let Inst{24} = op24;
1189 let Inst{23} = op23;
1190 let Inst{21-16} = op21_16;
1191 let Inst{11-8} = op11_8;
1192 let Inst{7} = op7;
1193 let Inst{6} = op6;
1194 let Inst{4} = op4;
1195}
1196
1197// NEON 3 vector register format.
1198class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1199 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1200 : NDataI<oops, iops, asm, cstr, pattern> {
1201 let Inst{24} = op24;
1202 let Inst{23} = op23;
1203 let Inst{21-20} = op21_20;
1204 let Inst{11-8} = op11_8;
1205 let Inst{6} = op6;
1206 let Inst{4} = op4;
1207}
1208
1209// NEON VMOVs between scalar and core registers.
1210class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1211 dag oops, dag iops, Format f, string opc, string asm,
1212 list<dag> pattern>
1213 : AI<oops, iops, f, opc, asm, pattern> {
1214 let Inst{27-20} = opcod1;
1215 let Inst{11-8} = opcod2;
1216 let Inst{6-5} = opcod3;
1217 let Inst{4} = 1;
1218 list<Predicate> Predicates = [HasNEON];
1219}
1220class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1221 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1222 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, opc, asm,
1223 pattern>;
1224class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1225 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1226 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, opc, asm,
1227 pattern>;
1228class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1229 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1230 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, opc, asm, pattern>;
David Goodwindd19ce42009-08-04 17:53:06 +00001231
1232// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1233// for single-precision FP.
1234class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1235 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1236}