blob: 89a0e7e02dbf7a9946dbc72564547a61edc0ab4c [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
Evan Chengdabc6c02009-07-08 22:51:32 +0000454 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000455}
Evan Chengbe998242008-11-06 08:47:38 +0000456class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000457 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000458 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000459 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000460 let Inst{4} = 1;
461 let Inst{5} = 1; // H bit
462 let Inst{6} = 0; // S bit
463 let Inst{7} = 1;
464 let Inst{20} = 1; // L bit
465 let Inst{21} = 0; // W bit
466 let Inst{24} = 1; // P bit
467}
Evan Chengbe998242008-11-06 08:47:38 +0000468class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000469 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000470 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000471 asm, "", pattern> {
472 let Inst{4} = 1;
473 let Inst{5} = 1; // H bit
474 let Inst{6} = 1; // S bit
475 let Inst{7} = 1;
476 let Inst{20} = 1; // L bit
477 let Inst{21} = 0; // W bit
478 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000479 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000480}
Evan Chengbe998242008-11-06 08:47:38 +0000481class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000482 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000483 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000484 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000485 let Inst{4} = 1;
486 let Inst{5} = 1; // H bit
487 let Inst{6} = 1; // S bit
488 let Inst{7} = 1;
489 let Inst{20} = 1; // L bit
490 let Inst{21} = 0; // W bit
491 let Inst{24} = 1; // P bit
492}
Evan Chengbe998242008-11-06 08:47:38 +0000493class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000494 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000495 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000496 asm, "", pattern> {
497 let Inst{4} = 1;
498 let Inst{5} = 0; // H bit
499 let Inst{6} = 1; // S bit
500 let Inst{7} = 1;
501 let Inst{20} = 1; // L bit
502 let Inst{21} = 0; // W bit
503 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000504 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000505}
Evan Chengbe998242008-11-06 08:47:38 +0000506class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000507 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000508 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000509 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000510 let Inst{4} = 1;
511 let Inst{5} = 0; // H bit
512 let Inst{6} = 1; // S bit
513 let Inst{7} = 1;
514 let Inst{20} = 1; // L bit
515 let Inst{21} = 0; // W bit
516 let Inst{24} = 1; // P bit
517}
Evan Chengbe998242008-11-06 08:47:38 +0000518class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000519 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000520 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000521 asm, "", pattern> {
522 let Inst{4} = 1;
523 let Inst{5} = 0; // H bit
524 let Inst{6} = 1; // S bit
525 let Inst{7} = 1;
526 let Inst{20} = 0; // L bit
527 let Inst{21} = 0; // W bit
528 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000529 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000530}
531
532// stores
Evan Chengbe998242008-11-06 08:47:38 +0000533class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000534 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000535 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000536 asm, "", pattern> {
537 let Inst{4} = 1;
538 let Inst{5} = 1; // H bit
539 let Inst{6} = 0; // S bit
540 let Inst{7} = 1;
541 let Inst{20} = 0; // L bit
542 let Inst{21} = 0; // W bit
543 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000544 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000545}
Evan Chengbe998242008-11-06 08:47:38 +0000546class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000547 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000548 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000549 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000550 let Inst{4} = 1;
551 let Inst{5} = 1; // H bit
552 let Inst{6} = 0; // S bit
553 let Inst{7} = 1;
554 let Inst{20} = 0; // L bit
555 let Inst{21} = 0; // W bit
556 let Inst{24} = 1; // P bit
557}
Evan Chengbe998242008-11-06 08:47:38 +0000558class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000559 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000560 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000561 asm, "", pattern> {
562 let Inst{4} = 1;
563 let Inst{5} = 1; // H bit
564 let Inst{6} = 1; // S bit
565 let Inst{7} = 1;
566 let Inst{20} = 0; // L bit
567 let Inst{21} = 0; // W bit
568 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000569 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000570}
571
572// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000573class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000574 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000575 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000576 asm, cstr, pattern> {
577 let Inst{4} = 1;
578 let Inst{5} = 1; // H bit
579 let Inst{6} = 0; // S bit
580 let Inst{7} = 1;
581 let Inst{20} = 1; // L bit
582 let Inst{21} = 1; // W bit
583 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000584 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000585}
Evan Chengbe998242008-11-06 08:47:38 +0000586class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000587 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000588 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000589 asm, cstr, pattern> {
590 let Inst{4} = 1;
591 let Inst{5} = 1; // H bit
592 let Inst{6} = 1; // S bit
593 let Inst{7} = 1;
594 let Inst{20} = 1; // L bit
595 let Inst{21} = 1; // W bit
596 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000597 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000598}
Evan Chengbe998242008-11-06 08:47:38 +0000599class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000600 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000601 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000602 asm, cstr, pattern> {
603 let Inst{4} = 1;
604 let Inst{5} = 0; // H bit
605 let Inst{6} = 1; // S bit
606 let Inst{7} = 1;
607 let Inst{20} = 1; // L bit
608 let Inst{21} = 1; // W bit
609 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000610 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000611}
612
613// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000614class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000615 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000616 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000617 asm, cstr, pattern> {
618 let Inst{4} = 1;
619 let Inst{5} = 1; // H bit
620 let Inst{6} = 0; // S bit
621 let Inst{7} = 1;
622 let Inst{20} = 0; // L bit
623 let Inst{21} = 1; // W bit
624 let Inst{24} = 1; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000625 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000626}
627
628// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000629class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000630 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000631 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000632 asm, cstr,pattern> {
633 let Inst{4} = 1;
634 let Inst{5} = 1; // H bit
635 let Inst{6} = 0; // S bit
636 let Inst{7} = 1;
637 let Inst{20} = 1; // L bit
638 let Inst{21} = 1; // W bit
639 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000640 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000641}
Evan Chengbe998242008-11-06 08:47:38 +0000642class AI3ldshpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000643 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000644 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000645 asm, cstr,pattern> {
646 let Inst{4} = 1;
647 let Inst{5} = 1; // H bit
648 let Inst{6} = 1; // S bit
649 let Inst{7} = 1;
650 let Inst{20} = 1; // L bit
651 let Inst{21} = 1; // W bit
652 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000653 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000654}
Evan Chengbe998242008-11-06 08:47:38 +0000655class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000656 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000657 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000658 asm, cstr,pattern> {
659 let Inst{4} = 1;
660 let Inst{5} = 0; // H bit
661 let Inst{6} = 1; // S bit
662 let Inst{7} = 1;
663 let Inst{20} = 1; // L bit
664 let Inst{21} = 1; // W bit
665 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000666 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000667}
668
669// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000670class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000671 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000672 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000673 asm, cstr,pattern> {
674 let Inst{4} = 1;
675 let Inst{5} = 1; // H bit
676 let Inst{6} = 0; // S bit
677 let Inst{7} = 1;
678 let Inst{20} = 0; // L bit
679 let Inst{21} = 1; // W bit
680 let Inst{24} = 0; // P bit
Evan Chengdabc6c02009-07-08 22:51:32 +0000681 let Inst{27-25} = 0b000;
Evan Chengac92c3f2008-09-01 07:00:14 +0000682}
683
684
Evan Cheng2e62b662008-09-01 01:51:14 +0000685// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000686class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000687 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000688 "", pattern> {
689 let Inst{20} = 1; // L bit
690 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000691 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000692}
Evan Chengf8e8b622008-11-06 17:48:05 +0000693class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000694 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000695 "", pattern> {
696 let Inst{20} = 0; // L bit
697 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000698 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000699}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000700
Jim Grosbach1feed042008-11-03 18:38:31 +0000701// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000702class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000703 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000704 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000705 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000706 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000707 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000708 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000709}
Evan Chengbe998242008-11-06 08:47:38 +0000710class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000711 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000712 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000713 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000714 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000715 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000716}
717
718// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000719class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000720 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000721 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000722 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000723 let Inst{7-4} = 0b1001;
724 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000725 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000726}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000727
Evan Cheng38396be2008-11-06 03:35:07 +0000728// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000729class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000730 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000731 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000732 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000733 let Inst{4} = 0;
734 let Inst{7} = 1;
735 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000736 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000737}
738
Evan Cheng37afa432008-11-06 22:15:19 +0000739// Extend instructions.
740class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
741 string asm, list<dag> pattern>
742 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
743 asm, "", pattern> {
744 let Inst{7-4} = 0b0111;
745 let Inst{27-20} = opcod;
746}
747
Evan Chengc2121a22008-11-07 01:41:35 +0000748// Misc Arithmetic instructions.
749class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
750 string asm, list<dag> pattern>
751 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
752 asm, "", pattern> {
753 let Inst{27-20} = opcod;
754}
755
Evan Cheng7b0249b2008-08-28 23:39:26 +0000756//===----------------------------------------------------------------------===//
757
758// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
759class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
760 list<Predicate> Predicates = [IsARM];
761}
762class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
763 list<Predicate> Predicates = [IsARM, HasV5TE];
764}
765class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
766 list<Predicate> Predicates = [IsARM, HasV6];
767}
Evan Cheng34a46e12008-08-29 06:41:12 +0000768
769//===----------------------------------------------------------------------===//
770//
771// Thumb Instruction Format Definitions.
772//
773
Evan Cheng34a46e12008-08-29 06:41:12 +0000774// TI - Thumb instruction.
775
776class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
777 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000778 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000779 let OutOperandList = outs;
780 let InOperandList = ins;
781 let AsmString = asm;
782 let Pattern = pattern;
783 list<Predicate> Predicates = [IsThumb];
784}
785
786class TI<dag outs, dag ins, string asm, list<dag> pattern>
787 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
Evan Cheng34a46e12008-08-29 06:41:12 +0000788
789// BL, BLX(1) are translated by assembler into two instructions
790class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
791 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
792
793// BR_JT instructions
794class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
795 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
796
Evan Cheng19bb7c72009-06-27 02:26:13 +0000797// TPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
798class TPat<dag pattern, dag result> : Pat<pattern, result> {
Bob Wilsone60fee02009-06-22 23:27:02 +0000799 list<Predicate> Predicates = [IsThumb];
800}
801
Evan Cheng19bb7c72009-06-27 02:26:13 +0000802class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
Bob Wilsone60fee02009-06-22 23:27:02 +0000803 list<Predicate> Predicates = [IsThumb, HasV5T];
804}
Evan Cheng34a46e12008-08-29 06:41:12 +0000805
Evan Cheng6fc534c2009-06-23 19:38:13 +0000806// Thumb1 only
807class Thumb1I<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
808 string asm, string cstr, list<dag> pattern>
809 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
810 let OutOperandList = outs;
811 let InOperandList = ins;
812 let AsmString = asm;
813 let Pattern = pattern;
814 list<Predicate> Predicates = [IsThumb1Only];
815}
816
817class T1I<dag outs, dag ins, string asm, list<dag> pattern>
818 : Thumb1I<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
Evan Cheng532cdc52009-06-29 07:51:04 +0000819class T1I1<dag outs, dag ins, string asm, list<dag> pattern>
820 : Thumb1I<outs, ins, AddrModeT1_1, Size2Bytes, asm, "", pattern>;
821class T1I2<dag outs, dag ins, string asm, list<dag> pattern>
822 : Thumb1I<outs, ins, AddrModeT1_2, Size2Bytes, asm, "", pattern>;
823class T1I4<dag outs, dag ins, string asm, list<dag> pattern>
824 : Thumb1I<outs, ins, AddrModeT1_4, Size2Bytes, asm, "", pattern>;
825class T1Is<dag outs, dag ins, string asm, list<dag> pattern>
826 : Thumb1I<outs, ins, AddrModeT1_s, Size2Bytes, asm, "", pattern>;
David Goodwinf6154702009-06-30 18:04:13 +0000827class T1Ix2<dag outs, dag ins, string asm, list<dag> pattern>
828 : Thumb1I<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
829class T1JTI<dag outs, dag ins, string asm, list<dag> pattern>
830 : Thumb1I<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng6fc534c2009-06-23 19:38:13 +0000831
832// Two-address instructions
833class T1It<dag outs, dag ins, string asm, list<dag> pattern>
834 : Thumb1I<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
835
Evan Cheng19bb7c72009-06-27 02:26:13 +0000836class T1Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Cheng6fc534c2009-06-23 19:38:13 +0000837 list<Predicate> Predicates = [IsThumb1Only];
838}
839
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000840// Thumb2I - Thumb2 instruction. Almost all Thumb2 instructions are predicable.
841class Thumb2I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
842 string opc, string asm, string cstr, list<dag> pattern>
Evan Cheng36173712009-06-23 17:48:47 +0000843 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000844 let OutOperandList = oops;
845 let InOperandList = !con(iops, (ops pred:$p));
846 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
847 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000848 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000849}
850
851// Same as Thumb2I except it can optionally modify CPSR. Note it's modeled as
852// an input operand since by default it's a zero register. It will
853// become an implicit def once it's "flipped".
854// FIXME: This uses unified syntax so {s} comes before {p}. We should make it
855// more consistent.
856class Thumb2sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
857 string opc, string asm, string cstr, list<dag> pattern>
858 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
859 let OutOperandList = oops;
860 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
861 let AsmString = !strconcat(opc, !strconcat("${s}${p}", asm));
862 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000863 list<Predicate> Predicates = [IsThumb2];
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000864}
865
866// Special cases
867class Thumb2XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
868 string asm, string cstr, list<dag> pattern>
869 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
870 let OutOperandList = oops;
871 let InOperandList = iops;
Evan Cheng36173712009-06-23 17:48:47 +0000872 let AsmString = asm;
873 let Pattern = pattern;
Evan Chengb1b2abc2009-07-02 06:38:40 +0000874 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000875}
876
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000877class T2I<dag oops, dag iops, string opc, string asm, list<dag> pattern>
878 : Thumb2I<oops, iops, AddrModeNone, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng532cdc52009-06-29 07:51:04 +0000879class T2Ii12<dag oops, dag iops, string opc, string asm, list<dag> pattern>
880 : Thumb2I<oops, iops, AddrModeT2_i12, Size4Bytes, opc, asm, "", pattern>;
881class T2Ii8<dag oops, dag iops, string opc, string asm, list<dag> pattern>
882 : Thumb2I<oops, iops, AddrModeT2_i8, Size4Bytes, opc, asm, "", pattern>;
883class T2Iso<dag oops, dag iops, string opc, string asm, list<dag> pattern>
884 : Thumb2I<oops, iops, AddrModeT2_so, Size4Bytes, opc, asm, "", pattern>;
885class T2Ipc<dag oops, dag iops, string opc, string asm, list<dag> pattern>
886 : Thumb2I<oops, iops, AddrModeT2_pc, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng503be112009-06-30 02:15:48 +0000887class T2Ii8s4<dag oops, dag iops, string opc, string asm, list<dag> pattern>
888 : Thumb2I<oops, iops, AddrModeT2_i8s4, Size4Bytes, opc, asm, "", pattern>;
Evan Cheng3d92dfd2009-06-25 02:08:06 +0000889
890class T2sI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
891 : Thumb2sI<oops, iops, AddrModeNone, Size4Bytes, opc, asm, "", pattern>;
892
893class T2XI<dag oops, dag iops, string asm, list<dag> pattern>
894 : Thumb2XI<oops, iops, AddrModeNone, Size4Bytes, asm, "", pattern>;
David Goodwinf6154702009-06-30 18:04:13 +0000895class T2JTI<dag oops, dag iops, string asm, list<dag> pattern>
896 : Thumb2XI<oops, iops, AddrModeNone, SizeSpecial, asm, "", pattern>;
Evan Cheng36173712009-06-23 17:48:47 +0000897
Evan Chenga90942e2009-07-02 07:28:31 +0000898// T2Iidxldst - Thumb2 indexed load / store instructions.
899class T2Iidxldst<dag oops, dag iops, AddrMode am, IndexMode im,
900 string opc, string asm, string cstr, list<dag> pattern>
901 : InstARM<am, Size4Bytes, im, ThumbFrm, cstr> {
902 let OutOperandList = oops;
903 let InOperandList = !con(iops, (ops pred:$p));
904 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
905 let Pattern = pattern;
906 list<Predicate> Predicates = [IsThumb2];
907}
908
909
Evan Cheng19bb7c72009-06-27 02:26:13 +0000910// T2Pat - Same as Pat<>, but requires that the compiler be in Thumb2 mode.
911class T2Pat<dag pattern, dag result> : Pat<pattern, result> {
Evan Chengb1b2abc2009-07-02 06:38:40 +0000912 list<Predicate> Predicates = [IsThumb2];
Evan Cheng36173712009-06-23 17:48:47 +0000913}
914
Evan Cheng34a46e12008-08-29 06:41:12 +0000915//===----------------------------------------------------------------------===//
916
Evan Chengc63e15e2008-11-11 02:11:05 +0000917//===----------------------------------------------------------------------===//
918// ARM VFP Instruction templates.
919//
920
Evan Chengbb786b32008-11-11 21:48:44 +0000921// ARM VFP addrmode5 loads and stores
922class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
923 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000924 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000925 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000926 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000927 let Inst{27-24} = opcod1;
928 let Inst{21-20} = opcod2;
929 let Inst{11-8} = 0b1011;
Evan Chengc63e15e2008-11-11 02:11:05 +0000930}
931
Evan Chengbb786b32008-11-11 21:48:44 +0000932class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
933 string opc, string asm, list<dag> pattern>
Evan Chengc63e15e2008-11-11 02:11:05 +0000934 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
Evan Chengbb786b32008-11-11 21:48:44 +0000935 VFPLdStFrm, opc, asm, "", pattern> {
Evan Chengc63e15e2008-11-11 02:11:05 +0000936 // TODO: Mark the instructions with the appropriate subtarget info.
Evan Chengbb786b32008-11-11 21:48:44 +0000937 let Inst{27-24} = opcod1;
938 let Inst{21-20} = opcod2;
939 let Inst{11-8} = 0b1010;
Evan Chengc63e15e2008-11-11 02:11:05 +0000940}
941
Evan Chengbb786b32008-11-11 21:48:44 +0000942// Load / store multiple
943class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
944 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
945 VFPLdStMulFrm, asm, "", pattern> {
946 // TODO: Mark the instructions with the appropriate subtarget info.
947 let Inst{27-25} = 0b110;
948 let Inst{11-8} = 0b1011;
949}
950
951class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
952 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
953 VFPLdStMulFrm, asm, "", pattern> {
954 // TODO: Mark the instructions with the appropriate subtarget info.
955 let Inst{27-25} = 0b110;
956 let Inst{11-8} = 0b1010;
957}
958
959
Evan Chengc63e15e2008-11-11 02:11:05 +0000960// Double precision, unary
961class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
962 string opc, string asm, list<dag> pattern>
963 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
964 let Inst{27-20} = opcod1;
965 let Inst{19-16} = opcod2;
966 let Inst{11-8} = 0b1011;
967 let Inst{7-4} = opcod3;
968}
969
970// Double precision, binary
971class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
972 string asm, list<dag> pattern>
973 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
974 let Inst{27-20} = opcod;
975 let Inst{11-8} = 0b1011;
976}
977
978// Single precision, unary
979class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
980 string opc, string asm, list<dag> pattern>
981 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
982 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
983 let Inst{27-20} = opcod1;
984 let Inst{19-16} = opcod2;
985 let Inst{11-8} = 0b1010;
986 let Inst{7-4} = opcod3;
987}
988
989// Single precision, binary
990class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
991 string asm, list<dag> pattern>
992 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
993 // Bit 22 (D bit) can be changed during instruction encoding.
994 let Inst{27-20} = opcod;
995 let Inst{11-8} = 0b1010;
996}
997
Evan Cheng74273382008-11-12 06:41:41 +0000998// VFP conversion instructions
999class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
1000 dag oops, dag iops, string opc, string asm, list<dag> pattern>
Evan Cheng9d3cc182008-11-11 19:40:26 +00001001 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
1002 let Inst{27-20} = opcod1;
Evan Cheng74273382008-11-12 06:41:41 +00001003 let Inst{19-16} = opcod2;
1004 let Inst{11-8} = opcod3;
1005 let Inst{6} = 1;
1006}
1007
1008class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
1009 string opc, string asm, list<dag> pattern>
1010 : AI<oops, iops, f, opc, asm, pattern> {
1011 let Inst{27-20} = opcod1;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001012 let Inst{11-8} = opcod2;
1013 let Inst{4} = 1;
1014}
1015
Evan Cheng828ccdc2008-11-11 22:46:12 +00001016class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
Evan Cheng74273382008-11-12 06:41:41 +00001017 string asm, list<dag> pattern>
1018 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
Evan Cheng828ccdc2008-11-11 22:46:12 +00001019
Evan Cheng74273382008-11-12 06:41:41 +00001020class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1021 string asm, list<dag> pattern>
1022 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
1023
1024class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1025 string asm, list<dag> pattern>
1026 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
1027
1028class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
1029 string asm, list<dag> pattern>
1030 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
Evan Cheng9d3cc182008-11-11 19:40:26 +00001031
Evan Chengc63e15e2008-11-11 02:11:05 +00001032//===----------------------------------------------------------------------===//
1033
Bob Wilsone60fee02009-06-22 23:27:02 +00001034//===----------------------------------------------------------------------===//
1035// ARM NEON Instruction templates.
1036//
Evan Cheng34a46e12008-08-29 06:41:12 +00001037
Bob Wilsone60fee02009-06-22 23:27:02 +00001038class NeonI<dag oops, dag iops, AddrMode am, IndexMode im, string asm,
1039 string cstr, list<dag> pattern>
1040 : InstARM<am, Size4Bytes, im, NEONFrm, cstr> {
1041 let OutOperandList = oops;
1042 let InOperandList = iops;
1043 let AsmString = asm;
1044 let Pattern = pattern;
1045 list<Predicate> Predicates = [HasNEON];
Evan Cheng34a46e12008-08-29 06:41:12 +00001046}
1047
Bob Wilsone60fee02009-06-22 23:27:02 +00001048class NI<dag oops, dag iops, string asm, list<dag> pattern>
1049 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, "", pattern> {
Evan Cheng34a46e12008-08-29 06:41:12 +00001050}
Bob Wilsone60fee02009-06-22 23:27:02 +00001051
Bob Wilsoned592c02009-07-08 18:11:30 +00001052class NLdSt<dag oops, dag iops, string asm, list<dag> pattern>
1053 : NeonI<oops, iops, AddrMode6, IndexModeNone, asm, "", pattern> {
1054 let Inst{31-24} = 0b11110100;
1055}
1056
Bob Wilsone60fee02009-06-22 23:27:02 +00001057class NDataI<dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1058 : NeonI<oops, iops, AddrModeNone, IndexModeNone, asm, cstr, pattern> {
1059 let Inst{31-25} = 0b1111001;
1060}
1061
1062// NEON "one register and a modified immediate" format.
1063class N1ModImm<bit op23, bits<3> op21_19, bits<4> op11_8, bit op7, bit op6,
1064 bit op5, bit op4,
1065 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1066 : NDataI<oops, iops, asm, cstr, pattern> {
1067 let Inst{23} = op23;
1068 let Inst{21-19} = op21_19;
1069 let Inst{11-8} = op11_8;
1070 let Inst{7} = op7;
1071 let Inst{6} = op6;
1072 let Inst{5} = op5;
1073 let Inst{4} = op4;
1074}
1075
1076// NEON 2 vector register format.
1077class N2V<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18, bits<2> op17_16,
1078 bits<5> op11_7, bit op6, bit op4,
1079 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1080 : NDataI<oops, iops, asm, cstr, pattern> {
1081 let Inst{24-23} = op24_23;
1082 let Inst{21-20} = op21_20;
1083 let Inst{19-18} = op19_18;
1084 let Inst{17-16} = op17_16;
1085 let Inst{11-7} = op11_7;
1086 let Inst{6} = op6;
1087 let Inst{4} = op4;
1088}
1089
1090// NEON 2 vector register with immediate.
1091class N2VImm<bit op24, bit op23, bits<6> op21_16, bits<4> op11_8, bit op7,
1092 bit op6, bit op4,
1093 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1094 : NDataI<oops, iops, asm, cstr, pattern> {
1095 let Inst{24} = op24;
1096 let Inst{23} = op23;
1097 let Inst{21-16} = op21_16;
1098 let Inst{11-8} = op11_8;
1099 let Inst{7} = op7;
1100 let Inst{6} = op6;
1101 let Inst{4} = op4;
1102}
1103
1104// NEON 3 vector register format.
1105class N3V<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op6, bit op4,
1106 dag oops, dag iops, string asm, string cstr, list<dag> pattern>
1107 : NDataI<oops, iops, asm, cstr, pattern> {
1108 let Inst{24} = op24;
1109 let Inst{23} = op23;
1110 let Inst{21-20} = op21_20;
1111 let Inst{11-8} = op11_8;
1112 let Inst{6} = op6;
1113 let Inst{4} = op4;
1114}
1115
1116// NEON VMOVs between scalar and core registers.
1117class NVLaneOp<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1118 dag oops, dag iops, Format f, string opc, string asm,
1119 list<dag> pattern>
1120 : AI<oops, iops, f, opc, asm, pattern> {
1121 let Inst{27-20} = opcod1;
1122 let Inst{11-8} = opcod2;
1123 let Inst{6-5} = opcod3;
1124 let Inst{4} = 1;
1125 list<Predicate> Predicates = [HasNEON];
1126}
1127class NVGetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1128 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1129 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONGetLnFrm, opc, asm,
1130 pattern>;
1131class NVSetLane<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1132 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1133 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONSetLnFrm, opc, asm,
1134 pattern>;
1135class NVDup<bits<8> opcod1, bits<4> opcod2, bits<2> opcod3,
1136 dag oops, dag iops, string opc, string asm, list<dag> pattern>
1137 : NVLaneOp<opcod1, opcod2, opcod3, oops, iops, NEONDupFrm, opc, asm, pattern>;