blob: b9868ccf6aede184bba7521ef2020d099458ac24 [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>;
87def AddrModeT2_i12: AddrMode<12>;
88def 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
113// ARM Instruction templates.
114//
115
Evan Chengbe998242008-11-06 08:47:38 +0000116class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000117 Format f, string cstr>
118 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +0000119 field bits<32> Inst;
120
Evan Cheng7b0249b2008-08-28 23:39:26 +0000121 let Namespace = "ARM";
122
Evan Cheng86a926a2008-11-05 18:35:52 +0000123 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +0000124 AddrMode AM = am;
125 bits<4> AddrModeBits = AM.Value;
126
127 SizeFlagVal SZ = sz;
128 bits<3> SizeFlag = SZ.Value;
129
130 IndexMode IM = im;
131 bits<2> IndexModeBits = IM.Value;
132
133 Format F = f;
134 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +0000135
136 //
137 // Attributes specific to ARM instructions...
138 //
139 bit isUnaryDataProc = 0;
Evan Cheng9aa4cd32009-07-08 01:46:35 +0000140 bit canXformTo16Bit = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +0000141
142 let Constraints = cstr;
143}
144
145class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000146 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000147 let OutOperandList = oops;
148 let InOperandList = iops;
149 let AsmString = asm;
150 let Pattern = pattern;
151}
152
153// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +0000154class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000155 IndexMode im, Format f, string opc, string asm, string cstr,
156 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000157 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000158 let OutOperandList = oops;
159 let InOperandList = !con(iops, (ops pred:$p));
160 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
161 let Pattern = pattern;
162 list<Predicate> Predicates = [IsARM];
163}
164
165// Same as I except it can optionally modify CPSR. Note it's modeled as
166// an input operand since by default it's a zero register. It will
167// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000168class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000169 IndexMode im, Format f, string opc, string asm, string cstr,
170 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000171 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000172 let OutOperandList = oops;
173 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
174 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
175 let Pattern = pattern;
176 list<Predicate> Predicates = [IsARM];
177}
178
Evan Chengc5409a82008-09-01 07:19:00 +0000179// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000180class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000181 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000182 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000183 let OutOperandList = oops;
184 let InOperandList = iops;
185 let AsmString = asm;
186 let Pattern = pattern;
187 list<Predicate> Predicates = [IsARM];
188}
189
Evan Chengbe998242008-11-06 08:47:38 +0000190class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000191 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000192 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000193 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000194class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000195 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000196 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000197 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000198class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000199 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000200 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000201 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000202
203// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000204class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000205 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000206 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000207 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000208 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000209}
Evan Chengf8e8b622008-11-06 17:48:05 +0000210class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
211 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000212 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000213 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000214}
Evan Chengf8e8b622008-11-06 17:48:05 +0000215class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
216 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000217 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000218
219// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000220class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000221 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000222 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000223
224// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000225class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
226 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000227 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000228 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000229 let Inst{24-21} = opcod;
230 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000231}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000232class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
233 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000234 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000235 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000236 let Inst{24-21} = opcod;
237 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000238}
Evan Chengc5409a82008-09-01 07:19:00 +0000239class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
240 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000241 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000242 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000243 let Inst{24-21} = opcod;
244 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000245}
Evan Chengbe998242008-11-06 08:47:38 +0000246class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000247 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000248 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000249 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000250
Evan Cheng2e62b662008-09-01 01:51:14 +0000251
252// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000253class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000254 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000255 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000256 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000257 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000258}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000259
260// loads
Evan Chengbe998242008-11-06 08:47:38 +0000261class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000262 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000263 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000264 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000265 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000266 let Inst{21} = 0; // W bit
267 let Inst{22} = 0; // B bit
268 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000269 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000270}
Evan Chengbe998242008-11-06 08:47:38 +0000271class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000272 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000273 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000274 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000275 let Inst{20} = 1; // L bit
276 let Inst{21} = 0; // W bit
277 let Inst{22} = 0; // B bit
278 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000279 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000280}
Evan Chengbe998242008-11-06 08:47:38 +0000281class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000282 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000283 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000284 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000285 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000286 let Inst{21} = 0; // W bit
287 let Inst{22} = 1; // B bit
288 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000289 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000290}
Evan Chengbe998242008-11-06 08:47:38 +0000291class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000292 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000293 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000294 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000295 let Inst{20} = 1; // L bit
296 let Inst{21} = 0; // W bit
297 let Inst{22} = 1; // B bit
298 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000299 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000300}
Evan Chengda020022008-08-31 19:02:21 +0000301
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000302// stores
Evan Chengbe998242008-11-06 08:47:38 +0000303class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +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} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000308 let Inst{21} = 0; // W bit
309 let Inst{22} = 0; // B bit
310 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000311 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000312}
Evan Chengbe998242008-11-06 08:47:38 +0000313class AXI2stw<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} = 0; // L bit
318 let Inst{21} = 0; // W bit
319 let Inst{22} = 0; // 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 Chengbe998242008-11-06 08:47:38 +0000323class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000324 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000325 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000326 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000327 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000328 let Inst{21} = 0; // W bit
329 let Inst{22} = 1; // B bit
330 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000331 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000332}
Evan Chengbe998242008-11-06 08:47:38 +0000333class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000334 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000335 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000336 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000337 let Inst{20} = 0; // L bit
338 let Inst{21} = 0; // W bit
339 let Inst{22} = 1; // B bit
340 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000341 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000342}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000343
Evan Chengac92c3f2008-09-01 07:00:14 +0000344// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000345class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000346 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000347 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000348 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000349 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350 let Inst{21} = 1; // W bit
351 let Inst{22} = 0; // 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 AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000356 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000357 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000359 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000360 let Inst{21} = 1; // 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 Cheng1a7c1cc2008-09-01 01:27:33 +0000364}
365
Evan Chengac92c3f2008-09-01 07:00:14 +0000366// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000367class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +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} = 0; // 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 AI2stbpr<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} = 0; // 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// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000389class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000390 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000391 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000392 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000393 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000394 let Inst{21} = 0; // W bit
395 let Inst{22} = 0; // B bit
396 let Inst{24} = 0; // 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 AI2ldbpo<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, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000402 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000403 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000404 let Inst{21} = 0; // W bit
405 let Inst{22} = 1; // B bit
406 let Inst{24} = 0; // 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 stores
Evan Chengbe998242008-11-06 08:47:38 +0000411class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +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} = 0; // 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 AI2stbpo<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} = 0; // 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 Cheng2e62b662008-09-01 01:51:14 +0000432// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000433class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000434 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000435 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000436 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000437class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000438 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000439 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000440 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000441
Evan Chengac92c3f2008-09-01 07:00:14 +0000442// loads
Evan Chengbe998242008-11-06 08:47:38 +0000443class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000444 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000445 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000446 asm, "", pattern> {
447 let Inst{4} = 1;
448 let Inst{5} = 1; // H bit
449 let Inst{6} = 0; // S bit
450 let Inst{7} = 1;
451 let Inst{20} = 1; // L bit
452 let Inst{21} = 0; // W bit
453 let Inst{24} = 1; // P bit
454}
Evan Chengbe998242008-11-06 08:47:38 +0000455class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000456 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000457 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000458 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000459 let Inst{4} = 1;
460 let Inst{5} = 1; // H bit
461 let Inst{6} = 0; // S bit
462 let Inst{7} = 1;
463 let Inst{20} = 1; // L bit
464 let Inst{21} = 0; // W bit
465 let Inst{24} = 1; // P bit
466}
Evan Chengbe998242008-11-06 08:47:38 +0000467class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000468 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000469 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000470 asm, "", pattern> {
471 let Inst{4} = 1;
472 let Inst{5} = 1; // H bit
473 let Inst{6} = 1; // S bit
474 let Inst{7} = 1;
475 let Inst{20} = 1; // L bit
476 let Inst{21} = 0; // W bit
477 let Inst{24} = 1; // P bit
478}
Evan Chengbe998242008-11-06 08:47:38 +0000479class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000480 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000481 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000482 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000483 let Inst{4} = 1;
484 let Inst{5} = 1; // H bit
485 let Inst{6} = 1; // S bit
486 let Inst{7} = 1;
487 let Inst{20} = 1; // L bit
488 let Inst{21} = 0; // W bit
489 let Inst{24} = 1; // P bit
490}
Evan Chengbe998242008-11-06 08:47:38 +0000491class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000492 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000493 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000494 asm, "", pattern> {
495 let Inst{4} = 1;
496 let Inst{5} = 0; // H bit
497 let Inst{6} = 1; // S bit
498 let Inst{7} = 1;
499 let Inst{20} = 1; // L bit
500 let Inst{21} = 0; // W bit
501 let Inst{24} = 1; // P bit
502}
Evan Chengbe998242008-11-06 08:47:38 +0000503class AXI3ldsb<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} = 0; // 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 AI3ldd<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} = 0; // L bit
524 let Inst{21} = 0; // W bit
525 let Inst{24} = 1; // P bit
526}
527
528// stores
Evan Chengbe998242008-11-06 08:47:38 +0000529class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000530 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000531 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000532 asm, "", pattern> {
533 let Inst{4} = 1;
534 let Inst{5} = 1; // H bit
535 let Inst{6} = 0; // S bit
536 let Inst{7} = 1;
537 let Inst{20} = 0; // L bit
538 let Inst{21} = 0; // W bit
539 let Inst{24} = 1; // P bit
540}
Evan Chengbe998242008-11-06 08:47:38 +0000541class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000542 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000543 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000544 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000545 let Inst{4} = 1;
546 let Inst{5} = 1; // H bit
547 let Inst{6} = 0; // S bit
548 let Inst{7} = 1;
549 let Inst{20} = 0; // L bit
550 let Inst{21} = 0; // W bit
551 let Inst{24} = 1; // P bit
552}
Evan Chengbe998242008-11-06 08:47:38 +0000553class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000554 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000555 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000556 asm, "", pattern> {
557 let Inst{4} = 1;
558 let Inst{5} = 1; // H bit
559 let Inst{6} = 1; // S bit
560 let Inst{7} = 1;
561 let Inst{20} = 0; // L bit
562 let Inst{21} = 0; // W bit
563 let Inst{24} = 1; // P bit
564}
565
566// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000567class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000568 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000569 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000570 asm, cstr, pattern> {
571 let Inst{4} = 1;
572 let Inst{5} = 1; // H bit
573 let Inst{6} = 0; // S bit
574 let Inst{7} = 1;
575 let Inst{20} = 1; // L bit
576 let Inst{21} = 1; // W bit
577 let Inst{24} = 1; // P bit
578}
Evan Chengbe998242008-11-06 08:47:38 +0000579class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000580 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000581 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000582 asm, cstr, pattern> {
583 let Inst{4} = 1;
584 let Inst{5} = 1; // H bit
585 let Inst{6} = 1; // S bit
586 let Inst{7} = 1;
587 let Inst{20} = 1; // L bit
588 let Inst{21} = 1; // W bit
589 let Inst{24} = 1; // P bit
590}
Evan Chengbe998242008-11-06 08:47:38 +0000591class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000592 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000593 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000594 asm, cstr, pattern> {
595 let Inst{4} = 1;
596 let Inst{5} = 0; // H bit
597 let Inst{6} = 1; // S bit
598 let Inst{7} = 1;
599 let Inst{20} = 1; // L bit
600 let Inst{21} = 1; // W bit
601 let Inst{24} = 1; // P bit
602}
603
604// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000605class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000606 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000607 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000608 asm, cstr, pattern> {
609 let Inst{4} = 1;
610 let Inst{5} = 1; // H bit
611 let Inst{6} = 0; // S bit
612 let Inst{7} = 1;
613 let Inst{20} = 0; // L bit
614 let Inst{21} = 1; // W bit
615 let Inst{24} = 1; // P bit
616}
617
618// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000619class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000620 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000621 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000622 asm, cstr,pattern> {
623 let Inst{4} = 1;
624 let Inst{5} = 1; // H bit
625 let Inst{6} = 0; // S bit
626 let Inst{7} = 1;
627 let Inst{20} = 1; // L bit
628 let Inst{21} = 1; // W bit
629 let Inst{24} = 0; // P bit
630}
Evan Chengbe998242008-11-06 08:47:38 +0000631class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000632 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000633 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000634 asm, cstr,pattern> {
635 let Inst{4} = 1;
636 let Inst{5} = 1; // H bit
637 let Inst{6} = 1; // S bit
638 let Inst{7} = 1;
639 let Inst{20} = 1; // L bit
640 let Inst{21} = 1; // W bit
641 let Inst{24} = 0; // P bit
642}
Evan Chengbe998242008-11-06 08:47:38 +0000643class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000644 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000645 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000646 asm, cstr,pattern> {
647 let Inst{4} = 1;
648 let Inst{5} = 0; // H bit
649 let Inst{6} = 1; // S bit
650 let Inst{7} = 1;
651 let Inst{20} = 1; // L bit
652 let Inst{21} = 1; // W bit
653 let Inst{24} = 0; // P bit
654}
655
656// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000657class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000658 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000659 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000660 asm, cstr,pattern> {
661 let Inst{4} = 1;
662 let Inst{5} = 1; // H bit
663 let Inst{6} = 0; // S bit
664 let Inst{7} = 1;
665 let Inst{20} = 0; // L bit
666 let Inst{21} = 1; // W bit
667 let Inst{24} = 0; // P bit
668}
669
670
Evan Cheng2e62b662008-09-01 01:51:14 +0000671// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000672class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000673 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000674 "", pattern> {
675 let Inst{20} = 1; // L bit
676 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000677 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000678}
Evan Chengf8e8b622008-11-06 17:48:05 +0000679class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000680 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000681 "", pattern> {
682 let Inst{20} = 0; // L bit
683 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000684 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000685}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000686
Jim Grosbach1feed042008-11-03 18:38:31 +0000687// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000688class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000689 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000690 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000691 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000692 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000693 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000694 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000695}
Evan Chengbe998242008-11-06 08:47:38 +0000696class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000697 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000698 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000699 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000700 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000701 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000702}
703
704// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000705class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000706 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000707 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000708 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000709 let Inst{7-4} = 0b1001;
710 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000711 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000712}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000713
Evan Cheng38396be2008-11-06 03:35:07 +0000714// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000715class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000716 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000717 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000718 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000719 let Inst{4} = 0;
720 let Inst{7} = 1;
721 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000722 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000723}
724
Evan Cheng37afa432008-11-06 22:15:19 +0000725// Extend instructions.
726class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
727 string asm, list<dag> pattern>
728 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
729 asm, "", pattern> {
730 let Inst{7-4} = 0b0111;
731 let Inst{27-20} = opcod;
732}
733
Evan Chengc2121a22008-11-07 01:41:35 +0000734// Misc Arithmetic instructions.
735class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
736 string asm, list<dag> pattern>
737 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
738 asm, "", pattern> {
739 let Inst{27-20} = opcod;
740}
741
Evan Cheng7b0249b2008-08-28 23:39:26 +0000742//===----------------------------------------------------------------------===//
743
744// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
745class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
746 list<Predicate> Predicates = [IsARM];
747}
748class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
749 list<Predicate> Predicates = [IsARM, HasV5TE];
750}
751class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
752 list<Predicate> Predicates = [IsARM, HasV6];
753}
Evan Cheng34a46e12008-08-29 06:41:12 +0000754
755//===----------------------------------------------------------------------===//
756//
757// Thumb Instruction Format Definitions.
758//
759
Evan Cheng34a46e12008-08-29 06:41:12 +0000760// TI - Thumb instruction.
761
762class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
763 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000764 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000765 let OutOperandList = outs;
766 let InOperandList = ins;
767 let AsmString = asm;
768 let Pattern = pattern;
769 list<Predicate> Predicates = [IsThumb];
770}
771
772class TI<dag outs, dag ins, string asm, list<dag> pattern>
773 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000774
775// BL, BLX(1) are translated by assembler into two instructions
776class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
777 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
778
779// BR_JT instructions
780class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
781 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
782
Evan Cheng19bb7c72009-06-27 02:26:13 +0000783// TPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
784class TPat<dag pattern, dag result> : Pat<pattern, result> {
Bob Wilsone60fee02009-06-22 23:27:02 +0000785 list<Predicate> Predicates = [IsThumb];
786}
787
Evan Cheng19bb7c72009-06-27 02:26:13 +0000788class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Bob Wilsone60fee02009-06-22 23:27:02 +0000789 list<Predicate> Predicates = [IsThumb, HasV5T];
790}
Evan Cheng34a46e12008-08-29 06:41:12 +0000791
Evan Cheng6fc534c2009-06-23 19:38:13 +0000792// Thumb1 only
793class Thumb1I<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
794 string asm, string cstr, list<dag> pattern>
795 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
796 let OutOperandList = outs;
797 let InOperandList = ins;
798 let AsmString = asm;
799 let Pattern = pattern;
800 list<Predicate> Predicates = [IsThumb1Only];
801}
802
803class T1I<dag outs, dag ins, string asm, list<dag> pattern>
804 : Thumb1I<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
Evan Cheng532cdc52009-06-29 07:51:04 +0000805class T1I1<dag outs, dag ins, string asm, list<dag> pattern>
806 : Thumb1I<outs, ins, AddrModeT1_1, Size2Bytes, asm, "", pattern>;
807class T1I2<dag outs, dag ins, string asm, list<dag> pattern>
808 : Thumb1I<outs, ins, AddrModeT1_2, Size2Bytes, asm, "", pattern>;
809class T1I4<dag outs, dag ins, string asm, list<dag> pattern>
810 : Thumb1I<outs, ins, AddrModeT1_4, Size2Bytes, asm, "", pattern>;
811class T1Is<dag outs, dag ins, string asm, list<dag> pattern>
812 : Thumb1I<outs, ins, AddrModeT1_s, Size2Bytes, asm, "", pattern>;
David Goodwinf6154702009-06-30 18:04:13 +0000813class T1Ix2<dag outs, dag ins, string asm, list<dag> pattern>
814 : Thumb1I<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
815class T1JTI<dag outs, dag ins, string asm, list<dag> pattern>
816 : Thumb1I<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000817
818// Two-address instructions
819class T1It<dag outs, dag ins, string asm, list<dag> pattern>
820 : Thumb1I<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
821
Evan Cheng19bb7c72009-06-27 02:26:13 +0000822class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Cheng6fc534c2009-06-23 19:38:13 +0000823 list<Predicate> Predicates = [IsThumb1Only];
824}
825
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000826// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
827class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
828 string opc, string asm, string cstr, list<dag> pattern>
Evan Cheng36173712009-06-23 17:48:47 +0000829 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000830 let OutOperandList = oops;
831 let InOperandList = !con(iops, (ops pred:$p));
832 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
833 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000834 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000835}
836
837// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
838// an input operand since by default it's a zero register. It will
839// become an implicit def once it's "flipped".
840// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
841// more consistent.
842class Thumb2sI<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 = oops;
846 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
847 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
848 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000849 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000850}
851
852// Special cases
853class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
854 string asm, string cstr, list<dag> pattern>
855 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
856 let OutOperandList = oops;
857 let InOperandList = iops;
Evan Cheng36173712009-06-23 17:48:47 +0000858 let AsmString = asm;
859 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000860 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000861}
862
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000863class T2I<dag oops, dag iops, string opc, string asm, list<dag> pattern>
864 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng532cdc52009-06-29 07:51:04 +0000865class T2Ii12<dag oops, dag iops, string opc, string asm, list<dag> pattern>
866 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, opc, asm, "", pattern>;
867class T2Ii8<dag oops, dag iops, string opc, string asm, list<dag> pattern>
868 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, opc, asm, "", pattern>;
869class T2Iso<dag oops, dag iops, string opc, string asm, list<dag> pattern>
870 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, opc, asm, "", pattern>;
871class T2Ipc<dag oops, dag iops, string opc, string asm, list<dag> pattern>
872 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng503be112009-06-30 02:15:48 +0000873class T2Ii8s4<dag oops, dag iops, string opc, string asm, list<dag> pattern>
874 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000875
876class T2sI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
877 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, opc, asm, "", pattern>;
878
879class T2XI<dag oops, dag iops, string asm, list<dag> pattern>
880 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
David Goodwinf6154702009-06-30 18:04:13 +0000881class T2JTI<dag oops, dag iops, string asm, list<dag> pattern>
882 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng36173712009-06-23 17:48:47 +0000883
Evan Chenga90942e2009-07-02 07:28:31 +0000884// T2Iidxldst - Thumb2 indexed load / store instructions.
885class T2Iidxldst<dag oops, dag iops, AddrMode am, IndexMode im,
886 string opc, string asm, string cstr, list<dag> pattern>
887 : InstARM<am, Size4Bytes, im, ThumbFrm, cstr> {
888 let OutOperandList = oops;
889 let InOperandList = !con(iops, (ops pred:$p));
890 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
891 let Pattern = pattern;
892 list<Predicate> Predicates = [IsThumb2];
893}
894
895
Evan Cheng19bb7c72009-06-27 02:26:13 +0000896// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
897class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengb1b2abc2009-07-02 06:38:40 +0000898 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000899}
900
Evan Cheng34a46e12008-08-29 06:41:12 +0000901//===----------------------------------------------------------------------===//
902
Evan Chengc63e15e2008-11-11 02:11:05 +0000903//===----------------------------------------------------------------------===//
904// ARM VFP Instruction templates.
905//
906
Evan Chengbb786b32008-11-11 21:48:44 +0000907// ARM VFP addrmode5 loads and stores
908class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
909 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000910 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000911 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000912 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000913 let Inst{27-24} = opcod1;
914 let Inst{21-20} = opcod2;
915 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +0000916}
917
Evan Chengbb786b32008-11-11 21:48:44 +0000918class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
919 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000920 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000921 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000922 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000923 let Inst{27-24} = opcod1;
924 let Inst{21-20} = opcod2;
925 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +0000926}
927
Evan Chengbb786b32008-11-11 21:48:44 +0000928// Load / store multiple
929class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
930 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
931 VFPLdStMulFrm, asm, "", pattern> {
932 // TODO: Mark the instructions with the appropriate subtarget info.
933 let Inst{27-25} = 0b110;
934 let Inst{11-8} = 0b1011;
935}
936
937class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
938 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
939 VFPLdStMulFrm, asm, "", pattern> {
940 // TODO: Mark the instructions with the appropriate subtarget info.
941 let Inst{27-25} = 0b110;
942 let Inst{11-8} = 0b1010;
943}
944
945
Evan Chengc63e15e2008-11-11 02:11:05 +0000946// Double precision, unary
947class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
948 string opc, string asm, list<dag> pattern>
949 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
950 let Inst{27-20} = opcod1;
951 let Inst{19-16} = opcod2;
952 let Inst{11-8} = 0b1011;
953 let Inst{7-4} = opcod3;
954}
955
956// Double precision, binary
957class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
958 string asm, list<dag> pattern>
959 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
960 let Inst{27-20} = opcod;
961 let Inst{11-8} = 0b1011;
962}
963
964// Single precision, unary
965class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
966 string opc, string asm, list<dag> pattern>
967 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
968 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
969 let Inst{27-20} = opcod1;
970 let Inst{19-16} = opcod2;
971 let Inst{11-8} = 0b1010;
972 let Inst{7-4} = opcod3;
973}
974
975// Single precision, binary
976class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
977 string asm, list<dag> pattern>
978 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
979 // Bit 22 (D bit) can be changed during instruction encoding.
980 let Inst{27-20} = opcod;
981 let Inst{11-8} = 0b1010;
982}
983
Evan Cheng74273382008-11-12 06:41:41 +0000984// VFP conversion instructions
985class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
986 dag oops, dag iops, string opc, string asm, list<dag> pattern>
Evan Cheng9d3cc182008-11-11 19:40:26 +0000987 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
988 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +0000989 let Inst{19-16} = opcod2;
990 let Inst{11-8} = opcod3;
991 let Inst{6} = 1;
992}
993
994class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
995 string opc, string asm, list<dag> pattern>
996 : AI<oops, iops, f, opc, asm, pattern> {
997 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +0000998 let Inst{11-8} = opcod2;
999 let Inst{4} = 1;
1000}
1001
Evan Cheng828ccdc2008-11-11 22:46:12 +00001002class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
Evan Cheng74273382008-11-12 06:41:41 +00001003 string asm, list<dag> pattern>
1004 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +00001005
Evan Cheng74273382008-11-12 06:41:41 +00001006class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1007 string asm, list<dag> pattern>
1008 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
1009
1010class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1011 string asm, list<dag> pattern>
1012 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
1013
1014class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1015 string asm, list<dag> pattern>
1016 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001017
Evan Chengc63e15e2008-11-11 02:11:05 +00001018//===----------------------------------------------------------------------===//
1019
Bob Wilsone60fee02009-06-22 23:27:02 +00001020//===----------------------------------------------------------------------===//
1021// ARM NEON Instruction templates.
1022//
Evan Cheng34a46e12008-08-29 06:41:12 +00001023
Bob Wilsone60fee02009-06-22 23:27:02 +00001024class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, string asm,
1025 string cstr, list<dag> pattern>
1026 : InstARM<am, Size4Bytes, im, NEONFrm, cstr> {
1027 let OutOperandList = oops;
1028 let InOperandList = iops;
1029 let AsmString = asm;
1030 let Pattern = pattern;
1031 list<Predicate> Predicates = [HasNEON];
Evan Cheng34a46e12008-08-29 06:41:12 +00001032}
1033
Bob Wilsone60fee02009-06-22 23:27:02 +00001034class NI<dag oops, dag iops, string asm, list<dag> pattern>
1035 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, "", pattern> {
Evan Cheng34a46e12008-08-29 06:41:12 +00001036}
Bob Wilsone60fee02009-06-22 23:27:02 +00001037
1038class NDataI<dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1039 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, cstr, pattern> {
1040 let Inst{31-25} = 0b1111001;
1041}
1042
1043// NEON "one register and a modified immediate" format.
1044class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1045 bit op5, bit op4,
1046 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1047 : NDataI<oops, iops, asm, cstr, pattern> {
1048 let Inst{23} = op23;
1049 let Inst{21-19} = op21_19;
1050 let Inst{11-8} = op11_8;
1051 let Inst{7} = op7;
1052 let Inst{6} = op6;
1053 let Inst{5} = op5;
1054 let Inst{4} = op4;
1055}
1056
1057// NEON 2 vector register format.
1058class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1059 bits<5> op11_7, bit op6, bit op4,
1060 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1061 : NDataI<oops, iops, asm, cstr, pattern> {
1062 let Inst{24-23} = op24_23;
1063 let Inst{21-20} = op21_20;
1064 let Inst{19-18} = op19_18;
1065 let Inst{17-16} = op17_16;
1066 let Inst{11-7} = op11_7;
1067 let Inst{6} = op6;
1068 let Inst{4} = op4;
1069}
1070
1071// NEON 2 vector register with immediate.
1072class N2VImm<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1073 bit op6, bit op4,
1074 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1075 : NDataI<oops, iops, asm, cstr, pattern> {
1076 let Inst{24} = op24;
1077 let Inst{23} = op23;
1078 let Inst{21-16} = op21_16;
1079 let Inst{11-8} = op11_8;
1080 let Inst{7} = op7;
1081 let Inst{6} = op6;
1082 let Inst{4} = op4;
1083}
1084
1085// NEON 3 vector register format.
1086class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1087 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1088 : NDataI<oops, iops, asm, cstr, pattern> {
1089 let Inst{24} = op24;
1090 let Inst{23} = op23;
1091 let Inst{21-20} = op21_20;
1092 let Inst{11-8} = op11_8;
1093 let Inst{6} = op6;
1094 let Inst{4} = op4;
1095}
1096
1097// NEON VMOVs between scalar and core registers.
1098class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1099 dag oops, dag iops, Format f, string opc, string asm,
1100 list<dag> pattern>
1101 : AI<oops, iops, f, opc, asm, pattern> {
1102 let Inst{27-20} = opcod1;
1103 let Inst{11-8} = opcod2;
1104 let Inst{6-5} = opcod3;
1105 let Inst{4} = 1;
1106 list<Predicate> Predicates = [HasNEON];
1107}
1108class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1109 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1110 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, opc, asm,
1111 pattern>;
1112class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1113 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1114 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, opc, asm,
1115 pattern>;
1116class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1117 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1118 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, opc, asm, pattern>;