blob: 26c6733ae7a73e6e6b9e05aedf13bc48d51eb74d [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>;
23def MulFrm : Format<2>;
24def MulSMLAW : Format<3>;
25def MulSMULW : Format<4>;
26def MulSMLA : Format<5>;
27def MulSMUL : Format<6>;
28def Branch : Format<7>;
29def BranchMisc : Format<8>;
30
Evan Cheng4c7e67a2008-09-13 01:35:33 +000031def DPRdIm : Format<9>;
32def DPRdReg : Format<10>;
33def DPRdSoReg : Format<11>;
34def DPRdMisc : Format<12>;
35def DPRnIm : Format<13>;
36def DPRnReg : Format<14>;
37def DPRnSoReg : Format<15>;
38def DPRIm : Format<16>;
39def DPRReg : Format<17>;
40def DPRSoReg : Format<18>;
41def DPRImS : Format<19>;
42def DPRRegS : Format<20>;
43def DPRSoRegS : Format<21>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000044
Evan Cheng4c7e67a2008-09-13 01:35:33 +000045def LdFrm : Format<22>;
46def StFrm : Format<23>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000047
Evan Cheng4c7e67a2008-09-13 01:35:33 +000048def ArithMisc : Format<24>;
49def ThumbFrm : Format<25>;
50def VFPFrm : Format<26>;
Evan Cheng7b0249b2008-08-28 23:39:26 +000051
52
Evan Cheng7b0249b2008-08-28 23:39:26 +000053//===----------------------------------------------------------------------===//
54
55// ARM Instruction templates.
56//
57
58class InstARM<bits<4> opcod, AddrMode am, SizeFlagVal sz, IndexMode im,
59 Format f, string cstr>
60 : Instruction {
Evan Chengd0750352008-08-29 07:40:52 +000061 field bits<32> Inst;
62
Evan Cheng7b0249b2008-08-28 23:39:26 +000063 let Namespace = "ARM";
64
65 bits<4> Opcode = opcod;
66 AddrMode AM = am;
67 bits<4> AddrModeBits = AM.Value;
68
69 SizeFlagVal SZ = sz;
70 bits<3> SizeFlag = SZ.Value;
71
72 IndexMode IM = im;
73 bits<2> IndexModeBits = IM.Value;
74
75 Format F = f;
76 bits<5> Form = F.Value;
77
78 let Constraints = cstr;
79}
80
81class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
82 : InstARM<0, AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
83 let OutOperandList = oops;
84 let InOperandList = iops;
85 let AsmString = asm;
86 let Pattern = pattern;
87}
88
89// Almost all ARM instructions are predicable.
90class I<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
91 IndexMode im, Format f, string opc, string asm, string cstr,
92 list<dag> pattern>
93 : InstARM<opcod, am, sz, im, f, cstr> {
94 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".
104class sI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
105 IndexMode im, Format f, string opc, string asm, string cstr,
106 list<dag> pattern>
107 : InstARM<opcod, am, sz, im, f, cstr> {
108 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
116class XI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
117 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
118 : InstARM<opcod, am, sz, im, f, cstr> {
119 let OutOperandList = oops;
120 let InOperandList = iops;
121 let AsmString = asm;
122 let Pattern = pattern;
123 list<Predicate> Predicates = [IsARM];
124}
125
Evan Cheng7b0249b2008-08-28 23:39:26 +0000126class AI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
127 string asm, list<dag> pattern>
128 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
129 asm,"",pattern>;
130class AsI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
131 string asm, list<dag> pattern>
132 : sI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
133 asm,"",pattern>;
Evan Chengc5409a82008-09-01 07:19:00 +0000134class AXI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
135 list<dag> pattern>
136 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
137 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000138
139// Ctrl flow instructions
140class ABLpredI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
141 string asm, list<dag> pattern>
142 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
143 asm,"",pattern> {
144 let Inst{24} = 1; // L bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000145 let Inst{25-27} = {1,0,1};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000146}
147class ABLI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
148 list<dag> pattern>
149 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
150 "", pattern> {
151 let Inst{24} = 1; // L bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000152 let Inst{25-27} = {1,0,1};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000153}
Evan Cheng10a9eb82008-09-01 08:25:56 +0000154// FIXME: BX
Evan Chengc5409a82008-09-01 07:19:00 +0000155class AXIx2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
156 list<dag> pattern>
157 : XI<opcod, oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, f, asm,
158 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000159class ABI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
160 list<dag> pattern>
161 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
162 "", pattern> {
163 let Inst{24} = 0; // L bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000164 let Inst{25-27} = {1,0,1};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000165}
166class ABccI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
167 string asm, list<dag> pattern>
168 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
169 asm,"",pattern> {
170 let Inst{24} = 0; // L bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000171 let Inst{25-27} = {1,0,1};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000172}
173
174// BR_JT instructions
175// == mov pc
176class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
177 : XI<opcod, oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BranchMisc,
178 asm, "", pattern> {
179 let Inst{20} = 0; // S Bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000180 let Inst{21-24} = {1,0,1,1};
181 let Inst{26-27} = {0,0};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000182}
Evan Cheng18e5d102008-09-17 07:16:21 +0000183// == add pc
Evan Cheng10a9eb82008-09-01 08:25:56 +0000184class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
185 : XI<opcod, oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BranchMisc,
186 asm, "", pattern> {
Evan Cheng18e5d102008-09-17 07:16:21 +0000187 let Inst{20} = 0; // S bit
188 let Inst{21-24} = {0,0,1,0};
189 let Inst{26-27} = {0,0};
190}
191// == ldr pc
192class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
193 : XI<opcod, oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BranchMisc,
194 asm, "", pattern> {
Evan Cheng10a9eb82008-09-01 08:25:56 +0000195 let Inst{20} = 1; // L bit
196 let Inst{21} = 0; // W bit
197 let Inst{22} = 0; // B bit
198 let Inst{24} = 1; // P bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000199 let Inst{26-27} = {0,0};
Evan Cheng10a9eb82008-09-01 08:25:56 +0000200}
201
Evan Cheng2e62b662008-09-01 01:51:14 +0000202
203// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000204class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
205 string asm, list<dag> pattern>
206 : I<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000207 asm, "", pattern> {
Evan Chengaf8f1282008-08-31 18:32:16 +0000208 let Inst{21-24} = opcod;
Evan Cheng18e5d102008-09-17 07:16:21 +0000209 let Inst{26-27} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000210}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000211class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
212 string asm, list<dag> pattern>
213 : sI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000214 asm, "", pattern> {
Evan Chengaf8f1282008-08-31 18:32:16 +0000215 let Inst{21-24} = opcod;
Evan Cheng18e5d102008-09-17 07:16:21 +0000216 let Inst{26-27} = {0,0};
Evan Chengd0750352008-08-29 07:40:52 +0000217}
Evan Chengc5409a82008-09-01 07:19:00 +0000218class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
219 list<dag> pattern>
220 : XI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
221 "", pattern> {
Evan Chengc5409a82008-09-01 07:19:00 +0000222 let Inst{21-24} = opcod;
Evan Cheng18e5d102008-09-17 07:16:21 +0000223 let Inst{26-27} = {0,0};
Evan Chengc5409a82008-09-01 07:19:00 +0000224}
Evan Cheng2e62b662008-09-01 01:51:14 +0000225class AI1x2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
226 string asm, list<dag> pattern>
227 : I<opcod, oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
228 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000229
Evan Cheng2e62b662008-09-01 01:51:14 +0000230
231// addrmode2 loads and stores
Evan Cheng7b0249b2008-08-28 23:39:26 +0000232class AI2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
233 string asm, list<dag> pattern>
234 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000235 asm, "", pattern> {
Evan Cheng18e5d102008-09-17 07:16:21 +0000236 let Inst{26-27} = {1,0};
Evan Chengda020022008-08-31 19:02:21 +0000237}
Evan Chengc5409a82008-09-01 07:19:00 +0000238class AXI2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
239 list<dag> pattern>
240 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
241 "", pattern>;
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000242
243// loads
Evan Chengda020022008-08-31 19:02:21 +0000244class AI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
245 string asm, list<dag> pattern>
246 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000247 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000248 let Inst{21} = 0; // W bit
249 let Inst{22} = 0; // B bit
250 let Inst{24} = 1; // P bit
251}
Evan Chengae7b1d72008-09-01 07:34:13 +0000252class AXI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
253 list<dag> pattern>
254 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
255 "", pattern> {
256 let Inst{20} = 1; // L bit
257 let Inst{21} = 0; // W bit
258 let Inst{22} = 0; // B bit
259 let Inst{24} = 1; // P bit
260}
Evan Chengda020022008-08-31 19:02:21 +0000261class AI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
262 string asm, list<dag> pattern>
263 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000264 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000265 let Inst{21} = 0; // W bit
266 let Inst{22} = 1; // B bit
267 let Inst{24} = 1; // P bit
268}
Evan Chengae7b1d72008-09-01 07:34:13 +0000269class AXI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
270 list<dag> pattern>
271 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
272 "", pattern> {
273 let Inst{20} = 1; // L bit
274 let Inst{21} = 0; // W bit
275 let Inst{22} = 1; // B bit
276 let Inst{24} = 1; // P bit
277}
Evan Chengda020022008-08-31 19:02:21 +0000278
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000279// stores
280class AI2stw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
281 string asm, list<dag> pattern>
282 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000283 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000284 let Inst{21} = 0; // W bit
285 let Inst{22} = 0; // B bit
286 let Inst{24} = 1; // P bit
287}
Evan Chengae7b1d72008-09-01 07:34:13 +0000288class AXI2stw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
289 list<dag> pattern>
290 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
291 "", pattern> {
292 let Inst{20} = 0; // L bit
293 let Inst{21} = 0; // W bit
294 let Inst{22} = 0; // B bit
295 let Inst{24} = 1; // P bit
296}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000297class AI2stb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
298 string asm, list<dag> pattern>
299 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000300 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000301 let Inst{21} = 0; // W bit
302 let Inst{22} = 1; // B bit
303 let Inst{24} = 1; // P bit
304}
Evan Chengae7b1d72008-09-01 07:34:13 +0000305class AXI2stb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
306 list<dag> pattern>
307 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
308 "", pattern> {
309 let Inst{20} = 0; // L bit
310 let Inst{21} = 0; // W bit
311 let Inst{22} = 1; // B bit
312 let Inst{24} = 1; // P bit
313}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000314
Evan Chengac92c3f2008-09-01 07:00:14 +0000315// Pre-indexed loads
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000316class AI2ldwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000317 string asm, string cstr, list<dag> pattern>
318 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000319 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000320 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000321 let Inst{21} = 1; // W bit
322 let Inst{22} = 0; // B bit
323 let Inst{24} = 1; // P bit
324}
325class AI2ldbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
326 string asm, string cstr, list<dag> pattern>
327 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
328 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} = 1; // W bit
331 let Inst{22} = 1; // B bit
332 let Inst{24} = 1; // P bit
333}
334
Evan Chengac92c3f2008-09-01 07:00:14 +0000335// Pre-indexed stores
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000336class AI2stwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
337 string asm, string cstr, list<dag> pattern>
338 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
339 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000340 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000341 let Inst{21} = 1; // W bit
342 let Inst{22} = 0; // B bit
343 let Inst{24} = 1; // P bit
344}
345class AI2stbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
346 string asm, string cstr, list<dag> pattern>
347 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
348 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000349 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000350 let Inst{21} = 1; // W bit
351 let Inst{22} = 1; // B bit
352 let Inst{24} = 1; // P bit
353}
354
Evan Chengac92c3f2008-09-01 07:00:14 +0000355// Post-indexed loads
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000356class AI2ldwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000357 string asm, string cstr, list<dag> pattern>
358 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000359 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000360 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000361 let Inst{21} = 0; // W bit
362 let Inst{22} = 0; // B bit
363 let Inst{24} = 0; // P bit
364}
365class AI2ldbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
366 string asm, string cstr, list<dag> pattern>
367 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
368 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000369 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000370 let Inst{21} = 0; // W bit
371 let Inst{22} = 1; // B bit
372 let Inst{24} = 0; // P bit
373}
374
Evan Chengac92c3f2008-09-01 07:00:14 +0000375// Post-indexed stores
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000376class AI2stwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
377 string asm, string cstr, list<dag> pattern>
378 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
379 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000380 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000381 let Inst{21} = 0; // W bit
382 let Inst{22} = 0; // B bit
383 let Inst{24} = 0; // P bit
384}
385class AI2stbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
386 string asm, string cstr, list<dag> pattern>
387 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
388 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000389 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000390 let Inst{21} = 0; // W bit
391 let Inst{22} = 1; // B bit
392 let Inst{24} = 0; // P bit
393}
394
Evan Cheng2e62b662008-09-01 01:51:14 +0000395// addrmode3 instructions
396class AI3<bits<4> opcod, dag oops, dag iops, Format f, string opc,
397 string asm, list<dag> pattern>
398 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
399 asm, "", pattern>;
Evan Chengc5409a82008-09-01 07:19:00 +0000400class AXI3<bits<4> opcod, dag oops, dag iops, Format f, string asm,
401 list<dag> pattern>
402 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
403 "", pattern>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000404
Evan Chengac92c3f2008-09-01 07:00:14 +0000405// loads
406class AI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
407 string asm, list<dag> pattern>
408 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
409 asm, "", pattern> {
410 let Inst{4} = 1;
411 let Inst{5} = 1; // H bit
412 let Inst{6} = 0; // S bit
413 let Inst{7} = 1;
414 let Inst{20} = 1; // L bit
415 let Inst{21} = 0; // W bit
416 let Inst{24} = 1; // P bit
417}
Evan Chengae7b1d72008-09-01 07:34:13 +0000418class AXI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
419 list<dag> pattern>
420 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
421 "", pattern> {
422 let Inst{4} = 1;
423 let Inst{5} = 1; // H bit
424 let Inst{6} = 0; // S bit
425 let Inst{7} = 1;
426 let Inst{20} = 1; // L bit
427 let Inst{21} = 0; // W bit
428 let Inst{24} = 1; // P bit
429}
Evan Chengac92c3f2008-09-01 07:00:14 +0000430class AI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
431 string asm, list<dag> pattern>
432 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
433 asm, "", pattern> {
434 let Inst{4} = 1;
435 let Inst{5} = 1; // H bit
436 let Inst{6} = 1; // S bit
437 let Inst{7} = 1;
438 let Inst{20} = 1; // L bit
439 let Inst{21} = 0; // W bit
440 let Inst{24} = 1; // P bit
441}
Evan Chengae7b1d72008-09-01 07:34:13 +0000442class AXI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
443 list<dag> pattern>
444 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
445 "", pattern> {
446 let Inst{4} = 1;
447 let Inst{5} = 1; // H bit
448 let Inst{6} = 1; // S bit
449 let Inst{7} = 1;
450 let Inst{20} = 1; // L bit
451 let Inst{21} = 0; // W bit
452 let Inst{24} = 1; // P bit
453}
Evan Chengac92c3f2008-09-01 07:00:14 +0000454class AI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
455 string asm, list<dag> pattern>
456 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
457 asm, "", pattern> {
458 let Inst{4} = 1;
459 let Inst{5} = 0; // H bit
460 let Inst{6} = 1; // S bit
461 let Inst{7} = 1;
462 let Inst{20} = 1; // L bit
463 let Inst{21} = 0; // W bit
464 let Inst{24} = 1; // P bit
465}
Evan Chengae7b1d72008-09-01 07:34:13 +0000466class AXI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
467 list<dag> pattern>
468 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
469 "", pattern> {
470 let Inst{4} = 1;
471 let Inst{5} = 0; // H bit
472 let Inst{6} = 1; // S bit
473 let Inst{7} = 1;
474 let Inst{20} = 1; // L bit
475 let Inst{21} = 0; // W bit
476 let Inst{24} = 1; // P bit
477}
Evan Chengac92c3f2008-09-01 07:00:14 +0000478class AI3ldd<bits<4> opcod, dag oops, dag iops, Format f, string opc,
479 string asm, list<dag> pattern>
480 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
481 asm, "", pattern> {
482 let Inst{4} = 1;
483 let Inst{5} = 0; // H bit
484 let Inst{6} = 1; // S bit
485 let Inst{7} = 1;
486 let Inst{20} = 0; // L bit
487 let Inst{21} = 0; // W bit
488 let Inst{24} = 1; // P bit
489}
490
491// stores
492class AI3sth<bits<4> opcod, dag oops, dag iops, Format f, string opc,
493 string asm, list<dag> pattern>
494 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
495 asm, "", pattern> {
496 let Inst{4} = 1;
497 let Inst{5} = 1; // H bit
498 let Inst{6} = 0; // S bit
499 let Inst{7} = 1;
500 let Inst{20} = 0; // L bit
501 let Inst{21} = 0; // W bit
502 let Inst{24} = 1; // P bit
503}
Evan Chengae7b1d72008-09-01 07:34:13 +0000504class AXI3sth<bits<4> opcod, dag oops, dag iops, Format f, string asm,
505 list<dag> pattern>
506 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
507 "", pattern> {
508 let Inst{4} = 1;
509 let Inst{5} = 1; // H bit
510 let Inst{6} = 0; // S bit
511 let Inst{7} = 1;
512 let Inst{20} = 0; // L bit
513 let Inst{21} = 0; // W bit
514 let Inst{24} = 1; // P bit
515}
Evan Chengac92c3f2008-09-01 07:00:14 +0000516class AI3std<bits<4> opcod, dag oops, dag iops, Format f, string opc,
517 string asm, list<dag> pattern>
518 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
519 asm, "", pattern> {
520 let Inst{4} = 1;
521 let Inst{5} = 1; // H bit
522 let Inst{6} = 1; // S bit
523 let Inst{7} = 1;
524 let Inst{20} = 0; // L bit
525 let Inst{21} = 0; // W bit
526 let Inst{24} = 1; // P bit
527}
528
529// Pre-indexed loads
530class AI3ldhpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
531 string asm, string cstr, list<dag> pattern>
532 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
533 asm, cstr, pattern> {
534 let Inst{4} = 1;
535 let Inst{5} = 1; // H bit
536 let Inst{6} = 0; // S bit
537 let Inst{7} = 1;
538 let Inst{20} = 1; // L bit
539 let Inst{21} = 1; // W bit
540 let Inst{24} = 1; // P bit
541}
542class AI3ldshpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
543 string asm, string cstr, list<dag> pattern>
544 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
545 asm, cstr, pattern> {
546 let Inst{4} = 1;
547 let Inst{5} = 1; // H bit
548 let Inst{6} = 1; // S bit
549 let Inst{7} = 1;
550 let Inst{20} = 1; // L bit
551 let Inst{21} = 1; // W bit
552 let Inst{24} = 1; // P bit
553}
554class AI3ldsbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
555 string asm, string cstr, list<dag> pattern>
556 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
557 asm, cstr, pattern> {
558 let Inst{4} = 1;
559 let Inst{5} = 0; // H bit
560 let Inst{6} = 1; // S bit
561 let Inst{7} = 1;
562 let Inst{20} = 1; // L bit
563 let Inst{21} = 1; // W bit
564 let Inst{24} = 1; // P bit
565}
566
567// Pre-indexed stores
568class AI3sthpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
569 string asm, string cstr, list<dag> pattern>
570 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
571 asm, cstr, pattern> {
572 let Inst{4} = 1;
573 let Inst{5} = 1; // H bit
574 let Inst{6} = 0; // S bit
575 let Inst{7} = 1;
576 let Inst{20} = 0; // L bit
577 let Inst{21} = 1; // W bit
578 let Inst{24} = 1; // P bit
579}
580
581// Post-indexed loads
582class AI3ldhpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
583 string asm, string cstr, list<dag> pattern>
584 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
585 asm, cstr,pattern> {
586 let Inst{4} = 1;
587 let Inst{5} = 1; // H bit
588 let Inst{6} = 0; // S bit
589 let Inst{7} = 1;
590 let Inst{20} = 1; // L bit
591 let Inst{21} = 1; // W bit
592 let Inst{24} = 0; // P bit
593}
594class AI3ldshpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
595 string asm, string cstr, list<dag> pattern>
596 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
597 asm, cstr,pattern> {
598 let Inst{4} = 1;
599 let Inst{5} = 1; // H bit
600 let Inst{6} = 1; // S bit
601 let Inst{7} = 1;
602 let Inst{20} = 1; // L bit
603 let Inst{21} = 1; // W bit
604 let Inst{24} = 0; // P bit
605}
606class AI3ldsbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
607 string asm, string cstr, list<dag> pattern>
608 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
609 asm, cstr,pattern> {
610 let Inst{4} = 1;
611 let Inst{5} = 0; // H bit
612 let Inst{6} = 1; // S bit
613 let Inst{7} = 1;
614 let Inst{20} = 1; // L bit
615 let Inst{21} = 1; // W bit
616 let Inst{24} = 0; // P bit
617}
618
619// Post-indexed stores
620class AI3sthpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
621 string asm, string cstr, list<dag> pattern>
622 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
623 asm, cstr,pattern> {
624 let Inst{4} = 1;
625 let Inst{5} = 1; // H bit
626 let Inst{6} = 0; // S bit
627 let Inst{7} = 1;
628 let Inst{20} = 0; // L bit
629 let Inst{21} = 1; // W bit
630 let Inst{24} = 0; // P bit
631}
632
633
Evan Cheng2e62b662008-09-01 01:51:14 +0000634// addrmode4 instructions
635class AI4<bits<4> opcod, dag oops, dag iops, Format f, string opc,
636 string asm, list<dag> pattern>
637 : I<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd36b01c2008-09-01 07:48:18 +0000638 asm, "", pattern> {
Evan Cheng18e5d102008-09-17 07:16:21 +0000639 let Inst{25-27} = {0,0,1};
Evan Chengd36b01c2008-09-01 07:48:18 +0000640}
641class AXI4ld<bits<4> opcod, dag oops, dag iops, Format f, string asm,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000642 list<dag> pattern>
643 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000644 "", pattern> {
645 let Inst{20} = 1; // L bit
646 let Inst{22} = 0; // S bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000647 let Inst{25-27} = {0,0,1};
Evan Chengd36b01c2008-09-01 07:48:18 +0000648}
649class AXI4ldpc<bits<4> opcod, dag oops, dag iops, Format f, string asm,
650 list<dag> pattern>
651 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
652 "", pattern> {
653 let Inst{20} = 1; // L bit
654 let Inst{22} = 1; // S bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000655 let Inst{25-27} = {0,0,1};
Evan Chengd36b01c2008-09-01 07:48:18 +0000656}
657class AXI4st<bits<4> opcod, dag oops, dag iops, Format f, string asm,
658 list<dag> pattern>
659 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
660 "", pattern> {
661 let Inst{20} = 0; // L bit
662 let Inst{22} = 0; // S bit
Evan Cheng18e5d102008-09-17 07:16:21 +0000663 let Inst{25-27} = {0,0,1};
Evan Chengd36b01c2008-09-01 07:48:18 +0000664}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000665
Evan Cheng7b0249b2008-08-28 23:39:26 +0000666
Evan Cheng7b0249b2008-08-28 23:39:26 +0000667//===----------------------------------------------------------------------===//
668
669// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
670class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
671 list<Predicate> Predicates = [IsARM];
672}
673class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
674 list<Predicate> Predicates = [IsARM, HasV5TE];
675}
676class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
677 list<Predicate> Predicates = [IsARM, HasV6];
678}
Evan Cheng34a46e12008-08-29 06:41:12 +0000679
680//===----------------------------------------------------------------------===//
681//
682// Thumb Instruction Format Definitions.
683//
684
685
686// TI - Thumb instruction.
687
688class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
689 string asm, string cstr, list<dag> pattern>
690 // FIXME: Set all opcodes to 0 for now.
691 : InstARM<0, am, sz, IndexModeNone, ThumbFrm, cstr> {
692 let OutOperandList = outs;
693 let InOperandList = ins;
694 let AsmString = asm;
695 let Pattern = pattern;
696 list<Predicate> Predicates = [IsThumb];
697}
698
699class TI<dag outs, dag ins, string asm, list<dag> pattern>
700 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
701class TI1<dag outs, dag ins, string asm, list<dag> pattern>
702 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
703class TI2<dag outs, dag ins, string asm, list<dag> pattern>
704 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
705class TI4<dag outs, dag ins, string asm, list<dag> pattern>
706 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
707class TIs<dag outs, dag ins, string asm, list<dag> pattern>
708 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
709
710// Two-address instructions
711class TIt<dag outs, dag ins, string asm, list<dag> pattern>
712 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
713
714// BL, BLX(1) are translated by assembler into two instructions
715class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
716 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
717
718// BR_JT instructions
719class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
720 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
721
722
723//===----------------------------------------------------------------------===//
724
725
726// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
727class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
728 list<Predicate> Predicates = [IsThumb];
729}
730
731class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
732 list<Predicate> Predicates = [IsThumb, HasV5T];
733}