1 //===- AArch64InstrFormats.td - AArch64 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 // A64 Instruction Format Definitions.
15 // A64 is currently the only instruction set supported by the AArch64
17 class A64Inst<dag outs, dag ins, string asmstr, list<dag> patterns,
20 // All A64 instructions are 32-bit. This field will be filled in
21 // graually going down the hierarchy.
24 field bits<32> Unpredictable = 0;
25 // SoftFail is the generic name for this field, but we alias it so
26 // as to make it more obvious what it means in ARM-land.
27 field bits<32> SoftFail = Unpredictable;
29 // LLVM-level model of the AArch64/A64 distinction.
30 let Namespace = "AArch64";
31 let DecoderNamespace = "A64";
34 // Set the templated fields
35 let OutOperandList = outs;
36 let InOperandList = ins;
37 let AsmString = asmstr;
38 let Pattern = patterns;
42 class PseudoInst<dag outs, dag ins, list<dag> patterns> : Instruction {
43 let Namespace = "AArch64";
45 let OutOperandList = outs;
46 let InOperandList= ins;
47 let Pattern = patterns;
48 let isCodeGenOnly = 1;
52 // Represents a pseudo-instruction that represents a single A64 instruction for
53 // whatever reason, the eventual result will be a 32-bit real instruction.
54 class A64PseudoInst<dag outs, dag ins, list<dag> patterns>
55 : PseudoInst<outs, ins, patterns> {
59 // As above, this will be a single A64 instruction, but we can actually give the
60 // expansion in TableGen.
61 class A64PseudoExpand<dag outs, dag ins, list<dag> patterns, dag Result>
62 : A64PseudoInst<outs, ins, patterns>,
63 PseudoInstExpansion<Result>;
66 // First, some common cross-hierarchy register formats.
68 class A64InstRd<dag outs, dag ins, string asmstr,
69 list<dag> patterns, InstrItinClass itin>
70 : A64Inst<outs, ins, asmstr, patterns, itin> {
76 class A64InstRt<dag outs, dag ins, string asmstr,
77 list<dag> patterns, InstrItinClass itin>
78 : A64Inst<outs, ins, asmstr, patterns, itin> {
85 class A64InstRdn<dag outs, dag ins, string asmstr,
86 list<dag> patterns, InstrItinClass itin>
87 : A64InstRd<outs, ins, asmstr, patterns, itin> {
94 class A64InstRtn<dag outs, dag ins, string asmstr,
95 list<dag> patterns, InstrItinClass itin>
96 : A64InstRt<outs, ins, asmstr, patterns, itin> {
103 // Instructions taking Rt,Rt2,Rn
104 class A64InstRtt2n<dag outs, dag ins, string asmstr,
105 list<dag> patterns, InstrItinClass itin>
106 : A64InstRtn<outs, ins, asmstr, patterns, itin> {
109 let Inst{14-10} = Rt2;
112 class A64InstRdnm<dag outs, dag ins, string asmstr,
113 list<dag> patterns, InstrItinClass itin>
114 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
117 let Inst{20-16} = Rm;
120 //===----------------------------------------------------------------------===//
122 // Actual A64 Instruction Formats
125 // Format for Add-subtract (extended register) instructions.
126 class A64I_addsubext<bit sf, bit op, bit S, bits<2> opt, bits<3> option,
127 dag outs, dag ins, string asmstr, list<dag> patterns,
129 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
135 let Inst{28-24} = 0b01011;
136 let Inst{23-22} = opt;
138 // Rm inherited in 20-16
139 let Inst{15-13} = option;
140 let Inst{12-10} = Imm3;
141 // Rn inherited in 9-5
142 // Rd inherited in 4-0
145 // Format for Add-subtract (immediate) instructions.
146 class A64I_addsubimm<bit sf, bit op, bit S, bits<2> shift,
147 dag outs, dag ins, string asmstr,
148 list<dag> patterns, InstrItinClass itin>
149 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
155 let Inst{28-24} = 0b10001;
156 let Inst{23-22} = shift;
157 let Inst{21-10} = Imm12;
160 // Format for Add-subtract (shifted register) instructions.
161 class A64I_addsubshift<bit sf, bit op, bit S, bits<2> shift,
162 dag outs, dag ins, string asmstr, list<dag> patterns,
164 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
170 let Inst{28-24} = 0b01011;
171 let Inst{23-22} = shift;
173 // Rm inherited in 20-16
174 let Inst{15-10} = Imm6;
175 // Rn inherited in 9-5
176 // Rd inherited in 4-0
179 // Format for Add-subtract (with carry) instructions.
180 class A64I_addsubcarry<bit sf, bit op, bit S, bits<6> opcode2,
181 dag outs, dag ins, string asmstr, list<dag> patterns,
183 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
187 let Inst{28-21} = 0b11010000;
188 // Rm inherited in 20-16
189 let Inst{15-10} = opcode2;
190 // Rn inherited in 9-5
191 // Rd inherited in 4-0
195 // Format for Bitfield instructions
196 class A64I_bitfield<bit sf, bits<2> opc, bit n,
197 dag outs, dag ins, string asmstr,
198 list<dag> patterns, InstrItinClass itin>
199 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
204 let Inst{30-29} = opc;
205 let Inst{28-23} = 0b100110;
207 let Inst{21-16} = ImmR;
208 let Inst{15-10} = ImmS;
213 // Format for compare and branch (immediate) instructions.
214 class A64I_cmpbr<bit sf, bit op,
215 dag outs, dag ins, string asmstr,
216 list<dag> patterns, InstrItinClass itin>
217 : A64InstRt<outs, ins, asmstr, patterns, itin> {
221 let Inst{30-25} = 0b011010;
223 let Inst{23-5} = Label;
227 // Format for conditional branch (immediate) instructions.
228 class A64I_condbr<bit o1, bit o0,
229 dag outs, dag ins, string asmstr,
230 list<dag> patterns, InstrItinClass itin>
231 : A64Inst<outs, ins, asmstr, patterns, itin> {
235 let Inst{31-25} = 0b0101010;
237 let Inst{23-5} = Label;
239 let Inst{3-0} = Cond;
242 // Format for conditional compare (immediate) instructions.
243 class A64I_condcmpimm<bit sf, bit op, bit o2, bit o3, bit s,
244 dag outs, dag ins, string asmstr,
245 list<dag> patterns, InstrItinClass itin>
246 : A64Inst<outs, ins, asmstr, patterns, itin> {
255 let Inst{28-21} = 0b11010010;
256 let Inst{20-16} = UImm5;
257 let Inst{15-12} = Cond;
262 let Inst{3-0} = NZCVImm;
265 // Format for conditional compare (register) instructions.
266 class A64I_condcmpreg<bit sf, bit op, bit o2, bit o3, bit s,
267 dag outs, dag ins, string asmstr,
268 list<dag> patterns, InstrItinClass itin>
269 : A64Inst<outs, ins, asmstr, patterns, itin> {
279 let Inst{28-21} = 0b11010010;
280 let Inst{20-16} = Rm;
281 let Inst{15-12} = Cond;
286 let Inst{3-0} = NZCVImm;
289 // Format for conditional select instructions.
290 class A64I_condsel<bit sf, bit op, bit s, bits<2> op2,
291 dag outs, dag ins, string asmstr,
292 list<dag> patterns, InstrItinClass itin>
293 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
299 let Inst{28-21} = 0b11010100;
300 // Inherit Rm in 20-16
301 let Inst{15-12} = Cond;
302 let Inst{11-10} = op2;
307 // Format for data processing (1 source) instructions
308 class A64I_dp_1src<bit sf, bit S, bits<5> opcode2, bits<6> opcode,
309 string asmstr, dag outs, dag ins,
310 list<dag> patterns, InstrItinClass itin>
311 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
315 let Inst{28-21} = 0b11010110;
316 let Inst{20-16} = opcode2;
317 let Inst{15-10} = opcode;
320 // Format for data processing (2 source) instructions
321 class A64I_dp_2src<bit sf, bits<6> opcode, bit S,
322 string asmstr, dag outs, dag ins,
323 list<dag> patterns, InstrItinClass itin>
324 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
328 let Inst{28-21} = 0b11010110;
329 let Inst{15-10} = opcode;
332 // Format for data-processing (3 source) instructions
334 class A64I_dp3<bit sf, bits<6> opcode,
335 dag outs, dag ins, string asmstr,
336 list<dag> patterns, InstrItinClass itin>
337 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
341 let Inst{30-29} = opcode{5-4};
342 let Inst{28-24} = 0b11011;
343 let Inst{23-21} = opcode{3-1};
344 // Inherits Rm in 20-16
345 let Inst{15} = opcode{0};
346 let Inst{14-10} = Ra;
347 // Inherits Rn in 9-5
348 // Inherits Rd in 4-0
351 // Format for exception generation instructions
352 class A64I_exception<bits<3> opc, bits<3> op2, bits<2> ll,
353 dag outs, dag ins, string asmstr,
354 list<dag> patterns, InstrItinClass itin>
355 : A64Inst<outs, ins, asmstr, patterns, itin> {
358 let Inst{31-24} = 0b11010100;
359 let Inst{23-21} = opc;
360 let Inst{20-5} = UImm16;
365 // Format for extract (immediate) instructions
366 class A64I_extract<bit sf, bits<3> op, bit n,
367 dag outs, dag ins, string asmstr,
368 list<dag> patterns, InstrItinClass itin>
369 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
373 let Inst{30-29} = op{2-1};
374 let Inst{28-23} = 0b100111;
376 let Inst{21} = op{0};
377 // Inherits Rm in bits 20-16
378 let Inst{15-10} = LSB;
379 // Inherits Rn in 9-5
380 // Inherits Rd in 4-0
383 // Format for floating-point compare instructions.
384 class A64I_fpcmp<bit m, bit s, bits<2> type, bits<2> op, bits<5> opcode2,
385 dag outs, dag ins, string asmstr,
386 list<dag> patterns, InstrItinClass itin>
387 : A64Inst<outs, ins, asmstr, patterns, itin> {
394 let Inst{28-24} = 0b11110;
395 let Inst{23-22} = type;
397 let Inst{20-16} = Rm;
398 let Inst{15-14} = op;
399 let Inst{13-10} = 0b1000;
401 let Inst{4-0} = opcode2;
404 // Format for floating-point conditional compare instructions.
405 class A64I_fpccmp<bit m, bit s, bits<2> type, bit op,
406 dag outs, dag ins, string asmstr,
407 list<dag> patterns, InstrItinClass itin>
408 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
417 let Inst{28-24} = 0b11110;
418 let Inst{23-22} = type;
420 let Inst{20-16} = Rm;
421 let Inst{15-12} = Cond;
422 let Inst{11-10} = 0b01;
425 let Inst{3-0} = NZCVImm;
428 // Format for floating-point conditional select instructions.
429 class A64I_fpcondsel<bit m, bit s, bits<2> type,
430 dag outs, dag ins, string asmstr,
431 list<dag> patterns, InstrItinClass itin>
432 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
438 let Inst{28-24} = 0b11110;
439 let Inst{23-22} = type;
441 // Inherit Rm in 20-16
442 let Inst{15-12} = Cond;
443 let Inst{11-10} = 0b11;
449 // Format for floating-point data-processing (1 source) instructions.
450 class A64I_fpdp1<bit m, bit s, bits<2> type, bits<6> opcode,
451 dag outs, dag ins, string asmstr,
452 list<dag> patterns, InstrItinClass itin>
453 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
457 let Inst{28-24} = 0b11110;
458 let Inst{23-22} = type;
460 let Inst{20-15} = opcode;
461 let Inst{14-10} = 0b10000;
466 // Format for floating-point data-processing (2 sources) instructions.
467 class A64I_fpdp2<bit m, bit s, bits<2> type, bits<4> opcode,
468 dag outs, dag ins, string asmstr,
469 list<dag> patterns, InstrItinClass itin>
470 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
474 let Inst{28-24} = 0b11110;
475 let Inst{23-22} = type;
477 // Inherit Rm in 20-16
478 let Inst{15-12} = opcode;
479 let Inst{11-10} = 0b10;
484 // Format for floating-point data-processing (3 sources) instructions.
485 class A64I_fpdp3<bit m, bit s, bits<2> type, bit o1, bit o0,
486 dag outs, dag ins, string asmstr,
487 list<dag> patterns, InstrItinClass itin>
488 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
494 let Inst{28-24} = 0b11111;
495 let Inst{23-22} = type;
497 // Inherit Rm in 20-16
499 let Inst{14-10} = Ra;
504 // Format for floating-point <-> fixed-point conversion instructions.
505 class A64I_fpfixed<bit sf, bit s, bits<2> type, bits<2> mode, bits<3> opcode,
506 dag outs, dag ins, string asmstr,
507 list<dag> patterns, InstrItinClass itin>
508 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
514 let Inst{28-24} = 0b11110;
515 let Inst{23-22} = type;
517 let Inst{20-19} = mode;
518 let Inst{18-16} = opcode;
519 let Inst{15-10} = Scale;
524 // Format for floating-point <-> integer conversion instructions.
525 class A64I_fpint<bit sf, bit s, bits<2> type, bits<2> rmode, bits<3> opcode,
526 dag outs, dag ins, string asmstr,
527 list<dag> patterns, InstrItinClass itin>
528 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
532 let Inst{28-24} = 0b11110;
533 let Inst{23-22} = type;
535 let Inst{20-19} = rmode;
536 let Inst{18-16} = opcode;
537 let Inst{15-10} = 0b000000;
543 // Format for floating-point immediate instructions.
544 class A64I_fpimm<bit m, bit s, bits<2> type, bits<5> imm5,
545 dag outs, dag ins, string asmstr,
546 list<dag> patterns, InstrItinClass itin>
547 : A64InstRd<outs, ins, asmstr, patterns, itin> {
553 let Inst{28-24} = 0b11110;
554 let Inst{23-22} = type;
556 let Inst{20-13} = Imm8;
557 let Inst{12-10} = 0b100;
558 let Inst{9-5} = imm5;
562 // Format for load-register (literal) instructions.
563 class A64I_LDRlit<bits<2> opc, bit v,
564 dag outs, dag ins, string asmstr,
565 list<dag> patterns, InstrItinClass itin>
566 : A64InstRt<outs, ins, asmstr, patterns, itin> {
569 let Inst{31-30} = opc;
570 let Inst{29-27} = 0b011;
572 let Inst{25-24} = 0b00;
573 let Inst{23-5} = Imm19;
577 // Format for load-store exclusive instructions.
578 class A64I_LDSTex_tn<bits<2> size, bit o2, bit L, bit o1, bit o0,
579 dag outs, dag ins, string asmstr,
580 list <dag> patterns, InstrItinClass itin>
581 : A64InstRtn<outs, ins, asmstr, patterns, itin> {
582 let Inst{31-30} = size;
583 let Inst{29-24} = 0b001000;
590 class A64I_LDSTex_tt2n<bits<2> size, bit o2, bit L, bit o1, bit o0,
591 dag outs, dag ins, string asmstr,
592 list <dag> patterns, InstrItinClass itin>:
593 A64I_LDSTex_tn<size, o2, L, o1, o0, outs, ins, asmstr, patterns, itin>{
595 let Inst{14-10} = Rt2;
598 class A64I_LDSTex_stn<bits<2> size, bit o2, bit L, bit o1, bit o0,
599 dag outs, dag ins, string asmstr,
600 list <dag> patterns, InstrItinClass itin>:
601 A64I_LDSTex_tn<size, o2, L, o1, o0, outs, ins, asmstr, patterns, itin>{
603 let Inst{20-16} = Rs;
606 class A64I_LDSTex_stt2n<bits<2> size, bit o2, bit L, bit o1, bit o0,
607 dag outs, dag ins, string asmstr,
608 list <dag> patterns, InstrItinClass itin>:
609 A64I_LDSTex_stn<size, o2, L, o1, o0, outs, ins, asmstr, patterns, itin>{
611 let Inst{14-10} = Rt2;
614 // Format for load-store register (immediate post-indexed) instructions
615 class A64I_LSpostind<bits<2> size, bit v, bits<2> opc,
616 dag outs, dag ins, string asmstr,
617 list<dag> patterns, InstrItinClass itin>
618 : A64InstRtn<outs, ins, asmstr, patterns, itin> {
621 let Inst{31-30} = size;
622 let Inst{29-27} = 0b111;
624 let Inst{25-24} = 0b00;
625 let Inst{23-22} = opc;
627 let Inst{20-12} = SImm9;
628 let Inst{11-10} = 0b01;
633 // Format for load-store register (immediate pre-indexed) instructions
634 class A64I_LSpreind<bits<2> size, bit v, bits<2> opc,
635 dag outs, dag ins, string asmstr,
636 list<dag> patterns, InstrItinClass itin>
637 : A64InstRtn<outs, ins, asmstr, patterns, itin> {
641 let Inst{31-30} = size;
642 let Inst{29-27} = 0b111;
644 let Inst{25-24} = 0b00;
645 let Inst{23-22} = opc;
647 let Inst{20-12} = SImm9;
648 let Inst{11-10} = 0b11;
653 // Format for load-store register (unprivileged) instructions
654 class A64I_LSunpriv<bits<2> size, bit v, bits<2> opc,
655 dag outs, dag ins, string asmstr,
656 list<dag> patterns, InstrItinClass itin>
657 : A64InstRtn<outs, ins, asmstr, patterns, itin> {
661 let Inst{31-30} = size;
662 let Inst{29-27} = 0b111;
664 let Inst{25-24} = 0b00;
665 let Inst{23-22} = opc;
667 let Inst{20-12} = SImm9;
668 let Inst{11-10} = 0b10;
673 // Format for load-store (unscaled immediate) instructions.
674 class A64I_LSunalimm<bits<2> size, bit v, bits<2> opc,
675 dag outs, dag ins, string asmstr,
676 list<dag> patterns, InstrItinClass itin>
677 : A64InstRtn<outs, ins, asmstr, patterns, itin> {
680 let Inst{31-30} = size;
681 let Inst{29-27} = 0b111;
683 let Inst{25-24} = 0b00;
684 let Inst{23-22} = opc;
686 let Inst{20-12} = SImm9;
687 let Inst{11-10} = 0b00;
693 // Format for load-store (unsigned immediate) instructions.
694 class A64I_LSunsigimm<bits<2> size, bit v, bits<2> opc,
695 dag outs, dag ins, string asmstr,
696 list<dag> patterns, InstrItinClass itin>
697 : A64InstRtn<outs, ins, asmstr, patterns, itin> {
700 let Inst{31-30} = size;
701 let Inst{29-27} = 0b111;
703 let Inst{25-24} = 0b01;
704 let Inst{23-22} = opc;
705 let Inst{21-10} = UImm12;
708 // Format for load-store register (register offset) instructions.
709 class A64I_LSregoff<bits<2> size, bit v, bits<2> opc, bit optionlo,
710 dag outs, dag ins, string asmstr,
711 list<dag> patterns, InstrItinClass itin>
712 : A64InstRtn<outs, ins, asmstr, patterns, itin> {
715 // Complex operand selection needed for these instructions, so they
716 // need an "addr" field for encoding/decoding to be generated.
718 // OptionHi = Ext{2-1}
721 let Inst{31-30} = size;
722 let Inst{29-27} = 0b111;
724 let Inst{25-24} = 0b00;
725 let Inst{23-22} = opc;
727 let Inst{20-16} = Rm;
728 let Inst{15-14} = Ext{2-1};
729 let Inst{13} = optionlo;
730 let Inst{12} = Ext{0};
731 let Inst{11-10} = 0b10;
732 // Inherits Rn in 9-5
733 // Inherits Rt in 4-0
735 let AddedComplexity = 50;
738 // Format for Load-store register pair (offset) instructions
739 class A64I_LSPoffset<bits<2> opc, bit v, bit l,
740 dag outs, dag ins, string asmstr,
741 list<dag> patterns, InstrItinClass itin>
742 : A64InstRtt2n<outs, ins, asmstr, patterns, itin> {
745 let Inst{31-30} = opc;
746 let Inst{29-27} = 0b101;
748 let Inst{25-23} = 0b010;
750 let Inst{21-15} = SImm7;
751 // Inherit Rt2 in 14-10
756 // Format for Load-store register pair (post-indexed) instructions
757 class A64I_LSPpostind<bits<2> opc, bit v, bit l,
758 dag outs, dag ins, string asmstr,
759 list<dag> patterns, InstrItinClass itin>
760 : A64InstRtt2n<outs, ins, asmstr, patterns, itin> {
763 let Inst{31-30} = opc;
764 let Inst{29-27} = 0b101;
766 let Inst{25-23} = 0b001;
768 let Inst{21-15} = SImm7;
769 // Inherit Rt2 in 14-10
774 // Format for Load-store register pair (pre-indexed) instructions
775 class A64I_LSPpreind<bits<2> opc, bit v, bit l,
776 dag outs, dag ins, string asmstr,
777 list<dag> patterns, InstrItinClass itin>
778 : A64InstRtt2n<outs, ins, asmstr, patterns, itin> {
781 let Inst{31-30} = opc;
782 let Inst{29-27} = 0b101;
784 let Inst{25-23} = 0b011;
786 let Inst{21-15} = SImm7;
787 // Inherit Rt2 in 14-10
792 // Format for Load-store non-temporal register pair (offset) instructions
793 class A64I_LSPnontemp<bits<2> opc, bit v, bit l,
794 dag outs, dag ins, string asmstr,
795 list<dag> patterns, InstrItinClass itin>
796 : A64InstRtt2n<outs, ins, asmstr, patterns, itin> {
799 let Inst{31-30} = opc;
800 let Inst{29-27} = 0b101;
802 let Inst{25-23} = 0b000;
804 let Inst{21-15} = SImm7;
805 // Inherit Rt2 in 14-10
810 // Format for Logical (immediate) instructions
811 class A64I_logicalimm<bit sf, bits<2> opc,
812 dag outs, dag ins, string asmstr,
813 list<dag> patterns, InstrItinClass itin>
814 : A64InstRdn<outs, ins, asmstr, patterns, itin> {
819 // N, ImmR and ImmS have no separate existence in any assembly syntax (or for
820 // selection), so we'll combine them into a single field here.
827 let Inst{30-29} = opc;
828 let Inst{28-23} = 0b100100;
829 let Inst{22} = Imm{12};
830 let Inst{21-16} = Imm{11-6};
831 let Inst{15-10} = Imm{5-0};
832 // Rn inherited in 9-5
833 // Rd inherited in 4-0
836 // Format for Logical (shifted register) instructions
837 class A64I_logicalshift<bit sf, bits<2> opc, bits<2> shift, bit N,
838 dag outs, dag ins, string asmstr,
839 list<dag> patterns, InstrItinClass itin>
840 : A64InstRdnm<outs, ins, asmstr, patterns, itin> {
844 let Inst{30-29} = opc;
845 let Inst{28-24} = 0b01010;
846 let Inst{23-22} = shift;
849 let Inst{15-10} = Imm6;
854 // Format for Move wide (immediate)
855 class A64I_movw<bit sf, bits<2> opc,
856 dag outs, dag ins, string asmstr,
857 list<dag> patterns, InstrItinClass itin>
858 : A64InstRd<outs, ins, asmstr, patterns, itin> {
860 bits<2> Shift; // Called "hw" officially
863 let Inst{30-29} = opc;
864 let Inst{28-23} = 0b100101;
865 let Inst{22-21} = Shift;
866 let Inst{20-5} = UImm16;
867 // Inherits Rd in 4-0
870 // Format for PC-relative addressing instructions, ADR and ADRP.
871 class A64I_PCADR<bit op,
872 dag outs, dag ins, string asmstr,
873 list<dag> patterns, InstrItinClass itin>
874 : A64InstRd<outs, ins, asmstr, patterns, itin> {
878 let Inst{30-29} = Label{1-0};
879 let Inst{28-24} = 0b10000;
880 let Inst{23-5} = Label{20-2};
883 // Format for system instructions
884 class A64I_system<bit l,
885 dag outs, dag ins, string asmstr,
886 list<dag> patterns, InstrItinClass itin>
887 : A64Inst<outs, ins, asmstr, patterns, itin> {
895 let Inst{31-22} = 0b1101010100;
897 let Inst{20-19} = Op0;
898 let Inst{18-16} = Op1;
899 let Inst{15-12} = CRn;
900 let Inst{11-8} = CRm;
904 // These instructions can do horrible things.
905 let hasSideEffects = 1;
908 // Format for unconditional branch (immediate) instructions
909 class A64I_Bimm<bit op,
910 dag outs, dag ins, string asmstr,
911 list<dag> patterns, InstrItinClass itin>
912 : A64Inst<outs, ins, asmstr, patterns, itin> {
913 // Doubly special in not even sharing register fields with other
914 // instructions, so we create our own Rn here.
918 let Inst{30-26} = 0b00101;
919 let Inst{25-0} = Label;
922 // Format for Test & branch (immediate) instructions
923 class A64I_TBimm<bit op,
924 dag outs, dag ins, string asmstr,
925 list<dag> patterns, InstrItinClass itin>
926 : A64InstRt<outs, ins, asmstr, patterns, itin> {
927 // Doubly special in not even sharing register fields with other
928 // instructions, so we create our own Rn here.
932 let Inst{31} = Imm{5};
933 let Inst{30-25} = 0b011011;
935 let Inst{23-19} = Imm{4-0};
936 let Inst{18-5} = Label;
940 // Format for Unconditional branch (register) instructions, including
941 // RET. Shares no fields with instructions further up the hierarchy
943 class A64I_Breg<bits<4> opc, bits<5> op2, bits<6> op3, bits<5> op4,
944 dag outs, dag ins, string asmstr,
945 list<dag> patterns, InstrItinClass itin>
946 : A64Inst<outs, ins, asmstr, patterns, itin> {
947 // Doubly special in not even sharing register fields with other
948 // instructions, so we create our own Rn here.
951 let Inst{31-25} = 0b1101011;
952 let Inst{24-21} = opc;
953 let Inst{20-16} = op2;
954 let Inst{15-10} = op3;