blob: c898acae041ab26e074f1ae48fbf687a466e1341 [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
22def Pseudo : Format<1>;
Evan Chengee80fb72008-11-06 01:21:28 +000023def MulFrm : Format<2>;
Evan Chengf8e8b622008-11-06 17:48:05 +000024def BrFrm : Format<3>;
25def BrMiscFrm : Format<4>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000026
Evan Cheng38396be2008-11-06 03:35:07 +000027def DPFrm : Format<5>;
28def DPSoRegFrm : Format<6>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000029
Evan Cheng38396be2008-11-06 03:35:07 +000030def LdFrm : Format<7>;
31def StFrm : Format<8>;
32def LdMiscFrm : Format<9>;
33def StMiscFrm : Format<10>;
34def LdMulFrm : Format<11>;
35def StMulFrm : Format<12>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000036
Evan Cheng37afa432008-11-06 22:15:19 +000037def ArithMiscFrm: Format<13>;
38def ExtFrm : Format<14>;
Evan Chengc63e15e2008-11-11 02:11:05 +000039def VFPFrm : Format<15>;
40def VFPUnaryFrm : Format<16>;
41def VFPBinaryFrm: Format<17>;
42def ThumbFrm : Format<18>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000043
Evan Cheng86a926a2008-11-05 18:35:52 +000044// Misc flag for data processing instructions that indicates whether
45// the instruction has a Rn register operand.
46class UnaryDP { bit isUnaryDataProc = 1; }
Evan Cheng7b0249b2008-08-28 23:39:26 +000047
Evan Cheng7b0249b2008-08-28 23:39:26 +000048//===----------------------------------------------------------------------===//
49
50// ARM Instruction templates.
51//
52
Evan Chengbe998242008-11-06 08:47:38 +000053class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
Evan Cheng7b0249b2008-08-28 23:39:26 +000054 Format f, string cstr>
55 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000056 field bits<32> Inst;
57
Evan Cheng7b0249b2008-08-28 23:39:26 +000058 let Namespace = "ARM";
59
Evan Cheng86a926a2008-11-05 18:35:52 +000060 // TSFlagsFields
Evan Cheng7b0249b2008-08-28 23:39:26 +000061 AddrMode AM = am;
62 bits<4> AddrModeBits = AM.Value;
63
64 SizeFlagVal SZ = sz;
65 bits<3> SizeFlag = SZ.Value;
66
67 IndexMode IM = im;
68 bits<2> IndexModeBits = IM.Value;
69
70 Format F = f;
71 bits<5> Form = F.Value;
Evan Cheng86a926a2008-11-05 18:35:52 +000072
73 //
74 // Attributes specific to ARM instructions...
75 //
76 bit isUnaryDataProc = 0;
Evan Cheng7b0249b2008-08-28 23:39:26 +000077
78 let Constraints = cstr;
79}
80
81class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000082 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000083 let OutOperandList = oops;
84 let InOperandList = iops;
85 let AsmString = asm;
86 let Pattern = pattern;
87}
88
89// Almost all ARM instructions are predicable.
Evan Chengbe998242008-11-06 08:47:38 +000090class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +000091 IndexMode im, Format f, string opc, string asm, string cstr,
92 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +000093 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +000094 let OutOperandList = oops;
95 let InOperandList = !con(iops, (ops pred:$p));
96 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
97 let Pattern = pattern;
98 list<Predicate> Predicates = [IsARM];
99}
100
101// Same as I except it can optionally modify CPSR. Note it's modeled as
102// an input operand since by default it's a zero register. It will
103// become an implicit def once it's "flipped".
Evan Chengbe998242008-11-06 08:47:38 +0000104class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000105 IndexMode im, Format f, string opc, string asm, string cstr,
106 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000107 : InstARM<am, sz, im, f, cstr> {
Evan Cheng7b0249b2008-08-28 23:39:26 +0000108 let OutOperandList = oops;
109 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
110 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
111 let Pattern = pattern;
112 list<Predicate> Predicates = [IsARM];
113}
114
Evan Chengc5409a82008-09-01 07:19:00 +0000115// Special cases
Evan Chengbe998242008-11-06 08:47:38 +0000116class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
Evan Chengc5409a82008-09-01 07:19:00 +0000117 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000118 : InstARM<am, sz, im, f, cstr> {
Evan Chengc5409a82008-09-01 07:19:00 +0000119 let OutOperandList = oops;
120 let InOperandList = iops;
121 let AsmString = asm;
122 let Pattern = pattern;
123 list<Predicate> Predicates = [IsARM];
124}
125
Evan Chengbe998242008-11-06 08:47:38 +0000126class AI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000127 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000128 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000129 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000130class AsI<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000131 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000132 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000133 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000134class AXI<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000135 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000136 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000137 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000138
139// Ctrl flow instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000140class ABI<bits<4> opcod, dag oops, dag iops, string opc,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000141 string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000142 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000143 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000144 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000145}
Evan Chengf8e8b622008-11-06 17:48:05 +0000146class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
147 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
Evan Cheng10a9eb82008-09-01 08:25:56 +0000148 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000149 let Inst{27-24} = opcod;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000150}
Evan Chengf8e8b622008-11-06 17:48:05 +0000151class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
152 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000153 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000154
155// BR_JT instructions
Evan Cheng0f63ae12008-11-07 09:06:08 +0000156class JTI<dag oops, dag iops, string asm, list<dag> pattern>
Evan Chengf8e8b622008-11-06 17:48:05 +0000157 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
Evan Cheng0f63ae12008-11-07 09:06:08 +0000158 asm, "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000159
160// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000161class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
162 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000163 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000164 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000165 let Inst{24-21} = opcod;
166 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000167}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000168class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
169 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000170 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000171 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000172 let Inst{24-21} = opcod;
173 let Inst{27-26} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000174}
Evan Chengc5409a82008-09-01 07:19:00 +0000175class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
176 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000177 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000178 "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000179 let Inst{24-21} = opcod;
180 let Inst{27-26} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000181}
Evan Chengbe998242008-11-06 08:47:38 +0000182class AI1x2<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000183 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000184 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000185 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000186
Evan Cheng2e62b662008-09-01 01:51:14 +0000187
188// addrmode2 loads and stores
Evan Chengbe998242008-11-06 08:47:38 +0000189class AI2<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000190 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000191 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000192 asm, "", pattern> {
Jim Grosbach88c246f2008-10-14 20:36:24 +0000193 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000194}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000195
196// loads
Evan Chengbe998242008-11-06 08:47:38 +0000197class AI2ldw<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000198 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000199 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000200 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000201 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000202 let Inst{21} = 0; // W bit
203 let Inst{22} = 0; // B bit
204 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000205 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000206}
Evan Chengbe998242008-11-06 08:47:38 +0000207class AXI2ldw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000208 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000209 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000210 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000211 let Inst{20} = 1; // L bit
212 let Inst{21} = 0; // W bit
213 let Inst{22} = 0; // B bit
214 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000215 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000216}
Evan Chengbe998242008-11-06 08:47:38 +0000217class AI2ldb<dag oops, dag iops, Format f, string opc,
Evan Chengda020022008-08-31 19:02:21 +0000218 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000219 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000220 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000221 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000222 let Inst{21} = 0; // W bit
223 let Inst{22} = 1; // B bit
224 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000225 let Inst{27-26} = {0,1};
Evan Chengda020022008-08-31 19:02:21 +0000226}
Evan Chengbe998242008-11-06 08:47:38 +0000227class AXI2ldb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000228 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000229 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000230 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000231 let Inst{20} = 1; // L bit
232 let Inst{21} = 0; // W bit
233 let Inst{22} = 1; // B bit
234 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000235 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000236}
Evan Chengda020022008-08-31 19:02:21 +0000237
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000238// stores
Evan Chengbe998242008-11-06 08:47:38 +0000239class AI2stw<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000240 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000241 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000242 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000243 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000244 let Inst{21} = 0; // W bit
245 let Inst{22} = 0; // B bit
246 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000247 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000248}
Evan Chengbe998242008-11-06 08:47:38 +0000249class AXI2stw<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000250 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000251 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000252 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000253 let Inst{20} = 0; // L bit
254 let Inst{21} = 0; // W bit
255 let Inst{22} = 0; // B bit
256 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000257 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000258}
Evan Chengbe998242008-11-06 08:47:38 +0000259class AI2stb<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000260 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000261 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengc41fb3152008-11-05 23:22:34 +0000262 asm, "", pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000263 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000264 let Inst{21} = 0; // W bit
265 let Inst{22} = 1; // B bit
266 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000267 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000268}
Evan Chengbe998242008-11-06 08:47:38 +0000269class AXI2stb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000270 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000271 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000272 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000273 let Inst{20} = 0; // L bit
274 let Inst{21} = 0; // W bit
275 let Inst{22} = 1; // B bit
276 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000277 let Inst{27-26} = {0,1};
Evan Chengae7b1d72008-09-01 07:34:13 +0000278}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000279
Evan Chengac92c3f2008-09-01 07:00:14 +0000280// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000281class AI2ldwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000282 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000283 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000284 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000285 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000286 let Inst{21} = 1; // W bit
287 let Inst{22} = 0; // B bit
288 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000289 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000290}
Evan Chengbe998242008-11-06 08:47:38 +0000291class AI2ldbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000292 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000293 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000294 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000295 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000296 let Inst{21} = 1; // 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 Cheng1a7c1cc2008-09-01 01:27:33 +0000300}
301
Evan Chengac92c3f2008-09-01 07:00:14 +0000302// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000303class AI2stwpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000304 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000305 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000306 asm, cstr, 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} = 1; // 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 AI2stbpr<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000314 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000315 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000316 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000317 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000318 let Inst{21} = 1; // W bit
319 let Inst{22} = 1; // B bit
320 let Inst{24} = 1; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000321 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000322}
323
Evan Chengac92c3f2008-09-01 07:00:14 +0000324// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000325class AI2ldwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000326 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000327 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000328 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000329 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000330 let Inst{21} = 0; // W bit
331 let Inst{22} = 0; // B bit
332 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000333 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000334}
Evan Chengbe998242008-11-06 08:47:38 +0000335class AI2ldbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000336 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000337 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000338 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000339 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000340 let Inst{21} = 0; // W bit
341 let Inst{22} = 1; // B bit
342 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000343 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000344}
345
Evan Chengac92c3f2008-09-01 07:00:14 +0000346// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000347class AI2stwpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000348 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000349 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000351 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000352 let Inst{21} = 0; // W bit
353 let Inst{22} = 0; // B bit
354 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000355 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000356}
Evan Chengbe998242008-11-06 08:47:38 +0000357class AI2stbpo<dag oops, dag iops, Format f, string opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000359 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000360 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000361 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000362 let Inst{21} = 0; // W bit
363 let Inst{22} = 1; // B bit
364 let Inst{24} = 0; // P bit
Evan Chengc41fb3152008-11-05 23:22:34 +0000365 let Inst{27-26} = {0,1};
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000366}
367
Evan Cheng2e62b662008-09-01 01:51:14 +0000368// addrmode3 instructions
Evan Chengbe998242008-11-06 08:47:38 +0000369class AI3<dag oops, dag iops, Format f, string opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000370 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000371 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng2e62b662008-09-01 01:51:14 +0000372 asm, "", pattern>;
Evan Chengbe998242008-11-06 08:47:38 +0000373class AXI3<dag oops, dag iops, Format f, string asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000374 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000375 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
Evan Chengc5409a82008-09-01 07:19:00 +0000376 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000377
Evan Chengac92c3f2008-09-01 07:00:14 +0000378// loads
Evan Chengbe998242008-11-06 08:47:38 +0000379class AI3ldh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000380 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000381 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000382 asm, "", pattern> {
383 let Inst{4} = 1;
384 let Inst{5} = 1; // H bit
385 let Inst{6} = 0; // S bit
386 let Inst{7} = 1;
387 let Inst{20} = 1; // L bit
388 let Inst{21} = 0; // W bit
389 let Inst{24} = 1; // P bit
390}
Evan Chengbe998242008-11-06 08:47:38 +0000391class AXI3ldh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000392 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000393 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000394 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000395 let Inst{4} = 1;
396 let Inst{5} = 1; // H bit
397 let Inst{6} = 0; // S bit
398 let Inst{7} = 1;
399 let Inst{20} = 1; // L bit
400 let Inst{21} = 0; // W bit
401 let Inst{24} = 1; // P bit
402}
Evan Chengbe998242008-11-06 08:47:38 +0000403class AI3ldsh<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000404 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000405 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000406 asm, "", pattern> {
407 let Inst{4} = 1;
408 let Inst{5} = 1; // H bit
409 let Inst{6} = 1; // S bit
410 let Inst{7} = 1;
411 let Inst{20} = 1; // L bit
412 let Inst{21} = 0; // W bit
413 let Inst{24} = 1; // P bit
414}
Evan Chengbe998242008-11-06 08:47:38 +0000415class AXI3ldsh<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000416 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000417 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000418 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000419 let Inst{4} = 1;
420 let Inst{5} = 1; // H bit
421 let Inst{6} = 1; // S bit
422 let Inst{7} = 1;
423 let Inst{20} = 1; // L bit
424 let Inst{21} = 0; // W bit
425 let Inst{24} = 1; // P bit
426}
Evan Chengbe998242008-11-06 08:47:38 +0000427class AI3ldsb<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000428 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000429 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000430 asm, "", pattern> {
431 let Inst{4} = 1;
432 let Inst{5} = 0; // H bit
433 let Inst{6} = 1; // S bit
434 let Inst{7} = 1;
435 let Inst{20} = 1; // L bit
436 let Inst{21} = 0; // W bit
437 let Inst{24} = 1; // P bit
438}
Evan Chengbe998242008-11-06 08:47:38 +0000439class AXI3ldsb<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000440 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000441 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000442 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000443 let Inst{4} = 1;
444 let Inst{5} = 0; // H bit
445 let Inst{6} = 1; // S bit
446 let Inst{7} = 1;
447 let Inst{20} = 1; // L bit
448 let Inst{21} = 0; // W bit
449 let Inst{24} = 1; // P bit
450}
Evan Chengbe998242008-11-06 08:47:38 +0000451class AI3ldd<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000452 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000453 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000454 asm, "", pattern> {
455 let Inst{4} = 1;
456 let Inst{5} = 0; // H bit
457 let Inst{6} = 1; // S bit
458 let Inst{7} = 1;
459 let Inst{20} = 0; // L bit
460 let Inst{21} = 0; // W bit
461 let Inst{24} = 1; // P bit
462}
463
464// stores
Evan Chengbe998242008-11-06 08:47:38 +0000465class AI3sth<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000466 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000467 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000468 asm, "", pattern> {
469 let Inst{4} = 1;
470 let Inst{5} = 1; // H bit
471 let Inst{6} = 0; // S bit
472 let Inst{7} = 1;
473 let Inst{20} = 0; // L bit
474 let Inst{21} = 0; // W bit
475 let Inst{24} = 1; // P bit
476}
Evan Chengbe998242008-11-06 08:47:38 +0000477class AXI3sth<dag oops, dag iops, Format f, string asm,
Evan Chengae7b1d72008-09-01 07:34:13 +0000478 list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000479 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
Evan Chengc41fb3152008-11-05 23:22:34 +0000480 asm, "", pattern> {
Evan Chengae7b1d72008-09-01 07:34:13 +0000481 let Inst{4} = 1;
482 let Inst{5} = 1; // H bit
483 let Inst{6} = 0; // S bit
484 let Inst{7} = 1;
485 let Inst{20} = 0; // L bit
486 let Inst{21} = 0; // W bit
487 let Inst{24} = 1; // P bit
488}
Evan Chengbe998242008-11-06 08:47:38 +0000489class AI3std<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000490 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000491 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000492 asm, "", pattern> {
493 let Inst{4} = 1;
494 let Inst{5} = 1; // H bit
495 let Inst{6} = 1; // S bit
496 let Inst{7} = 1;
497 let Inst{20} = 0; // L bit
498 let Inst{21} = 0; // W bit
499 let Inst{24} = 1; // P bit
500}
501
502// Pre-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000503class AI3ldhpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000504 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000505 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000506 asm, cstr, pattern> {
507 let Inst{4} = 1;
508 let Inst{5} = 1; // H bit
509 let Inst{6} = 0; // S bit
510 let Inst{7} = 1;
511 let Inst{20} = 1; // L bit
512 let Inst{21} = 1; // W bit
513 let Inst{24} = 1; // P bit
514}
Evan Chengbe998242008-11-06 08:47:38 +0000515class AI3ldshpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000516 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000517 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000518 asm, cstr, pattern> {
519 let Inst{4} = 1;
520 let Inst{5} = 1; // H bit
521 let Inst{6} = 1; // S bit
522 let Inst{7} = 1;
523 let Inst{20} = 1; // L bit
524 let Inst{21} = 1; // W bit
525 let Inst{24} = 1; // P bit
526}
Evan Chengbe998242008-11-06 08:47:38 +0000527class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000528 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000529 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000530 asm, cstr, pattern> {
531 let Inst{4} = 1;
532 let Inst{5} = 0; // H bit
533 let Inst{6} = 1; // S bit
534 let Inst{7} = 1;
535 let Inst{20} = 1; // L bit
536 let Inst{21} = 1; // W bit
537 let Inst{24} = 1; // P bit
538}
539
540// Pre-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000541class AI3sthpr<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000542 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000543 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000544 asm, cstr, pattern> {
545 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} = 1; // W bit
551 let Inst{24} = 1; // P bit
552}
553
554// Post-indexed loads
Evan Chengbe998242008-11-06 08:47:38 +0000555class AI3ldhpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000556 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000557 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000558 asm, cstr,pattern> {
559 let Inst{4} = 1;
560 let Inst{5} = 1; // H bit
561 let Inst{6} = 0; // S bit
562 let Inst{7} = 1;
563 let Inst{20} = 1; // L bit
564 let Inst{21} = 1; // W bit
565 let Inst{24} = 0; // P bit
566}
Evan Chengbe998242008-11-06 08:47:38 +0000567class AI3ldshpo<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, IndexModePost, 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} = 1; // 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} = 0; // P bit
578}
Evan Chengbe998242008-11-06 08:47:38 +0000579class AI3ldsbpo<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, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000582 asm, cstr,pattern> {
583 let Inst{4} = 1;
584 let Inst{5} = 0; // 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} = 0; // P bit
590}
591
592// Post-indexed stores
Evan Chengbe998242008-11-06 08:47:38 +0000593class AI3sthpo<dag oops, dag iops, Format f, string opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000594 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000595 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
Evan Chengac92c3f2008-09-01 07:00:14 +0000596 asm, cstr,pattern> {
597 let Inst{4} = 1;
598 let Inst{5} = 1; // H bit
599 let Inst{6} = 0; // S bit
600 let Inst{7} = 1;
601 let Inst{20} = 0; // L bit
602 let Inst{21} = 1; // W bit
603 let Inst{24} = 0; // P bit
604}
605
606
Evan Cheng2e62b662008-09-01 01:51:14 +0000607// addrmode4 instructions
Evan Chengf8e8b622008-11-06 17:48:05 +0000608class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000609 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000610 "", pattern> {
611 let Inst{20} = 1; // L bit
612 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000613 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000614}
Evan Chengf8e8b622008-11-06 17:48:05 +0000615class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000616 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000617 "", pattern> {
618 let Inst{20} = 0; // L bit
619 let Inst{22} = 0; // S bit
Jim Grosbach88c246f2008-10-14 20:36:24 +0000620 let Inst{27-25} = 0b100;
Evan Chengd36b01c2008-09-01 07:48:18 +0000621}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000622
Jim Grosbach1feed042008-11-03 18:38:31 +0000623// Unsigned multiply, multiply-accumulate instructions.
Evan Chengbe998242008-11-06 08:47:38 +0000624class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000625 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000626 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000627 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000628 let Inst{7-4} = 0b1001;
Evan Chengee80fb72008-11-06 01:21:28 +0000629 let Inst{20} = 0; // S bit
Evan Chengbe998242008-11-06 08:47:38 +0000630 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000631}
Evan Chengbe998242008-11-06 08:47:38 +0000632class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
Jim Grosbach1feed042008-11-03 18:38:31 +0000633 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000634 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000635 asm, "", pattern> {
Jim Grosbach1feed042008-11-03 18:38:31 +0000636 let Inst{7-4} = 0b1001;
Evan Chengbe998242008-11-06 08:47:38 +0000637 let Inst{27-21} = opcod;
Evan Chengee80fb72008-11-06 01:21:28 +0000638}
639
640// Most significant word multiply
Evan Chengbe998242008-11-06 08:47:38 +0000641class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
Evan Chengee80fb72008-11-06 01:21:28 +0000642 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000643 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000644 asm, "", pattern> {
Evan Chengee80fb72008-11-06 01:21:28 +0000645 let Inst{7-4} = 0b1001;
646 let Inst{20} = 1;
Evan Chengbe998242008-11-06 08:47:38 +0000647 let Inst{27-21} = opcod;
Jim Grosbach1feed042008-11-03 18:38:31 +0000648}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000649
Evan Cheng38396be2008-11-06 03:35:07 +0000650// SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
Evan Chengbe998242008-11-06 08:47:38 +0000651class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
Evan Cheng38396be2008-11-06 03:35:07 +0000652 string asm, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000653 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
Evan Cheng37afa432008-11-06 22:15:19 +0000654 asm, "", pattern> {
Evan Cheng38396be2008-11-06 03:35:07 +0000655 let Inst{4} = 0;
656 let Inst{7} = 1;
657 let Inst{20} = 0;
Evan Chengbe998242008-11-06 08:47:38 +0000658 let Inst{27-21} = opcod;
Evan Cheng38396be2008-11-06 03:35:07 +0000659}
660
Evan Cheng37afa432008-11-06 22:15:19 +0000661// Extend instructions.
662class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
663 string asm, list<dag> pattern>
664 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
665 asm, "", pattern> {
666 let Inst{7-4} = 0b0111;
667 let Inst{27-20} = opcod;
668}
669
Evan Chengc2121a22008-11-07 01:41:35 +0000670// Misc Arithmetic instructions.
671class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
672 string asm, list<dag> pattern>
673 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
674 asm, "", pattern> {
675 let Inst{27-20} = opcod;
676}
677
Evan Cheng7b0249b2008-08-28 23:39:26 +0000678//===----------------------------------------------------------------------===//
679
680// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
681class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
682 list<Predicate> Predicates = [IsARM];
683}
684class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
685 list<Predicate> Predicates = [IsARM, HasV5TE];
686}
687class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
688 list<Predicate> Predicates = [IsARM, HasV6];
689}
Evan Cheng34a46e12008-08-29 06:41:12 +0000690
691//===----------------------------------------------------------------------===//
692//
693// Thumb Instruction Format Definitions.
694//
695
696
697// TI - Thumb instruction.
698
699class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
700 string asm, string cstr, list<dag> pattern>
Evan Chengbe998242008-11-06 08:47:38 +0000701 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
Evan Cheng34a46e12008-08-29 06:41:12 +0000702 let OutOperandList = outs;
703 let InOperandList = ins;
704 let AsmString = asm;
705 let Pattern = pattern;
706 list<Predicate> Predicates = [IsThumb];
707}
708
709class TI<dag outs, dag ins, string asm, list<dag> pattern>
710 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
711class TI1<dag outs, dag ins, string asm, list<dag> pattern>
712 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
713class TI2<dag outs, dag ins, string asm, list<dag> pattern>
714 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
715class TI4<dag outs, dag ins, string asm, list<dag> pattern>
716 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
717class TIs<dag outs, dag ins, string asm, list<dag> pattern>
718 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
719
720// Two-address instructions
721class TIt<dag outs, dag ins, string asm, list<dag> pattern>
722 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
723
724// BL, BLX(1) are translated by assembler into two instructions
725class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
726 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
727
728// BR_JT instructions
729class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
730 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
731
732
733//===----------------------------------------------------------------------===//
734
Evan Chengc63e15e2008-11-11 02:11:05 +0000735//===----------------------------------------------------------------------===//
736// ARM VFP Instruction templates.
737//
738
739// ARM Float Instruction
740class ASI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
741 : AI<oops, iops, VFPFrm, opc, asm, pattern> {
742 // TODO: Mark the instructions with the appropriate subtarget info.
743}
744
745class ASI5<dag oops, dag iops, string opc, string asm, list<dag> pattern>
746 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
747 VFPFrm, opc, asm, "", pattern> {
748 // TODO: Mark the instructions with the appropriate subtarget info.
749}
750
751// ARM Double Instruction
752class ADI<dag oops, dag iops, string opc, string asm, list<dag> pattern>
753 : AI<oops, iops, VFPFrm, opc, asm, pattern> {
754 // TODO: Mark the instructions with the appropriate subtarget info.
755}
756
757class ADI5<dag oops, dag iops, string opc, string asm, list<dag> pattern>
758 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
759 VFPFrm, opc, asm, "", pattern> {
760 // TODO: Mark the instructions with the appropriate subtarget info.
761}
762
763// Double precision, unary
764class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
765 string opc, string asm, list<dag> pattern>
766 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
767 let Inst{27-20} = opcod1;
768 let Inst{19-16} = opcod2;
769 let Inst{11-8} = 0b1011;
770 let Inst{7-4} = opcod3;
771}
772
773// Double precision, binary
774class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
775 string asm, list<dag> pattern>
776 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
777 let Inst{27-20} = opcod;
778 let Inst{11-8} = 0b1011;
779}
780
781// Single precision, unary
782class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
783 string opc, string asm, list<dag> pattern>
784 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
785 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
786 let Inst{27-20} = opcod1;
787 let Inst{19-16} = opcod2;
788 let Inst{11-8} = 0b1010;
789 let Inst{7-4} = opcod3;
790}
791
792// Single precision, binary
793class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
794 string asm, list<dag> pattern>
795 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
796 // Bit 22 (D bit) can be changed during instruction encoding.
797 let Inst{27-20} = opcod;
798 let Inst{11-8} = 0b1010;
799}
800
801// Special cases.
802class AXSI<dag oops, dag iops, string asm, list<dag> pattern>
803 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone,
804 VFPFrm, asm, "", pattern> {
805 // TODO: Mark the instructions with the appropriate subtarget info.
806}
807
808class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
809 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
810 VFPFrm, asm, "", pattern> {
811 // TODO: Mark the instructions with the appropriate subtarget info.
812}
813
814class AXDI<dag oops, dag iops, string asm, list<dag> pattern>
815 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone,
816 VFPFrm, asm, "", pattern> {
817 // TODO: Mark the instructions with the appropriate subtarget info.
818}
819
820class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
821 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
822 VFPFrm, asm, "", pattern> {
823 // TODO: Mark the instructions with the appropriate subtarget info.
824}
825
826
827//===----------------------------------------------------------------------===//
828
Evan Cheng34a46e12008-08-29 06:41:12 +0000829
830// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
831class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
832 list<Predicate> Predicates = [IsThumb];
833}
834
835class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
836 list<Predicate> Predicates = [IsThumb, HasV5T];
837}