1 //===- PowerPCInstrFormats.td - PowerPC Instruction Formats --*- tablegen -*-=//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
11 // PowerPC instruction formats
13 class I<bits<6> opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin>
16 field bits<32> SoftFail = 0;
19 bit PPC64 = 0; // Default value, override with isPPC64
21 let Namespace = "PPC";
22 let Inst{0-5} = opcode;
23 let OutOperandList = OOL;
24 let InOperandList = IOL;
25 let AsmString = asmstr;
28 bits<1> PPC970_First = 0;
29 bits<1> PPC970_Single = 0;
30 bits<1> PPC970_Cracked = 0;
31 bits<3> PPC970_Unit = 0;
33 /// These fields correspond to the fields in PPCInstrInfo.h. Any changes to
34 /// these must be reflected there! See comments there for what these are.
35 let TSFlags{0} = PPC970_First;
36 let TSFlags{1} = PPC970_Single;
37 let TSFlags{2} = PPC970_Cracked;
38 let TSFlags{5-3} = PPC970_Unit;
40 // Indicate that this instruction is of type X-Form Load or Store
41 bits<1> XFormMemOp = 0;
42 let TSFlags{6} = XFormMemOp;
44 // Indicate that this instruction is prefixed.
46 let TSFlags{7} = Prefixed;
48 // Fields used for relation models.
51 // For cases where multiple instruction definitions really represent the
52 // same underlying instruction but with one definition for 64-bit arguments
53 // and one for 32-bit arguments, this bit breaks the degeneracy between
54 // the two forms and allows TableGen to generate mapping tables.
55 bit Interpretation64Bit = 0;
58 class PPC970_DGroup_First { bits<1> PPC970_First = 1; }
59 class PPC970_DGroup_Single { bits<1> PPC970_Single = 1; }
60 class PPC970_DGroup_Cracked { bits<1> PPC970_Cracked = 1; }
61 class PPC970_MicroCode;
63 class PPC970_Unit_Pseudo { bits<3> PPC970_Unit = 0; }
64 class PPC970_Unit_FXU { bits<3> PPC970_Unit = 1; }
65 class PPC970_Unit_LSU { bits<3> PPC970_Unit = 2; }
66 class PPC970_Unit_FPU { bits<3> PPC970_Unit = 3; }
67 class PPC970_Unit_CRU { bits<3> PPC970_Unit = 4; }
68 class PPC970_Unit_VALU { bits<3> PPC970_Unit = 5; }
69 class PPC970_Unit_VPERM { bits<3> PPC970_Unit = 6; }
70 class PPC970_Unit_BRU { bits<3> PPC970_Unit = 7; }
72 class XFormMemOp { bits<1> XFormMemOp = 1; }
74 // Two joined instructions; used to emit two adjacent instructions as one.
75 // The itinerary from the first instruction is used for scheduling and
77 class I2<bits<6> opcode1, bits<6> opcode2, dag OOL, dag IOL, string asmstr,
81 field bits<64> SoftFail = 0;
84 bit PPC64 = 0; // Default value, override with isPPC64
86 let Namespace = "PPC";
87 let Inst{0-5} = opcode1;
88 let Inst{32-37} = opcode2;
89 let OutOperandList = OOL;
90 let InOperandList = IOL;
91 let AsmString = asmstr;
94 bits<1> PPC970_First = 0;
95 bits<1> PPC970_Single = 0;
96 bits<1> PPC970_Cracked = 0;
97 bits<3> PPC970_Unit = 0;
99 /// These fields correspond to the fields in PPCInstrInfo.h. Any changes to
100 /// these must be reflected there! See comments there for what these are.
101 let TSFlags{0} = PPC970_First;
102 let TSFlags{1} = PPC970_Single;
103 let TSFlags{2} = PPC970_Cracked;
104 let TSFlags{5-3} = PPC970_Unit;
106 // Fields used for relation models.
107 string BaseName = "";
108 bit Interpretation64Bit = 0;
111 // Base class for all X-Form memory instructions
112 class IXFormMemOp<bits<6> opcode, dag OOL, dag IOL, string asmstr,
114 :I<opcode, OOL, IOL, asmstr, itin>, XFormMemOp;
117 class IForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr,
118 InstrItinClass itin, list<dag> pattern>
119 : I<opcode, OOL, IOL, asmstr, itin> {
120 let Pattern = pattern;
129 class BForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr>
130 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
131 bits<7> BIBO; // 2 bits of BI and 5 bits of BO.
136 let BI{0-1} = BIBO{5-6};
137 let BI{2-4} = CR{0-2};
139 let Inst{6-10} = BIBO{4-0};
140 let Inst{11-15} = BI;
141 let Inst{16-29} = BD;
146 class BForm_1<bits<6> opcode, bits<5> bo, bit aa, bit lk, dag OOL, dag IOL,
148 : BForm<opcode, aa, lk, OOL, IOL, asmstr> {
154 class BForm_2<bits<6> opcode, bits<5> bo, bits<5> bi, bit aa, bit lk,
155 dag OOL, dag IOL, string asmstr>
156 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
160 let Inst{11-15} = bi;
161 let Inst{16-29} = BD;
166 class BForm_3<bits<6> opcode, bit aa, bit lk,
167 dag OOL, dag IOL, string asmstr>
168 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
174 let Inst{11-15} = BI;
175 let Inst{16-29} = BD;
180 class BForm_3_at<bits<6> opcode, bit aa, bit lk,
181 dag OOL, dag IOL, string asmstr>
182 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
188 let Inst{6-8} = BO{4-2};
190 let Inst{11-15} = BI;
191 let Inst{16-29} = BD;
196 class BForm_4<bits<6> opcode, bits<5> bo, bit aa, bit lk,
197 dag OOL, dag IOL, string asmstr>
198 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
203 let Inst{11-15} = BI;
204 let Inst{16-29} = BD;
210 class SCForm<bits<6> opcode, bits<1> xo,
211 dag OOL, dag IOL, string asmstr, InstrItinClass itin,
213 : I<opcode, OOL, IOL, asmstr, itin> {
216 let Pattern = pattern;
218 let Inst{20-26} = LEV;
223 class DForm_base<bits<6> opcode, dag OOL, dag IOL, string asmstr,
224 InstrItinClass itin, list<dag> pattern>
225 : I<opcode, OOL, IOL, asmstr, itin> {
230 let Pattern = pattern;
237 class DForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
238 InstrItinClass itin, list<dag> pattern>
239 : I<opcode, OOL, IOL, asmstr, itin> {
243 let Pattern = pattern;
246 let Inst{11-15} = Addr{20-16}; // Base Reg
247 let Inst{16-31} = Addr{15-0}; // Displacement
250 class DForm_1a<bits<6> opcode, dag OOL, dag IOL, string asmstr,
251 InstrItinClass itin, list<dag> pattern>
252 : I<opcode, OOL, IOL, asmstr, itin> {
257 let Pattern = pattern;
265 class DForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
266 InstrItinClass itin, list<dag> pattern>
267 : DForm_base<opcode, OOL, IOL, asmstr, itin, pattern> {
269 // Even though ADDIC_rec does not really have an RC bit, provide
270 // the declaration of one here so that isRecordForm has something to set.
274 class DForm_2_r0<bits<6> opcode, dag OOL, dag IOL, string asmstr,
275 InstrItinClass itin, list<dag> pattern>
276 : I<opcode, OOL, IOL, asmstr, itin> {
280 let Pattern = pattern;
287 class DForm_4<bits<6> opcode, dag OOL, dag IOL, string asmstr,
288 InstrItinClass itin, list<dag> pattern>
289 : I<opcode, OOL, IOL, asmstr, itin> {
294 let Pattern = pattern;
301 class DForm_4_zero<bits<6> opcode, dag OOL, dag IOL, string asmstr,
302 InstrItinClass itin, list<dag> pattern>
303 : DForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
308 class DForm_4_fixedreg_zero<bits<6> opcode, bits<5> R, dag OOL, dag IOL,
309 string asmstr, InstrItinClass itin,
311 : DForm_4<opcode, OOL, IOL, asmstr, itin, pattern> {
317 class IForm_and_DForm_1<bits<6> opcode1, bit aa, bit lk, bits<6> opcode2,
318 dag OOL, dag IOL, string asmstr,
319 InstrItinClass itin, list<dag> pattern>
320 : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
324 let Pattern = pattern;
332 let Inst{43-47} = Addr{20-16}; // Base Reg
333 let Inst{48-63} = Addr{15-0}; // Displacement
336 // This is used to emit BL8+NOP.
337 class IForm_and_DForm_4_zero<bits<6> opcode1, bit aa, bit lk, bits<6> opcode2,
338 dag OOL, dag IOL, string asmstr,
339 InstrItinClass itin, list<dag> pattern>
340 : IForm_and_DForm_1<opcode1, aa, lk, opcode2,
341 OOL, IOL, asmstr, itin, pattern> {
346 class DForm_5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
348 : I<opcode, OOL, IOL, asmstr, itin> {
357 let Inst{11-15} = RA;
361 class DForm_5_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
363 : DForm_5<opcode, OOL, IOL, asmstr, itin> {
367 class DForm_6<bits<6> opcode, dag OOL, dag IOL, string asmstr,
369 : DForm_5<opcode, OOL, IOL, asmstr, itin>;
371 class DForm_6_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
373 : DForm_6<opcode, OOL, IOL, asmstr, itin> {
379 class DSForm_1<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
380 InstrItinClass itin, list<dag> pattern>
381 : I<opcode, OOL, IOL, asmstr, itin> {
385 let Pattern = pattern;
387 let Inst{6-10} = RST;
388 let Inst{11-15} = DS_RA{18-14}; // Register #
389 let Inst{16-29} = DS_RA{13-0}; // Displacement.
390 let Inst{30-31} = xo;
393 // ISA V3.0B 1.6.6 DX-Form
394 class DXForm<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
395 InstrItinClass itin, list<dag> pattern>
396 : I<opcode, OOL, IOL, asmstr, itin> {
400 let Pattern = pattern;
403 let Inst{11-15} = D{5-1}; // d1
404 let Inst{16-25} = D{15-6}; // d0
405 let Inst{26-30} = xo;
406 let Inst{31} = D{0}; // d2
409 // DQ-Form: [PO T RA DQ TX XO] or [PO S RA DQ SX XO]
410 class DQ_RD6_RS5_DQ12<bits<6> opcode, bits<3> xo, dag OOL, dag IOL,
411 string asmstr, InstrItinClass itin, list<dag> pattern>
412 : I<opcode, OOL, IOL, asmstr, itin> {
416 let Pattern = pattern;
418 let Inst{6-10} = XT{4-0};
419 let Inst{11-15} = DS_RA{16-12}; // Register #
420 let Inst{16-27} = DS_RA{11-0}; // Displacement.
421 let Inst{28} = XT{5};
422 let Inst{29-31} = xo;
425 class DQForm_RTp5_RA17_MEM<bits<6> opcode, bits<4> xo, dag OOL, dag IOL,
426 string asmstr, InstrItinClass itin,
428 : I<opcode, OOL, IOL, asmstr, itin> {
431 let Pattern = pattern;
433 let Inst{6-10} = RTp{4-0};
434 let Inst{11-15} = DQ_RA{16-12}; // Register #
435 let Inst{16-27} = DQ_RA{11-0}; // Displacement.
436 let Inst{28-31} = xo;
440 class XForm_base_r3xo<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
441 InstrItinClass itin, list<dag> pattern>
442 : I<opcode, OOL, IOL, asmstr, itin> {
447 let Pattern = pattern;
449 bit RC = 0; // set by isRecordForm
451 let Inst{6-10} = RST;
454 let Inst{21-30} = xo;
458 class XForm_base_r3xo_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
459 string asmstr, InstrItinClass itin,
461 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>, XFormMemOp;
463 class XForm_tlb<bits<10> xo, dag OOL, dag IOL, string asmstr,
464 InstrItinClass itin> : XForm_base_r3xo<31, xo, OOL, IOL, asmstr, itin, []> {
468 class XForm_attn<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
470 : I<opcode, OOL, IOL, asmstr, itin> {
471 let Inst{21-30} = xo;
474 // This is the same as XForm_base_r3xo, but the first two operands are swapped
475 // when code is emitted.
476 class XForm_base_r3xo_swapped
477 <bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
479 : I<opcode, OOL, IOL, asmstr, itin> {
484 bit RC = 0; // set by isRecordForm
486 let Inst{6-10} = RST;
489 let Inst{21-30} = xo;
494 class XForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
495 InstrItinClass itin, list<dag> pattern>
496 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
498 class XForm_1_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
499 InstrItinClass itin, list<dag> pattern>
500 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
502 class XForm_1a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
503 InstrItinClass itin, list<dag> pattern>
504 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
508 class XForm_rs<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
509 InstrItinClass itin, list<dag> pattern>
510 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
515 class XForm_tlbws<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
516 InstrItinClass itin, list<dag> pattern>
517 : I<opcode, OOL, IOL, asmstr, itin> {
522 let Pattern = pattern;
524 let Inst{6-10} = RST;
527 let Inst{21-30} = xo;
531 class XForm_6<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
532 InstrItinClass itin, list<dag> pattern>
533 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
534 let Pattern = pattern;
537 class XForm_8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
538 InstrItinClass itin, list<dag> pattern>
539 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
541 class XForm_8_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
542 InstrItinClass itin, list<dag> pattern>
543 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
545 class XForm_10<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
546 InstrItinClass itin, list<dag> pattern>
547 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
548 let Pattern = pattern;
551 class XForm_11<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
552 InstrItinClass itin, list<dag> pattern>
553 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
555 let Pattern = pattern;
558 class XForm_16<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
560 : I<opcode, OOL, IOL, asmstr, itin> {
569 let Inst{11-15} = RA;
570 let Inst{16-20} = RB;
571 let Inst{21-30} = xo;
575 class XForm_icbt<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
577 : I<opcode, OOL, IOL, asmstr, itin> {
584 let Inst{11-15} = RA;
585 let Inst{16-20} = RB;
586 let Inst{21-30} = xo;
590 class XForm_sr<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
592 : I<opcode, OOL, IOL, asmstr, itin> {
597 let Inst{12-15} = SR;
598 let Inst{21-30} = xo;
601 class XForm_mbar<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
603 : I<opcode, OOL, IOL, asmstr, itin> {
607 let Inst{21-30} = xo;
610 class XForm_srin<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
612 : I<opcode, OOL, IOL, asmstr, itin> {
617 let Inst{16-20} = RB;
618 let Inst{21-30} = xo;
621 class XForm_mtmsr<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
623 : I<opcode, OOL, IOL, asmstr, itin> {
629 let Inst{21-30} = xo;
632 class XForm_16_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
634 : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
638 class XForm_17<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
640 : I<opcode, OOL, IOL, asmstr, itin> {
647 let Inst{11-15} = FRA;
648 let Inst{16-20} = FRB;
649 let Inst{21-30} = xo;
653 class XForm_17a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
654 InstrItinClass itin, list<dag> pattern>
655 : XForm_17<opcode, xo, OOL, IOL, asmstr, itin > {
657 let Pattern = pattern;
660 class XForm_18<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
661 InstrItinClass itin, list<dag> pattern>
662 : I<opcode, OOL, IOL, asmstr, itin> {
667 let Pattern = pattern;
669 let Inst{6-10} = FRT;
670 let Inst{11-15} = FRA;
671 let Inst{16-20} = FRB;
672 let Inst{21-30} = xo;
676 class XForm_19<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
677 InstrItinClass itin, list<dag> pattern>
678 : XForm_18<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
682 class XForm_20<bits<6> opcode, bits<6> xo, dag OOL, dag IOL, string asmstr,
683 InstrItinClass itin, list<dag> pattern>
684 : I<opcode, OOL, IOL, asmstr, itin> {
690 let Pattern = pattern;
692 let Inst{6-10} = FRT;
693 let Inst{11-15} = FRA;
694 let Inst{16-20} = FRB;
695 let Inst{21-24} = tttt;
696 let Inst{25-30} = xo;
700 class XForm_24<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
701 InstrItinClass itin, list<dag> pattern>
702 : I<opcode, OOL, IOL, asmstr, itin> {
703 let Pattern = pattern;
707 let Inst{21-30} = xo;
711 class XForm_24_sync<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
712 string asmstr, InstrItinClass itin, list<dag> pattern>
713 : I<opcode, OOL, IOL, asmstr, itin> {
716 let Pattern = pattern;
721 let Inst{21-30} = xo;
725 class XForm_24_eieio<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
726 string asmstr, InstrItinClass itin, list<dag> pattern>
727 : XForm_24_sync<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
731 class XForm_25<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
732 InstrItinClass itin, list<dag> pattern>
733 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
736 class XForm_25_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
737 string asmstr, InstrItinClass itin, list<dag> pattern>
738 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
741 // [PO RT /// RB XO RC]
742 class XForm_26<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
743 InstrItinClass itin, list<dag> pattern>
744 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
748 class XForm_28_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
749 string asmstr, InstrItinClass itin, list<dag> pattern>
750 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
753 class XForm_28<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
754 InstrItinClass itin, list<dag> pattern>
755 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
758 // This is used for MFFS, MTFSB0, MTFSB1. 42 is arbitrary; this series of
759 // numbers presumably relates to some document, but I haven't found it.
760 class XForm_42<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
761 InstrItinClass itin, list<dag> pattern>
762 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
763 let Pattern = pattern;
765 bit RC = 0; // set by isRecordForm
767 let Inst{6-10} = RST;
769 let Inst{21-30} = xo;
772 class XForm_43<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
773 InstrItinClass itin, list<dag> pattern>
774 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
775 let Pattern = pattern;
778 bit RC = 0; // set by isRecordForm
782 let Inst{21-30} = xo;
786 class XForm_44<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
788 : I<opcode, OOL, IOL, asmstr, itin> {
793 let Inst{11-13} = BFA;
796 let Inst{21-30} = xo;
800 class XForm_45<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
802 : I<opcode, OOL, IOL, asmstr, itin> {
810 let Inst{21-30} = xo;
814 class X_FRT5_XO2_XO3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2, bits<10> xo,
815 dag OOL, dag IOL, string asmstr, InstrItinClass itin,
817 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
818 let Pattern = pattern;
820 let Inst{6-10} = RST;
821 let Inst{11-12} = xo1;
822 let Inst{13-15} = xo2;
824 let Inst{21-30} = xo;
828 class X_FRT5_XO2_XO3_FRB5_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
829 bits<10> xo, dag OOL, dag IOL, string asmstr,
830 InstrItinClass itin, list<dag> pattern>
831 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
832 let Pattern = pattern;
835 let Inst{6-10} = RST;
836 let Inst{11-12} = xo1;
837 let Inst{13-15} = xo2;
838 let Inst{16-20} = FRB;
839 let Inst{21-30} = xo;
843 class X_FRT5_XO2_XO3_DRM3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
844 bits<10> xo, dag OOL, dag IOL, string asmstr,
845 InstrItinClass itin, list<dag> pattern>
846 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
847 let Pattern = pattern;
850 let Inst{6-10} = RST;
851 let Inst{11-12} = xo1;
852 let Inst{13-15} = xo2;
854 let Inst{18-20} = DRM;
855 let Inst{21-30} = xo;
859 class X_FRT5_XO2_XO3_RM2_X10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
860 bits<10> xo, dag OOL, dag IOL, string asmstr,
861 InstrItinClass itin, list<dag> pattern>
862 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
863 let Pattern = pattern;
866 let Inst{6-10} = RST;
867 let Inst{11-12} = xo1;
868 let Inst{13-15} = xo2;
870 let Inst{19-20} = RM;
871 let Inst{21-30} = xo;
876 class XForm_0<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
877 InstrItinClass itin, list<dag> pattern>
878 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
884 class XForm_16b<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
885 InstrItinClass itin, list<dag> pattern>
886 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
891 class XForm_htm0<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
892 string asmstr, InstrItinClass itin, list<dag> pattern>
893 : I<opcode, OOL, IOL, asmstr, itin> {
901 let Inst{21-30} = xo;
905 class XForm_htm1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
906 string asmstr, InstrItinClass itin, list<dag> pattern>
907 : I<opcode, OOL, IOL, asmstr, itin> {
914 let Inst{21-30} = xo;
918 class XForm_htm2<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
919 InstrItinClass itin, list<dag> pattern>
920 : I<opcode, OOL, IOL, asmstr, itin> {
923 bit RC = 0; // set by isRecordForm
928 let Inst{21-30} = xo;
932 class XForm_htm3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
933 InstrItinClass itin, list<dag> pattern>
934 : I<opcode, OOL, IOL, asmstr, itin> {
941 let Inst{21-30} = xo;
945 // [PO RT RA RB XO /]
946 class X_BF3_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
947 string asmstr, InstrItinClass itin, list<dag> pattern>
948 : I<opcode, OOL, IOL, asmstr, itin> {
954 let Pattern = pattern;
959 let Inst{11-15} = RA;
960 let Inst{16-20} = RB;
961 let Inst{21-30} = xo;
965 // Same as XForm_17 but with GPR's and new naming convention
966 class X_BF3_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
967 string asmstr, InstrItinClass itin, list<dag> pattern>
968 : I<opcode, OOL, IOL, asmstr, itin> {
973 let Pattern = pattern;
977 let Inst{11-15} = RA;
978 let Inst{16-20} = RB;
979 let Inst{21-30} = xo;
983 // e.g. [PO VRT XO VRB XO /] or [PO VRT XO VRB XO RO]
984 class X_RD5_XO5_RS5<bits<6> opcode, bits<5> xo2, bits<10> xo, dag OOL, dag IOL,
985 string asmstr, InstrItinClass itin, list<dag> pattern>
986 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
990 class X_BF3_DCMX7_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
991 string asmstr, InstrItinClass itin, list<dag> pattern>
992 : I<opcode, OOL, IOL, asmstr, itin> {
997 let Pattern = pattern;
1000 let Inst{9-15} = DCMX;
1001 let Inst{16-20} = VB;
1002 let Inst{21-30} = xo;
1006 class X_RD6_IMM8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1007 string asmstr, InstrItinClass itin, list<dag> pattern>
1008 : I<opcode, OOL, IOL, asmstr, itin> {
1012 let Pattern = pattern;
1014 let Inst{6-10} = XT{4-0};
1015 let Inst{11-12} = 0;
1016 let Inst{13-20} = IMM8;
1017 let Inst{21-30} = xo;
1018 let Inst{31} = XT{5};
1021 // XForm_base_r3xo for instructions such as P9 atomics where we don't want
1022 // to specify an SDAG pattern for matching.
1023 class X_RD5_RS5_IM5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1024 string asmstr, InstrItinClass itin>
1025 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, []> {
1028 class X_BF3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1029 InstrItinClass itin>
1030 : XForm_17<opcode, xo, OOL, IOL, asmstr, itin> {
1035 // [PO /// L RA RB XO /]
1036 class X_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1037 string asmstr, InstrItinClass itin, list<dag> pattern>
1038 : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
1040 let Pattern = pattern;
1047 class XX1Form<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1048 InstrItinClass itin, list<dag> pattern>
1049 : I<opcode, OOL, IOL, asmstr, itin> {
1054 let Pattern = pattern;
1056 let Inst{6-10} = XT{4-0};
1057 let Inst{11-15} = A;
1058 let Inst{16-20} = B;
1059 let Inst{21-30} = xo;
1060 let Inst{31} = XT{5};
1063 class XX1Form_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1064 string asmstr, InstrItinClass itin, list<dag> pattern>
1065 : XX1Form<opcode, xo, OOL, IOL, asmstr, itin, pattern>, XFormMemOp;
1067 class XX1_RS6_RD5_XO<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1068 string asmstr, InstrItinClass itin, list<dag> pattern>
1069 : XX1Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1073 class XX2Form<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
1074 InstrItinClass itin, list<dag> pattern>
1075 : I<opcode, OOL, IOL, asmstr, itin> {
1079 let Pattern = pattern;
1081 let Inst{6-10} = XT{4-0};
1082 let Inst{11-15} = 0;
1083 let Inst{16-20} = XB{4-0};
1084 let Inst{21-29} = xo;
1085 let Inst{30} = XB{5};
1086 let Inst{31} = XT{5};
1089 class XX2Form_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
1090 InstrItinClass itin, list<dag> pattern>
1091 : I<opcode, OOL, IOL, asmstr, itin> {
1095 let Pattern = pattern;
1099 let Inst{16-20} = XB{4-0};
1100 let Inst{21-29} = xo;
1101 let Inst{30} = XB{5};
1105 class XX2Form_2<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
1106 InstrItinClass itin, list<dag> pattern>
1107 : I<opcode, OOL, IOL, asmstr, itin> {
1112 let Pattern = pattern;
1114 let Inst{6-10} = XT{4-0};
1115 let Inst{11-13} = 0;
1116 let Inst{14-15} = D;
1117 let Inst{16-20} = XB{4-0};
1118 let Inst{21-29} = xo;
1119 let Inst{30} = XB{5};
1120 let Inst{31} = XT{5};
1123 class XX2_RD6_UIM5_RS6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
1124 string asmstr, InstrItinClass itin, list<dag> pattern>
1125 : I<opcode, OOL, IOL, asmstr, itin> {
1130 let Pattern = pattern;
1132 let Inst{6-10} = XT{4-0};
1133 let Inst{11-15} = UIM5;
1134 let Inst{16-20} = XB{4-0};
1135 let Inst{21-29} = xo;
1136 let Inst{30} = XB{5};
1137 let Inst{31} = XT{5};
1140 // [PO T XO B XO BX /]
1141 class XX2_RD5_XO5_RS6<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL, dag IOL,
1142 string asmstr, InstrItinClass itin, list<dag> pattern>
1143 : I<opcode, OOL, IOL, asmstr, itin> {
1147 let Pattern = pattern;
1149 let Inst{6-10} = RT;
1150 let Inst{11-15} = xo2;
1151 let Inst{16-20} = XB{4-0};
1152 let Inst{21-29} = xo;
1153 let Inst{30} = XB{5};
1157 // [PO T XO B XO BX TX]
1158 class XX2_RD6_XO5_RS6<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL, dag IOL,
1159 string asmstr, InstrItinClass itin, list<dag> pattern>
1160 : I<opcode, OOL, IOL, asmstr, itin> {
1164 let Pattern = pattern;
1166 let Inst{6-10} = XT{4-0};
1167 let Inst{11-15} = xo2;
1168 let Inst{16-20} = XB{4-0};
1169 let Inst{21-29} = xo;
1170 let Inst{30} = XB{5};
1171 let Inst{31} = XT{5};
1174 class XX2_BF3_DCMX7_RS6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
1175 string asmstr, InstrItinClass itin, list<dag> pattern>
1176 : I<opcode, OOL, IOL, asmstr, itin> {
1181 let Pattern = pattern;
1184 let Inst{9-15} = DCMX;
1185 let Inst{16-20} = XB{4-0};
1186 let Inst{21-29} = xo;
1187 let Inst{30} = XB{5};
1191 class XX2_RD6_DCMX7_RS6<bits<6> opcode, bits<4> xo1, bits<3> xo2,
1192 dag OOL, dag IOL, string asmstr, InstrItinClass itin,
1194 : I<opcode, OOL, IOL, asmstr, itin> {
1199 let Pattern = pattern;
1201 let Inst{6-10} = XT{4-0};
1202 let Inst{11-15} = DCMX{4-0};
1203 let Inst{16-20} = XB{4-0};
1204 let Inst{21-24} = xo1;
1205 let Inst{25} = DCMX{6};
1206 let Inst{26-28} = xo2;
1207 let Inst{29} = DCMX{5};
1208 let Inst{30} = XB{5};
1209 let Inst{31} = XT{5};
1212 class XForm_XD6_RA5_RB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1213 string asmstr, InstrItinClass itin, list<dag> pattern>
1214 : I<opcode, OOL, IOL, asmstr, itin> {
1218 let Pattern = pattern;
1220 let Inst{6-10} = D_RA_XD{4-0}; // D
1221 let Inst{11-15} = D_RA_XD{10-6}; // RA
1222 let Inst{16-20} = RB;
1223 let Inst{21-30} = xo;
1224 let Inst{31} = D_RA_XD{5}; // DX
1227 class XX3Form<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
1228 InstrItinClass itin, list<dag> pattern>
1229 : I<opcode, OOL, IOL, asmstr, itin> {
1234 let Pattern = pattern;
1236 let Inst{6-10} = XT{4-0};
1237 let Inst{11-15} = XA{4-0};
1238 let Inst{16-20} = XB{4-0};
1239 let Inst{21-28} = xo;
1240 let Inst{29} = XA{5};
1241 let Inst{30} = XB{5};
1242 let Inst{31} = XT{5};
1245 class XX3Form_SameOp<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
1246 InstrItinClass itin, list<dag> pattern>
1247 : XX3Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1252 class XX3Form_1<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
1253 InstrItinClass itin, list<dag> pattern>
1254 : I<opcode, OOL, IOL, asmstr, itin> {
1259 let Pattern = pattern;
1263 let Inst{11-15} = XA{4-0};
1264 let Inst{16-20} = XB{4-0};
1265 let Inst{21-28} = xo;
1266 let Inst{29} = XA{5};
1267 let Inst{30} = XB{5};
1271 class XX3Form_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1272 InstrItinClass itin, list<dag> pattern>
1273 : I<opcode, OOL, IOL, asmstr, itin> {
1279 let Pattern = pattern;
1281 let Inst{6-10} = XT{4-0};
1282 let Inst{11-15} = XA{4-0};
1283 let Inst{16-20} = XB{4-0};
1285 let Inst{22-23} = D;
1286 let Inst{24-28} = xo;
1287 let Inst{29} = XA{5};
1288 let Inst{30} = XB{5};
1289 let Inst{31} = XT{5};
1292 class XX3Form_Rc<bits<6> opcode, bits<7> xo, dag OOL, dag IOL, string asmstr,
1293 InstrItinClass itin, list<dag> pattern>
1294 : I<opcode, OOL, IOL, asmstr, itin> {
1299 let Pattern = pattern;
1301 bit RC = 0; // set by isRecordForm
1303 let Inst{6-10} = XT{4-0};
1304 let Inst{11-15} = XA{4-0};
1305 let Inst{16-20} = XB{4-0};
1307 let Inst{22-28} = xo;
1308 let Inst{29} = XA{5};
1309 let Inst{30} = XB{5};
1310 let Inst{31} = XT{5};
1313 class XX4Form<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
1314 InstrItinClass itin, list<dag> pattern>
1315 : I<opcode, OOL, IOL, asmstr, itin> {
1321 let Pattern = pattern;
1323 let Inst{6-10} = XT{4-0};
1324 let Inst{11-15} = XA{4-0};
1325 let Inst{16-20} = XB{4-0};
1326 let Inst{21-25} = XC{4-0};
1327 let Inst{26-27} = xo;
1328 let Inst{28} = XC{5};
1329 let Inst{29} = XA{5};
1330 let Inst{30} = XB{5};
1331 let Inst{31} = XT{5};
1334 // DCB_Form - Form X instruction, used for dcb* instructions.
1335 class DCB_Form<bits<10> xo, bits<5> immfield, dag OOL, dag IOL, string asmstr,
1336 InstrItinClass itin, list<dag> pattern>
1337 : I<31, OOL, IOL, asmstr, itin> {
1341 let Pattern = pattern;
1343 let Inst{6-10} = immfield;
1344 let Inst{11-15} = A;
1345 let Inst{16-20} = B;
1346 let Inst{21-30} = xo;
1350 class DCB_Form_hint<bits<10> xo, dag OOL, dag IOL, string asmstr,
1351 InstrItinClass itin, list<dag> pattern>
1352 : I<31, OOL, IOL, asmstr, itin> {
1357 let Pattern = pattern;
1359 let Inst{6-10} = TH;
1360 let Inst{11-15} = A;
1361 let Inst{16-20} = B;
1362 let Inst{21-30} = xo;
1366 // DSS_Form - Form X instruction, used for altivec dss* instructions.
1367 class DSS_Form<bits<1> T, bits<10> xo, dag OOL, dag IOL, string asmstr,
1368 InstrItinClass itin, list<dag> pattern>
1369 : I<31, OOL, IOL, asmstr, itin> {
1374 let Pattern = pattern;
1378 let Inst{9-10} = STRM;
1379 let Inst{11-15} = A;
1380 let Inst{16-20} = B;
1381 let Inst{21-30} = xo;
1386 class XLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1387 InstrItinClass itin, list<dag> pattern>
1388 : I<opcode, OOL, IOL, asmstr, itin> {
1393 let Pattern = pattern;
1395 let Inst{6-10} = CRD;
1396 let Inst{11-15} = CRA;
1397 let Inst{16-20} = CRB;
1398 let Inst{21-30} = xo;
1402 class XLForm_1_np<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1403 InstrItinClass itin, list<dag> pattern>
1404 : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1410 class XLForm_1_gen<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1411 InstrItinClass itin, list<dag> pattern>
1412 : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1421 class XLForm_1_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1422 InstrItinClass itin, list<dag> pattern>
1423 : I<opcode, OOL, IOL, asmstr, itin> {
1426 let Pattern = pattern;
1428 let Inst{6-10} = CRD;
1429 let Inst{11-15} = CRD;
1430 let Inst{16-20} = CRD;
1431 let Inst{21-30} = xo;
1435 class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, dag OOL, dag IOL, string asmstr,
1436 InstrItinClass itin, list<dag> pattern>
1437 : I<opcode, OOL, IOL, asmstr, itin> {
1442 let Pattern = pattern;
1444 let Inst{6-10} = BO;
1445 let Inst{11-15} = BI;
1446 let Inst{16-18} = 0;
1447 let Inst{19-20} = BH;
1448 let Inst{21-30} = xo;
1452 class XLForm_2_br<bits<6> opcode, bits<10> xo, bit lk,
1453 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
1454 : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
1455 bits<7> BIBO; // 2 bits of BI and 5 bits of BO.
1459 let BI{0-1} = BIBO{5-6};
1460 let BI{2-4} = CR{0-2};
1464 class XLForm_2_br2<bits<6> opcode, bits<10> xo, bits<5> bo, bit lk,
1465 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
1466 : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
1471 class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo, bits<5> bi, bit lk,
1472 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
1473 : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
1479 class XLForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1480 InstrItinClass itin>
1481 : I<opcode, OOL, IOL, asmstr, itin> {
1487 let Inst{11-13} = BFA;
1488 let Inst{14-15} = 0;
1489 let Inst{16-20} = 0;
1490 let Inst{21-30} = xo;
1494 class XLForm_4<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1495 InstrItinClass itin>
1496 : I<opcode, OOL, IOL, asmstr, itin> {
1505 let Inst{11-14} = 0;
1507 let Inst{16-19} = U;
1509 let Inst{21-30} = xo;
1513 class XLForm_S<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1514 InstrItinClass itin, list<dag> pattern>
1515 : I<opcode, OOL, IOL, asmstr, itin> {
1518 let Pattern = pattern;
1522 let Inst{21-30} = xo;
1526 class XLForm_2_and_DSForm_1<bits<6> opcode1, bits<10> xo1, bit lk,
1527 bits<6> opcode2, bits<2> xo2,
1528 dag OOL, dag IOL, string asmstr,
1529 InstrItinClass itin, list<dag> pattern>
1530 : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
1538 let Pattern = pattern;
1540 let Inst{6-10} = BO;
1541 let Inst{11-15} = BI;
1542 let Inst{16-18} = 0;
1543 let Inst{19-20} = BH;
1544 let Inst{21-30} = xo1;
1547 let Inst{38-42} = RST;
1548 let Inst{43-47} = DS_RA{18-14}; // Register #
1549 let Inst{48-61} = DS_RA{13-0}; // Displacement.
1550 let Inst{62-63} = xo2;
1553 class XLForm_2_ext_and_DSForm_1<bits<6> opcode1, bits<10> xo1,
1554 bits<5> bo, bits<5> bi, bit lk,
1555 bits<6> opcode2, bits<2> xo2,
1556 dag OOL, dag IOL, string asmstr,
1557 InstrItinClass itin, list<dag> pattern>
1558 : XLForm_2_and_DSForm_1<opcode1, xo1, lk, opcode2, xo2,
1559 OOL, IOL, asmstr, itin, pattern> {
1565 class XLForm_2_ext_and_DForm_1<bits<6> opcode1, bits<10> xo1, bits<5> bo,
1566 bits<5> bi, bit lk, bits<6> opcode2, dag OOL,
1567 dag IOL, string asmstr, InstrItinClass itin,
1569 : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
1574 let Pattern = pattern;
1576 let Inst{6-10} = bo;
1577 let Inst{11-15} = bi;
1578 let Inst{16-18} = 0;
1579 let Inst{19-20} = 0; // Unused (BH)
1580 let Inst{21-30} = xo1;
1583 let Inst{38-42} = RST;
1584 let Inst{43-47} = D_RA{20-16}; // Base Register
1585 let Inst{48-63} = D_RA{15-0}; // Displacement
1589 class XFXForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1590 InstrItinClass itin>
1591 : I<opcode, OOL, IOL, asmstr, itin> {
1595 let Inst{6-10} = RT;
1596 let Inst{11} = SPR{4};
1597 let Inst{12} = SPR{3};
1598 let Inst{13} = SPR{2};
1599 let Inst{14} = SPR{1};
1600 let Inst{15} = SPR{0};
1601 let Inst{16} = SPR{9};
1602 let Inst{17} = SPR{8};
1603 let Inst{18} = SPR{7};
1604 let Inst{19} = SPR{6};
1605 let Inst{20} = SPR{5};
1606 let Inst{21-30} = xo;
1610 class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
1611 dag OOL, dag IOL, string asmstr, InstrItinClass itin>
1612 : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin> {
1616 class XFXForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1617 InstrItinClass itin>
1618 : I<opcode, OOL, IOL, asmstr, itin> {
1621 let Inst{6-10} = RT;
1622 let Inst{11-20} = 0;
1623 let Inst{21-30} = xo;
1627 class XFXForm_3p<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1628 InstrItinClass itin, list<dag> pattern>
1629 : I<opcode, OOL, IOL, asmstr, itin> {
1632 let Pattern = pattern;
1634 let Inst{6-10} = RT;
1635 let Inst{11-20} = Entry;
1636 let Inst{21-30} = xo;
1640 class XFXForm_5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1641 InstrItinClass itin>
1642 : I<opcode, OOL, IOL, asmstr, itin> {
1646 let Inst{6-10} = rS;
1648 let Inst{12-19} = FXM;
1650 let Inst{21-30} = xo;
1654 class XFXForm_5a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1655 InstrItinClass itin>
1656 : I<opcode, OOL, IOL, asmstr, itin> {
1660 let Inst{6-10} = ST;
1662 let Inst{12-19} = FXM;
1664 let Inst{21-30} = xo;
1668 class XFXForm_7<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1669 InstrItinClass itin>
1670 : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin>;
1672 class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
1673 dag OOL, dag IOL, string asmstr, InstrItinClass itin>
1674 : XFXForm_7<opcode, xo, OOL, IOL, asmstr, itin> {
1679 // This is probably 1.7.9, but I don't have the reference that uses this
1680 // numbering scheme...
1681 class XFLForm<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1682 InstrItinClass itin, list<dag>pattern>
1683 : I<opcode, OOL, IOL, asmstr, itin> {
1687 bit RC = 0; // set by isRecordForm
1688 let Pattern = pattern;
1691 let Inst{7-14} = FM;
1693 let Inst{16-20} = rT;
1694 let Inst{21-30} = xo;
1698 class XFLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1699 InstrItinClass itin, list<dag>pattern>
1700 : I<opcode, OOL, IOL, asmstr, itin> {
1706 bit RC = 0; // set by isRecordForm
1707 let Pattern = pattern;
1710 let Inst{7-14} = FLM;
1712 let Inst{16-20} = FRB;
1713 let Inst{21-30} = xo;
1717 // 1.7.10 XS-Form - SRADI.
1718 class XSForm_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
1719 InstrItinClass itin, list<dag> pattern>
1720 : I<opcode, OOL, IOL, asmstr, itin> {
1725 bit RC = 0; // set by isRecordForm
1726 let Pattern = pattern;
1728 let Inst{6-10} = RS;
1729 let Inst{11-15} = A;
1730 let Inst{16-20} = SH{4,3,2,1,0};
1731 let Inst{21-29} = xo;
1732 let Inst{30} = SH{5};
1737 class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, string asmstr,
1738 InstrItinClass itin, list<dag> pattern>
1739 : I<opcode, OOL, IOL, asmstr, itin> {
1744 let Pattern = pattern;
1746 bit RC = 0; // set by isRecordForm
1748 let Inst{6-10} = RT;
1749 let Inst{11-15} = RA;
1750 let Inst{16-20} = RB;
1752 let Inst{22-30} = xo;
1756 class XOForm_3<bits<6> opcode, bits<9> xo, bit oe,
1757 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
1758 : XOForm_1<opcode, xo, oe, OOL, IOL, asmstr, itin, pattern> {
1763 class AForm_1<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1764 InstrItinClass itin, list<dag> pattern>
1765 : I<opcode, OOL, IOL, asmstr, itin> {
1771 let Pattern = pattern;
1773 bit RC = 0; // set by isRecordForm
1775 let Inst{6-10} = FRT;
1776 let Inst{11-15} = FRA;
1777 let Inst{16-20} = FRB;
1778 let Inst{21-25} = FRC;
1779 let Inst{26-30} = xo;
1783 class AForm_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1784 InstrItinClass itin, list<dag> pattern>
1785 : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1789 class AForm_3<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1790 InstrItinClass itin, list<dag> pattern>
1791 : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1795 class AForm_4<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1796 InstrItinClass itin, list<dag> pattern>
1797 : I<opcode, OOL, IOL, asmstr, itin> {
1803 let Pattern = pattern;
1805 let Inst{6-10} = RT;
1806 let Inst{11-15} = RA;
1807 let Inst{16-20} = RB;
1808 let Inst{21-25} = COND;
1809 let Inst{26-30} = xo;
1814 class MForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
1815 InstrItinClass itin, list<dag> pattern>
1816 : I<opcode, OOL, IOL, asmstr, itin> {
1823 let Pattern = pattern;
1825 bit RC = 0; // set by isRecordForm
1827 let Inst{6-10} = RS;
1828 let Inst{11-15} = RA;
1829 let Inst{16-20} = RB;
1830 let Inst{21-25} = MB;
1831 let Inst{26-30} = ME;
1835 class MForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
1836 InstrItinClass itin, list<dag> pattern>
1837 : MForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
1841 class MDForm_1<bits<6> opcode, bits<3> xo, dag OOL, dag IOL, string asmstr,
1842 InstrItinClass itin, list<dag> pattern>
1843 : I<opcode, OOL, IOL, asmstr, itin> {
1849 let Pattern = pattern;
1851 bit RC = 0; // set by isRecordForm
1853 let Inst{6-10} = RS;
1854 let Inst{11-15} = RA;
1855 let Inst{16-20} = SH{4,3,2,1,0};
1856 let Inst{21-26} = MBE{4,3,2,1,0,5};
1857 let Inst{27-29} = xo;
1858 let Inst{30} = SH{5};
1862 class MDSForm_1<bits<6> opcode, bits<4> xo, dag OOL, dag IOL, string asmstr,
1863 InstrItinClass itin, list<dag> pattern>
1864 : I<opcode, OOL, IOL, asmstr, itin> {
1870 let Pattern = pattern;
1872 bit RC = 0; // set by isRecordForm
1874 let Inst{6-10} = RS;
1875 let Inst{11-15} = RA;
1876 let Inst{16-20} = RB;
1877 let Inst{21-26} = MBE{4,3,2,1,0,5};
1878 let Inst{27-30} = xo;
1885 // VAForm_1 - DACB ordering.
1886 class VAForm_1<bits<6> xo, dag OOL, dag IOL, string asmstr,
1887 InstrItinClass itin, list<dag> pattern>
1888 : I<4, OOL, IOL, asmstr, itin> {
1894 let Pattern = pattern;
1896 let Inst{6-10} = VD;
1897 let Inst{11-15} = VA;
1898 let Inst{16-20} = VB;
1899 let Inst{21-25} = VC;
1900 let Inst{26-31} = xo;
1903 // VAForm_1a - DABC ordering.
1904 class VAForm_1a<bits<6> xo, dag OOL, dag IOL, string asmstr,
1905 InstrItinClass itin, list<dag> pattern>
1906 : I<4, OOL, IOL, asmstr, itin> {
1912 let Pattern = pattern;
1914 let Inst{6-10} = VD;
1915 let Inst{11-15} = VA;
1916 let Inst{16-20} = VB;
1917 let Inst{21-25} = VC;
1918 let Inst{26-31} = xo;
1921 class VAForm_2<bits<6> xo, dag OOL, dag IOL, string asmstr,
1922 InstrItinClass itin, list<dag> pattern>
1923 : I<4, OOL, IOL, asmstr, itin> {
1929 let Pattern = pattern;
1931 let Inst{6-10} = VD;
1932 let Inst{11-15} = VA;
1933 let Inst{16-20} = VB;
1935 let Inst{22-25} = SH;
1936 let Inst{26-31} = xo;
1940 class VXForm_1<bits<11> xo, dag OOL, dag IOL, string asmstr,
1941 InstrItinClass itin, list<dag> pattern>
1942 : I<4, OOL, IOL, asmstr, itin> {
1947 let Pattern = pattern;
1949 let Inst{6-10} = VD;
1950 let Inst{11-15} = VA;
1951 let Inst{16-20} = VB;
1952 let Inst{21-31} = xo;
1955 class VXForm_setzero<bits<11> xo, dag OOL, dag IOL, string asmstr,
1956 InstrItinClass itin, list<dag> pattern>
1957 : VXForm_1<xo, OOL, IOL, asmstr, itin, pattern> {
1963 class VXForm_2<bits<11> xo, dag OOL, dag IOL, string asmstr,
1964 InstrItinClass itin, list<dag> pattern>
1965 : I<4, OOL, IOL, asmstr, itin> {
1969 let Pattern = pattern;
1971 let Inst{6-10} = VD;
1972 let Inst{11-15} = 0;
1973 let Inst{16-20} = VB;
1974 let Inst{21-31} = xo;
1977 class VXForm_3<bits<11> xo, dag OOL, dag IOL, string asmstr,
1978 InstrItinClass itin, list<dag> pattern>
1979 : I<4, OOL, IOL, asmstr, itin> {
1983 let Pattern = pattern;
1985 let Inst{6-10} = VD;
1986 let Inst{11-15} = IMM;
1987 let Inst{16-20} = 0;
1988 let Inst{21-31} = xo;
1991 /// VXForm_4 - VX instructions with "VD,0,0" register fields, like mfvscr.
1992 class VXForm_4<bits<11> xo, dag OOL, dag IOL, string asmstr,
1993 InstrItinClass itin, list<dag> pattern>
1994 : I<4, OOL, IOL, asmstr, itin> {
1997 let Pattern = pattern;
1999 let Inst{6-10} = VD;
2000 let Inst{11-15} = 0;
2001 let Inst{16-20} = 0;
2002 let Inst{21-31} = xo;
2005 /// VXForm_5 - VX instructions with "0,0,VB" register fields, like mtvscr.
2006 class VXForm_5<bits<11> xo, dag OOL, dag IOL, string asmstr,
2007 InstrItinClass itin, list<dag> pattern>
2008 : I<4, OOL, IOL, asmstr, itin> {
2011 let Pattern = pattern;
2014 let Inst{11-15} = 0;
2015 let Inst{16-20} = VB;
2016 let Inst{21-31} = xo;
2019 // e.g. [PO VRT EO VRB XO]
2020 class VXForm_RD5_XO5_RS5<bits<11> xo, bits<5> eo, dag OOL, dag IOL,
2021 string asmstr, InstrItinClass itin, list<dag> pattern>
2022 : I<4, OOL, IOL, asmstr, itin> {
2026 let Pattern = pattern;
2028 let Inst{6-10} = RD;
2029 let Inst{11-15} = eo;
2030 let Inst{16-20} = VB;
2031 let Inst{21-31} = xo;
2034 /// VXForm_CR - VX crypto instructions with "VRT, VRA, ST, SIX"
2035 class VXForm_CR<bits<11> xo, dag OOL, dag IOL, string asmstr,
2036 InstrItinClass itin, list<dag> pattern>
2037 : I<4, OOL, IOL, asmstr, itin> {
2043 let Pattern = pattern;
2045 let Inst{6-10} = VD;
2046 let Inst{11-15} = VA;
2048 let Inst{17-20} = SIX;
2049 let Inst{21-31} = xo;
2052 /// VXForm_BX - VX crypto instructions with "VRT, VRA, 0 - like vsbox"
2053 class VXForm_BX<bits<11> xo, dag OOL, dag IOL, string asmstr,
2054 InstrItinClass itin, list<dag> pattern>
2055 : I<4, OOL, IOL, asmstr, itin> {
2059 let Pattern = pattern;
2061 let Inst{6-10} = VD;
2062 let Inst{11-15} = VA;
2063 let Inst{16-20} = 0;
2064 let Inst{21-31} = xo;
2068 class VXRForm_1<bits<10> xo, dag OOL, dag IOL, string asmstr,
2069 InstrItinClass itin, list<dag> pattern>
2070 : I<4, OOL, IOL, asmstr, itin> {
2076 let Pattern = pattern;
2078 let Inst{6-10} = VD;
2079 let Inst{11-15} = VA;
2080 let Inst{16-20} = VB;
2082 let Inst{22-31} = xo;
2085 // VX-Form: [PO VRT EO VRB 1 PS XO]
2086 class VX_RD5_EO5_RS5_PS1_XO9<bits<5> eo, bits<9> xo,
2087 dag OOL, dag IOL, string asmstr,
2088 InstrItinClass itin, list<dag> pattern>
2089 : I<4, OOL, IOL, asmstr, itin> {
2094 let Pattern = pattern;
2096 let Inst{6-10} = VD;
2097 let Inst{11-15} = eo;
2098 let Inst{16-20} = VB;
2101 let Inst{23-31} = xo;
2104 // VX-Form: [PO VRT VRA VRB 1 PS XO] or [PO VRT VRA VRB 1 / XO]
2105 class VX_RD5_RSp5_PS1_XO9<bits<9> xo, dag OOL, dag IOL, string asmstr,
2106 InstrItinClass itin, list<dag> pattern>
2107 : I<4, OOL, IOL, asmstr, itin> {
2113 let Pattern = pattern;
2115 let Inst{6-10} = VD;
2116 let Inst{11-15} = VA;
2117 let Inst{16-20} = VB;
2120 let Inst{23-31} = xo;
2123 class Z23Form_8<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
2124 InstrItinClass itin, list<dag> pattern>
2125 : I<opcode, OOL, IOL, asmstr, itin> {
2131 let Pattern = pattern;
2133 bit RC = 0; // set by isRecordForm
2135 let Inst{6-10} = VRT;
2136 let Inst{11-14} = 0;
2138 let Inst{16-20} = VRB;
2139 let Inst{21-22} = idx;
2140 let Inst{23-30} = xo;
2144 class Z23Form_RTAB5_CY2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
2145 string asmstr, InstrItinClass itin, list<dag> pattern>
2146 : I<opcode, OOL, IOL, asmstr, itin> {
2152 let Pattern = pattern;
2154 let Inst{6-10} = RT;
2155 let Inst{11-15} = RA;
2156 let Inst{16-20} = RB;
2157 let Inst{21-22} = CY;
2158 let Inst{23-30} = xo;
2162 //===----------------------------------------------------------------------===//
2163 // EmitTimePseudo won't have encoding information for the [MC]CodeEmitter
2165 class PPCEmitTimePseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
2166 : I<0, OOL, IOL, asmstr, NoItinerary> {
2167 let isCodeGenOnly = 1;
2169 let Pattern = pattern;
2171 let hasNoSchedulingInfo = 1;
2174 // Instruction that require custom insertion support
2175 // a.k.a. ISelPseudos, however, these won't have isPseudo set
2176 class PPCCustomInserterPseudo<dag OOL, dag IOL, string asmstr,
2178 : PPCEmitTimePseudo<OOL, IOL, asmstr, pattern> {
2179 let usesCustomInserter = 1;
2182 // PostRAPseudo will be expanded in expandPostRAPseudo, isPseudo flag in td
2183 // files is set only for PostRAPseudo
2184 class PPCPostRAExpPseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
2185 : PPCEmitTimePseudo<OOL, IOL, asmstr, pattern> {
2189 class PseudoXFormMemOp<dag OOL, dag IOL, string asmstr, list<dag> pattern>
2190 : PPCPostRAExpPseudo<OOL, IOL, asmstr, pattern>, XFormMemOp;