1 //===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 // ARM Instruction Format Definitions.
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
18 class Format<bits<5> val> {
22 def Pseudo : Format<0>;
23 def MulFrm : Format<1>;
24 def BrFrm : Format<2>;
25 def BrMiscFrm : Format<3>;
27 def DPFrm : Format<4>;
28 def DPSoRegFrm : Format<5>;
30 def LdFrm : Format<6>;
31 def StFrm : Format<7>;
32 def LdMiscFrm : Format<8>;
33 def StMiscFrm : Format<9>;
34 def LdStMulFrm : Format<10>;
36 def ArithMiscFrm : Format<11>;
37 def ExtFrm : Format<12>;
39 def VFPUnaryFrm : Format<13>;
40 def VFPBinaryFrm : Format<14>;
41 def VFPConv1Frm : Format<15>;
42 def VFPConv2Frm : Format<16>;
43 def VFPConv3Frm : Format<17>;
44 def VFPConv4Frm : Format<18>;
45 def VFPConv5Frm : Format<19>;
46 def VFPLdStFrm : Format<20>;
47 def VFPLdStMulFrm : Format<21>;
48 def VFPMiscFrm : Format<22>;
50 def ThumbFrm : Format<23>;
52 // Misc flag for data processing instructions that indicates whether
53 // the instruction has a Rn register operand.
54 class UnaryDP { bit isUnaryDataProc = 1; }
56 //===----------------------------------------------------------------------===//
58 // ARM Instruction templates.
61 class InstARM<AddrMode am, SizeFlagVal sz, IndexMode im,
62 Format f, string cstr>
66 let Namespace = "ARM";
70 bits<4> AddrModeBits = AM.Value;
73 bits<3> SizeFlag = SZ.Value;
76 bits<2> IndexModeBits = IM.Value;
79 bits<5> Form = F.Value;
82 // Attributes specific to ARM instructions...
84 bit isUnaryDataProc = 0;
86 let Constraints = cstr;
89 class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern>
90 : InstARM<AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> {
91 let OutOperandList = oops;
92 let InOperandList = iops;
94 let Pattern = pattern;
97 // Almost all ARM instructions are predicable.
98 class I<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
99 IndexMode im, Format f, string opc, string asm, string cstr,
101 : InstARM<am, sz, im, f, cstr> {
102 let OutOperandList = oops;
103 let InOperandList = !con(iops, (ops pred:$p));
104 let AsmString = !strconcat(opc, !strconcat("${p}", asm));
105 let Pattern = pattern;
106 list<Predicate> Predicates = [IsARM];
109 // Same as I except it can optionally modify CPSR. Note it's modeled as
110 // an input operand since by default it's a zero register. It will
111 // become an implicit def once it's "flipped".
112 class sI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
113 IndexMode im, Format f, string opc, string asm, string cstr,
115 : InstARM<am, sz, im, f, cstr> {
116 let OutOperandList = oops;
117 let InOperandList = !con(iops, (ops pred:$p, cc_out:$s));
118 let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm));
119 let Pattern = pattern;
120 list<Predicate> Predicates = [IsARM];
124 class XI<dag oops, dag iops, AddrMode am, SizeFlagVal sz,
125 IndexMode im, Format f, string asm, string cstr, list<dag> pattern>
126 : InstARM<am, sz, im, f, cstr> {
127 let OutOperandList = oops;
128 let InOperandList = iops;
130 let Pattern = pattern;
131 list<Predicate> Predicates = [IsARM];
134 class AI<dag oops, dag iops, Format f, string opc,
135 string asm, list<dag> pattern>
136 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
138 class AsI<dag oops, dag iops, Format f, string opc,
139 string asm, list<dag> pattern>
140 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc,
142 class AXI<dag oops, dag iops, Format f, string asm,
144 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm,
147 // Ctrl flow instructions
148 class ABI<bits<4> opcod, dag oops, dag iops, string opc,
149 string asm, list<dag> pattern>
150 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, opc,
152 let Inst{27-24} = opcod;
154 class ABXI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern>
155 : XI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, asm,
157 let Inst{27-24} = opcod;
159 class ABXIx2<dag oops, dag iops, string asm, list<dag> pattern>
160 : XI<oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, BrMiscFrm, asm,
163 // BR_JT instructions
164 class JTI<dag oops, dag iops, string asm, list<dag> pattern>
165 : XI<oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BrMiscFrm,
168 // addrmode1 instructions
169 class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
170 string asm, list<dag> pattern>
171 : I<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
173 let Inst{24-21} = opcod;
174 let Inst{27-26} = {0,0};
176 class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc,
177 string asm, list<dag> pattern>
178 : sI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc,
180 let Inst{24-21} = opcod;
181 let Inst{27-26} = {0,0};
183 class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm,
185 : XI<oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm,
187 let Inst{24-21} = opcod;
188 let Inst{27-26} = {0,0};
190 class AI1x2<dag oops, dag iops, Format f, string opc,
191 string asm, list<dag> pattern>
192 : I<oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc,
196 // addrmode2 loads and stores
197 class AI2<dag oops, dag iops, Format f, string opc,
198 string asm, list<dag> pattern>
199 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
201 let Inst{27-26} = {0,1};
205 class AI2ldw<dag oops, dag iops, Format f, string opc,
206 string asm, list<dag> pattern>
207 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
209 let Inst{20} = 1; // L bit
210 let Inst{21} = 0; // W bit
211 let Inst{22} = 0; // B bit
212 let Inst{24} = 1; // P bit
213 let Inst{27-26} = {0,1};
215 class AXI2ldw<dag oops, dag iops, Format f, string asm,
217 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
219 let Inst{20} = 1; // L bit
220 let Inst{21} = 0; // W bit
221 let Inst{22} = 0; // B bit
222 let Inst{24} = 1; // P bit
223 let Inst{27-26} = {0,1};
225 class AI2ldb<dag oops, dag iops, Format f, string opc,
226 string asm, list<dag> pattern>
227 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
229 let Inst{20} = 1; // L bit
230 let Inst{21} = 0; // W bit
231 let Inst{22} = 1; // B bit
232 let Inst{24} = 1; // P bit
233 let Inst{27-26} = {0,1};
235 class AXI2ldb<dag oops, dag iops, Format f, string asm,
237 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
239 let Inst{20} = 1; // L bit
240 let Inst{21} = 0; // W bit
241 let Inst{22} = 1; // B bit
242 let Inst{24} = 1; // P bit
243 let Inst{27-26} = {0,1};
247 class AI2stw<dag oops, dag iops, Format f, string opc,
248 string asm, list<dag> pattern>
249 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
251 let Inst{20} = 0; // L bit
252 let Inst{21} = 0; // W bit
253 let Inst{22} = 0; // B bit
254 let Inst{24} = 1; // P bit
255 let Inst{27-26} = {0,1};
257 class AXI2stw<dag oops, dag iops, Format f, string asm,
259 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
261 let Inst{20} = 0; // L bit
262 let Inst{21} = 0; // W bit
263 let Inst{22} = 0; // B bit
264 let Inst{24} = 1; // P bit
265 let Inst{27-26} = {0,1};
267 class AI2stb<dag oops, dag iops, Format f, string opc,
268 string asm, list<dag> pattern>
269 : I<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc,
271 let Inst{20} = 0; // L bit
272 let Inst{21} = 0; // W bit
273 let Inst{22} = 1; // B bit
274 let Inst{24} = 1; // P bit
275 let Inst{27-26} = {0,1};
277 class AXI2stb<dag oops, dag iops, Format f, string asm,
279 : XI<oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f,
281 let Inst{20} = 0; // L bit
282 let Inst{21} = 0; // W bit
283 let Inst{22} = 1; // B bit
284 let Inst{24} = 1; // P bit
285 let Inst{27-26} = {0,1};
289 class AI2ldwpr<dag oops, dag iops, Format f, string opc,
290 string asm, string cstr, list<dag> pattern>
291 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
292 asm, cstr, pattern> {
293 let Inst{20} = 1; // L bit
294 let Inst{21} = 1; // W bit
295 let Inst{22} = 0; // B bit
296 let Inst{24} = 1; // P bit
297 let Inst{27-26} = {0,1};
299 class AI2ldbpr<dag oops, dag iops, Format f, string opc,
300 string asm, string cstr, list<dag> pattern>
301 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
302 asm, cstr, pattern> {
303 let Inst{20} = 1; // L bit
304 let Inst{21} = 1; // W bit
305 let Inst{22} = 1; // B bit
306 let Inst{24} = 1; // P bit
307 let Inst{27-26} = {0,1};
310 // Pre-indexed stores
311 class AI2stwpr<dag oops, dag iops, Format f, string opc,
312 string asm, string cstr, list<dag> pattern>
313 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
314 asm, cstr, pattern> {
315 let Inst{20} = 0; // L bit
316 let Inst{21} = 1; // W bit
317 let Inst{22} = 0; // B bit
318 let Inst{24} = 1; // P bit
319 let Inst{27-26} = {0,1};
321 class AI2stbpr<dag oops, dag iops, Format f, string opc,
322 string asm, string cstr, list<dag> pattern>
323 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc,
324 asm, cstr, pattern> {
325 let Inst{20} = 0; // L bit
326 let Inst{21} = 1; // W bit
327 let Inst{22} = 1; // B bit
328 let Inst{24} = 1; // P bit
329 let Inst{27-26} = {0,1};
332 // Post-indexed loads
333 class AI2ldwpo<dag oops, dag iops, Format f, string opc,
334 string asm, string cstr, list<dag> pattern>
335 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
337 let Inst{20} = 1; // L bit
338 let Inst{21} = 0; // W bit
339 let Inst{22} = 0; // B bit
340 let Inst{24} = 0; // P bit
341 let Inst{27-26} = {0,1};
343 class AI2ldbpo<dag oops, dag iops, Format f, string opc,
344 string asm, string cstr, list<dag> pattern>
345 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
347 let Inst{20} = 1; // L bit
348 let Inst{21} = 0; // W bit
349 let Inst{22} = 1; // B bit
350 let Inst{24} = 0; // P bit
351 let Inst{27-26} = {0,1};
354 // Post-indexed stores
355 class AI2stwpo<dag oops, dag iops, Format f, string opc,
356 string asm, string cstr, list<dag> pattern>
357 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
359 let Inst{20} = 0; // L bit
360 let Inst{21} = 0; // W bit
361 let Inst{22} = 0; // B bit
362 let Inst{24} = 0; // P bit
363 let Inst{27-26} = {0,1};
365 class AI2stbpo<dag oops, dag iops, Format f, string opc,
366 string asm, string cstr, list<dag> pattern>
367 : I<oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc,
369 let Inst{20} = 0; // L bit
370 let Inst{21} = 0; // W bit
371 let Inst{22} = 1; // B bit
372 let Inst{24} = 0; // P bit
373 let Inst{27-26} = {0,1};
376 // addrmode3 instructions
377 class AI3<dag oops, dag iops, Format f, string opc,
378 string asm, list<dag> pattern>
379 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
381 class AXI3<dag oops, dag iops, Format f, string asm,
383 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm,
387 class AI3ldh<dag oops, dag iops, Format f, string opc,
388 string asm, list<dag> pattern>
389 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
392 let Inst{5} = 1; // H bit
393 let Inst{6} = 0; // S bit
395 let Inst{20} = 1; // L bit
396 let Inst{21} = 0; // W bit
397 let Inst{24} = 1; // P bit
399 class AXI3ldh<dag oops, dag iops, Format f, string asm,
401 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
404 let Inst{5} = 1; // H bit
405 let Inst{6} = 0; // S bit
407 let Inst{20} = 1; // L bit
408 let Inst{21} = 0; // W bit
409 let Inst{24} = 1; // P bit
411 class AI3ldsh<dag oops, dag iops, Format f, string opc,
412 string asm, list<dag> pattern>
413 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
416 let Inst{5} = 1; // H bit
417 let Inst{6} = 1; // S bit
419 let Inst{20} = 1; // L bit
420 let Inst{21} = 0; // W bit
421 let Inst{24} = 1; // P bit
423 class AXI3ldsh<dag oops, dag iops, Format f, string asm,
425 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
428 let Inst{5} = 1; // H bit
429 let Inst{6} = 1; // S bit
431 let Inst{20} = 1; // L bit
432 let Inst{21} = 0; // W bit
433 let Inst{24} = 1; // P bit
435 class AI3ldsb<dag oops, dag iops, Format f, string opc,
436 string asm, list<dag> pattern>
437 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
440 let Inst{5} = 0; // H bit
441 let Inst{6} = 1; // S bit
443 let Inst{20} = 1; // L bit
444 let Inst{21} = 0; // W bit
445 let Inst{24} = 1; // P bit
447 class AXI3ldsb<dag oops, dag iops, Format f, string asm,
449 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
452 let Inst{5} = 0; // H bit
453 let Inst{6} = 1; // S bit
455 let Inst{20} = 1; // L bit
456 let Inst{21} = 0; // W bit
457 let Inst{24} = 1; // P bit
459 class AI3ldd<dag oops, dag iops, Format f, string opc,
460 string asm, list<dag> pattern>
461 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
464 let Inst{5} = 0; // H bit
465 let Inst{6} = 1; // S bit
467 let Inst{20} = 0; // L bit
468 let Inst{21} = 0; // W bit
469 let Inst{24} = 1; // P bit
473 class AI3sth<dag oops, dag iops, Format f, string opc,
474 string asm, list<dag> pattern>
475 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
478 let Inst{5} = 1; // H bit
479 let Inst{6} = 0; // S bit
481 let Inst{20} = 0; // L bit
482 let Inst{21} = 0; // W bit
483 let Inst{24} = 1; // P bit
485 class AXI3sth<dag oops, dag iops, Format f, string asm,
487 : XI<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f,
490 let Inst{5} = 1; // H bit
491 let Inst{6} = 0; // S bit
493 let Inst{20} = 0; // L bit
494 let Inst{21} = 0; // W bit
495 let Inst{24} = 1; // P bit
497 class AI3std<dag oops, dag iops, Format f, string opc,
498 string asm, list<dag> pattern>
499 : I<oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc,
502 let Inst{5} = 1; // H bit
503 let Inst{6} = 1; // S bit
505 let Inst{20} = 0; // L bit
506 let Inst{21} = 0; // W bit
507 let Inst{24} = 1; // P bit
511 class AI3ldhpr<dag oops, dag iops, Format f, string opc,
512 string asm, string cstr, list<dag> pattern>
513 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
514 asm, cstr, pattern> {
516 let Inst{5} = 1; // H bit
517 let Inst{6} = 0; // S bit
519 let Inst{20} = 1; // L bit
520 let Inst{21} = 1; // W bit
521 let Inst{24} = 1; // P bit
523 class AI3ldshpr<dag oops, dag iops, Format f, string opc,
524 string asm, string cstr, list<dag> pattern>
525 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
526 asm, cstr, pattern> {
528 let Inst{5} = 1; // H bit
529 let Inst{6} = 1; // S bit
531 let Inst{20} = 1; // L bit
532 let Inst{21} = 1; // W bit
533 let Inst{24} = 1; // P bit
535 class AI3ldsbpr<dag oops, dag iops, Format f, string opc,
536 string asm, string cstr, list<dag> pattern>
537 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
538 asm, cstr, pattern> {
540 let Inst{5} = 0; // H bit
541 let Inst{6} = 1; // S bit
543 let Inst{20} = 1; // L bit
544 let Inst{21} = 1; // W bit
545 let Inst{24} = 1; // P bit
548 // Pre-indexed stores
549 class AI3sthpr<dag oops, dag iops, Format f, string opc,
550 string asm, string cstr, list<dag> pattern>
551 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc,
552 asm, cstr, pattern> {
554 let Inst{5} = 1; // H bit
555 let Inst{6} = 0; // S bit
557 let Inst{20} = 0; // L bit
558 let Inst{21} = 1; // W bit
559 let Inst{24} = 1; // P bit
562 // Post-indexed loads
563 class AI3ldhpo<dag oops, dag iops, Format f, string opc,
564 string asm, string cstr, list<dag> pattern>
565 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
568 let Inst{5} = 1; // H bit
569 let Inst{6} = 0; // S bit
571 let Inst{20} = 1; // L bit
572 let Inst{21} = 1; // W bit
573 let Inst{24} = 0; // P bit
575 class AI3ldshpo<dag oops, dag iops, Format f, string opc,
576 string asm, string cstr, list<dag> pattern>
577 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
580 let Inst{5} = 1; // H bit
581 let Inst{6} = 1; // S bit
583 let Inst{20} = 1; // L bit
584 let Inst{21} = 1; // W bit
585 let Inst{24} = 0; // P bit
587 class AI3ldsbpo<dag oops, dag iops, Format f, string opc,
588 string asm, string cstr, list<dag> pattern>
589 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
592 let Inst{5} = 0; // H bit
593 let Inst{6} = 1; // S bit
595 let Inst{20} = 1; // L bit
596 let Inst{21} = 1; // W bit
597 let Inst{24} = 0; // P bit
600 // Post-indexed stores
601 class AI3sthpo<dag oops, dag iops, Format f, string opc,
602 string asm, string cstr, list<dag> pattern>
603 : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc,
606 let Inst{5} = 1; // H bit
607 let Inst{6} = 0; // S bit
609 let Inst{20} = 0; // L bit
610 let Inst{21} = 1; // W bit
611 let Inst{24} = 0; // P bit
615 // addrmode4 instructions
616 class AXI4ld<dag oops, dag iops, Format f, string asm, list<dag> pattern>
617 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
619 let Inst{20} = 1; // L bit
620 let Inst{22} = 0; // S bit
621 let Inst{27-25} = 0b100;
623 class AXI4st<dag oops, dag iops, Format f, string asm, list<dag> pattern>
624 : XI<oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm,
626 let Inst{20} = 0; // L bit
627 let Inst{22} = 0; // S bit
628 let Inst{27-25} = 0b100;
631 // Unsigned multiply, multiply-accumulate instructions.
632 class AMul1I<bits<7> opcod, dag oops, dag iops, string opc,
633 string asm, list<dag> pattern>
634 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
636 let Inst{7-4} = 0b1001;
637 let Inst{20} = 0; // S bit
638 let Inst{27-21} = opcod;
640 class AsMul1I<bits<7> opcod, dag oops, dag iops, string opc,
641 string asm, list<dag> pattern>
642 : sI<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
644 let Inst{7-4} = 0b1001;
645 let Inst{27-21} = opcod;
648 // Most significant word multiply
649 class AMul2I<bits<7> opcod, dag oops, dag iops, string opc,
650 string asm, list<dag> pattern>
651 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
653 let Inst{7-4} = 0b1001;
655 let Inst{27-21} = opcod;
658 // SMUL<x><y> / SMULW<y> / SMLA<x><y> / SMLAW<x><y>
659 class AMulxyI<bits<7> opcod, dag oops, dag iops, string opc,
660 string asm, list<dag> pattern>
661 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm, opc,
666 let Inst{27-21} = opcod;
669 // Extend instructions.
670 class AExtI<bits<8> opcod, dag oops, dag iops, string opc,
671 string asm, list<dag> pattern>
672 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ExtFrm, opc,
674 let Inst{7-4} = 0b0111;
675 let Inst{27-20} = opcod;
678 // Misc Arithmetic instructions.
679 class AMiscA1I<bits<8> opcod, dag oops, dag iops, string opc,
680 string asm, list<dag> pattern>
681 : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, ArithMiscFrm, opc,
683 let Inst{27-20} = opcod;
686 //===----------------------------------------------------------------------===//
688 // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode.
689 class ARMPat<dag pattern, dag result> : Pat<pattern, result> {
690 list<Predicate> Predicates = [IsARM];
692 class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> {
693 list<Predicate> Predicates = [IsARM, HasV5TE];
695 class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> {
696 list<Predicate> Predicates = [IsARM, HasV6];
699 //===----------------------------------------------------------------------===//
701 // Thumb Instruction Format Definitions.
705 // TI - Thumb instruction.
707 class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz,
708 string asm, string cstr, list<dag> pattern>
709 : InstARM<am, sz, IndexModeNone, ThumbFrm, cstr> {
710 let OutOperandList = outs;
711 let InOperandList = ins;
713 let Pattern = pattern;
714 list<Predicate> Predicates = [IsThumb];
717 class TI<dag outs, dag ins, string asm, list<dag> pattern>
718 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>;
719 class TI1<dag outs, dag ins, string asm, list<dag> pattern>
720 : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>;
721 class TI2<dag outs, dag ins, string asm, list<dag> pattern>
722 : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>;
723 class TI4<dag outs, dag ins, string asm, list<dag> pattern>
724 : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>;
725 class TIs<dag outs, dag ins, string asm, list<dag> pattern>
726 : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>;
728 // Two-address instructions
729 class TIt<dag outs, dag ins, string asm, list<dag> pattern>
730 : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>;
732 // BL, BLX(1) are translated by assembler into two instructions
733 class TIx2<dag outs, dag ins, string asm, list<dag> pattern>
734 : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>;
736 // BR_JT instructions
737 class TJTI<dag outs, dag ins, string asm, list<dag> pattern>
738 : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>;
741 //===----------------------------------------------------------------------===//
743 //===----------------------------------------------------------------------===//
744 // ARM VFP Instruction templates.
747 // ARM VFP addrmode5 loads and stores
748 class ADI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
749 string opc, string asm, list<dag> pattern>
750 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
751 VFPLdStFrm, opc, asm, "", pattern> {
752 // TODO: Mark the instructions with the appropriate subtarget info.
753 let Inst{27-24} = opcod1;
754 let Inst{21-20} = opcod2;
755 let Inst{11-8} = 0b1011;
758 class ASI5<bits<4> opcod1, bits<2> opcod2, dag oops, dag iops,
759 string opc, string asm, list<dag> pattern>
760 : I<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
761 VFPLdStFrm, opc, asm, "", pattern> {
762 // TODO: Mark the instructions with the appropriate subtarget info.
763 let Inst{27-24} = opcod1;
764 let Inst{21-20} = opcod2;
765 let Inst{11-8} = 0b1010;
768 // Load / store multiple
769 class AXSI5<dag oops, dag iops, string asm, list<dag> pattern>
770 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
771 VFPLdStMulFrm, asm, "", pattern> {
772 // TODO: Mark the instructions with the appropriate subtarget info.
773 let Inst{27-25} = 0b110;
774 let Inst{11-8} = 0b1011;
777 class AXDI5<dag oops, dag iops, string asm, list<dag> pattern>
778 : XI<oops, iops, AddrMode5, Size4Bytes, IndexModeNone,
779 VFPLdStMulFrm, asm, "", pattern> {
780 // TODO: Mark the instructions with the appropriate subtarget info.
781 let Inst{27-25} = 0b110;
782 let Inst{11-8} = 0b1010;
786 // Double precision, unary
787 class ADuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
788 string opc, string asm, list<dag> pattern>
789 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
790 let Inst{27-20} = opcod1;
791 let Inst{19-16} = opcod2;
792 let Inst{11-8} = 0b1011;
793 let Inst{7-4} = opcod3;
796 // Double precision, binary
797 class ADbI<bits<8> opcod, dag oops, dag iops, string opc,
798 string asm, list<dag> pattern>
799 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
800 let Inst{27-20} = opcod;
801 let Inst{11-8} = 0b1011;
804 // Single precision, unary
805 class ASuI<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3, dag oops, dag iops,
806 string opc, string asm, list<dag> pattern>
807 : AI<oops, iops, VFPUnaryFrm, opc, asm, pattern> {
808 // Bits 22 (D bit) and 5 (M bit) will be changed during instruction encoding.
809 let Inst{27-20} = opcod1;
810 let Inst{19-16} = opcod2;
811 let Inst{11-8} = 0b1010;
812 let Inst{7-4} = opcod3;
815 // Single precision, binary
816 class ASbI<bits<8> opcod, dag oops, dag iops, string opc,
817 string asm, list<dag> pattern>
818 : AI<oops, iops, VFPBinaryFrm, opc, asm, pattern> {
819 // Bit 22 (D bit) can be changed during instruction encoding.
820 let Inst{27-20} = opcod;
821 let Inst{11-8} = 0b1010;
824 // VFP conversion instructions
825 class AVConv1I<bits<8> opcod1, bits<4> opcod2, bits<4> opcod3,
826 dag oops, dag iops, string opc, string asm, list<dag> pattern>
827 : AI<oops, iops, VFPConv1Frm, opc, asm, pattern> {
828 let Inst{27-20} = opcod1;
829 let Inst{19-16} = opcod2;
830 let Inst{11-8} = opcod3;
834 class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
835 string opc, string asm, list<dag> pattern>
836 : AI<oops, iops, f, opc, asm, pattern> {
837 let Inst{27-20} = opcod1;
838 let Inst{11-8} = opcod2;
842 class AVConv2I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
843 string asm, list<dag> pattern>
844 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv2Frm, opc, asm, pattern>;
846 class AVConv3I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
847 string asm, list<dag> pattern>
848 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv3Frm, opc, asm, pattern>;
850 class AVConv4I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
851 string asm, list<dag> pattern>
852 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv4Frm, opc, asm, pattern>;
854 class AVConv5I<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, string opc,
855 string asm, list<dag> pattern>
856 : AVConvXI<opcod1, opcod2, oops, iops, VFPConv5Frm, opc, asm, pattern>;
858 //===----------------------------------------------------------------------===//
861 // ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode.
862 class ThumbPat<dag pattern, dag result> : Pat<pattern, result> {
863 list<Predicate> Predicates = [IsThumb];
866 class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> {
867 list<Predicate> Predicates = [IsThumb, HasV5T];