blob: 4bf295a6fca0638e30c4e81f019713f260f15a79 [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 Chenga964b7d2008-09-12 23:15:39 +000031def UnaryFrm : Format<9>;
32def BinaryFrm : Format<10>;
Evan Cheng37f25d92008-08-28 23:39:26 +000033
Evan Chenga964b7d2008-09-12 23:15:39 +000034def LdFrm : Format<11>;
35def StFrm : Format<12>;
Evan Cheng37f25d92008-08-28 23:39:26 +000036
Evan Chenga964b7d2008-09-12 23:15:39 +000037def ArithMisc : Format<13>;
38def ThumbFrm : Format<14>;
39def VFPFrm : Format<15>;
Evan Cheng37f25d92008-08-28 23:39:26 +000040
41
Evan Cheng37f25d92008-08-28 23:39:26 +000042//===----------------------------------------------------------------------===//
43
44// ARM Instruction templates.
45//
46
47class InstARM<bits<4> opcod, AddrMode am, SizeFlagVal sz, IndexMode im,
48 Format f, string cstr>
49 : Instruction {
Evan Cheng612b79e2008-08-29 07:40:52 +000050 field bits<32> Inst;
51
Evan Cheng37f25d92008-08-28 23:39:26 +000052 let Namespace = "ARM";
53
54 bits<4> Opcode = opcod;
55 AddrMode AM = am;
56 bits<4> AddrModeBits = AM.Value;
57
58 SizeFlagVal SZ = sz;
59 bits<3> SizeFlag = SZ.Value;
60
61 IndexMode IM = im;
62 bits<2> IndexModeBits = IM.Value;
63
64 Format F = f;
65 bits<5> Form = F.Value;
66
67 let Constraints = cstr;
68}
69
70class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
71 : InstARM<0, AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
72 let OutOperandList = oops;
73 let InOperandList = iops;
74 let AsmString = asm;
75 let Pattern = pattern;
76}
77
78// Almost all ARM instructions are predicable.
79class I<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
80 IndexMode im, Format f, string opc, string asm, string cstr,
81 list<dag> pattern>
82 : InstARM<opcod, am, sz, im, f, cstr> {
83 let OutOperandList = oops;
84 let InOperandList = !con(iops, (ops pred:$p));
85 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
86 let Pattern = pattern;
87 list<Predicate> Predicates = [IsARM];
88}
89
90// Same as I except it can optionally modify CPSR. Note it's modeled as
91// an input operand since by default it's a zero register. It will
92// become an implicit def once it's "flipped".
93class sI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
94 IndexMode im, Format f, string opc, string asm, string cstr,
95 list<dag> pattern>
96 : InstARM<opcod, am, sz, im, f, cstr> {
97 let OutOperandList = oops;
98 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
99 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
100 let Pattern = pattern;
101 list<Predicate> Predicates = [IsARM];
102}
103
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000104// Special cases
105class XI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
106 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
107 : InstARM<opcod, am, sz, im, f, cstr> {
108 let OutOperandList = oops;
109 let InOperandList = iops;
110 let AsmString = asm;
111 let Pattern = pattern;
112 list<Predicate> Predicates = [IsARM];
113}
114
Evan Cheng37f25d92008-08-28 23:39:26 +0000115class AI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
116 string asm, list<dag> pattern>
117 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
118 asm,"",pattern>;
119class AsI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
120 string asm, list<dag> pattern>
121 : sI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
122 asm,"",pattern>;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000123class AXI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
124 list<dag> pattern>
125 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
126 "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000127
128// Ctrl flow instructions
129class ABLpredI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
130 string asm, list<dag> pattern>
131 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
132 asm,"",pattern> {
133 let Inst{24} = 1; // L bit
134 let Inst{25-27} = 5;
135}
136class ABLI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
137 list<dag> pattern>
138 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
139 "", pattern> {
140 let Inst{24} = 1; // L bit
141 let Inst{25-27} = 5;
142}
143class ABLXI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
144 list<dag> pattern>
145 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
146 "", pattern> {
147 let Inst{4-7} = 3;
148 let Inst{20-27} = 0x12;
149}
150// FIXME: BX
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000151class AXIx2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
152 list<dag> pattern>
153 : XI<opcod, oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, f, asm,
154 "", pattern>;
Evan Cheng3aac7882008-09-01 08:25:56 +0000155class ABI<bits<4> opcod, dag oops, dag iops, Format f, string asm,
156 list<dag> pattern>
157 : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
158 "", pattern> {
159 let Inst{24} = 0; // L bit
160 let Inst{25-27} = 5;
161}
162class ABccI<bits<4> opcod, dag oops, dag iops, Format f, string opc,
163 string asm, list<dag> pattern>
164 : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
165 asm,"",pattern> {
166 let Inst{24} = 0; // L bit
167 let Inst{25-27} = 5;
168}
169
170// BR_JT instructions
171// == mov pc
172class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
173 : XI<opcod, oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BranchMisc,
174 asm, "", pattern> {
175 let Inst{20} = 0; // S Bit
176 let Inst{21-24} = 0xd;
177 let Inst{26-27} = 0;
178}
179// == ldr pc
180class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
181 : XI<opcod, oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BranchMisc,
182 asm, "", pattern> {
183 let Inst{20} = 1; // L bit
184 let Inst{21} = 0; // W bit
185 let Inst{22} = 0; // B bit
186 let Inst{24} = 1; // P bit
187}
188// == add pc
189class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
190 : XI<opcod, oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BranchMisc,
191 asm, "", pattern> {
192 let Inst{20} = 0; // S bit
193 let Inst{21-24} = 4;
194 let Inst{26-27} = 0;
195}
196
Evan Cheng0d14fc82008-09-01 01:51:14 +0000197
198// addrmode1 instructions
Evan Cheng37f25d92008-08-28 23:39:26 +0000199class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
200 string asm, list<dag> pattern>
201 : I<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng612b79e2008-08-29 07:40:52 +0000202 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000203 let Inst{21-24} = opcod;
204 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000205}
Evan Cheng37f25d92008-08-28 23:39:26 +0000206class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
207 string asm, list<dag> pattern>
208 : sI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng612b79e2008-08-29 07:40:52 +0000209 asm, "", pattern> {
Evan Chengb7880ac2008-08-31 18:32:16 +0000210 let Inst{21-24} = opcod;
211 let Inst{26-27} = 0;
Evan Cheng612b79e2008-08-29 07:40:52 +0000212}
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000213class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
214 list<dag> pattern>
215 : XI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
216 "", pattern> {
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000217 let Inst{21-24} = opcod;
218 let Inst{26-27} = 0;
219}
Evan Cheng0d14fc82008-09-01 01:51:14 +0000220class AI1x2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
221 string asm, list<dag> pattern>
222 : I<opcod, oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
223 asm, "", pattern>;
Evan Cheng17222df2008-08-31 19:02:21 +0000224
Evan Cheng0d14fc82008-09-01 01:51:14 +0000225
226// addrmode2 loads and stores
Evan Cheng37f25d92008-08-28 23:39:26 +0000227class AI2<bits<4> opcod, dag oops, dag iops, Format f, string opc,
228 string asm, list<dag> pattern>
229 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng17222df2008-08-31 19:02:21 +0000230 asm, "", pattern> {
231 let Inst{26-27} = 1;
232}
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000233class AXI2<bits<4> opcod, dag oops, dag iops, Format f, string asm,
234 list<dag> pattern>
235 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
236 "", pattern>;
Evan Cheng93912732008-09-01 01:27:33 +0000237
238// loads
Evan Cheng17222df2008-08-31 19:02:21 +0000239class AI2ldw<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} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000243 let Inst{21} = 0; // W bit
244 let Inst{22} = 0; // B bit
245 let Inst{24} = 1; // P bit
246}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000247class AXI2ldw<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} = 1; // L bit
252 let Inst{21} = 0; // W bit
253 let Inst{22} = 0; // B bit
254 let Inst{24} = 1; // P bit
255}
Evan Cheng17222df2008-08-31 19:02:21 +0000256class AI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
257 string asm, list<dag> pattern>
258 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000259 let Inst{20} = 1; // L bit
Evan Cheng17222df2008-08-31 19:02:21 +0000260 let Inst{21} = 0; // W bit
261 let Inst{22} = 1; // B bit
262 let Inst{24} = 1; // P bit
263}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000264class AXI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
265 list<dag> pattern>
266 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
267 "", pattern> {
268 let Inst{20} = 1; // L bit
269 let Inst{21} = 0; // W bit
270 let Inst{22} = 1; // B bit
271 let Inst{24} = 1; // P bit
272}
Evan Cheng17222df2008-08-31 19:02:21 +0000273
Evan Cheng93912732008-09-01 01:27:33 +0000274// stores
275class AI2stw<bits<4> opcod, dag oops, dag iops, Format f, string opc,
276 string asm, list<dag> pattern>
277 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000278 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000279 let Inst{21} = 0; // W bit
280 let Inst{22} = 0; // B bit
281 let Inst{24} = 1; // P bit
282}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000283class AXI2stw<bits<4> opcod, dag oops, dag iops, Format f, string asm,
284 list<dag> pattern>
285 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
286 "", pattern> {
287 let Inst{20} = 0; // L bit
288 let Inst{21} = 0; // W bit
289 let Inst{22} = 0; // B bit
290 let Inst{24} = 1; // P bit
291}
Evan Cheng93912732008-09-01 01:27:33 +0000292class AI2stb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
293 string asm, list<dag> pattern>
294 : AI2<opcod, oops, iops, f, opc, asm, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000295 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000296 let Inst{21} = 0; // W bit
297 let Inst{22} = 1; // B bit
298 let Inst{24} = 1; // P bit
299}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000300class AXI2stb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
301 list<dag> pattern>
302 : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, asm,
303 "", pattern> {
304 let Inst{20} = 0; // L bit
305 let Inst{21} = 0; // W bit
306 let Inst{22} = 1; // B bit
307 let Inst{24} = 1; // P bit
308}
Evan Cheng93912732008-09-01 01:27:33 +0000309
Evan Cheng840917b2008-09-01 07:00:14 +0000310// Pre-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000311class AI2ldwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000312 string asm, string cstr, list<dag> pattern>
313 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000314 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000315 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000316 let Inst{21} = 1; // W bit
317 let Inst{22} = 0; // B bit
318 let Inst{24} = 1; // P bit
319}
320class AI2ldbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
321 string asm, string cstr, list<dag> pattern>
322 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
323 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000324 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000325 let Inst{21} = 1; // W bit
326 let Inst{22} = 1; // B bit
327 let Inst{24} = 1; // P bit
328}
329
Evan Cheng840917b2008-09-01 07:00:14 +0000330// Pre-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000331class AI2stwpr<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} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000336 let Inst{21} = 1; // W bit
337 let Inst{22} = 0; // B bit
338 let Inst{24} = 1; // P bit
339}
340class AI2stbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
341 string asm, string cstr, list<dag> pattern>
342 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
343 asm, cstr, pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000344 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000345 let Inst{21} = 1; // W bit
346 let Inst{22} = 1; // B bit
347 let Inst{24} = 1; // P bit
348}
349
Evan Cheng840917b2008-09-01 07:00:14 +0000350// Post-indexed loads
Evan Cheng93912732008-09-01 01:27:33 +0000351class AI2ldwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
Evan Cheng37f25d92008-08-28 23:39:26 +0000352 string asm, string cstr, list<dag> pattern>
353 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
Evan Cheng93912732008-09-01 01:27:33 +0000354 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000355 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000356 let Inst{21} = 0; // W bit
357 let Inst{22} = 0; // B bit
358 let Inst{24} = 0; // P bit
359}
360class AI2ldbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
361 string asm, string cstr, list<dag> pattern>
362 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
363 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000364 let Inst{20} = 1; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000365 let Inst{21} = 0; // W bit
366 let Inst{22} = 1; // B bit
367 let Inst{24} = 0; // P bit
368}
369
Evan Cheng840917b2008-09-01 07:00:14 +0000370// Post-indexed stores
Evan Cheng93912732008-09-01 01:27:33 +0000371class AI2stwpo<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} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000376 let Inst{21} = 0; // W bit
377 let Inst{22} = 0; // B bit
378 let Inst{24} = 0; // P bit
379}
380class AI2stbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
381 string asm, string cstr, list<dag> pattern>
382 : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
383 asm, cstr,pattern> {
Evan Cheng840917b2008-09-01 07:00:14 +0000384 let Inst{20} = 0; // L bit
Evan Cheng93912732008-09-01 01:27:33 +0000385 let Inst{21} = 0; // W bit
386 let Inst{22} = 1; // B bit
387 let Inst{24} = 0; // P bit
388}
389
Evan Cheng0d14fc82008-09-01 01:51:14 +0000390// addrmode3 instructions
391class AI3<bits<4> opcod, dag oops, dag iops, Format f, string opc,
392 string asm, list<dag> pattern>
393 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
394 asm, "", pattern>;
Evan Cheng4bbd5f82008-09-01 07:19:00 +0000395class AXI3<bits<4> opcod, dag oops, dag iops, Format f, string asm,
396 list<dag> pattern>
397 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
398 "", pattern>;
Evan Cheng0d14fc82008-09-01 01:51:14 +0000399
Evan Cheng840917b2008-09-01 07:00:14 +0000400// loads
401class AI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
402 string asm, list<dag> pattern>
403 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
404 asm, "", pattern> {
405 let Inst{4} = 1;
406 let Inst{5} = 1; // H bit
407 let Inst{6} = 0; // S bit
408 let Inst{7} = 1;
409 let Inst{20} = 1; // L bit
410 let Inst{21} = 0; // W bit
411 let Inst{24} = 1; // P bit
412}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000413class AXI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
414 list<dag> pattern>
415 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
416 "", pattern> {
417 let Inst{4} = 1;
418 let Inst{5} = 1; // H bit
419 let Inst{6} = 0; // S bit
420 let Inst{7} = 1;
421 let Inst{20} = 1; // L bit
422 let Inst{21} = 0; // W bit
423 let Inst{24} = 1; // P bit
424}
Evan Cheng840917b2008-09-01 07:00:14 +0000425class AI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string opc,
426 string asm, list<dag> pattern>
427 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
428 asm, "", pattern> {
429 let Inst{4} = 1;
430 let Inst{5} = 1; // H bit
431 let Inst{6} = 1; // S bit
432 let Inst{7} = 1;
433 let Inst{20} = 1; // L bit
434 let Inst{21} = 0; // W bit
435 let Inst{24} = 1; // P bit
436}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000437class AXI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string asm,
438 list<dag> pattern>
439 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
440 "", pattern> {
441 let Inst{4} = 1;
442 let Inst{5} = 1; // H bit
443 let Inst{6} = 1; // S bit
444 let Inst{7} = 1;
445 let Inst{20} = 1; // L bit
446 let Inst{21} = 0; // W bit
447 let Inst{24} = 1; // P bit
448}
Evan Cheng840917b2008-09-01 07:00:14 +0000449class AI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string opc,
450 string asm, list<dag> pattern>
451 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
452 asm, "", pattern> {
453 let Inst{4} = 1;
454 let Inst{5} = 0; // H bit
455 let Inst{6} = 1; // S bit
456 let Inst{7} = 1;
457 let Inst{20} = 1; // L bit
458 let Inst{21} = 0; // W bit
459 let Inst{24} = 1; // P bit
460}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000461class AXI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string asm,
462 list<dag> pattern>
463 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
464 "", pattern> {
465 let Inst{4} = 1;
466 let Inst{5} = 0; // H bit
467 let Inst{6} = 1; // S bit
468 let Inst{7} = 1;
469 let Inst{20} = 1; // L bit
470 let Inst{21} = 0; // W bit
471 let Inst{24} = 1; // P bit
472}
Evan Cheng840917b2008-09-01 07:00:14 +0000473class AI3ldd<bits<4> opcod, dag oops, dag iops, Format f, string opc,
474 string asm, list<dag> pattern>
475 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
476 asm, "", pattern> {
477 let Inst{4} = 1;
478 let Inst{5} = 0; // H bit
479 let Inst{6} = 1; // S bit
480 let Inst{7} = 1;
481 let Inst{20} = 0; // L bit
482 let Inst{21} = 0; // W bit
483 let Inst{24} = 1; // P bit
484}
485
486// stores
487class AI3sth<bits<4> opcod, dag oops, dag iops, Format f, string opc,
488 string asm, list<dag> pattern>
489 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
490 asm, "", pattern> {
491 let Inst{4} = 1;
492 let Inst{5} = 1; // H bit
493 let Inst{6} = 0; // S bit
494 let Inst{7} = 1;
495 let Inst{20} = 0; // L bit
496 let Inst{21} = 0; // W bit
497 let Inst{24} = 1; // P bit
498}
Evan Cheng5d2c1cf2008-09-01 07:34:13 +0000499class AXI3sth<bits<4> opcod, dag oops, dag iops, Format f, string asm,
500 list<dag> pattern>
501 : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
502 "", pattern> {
503 let Inst{4} = 1;
504 let Inst{5} = 1; // H bit
505 let Inst{6} = 0; // S bit
506 let Inst{7} = 1;
507 let Inst{20} = 0; // L bit
508 let Inst{21} = 0; // W bit
509 let Inst{24} = 1; // P bit
510}
Evan Cheng840917b2008-09-01 07:00:14 +0000511class AI3std<bits<4> opcod, dag oops, dag iops, Format f, string opc,
512 string asm, list<dag> pattern>
513 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
514 asm, "", pattern> {
515 let Inst{4} = 1;
516 let Inst{5} = 1; // H bit
517 let Inst{6} = 1; // S bit
518 let Inst{7} = 1;
519 let Inst{20} = 0; // L bit
520 let Inst{21} = 0; // W bit
521 let Inst{24} = 1; // P bit
522}
523
524// Pre-indexed loads
525class AI3ldhpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
526 string asm, string cstr, list<dag> pattern>
527 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
528 asm, cstr, pattern> {
529 let Inst{4} = 1;
530 let Inst{5} = 1; // H bit
531 let Inst{6} = 0; // S bit
532 let Inst{7} = 1;
533 let Inst{20} = 1; // L bit
534 let Inst{21} = 1; // W bit
535 let Inst{24} = 1; // P bit
536}
537class AI3ldshpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
538 string asm, string cstr, list<dag> pattern>
539 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
540 asm, cstr, pattern> {
541 let Inst{4} = 1;
542 let Inst{5} = 1; // H bit
543 let Inst{6} = 1; // S bit
544 let Inst{7} = 1;
545 let Inst{20} = 1; // L bit
546 let Inst{21} = 1; // W bit
547 let Inst{24} = 1; // P bit
548}
549class AI3ldsbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
550 string asm, string cstr, list<dag> pattern>
551 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
552 asm, cstr, pattern> {
553 let Inst{4} = 1;
554 let Inst{5} = 0; // H bit
555 let Inst{6} = 1; // S bit
556 let Inst{7} = 1;
557 let Inst{20} = 1; // L bit
558 let Inst{21} = 1; // W bit
559 let Inst{24} = 1; // P bit
560}
561
562// Pre-indexed stores
563class AI3sthpr<bits<4> opcod, dag oops, dag iops, Format f, string opc,
564 string asm, string cstr, list<dag> pattern>
565 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
566 asm, cstr, pattern> {
567 let Inst{4} = 1;
568 let Inst{5} = 1; // H bit
569 let Inst{6} = 0; // S bit
570 let Inst{7} = 1;
571 let Inst{20} = 0; // L bit
572 let Inst{21} = 1; // W bit
573 let Inst{24} = 1; // P bit
574}
575
576// Post-indexed loads
577class AI3ldhpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
578 string asm, string cstr, list<dag> pattern>
579 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
580 asm, cstr,pattern> {
581 let Inst{4} = 1;
582 let Inst{5} = 1; // H bit
583 let Inst{6} = 0; // S bit
584 let Inst{7} = 1;
585 let Inst{20} = 1; // L bit
586 let Inst{21} = 1; // W bit
587 let Inst{24} = 0; // P bit
588}
589class AI3ldshpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
590 string asm, string cstr, list<dag> pattern>
591 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
592 asm, cstr,pattern> {
593 let Inst{4} = 1;
594 let Inst{5} = 1; // H bit
595 let Inst{6} = 1; // S bit
596 let Inst{7} = 1;
597 let Inst{20} = 1; // L bit
598 let Inst{21} = 1; // W bit
599 let Inst{24} = 0; // P bit
600}
601class AI3ldsbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
602 string asm, string cstr, list<dag> pattern>
603 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
604 asm, cstr,pattern> {
605 let Inst{4} = 1;
606 let Inst{5} = 0; // H bit
607 let Inst{6} = 1; // S bit
608 let Inst{7} = 1;
609 let Inst{20} = 1; // L bit
610 let Inst{21} = 1; // W bit
611 let Inst{24} = 0; // P bit
612}
613
614// Post-indexed stores
615class AI3sthpo<bits<4> opcod, dag oops, dag iops, Format f, string opc,
616 string asm, string cstr, list<dag> pattern>
617 : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
618 asm, cstr,pattern> {
619 let Inst{4} = 1;
620 let Inst{5} = 1; // H bit
621 let Inst{6} = 0; // S bit
622 let Inst{7} = 1;
623 let Inst{20} = 0; // L bit
624 let Inst{21} = 1; // W bit
625 let Inst{24} = 0; // P bit
626}
627
628
Evan Cheng0d14fc82008-09-01 01:51:14 +0000629// addrmode4 instructions
630class AI4<bits<4> opcod, dag oops, dag iops, Format f, string opc,
631 string asm, list<dag> pattern>
632 : I<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc,
Evan Cheng3c2ee492008-09-01 07:48:18 +0000633 asm, "", pattern> {
634 let Inst{25-27} = 0x4;
635}
636class AXI4ld<bits<4> opcod, dag oops, dag iops, Format f, string asm,
Evan Cheng37f25d92008-08-28 23:39:26 +0000637 list<dag> pattern>
638 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
Evan Cheng3c2ee492008-09-01 07:48:18 +0000639 "", pattern> {
640 let Inst{20} = 1; // L bit
641 let Inst{22} = 0; // S bit
642 let Inst{25-27} = 0x4;
643}
644class AXI4ldpc<bits<4> opcod, dag oops, dag iops, Format f, string asm,
645 list<dag> pattern>
646 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
647 "", pattern> {
648 let Inst{20} = 1; // L bit
649 let Inst{22} = 1; // S bit
650 let Inst{25-27} = 0x4;
651}
652class AXI4st<bits<4> opcod, dag oops, dag iops, Format f, string asm,
653 list<dag> pattern>
654 : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
655 "", pattern> {
656 let Inst{20} = 0; // L bit
657 let Inst{22} = 0; // S bit
658 let Inst{25-27} = 0x4;
659}
Evan Cheng37f25d92008-08-28 23:39:26 +0000660
Evan Cheng37f25d92008-08-28 23:39:26 +0000661
Evan Cheng37f25d92008-08-28 23:39:26 +0000662//===----------------------------------------------------------------------===//
663
664// ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
665class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
666 list<Predicate> Predicates = [IsARM];
667}
668class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
669 list<Predicate> Predicates = [IsARM, HasV5TE];
670}
671class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
672 list<Predicate> Predicates = [IsARM, HasV6];
673}
Evan Cheng13096642008-08-29 06:41:12 +0000674
675//===----------------------------------------------------------------------===//
676//
677// Thumb Instruction Format Definitions.
678//
679
680
681// TI - Thumb instruction.
682
683class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
684 string asm, string cstr, list<dag> pattern>
685 // FIXME: Set all opcodes to 0 for now.
686 : InstARM<0, am, sz, IndexModeNone, ThumbFrm, cstr> {
687 let OutOperandList = outs;
688 let InOperandList = ins;
689 let AsmString = asm;
690 let Pattern = pattern;
691 list<Predicate> Predicates = [IsThumb];
692}
693
694class TI<dag outs, dag ins, string asm, list<dag> pattern>
695 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
696class TI1<dag outs, dag ins, string asm, list<dag> pattern>
697 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
698class TI2<dag outs, dag ins, string asm, list<dag> pattern>
699 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
700class TI4<dag outs, dag ins, string asm, list<dag> pattern>
701 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
702class TIs<dag outs, dag ins, string asm, list<dag> pattern>
703 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
704
705// Two-address instructions
706class TIt<dag outs, dag ins, string asm, list<dag> pattern>
707 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
708
709// BL, BLX(1) are translated by assembler into two instructions
710class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
711 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
712
713// BR_JT instructions
714class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
715 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
716
717
718//===----------------------------------------------------------------------===//
719
720
721// ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
722class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
723 list<Predicate> Predicates = [IsThumb];
724}
725
726class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
727 list<Predicate> Predicates = [IsThumb, HasV5T];
728}