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 the VSX instruction is to use VSX numbering/encoding.
41 /// Since ISA 3.0, there are scalar instructions that use the upper
42 /// half of the VSX register set only. Rather than adding further complexity
43 /// to the register class set, the VSX registers just include the Altivec
44 /// registers and this flag decides the numbering to be used for them.
45 bits<1> UseVSXReg = 0;
46 let TSFlags{6} = UseVSXReg;
48 // Indicate that this instruction is of type X-Form Load or Store
49 bits<1> XFormMemOp = 0;
50 let TSFlags{7} = XFormMemOp;
52 // Fields used for relation models.
55 // For cases where multiple instruction definitions really represent the
56 // same underlying instruction but with one definition for 64-bit arguments
57 // and one for 32-bit arguments, this bit breaks the degeneracy between
58 // the two forms and allows TableGen to generate mapping tables.
59 bit Interpretation64Bit = 0;
62 class PPC970_DGroup_First { bits<1> PPC970_First = 1; }
63 class PPC970_DGroup_Single { bits<1> PPC970_Single = 1; }
64 class PPC970_DGroup_Cracked { bits<1> PPC970_Cracked = 1; }
65 class PPC970_MicroCode;
67 class PPC970_Unit_Pseudo { bits<3> PPC970_Unit = 0; }
68 class PPC970_Unit_FXU { bits<3> PPC970_Unit = 1; }
69 class PPC970_Unit_LSU { bits<3> PPC970_Unit = 2; }
70 class PPC970_Unit_FPU { bits<3> PPC970_Unit = 3; }
71 class PPC970_Unit_CRU { bits<3> PPC970_Unit = 4; }
72 class PPC970_Unit_VALU { bits<3> PPC970_Unit = 5; }
73 class PPC970_Unit_VPERM { bits<3> PPC970_Unit = 6; }
74 class PPC970_Unit_BRU { bits<3> PPC970_Unit = 7; }
76 class UseVSXReg { bits<1> UseVSXReg = 1; }
77 class XFormMemOp { bits<1> XFormMemOp = 1; }
79 // Two joined instructions; used to emit two adjacent instructions as one.
80 // The itinerary from the first instruction is used for scheduling and
82 class I2<bits<6> opcode1, bits<6> opcode2, dag OOL, dag IOL, string asmstr,
86 field bits<64> SoftFail = 0;
89 bit PPC64 = 0; // Default value, override with isPPC64
91 let Namespace = "PPC";
92 let Inst{0-5} = opcode1;
93 let Inst{32-37} = opcode2;
94 let OutOperandList = OOL;
95 let InOperandList = IOL;
96 let AsmString = asmstr;
99 bits<1> PPC970_First = 0;
100 bits<1> PPC970_Single = 0;
101 bits<1> PPC970_Cracked = 0;
102 bits<3> PPC970_Unit = 0;
104 /// These fields correspond to the fields in PPCInstrInfo.h. Any changes to
105 /// these must be reflected there! See comments there for what these are.
106 let TSFlags{0} = PPC970_First;
107 let TSFlags{1} = PPC970_Single;
108 let TSFlags{2} = PPC970_Cracked;
109 let TSFlags{5-3} = PPC970_Unit;
111 // Fields used for relation models.
112 string BaseName = "";
113 bit Interpretation64Bit = 0;
116 // Base class for all X-Form memory instructions
117 class IXFormMemOp<bits<6> opcode, dag OOL, dag IOL, string asmstr,
119 :I<opcode, OOL, IOL, asmstr, itin>, XFormMemOp;
122 class IForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr,
123 InstrItinClass itin, list<dag> pattern>
124 : I<opcode, OOL, IOL, asmstr, itin> {
125 let Pattern = pattern;
134 class BForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr>
135 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
136 bits<7> BIBO; // 2 bits of BI and 5 bits of BO.
141 let BI{0-1} = BIBO{5-6};
142 let BI{2-4} = CR{0-2};
144 let Inst{6-10} = BIBO{4-0};
145 let Inst{11-15} = BI;
146 let Inst{16-29} = BD;
151 class BForm_1<bits<6> opcode, bits<5> bo, bit aa, bit lk, dag OOL, dag IOL,
153 : BForm<opcode, aa, lk, OOL, IOL, asmstr> {
159 class BForm_2<bits<6> opcode, bits<5> bo, bits<5> bi, bit aa, bit lk,
160 dag OOL, dag IOL, string asmstr>
161 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
165 let Inst{11-15} = bi;
166 let Inst{16-29} = BD;
171 class BForm_3<bits<6> opcode, bit aa, bit lk,
172 dag OOL, dag IOL, string asmstr>
173 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
179 let Inst{11-15} = BI;
180 let Inst{16-29} = BD;
185 class BForm_3_at<bits<6> opcode, bit aa, bit lk,
186 dag OOL, dag IOL, string asmstr>
187 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
193 let Inst{6-8} = BO{4-2};
195 let Inst{11-15} = BI;
196 let Inst{16-29} = BD;
201 class BForm_4<bits<6> opcode, bits<5> bo, bit aa, bit lk,
202 dag OOL, dag IOL, string asmstr>
203 : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
208 let Inst{11-15} = BI;
209 let Inst{16-29} = BD;
215 class SCForm<bits<6> opcode, bits<1> xo,
216 dag OOL, dag IOL, string asmstr, InstrItinClass itin,
218 : I<opcode, OOL, IOL, asmstr, itin> {
221 let Pattern = pattern;
223 let Inst{20-26} = LEV;
228 class DForm_base<bits<6> opcode, dag OOL, dag IOL, string asmstr,
229 InstrItinClass itin, list<dag> pattern>
230 : I<opcode, OOL, IOL, asmstr, itin> {
235 let Pattern = pattern;
242 class DForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
243 InstrItinClass itin, list<dag> pattern>
244 : I<opcode, OOL, IOL, asmstr, itin> {
248 let Pattern = pattern;
251 let Inst{11-15} = Addr{20-16}; // Base Reg
252 let Inst{16-31} = Addr{15-0}; // Displacement
255 class DForm_1a<bits<6> opcode, dag OOL, dag IOL, string asmstr,
256 InstrItinClass itin, list<dag> pattern>
257 : I<opcode, OOL, IOL, asmstr, itin> {
262 let Pattern = pattern;
270 class DForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
271 InstrItinClass itin, list<dag> pattern>
272 : DForm_base<opcode, OOL, IOL, asmstr, itin, pattern> {
274 // Even though ADDICo does not really have an RC bit, provide
275 // the declaration of one here so that isDOT has something to set.
279 class DForm_2_r0<bits<6> opcode, dag OOL, dag IOL, string asmstr,
280 InstrItinClass itin, list<dag> pattern>
281 : I<opcode, OOL, IOL, asmstr, itin> {
285 let Pattern = pattern;
292 class DForm_4<bits<6> opcode, dag OOL, dag IOL, string asmstr,
293 InstrItinClass itin, list<dag> pattern>
294 : I<opcode, OOL, IOL, asmstr, itin> {
299 let Pattern = pattern;
306 class DForm_4_zero<bits<6> opcode, dag OOL, dag IOL, string asmstr,
307 InstrItinClass itin, list<dag> pattern>
308 : DForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
313 class DForm_4_fixedreg_zero<bits<6> opcode, bits<5> R, dag OOL, dag IOL,
314 string asmstr, InstrItinClass itin,
316 : DForm_4<opcode, OOL, IOL, asmstr, itin, pattern> {
322 class IForm_and_DForm_1<bits<6> opcode1, bit aa, bit lk, bits<6> opcode2,
323 dag OOL, dag IOL, string asmstr,
324 InstrItinClass itin, list<dag> pattern>
325 : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
329 let Pattern = pattern;
337 let Inst{43-47} = Addr{20-16}; // Base Reg
338 let Inst{48-63} = Addr{15-0}; // Displacement
341 // This is used to emit BL8+NOP.
342 class IForm_and_DForm_4_zero<bits<6> opcode1, bit aa, bit lk, bits<6> opcode2,
343 dag OOL, dag IOL, string asmstr,
344 InstrItinClass itin, list<dag> pattern>
345 : IForm_and_DForm_1<opcode1, aa, lk, opcode2,
346 OOL, IOL, asmstr, itin, pattern> {
351 class DForm_5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
353 : I<opcode, OOL, IOL, asmstr, itin> {
362 let Inst{11-15} = RA;
366 class DForm_5_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
368 : DForm_5<opcode, OOL, IOL, asmstr, itin> {
372 class DForm_6<bits<6> opcode, dag OOL, dag IOL, string asmstr,
374 : DForm_5<opcode, OOL, IOL, asmstr, itin>;
376 class DForm_6_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
378 : DForm_6<opcode, OOL, IOL, asmstr, itin> {
384 class DSForm_1<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
385 InstrItinClass itin, list<dag> pattern>
386 : I<opcode, OOL, IOL, asmstr, itin> {
390 let Pattern = pattern;
392 let Inst{6-10} = RST;
393 let Inst{11-15} = DS_RA{18-14}; // Register #
394 let Inst{16-29} = DS_RA{13-0}; // Displacement.
395 let Inst{30-31} = xo;
398 // ISA V3.0B 1.6.6 DX-Form
399 class DXForm<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
400 InstrItinClass itin, list<dag> pattern>
401 : I<opcode, OOL, IOL, asmstr, itin> {
405 let Pattern = pattern;
408 let Inst{11-15} = D{5-1}; // d1
409 let Inst{16-25} = D{15-6}; // d0
410 let Inst{26-30} = xo;
411 let Inst{31} = D{0}; // d2
414 // DQ-Form: [PO T RA DQ TX XO] or [PO S RA DQ SX XO]
415 class DQ_RD6_RS5_DQ12<bits<6> opcode, bits<3> xo, dag OOL, dag IOL,
416 string asmstr, InstrItinClass itin, list<dag> pattern>
417 : I<opcode, OOL, IOL, asmstr, itin> {
421 let Pattern = pattern;
423 let Inst{6-10} = XT{4-0};
424 let Inst{11-15} = DS_RA{16-12}; // Register #
425 let Inst{16-27} = DS_RA{11-0}; // Displacement.
426 let Inst{28} = XT{5};
427 let Inst{29-31} = xo;
431 class XForm_base_r3xo<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
432 InstrItinClass itin, list<dag> pattern>
433 : I<opcode, OOL, IOL, asmstr, itin> {
438 let Pattern = pattern;
440 bit RC = 0; // set by isDOT
442 let Inst{6-10} = RST;
445 let Inst{21-30} = xo;
449 class XForm_base_r3xo_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
450 string asmstr, InstrItinClass itin,
452 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>, XFormMemOp;
454 class XForm_tlb<bits<10> xo, dag OOL, dag IOL, string asmstr,
455 InstrItinClass itin> : XForm_base_r3xo<31, xo, OOL, IOL, asmstr, itin, []> {
459 class XForm_attn<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
461 : I<opcode, OOL, IOL, asmstr, itin> {
462 let Inst{21-30} = xo;
465 // This is the same as XForm_base_r3xo, but the first two operands are swapped
466 // when code is emitted.
467 class XForm_base_r3xo_swapped
468 <bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
470 : I<opcode, OOL, IOL, asmstr, itin> {
475 bit RC = 0; // set by isDOT
477 let Inst{6-10} = RST;
480 let Inst{21-30} = xo;
485 class XForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
486 InstrItinClass itin, list<dag> pattern>
487 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
489 class XForm_1_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
490 InstrItinClass itin, list<dag> pattern>
491 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
493 class XForm_1a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
494 InstrItinClass itin, list<dag> pattern>
495 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
499 class XForm_rs<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
500 InstrItinClass itin, list<dag> pattern>
501 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
506 class XForm_tlbws<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
507 InstrItinClass itin, list<dag> pattern>
508 : I<opcode, OOL, IOL, asmstr, itin> {
513 let Pattern = pattern;
515 let Inst{6-10} = RST;
518 let Inst{21-30} = xo;
522 class XForm_6<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
523 InstrItinClass itin, list<dag> pattern>
524 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
525 let Pattern = pattern;
528 class XForm_8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
529 InstrItinClass itin, list<dag> pattern>
530 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
532 class XForm_8_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
533 InstrItinClass itin, list<dag> pattern>
534 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
536 class XForm_10<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
537 InstrItinClass itin, list<dag> pattern>
538 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
539 let Pattern = pattern;
542 class XForm_11<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
543 InstrItinClass itin, list<dag> pattern>
544 : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
546 let Pattern = pattern;
549 class XForm_16<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
551 : I<opcode, OOL, IOL, asmstr, itin> {
560 let Inst{11-15} = RA;
561 let Inst{16-20} = RB;
562 let Inst{21-30} = xo;
566 class XForm_icbt<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
568 : I<opcode, OOL, IOL, asmstr, itin> {
575 let Inst{11-15} = RA;
576 let Inst{16-20} = RB;
577 let Inst{21-30} = xo;
581 class XForm_sr<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
583 : I<opcode, OOL, IOL, asmstr, itin> {
588 let Inst{12-15} = SR;
589 let Inst{21-30} = xo;
592 class XForm_mbar<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
594 : I<opcode, OOL, IOL, asmstr, itin> {
598 let Inst{21-30} = xo;
601 class XForm_srin<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
603 : I<opcode, OOL, IOL, asmstr, itin> {
608 let Inst{16-20} = RB;
609 let Inst{21-30} = xo;
612 class XForm_mtmsr<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
614 : I<opcode, OOL, IOL, asmstr, itin> {
620 let Inst{21-30} = xo;
623 class XForm_16_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
625 : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
629 class XForm_17<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
631 : I<opcode, OOL, IOL, asmstr, itin> {
638 let Inst{11-15} = FRA;
639 let Inst{16-20} = FRB;
640 let Inst{21-30} = xo;
644 class XForm_17a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
646 : XForm_17<opcode, xo, OOL, IOL, asmstr, itin > {
651 class XForm_18<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
652 InstrItinClass itin, list<dag> pattern>
653 : I<opcode, OOL, IOL, asmstr, itin> {
658 let Pattern = pattern;
660 let Inst{6-10} = FRT;
661 let Inst{11-15} = FRA;
662 let Inst{16-20} = FRB;
663 let Inst{21-30} = xo;
667 class XForm_19<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
668 InstrItinClass itin, list<dag> pattern>
669 : XForm_18<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
673 class XForm_20<bits<6> opcode, bits<6> xo, dag OOL, dag IOL, string asmstr,
674 InstrItinClass itin, list<dag> pattern>
675 : I<opcode, OOL, IOL, asmstr, itin> {
681 let Pattern = pattern;
683 let Inst{6-10} = FRT;
684 let Inst{11-15} = FRA;
685 let Inst{16-20} = FRB;
686 let Inst{21-24} = tttt;
687 let Inst{25-30} = xo;
691 class XForm_24<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
692 InstrItinClass itin, list<dag> pattern>
693 : I<opcode, OOL, IOL, asmstr, itin> {
694 let Pattern = pattern;
698 let Inst{21-30} = xo;
702 class XForm_24_sync<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
703 string asmstr, InstrItinClass itin, list<dag> pattern>
704 : I<opcode, OOL, IOL, asmstr, itin> {
707 let Pattern = pattern;
712 let Inst{21-30} = xo;
716 class XForm_24_eieio<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
717 string asmstr, InstrItinClass itin, list<dag> pattern>
718 : XForm_24_sync<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
722 class XForm_25<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
723 InstrItinClass itin, list<dag> pattern>
724 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
727 class XForm_25_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
728 string asmstr, InstrItinClass itin, list<dag> pattern>
729 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
732 class XForm_26<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
733 InstrItinClass itin, list<dag> pattern>
734 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
738 class XForm_28_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
739 string asmstr, InstrItinClass itin, list<dag> pattern>
740 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
743 class XForm_28<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
744 InstrItinClass itin, list<dag> pattern>
745 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
748 // This is used for MFFS, MTFSB0, MTFSB1. 42 is arbitrary; this series of
749 // numbers presumably relates to some document, but I haven't found it.
750 class XForm_42<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
751 InstrItinClass itin, list<dag> pattern>
752 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
753 let Pattern = pattern;
755 bit RC = 0; // set by isDOT
757 let Inst{6-10} = RST;
759 let Inst{21-30} = xo;
762 class XForm_43<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
763 InstrItinClass itin, list<dag> pattern>
764 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
765 let Pattern = pattern;
768 bit RC = 0; // set by isDOT
772 let Inst{21-30} = xo;
776 class XForm_44<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
778 : I<opcode, OOL, IOL, asmstr, itin> {
783 let Inst{11-13} = BFA;
786 let Inst{21-30} = xo;
790 class XForm_45<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
792 : I<opcode, OOL, IOL, asmstr, itin> {
800 let Inst{21-30} = xo;
804 class X_FRT5_XO2_XO3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2, bits<10> xo,
805 dag OOL, dag IOL, string asmstr, InstrItinClass itin,
807 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
808 let Pattern = pattern;
810 let Inst{6-10} = RST;
811 let Inst{11-12} = xo1;
812 let Inst{13-15} = xo2;
814 let Inst{21-30} = xo;
818 class X_FRT5_XO2_XO3_FRB5_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
819 bits<10> xo, dag OOL, dag IOL, string asmstr,
820 InstrItinClass itin, list<dag> pattern>
821 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
822 let Pattern = pattern;
825 let Inst{6-10} = RST;
826 let Inst{11-12} = xo1;
827 let Inst{13-15} = xo2;
828 let Inst{16-20} = FRB;
829 let Inst{21-30} = xo;
833 class X_FRT5_XO2_XO3_DRM3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
834 bits<10> xo, dag OOL, dag IOL, string asmstr,
835 InstrItinClass itin, list<dag> pattern>
836 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
837 let Pattern = pattern;
840 let Inst{6-10} = RST;
841 let Inst{11-12} = xo1;
842 let Inst{13-15} = xo2;
844 let Inst{18-20} = DRM;
845 let Inst{21-30} = xo;
849 class X_FRT5_XO2_XO3_RM2_X10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
850 bits<10> xo, dag OOL, dag IOL, string asmstr,
851 InstrItinClass itin, list<dag> pattern>
852 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
853 let Pattern = pattern;
856 let Inst{6-10} = RST;
857 let Inst{11-12} = xo1;
858 let Inst{13-15} = xo2;
860 let Inst{19-20} = RM;
861 let Inst{21-30} = xo;
866 class XForm_0<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
867 InstrItinClass itin, list<dag> pattern>
868 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
874 class XForm_16b<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
875 InstrItinClass itin, list<dag> pattern>
876 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
881 class XForm_htm0<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
882 string asmstr, InstrItinClass itin, list<dag> pattern>
883 : I<opcode, OOL, IOL, asmstr, itin> {
891 let Inst{21-30} = xo;
895 class XForm_htm1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
896 string asmstr, InstrItinClass itin, list<dag> pattern>
897 : I<opcode, OOL, IOL, asmstr, itin> {
904 let Inst{21-30} = xo;
908 class XForm_htm2<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
909 InstrItinClass itin, list<dag> pattern>
910 : I<opcode, OOL, IOL, asmstr, itin> {
913 bit RC = 0; // set by isDOT
918 let Inst{21-30} = xo;
922 class XForm_htm3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
923 InstrItinClass itin, list<dag> pattern>
924 : I<opcode, OOL, IOL, asmstr, itin> {
931 let Inst{21-30} = xo;
935 // [PO RT RA RB XO /]
936 class X_BF3_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
937 string asmstr, InstrItinClass itin, list<dag> pattern>
938 : I<opcode, OOL, IOL, asmstr, itin> {
944 let Pattern = pattern;
949 let Inst{11-15} = RA;
950 let Inst{16-20} = RB;
951 let Inst{21-30} = xo;
955 // Same as XForm_17 but with GPR's and new naming convention
956 class X_BF3_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
957 string asmstr, InstrItinClass itin, list<dag> pattern>
958 : I<opcode, OOL, IOL, asmstr, itin> {
963 let Pattern = pattern;
967 let Inst{11-15} = RA;
968 let Inst{16-20} = RB;
969 let Inst{21-30} = xo;
973 // e.g. [PO VRT XO VRB XO /] or [PO VRT XO VRB XO RO]
974 class X_RD5_XO5_RS5<bits<6> opcode, bits<5> xo2, bits<10> xo, dag OOL, dag IOL,
975 string asmstr, InstrItinClass itin, list<dag> pattern>
976 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
980 class X_BF3_DCMX7_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
981 string asmstr, InstrItinClass itin, list<dag> pattern>
982 : I<opcode, OOL, IOL, asmstr, itin> {
987 let Pattern = pattern;
990 let Inst{9-15} = DCMX;
991 let Inst{16-20} = VB;
992 let Inst{21-30} = xo;
996 class X_RD6_IMM8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
997 string asmstr, InstrItinClass itin, list<dag> pattern>
998 : I<opcode, OOL, IOL, asmstr, itin> {
1002 let Pattern = pattern;
1004 let Inst{6-10} = XT{4-0};
1005 let Inst{11-12} = 0;
1006 let Inst{13-20} = IMM8;
1007 let Inst{21-30} = xo;
1008 let Inst{31} = XT{5};
1011 // XForm_base_r3xo for instructions such as P9 atomics where we don't want
1012 // to specify an SDAG pattern for matching.
1013 class X_RD5_RS5_IM5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1014 string asmstr, InstrItinClass itin>
1015 : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, []> {
1018 class X_BF3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1019 InstrItinClass itin>
1020 : XForm_17<opcode, xo, OOL, IOL, asmstr, itin> {
1025 // [PO /// L RA RB XO /]
1026 class X_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1027 string asmstr, InstrItinClass itin, list<dag> pattern>
1028 : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
1030 let Pattern = pattern;
1037 class XX1Form<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1038 InstrItinClass itin, list<dag> pattern>
1039 : I<opcode, OOL, IOL, asmstr, itin> {
1044 let Pattern = pattern;
1046 let Inst{6-10} = XT{4-0};
1047 let Inst{11-15} = A;
1048 let Inst{16-20} = B;
1049 let Inst{21-30} = xo;
1050 let Inst{31} = XT{5};
1053 class XX1Form_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1054 string asmstr, InstrItinClass itin, list<dag> pattern>
1055 : XX1Form<opcode, xo, OOL, IOL, asmstr, itin, pattern>, XFormMemOp;
1057 class XX1_RS6_RD5_XO<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1058 string asmstr, InstrItinClass itin, list<dag> pattern>
1059 : XX1Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1063 class XX2Form<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
1064 InstrItinClass itin, list<dag> pattern>
1065 : I<opcode, OOL, IOL, asmstr, itin> {
1069 let Pattern = pattern;
1071 let Inst{6-10} = XT{4-0};
1072 let Inst{11-15} = 0;
1073 let Inst{16-20} = XB{4-0};
1074 let Inst{21-29} = xo;
1075 let Inst{30} = XB{5};
1076 let Inst{31} = XT{5};
1079 class XX2Form_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
1080 InstrItinClass itin, list<dag> pattern>
1081 : I<opcode, OOL, IOL, asmstr, itin> {
1085 let Pattern = pattern;
1089 let Inst{16-20} = XB{4-0};
1090 let Inst{21-29} = xo;
1091 let Inst{30} = XB{5};
1095 class XX2Form_2<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
1096 InstrItinClass itin, list<dag> pattern>
1097 : I<opcode, OOL, IOL, asmstr, itin> {
1102 let Pattern = pattern;
1104 let Inst{6-10} = XT{4-0};
1105 let Inst{11-13} = 0;
1106 let Inst{14-15} = D;
1107 let Inst{16-20} = XB{4-0};
1108 let Inst{21-29} = xo;
1109 let Inst{30} = XB{5};
1110 let Inst{31} = XT{5};
1113 class XX2_RD6_UIM5_RS6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
1114 string asmstr, InstrItinClass itin, list<dag> pattern>
1115 : I<opcode, OOL, IOL, asmstr, itin> {
1120 let Pattern = pattern;
1122 let Inst{6-10} = XT{4-0};
1123 let Inst{11-15} = UIM5;
1124 let Inst{16-20} = XB{4-0};
1125 let Inst{21-29} = xo;
1126 let Inst{30} = XB{5};
1127 let Inst{31} = XT{5};
1130 // [PO T XO B XO BX /]
1131 class XX2_RD5_XO5_RS6<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL, dag IOL,
1132 string asmstr, InstrItinClass itin, list<dag> pattern>
1133 : I<opcode, OOL, IOL, asmstr, itin> {
1137 let Pattern = pattern;
1139 let Inst{6-10} = RT;
1140 let Inst{11-15} = xo2;
1141 let Inst{16-20} = XB{4-0};
1142 let Inst{21-29} = xo;
1143 let Inst{30} = XB{5};
1147 // [PO T XO B XO BX TX]
1148 class XX2_RD6_XO5_RS6<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL, dag IOL,
1149 string asmstr, InstrItinClass itin, list<dag> pattern>
1150 : I<opcode, OOL, IOL, asmstr, itin> {
1154 let Pattern = pattern;
1156 let Inst{6-10} = XT{4-0};
1157 let Inst{11-15} = xo2;
1158 let Inst{16-20} = XB{4-0};
1159 let Inst{21-29} = xo;
1160 let Inst{30} = XB{5};
1161 let Inst{31} = XT{5};
1164 class XX2_BF3_DCMX7_RS6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
1165 string asmstr, InstrItinClass itin, list<dag> pattern>
1166 : I<opcode, OOL, IOL, asmstr, itin> {
1171 let Pattern = pattern;
1174 let Inst{9-15} = DCMX;
1175 let Inst{16-20} = XB{4-0};
1176 let Inst{21-29} = xo;
1177 let Inst{30} = XB{5};
1181 class XX2_RD6_DCMX7_RS6<bits<6> opcode, bits<4> xo1, bits<3> xo2,
1182 dag OOL, dag IOL, string asmstr, InstrItinClass itin,
1184 : I<opcode, OOL, IOL, asmstr, itin> {
1189 let Pattern = pattern;
1191 let Inst{6-10} = XT{4-0};
1192 let Inst{11-15} = DCMX{4-0};
1193 let Inst{16-20} = XB{4-0};
1194 let Inst{21-24} = xo1;
1195 let Inst{25} = DCMX{5};
1196 let Inst{26-28} = xo2;
1197 let Inst{29} = DCMX{6};
1198 let Inst{30} = XB{5};
1199 let Inst{31} = XT{5};
1202 class XX3Form<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
1203 InstrItinClass itin, list<dag> pattern>
1204 : I<opcode, OOL, IOL, asmstr, itin> {
1209 let Pattern = pattern;
1211 let Inst{6-10} = XT{4-0};
1212 let Inst{11-15} = XA{4-0};
1213 let Inst{16-20} = XB{4-0};
1214 let Inst{21-28} = xo;
1215 let Inst{29} = XA{5};
1216 let Inst{30} = XB{5};
1217 let Inst{31} = XT{5};
1220 class XX3Form_Zero<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
1221 InstrItinClass itin, list<dag> pattern>
1222 : XX3Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1227 class XX3Form_SetZero<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
1228 InstrItinClass itin, list<dag> pattern>
1229 : XX3Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1234 class XX3Form_1<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
1235 InstrItinClass itin, list<dag> pattern>
1236 : I<opcode, OOL, IOL, asmstr, itin> {
1241 let Pattern = pattern;
1245 let Inst{11-15} = XA{4-0};
1246 let Inst{16-20} = XB{4-0};
1247 let Inst{21-28} = xo;
1248 let Inst{29} = XA{5};
1249 let Inst{30} = XB{5};
1253 class XX3Form_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1254 InstrItinClass itin, list<dag> pattern>
1255 : I<opcode, OOL, IOL, asmstr, itin> {
1261 let Pattern = pattern;
1263 let Inst{6-10} = XT{4-0};
1264 let Inst{11-15} = XA{4-0};
1265 let Inst{16-20} = XB{4-0};
1267 let Inst{22-23} = D;
1268 let Inst{24-28} = xo;
1269 let Inst{29} = XA{5};
1270 let Inst{30} = XB{5};
1271 let Inst{31} = XT{5};
1274 class XX3Form_Rc<bits<6> opcode, bits<7> xo, dag OOL, dag IOL, string asmstr,
1275 InstrItinClass itin, list<dag> pattern>
1276 : I<opcode, OOL, IOL, asmstr, itin> {
1281 let Pattern = pattern;
1283 bit RC = 0; // set by isDOT
1285 let Inst{6-10} = XT{4-0};
1286 let Inst{11-15} = XA{4-0};
1287 let Inst{16-20} = XB{4-0};
1289 let Inst{22-28} = xo;
1290 let Inst{29} = XA{5};
1291 let Inst{30} = XB{5};
1292 let Inst{31} = XT{5};
1295 class XX4Form<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
1296 InstrItinClass itin, list<dag> pattern>
1297 : I<opcode, OOL, IOL, asmstr, itin> {
1303 let Pattern = pattern;
1305 let Inst{6-10} = XT{4-0};
1306 let Inst{11-15} = XA{4-0};
1307 let Inst{16-20} = XB{4-0};
1308 let Inst{21-25} = XC{4-0};
1309 let Inst{26-27} = xo;
1310 let Inst{28} = XC{5};
1311 let Inst{29} = XA{5};
1312 let Inst{30} = XB{5};
1313 let Inst{31} = XT{5};
1316 // DCB_Form - Form X instruction, used for dcb* instructions.
1317 class DCB_Form<bits<10> xo, bits<5> immfield, dag OOL, dag IOL, string asmstr,
1318 InstrItinClass itin, list<dag> pattern>
1319 : I<31, OOL, IOL, asmstr, itin> {
1323 let Pattern = pattern;
1325 let Inst{6-10} = immfield;
1326 let Inst{11-15} = A;
1327 let Inst{16-20} = B;
1328 let Inst{21-30} = xo;
1332 class DCB_Form_hint<bits<10> xo, dag OOL, dag IOL, string asmstr,
1333 InstrItinClass itin, list<dag> pattern>
1334 : I<31, OOL, IOL, asmstr, itin> {
1339 let Pattern = pattern;
1341 let Inst{6-10} = TH;
1342 let Inst{11-15} = A;
1343 let Inst{16-20} = B;
1344 let Inst{21-30} = xo;
1348 // DSS_Form - Form X instruction, used for altivec dss* instructions.
1349 class DSS_Form<bits<1> T, bits<10> xo, dag OOL, dag IOL, string asmstr,
1350 InstrItinClass itin, list<dag> pattern>
1351 : I<31, OOL, IOL, asmstr, itin> {
1356 let Pattern = pattern;
1360 let Inst{9-10} = STRM;
1361 let Inst{11-15} = A;
1362 let Inst{16-20} = B;
1363 let Inst{21-30} = xo;
1368 class XLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1369 InstrItinClass itin, list<dag> pattern>
1370 : I<opcode, OOL, IOL, asmstr, itin> {
1375 let Pattern = pattern;
1377 let Inst{6-10} = CRD;
1378 let Inst{11-15} = CRA;
1379 let Inst{16-20} = CRB;
1380 let Inst{21-30} = xo;
1384 class XLForm_1_np<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1385 InstrItinClass itin, list<dag> pattern>
1386 : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1392 class XLForm_1_gen<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1393 InstrItinClass itin, list<dag> pattern>
1394 : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1403 class XLForm_1_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1404 InstrItinClass itin, list<dag> pattern>
1405 : I<opcode, OOL, IOL, asmstr, itin> {
1408 let Pattern = pattern;
1410 let Inst{6-10} = CRD;
1411 let Inst{11-15} = CRD;
1412 let Inst{16-20} = CRD;
1413 let Inst{21-30} = xo;
1417 class XLForm_2<bits<6> opcode, bits<10> xo, bit lk, dag OOL, dag IOL, string asmstr,
1418 InstrItinClass itin, list<dag> pattern>
1419 : I<opcode, OOL, IOL, asmstr, itin> {
1424 let Pattern = pattern;
1426 let Inst{6-10} = BO;
1427 let Inst{11-15} = BI;
1428 let Inst{16-18} = 0;
1429 let Inst{19-20} = BH;
1430 let Inst{21-30} = xo;
1434 class XLForm_2_br<bits<6> opcode, bits<10> xo, bit lk,
1435 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
1436 : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
1437 bits<7> BIBO; // 2 bits of BI and 5 bits of BO.
1441 let BI{0-1} = BIBO{5-6};
1442 let BI{2-4} = CR{0-2};
1446 class XLForm_2_br2<bits<6> opcode, bits<10> xo, bits<5> bo, bit lk,
1447 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
1448 : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
1453 class XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo, bits<5> bi, bit lk,
1454 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
1455 : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
1461 class XLForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1462 InstrItinClass itin>
1463 : I<opcode, OOL, IOL, asmstr, itin> {
1469 let Inst{11-13} = BFA;
1470 let Inst{14-15} = 0;
1471 let Inst{16-20} = 0;
1472 let Inst{21-30} = xo;
1476 class XLForm_4<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1477 InstrItinClass itin>
1478 : I<opcode, OOL, IOL, asmstr, itin> {
1487 let Inst{11-14} = 0;
1489 let Inst{16-19} = U;
1491 let Inst{21-30} = xo;
1495 class XLForm_S<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1496 InstrItinClass itin, list<dag> pattern>
1497 : I<opcode, OOL, IOL, asmstr, itin> {
1500 let Pattern = pattern;
1504 let Inst{21-30} = xo;
1508 class XLForm_2_and_DSForm_1<bits<6> opcode1, bits<10> xo1, bit lk,
1509 bits<6> opcode2, bits<2> xo2,
1510 dag OOL, dag IOL, string asmstr,
1511 InstrItinClass itin, list<dag> pattern>
1512 : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
1520 let Pattern = pattern;
1522 let Inst{6-10} = BO;
1523 let Inst{11-15} = BI;
1524 let Inst{16-18} = 0;
1525 let Inst{19-20} = BH;
1526 let Inst{21-30} = xo1;
1529 let Inst{38-42} = RST;
1530 let Inst{43-47} = DS_RA{18-14}; // Register #
1531 let Inst{48-61} = DS_RA{13-0}; // Displacement.
1532 let Inst{62-63} = xo2;
1535 class XLForm_2_ext_and_DSForm_1<bits<6> opcode1, bits<10> xo1,
1536 bits<5> bo, bits<5> bi, bit lk,
1537 bits<6> opcode2, bits<2> xo2,
1538 dag OOL, dag IOL, string asmstr,
1539 InstrItinClass itin, list<dag> pattern>
1540 : XLForm_2_and_DSForm_1<opcode1, xo1, lk, opcode2, xo2,
1541 OOL, IOL, asmstr, itin, pattern> {
1548 class XFXForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1549 InstrItinClass itin>
1550 : I<opcode, OOL, IOL, asmstr, itin> {
1554 let Inst{6-10} = RT;
1555 let Inst{11} = SPR{4};
1556 let Inst{12} = SPR{3};
1557 let Inst{13} = SPR{2};
1558 let Inst{14} = SPR{1};
1559 let Inst{15} = SPR{0};
1560 let Inst{16} = SPR{9};
1561 let Inst{17} = SPR{8};
1562 let Inst{18} = SPR{7};
1563 let Inst{19} = SPR{6};
1564 let Inst{20} = SPR{5};
1565 let Inst{21-30} = xo;
1569 class XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
1570 dag OOL, dag IOL, string asmstr, InstrItinClass itin>
1571 : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin> {
1575 class XFXForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1576 InstrItinClass itin>
1577 : I<opcode, OOL, IOL, asmstr, itin> {
1580 let Inst{6-10} = RT;
1581 let Inst{11-20} = 0;
1582 let Inst{21-30} = xo;
1586 class XFXForm_3p<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1587 InstrItinClass itin, list<dag> pattern>
1588 : I<opcode, OOL, IOL, asmstr, itin> {
1591 let Pattern = pattern;
1593 let Inst{6-10} = RT;
1594 let Inst{11-20} = Entry;
1595 let Inst{21-30} = xo;
1599 class XFXForm_5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1600 InstrItinClass itin>
1601 : I<opcode, OOL, IOL, asmstr, itin> {
1605 let Inst{6-10} = rS;
1607 let Inst{12-19} = FXM;
1609 let Inst{21-30} = xo;
1613 class XFXForm_5a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1614 InstrItinClass itin>
1615 : I<opcode, OOL, IOL, asmstr, itin> {
1619 let Inst{6-10} = ST;
1621 let Inst{12-19} = FXM;
1623 let Inst{21-30} = xo;
1627 class XFXForm_7<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1628 InstrItinClass itin>
1629 : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin>;
1631 class XFXForm_7_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
1632 dag OOL, dag IOL, string asmstr, InstrItinClass itin>
1633 : XFXForm_7<opcode, xo, OOL, IOL, asmstr, itin> {
1638 // This is probably 1.7.9, but I don't have the reference that uses this
1639 // numbering scheme...
1640 class XFLForm<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1641 InstrItinClass itin, list<dag>pattern>
1642 : I<opcode, OOL, IOL, asmstr, itin> {
1646 bit RC = 0; // set by isDOT
1647 let Pattern = pattern;
1650 let Inst{7-14} = FM;
1652 let Inst{16-20} = rT;
1653 let Inst{21-30} = xo;
1657 class XFLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1658 InstrItinClass itin, list<dag>pattern>
1659 : I<opcode, OOL, IOL, asmstr, itin> {
1665 bit RC = 0; // set by isDOT
1666 let Pattern = pattern;
1669 let Inst{7-14} = FLM;
1671 let Inst{16-20} = FRB;
1672 let Inst{21-30} = xo;
1676 // 1.7.10 XS-Form - SRADI.
1677 class XSForm_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
1678 InstrItinClass itin, list<dag> pattern>
1679 : I<opcode, OOL, IOL, asmstr, itin> {
1684 bit RC = 0; // set by isDOT
1685 let Pattern = pattern;
1687 let Inst{6-10} = RS;
1688 let Inst{11-15} = A;
1689 let Inst{16-20} = SH{4,3,2,1,0};
1690 let Inst{21-29} = xo;
1691 let Inst{30} = SH{5};
1696 class XOForm_1<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, string asmstr,
1697 InstrItinClass itin, list<dag> pattern>
1698 : I<opcode, OOL, IOL, asmstr, itin> {
1703 let Pattern = pattern;
1705 bit RC = 0; // set by isDOT
1707 let Inst{6-10} = RT;
1708 let Inst{11-15} = RA;
1709 let Inst{16-20} = RB;
1711 let Inst{22-30} = xo;
1715 class XOForm_3<bits<6> opcode, bits<9> xo, bit oe,
1716 dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
1717 : XOForm_1<opcode, xo, oe, OOL, IOL, asmstr, itin, pattern> {
1722 class AForm_1<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1723 InstrItinClass itin, list<dag> pattern>
1724 : I<opcode, OOL, IOL, asmstr, itin> {
1730 let Pattern = pattern;
1732 bit RC = 0; // set by isDOT
1734 let Inst{6-10} = FRT;
1735 let Inst{11-15} = FRA;
1736 let Inst{16-20} = FRB;
1737 let Inst{21-25} = FRC;
1738 let Inst{26-30} = xo;
1742 class AForm_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1743 InstrItinClass itin, list<dag> pattern>
1744 : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1748 class AForm_3<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1749 InstrItinClass itin, list<dag> pattern>
1750 : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1754 class AForm_4<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1755 InstrItinClass itin, list<dag> pattern>
1756 : I<opcode, OOL, IOL, asmstr, itin> {
1762 let Pattern = pattern;
1764 let Inst{6-10} = RT;
1765 let Inst{11-15} = RA;
1766 let Inst{16-20} = RB;
1767 let Inst{21-25} = COND;
1768 let Inst{26-30} = xo;
1773 class AForm_4a<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
1774 InstrItinClass itin, list<dag> pattern>
1775 : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1781 class MForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
1782 InstrItinClass itin, list<dag> pattern>
1783 : I<opcode, OOL, IOL, asmstr, itin> {
1790 let Pattern = pattern;
1792 bit RC = 0; // set by isDOT
1794 let Inst{6-10} = RS;
1795 let Inst{11-15} = RA;
1796 let Inst{16-20} = RB;
1797 let Inst{21-25} = MB;
1798 let Inst{26-30} = ME;
1802 class MForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
1803 InstrItinClass itin, list<dag> pattern>
1804 : MForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
1808 class MDForm_1<bits<6> opcode, bits<3> xo, dag OOL, dag IOL, string asmstr,
1809 InstrItinClass itin, list<dag> pattern>
1810 : I<opcode, OOL, IOL, asmstr, itin> {
1816 let Pattern = pattern;
1818 bit RC = 0; // set by isDOT
1820 let Inst{6-10} = RS;
1821 let Inst{11-15} = RA;
1822 let Inst{16-20} = SH{4,3,2,1,0};
1823 let Inst{21-26} = MBE{4,3,2,1,0,5};
1824 let Inst{27-29} = xo;
1825 let Inst{30} = SH{5};
1829 class MDSForm_1<bits<6> opcode, bits<4> xo, dag OOL, dag IOL, string asmstr,
1830 InstrItinClass itin, list<dag> pattern>
1831 : I<opcode, OOL, IOL, asmstr, itin> {
1837 let Pattern = pattern;
1839 bit RC = 0; // set by isDOT
1841 let Inst{6-10} = RS;
1842 let Inst{11-15} = RA;
1843 let Inst{16-20} = RB;
1844 let Inst{21-26} = MBE{4,3,2,1,0,5};
1845 let Inst{27-30} = xo;
1852 // VAForm_1 - DACB ordering.
1853 class VAForm_1<bits<6> xo, dag OOL, dag IOL, string asmstr,
1854 InstrItinClass itin, list<dag> pattern>
1855 : I<4, OOL, IOL, asmstr, itin> {
1861 let Pattern = pattern;
1863 let Inst{6-10} = VD;
1864 let Inst{11-15} = VA;
1865 let Inst{16-20} = VB;
1866 let Inst{21-25} = VC;
1867 let Inst{26-31} = xo;
1870 // VAForm_1a - DABC ordering.
1871 class VAForm_1a<bits<6> xo, dag OOL, dag IOL, string asmstr,
1872 InstrItinClass itin, list<dag> pattern>
1873 : I<4, OOL, IOL, asmstr, itin> {
1879 let Pattern = pattern;
1881 let Inst{6-10} = VD;
1882 let Inst{11-15} = VA;
1883 let Inst{16-20} = VB;
1884 let Inst{21-25} = VC;
1885 let Inst{26-31} = xo;
1888 class VAForm_2<bits<6> xo, dag OOL, dag IOL, string asmstr,
1889 InstrItinClass itin, list<dag> pattern>
1890 : I<4, OOL, IOL, asmstr, itin> {
1896 let Pattern = pattern;
1898 let Inst{6-10} = VD;
1899 let Inst{11-15} = VA;
1900 let Inst{16-20} = VB;
1902 let Inst{22-25} = SH;
1903 let Inst{26-31} = xo;
1907 class VXForm_1<bits<11> xo, dag OOL, dag IOL, string asmstr,
1908 InstrItinClass itin, list<dag> pattern>
1909 : I<4, OOL, IOL, asmstr, itin> {
1914 let Pattern = pattern;
1916 let Inst{6-10} = VD;
1917 let Inst{11-15} = VA;
1918 let Inst{16-20} = VB;
1919 let Inst{21-31} = xo;
1922 class VXForm_setzero<bits<11> xo, dag OOL, dag IOL, string asmstr,
1923 InstrItinClass itin, list<dag> pattern>
1924 : VXForm_1<xo, OOL, IOL, asmstr, itin, pattern> {
1930 class VXForm_2<bits<11> xo, dag OOL, dag IOL, string asmstr,
1931 InstrItinClass itin, list<dag> pattern>
1932 : I<4, OOL, IOL, asmstr, itin> {
1936 let Pattern = pattern;
1938 let Inst{6-10} = VD;
1939 let Inst{11-15} = 0;
1940 let Inst{16-20} = VB;
1941 let Inst{21-31} = xo;
1944 class VXForm_3<bits<11> xo, dag OOL, dag IOL, string asmstr,
1945 InstrItinClass itin, list<dag> pattern>
1946 : I<4, OOL, IOL, asmstr, itin> {
1950 let Pattern = pattern;
1952 let Inst{6-10} = VD;
1953 let Inst{11-15} = IMM;
1954 let Inst{16-20} = 0;
1955 let Inst{21-31} = xo;
1958 /// VXForm_4 - VX instructions with "VD,0,0" register fields, like mfvscr.
1959 class VXForm_4<bits<11> xo, dag OOL, dag IOL, string asmstr,
1960 InstrItinClass itin, list<dag> pattern>
1961 : I<4, OOL, IOL, asmstr, itin> {
1964 let Pattern = pattern;
1966 let Inst{6-10} = VD;
1967 let Inst{11-15} = 0;
1968 let Inst{16-20} = 0;
1969 let Inst{21-31} = xo;
1972 /// VXForm_5 - VX instructions with "0,0,VB" register fields, like mtvscr.
1973 class VXForm_5<bits<11> xo, dag OOL, dag IOL, string asmstr,
1974 InstrItinClass itin, list<dag> pattern>
1975 : I<4, OOL, IOL, asmstr, itin> {
1978 let Pattern = pattern;
1981 let Inst{11-15} = 0;
1982 let Inst{16-20} = VB;
1983 let Inst{21-31} = xo;
1986 // e.g. [PO VRT EO VRB XO]
1987 class VXForm_RD5_XO5_RS5<bits<11> xo, bits<5> eo, dag OOL, dag IOL,
1988 string asmstr, InstrItinClass itin, list<dag> pattern>
1989 : I<4, OOL, IOL, asmstr, itin> {
1993 let Pattern = pattern;
1995 let Inst{6-10} = RD;
1996 let Inst{11-15} = eo;
1997 let Inst{16-20} = VB;
1998 let Inst{21-31} = xo;
2001 /// VXForm_CR - VX crypto instructions with "VRT, VRA, ST, SIX"
2002 class VXForm_CR<bits<11> xo, dag OOL, dag IOL, string asmstr,
2003 InstrItinClass itin, list<dag> pattern>
2004 : I<4, OOL, IOL, asmstr, itin> {
2010 let Pattern = pattern;
2012 let Inst{6-10} = VD;
2013 let Inst{11-15} = VA;
2015 let Inst{17-20} = SIX;
2016 let Inst{21-31} = xo;
2019 /// VXForm_BX - VX crypto instructions with "VRT, VRA, 0 - like vsbox"
2020 class VXForm_BX<bits<11> xo, dag OOL, dag IOL, string asmstr,
2021 InstrItinClass itin, list<dag> pattern>
2022 : I<4, OOL, IOL, asmstr, itin> {
2026 let Pattern = pattern;
2028 let Inst{6-10} = VD;
2029 let Inst{11-15} = VA;
2030 let Inst{16-20} = 0;
2031 let Inst{21-31} = xo;
2035 class VXRForm_1<bits<10> 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;
2047 let Inst{16-20} = VB;
2049 let Inst{22-31} = xo;
2052 // VX-Form: [PO VRT EO VRB 1 PS XO]
2053 class VX_RD5_EO5_RS5_PS1_XO9<bits<5> eo, bits<9> xo,
2054 dag OOL, dag IOL, string asmstr,
2055 InstrItinClass itin, list<dag> pattern>
2056 : I<4, OOL, IOL, asmstr, itin> {
2061 let Pattern = pattern;
2063 let Inst{6-10} = VD;
2064 let Inst{11-15} = eo;
2065 let Inst{16-20} = VB;
2068 let Inst{23-31} = xo;
2071 // VX-Form: [PO VRT VRA VRB 1 PS XO] or [PO VRT VRA VRB 1 / XO]
2072 class VX_RD5_RSp5_PS1_XO9<bits<9> xo, dag OOL, dag IOL, string asmstr,
2073 InstrItinClass itin, list<dag> pattern>
2074 : I<4, OOL, IOL, asmstr, itin> {
2080 let Pattern = pattern;
2082 let Inst{6-10} = VD;
2083 let Inst{11-15} = VA;
2084 let Inst{16-20} = VB;
2087 let Inst{23-31} = xo;
2090 // Z23-Form (used by QPX)
2091 class Z23Form_1<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
2092 InstrItinClass itin, list<dag> pattern>
2093 : I<opcode, OOL, IOL, asmstr, itin> {
2099 let Pattern = pattern;
2101 bit RC = 0; // set by isDOT
2103 let Inst{6-10} = FRT;
2104 let Inst{11-15} = FRA;
2105 let Inst{16-20} = FRB;
2106 let Inst{21-22} = idx;
2107 let Inst{23-30} = xo;
2111 class Z23Form_2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
2112 InstrItinClass itin, list<dag> pattern>
2113 : Z23Form_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
2117 class Z23Form_3<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
2118 InstrItinClass itin, list<dag> pattern>
2119 : I<opcode, OOL, IOL, asmstr, itin> {
2123 let Pattern = pattern;
2125 bit RC = 0; // set by isDOT
2127 let Inst{6-10} = FRT;
2128 let Inst{11-22} = idx;
2129 let Inst{23-30} = xo;
2133 class Z23Form_8<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
2134 InstrItinClass itin, list<dag> pattern>
2135 : I<opcode, OOL, IOL, asmstr, itin> {
2141 let Pattern = pattern;
2143 bit RC = 0; // set by isDOT
2145 let Inst{6-10} = VRT;
2146 let Inst{11-14} = 0;
2148 let Inst{16-20} = VRB;
2149 let Inst{21-22} = idx;
2150 let Inst{23-30} = xo;
2154 //===----------------------------------------------------------------------===//
2155 // EmitTimePseudo won't have encoding information for the [MC]CodeEmitter
2157 class PPCEmitTimePseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
2158 : I<0, OOL, IOL, asmstr, NoItinerary> {
2159 let isCodeGenOnly = 1;
2161 let Pattern = pattern;
2163 let hasNoSchedulingInfo = 1;
2166 // Instruction that require custom insertion support
2167 // a.k.a. ISelPseudos, however, these won't have isPseudo set
2168 class PPCCustomInserterPseudo<dag OOL, dag IOL, string asmstr,
2170 : PPCEmitTimePseudo<OOL, IOL, asmstr, pattern> {
2171 let usesCustomInserter = 1;
2174 // PostRAPseudo will be expanded in expandPostRAPseudo, isPseudo flag in td
2175 // files is set only for PostRAPseudo
2176 class PPCPostRAExpPseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
2177 : PPCEmitTimePseudo<OOL, IOL, asmstr, pattern> {
2181 class PseudoXFormMemOp<dag OOL, dag IOL, string asmstr, list<dag> pattern>
2182 : PPCPostRAExpPseudo<OOL, IOL, asmstr, pattern>, XFormMemOp;