blob: d60ba5f6070de935af067e33b750060250943551 [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
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 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
145 let Inst{25-27} = 5;
146}
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
152 let Inst{25-27} = 5;
153}
154class ABLXI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
155 list<dag> pattern>
156 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
157 "", pattern> {
158 let Inst{4-7} = 3;
159 let Inst{20-27} = 0x12;
160}
161// FIXME: BX
Evan Chengc5409a82008-09-01 07:19:00 +0000162class AXIx2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
163 list<dag> pattern>
164 : XI<opcod, oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, f, asm,
165 "", pattern>;
Evan Cheng10a9eb82008-09-01 08:25:56 +0000166class ABI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
167 list<dag> pattern>
168 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
169 "", pattern> {
170 let Inst{24} = 0; // L bit
171 let Inst{25-27} = 5;
172}
173class ABccI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
174 string asm, list<dag> pattern>
175 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
176 asm,"",pattern> {
177 let Inst{24} = 0; // L bit
178 let Inst{25-27} = 5;
179}
180
181// BR_JT instructions
182// == mov pc
183class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
184 : XI<opcod, oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BranchMisc,
185 asm, "", pattern> {
186 let Inst{20} = 0; // S Bit
187 let Inst{21-24} = 0xd;
188 let Inst{26-27} = 0;
189}
190// == ldr pc
191class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
192 : XI<opcod, oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BranchMisc,
193 asm, "", pattern> {
194 let Inst{20} = 1; // L bit
195 let Inst{21} = 0; // W bit
196 let Inst{22} = 0; // B bit
197 let Inst{24} = 1; // P bit
198}
199// == add pc
200class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
201 : XI<opcod, oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BranchMisc,
202 asm, "", pattern> {
203 let Inst{20} = 0; // S bit
204 let Inst{21-24} = 4;
205 let Inst{26-27} = 0;
206}
207
Evan Cheng2e62b662008-09-01 01:51:14 +0000208
209// addrmode1 instructions
Evan Cheng7b0249b2008-08-28 23:39:26 +0000210class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
211 string asm, list<dag> pattern>
212 : I<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000213 asm, "", pattern> {
Evan Chengaf8f1282008-08-31 18:32:16 +0000214 let Inst{21-24} = opcod;
215 let Inst{26-27} = 0;
Evan Chengd0750352008-08-29 07:40:52 +0000216}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000217class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
218 string asm, list<dag> pattern>
219 : sI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd0750352008-08-29 07:40:52 +0000220 asm, "", pattern> {
Evan Chengaf8f1282008-08-31 18:32:16 +0000221 let Inst{20} = 1;
222 let Inst{21-24} = opcod;
223 let Inst{26-27} = 0;
Evan Chengd0750352008-08-29 07:40:52 +0000224}
Evan Chengc5409a82008-09-01 07:19:00 +0000225class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
226 list<dag> pattern>
227 : XI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
228 "", pattern> {
229 let Inst{20} = 1;
230 let Inst{21-24} = opcod;
231 let Inst{26-27} = 0;
232}
Evan Cheng2e62b662008-09-01 01:51:14 +0000233class AI1x2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
234 string asm, list<dag> pattern>
235 : I<opcod, oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
236 asm, "", pattern>;
Evan Chengda020022008-08-31 19:02:21 +0000237
Evan Cheng2e62b662008-09-01 01:51:14 +0000238
239// addrmode2 loads and stores
Evan Cheng7b0249b2008-08-28 23:39:26 +0000240class AI2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
241 string asm, list<dag> pattern>
242 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Chengda020022008-08-31 19:02:21 +0000243 asm, "", pattern> {
244 let Inst{26-27} = 1;
245}
Evan Chengc5409a82008-09-01 07:19:00 +0000246class AXI2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
247 list<dag> pattern>
248 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
249 "", pattern>;
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000250
251// loads
Evan Chengda020022008-08-31 19:02:21 +0000252class AI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
253 string asm, list<dag> pattern>
254 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000255 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000256 let Inst{21} = 0; // W bit
257 let Inst{22} = 0; // B bit
258 let Inst{24} = 1; // P bit
259}
Evan Chengae7b1d72008-09-01 07:34:13 +0000260class AXI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
261 list<dag> pattern>
262 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
263 "", pattern> {
264 let Inst{20} = 1; // L bit
265 let Inst{21} = 0; // W bit
266 let Inst{22} = 0; // B bit
267 let Inst{24} = 1; // P bit
268}
Evan Chengda020022008-08-31 19:02:21 +0000269class AI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
270 string asm, list<dag> pattern>
271 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000272 let Inst{20} = 1; // L bit
Evan Chengda020022008-08-31 19:02:21 +0000273 let Inst{21} = 0; // W bit
274 let Inst{22} = 1; // B bit
275 let Inst{24} = 1; // P bit
276}
Evan Chengae7b1d72008-09-01 07:34:13 +0000277class AXI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
278 list<dag> pattern>
279 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
280 "", pattern> {
281 let Inst{20} = 1; // L bit
282 let Inst{21} = 0; // W bit
283 let Inst{22} = 1; // B bit
284 let Inst{24} = 1; // P bit
285}
Evan Chengda020022008-08-31 19:02:21 +0000286
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000287// stores
288class AI2stw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
289 string asm, list<dag> pattern>
290 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000291 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000292 let Inst{21} = 0; // W bit
293 let Inst{22} = 0; // B bit
294 let Inst{24} = 1; // P bit
295}
Evan Chengae7b1d72008-09-01 07:34:13 +0000296class AXI2stw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
297 list<dag> pattern>
298 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
299 "", pattern> {
300 let Inst{20} = 0; // L bit
301 let Inst{21} = 0; // W bit
302 let Inst{22} = 0; // B bit
303 let Inst{24} = 1; // P bit
304}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000305class AI2stb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
306 string asm, list<dag> pattern>
307 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000308 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000309 let Inst{21} = 0; // W bit
310 let Inst{22} = 1; // B bit
311 let Inst{24} = 1; // P bit
312}
Evan Chengae7b1d72008-09-01 07:34:13 +0000313class AXI2stb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
314 list<dag> pattern>
315 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
316 "", pattern> {
317 let Inst{20} = 0; // L bit
318 let Inst{21} = 0; // W bit
319 let Inst{22} = 1; // B bit
320 let Inst{24} = 1; // P bit
321}
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000322
Evan Chengac92c3f2008-09-01 07:00:14 +0000323// Pre-indexed loads
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000324class AI2ldwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000325 string asm, string cstr, list<dag> pattern>
326 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000327 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000328 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000329 let Inst{21} = 1; // W bit
330 let Inst{22} = 0; // B bit
331 let Inst{24} = 1; // P bit
332}
333class AI2ldbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
334 string asm, string cstr, list<dag> pattern>
335 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
336 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000337 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000338 let Inst{21} = 1; // W bit
339 let Inst{22} = 1; // B bit
340 let Inst{24} = 1; // P bit
341}
342
Evan Chengac92c3f2008-09-01 07:00:14 +0000343// Pre-indexed stores
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000344class AI2stwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
345 string asm, string cstr, list<dag> pattern>
346 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
347 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000348 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000349 let Inst{21} = 1; // W bit
350 let Inst{22} = 0; // B bit
351 let Inst{24} = 1; // P bit
352}
353class AI2stbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
354 string asm, string cstr, list<dag> pattern>
355 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
356 asm, cstr, pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000357 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000358 let Inst{21} = 1; // W bit
359 let Inst{22} = 1; // B bit
360 let Inst{24} = 1; // P bit
361}
362
Evan Chengac92c3f2008-09-01 07:00:14 +0000363// Post-indexed loads
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000364class AI2ldwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000365 string asm, string cstr, list<dag> pattern>
366 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000367 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000368 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000369 let Inst{21} = 0; // W bit
370 let Inst{22} = 0; // B bit
371 let Inst{24} = 0; // P bit
372}
373class AI2ldbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
374 string asm, string cstr, list<dag> pattern>
375 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
376 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000377 let Inst{20} = 1; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000378 let Inst{21} = 0; // W bit
379 let Inst{22} = 1; // B bit
380 let Inst{24} = 0; // P bit
381}
382
Evan Chengac92c3f2008-09-01 07:00:14 +0000383// Post-indexed stores
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000384class AI2stwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
385 string asm, string cstr, list<dag> pattern>
386 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
387 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000388 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000389 let Inst{21} = 0; // W bit
390 let Inst{22} = 0; // B bit
391 let Inst{24} = 0; // P bit
392}
393class AI2stbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
394 string asm, string cstr, list<dag> pattern>
395 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
396 asm, cstr,pattern> {
Evan Chengac92c3f2008-09-01 07:00:14 +0000397 let Inst{20} = 0; // L bit
Evan Cheng1a7c1cc2008-09-01 01:27:33 +0000398 let Inst{21} = 0; // W bit
399 let Inst{22} = 1; // B bit
400 let Inst{24} = 0; // P bit
401}
402
Evan Cheng2e62b662008-09-01 01:51:14 +0000403// addrmode3 instructions
404class AI3<bits<4> opcod, dag oops, dag iops, Format f, string opc,
405 string asm, list<dag> pattern>
406 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
407 asm, "", pattern>;
Evan Chengc5409a82008-09-01 07:19:00 +0000408class AXI3<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>;
Evan Cheng2e62b662008-09-01 01:51:14 +0000412
Evan Chengac92c3f2008-09-01 07:00:14 +0000413// loads
414class AI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
415 string asm, list<dag> pattern>
416 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
417 asm, "", pattern> {
418 let Inst{4} = 1;
419 let Inst{5} = 1; // H bit
420 let Inst{6} = 0; // S bit
421 let Inst{7} = 1;
422 let Inst{20} = 1; // L bit
423 let Inst{21} = 0; // W bit
424 let Inst{24} = 1; // P bit
425}
Evan Chengae7b1d72008-09-01 07:34:13 +0000426class AXI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
427 list<dag> pattern>
428 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
429 "", pattern> {
430 let Inst{4} = 1;
431 let Inst{5} = 1; // H bit
432 let Inst{6} = 0; // S bit
433 let Inst{7} = 1;
434 let Inst{20} = 1; // L bit
435 let Inst{21} = 0; // W bit
436 let Inst{24} = 1; // P bit
437}
Evan Chengac92c3f2008-09-01 07:00:14 +0000438class AI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
439 string asm, list<dag> pattern>
440 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
441 asm, "", pattern> {
442 let Inst{4} = 1;
443 let Inst{5} = 1; // H bit
444 let Inst{6} = 1; // S bit
445 let Inst{7} = 1;
446 let Inst{20} = 1; // L bit
447 let Inst{21} = 0; // W bit
448 let Inst{24} = 1; // P bit
449}
Evan Chengae7b1d72008-09-01 07:34:13 +0000450class AXI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
451 list<dag> pattern>
452 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
453 "", pattern> {
454 let Inst{4} = 1;
455 let Inst{5} = 1; // H bit
456 let Inst{6} = 1; // S bit
457 let Inst{7} = 1;
458 let Inst{20} = 1; // L bit
459 let Inst{21} = 0; // W bit
460 let Inst{24} = 1; // P bit
461}
Evan Chengac92c3f2008-09-01 07:00:14 +0000462class AI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
463 string asm, list<dag> pattern>
464 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
465 asm, "", pattern> {
466 let Inst{4} = 1;
467 let Inst{5} = 0; // H bit
468 let Inst{6} = 1; // S bit
469 let Inst{7} = 1;
470 let Inst{20} = 1; // L bit
471 let Inst{21} = 0; // W bit
472 let Inst{24} = 1; // P bit
473}
Evan Chengae7b1d72008-09-01 07:34:13 +0000474class AXI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
475 list<dag> pattern>
476 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
477 "", pattern> {
478 let Inst{4} = 1;
479 let Inst{5} = 0; // H bit
480 let Inst{6} = 1; // S bit
481 let Inst{7} = 1;
482 let Inst{20} = 1; // L bit
483 let Inst{21} = 0; // W bit
484 let Inst{24} = 1; // P bit
485}
Evan Chengac92c3f2008-09-01 07:00:14 +0000486class AI3ldd<bits<4> opcod, dag oops, dag iops, Format f, string opc,
487 string asm, list<dag> pattern>
488 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
489 asm, "", pattern> {
490 let Inst{4} = 1;
491 let Inst{5} = 0; // H bit
492 let Inst{6} = 1; // S bit
493 let Inst{7} = 1;
494 let Inst{20} = 0; // L bit
495 let Inst{21} = 0; // W bit
496 let Inst{24} = 1; // P bit
497}
498
499// stores
500class AI3sth<bits<4> opcod, dag oops, dag iops, Format f, string opc,
501 string asm, list<dag> pattern>
502 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
503 asm, "", pattern> {
504 let Inst{4} = 1;
505 let Inst{5} = 1; // H bit
506 let Inst{6} = 0; // S bit
507 let Inst{7} = 1;
508 let Inst{20} = 0; // L bit
509 let Inst{21} = 0; // W bit
510 let Inst{24} = 1; // P bit
511}
Evan Chengae7b1d72008-09-01 07:34:13 +0000512class AXI3sth<bits<4> opcod, dag oops, dag iops, Format f, string asm,
513 list<dag> pattern>
514 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
515 "", pattern> {
516 let Inst{4} = 1;
517 let Inst{5} = 1; // H bit
518 let Inst{6} = 0; // S bit
519 let Inst{7} = 1;
520 let Inst{20} = 0; // L bit
521 let Inst{21} = 0; // W bit
522 let Inst{24} = 1; // P bit
523}
Evan Chengac92c3f2008-09-01 07:00:14 +0000524class AI3std<bits<4> opcod, dag oops, dag iops, Format f, string opc,
525 string asm, list<dag> pattern>
526 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
527 asm, "", pattern> {
528 let Inst{4} = 1;
529 let Inst{5} = 1; // H bit
530 let Inst{6} = 1; // S bit
531 let Inst{7} = 1;
532 let Inst{20} = 0; // L bit
533 let Inst{21} = 0; // W bit
534 let Inst{24} = 1; // P bit
535}
536
537// Pre-indexed loads
538class AI3ldhpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
539 string asm, string cstr, list<dag> pattern>
540 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
541 asm, cstr, pattern> {
542 let Inst{4} = 1;
543 let Inst{5} = 1; // H bit
544 let Inst{6} = 0; // S bit
545 let Inst{7} = 1;
546 let Inst{20} = 1; // L bit
547 let Inst{21} = 1; // W bit
548 let Inst{24} = 1; // P bit
549}
550class AI3ldshpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
551 string asm, string cstr, list<dag> pattern>
552 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
553 asm, cstr, pattern> {
554 let Inst{4} = 1;
555 let Inst{5} = 1; // H bit
556 let Inst{6} = 1; // S bit
557 let Inst{7} = 1;
558 let Inst{20} = 1; // L bit
559 let Inst{21} = 1; // W bit
560 let Inst{24} = 1; // P bit
561}
562class AI3ldsbpr<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, IndexModePre, f, opc,
565 asm, cstr, pattern> {
566 let Inst{4} = 1;
567 let Inst{5} = 0; // H bit
568 let Inst{6} = 1; // S bit
569 let Inst{7} = 1;
570 let Inst{20} = 1; // L bit
571 let Inst{21} = 1; // W bit
572 let Inst{24} = 1; // P bit
573}
574
575// Pre-indexed stores
576class AI3sthpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
577 string asm, string cstr, list<dag> pattern>
578 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
579 asm, cstr, pattern> {
580 let Inst{4} = 1;
581 let Inst{5} = 1; // H bit
582 let Inst{6} = 0; // S bit
583 let Inst{7} = 1;
584 let Inst{20} = 0; // L bit
585 let Inst{21} = 1; // W bit
586 let Inst{24} = 1; // P bit
587}
588
589// Post-indexed loads
590class AI3ldhpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
591 string asm, string cstr, list<dag> pattern>
592 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
593 asm, cstr,pattern> {
594 let Inst{4} = 1;
595 let Inst{5} = 1; // H bit
596 let Inst{6} = 0; // S bit
597 let Inst{7} = 1;
598 let Inst{20} = 1; // L bit
599 let Inst{21} = 1; // W bit
600 let Inst{24} = 0; // P bit
601}
602class AI3ldshpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
603 string asm, string cstr, list<dag> pattern>
604 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
605 asm, cstr,pattern> {
606 let Inst{4} = 1;
607 let Inst{5} = 1; // H bit
608 let Inst{6} = 1; // S bit
609 let Inst{7} = 1;
610 let Inst{20} = 1; // L bit
611 let Inst{21} = 1; // W bit
612 let Inst{24} = 0; // P bit
613}
614class AI3ldsbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
615 string asm, string cstr, list<dag> pattern>
616 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
617 asm, cstr,pattern> {
618 let Inst{4} = 1;
619 let Inst{5} = 0; // H bit
620 let Inst{6} = 1; // S bit
621 let Inst{7} = 1;
622 let Inst{20} = 1; // L bit
623 let Inst{21} = 1; // W bit
624 let Inst{24} = 0; // P bit
625}
626
627// Post-indexed stores
628class AI3sthpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
629 string asm, string cstr, list<dag> pattern>
630 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
631 asm, cstr,pattern> {
632 let Inst{4} = 1;
633 let Inst{5} = 1; // H bit
634 let Inst{6} = 0; // S bit
635 let Inst{7} = 1;
636 let Inst{20} = 0; // L bit
637 let Inst{21} = 1; // W bit
638 let Inst{24} = 0; // P bit
639}
640
641
Evan Cheng2e62b662008-09-01 01:51:14 +0000642// addrmode4 instructions
643class AI4<bits<4> opcod, dag oops, dag iops, Format f, string opc,
644 string asm, list<dag> pattern>
645 : I<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc,
Evan Chengd36b01c2008-09-01 07:48:18 +0000646 asm, "", pattern> {
647 let Inst{25-27} = 0x4;
648}
649class AXI4ld<bits<4> opcod, dag oops, dag iops, Format f, string asm,
Evan Cheng7b0249b2008-08-28 23:39:26 +0000650 list<dag> pattern>
651 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Chengd36b01c2008-09-01 07:48:18 +0000652 "", pattern> {
653 let Inst{20} = 1; // L bit
654 let Inst{22} = 0; // S bit
655 let Inst{25-27} = 0x4;
656}
657class AXI4ldpc<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} = 1; // L bit
662 let Inst{22} = 1; // S bit
663 let Inst{25-27} = 0x4;
664}
665class AXI4st<bits<4> opcod, dag oops, dag iops, Format f, string asm,
666 list<dag> pattern>
667 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
668 "", pattern> {
669 let Inst{20} = 0; // L bit
670 let Inst{22} = 0; // S bit
671 let Inst{25-27} = 0x4;
672}
Evan Cheng7b0249b2008-08-28 23:39:26 +0000673
Evan Cheng7b0249b2008-08-28 23:39:26 +0000674
Evan Cheng7b0249b2008-08-28 23:39:26 +0000675//===----------------------------------------------------------------------===//
676
677// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
678class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
679 list<Predicate> Predicates = [IsARM];
680}
681class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
682 list<Predicate> Predicates = [IsARM, HasV5TE];
683}
684class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
685 list<Predicate> Predicates = [IsARM, HasV6];
686}
Evan Cheng34a46e12008-08-29 06:41:12 +0000687
688//===----------------------------------------------------------------------===//
689//
690// Thumb Instruction Format Definitions.
691//
692
693
694// TI - Thumb instruction.
695
696class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
697 string asm, string cstr, list<dag> pattern>
698 // FIXME: Set all opcodes to 0 for now.
699 : InstARM<0, am, sz, IndexModeNone, ThumbFrm, cstr> {
700 let OutOperandList = outs;
701 let InOperandList = ins;
702 let AsmString = asm;
703 let Pattern = pattern;
704 list<Predicate> Predicates = [IsThumb];
705}
706
707class TI<dag outs, dag ins, string asm, list<dag> pattern>
708 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
709class TI1<dag outs, dag ins, string asm, list<dag> pattern>
710 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
711class TI2<dag outs, dag ins, string asm, list<dag> pattern>
712 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
713class TI4<dag outs, dag ins, string asm, list<dag> pattern>
714 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
715class TIs<dag outs, dag ins, string asm, list<dag> pattern>
716 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
717
718// Two-address instructions
719class TIt<dag outs, dag ins, string asm, list<dag> pattern>
720 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
721
722// BL, BLX(1) are translated by assembler into two instructions
723class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
724 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
725
726// BR_JT instructions
727class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
728 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
729
730
731//===----------------------------------------------------------------------===//
732
733
734// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
735class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
736 list<Predicate> Predicates = [IsThumb];
737}
738
739class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
740 list<Predicate> Predicates = [IsThumb, HasV5T];
741}