blob: eae947e48134e452d27cf2f4f0f7438b3907b2a2 [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
Evan Cheng05fc9662008-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 Cheng37f25d92008-08-28 23:39:26 +000044
Evan Cheng05fc9662008-09-13 01:35:33 +000045def LdFrm : Format<22>;
46def StFrm : Format<23>;
Evan Cheng37f25d92008-08-28 23:39:26 +000047
Evan Cheng05fc9662008-09-13 01:35:33 +000048def ArithMisc : Format<24>;
49def ThumbFrm : Format<25>;
50def VFPFrm : Format<26>;
Evan Cheng37f25d92008-08-28 23:39:26 +000051
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>;
Evan Cheng3aac7882008-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 Cheng4bbd5f82008-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 Cheng3aac7882008-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 Cheng0d14fc82008-09-01 01:51:14 +0000208
209// addrmode1 instructions
Evan Cheng37f25d92008-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 Cheng612b79e2008-08-29 07:40:52 +0000213 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000214 let Inst{21-24} = opcod;
215 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000216}
Evan Cheng37f25d92008-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 Cheng612b79e2008-08-29 07:40:52 +0000220 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000221 let Inst{21-24} = opcod;
222 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000223}
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000224class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
225 list<dag> pattern>
226 : XI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
227 "", pattern> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000228 let Inst{21-24} = opcod;
229 let Inst{26-27} = 0;
230}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000231class AI1x2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
232 string asm, list<dag> pattern>
233 : I<opcod, oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
234 asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000235
Evan Cheng0d14fc82008-09-01 01:51:14 +0000236
237// addrmode2 loads and stores
Evan Cheng37f25d92008-08-28 23:39:26 +0000238class AI2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
239 string asm, list<dag> pattern>
240 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng17222df2008-08-31 19:02:21 +0000241 asm, "", pattern> {
242 let Inst{26-27} = 1;
243}
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000244class AXI2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
245 list<dag> pattern>
246 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
247 "", pattern>;
Evan Cheng93912732008-09-01 01:27:33 +0000248
249// loads
Evan Cheng17222df2008-08-31 19:02:21 +0000250class AI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
251 string asm, list<dag> pattern>
252 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000253 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000254 let Inst{21} = 0; // W bit
255 let Inst{22} = 0; // B bit
256 let Inst{24} = 1; // P bit
257}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000258class AXI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
259 list<dag> pattern>
260 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
261 "", pattern> {
262 let Inst{20} = 1; // L bit
263 let Inst{21} = 0; // W bit
264 let Inst{22} = 0; // B bit
265 let Inst{24} = 1; // P bit
266}
Evan Cheng17222df2008-08-31 19:02:21 +0000267class AI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
268 string asm, list<dag> pattern>
269 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000270 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000271 let Inst{21} = 0; // W bit
272 let Inst{22} = 1; // B bit
273 let Inst{24} = 1; // P bit
274}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000275class AXI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
276 list<dag> pattern>
277 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
278 "", pattern> {
279 let Inst{20} = 1; // L bit
280 let Inst{21} = 0; // W bit
281 let Inst{22} = 1; // B bit
282 let Inst{24} = 1; // P bit
283}
Evan Cheng17222df2008-08-31 19:02:21 +0000284
Evan Cheng93912732008-09-01 01:27:33 +0000285// stores
286class AI2stw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
287 string asm, list<dag> pattern>
288 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000289 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000290 let Inst{21} = 0; // W bit
291 let Inst{22} = 0; // B bit
292 let Inst{24} = 1; // P bit
293}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000294class AXI2stw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
295 list<dag> pattern>
296 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
297 "", pattern> {
298 let Inst{20} = 0; // L bit
299 let Inst{21} = 0; // W bit
300 let Inst{22} = 0; // B bit
301 let Inst{24} = 1; // P bit
302}
Evan Cheng93912732008-09-01 01:27:33 +0000303class AI2stb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
304 string asm, list<dag> pattern>
305 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000306 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000307 let Inst{21} = 0; // W bit
308 let Inst{22} = 1; // B bit
309 let Inst{24} = 1; // P bit
310}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000311class AXI2stb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
312 list<dag> pattern>
313 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
314 "", pattern> {
315 let Inst{20} = 0; // L bit
316 let Inst{21} = 0; // W bit
317 let Inst{22} = 1; // B bit
318 let Inst{24} = 1; // P bit
319}
Evan Cheng93912732008-09-01 01:27:33 +0000320
Evan Cheng840917b2008-09-01 07:00:14 +0000321// Pre-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000322class AI2ldwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000323 string asm, string cstr, list<dag> pattern>
324 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000325 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000326 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000327 let Inst{21} = 1; // W bit
328 let Inst{22} = 0; // B bit
329 let Inst{24} = 1; // P bit
330}
331class AI2ldbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
332 string asm, string cstr, list<dag> pattern>
333 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
334 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000335 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000336 let Inst{21} = 1; // W bit
337 let Inst{22} = 1; // B bit
338 let Inst{24} = 1; // P bit
339}
340
Evan Cheng840917b2008-09-01 07:00:14 +0000341// Pre-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000342class AI2stwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
343 string asm, string cstr, list<dag> pattern>
344 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
345 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000346 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000347 let Inst{21} = 1; // W bit
348 let Inst{22} = 0; // B bit
349 let Inst{24} = 1; // P bit
350}
351class AI2stbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
352 string asm, string cstr, list<dag> pattern>
353 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
354 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000355 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000356 let Inst{21} = 1; // W bit
357 let Inst{22} = 1; // B bit
358 let Inst{24} = 1; // P bit
359}
360
Evan Cheng840917b2008-09-01 07:00:14 +0000361// Post-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000362class AI2ldwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000363 string asm, string cstr, list<dag> pattern>
364 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000365 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000366 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000367 let Inst{21} = 0; // W bit
368 let Inst{22} = 0; // B bit
369 let Inst{24} = 0; // P bit
370}
371class AI2ldbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
372 string asm, string cstr, list<dag> pattern>
373 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
374 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000375 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000376 let Inst{21} = 0; // W bit
377 let Inst{22} = 1; // B bit
378 let Inst{24} = 0; // P bit
379}
380
Evan Cheng840917b2008-09-01 07:00:14 +0000381// Post-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000382class AI2stwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
383 string asm, string cstr, list<dag> pattern>
384 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
385 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000386 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000387 let Inst{21} = 0; // W bit
388 let Inst{22} = 0; // B bit
389 let Inst{24} = 0; // P bit
390}
391class AI2stbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
392 string asm, string cstr, list<dag> pattern>
393 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
394 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000395 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000396 let Inst{21} = 0; // W bit
397 let Inst{22} = 1; // B bit
398 let Inst{24} = 0; // P bit
399}
400
Evan Cheng0d14fc82008-09-01 01:51:14 +0000401// addrmode3 instructions
402class AI3<bits<4> opcod, dag oops, dag iops, Format f, string opc,
403 string asm, list<dag> pattern>
404 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
405 asm, "", pattern>;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000406class AXI3<bits<4> opcod, dag oops, dag iops, Format f, string asm,
407 list<dag> pattern>
408 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
409 "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000410
Evan Cheng840917b2008-09-01 07:00:14 +0000411// loads
412class AI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
413 string asm, list<dag> pattern>
414 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
415 asm, "", pattern> {
416 let Inst{4} = 1;
417 let Inst{5} = 1; // H bit
418 let Inst{6} = 0; // S bit
419 let Inst{7} = 1;
420 let Inst{20} = 1; // L bit
421 let Inst{21} = 0; // W bit
422 let Inst{24} = 1; // P bit
423}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000424class AXI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
425 list<dag> pattern>
426 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
427 "", pattern> {
428 let Inst{4} = 1;
429 let Inst{5} = 1; // H bit
430 let Inst{6} = 0; // S bit
431 let Inst{7} = 1;
432 let Inst{20} = 1; // L bit
433 let Inst{21} = 0; // W bit
434 let Inst{24} = 1; // P bit
435}
Evan Cheng840917b2008-09-01 07:00:14 +0000436class AI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
437 string asm, list<dag> pattern>
438 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
439 asm, "", pattern> {
440 let Inst{4} = 1;
441 let Inst{5} = 1; // H bit
442 let Inst{6} = 1; // S bit
443 let Inst{7} = 1;
444 let Inst{20} = 1; // L bit
445 let Inst{21} = 0; // W bit
446 let Inst{24} = 1; // P bit
447}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000448class AXI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
449 list<dag> pattern>
450 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
451 "", pattern> {
452 let Inst{4} = 1;
453 let Inst{5} = 1; // H bit
454 let Inst{6} = 1; // S bit
455 let Inst{7} = 1;
456 let Inst{20} = 1; // L bit
457 let Inst{21} = 0; // W bit
458 let Inst{24} = 1; // P bit
459}
Evan Cheng840917b2008-09-01 07:00:14 +0000460class AI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
461 string asm, list<dag> pattern>
462 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
463 asm, "", pattern> {
464 let Inst{4} = 1;
465 let Inst{5} = 0; // H bit
466 let Inst{6} = 1; // S bit
467 let Inst{7} = 1;
468 let Inst{20} = 1; // L bit
469 let Inst{21} = 0; // W bit
470 let Inst{24} = 1; // P bit
471}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000472class AXI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
473 list<dag> pattern>
474 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
475 "", pattern> {
476 let Inst{4} = 1;
477 let Inst{5} = 0; // H bit
478 let Inst{6} = 1; // S bit
479 let Inst{7} = 1;
480 let Inst{20} = 1; // L bit
481 let Inst{21} = 0; // W bit
482 let Inst{24} = 1; // P bit
483}
Evan Cheng840917b2008-09-01 07:00:14 +0000484class AI3ldd<bits<4> opcod, dag oops, dag iops, Format f, string opc,
485 string asm, list<dag> pattern>
486 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
487 asm, "", pattern> {
488 let Inst{4} = 1;
489 let Inst{5} = 0; // H bit
490 let Inst{6} = 1; // S bit
491 let Inst{7} = 1;
492 let Inst{20} = 0; // L bit
493 let Inst{21} = 0; // W bit
494 let Inst{24} = 1; // P bit
495}
496
497// stores
498class AI3sth<bits<4> opcod, dag oops, dag iops, Format f, string opc,
499 string asm, list<dag> pattern>
500 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
501 asm, "", pattern> {
502 let Inst{4} = 1;
503 let Inst{5} = 1; // H bit
504 let Inst{6} = 0; // S bit
505 let Inst{7} = 1;
506 let Inst{20} = 0; // L bit
507 let Inst{21} = 0; // W bit
508 let Inst{24} = 1; // P bit
509}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000510class AXI3sth<bits<4> opcod, dag oops, dag iops, Format f, string asm,
511 list<dag> pattern>
512 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
513 "", 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} = 0; // W bit
520 let Inst{24} = 1; // P bit
521}
Evan Cheng840917b2008-09-01 07:00:14 +0000522class AI3std<bits<4> opcod, dag oops, dag iops, Format f, string opc,
523 string asm, list<dag> pattern>
524 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
525 asm, "", pattern> {
526 let Inst{4} = 1;
527 let Inst{5} = 1; // H bit
528 let Inst{6} = 1; // S bit
529 let Inst{7} = 1;
530 let Inst{20} = 0; // L bit
531 let Inst{21} = 0; // W bit
532 let Inst{24} = 1; // P bit
533}
534
535// Pre-indexed loads
536class AI3ldhpr<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, IndexModePre, f, opc,
539 asm, cstr, pattern> {
540 let Inst{4} = 1;
541 let Inst{5} = 1; // H bit
542 let Inst{6} = 0; // 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} = 1; // P bit
547}
548class AI3ldshpr<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, IndexModePre, f, opc,
551 asm, cstr, pattern> {
552 let Inst{4} = 1;
553 let Inst{5} = 1; // 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} = 1; // P bit
559}
560class AI3ldsbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
561 string asm, string cstr, list<dag> pattern>
562 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
563 asm, cstr, pattern> {
564 let Inst{4} = 1;
565 let Inst{5} = 0; // H bit
566 let Inst{6} = 1; // S bit
567 let Inst{7} = 1;
568 let Inst{20} = 1; // L bit
569 let Inst{21} = 1; // W bit
570 let Inst{24} = 1; // P bit
571}
572
573// Pre-indexed stores
574class AI3sthpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
575 string asm, string cstr, list<dag> pattern>
576 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
577 asm, cstr, pattern> {
578 let Inst{4} = 1;
579 let Inst{5} = 1; // H bit
580 let Inst{6} = 0; // S bit
581 let Inst{7} = 1;
582 let Inst{20} = 0; // L bit
583 let Inst{21} = 1; // W bit
584 let Inst{24} = 1; // P bit
585}
586
587// Post-indexed loads
588class AI3ldhpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
589 string asm, string cstr, list<dag> pattern>
590 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
591 asm, cstr,pattern> {
592 let Inst{4} = 1;
593 let Inst{5} = 1; // H bit
594 let Inst{6} = 0; // S bit
595 let Inst{7} = 1;
596 let Inst{20} = 1; // L bit
597 let Inst{21} = 1; // W bit
598 let Inst{24} = 0; // P bit
599}
600class AI3ldshpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
601 string asm, string cstr, list<dag> pattern>
602 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
603 asm, cstr,pattern> {
604 let Inst{4} = 1;
605 let Inst{5} = 1; // H bit
606 let Inst{6} = 1; // S bit
607 let Inst{7} = 1;
608 let Inst{20} = 1; // L bit
609 let Inst{21} = 1; // W bit
610 let Inst{24} = 0; // P bit
611}
612class AI3ldsbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
613 string asm, string cstr, list<dag> pattern>
614 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
615 asm, cstr,pattern> {
616 let Inst{4} = 1;
617 let Inst{5} = 0; // H bit
618 let Inst{6} = 1; // S bit
619 let Inst{7} = 1;
620 let Inst{20} = 1; // L bit
621 let Inst{21} = 1; // W bit
622 let Inst{24} = 0; // P bit
623}
624
625// Post-indexed stores
626class AI3sthpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
627 string asm, string cstr, list<dag> pattern>
628 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
629 asm, cstr,pattern> {
630 let Inst{4} = 1;
631 let Inst{5} = 1; // H bit
632 let Inst{6} = 0; // S bit
633 let Inst{7} = 1;
634 let Inst{20} = 0; // L bit
635 let Inst{21} = 1; // W bit
636 let Inst{24} = 0; // P bit
637}
638
639
Evan Cheng0d14fc82008-09-01 01:51:14 +0000640// addrmode4 instructions
641class AI4<bits<4> opcod, dag oops, dag iops, Format f, string opc,
642 string asm, list<dag> pattern>
643 : I<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng3c2ee492008-09-01 07:48:18 +0000644 asm, "", pattern> {
645 let Inst{25-27} = 0x4;
646}
647class AXI4ld<bits<4> opcod, dag oops, dag iops, Format f, string asm,
Evan Cheng37f25d92008-08-28 23:39:26 +0000648 list<dag> pattern>
649 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Cheng3c2ee492008-09-01 07:48:18 +0000650 "", pattern> {
651 let Inst{20} = 1; // L bit
652 let Inst{22} = 0; // S bit
653 let Inst{25-27} = 0x4;
654}
655class AXI4ldpc<bits<4> opcod, dag oops, dag iops, Format f, string asm,
656 list<dag> pattern>
657 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
658 "", pattern> {
659 let Inst{20} = 1; // L bit
660 let Inst{22} = 1; // S bit
661 let Inst{25-27} = 0x4;
662}
663class AXI4st<bits<4> opcod, dag oops, dag iops, Format f, string asm,
664 list<dag> pattern>
665 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
666 "", pattern> {
667 let Inst{20} = 0; // L bit
668 let Inst{22} = 0; // S bit
669 let Inst{25-27} = 0x4;
670}
Evan Cheng37f25d92008-08-28 23:39:26 +0000671
Evan Cheng37f25d92008-08-28 23:39:26 +0000672
Evan Cheng37f25d92008-08-28 23:39:26 +0000673//===----------------------------------------------------------------------===//
674
675// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
676class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
677 list<Predicate> Predicates = [IsARM];
678}
679class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
680 list<Predicate> Predicates = [IsARM, HasV5TE];
681}
682class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
683 list<Predicate> Predicates = [IsARM, HasV6];
684}
Evan Cheng13096642008-08-29 06:41:12 +0000685
686//===----------------------------------------------------------------------===//
687//
688// Thumb Instruction Format Definitions.
689//
690
691
692// TI - Thumb instruction.
693
694class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
695 string asm, string cstr, list<dag> pattern>
696 // FIXME: Set all opcodes to 0 for now.
697 : InstARM<0, am, sz, IndexModeNone, ThumbFrm, cstr> {
698 let OutOperandList = outs;
699 let InOperandList = ins;
700 let AsmString = asm;
701 let Pattern = pattern;
702 list<Predicate> Predicates = [IsThumb];
703}
704
705class TI<dag outs, dag ins, string asm, list<dag> pattern>
706 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
707class TI1<dag outs, dag ins, string asm, list<dag> pattern>
708 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
709class TI2<dag outs, dag ins, string asm, list<dag> pattern>
710 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
711class TI4<dag outs, dag ins, string asm, list<dag> pattern>
712 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
713class TIs<dag outs, dag ins, string asm, list<dag> pattern>
714 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
715
716// Two-address instructions
717class TIt<dag outs, dag ins, string asm, list<dag> pattern>
718 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
719
720// BL, BLX(1) are translated by assembler into two instructions
721class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
722 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
723
724// BR_JT instructions
725class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
726 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
727
728
729//===----------------------------------------------------------------------===//
730
731
732// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
733class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
734 list<Predicate> Predicates = [IsThumb];
735}
736
737class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
738 list<Predicate> Predicates = [IsThumb, HasV5T];
739}