blob: 10153f68d025c5dc870d7d8b3ddb32aedbbba407 [file] [log] [blame]
Evan Cheng37f25d92008-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
31def 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>;
44
45def LdFrm : Format<22>;
46def StFrm : Format<23>;
47
48def ArithMisc : Format<24>;
49def ThumbFrm : Format<25>;
50def VFPFrm : Format<26>;
51
52
Evan Cheng37f25d92008-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 Cheng612b79e2008-08-29 07:40:52 +000061 field bits<32> Inst;
62
Evan Cheng37f25d92008-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 Cheng4bbd5f82008-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 Cheng37f25d92008-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 Cheng4bbd5f82008-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>;
138class AXIx2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
139 list<dag> pattern>
140 : XI<opcod, oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, f, asm,
141 "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000142
143// addrmode1 instructions
Evan Cheng37f25d92008-08-28 23:39:26 +0000144class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
145 string asm, list<dag> pattern>
146 : I<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng612b79e2008-08-29 07:40:52 +0000147 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000148 let Inst{21-24} = opcod;
149 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000150}
Evan Cheng37f25d92008-08-28 23:39:26 +0000151class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
152 string asm, list<dag> pattern>
153 : sI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng612b79e2008-08-29 07:40:52 +0000154 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000155 let Inst{20} = 1;
156 let Inst{21-24} = opcod;
157 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000158}
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000159class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
160 list<dag> pattern>
161 : XI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
162 "", pattern> {
163 let Inst{20} = 1;
164 let Inst{21-24} = opcod;
165 let Inst{26-27} = 0;
166}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000167class AI1x2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
168 string asm, list<dag> pattern>
169 : I<opcod, oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
170 asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000171
Evan Cheng0d14fc82008-09-01 01:51:14 +0000172
173// addrmode2 loads and stores
Evan Cheng37f25d92008-08-28 23:39:26 +0000174class AI2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
175 string asm, list<dag> pattern>
176 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng17222df2008-08-31 19:02:21 +0000177 asm, "", pattern> {
178 let Inst{26-27} = 1;
179}
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000180class AXI2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
181 list<dag> pattern>
182 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
183 "", pattern>;
Evan Cheng93912732008-09-01 01:27:33 +0000184
185// loads
Evan Cheng17222df2008-08-31 19:02:21 +0000186class AI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
187 string asm, list<dag> pattern>
188 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000189 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000190 let Inst{21} = 0; // W bit
191 let Inst{22} = 0; // B bit
192 let Inst{24} = 1; // P bit
193}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000194class AXI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
195 list<dag> pattern>
196 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
197 "", pattern> {
198 let Inst{20} = 1; // L bit
199 let Inst{21} = 0; // W bit
200 let Inst{22} = 0; // B bit
201 let Inst{24} = 1; // P bit
202}
Evan Cheng17222df2008-08-31 19:02:21 +0000203class AI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
204 string asm, list<dag> pattern>
205 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000206 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000207 let Inst{21} = 0; // W bit
208 let Inst{22} = 1; // B bit
209 let Inst{24} = 1; // P bit
210}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000211class AXI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
212 list<dag> pattern>
213 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
214 "", pattern> {
215 let Inst{20} = 1; // L bit
216 let Inst{21} = 0; // W bit
217 let Inst{22} = 1; // B bit
218 let Inst{24} = 1; // P bit
219}
Evan Cheng17222df2008-08-31 19:02:21 +0000220
Evan Cheng93912732008-09-01 01:27:33 +0000221// stores
222class AI2stw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
223 string asm, list<dag> pattern>
224 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000225 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000226 let Inst{21} = 0; // W bit
227 let Inst{22} = 0; // B bit
228 let Inst{24} = 1; // P bit
229}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000230class AXI2stw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
231 list<dag> pattern>
232 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
233 "", pattern> {
234 let Inst{20} = 0; // L bit
235 let Inst{21} = 0; // W bit
236 let Inst{22} = 0; // B bit
237 let Inst{24} = 1; // P bit
238}
Evan Cheng93912732008-09-01 01:27:33 +0000239class AI2stb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
240 string asm, list<dag> pattern>
241 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000242 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000243 let Inst{21} = 0; // W bit
244 let Inst{22} = 1; // B bit
245 let Inst{24} = 1; // P bit
246}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000247class AXI2stb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
248 list<dag> pattern>
249 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
250 "", pattern> {
251 let Inst{20} = 0; // L bit
252 let Inst{21} = 0; // W bit
253 let Inst{22} = 1; // B bit
254 let Inst{24} = 1; // P bit
255}
Evan Cheng93912732008-09-01 01:27:33 +0000256
Evan Cheng840917b2008-09-01 07:00:14 +0000257// Pre-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000258class AI2ldwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000259 string asm, string cstr, list<dag> pattern>
260 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000261 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000262 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000263 let Inst{21} = 1; // W bit
264 let Inst{22} = 0; // B bit
265 let Inst{24} = 1; // P bit
266}
267class AI2ldbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
268 string asm, string cstr, list<dag> pattern>
269 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
270 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000271 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000272 let Inst{21} = 1; // W bit
273 let Inst{22} = 1; // B bit
274 let Inst{24} = 1; // P bit
275}
276
Evan Cheng840917b2008-09-01 07:00:14 +0000277// Pre-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000278class AI2stwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
279 string asm, string cstr, list<dag> pattern>
280 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
281 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000282 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000283 let Inst{21} = 1; // W bit
284 let Inst{22} = 0; // B bit
285 let Inst{24} = 1; // P bit
286}
287class AI2stbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
288 string asm, string cstr, list<dag> pattern>
289 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
290 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000291 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000292 let Inst{21} = 1; // W bit
293 let Inst{22} = 1; // B bit
294 let Inst{24} = 1; // P bit
295}
296
Evan Cheng840917b2008-09-01 07:00:14 +0000297// Post-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000298class AI2ldwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000299 string asm, string cstr, list<dag> pattern>
300 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000301 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000302 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000303 let Inst{21} = 0; // W bit
304 let Inst{22} = 0; // B bit
305 let Inst{24} = 0; // P bit
306}
307class AI2ldbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
308 string asm, string cstr, list<dag> pattern>
309 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
310 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000311 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000312 let Inst{21} = 0; // W bit
313 let Inst{22} = 1; // B bit
314 let Inst{24} = 0; // P bit
315}
316
Evan Cheng840917b2008-09-01 07:00:14 +0000317// Post-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000318class AI2stwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
319 string asm, string cstr, list<dag> pattern>
320 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
321 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000322 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000323 let Inst{21} = 0; // W bit
324 let Inst{22} = 0; // B bit
325 let Inst{24} = 0; // P bit
326}
327class AI2stbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
328 string asm, string cstr, list<dag> pattern>
329 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
330 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000331 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000332 let Inst{21} = 0; // W bit
333 let Inst{22} = 1; // B bit
334 let Inst{24} = 0; // P bit
335}
336
Evan Cheng0d14fc82008-09-01 01:51:14 +0000337// addrmode3 instructions
338class AI3<bits<4> opcod, dag oops, dag iops, Format f, string opc,
339 string asm, list<dag> pattern>
340 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
341 asm, "", pattern>;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000342class AXI3<bits<4> opcod, dag oops, dag iops, Format f, string asm,
343 list<dag> pattern>
344 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
345 "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000346
Evan Cheng840917b2008-09-01 07:00:14 +0000347// loads
348class AI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
349 string asm, list<dag> pattern>
350 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
351 asm, "", pattern> {
352 let Inst{4} = 1;
353 let Inst{5} = 1; // H bit
354 let Inst{6} = 0; // S bit
355 let Inst{7} = 1;
356 let Inst{20} = 1; // L bit
357 let Inst{21} = 0; // W bit
358 let Inst{24} = 1; // P bit
359}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000360class AXI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
361 list<dag> pattern>
362 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
363 "", pattern> {
364 let Inst{4} = 1;
365 let Inst{5} = 1; // H bit
366 let Inst{6} = 0; // S bit
367 let Inst{7} = 1;
368 let Inst{20} = 1; // L bit
369 let Inst{21} = 0; // W bit
370 let Inst{24} = 1; // P bit
371}
Evan Cheng840917b2008-09-01 07:00:14 +0000372class AI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
373 string asm, list<dag> pattern>
374 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
375 asm, "", pattern> {
376 let Inst{4} = 1;
377 let Inst{5} = 1; // H bit
378 let Inst{6} = 1; // S bit
379 let Inst{7} = 1;
380 let Inst{20} = 1; // L bit
381 let Inst{21} = 0; // W bit
382 let Inst{24} = 1; // P bit
383}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000384class AXI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
385 list<dag> pattern>
386 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
387 "", pattern> {
388 let Inst{4} = 1;
389 let Inst{5} = 1; // H bit
390 let Inst{6} = 1; // S bit
391 let Inst{7} = 1;
392 let Inst{20} = 1; // L bit
393 let Inst{21} = 0; // W bit
394 let Inst{24} = 1; // P bit
395}
Evan Cheng840917b2008-09-01 07:00:14 +0000396class AI3ldsb<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> {
400 let Inst{4} = 1;
401 let Inst{5} = 0; // H bit
402 let Inst{6} = 1; // S bit
403 let Inst{7} = 1;
404 let Inst{20} = 1; // L bit
405 let Inst{21} = 0; // W bit
406 let Inst{24} = 1; // P bit
407}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000408class AXI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
409 list<dag> pattern>
410 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
411 "", pattern> {
412 let Inst{4} = 1;
413 let Inst{5} = 0; // H bit
414 let Inst{6} = 1; // S bit
415 let Inst{7} = 1;
416 let Inst{20} = 1; // L bit
417 let Inst{21} = 0; // W bit
418 let Inst{24} = 1; // P bit
419}
Evan Cheng840917b2008-09-01 07:00:14 +0000420class AI3ldd<bits<4> opcod, dag oops, dag iops, Format f, string opc,
421 string asm, list<dag> pattern>
422 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
423 asm, "", pattern> {
424 let Inst{4} = 1;
425 let Inst{5} = 0; // H bit
426 let Inst{6} = 1; // S bit
427 let Inst{7} = 1;
428 let Inst{20} = 0; // L bit
429 let Inst{21} = 0; // W bit
430 let Inst{24} = 1; // P bit
431}
432
433// stores
434class AI3sth<bits<4> opcod, dag oops, dag iops, Format f, string opc,
435 string asm, list<dag> pattern>
436 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
437 asm, "", pattern> {
438 let Inst{4} = 1;
439 let Inst{5} = 1; // H bit
440 let Inst{6} = 0; // S bit
441 let Inst{7} = 1;
442 let Inst{20} = 0; // L bit
443 let Inst{21} = 0; // W bit
444 let Inst{24} = 1; // P bit
445}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000446class AXI3sth<bits<4> opcod, dag oops, dag iops, Format f, string asm,
447 list<dag> pattern>
448 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
449 "", pattern> {
450 let Inst{4} = 1;
451 let Inst{5} = 1; // H bit
452 let Inst{6} = 0; // S bit
453 let Inst{7} = 1;
454 let Inst{20} = 0; // L bit
455 let Inst{21} = 0; // W bit
456 let Inst{24} = 1; // P bit
457}
Evan Cheng840917b2008-09-01 07:00:14 +0000458class AI3std<bits<4> opcod, dag oops, dag iops, Format f, string opc,
459 string asm, list<dag> pattern>
460 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
461 asm, "", pattern> {
462 let Inst{4} = 1;
463 let Inst{5} = 1; // H bit
464 let Inst{6} = 1; // S bit
465 let Inst{7} = 1;
466 let Inst{20} = 0; // L bit
467 let Inst{21} = 0; // W bit
468 let Inst{24} = 1; // P bit
469}
470
471// Pre-indexed loads
472class AI3ldhpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
473 string asm, string cstr, list<dag> pattern>
474 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
475 asm, cstr, pattern> {
476 let Inst{4} = 1;
477 let Inst{5} = 1; // H bit
478 let Inst{6} = 0; // S bit
479 let Inst{7} = 1;
480 let Inst{20} = 1; // L bit
481 let Inst{21} = 1; // W bit
482 let Inst{24} = 1; // P bit
483}
484class AI3ldshpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
485 string asm, string cstr, list<dag> pattern>
486 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
487 asm, cstr, pattern> {
488 let Inst{4} = 1;
489 let Inst{5} = 1; // H bit
490 let Inst{6} = 1; // S bit
491 let Inst{7} = 1;
492 let Inst{20} = 1; // L bit
493 let Inst{21} = 1; // W bit
494 let Inst{24} = 1; // P bit
495}
496class AI3ldsbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
497 string asm, string cstr, list<dag> pattern>
498 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
499 asm, cstr, pattern> {
500 let Inst{4} = 1;
501 let Inst{5} = 0; // H bit
502 let Inst{6} = 1; // S bit
503 let Inst{7} = 1;
504 let Inst{20} = 1; // L bit
505 let Inst{21} = 1; // W bit
506 let Inst{24} = 1; // P bit
507}
508
509// Pre-indexed stores
510class AI3sthpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
511 string asm, string cstr, list<dag> pattern>
512 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
513 asm, cstr, pattern> {
514 let Inst{4} = 1;
515 let Inst{5} = 1; // H bit
516 let Inst{6} = 0; // S bit
517 let Inst{7} = 1;
518 let Inst{20} = 0; // L bit
519 let Inst{21} = 1; // W bit
520 let Inst{24} = 1; // P bit
521}
522
523// Post-indexed loads
524class AI3ldhpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
525 string asm, string cstr, list<dag> pattern>
526 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
527 asm, cstr,pattern> {
528 let Inst{4} = 1;
529 let Inst{5} = 1; // H bit
530 let Inst{6} = 0; // S bit
531 let Inst{7} = 1;
532 let Inst{20} = 1; // L bit
533 let Inst{21} = 1; // W bit
534 let Inst{24} = 0; // P bit
535}
536class AI3ldshpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
537 string asm, string cstr, list<dag> pattern>
538 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
539 asm, cstr,pattern> {
540 let Inst{4} = 1;
541 let Inst{5} = 1; // H bit
542 let Inst{6} = 1; // S bit
543 let Inst{7} = 1;
544 let Inst{20} = 1; // L bit
545 let Inst{21} = 1; // W bit
546 let Inst{24} = 0; // P bit
547}
548class AI3ldsbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
549 string asm, string cstr, list<dag> pattern>
550 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
551 asm, cstr,pattern> {
552 let Inst{4} = 1;
553 let Inst{5} = 0; // H bit
554 let Inst{6} = 1; // S bit
555 let Inst{7} = 1;
556 let Inst{20} = 1; // L bit
557 let Inst{21} = 1; // W bit
558 let Inst{24} = 0; // P bit
559}
560
561// Post-indexed stores
562class AI3sthpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
563 string asm, string cstr, list<dag> pattern>
564 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
565 asm, cstr,pattern> {
566 let Inst{4} = 1;
567 let Inst{5} = 1; // H bit
568 let Inst{6} = 0; // S bit
569 let Inst{7} = 1;
570 let Inst{20} = 0; // L bit
571 let Inst{21} = 1; // W bit
572 let Inst{24} = 0; // P bit
573}
574
575
Evan Cheng0d14fc82008-09-01 01:51:14 +0000576// addrmode4 instructions
577class AI4<bits<4> opcod, dag oops, dag iops, Format f, string opc,
578 string asm, list<dag> pattern>
579 : I<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc,
580 asm, "", pattern>;
Evan Cheng37f25d92008-08-28 23:39:26 +0000581class AXI4<bits<4> opcod, dag oops, dag iops, Format f, string asm,
582 list<dag> pattern>
583 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
584 "", pattern>;
585
Evan Cheng37f25d92008-08-28 23:39:26 +0000586
587// BR_JT instructions
588class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
589 : XI<opcod, oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BranchMisc,
590 asm, "", pattern>;
591class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
592 : XI<opcod, oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BranchMisc,
593 asm, "", pattern>;
594class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
595 : XI<opcod, oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BranchMisc,
596 asm, "", pattern>;
597
598
599//===----------------------------------------------------------------------===//
600
601// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
602class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
603 list<Predicate> Predicates = [IsARM];
604}
605class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
606 list<Predicate> Predicates = [IsARM, HasV5TE];
607}
608class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
609 list<Predicate> Predicates = [IsARM, HasV6];
610}
Evan Cheng13096642008-08-29 06:41:12 +0000611
612//===----------------------------------------------------------------------===//
613//
614// Thumb Instruction Format Definitions.
615//
616
617
618// TI - Thumb instruction.
619
620class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
621 string asm, string cstr, list<dag> pattern>
622 // FIXME: Set all opcodes to 0 for now.
623 : InstARM<0, am, sz, IndexModeNone, ThumbFrm, cstr> {
624 let OutOperandList = outs;
625 let InOperandList = ins;
626 let AsmString = asm;
627 let Pattern = pattern;
628 list<Predicate> Predicates = [IsThumb];
629}
630
631class TI<dag outs, dag ins, string asm, list<dag> pattern>
632 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
633class TI1<dag outs, dag ins, string asm, list<dag> pattern>
634 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
635class TI2<dag outs, dag ins, string asm, list<dag> pattern>
636 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
637class TI4<dag outs, dag ins, string asm, list<dag> pattern>
638 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
639class TIs<dag outs, dag ins, string asm, list<dag> pattern>
640 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
641
642// Two-address instructions
643class TIt<dag outs, dag ins, string asm, list<dag> pattern>
644 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
645
646// BL, BLX(1) are translated by assembler into two instructions
647class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
648 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
649
650// BR_JT instructions
651class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
652 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
653
654
655//===----------------------------------------------------------------------===//
656
657
658// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
659class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
660 list<Predicate> Predicates = [IsThumb];
661}
662
663class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
664 list<Predicate> Predicates = [IsThumb, HasV5T];
665}