blob: 2d76a3615f6b68769beca77c2c114640a3bbbffa [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 Chengd16eb2f2009-08-04 23:47:55 +0000811// Two-address instructions
812class TIt<dag oops, dag iops, string asm, list<dag> pattern>
813 : ThumbI<oops, iops, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
814
Evan Cheng68e4b582009-08-01 00:16:10 +0000815// tBL, tBX instructions
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000816class TIx2<dag oops, dag iops, string asm, list<dag> pattern>
817 : ThumbI<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000818
819// BR_JT instructions
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000820class TJTI<dag oops, dag iops, string asm, list<dag> pattern>
821 : ThumbI<oops, iops, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000822
Evan Cheng6fc534c2009-06-23 19:38:13 +0000823// Thumb1 only
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000824class Thumb1I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng6fc534c2009-06-23 19:38:13 +0000825 string asm, string cstr, list<dag> pattern>
826 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000827 let OutOperandList = oops;
828 let InOperandList = iops;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000829 let AsmString = asm;
830 let Pattern = pattern;
831 list<Predicate> Predicates = [IsThumb1Only];
832}
833
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000834class T1I<dag oops, dag iops, string asm, list<dag> pattern>
835 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, asm, "", pattern>;
836class T1Ix2<dag oops, dag iops, string asm, list<dag> pattern>
837 : Thumb1I<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
838class T1JTI<dag oops, dag iops, string asm, list<dag> pattern>
839 : Thumb1I<oops, iops, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000840
841// Two-address instructions
Evan Cheng7bd2ad12009-07-11 06:43:01 +0000842class T1It<dag oops, dag iops, string asm, list<dag> pattern>
843 : Thumb1I<oops, iops, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
844
845// Thumb1 instruction that can either be predicated or set CPSR.
846class Thumb1sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
847 string opc, string asm, string cstr, list<dag> pattern>
848 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
849 let OutOperandList = !con(oops, (ops s_cc_out:$s));
850 let InOperandList = !con(iops, (ops pred:$p));
851 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
852 let Pattern = pattern;
853 list<Predicate> Predicates = [IsThumb1Only];
854}
855
856class T1sI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
857 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, opc, asm, "", pattern>;
858
859// Two-address instructions
860class T1sIt<dag oops, dag iops, string opc, string asm, list<dag> pattern>
861 : Thumb1sI<oops, iops, AddrModeNone, Size2Bytes, opc, asm,
862 "$lhs = $dst", pattern>;
863
864// Thumb1 instruction that can be predicated.
865class Thumb1pI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
866 string opc, string asm, string cstr, list<dag> pattern>
867 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
868 let OutOperandList = oops;
869 let InOperandList = !con(iops, (ops pred:$p));
870 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
871 let Pattern = pattern;
872 list<Predicate> Predicates = [IsThumb1Only];
873}
874
875class T1pI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
876 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, opc, asm, "", pattern>;
877
878// Two-address instructions
879class T1pIt<dag oops, dag iops, string opc, string asm, list<dag> pattern>
880 : Thumb1pI<oops, iops, AddrModeNone, Size2Bytes, opc, asm,
881 "$lhs = $dst", pattern>;
882
883class T1pI1<dag oops, dag iops, string opc, string asm, list<dag> pattern>
884 : Thumb1pI<oops, iops, AddrModeT1_1, Size2Bytes, opc, asm, "", pattern>;
885class T1pI2<dag oops, dag iops, string opc, string asm, list<dag> pattern>
886 : Thumb1pI<oops, iops, AddrModeT1_2, Size2Bytes, opc, asm, "", pattern>;
887class T1pI4<dag oops, dag iops, string opc, string asm, list<dag> pattern>
888 : Thumb1pI<oops, iops, AddrModeT1_4, Size2Bytes, opc, asm, "", pattern>;
889class T1pIs<dag oops, dag iops, string opc, string asm, list<dag> pattern>
890 : Thumb1pI<oops, iops, AddrModeT1_s, Size2Bytes, opc, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000891
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000892// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
893class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
894 string opc, string asm, string cstr, list<dag> pattern>
Evan Cheng36173712009-06-23 17:48:47 +0000895 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000896 let OutOperandList = oops;
897 let InOperandList = !con(iops, (ops pred:$p));
898 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
899 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000900 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000901}
902
903// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
904// an input operand since by default it's a zero register. It will
905// become an implicit def once it's "flipped".
906// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
907// more consistent.
908class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
909 string opc, string asm, string cstr, list<dag> pattern>
910 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
911 let OutOperandList = oops;
912 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
913 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
914 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000915 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000916}
917
918// Special cases
919class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
920 string asm, string cstr, list<dag> pattern>
921 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
922 let OutOperandList = oops;
923 let InOperandList = iops;
Evan Cheng36173712009-06-23 17:48:47 +0000924 let AsmString = asm;
925 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000926 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000927}
928
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000929class T2I<dag oops, dag iops, string opc, string asm, list<dag> pattern>
930 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng532cdc52009-06-29 07:51:04 +0000931class T2Ii12<dag oops, dag iops, string opc, string asm, list<dag> pattern>
932 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, opc, asm, "", pattern>;
933class T2Ii8<dag oops, dag iops, string opc, string asm, list<dag> pattern>
934 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, opc, asm, "", pattern>;
935class T2Iso<dag oops, dag iops, string opc, string asm, list<dag> pattern>
936 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, opc, asm, "", pattern>;
937class T2Ipc<dag oops, dag iops, string opc, string asm, list<dag> pattern>
938 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng503be112009-06-30 02:15:48 +0000939class T2Ii8s4<dag oops, dag iops, string opc, string asm, list<dag> pattern>
940 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000941
942class T2sI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
943 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, opc, asm, "", pattern>;
944
945class T2XI<dag oops, dag iops, string asm, list<dag> pattern>
946 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
David Goodwinf6154702009-06-30 18:04:13 +0000947class T2JTI<dag oops, dag iops, string asm, list<dag> pattern>
948 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng36173712009-06-23 17:48:47 +0000949
Evan Chenga90942e2009-07-02 07:28:31 +0000950// T2Iidxldst - Thumb2 indexed load / store instructions.
951class T2Iidxldst<dag oops, dag iops, AddrMode am, IndexMode im,
952 string opc, string asm, string cstr, list<dag> pattern>
953 : InstARM<am, Size4Bytes, im, ThumbFrm, cstr> {
954 let OutOperandList = oops;
955 let InOperandList = !con(iops, (ops pred:$p));
956 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
957 let Pattern = pattern;
958 list<Predicate> Predicates = [IsThumb2];
959}
960
David Goodwin27c016b2009-07-27 19:59:26 +0000961// Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
962class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
963 list<Predicate> Predicates = [IsThumb1Only, HasV5T];
964}
965
966// T1Pat - Same as Pat<>, but requires that the compiler be in Thumb1 mode.
967class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
968 list<Predicate> Predicates = [IsThumb1Only];
969}
Evan Chenga90942e2009-07-02 07:28:31 +0000970
Evan Cheng19bb7c72009-06-27 02:26:13 +0000971// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
972class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengb1b2abc2009-07-02 06:38:40 +0000973 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000974}
975
Evan Cheng34a46e12008-08-29 06:41:12 +0000976//===----------------------------------------------------------------------===//
977
Evan Chengc63e15e2008-11-11 02:11:05 +0000978//===----------------------------------------------------------------------===//
979// ARM VFP Instruction templates.
980//
981
David Goodwince9fbbe2009-07-10 17:03:29 +0000982// Almost all VFP instructions are predicable.
983class VFPI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
984 IndexMode im, Format f, string opc, string asm, string cstr,
985 list<dag> pattern>
986 : InstARM<am, sz, im, f, cstr> {
987 let OutOperandList = oops;
988 let InOperandList = !con(iops, (ops pred:$p));
989 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
990 let Pattern = pattern;
991 list<Predicate> Predicates = [HasVFP2];
992}
993
994// Special cases
995class VFPXI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
996 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
997 : InstARM<am, sz, im, f, cstr> {
998 let OutOperandList = oops;
999 let InOperandList = iops;
1000 let AsmString = asm;
1001 let Pattern = pattern;
1002 list<Predicate> Predicates = [HasVFP2];
1003}
1004
1005class VFPAI<dag oops, dag iops, Format f, string opc,
1006 string asm, list<dag> pattern>
1007 : VFPI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
1008 asm, "", pattern>;
1009
Evan Chengbb786b32008-11-11 21:48:44 +00001010// ARM VFP addrmode5 loads and stores
1011class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1012 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001013 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +00001014 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001015 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001016 let Inst{27-24} = opcod1;
1017 let Inst{21-20} = opcod2;
1018 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +00001019}
1020
Evan Chengbb786b32008-11-11 21:48:44 +00001021class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
1022 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001023 : VFPI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +00001024 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001025 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +00001026 let Inst{27-24} = opcod1;
1027 let Inst{21-20} = opcod2;
1028 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +00001029}
1030
Evan Chengbb786b32008-11-11 21:48:44 +00001031// Load / store multiple
1032class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001033 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +00001034 VFPLdStMulFrm, asm, "", pattern> {
1035 // TODO: Mark the instructions with the appropriate subtarget info.
1036 let Inst{27-25} = 0b110;
1037 let Inst{11-8} = 0b1011;
1038}
1039
1040class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001041 : VFPXI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +00001042 VFPLdStMulFrm, asm, "", pattern> {
1043 // TODO: Mark the instructions with the appropriate subtarget info.
1044 let Inst{27-25} = 0b110;
1045 let Inst{11-8} = 0b1010;
1046}
1047
1048
Evan Chengc63e15e2008-11-11 02:11:05 +00001049// Double precision, unary
1050class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
1051 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001052 : VFPAI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001053 let Inst{27-20} = opcod1;
1054 let Inst{19-16} = opcod2;
1055 let Inst{11-8} = 0b1011;
1056 let Inst{7-4} = opcod3;
1057}
1058
1059// Double precision, binary
1060class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
1061 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001062 : VFPAI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001063 let Inst{27-20} = opcod;
1064 let Inst{11-8} = 0b1011;
1065}
1066
1067// Single precision, unary
1068class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
1069 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001070 : VFPAI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001071 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
1072 let Inst{27-20} = opcod1;
1073 let Inst{19-16} = opcod2;
1074 let Inst{11-8} = 0b1010;
1075 let Inst{7-4} = opcod3;
1076}
1077
David Goodwinbc7c05e2009-08-04 20:39:05 +00001078// Single precision, unary if no NEON
1079// Same as ASuI except not available if NEON is enabled
1080class ASuIn<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
1081 string opc, string asm, list<dag> pattern>
1082 : ASuI<opcod1, opcod2, opcod2, oops, iops, opc, asm, pattern> {
1083 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1084}
1085
Evan Chengc63e15e2008-11-11 02:11:05 +00001086// Single precision, binary
1087class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
1088 string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001089 : VFPAI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +00001090 // Bit 22 (D bit) can be changed during instruction encoding.
1091 let Inst{27-20} = opcod;
1092 let Inst{11-8} = 0b1010;
1093}
1094
David Goodwindd19ce42009-08-04 17:53:06 +00001095// Single precision, binary if no NEON
1096// Same as ASbI except not available if NEON is enabled
1097class ASbIn<bits<8> opcod, dag oops, dag iops, string opc,
1098 string asm, list<dag> pattern>
1099 : ASbI<opcod, oops, iops, opc, asm, pattern> {
1100 list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
1101}
1102
Evan Cheng74273382008-11-12 06:41:41 +00001103// VFP conversion instructions
1104class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
1105 dag oops, dag iops, string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001106 : VFPAI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
Evan Cheng9d3cc182008-11-11 19:40:26 +00001107 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +00001108 let Inst{19-16} = opcod2;
1109 let Inst{11-8} = opcod3;
1110 let Inst{6} = 1;
1111}
1112
1113class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1114 string opc, string asm, list<dag> pattern>
David Goodwince9fbbe2009-07-10 17:03:29 +00001115 : VFPAI<oops, iops, f, opc, asm, pattern> {
Evan Cheng74273382008-11-12 06:41:41 +00001116 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001117 let Inst{11-8} = opcod2;
1118 let Inst{4} = 1;
1119}
1120
Evan Cheng828ccdc2008-11-11 22:46:12 +00001121class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
Evan Cheng74273382008-11-12 06:41:41 +00001122 string asm, list<dag> pattern>
1123 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +00001124
Evan Cheng74273382008-11-12 06:41:41 +00001125class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1126 string asm, list<dag> pattern>
1127 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
1128
1129class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1130 string asm, list<dag> pattern>
1131 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
1132
1133class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1134 string asm, list<dag> pattern>
1135 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001136
Evan Chengc63e15e2008-11-11 02:11:05 +00001137//===----------------------------------------------------------------------===//
1138
Bob Wilsone60fee02009-06-22 23:27:02 +00001139//===----------------------------------------------------------------------===//
1140// ARM NEON Instruction templates.
1141//
Evan Cheng34a46e12008-08-29 06:41:12 +00001142
Bob Wilsone60fee02009-06-22 23:27:02 +00001143class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, string asm,
1144 string cstr, list<dag> pattern>
1145 : InstARM<am, Size4Bytes, im, NEONFrm, cstr> {
1146 let OutOperandList = oops;
1147 let InOperandList = iops;
1148 let AsmString = asm;
1149 let Pattern = pattern;
1150 list<Predicate> Predicates = [HasNEON];
Evan Cheng34a46e12008-08-29 06:41:12 +00001151}
1152
Bob Wilsone60fee02009-06-22 23:27:02 +00001153class NI<dag oops, dag iops, string asm, list<dag> pattern>
1154 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, "", pattern> {
Evan Cheng34a46e12008-08-29 06:41:12 +00001155}
Bob Wilsone60fee02009-06-22 23:27:02 +00001156
Bob Wilsoned592c02009-07-08 18:11:30 +00001157class NLdSt<dag oops, dag iops, string asm, list<dag> pattern>
1158 : NeonI<oops, iops, AddrMode6, IndexModeNone, asm, "", pattern> {
1159 let Inst{31-24} = 0b11110100;
1160}
1161
Bob Wilsone60fee02009-06-22 23:27:02 +00001162class NDataI<dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1163 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, cstr, pattern> {
1164 let Inst{31-25} = 0b1111001;
1165}
1166
1167// NEON "one register and a modified immediate" format.
1168class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1169 bit op5, bit op4,
1170 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1171 : NDataI<oops, iops, asm, cstr, pattern> {
1172 let Inst{23} = op23;
1173 let Inst{21-19} = op21_19;
1174 let Inst{11-8} = op11_8;
1175 let Inst{7} = op7;
1176 let Inst{6} = op6;
1177 let Inst{5} = op5;
1178 let Inst{4} = op4;
1179}
1180
1181// NEON 2 vector register format.
1182class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1183 bits<5> op11_7, bit op6, bit op4,
1184 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1185 : NDataI<oops, iops, asm, cstr, pattern> {
1186 let Inst{24-23} = op24_23;
1187 let Inst{21-20} = op21_20;
1188 let Inst{19-18} = op19_18;
1189 let Inst{17-16} = op17_16;
1190 let Inst{11-7} = op11_7;
1191 let Inst{6} = op6;
1192 let Inst{4} = op4;
1193}
1194
1195// NEON 2 vector register with immediate.
1196class N2VImm<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1197 bit op6, bit op4,
1198 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1199 : NDataI<oops, iops, asm, cstr, pattern> {
1200 let Inst{24} = op24;
1201 let Inst{23} = op23;
1202 let Inst{21-16} = op21_16;
1203 let Inst{11-8} = op11_8;
1204 let Inst{7} = op7;
1205 let Inst{6} = op6;
1206 let Inst{4} = op4;
1207}
1208
1209// NEON 3 vector register format.
1210class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1211 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1212 : NDataI<oops, iops, asm, cstr, pattern> {
1213 let Inst{24} = op24;
1214 let Inst{23} = op23;
1215 let Inst{21-20} = op21_20;
1216 let Inst{11-8} = op11_8;
1217 let Inst{6} = op6;
1218 let Inst{4} = op4;
1219}
1220
1221// NEON VMOVs between scalar and core registers.
1222class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1223 dag oops, dag iops, Format f, string opc, string asm,
1224 list<dag> pattern>
1225 : AI<oops, iops, f, opc, asm, pattern> {
1226 let Inst{27-20} = opcod1;
1227 let Inst{11-8} = opcod2;
1228 let Inst{6-5} = opcod3;
1229 let Inst{4} = 1;
1230 list<Predicate> Predicates = [HasNEON];
1231}
1232class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1233 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1234 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, opc, asm,
1235 pattern>;
1236class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1237 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1238 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, opc, asm,
1239 pattern>;
1240class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1241 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1242 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, opc, asm, pattern>;
David Goodwindd19ce42009-08-04 17:53:06 +00001243
1244// NEONFPPat - Same as Pat<>, but requires that the compiler be using NEON
1245// for single-precision FP.
1246class NEONFPPat<dag pattern, dag result> : Pat<pattern, result> {
1247 list<Predicate> Predicates = [HasNEON,UseNEONForFP];
1248}