xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstrFormats.td (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric//===- PowerPCInstrFormats.td - PowerPC Instruction Formats --*- tablegen -*-=//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
100b57cec5SDimitry Andric//
110b57cec5SDimitry Andric// PowerPC instruction formats
120b57cec5SDimitry Andric
130b57cec5SDimitry Andricclass I<bits<6> opcode, dag OOL, dag IOL, string asmstr, InstrItinClass itin>
140b57cec5SDimitry Andric        : Instruction {
150b57cec5SDimitry Andric  field bits<32> Inst;
160b57cec5SDimitry Andric  field bits<32> SoftFail = 0;
170b57cec5SDimitry Andric  let Size = 4;
180b57cec5SDimitry Andric
190b57cec5SDimitry Andric  bit PPC64 = 0;  // Default value, override with isPPC64
200b57cec5SDimitry Andric
210b57cec5SDimitry Andric  let Namespace = "PPC";
220b57cec5SDimitry Andric  let Inst{0-5} = opcode;
230b57cec5SDimitry Andric  let OutOperandList = OOL;
240b57cec5SDimitry Andric  let InOperandList = IOL;
250b57cec5SDimitry Andric  let AsmString = asmstr;
260b57cec5SDimitry Andric  let Itinerary = itin;
270b57cec5SDimitry Andric
280b57cec5SDimitry Andric  bits<1> PPC970_First = 0;
290b57cec5SDimitry Andric  bits<1> PPC970_Single = 0;
300b57cec5SDimitry Andric  bits<1> PPC970_Cracked = 0;
310b57cec5SDimitry Andric  bits<3> PPC970_Unit = 0;
320b57cec5SDimitry Andric
330b57cec5SDimitry Andric  /// These fields correspond to the fields in PPCInstrInfo.h.  Any changes to
340b57cec5SDimitry Andric  /// these must be reflected there!  See comments there for what these are.
350b57cec5SDimitry Andric  let TSFlags{0}   = PPC970_First;
360b57cec5SDimitry Andric  let TSFlags{1}   = PPC970_Single;
370b57cec5SDimitry Andric  let TSFlags{2}   = PPC970_Cracked;
380b57cec5SDimitry Andric  let TSFlags{5-3} = PPC970_Unit;
390b57cec5SDimitry Andric
400b57cec5SDimitry Andric  // Indicate that this instruction is of type X-Form Load or Store
410b57cec5SDimitry Andric  bits<1> XFormMemOp = 0;
425ffd83dbSDimitry Andric  let TSFlags{6}  = XFormMemOp;
435ffd83dbSDimitry Andric
445ffd83dbSDimitry Andric  // Indicate that this instruction is prefixed.
455ffd83dbSDimitry Andric  bits<1> Prefixed = 0;
465ffd83dbSDimitry Andric  let TSFlags{7}  = Prefixed;
470b57cec5SDimitry Andric
48bdd1243dSDimitry Andric  // Indicate that this instruction produces a result that is sign extended from
49bdd1243dSDimitry Andric  // 32 bits to 64 bits.
50bdd1243dSDimitry Andric  bits<1> SExt32To64 = 0;
51bdd1243dSDimitry Andric  let TSFlags{8} = SExt32To64;
52bdd1243dSDimitry Andric
53bdd1243dSDimitry Andric  // Indicate that this instruction produces a result that is zero extended from
54bdd1243dSDimitry Andric  // 32 bits to 64 bits.
55bdd1243dSDimitry Andric  bits<1> ZExt32To64 = 0;
56bdd1243dSDimitry Andric  let TSFlags{9} = ZExt32To64;
57bdd1243dSDimitry Andric
580b57cec5SDimitry Andric  // Fields used for relation models.
590b57cec5SDimitry Andric  string BaseName = "";
600b57cec5SDimitry Andric
610b57cec5SDimitry Andric  // For cases where multiple instruction definitions really represent the
620b57cec5SDimitry Andric  // same underlying instruction but with one definition for 64-bit arguments
630b57cec5SDimitry Andric  // and one for 32-bit arguments, this bit breaks the degeneracy between
640b57cec5SDimitry Andric  // the two forms and allows TableGen to generate mapping tables.
650b57cec5SDimitry Andric  bit Interpretation64Bit = 0;
660b57cec5SDimitry Andric}
670b57cec5SDimitry Andric
680b57cec5SDimitry Andricclass PPC970_DGroup_First   { bits<1> PPC970_First = 1;  }
690b57cec5SDimitry Andricclass PPC970_DGroup_Single  { bits<1> PPC970_Single = 1; }
700b57cec5SDimitry Andricclass PPC970_DGroup_Cracked { bits<1> PPC970_Cracked = 1; }
710b57cec5SDimitry Andricclass PPC970_MicroCode;
720b57cec5SDimitry Andric
730b57cec5SDimitry Andricclass PPC970_Unit_Pseudo   { bits<3> PPC970_Unit = 0;   }
740b57cec5SDimitry Andricclass PPC970_Unit_FXU      { bits<3> PPC970_Unit = 1;   }
750b57cec5SDimitry Andricclass PPC970_Unit_LSU      { bits<3> PPC970_Unit = 2;   }
760b57cec5SDimitry Andricclass PPC970_Unit_FPU      { bits<3> PPC970_Unit = 3;   }
770b57cec5SDimitry Andricclass PPC970_Unit_CRU      { bits<3> PPC970_Unit = 4;   }
780b57cec5SDimitry Andricclass PPC970_Unit_VALU     { bits<3> PPC970_Unit = 5;   }
790b57cec5SDimitry Andricclass PPC970_Unit_VPERM    { bits<3> PPC970_Unit = 6;   }
800b57cec5SDimitry Andricclass PPC970_Unit_BRU      { bits<3> PPC970_Unit = 7;   }
810b57cec5SDimitry Andric
820b57cec5SDimitry Andricclass XFormMemOp { bits<1> XFormMemOp = 1; }
83bdd1243dSDimitry Andricclass SExt32To64 { bits<1> SExt32To64 = 1; }
84bdd1243dSDimitry Andricclass ZExt32To64 { bits<1> ZExt32To64 = 1; }
850b57cec5SDimitry Andric
860b57cec5SDimitry Andric// Two joined instructions; used to emit two adjacent instructions as one.
870b57cec5SDimitry Andric// The itinerary from the first instruction is used for scheduling and
880b57cec5SDimitry Andric// classification.
890b57cec5SDimitry Andricclass I2<bits<6> opcode1, bits<6> opcode2, dag OOL, dag IOL, string asmstr,
900b57cec5SDimitry Andric         InstrItinClass itin>
910b57cec5SDimitry Andric        : Instruction {
920b57cec5SDimitry Andric  field bits<64> Inst;
930b57cec5SDimitry Andric  field bits<64> SoftFail = 0;
940b57cec5SDimitry Andric  let Size = 8;
950b57cec5SDimitry Andric
960b57cec5SDimitry Andric  bit PPC64 = 0;  // Default value, override with isPPC64
970b57cec5SDimitry Andric
980b57cec5SDimitry Andric  let Namespace = "PPC";
990b57cec5SDimitry Andric  let Inst{0-5} = opcode1;
1000b57cec5SDimitry Andric  let Inst{32-37} = opcode2;
1010b57cec5SDimitry Andric  let OutOperandList = OOL;
1020b57cec5SDimitry Andric  let InOperandList = IOL;
1030b57cec5SDimitry Andric  let AsmString = asmstr;
1040b57cec5SDimitry Andric  let Itinerary = itin;
1050b57cec5SDimitry Andric
1060b57cec5SDimitry Andric  bits<1> PPC970_First = 0;
1070b57cec5SDimitry Andric  bits<1> PPC970_Single = 0;
1080b57cec5SDimitry Andric  bits<1> PPC970_Cracked = 0;
1090b57cec5SDimitry Andric  bits<3> PPC970_Unit = 0;
1100b57cec5SDimitry Andric
1110b57cec5SDimitry Andric  /// These fields correspond to the fields in PPCInstrInfo.h.  Any changes to
1120b57cec5SDimitry Andric  /// these must be reflected there!  See comments there for what these are.
1130b57cec5SDimitry Andric  let TSFlags{0}   = PPC970_First;
1140b57cec5SDimitry Andric  let TSFlags{1}   = PPC970_Single;
1150b57cec5SDimitry Andric  let TSFlags{2}   = PPC970_Cracked;
1160b57cec5SDimitry Andric  let TSFlags{5-3} = PPC970_Unit;
1170b57cec5SDimitry Andric
1180b57cec5SDimitry Andric  // Fields used for relation models.
1190b57cec5SDimitry Andric  string BaseName = "";
1200b57cec5SDimitry Andric  bit Interpretation64Bit = 0;
1210b57cec5SDimitry Andric}
1220b57cec5SDimitry Andric
1230b57cec5SDimitry Andric// Base class for all X-Form memory instructions
1240b57cec5SDimitry Andricclass IXFormMemOp<bits<6> opcode, dag OOL, dag IOL, string asmstr,
1250b57cec5SDimitry Andric                  InstrItinClass itin>
1260b57cec5SDimitry Andric        :I<opcode, OOL, IOL, asmstr, itin>, XFormMemOp;
1270b57cec5SDimitry Andric
1280b57cec5SDimitry Andric// 1.7.1 I-Form
1290b57cec5SDimitry Andricclass IForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr,
1300b57cec5SDimitry Andric            InstrItinClass itin, list<dag> pattern>
1310b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
1320b57cec5SDimitry Andric  let Pattern = pattern;
1330b57cec5SDimitry Andric  bits<24> LI;
1340b57cec5SDimitry Andric
1350b57cec5SDimitry Andric  let Inst{6-29}  = LI;
1360b57cec5SDimitry Andric  let Inst{30}    = aa;
1370b57cec5SDimitry Andric  let Inst{31}    = lk;
1380b57cec5SDimitry Andric}
1390b57cec5SDimitry Andric
1400b57cec5SDimitry Andric// 1.7.2 B-Form
1410b57cec5SDimitry Andricclass BForm<bits<6> opcode, bit aa, bit lk, dag OOL, dag IOL, string asmstr>
1420b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
1430b57cec5SDimitry Andric  bits<7> BIBO;  // 2 bits of BI and 5 bits of BO.
1440b57cec5SDimitry Andric  bits<3>  CR;
1450b57cec5SDimitry Andric  bits<14> BD;
1460b57cec5SDimitry Andric
1470b57cec5SDimitry Andric  bits<5> BI;
1480b57cec5SDimitry Andric  let BI{0-1} = BIBO{5-6};
1490b57cec5SDimitry Andric  let BI{2-4} = CR{0-2};
1500b57cec5SDimitry Andric
1510b57cec5SDimitry Andric  let Inst{6-10}  = BIBO{4-0};
1520b57cec5SDimitry Andric  let Inst{11-15} = BI;
1530b57cec5SDimitry Andric  let Inst{16-29} = BD;
1540b57cec5SDimitry Andric  let Inst{30}    = aa;
1550b57cec5SDimitry Andric  let Inst{31}    = lk;
1560b57cec5SDimitry Andric}
1570b57cec5SDimitry Andric
1580b57cec5SDimitry Andricclass BForm_1<bits<6> opcode, bits<5> bo, bit aa, bit lk, dag OOL, dag IOL,
1590b57cec5SDimitry Andric             string asmstr>
1600b57cec5SDimitry Andric  : BForm<opcode, aa, lk, OOL, IOL, asmstr> {
1610b57cec5SDimitry Andric  let BIBO{4-0} = bo;
1620b57cec5SDimitry Andric  let BIBO{6-5} = 0;
1630b57cec5SDimitry Andric  let CR = 0;
1640b57cec5SDimitry Andric}
1650b57cec5SDimitry Andric
1660b57cec5SDimitry Andricclass BForm_2<bits<6> opcode, bits<5> bo, bits<5> bi, bit aa, bit lk,
1670b57cec5SDimitry Andric              dag OOL, dag IOL, string asmstr>
1680b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
1690b57cec5SDimitry Andric  bits<14> BD;
1700b57cec5SDimitry Andric
1710b57cec5SDimitry Andric  let Inst{6-10}  = bo;
1720b57cec5SDimitry Andric  let Inst{11-15} = bi;
1730b57cec5SDimitry Andric  let Inst{16-29} = BD;
1740b57cec5SDimitry Andric  let Inst{30}    = aa;
1750b57cec5SDimitry Andric  let Inst{31}    = lk;
1760b57cec5SDimitry Andric}
1770b57cec5SDimitry Andric
1780b57cec5SDimitry Andricclass BForm_3<bits<6> opcode, bit aa, bit lk,
1790b57cec5SDimitry Andric              dag OOL, dag IOL, string asmstr>
1800b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
1810b57cec5SDimitry Andric  bits<5> BO;
1820b57cec5SDimitry Andric  bits<5> BI;
1830b57cec5SDimitry Andric  bits<14> BD;
1840b57cec5SDimitry Andric
1850b57cec5SDimitry Andric  let Inst{6-10}  = BO;
1860b57cec5SDimitry Andric  let Inst{11-15} = BI;
1870b57cec5SDimitry Andric  let Inst{16-29} = BD;
1880b57cec5SDimitry Andric  let Inst{30}    = aa;
1890b57cec5SDimitry Andric  let Inst{31}    = lk;
1900b57cec5SDimitry Andric}
1910b57cec5SDimitry Andric
1920b57cec5SDimitry Andricclass BForm_3_at<bits<6> opcode, bit aa, bit lk,
1930b57cec5SDimitry Andric                 dag OOL, dag IOL, string asmstr>
1940b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
1950b57cec5SDimitry Andric  bits<5> BO;
1960b57cec5SDimitry Andric  bits<2> at;
1970b57cec5SDimitry Andric  bits<5> BI;
1980b57cec5SDimitry Andric  bits<14> BD;
1990b57cec5SDimitry Andric
2000b57cec5SDimitry Andric  let Inst{6-8}   = BO{4-2};
2010b57cec5SDimitry Andric  let Inst{9-10}  = at;
2020b57cec5SDimitry Andric  let Inst{11-15} = BI;
2030b57cec5SDimitry Andric  let Inst{16-29} = BD;
2040b57cec5SDimitry Andric  let Inst{30}    = aa;
2050b57cec5SDimitry Andric  let Inst{31}    = lk;
2060b57cec5SDimitry Andric}
2070b57cec5SDimitry Andric
20806c3fb27SDimitry Andricclass
20906c3fb27SDimitry AndricBForm_4<bits<6> opcode, bits<5> bo, bit aa, bit lk,
2100b57cec5SDimitry Andric              dag OOL, dag IOL, string asmstr>
2110b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, IIC_BrB> {
2120b57cec5SDimitry Andric  bits<5> BI;
2130b57cec5SDimitry Andric  bits<14> BD;
2140b57cec5SDimitry Andric
2150b57cec5SDimitry Andric  let Inst{6-10}  = bo;
2160b57cec5SDimitry Andric  let Inst{11-15} = BI;
2170b57cec5SDimitry Andric  let Inst{16-29} = BD;
2180b57cec5SDimitry Andric  let Inst{30}    = aa;
2190b57cec5SDimitry Andric  let Inst{31}    = lk;
2200b57cec5SDimitry Andric}
2210b57cec5SDimitry Andric
2220b57cec5SDimitry Andric// 1.7.3 SC-Form
223*5f757f3fSDimitry Andricclass SCForm<bits<6> opcode, bits<1> xo1, bits<1> xo2,
2240b57cec5SDimitry Andric                     dag OOL, dag IOL, string asmstr, InstrItinClass itin,
2250b57cec5SDimitry Andric                     list<dag> pattern>
2260b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
2270b57cec5SDimitry Andric  bits<7>  LEV;
2280b57cec5SDimitry Andric
2290b57cec5SDimitry Andric  let Pattern = pattern;
2300b57cec5SDimitry Andric
2310b57cec5SDimitry Andric  let Inst{20-26} = LEV;
232*5f757f3fSDimitry Andric  let Inst{30}    = xo1;
233*5f757f3fSDimitry Andric  let Inst{31}    = xo2;
2340b57cec5SDimitry Andric}
2350b57cec5SDimitry Andric
2360b57cec5SDimitry Andric// 1.7.4 D-Form
2370b57cec5SDimitry Andricclass DForm_base<bits<6> opcode, dag OOL, dag IOL, string asmstr,
2380b57cec5SDimitry Andric                 InstrItinClass itin, list<dag> pattern>
2390b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
24006c3fb27SDimitry Andric  bits<5>  RST;
24106c3fb27SDimitry Andric  bits<5>  RA;
24206c3fb27SDimitry Andric  bits<16> D;
2430b57cec5SDimitry Andric
2440b57cec5SDimitry Andric  let Pattern = pattern;
2450b57cec5SDimitry Andric
24606c3fb27SDimitry Andric  let Inst{6-10}  = RST;
24706c3fb27SDimitry Andric  let Inst{11-15} = RA;
24806c3fb27SDimitry Andric  let Inst{16-31} = D;
2490b57cec5SDimitry Andric}
2500b57cec5SDimitry Andric
2510b57cec5SDimitry Andricclass DForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
2520b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
25306c3fb27SDimitry Andric  : DForm_base<opcode, OOL, IOL, asmstr, itin, pattern> {
2540b57cec5SDimitry Andric}
2550b57cec5SDimitry Andric
2560b57cec5SDimitry Andricclass DForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
2570b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
2580b57cec5SDimitry Andric  : DForm_base<opcode, OOL, IOL, asmstr, itin, pattern> {
2590b57cec5SDimitry Andric
260480093f4SDimitry Andric  // Even though ADDIC_rec does not really have an RC bit, provide
261480093f4SDimitry Andric  // the declaration of one here so that isRecordForm has something to set.
2620b57cec5SDimitry Andric  bit RC = 0;
2630b57cec5SDimitry Andric}
2640b57cec5SDimitry Andric
2650b57cec5SDimitry Andricclass DForm_2_r0<bits<6> opcode, dag OOL, dag IOL, string asmstr,
2660b57cec5SDimitry Andric                 InstrItinClass itin, list<dag> pattern>
2670b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
26806c3fb27SDimitry Andric  bits<5>  RST;
26906c3fb27SDimitry Andric  bits<16> D;
2700b57cec5SDimitry Andric
2710b57cec5SDimitry Andric  let Pattern = pattern;
2720b57cec5SDimitry Andric
27306c3fb27SDimitry Andric  let Inst{6-10}  = RST;
2740b57cec5SDimitry Andric  let Inst{11-15} = 0;
27506c3fb27SDimitry Andric  let Inst{16-31} = D;
2760b57cec5SDimitry Andric}
2770b57cec5SDimitry Andric
2780b57cec5SDimitry Andricclass DForm_4<bits<6> opcode, dag OOL, dag IOL, string asmstr,
2790b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
2800b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
28106c3fb27SDimitry Andric  bits<5>  RA;
28206c3fb27SDimitry Andric  bits<5>  RST;
28306c3fb27SDimitry Andric  bits<16> D;
2840b57cec5SDimitry Andric
2850b57cec5SDimitry Andric  let Pattern = pattern;
2860b57cec5SDimitry Andric
28706c3fb27SDimitry Andric  let Inst{6-10}  = RST;
28806c3fb27SDimitry Andric  let Inst{11-15} = RA;
28906c3fb27SDimitry Andric  let Inst{16-31} = D;
2900b57cec5SDimitry Andric}
2910b57cec5SDimitry Andric
2920b57cec5SDimitry Andricclass DForm_4_zero<bits<6> opcode, dag OOL, dag IOL, string asmstr,
2930b57cec5SDimitry Andric                   InstrItinClass itin, list<dag> pattern>
2940b57cec5SDimitry Andric  : DForm_1<opcode, OOL, IOL, asmstr, itin, pattern> {
29506c3fb27SDimitry Andric  let RST = 0;
29606c3fb27SDimitry Andric  let RA = 0;
29706c3fb27SDimitry Andric  let D = 0;
2980b57cec5SDimitry Andric}
2990b57cec5SDimitry Andric
3000b57cec5SDimitry Andricclass DForm_4_fixedreg_zero<bits<6> opcode, bits<5> R, dag OOL, dag IOL,
3010b57cec5SDimitry Andric                            string asmstr, InstrItinClass itin,
3020b57cec5SDimitry Andric                            list<dag> pattern>
3030b57cec5SDimitry Andric  : DForm_4<opcode, OOL, IOL, asmstr, itin, pattern> {
30406c3fb27SDimitry Andric  let RST = R;
30506c3fb27SDimitry Andric  let RA = R;
30606c3fb27SDimitry Andric  let D = 0;
3070b57cec5SDimitry Andric}
3080b57cec5SDimitry Andric
3090b57cec5SDimitry Andricclass IForm_and_DForm_1<bits<6> opcode1, bit aa, bit lk, bits<6> opcode2,
3100b57cec5SDimitry Andric            dag OOL, dag IOL, string asmstr,
3110b57cec5SDimitry Andric            InstrItinClass itin, list<dag> pattern>
3120b57cec5SDimitry Andric         : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
31306c3fb27SDimitry Andric  bits<5>  RST;
31406c3fb27SDimitry Andric  bits<5>  RA;
31506c3fb27SDimitry Andric  bits<16> D;
3160b57cec5SDimitry Andric
3170b57cec5SDimitry Andric  let Pattern = pattern;
3180b57cec5SDimitry Andric  bits<24> LI;
3190b57cec5SDimitry Andric
3200b57cec5SDimitry Andric  let Inst{6-29}  = LI;
3210b57cec5SDimitry Andric  let Inst{30}    = aa;
3220b57cec5SDimitry Andric  let Inst{31}    = lk;
3230b57cec5SDimitry Andric
32406c3fb27SDimitry Andric  let Inst{38-42}  = RST;
32506c3fb27SDimitry Andric  let Inst{43-47} = RA;
32606c3fb27SDimitry Andric  let Inst{48-63} = D;
3270b57cec5SDimitry Andric}
3280b57cec5SDimitry Andric
3290b57cec5SDimitry Andric// This is used to emit BL8+NOP.
3300b57cec5SDimitry Andricclass IForm_and_DForm_4_zero<bits<6> opcode1, bit aa, bit lk, bits<6> opcode2,
3310b57cec5SDimitry Andric            dag OOL, dag IOL, string asmstr,
3320b57cec5SDimitry Andric            InstrItinClass itin, list<dag> pattern>
3330b57cec5SDimitry Andric         :  IForm_and_DForm_1<opcode1, aa, lk, opcode2,
3340b57cec5SDimitry Andric                              OOL, IOL, asmstr, itin, pattern> {
33506c3fb27SDimitry Andric  let RST = 0;
33606c3fb27SDimitry Andric  let RA = 0;
33706c3fb27SDimitry Andric  let D = 0;
3380b57cec5SDimitry Andric}
3390b57cec5SDimitry Andric
3400b57cec5SDimitry Andricclass DForm_5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
3410b57cec5SDimitry Andric              InstrItinClass itin>
3420b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
3430b57cec5SDimitry Andric  bits<3>  BF;
3440b57cec5SDimitry Andric  bits<1>  L;
3450b57cec5SDimitry Andric  bits<5>  RA;
34606c3fb27SDimitry Andric  bits<16> D;
3470b57cec5SDimitry Andric
3480b57cec5SDimitry Andric  let Inst{6-8}   = BF;
3490b57cec5SDimitry Andric  let Inst{9}     = 0;
3500b57cec5SDimitry Andric  let Inst{10}    = L;
3510b57cec5SDimitry Andric  let Inst{11-15} = RA;
35206c3fb27SDimitry Andric  let Inst{16-31} = D;
3530b57cec5SDimitry Andric}
3540b57cec5SDimitry Andric
3550b57cec5SDimitry Andricclass DForm_5_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
3560b57cec5SDimitry Andric                  InstrItinClass itin>
3570b57cec5SDimitry Andric  : DForm_5<opcode, OOL, IOL, asmstr, itin> {
3580b57cec5SDimitry Andric  let L = PPC64;
3590b57cec5SDimitry Andric}
3600b57cec5SDimitry Andric
3610b57cec5SDimitry Andricclass DForm_6<bits<6> opcode, dag OOL, dag IOL, string asmstr,
3620b57cec5SDimitry Andric              InstrItinClass itin>
3630b57cec5SDimitry Andric  : DForm_5<opcode, OOL, IOL, asmstr, itin>;
3640b57cec5SDimitry Andric
3650b57cec5SDimitry Andricclass DForm_6_ext<bits<6> opcode, dag OOL, dag IOL, string asmstr,
3660b57cec5SDimitry Andric                  InstrItinClass itin>
3670b57cec5SDimitry Andric  : DForm_6<opcode, OOL, IOL, asmstr, itin> {
3680b57cec5SDimitry Andric  let L = PPC64;
3690b57cec5SDimitry Andric}
3700b57cec5SDimitry Andric
3710b57cec5SDimitry Andric
3720b57cec5SDimitry Andric// 1.7.5 DS-Form
3730b57cec5SDimitry Andricclass DSForm_1<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
3740b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
3750b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
3760b57cec5SDimitry Andric  bits<5>  RST;
37706c3fb27SDimitry Andric  bits<5>  RA;
37806c3fb27SDimitry Andric  bits<14> D;
3790b57cec5SDimitry Andric
3800b57cec5SDimitry Andric  let Pattern = pattern;
3810b57cec5SDimitry Andric
3820b57cec5SDimitry Andric  let Inst{6-10}  = RST;
38306c3fb27SDimitry Andric  let Inst{11-15} = RA;
38406c3fb27SDimitry Andric  let Inst{16-29} = D;
3850b57cec5SDimitry Andric  let Inst{30-31} = xo;
3860b57cec5SDimitry Andric}
3870b57cec5SDimitry Andric
3880b57cec5SDimitry Andric// ISA V3.0B 1.6.6 DX-Form
3890b57cec5SDimitry Andricclass DXForm<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
3900b57cec5SDimitry Andric             InstrItinClass itin, list<dag> pattern>
3910b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
3920b57cec5SDimitry Andric  bits<5>  RT;
3930b57cec5SDimitry Andric  bits<16> D;
3940b57cec5SDimitry Andric
3950b57cec5SDimitry Andric  let Pattern = pattern;
3960b57cec5SDimitry Andric
3970b57cec5SDimitry Andric  let Inst{6-10}  = RT;
3980b57cec5SDimitry Andric  let Inst{11-15} = D{5-1};  // d1
3990b57cec5SDimitry Andric  let Inst{16-25} = D{15-6}; // d0
4000b57cec5SDimitry Andric  let Inst{26-30} = xo;
4010b57cec5SDimitry Andric  let Inst{31}    = D{0};    // d2
4020b57cec5SDimitry Andric}
4030b57cec5SDimitry Andric
4040b57cec5SDimitry Andric// DQ-Form: [PO T RA DQ TX XO] or [PO S RA DQ SX XO]
4050b57cec5SDimitry Andricclass DQ_RD6_RS5_DQ12<bits<6> opcode, bits<3> xo, dag OOL, dag IOL,
4060b57cec5SDimitry Andric                      string asmstr, InstrItinClass itin, list<dag> pattern>
4070b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
4080b57cec5SDimitry Andric  bits<6>  XT;
40906c3fb27SDimitry Andric  bits<5> RA;
41006c3fb27SDimitry Andric  bits<12> DQ;
4110b57cec5SDimitry Andric
4120b57cec5SDimitry Andric  let Pattern = pattern;
4130b57cec5SDimitry Andric
4140b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
41506c3fb27SDimitry Andric  let Inst{11-15} = RA;
41606c3fb27SDimitry Andric  let Inst{16-27} = DQ;
4170b57cec5SDimitry Andric  let Inst{28}    = XT{5};
4180b57cec5SDimitry Andric  let Inst{29-31} = xo;
4190b57cec5SDimitry Andric}
4200b57cec5SDimitry Andric
421fe6060f1SDimitry Andricclass DQForm_RTp5_RA17_MEM<bits<6> opcode, bits<4> xo, dag OOL, dag IOL,
422fe6060f1SDimitry Andric                           string asmstr, InstrItinClass itin,
423fe6060f1SDimitry Andric                           list<dag> pattern>
424fe6060f1SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
425fe6060f1SDimitry Andric  bits<5> RTp;
42606c3fb27SDimitry Andric  bits<5> RA;
42706c3fb27SDimitry Andric  bits<12> DQ;
428fe6060f1SDimitry Andric  let Pattern = pattern;
429fe6060f1SDimitry Andric
430fe6060f1SDimitry Andric  let Inst{6-10} =  RTp{4-0};
43106c3fb27SDimitry Andric  let Inst{11-15} = RA;
43206c3fb27SDimitry Andric  let Inst{16-27} = DQ;
433fe6060f1SDimitry Andric  let Inst{28-31} = xo;
434fe6060f1SDimitry Andric}
435fe6060f1SDimitry Andric
4360b57cec5SDimitry Andric// 1.7.6 X-Form
4370b57cec5SDimitry Andricclass XForm_base_r3xo<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
4380b57cec5SDimitry Andric                      InstrItinClass itin, list<dag> pattern>
4390b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
4400b57cec5SDimitry Andric  bits<5> RST;
44106c3fb27SDimitry Andric  bits<5> RA;
44206c3fb27SDimitry Andric  bits<5> RB;
4430b57cec5SDimitry Andric
4440b57cec5SDimitry Andric  let Pattern = pattern;
4450b57cec5SDimitry Andric
446480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
4470b57cec5SDimitry Andric
4480b57cec5SDimitry Andric  let Inst{6-10}  = RST;
44906c3fb27SDimitry Andric  let Inst{11-15} = RA;
45006c3fb27SDimitry Andric  let Inst{16-20} = RB;
4510b57cec5SDimitry Andric  let Inst{21-30} = xo;
4520b57cec5SDimitry Andric  let Inst{31}    = RC;
4530b57cec5SDimitry Andric}
4540b57cec5SDimitry Andric
4550b57cec5SDimitry Andricclass XForm_base_r3xo_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
4560b57cec5SDimitry Andric                            string asmstr, InstrItinClass itin,
4570b57cec5SDimitry Andric                            list<dag> pattern>
4580b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>, XFormMemOp;
4590b57cec5SDimitry Andric
4600b57cec5SDimitry Andricclass XForm_tlb<bits<10> xo, dag OOL, dag IOL, string asmstr,
4610b57cec5SDimitry Andric                InstrItinClass itin> : XForm_base_r3xo<31, xo, OOL, IOL, asmstr, itin, []> {
4620b57cec5SDimitry Andric  let RST = 0;
4630b57cec5SDimitry Andric}
4640b57cec5SDimitry Andric
4658a4dda33SDimitry Andricclass XForm_tlbilx<bits<10> xo, dag OOL, dag IOL, string asmstr,
4668a4dda33SDimitry Andric      InstrItinClass itin> : XForm_base_r3xo<31, xo, OOL, IOL, asmstr, itin, []> {
4678a4dda33SDimitry Andric  bits<5> T;
4688a4dda33SDimitry Andric  let RST = T;
4698a4dda33SDimitry Andric}
4708a4dda33SDimitry Andric
4710b57cec5SDimitry Andricclass XForm_attn<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
4720b57cec5SDimitry Andric                 InstrItinClass itin>
4730b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
4740b57cec5SDimitry Andric  let Inst{21-30} = xo;
4750b57cec5SDimitry Andric}
4760b57cec5SDimitry Andric
4770b57cec5SDimitry Andric// This is the same as XForm_base_r3xo, but the first two operands are swapped
4780b57cec5SDimitry Andric// when code is emitted.
4790b57cec5SDimitry Andricclass XForm_base_r3xo_swapped
4800b57cec5SDimitry Andric        <bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
4810b57cec5SDimitry Andric        InstrItinClass itin>
4820b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
48306c3fb27SDimitry Andric  bits<5> RA;
4840b57cec5SDimitry Andric  bits<5> RST;
48506c3fb27SDimitry Andric  bits<5> RB;
4860b57cec5SDimitry Andric
487480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
4880b57cec5SDimitry Andric
4890b57cec5SDimitry Andric  let Inst{6-10}  = RST;
49006c3fb27SDimitry Andric  let Inst{11-15} = RA;
49106c3fb27SDimitry Andric  let Inst{16-20} = RB;
4920b57cec5SDimitry Andric  let Inst{21-30} = xo;
4930b57cec5SDimitry Andric  let Inst{31}    = RC;
4940b57cec5SDimitry Andric}
4950b57cec5SDimitry Andric
4960b57cec5SDimitry Andric
4970b57cec5SDimitry Andricclass XForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
4980b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
4990b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
5000b57cec5SDimitry Andric
5010b57cec5SDimitry Andricclass XForm_1_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5020b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
5030b57cec5SDimitry Andric  : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
5040b57cec5SDimitry Andric
5050b57cec5SDimitry Andricclass XForm_1a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5060b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
5070b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
5080b57cec5SDimitry Andric  let RST = 0;
5090b57cec5SDimitry Andric}
5100b57cec5SDimitry Andric
5110b57cec5SDimitry Andricclass XForm_rs<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5120b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
5130b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
51406c3fb27SDimitry Andric  let RA = 0;
51506c3fb27SDimitry Andric  let RB = 0;
5160b57cec5SDimitry Andric}
5170b57cec5SDimitry Andric
5180b57cec5SDimitry Andricclass XForm_tlbws<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5190b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
5200b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
5210b57cec5SDimitry Andric  bits<5> RST;
52206c3fb27SDimitry Andric  bits<5> RA;
5230b57cec5SDimitry Andric  bits<1> WS;
5240b57cec5SDimitry Andric
5250b57cec5SDimitry Andric  let Pattern = pattern;
5260b57cec5SDimitry Andric
5270b57cec5SDimitry Andric  let Inst{6-10}  = RST;
52806c3fb27SDimitry Andric  let Inst{11-15} = RA;
5290b57cec5SDimitry Andric  let Inst{20}    = WS;
5300b57cec5SDimitry Andric  let Inst{21-30} = xo;
5310b57cec5SDimitry Andric  let Inst{31}    = 0;
5320b57cec5SDimitry Andric}
5330b57cec5SDimitry Andric
5340b57cec5SDimitry Andricclass XForm_6<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5350b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
5360b57cec5SDimitry Andric  : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
5370b57cec5SDimitry Andric  let Pattern = pattern;
5380b57cec5SDimitry Andric}
5390b57cec5SDimitry Andric
5400b57cec5SDimitry Andricclass XForm_8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5410b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
5420b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
5430b57cec5SDimitry Andric
5440b57cec5SDimitry Andricclass XForm_8_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5450b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
5460b57cec5SDimitry Andric  : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern>;
5470b57cec5SDimitry Andric
5480b57cec5SDimitry Andricclass XForm_10<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5490b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
5500b57cec5SDimitry Andric  : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
5510b57cec5SDimitry Andric    let Pattern = pattern;
5520b57cec5SDimitry Andric}
5530b57cec5SDimitry Andric
5540b57cec5SDimitry Andricclass XForm_11<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5550b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
5560b57cec5SDimitry Andric  : XForm_base_r3xo_swapped<opcode, xo, OOL, IOL, asmstr, itin> {
55706c3fb27SDimitry Andric  let RB = 0;
5580b57cec5SDimitry Andric  let Pattern = pattern;
5590b57cec5SDimitry Andric}
5600b57cec5SDimitry Andric
5610b57cec5SDimitry Andricclass XForm_16<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5620b57cec5SDimitry Andric               InstrItinClass itin>
5630b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
5640b57cec5SDimitry Andric  bits<3> BF;
5650b57cec5SDimitry Andric  bits<1> L;
5660b57cec5SDimitry Andric  bits<5> RA;
5670b57cec5SDimitry Andric  bits<5> RB;
5680b57cec5SDimitry Andric
5690b57cec5SDimitry Andric  let Inst{6-8}   = BF;
5700b57cec5SDimitry Andric  let Inst{9}     = 0;
5710b57cec5SDimitry Andric  let Inst{10}    = L;
5720b57cec5SDimitry Andric  let Inst{11-15} = RA;
5730b57cec5SDimitry Andric  let Inst{16-20} = RB;
5740b57cec5SDimitry Andric  let Inst{21-30} = xo;
5750b57cec5SDimitry Andric  let Inst{31}    = 0;
5760b57cec5SDimitry Andric}
5770b57cec5SDimitry Andric
5780b57cec5SDimitry Andricclass XForm_icbt<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5790b57cec5SDimitry Andric                 InstrItinClass itin>
5800b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
5810b57cec5SDimitry Andric  bits<4> CT;
5820b57cec5SDimitry Andric  bits<5> RA;
5830b57cec5SDimitry Andric  bits<5> RB;
5840b57cec5SDimitry Andric
5850b57cec5SDimitry Andric  let Inst{6} = 0;
5860b57cec5SDimitry Andric  let Inst{7-10} = CT;
5870b57cec5SDimitry Andric  let Inst{11-15} = RA;
5880b57cec5SDimitry Andric  let Inst{16-20} = RB;
5890b57cec5SDimitry Andric  let Inst{21-30} = xo;
5900b57cec5SDimitry Andric  let Inst{31} = 0;
5910b57cec5SDimitry Andric}
5920b57cec5SDimitry Andric
5930b57cec5SDimitry Andricclass XForm_sr<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
5940b57cec5SDimitry Andric                InstrItinClass itin>
5950b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
5960b57cec5SDimitry Andric  bits<5> RS;
5970b57cec5SDimitry Andric  bits<4> SR;
5980b57cec5SDimitry Andric
5990b57cec5SDimitry Andric  let Inst{6-10} = RS;
6000b57cec5SDimitry Andric  let Inst{12-15} = SR;
6010b57cec5SDimitry Andric  let Inst{21-30} = xo;
6020b57cec5SDimitry Andric}
6030b57cec5SDimitry Andric
6040b57cec5SDimitry Andricclass XForm_mbar<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
6050b57cec5SDimitry Andric                InstrItinClass itin>
6060b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
6070b57cec5SDimitry Andric  bits<5> MO;
6080b57cec5SDimitry Andric
6090b57cec5SDimitry Andric  let Inst{6-10} = MO;
6100b57cec5SDimitry Andric  let Inst{21-30} = xo;
6110b57cec5SDimitry Andric}
6120b57cec5SDimitry Andric
6130b57cec5SDimitry Andricclass XForm_srin<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
6140b57cec5SDimitry Andric                InstrItinClass itin>
6150b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
6160b57cec5SDimitry Andric  bits<5> RS;
6170b57cec5SDimitry Andric  bits<5> RB;
6180b57cec5SDimitry Andric
6190b57cec5SDimitry Andric  let Inst{6-10} = RS;
6200b57cec5SDimitry Andric  let Inst{16-20} = RB;
6210b57cec5SDimitry Andric  let Inst{21-30} = xo;
6220b57cec5SDimitry Andric}
6230b57cec5SDimitry Andric
6240b57cec5SDimitry Andricclass XForm_mtmsr<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
6250b57cec5SDimitry Andric                InstrItinClass itin>
6260b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
6270b57cec5SDimitry Andric  bits<5> RS;
6280b57cec5SDimitry Andric  bits<1> L;
6290b57cec5SDimitry Andric
6300b57cec5SDimitry Andric  let Inst{6-10} = RS;
6310b57cec5SDimitry Andric  let Inst{15} = L;
6320b57cec5SDimitry Andric  let Inst{21-30} = xo;
6330b57cec5SDimitry Andric}
6340b57cec5SDimitry Andric
6350b57cec5SDimitry Andricclass XForm_16_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
6360b57cec5SDimitry Andric                   InstrItinClass itin>
6370b57cec5SDimitry Andric  : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
6380b57cec5SDimitry Andric  let L = PPC64;
6390b57cec5SDimitry Andric}
6400b57cec5SDimitry Andric
6410b57cec5SDimitry Andricclass XForm_17<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
6420b57cec5SDimitry Andric               InstrItinClass itin>
6430b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
6440b57cec5SDimitry Andric  bits<3> BF;
64506c3fb27SDimitry Andric  bits<5> RA;
64606c3fb27SDimitry Andric  bits<5> RB;
6470b57cec5SDimitry Andric
6480b57cec5SDimitry Andric  let Inst{6-8}   = BF;
6490b57cec5SDimitry Andric  let Inst{9-10}  = 0;
65006c3fb27SDimitry Andric  let Inst{11-15} = RA;
65106c3fb27SDimitry Andric  let Inst{16-20} = RB;
6520b57cec5SDimitry Andric  let Inst{21-30} = xo;
6530b57cec5SDimitry Andric  let Inst{31}    = 0;
6540b57cec5SDimitry Andric}
6550b57cec5SDimitry Andric
6560b57cec5SDimitry Andricclass XForm_17a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
657e8d8bef9SDimitry Andric               InstrItinClass itin, list<dag> pattern>
6580b57cec5SDimitry Andric  : XForm_17<opcode, xo, OOL, IOL, asmstr, itin > {
65906c3fb27SDimitry Andric  let RA = 0;
660e8d8bef9SDimitry Andric  let Pattern = pattern;
6610b57cec5SDimitry Andric}
6620b57cec5SDimitry Andric
6630b57cec5SDimitry Andricclass XForm_18<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
6640b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
6650b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
6660b57cec5SDimitry Andric  bits<5> FRT;
6670b57cec5SDimitry Andric  bits<5> FRA;
6680b57cec5SDimitry Andric  bits<5> FRB;
6690b57cec5SDimitry Andric
6700b57cec5SDimitry Andric  let Pattern = pattern;
6710b57cec5SDimitry Andric
6720b57cec5SDimitry Andric  let Inst{6-10}  = FRT;
6730b57cec5SDimitry Andric  let Inst{11-15} = FRA;
6740b57cec5SDimitry Andric  let Inst{16-20} = FRB;
6750b57cec5SDimitry Andric  let Inst{21-30} = xo;
6760b57cec5SDimitry Andric  let Inst{31}    = 0;
6770b57cec5SDimitry Andric}
6780b57cec5SDimitry Andric
6790b57cec5SDimitry Andricclass XForm_19<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
6800b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
6810b57cec5SDimitry Andric  : XForm_18<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
6820b57cec5SDimitry Andric  let FRA = 0;
6830b57cec5SDimitry Andric}
6840b57cec5SDimitry Andric
6850b57cec5SDimitry Andricclass XForm_20<bits<6> opcode, bits<6> xo, dag OOL, dag IOL, string asmstr,
6860b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
6870b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
6880b57cec5SDimitry Andric  bits<5> FRT;
6890b57cec5SDimitry Andric  bits<5> FRA;
6900b57cec5SDimitry Andric  bits<5> FRB;
6910b57cec5SDimitry Andric  bits<4> tttt;
6920b57cec5SDimitry Andric
6930b57cec5SDimitry Andric  let Pattern = pattern;
6940b57cec5SDimitry Andric
6950b57cec5SDimitry Andric  let Inst{6-10}  = FRT;
6960b57cec5SDimitry Andric  let Inst{11-15} = FRA;
6970b57cec5SDimitry Andric  let Inst{16-20} = FRB;
6980b57cec5SDimitry Andric  let Inst{21-24} = tttt;
6990b57cec5SDimitry Andric  let Inst{25-30} = xo;
7000b57cec5SDimitry Andric  let Inst{31}    = 0;
7010b57cec5SDimitry Andric}
7020b57cec5SDimitry Andric
7030b57cec5SDimitry Andricclass XForm_24<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
7040b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
7050b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
7060b57cec5SDimitry Andric  let Pattern = pattern;
7070b57cec5SDimitry Andric  let Inst{6-10}  = 31;
7080b57cec5SDimitry Andric  let Inst{11-15} = 0;
7090b57cec5SDimitry Andric  let Inst{16-20} = 0;
7100b57cec5SDimitry Andric  let Inst{21-30} = xo;
7110b57cec5SDimitry Andric  let Inst{31}    = 0;
7120b57cec5SDimitry Andric}
7130b57cec5SDimitry Andric
7140b57cec5SDimitry Andricclass XForm_24_sync<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
7150b57cec5SDimitry Andric               string asmstr, InstrItinClass itin, list<dag> pattern>
7160b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
7170b57cec5SDimitry Andric  bits<2> L;
7180b57cec5SDimitry Andric
7190b57cec5SDimitry Andric  let Pattern = pattern;
7200b57cec5SDimitry Andric  let Inst{6-8}   = 0;
7210b57cec5SDimitry Andric  let Inst{9-10}  = L;
7220b57cec5SDimitry Andric  let Inst{11-15} = 0;
7230b57cec5SDimitry Andric  let Inst{16-20} = 0;
7240b57cec5SDimitry Andric  let Inst{21-30} = xo;
7250b57cec5SDimitry Andric  let Inst{31}    = 0;
7260b57cec5SDimitry Andric}
7270b57cec5SDimitry Andric
728*5f757f3fSDimitry Andricclass XForm_IMM2_IMM2<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
729*5f757f3fSDimitry Andric               string asmstr, InstrItinClass itin, list<dag> pattern>
730*5f757f3fSDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
731*5f757f3fSDimitry Andric  bits<2> L;
732*5f757f3fSDimitry Andric  bits<2> PL;
733*5f757f3fSDimitry Andric
734*5f757f3fSDimitry Andric  let Pattern = pattern;
735*5f757f3fSDimitry Andric  let Inst{6-8}   = 0;
736*5f757f3fSDimitry Andric  let Inst{9-10}  = L;
737*5f757f3fSDimitry Andric  let Inst{11-13} = 0;
738*5f757f3fSDimitry Andric  let Inst{14-15} = PL;
739*5f757f3fSDimitry Andric  let Inst{16-20} = 0;
740*5f757f3fSDimitry Andric  let Inst{21-30} = xo;
741*5f757f3fSDimitry Andric  let Inst{31}    = 0;
742*5f757f3fSDimitry Andric}
743*5f757f3fSDimitry Andric
744*5f757f3fSDimitry Andricclass XForm_IMM3_IMM2<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
745*5f757f3fSDimitry Andric               string asmstr, InstrItinClass itin, list<dag> pattern>
746*5f757f3fSDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
747*5f757f3fSDimitry Andric  bits<3> L;
748*5f757f3fSDimitry Andric  bits<2> SC;
749*5f757f3fSDimitry Andric
750*5f757f3fSDimitry Andric  let Pattern = pattern;
751*5f757f3fSDimitry Andric  let Inst{6-7}   = 0;
752*5f757f3fSDimitry Andric  let Inst{8-10}  = L;
753*5f757f3fSDimitry Andric  let Inst{11-13} = 0;
754*5f757f3fSDimitry Andric  let Inst{14-15} = SC;
755*5f757f3fSDimitry Andric  let Inst{16-20} = 0;
756*5f757f3fSDimitry Andric  let Inst{21-30} = xo;
757*5f757f3fSDimitry Andric  let Inst{31}    = 0;
758*5f757f3fSDimitry Andric}
759*5f757f3fSDimitry Andric
7600b57cec5SDimitry Andricclass XForm_24_eieio<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
7610b57cec5SDimitry Andric               string asmstr, InstrItinClass itin, list<dag> pattern>
7620b57cec5SDimitry Andric  : XForm_24_sync<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
7630b57cec5SDimitry Andric  let L = 0;
7640b57cec5SDimitry Andric}
7650b57cec5SDimitry Andric
7660b57cec5SDimitry Andricclass XForm_25<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
7670b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
7680b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
7690b57cec5SDimitry Andric}
7700b57cec5SDimitry Andric
7710b57cec5SDimitry Andricclass XForm_25_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
7720b57cec5SDimitry Andric                    string asmstr, InstrItinClass itin, list<dag> pattern>
7730b57cec5SDimitry Andric  : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
7740b57cec5SDimitry Andric}
7750b57cec5SDimitry Andric
7760b57cec5SDimitry Andric// [PO RT /// RB XO RC]
7770b57cec5SDimitry Andricclass XForm_26<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
7780b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
7790b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
78006c3fb27SDimitry Andric  let RA = 0;
7810b57cec5SDimitry Andric}
7820b57cec5SDimitry Andric
7830b57cec5SDimitry Andricclass XForm_28_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
7840b57cec5SDimitry Andric                    string asmstr, InstrItinClass itin, list<dag> pattern>
7850b57cec5SDimitry Andric  : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
7860b57cec5SDimitry Andric}
7870b57cec5SDimitry Andric
7880b57cec5SDimitry Andricclass XForm_28<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
7890b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
7900b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
7910b57cec5SDimitry Andric}
7920b57cec5SDimitry Andric
7930b57cec5SDimitry Andric// This is used for MFFS, MTFSB0, MTFSB1.  42 is arbitrary; this series of
7940b57cec5SDimitry Andric// numbers presumably relates to some document, but I haven't found it.
7950b57cec5SDimitry Andricclass XForm_42<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
7960b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
7970b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
7980b57cec5SDimitry Andric  let Pattern = pattern;
7990b57cec5SDimitry Andric
800480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
8010b57cec5SDimitry Andric
8020b57cec5SDimitry Andric  let Inst{6-10}  = RST;
8030b57cec5SDimitry Andric  let Inst{11-20} = 0;
8040b57cec5SDimitry Andric  let Inst{21-30} = xo;
8050b57cec5SDimitry Andric  let Inst{31}    = RC;
8060b57cec5SDimitry Andric}
8070b57cec5SDimitry Andricclass XForm_43<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
8080b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
8090b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
8100b57cec5SDimitry Andric  let Pattern = pattern;
8110b57cec5SDimitry Andric  bits<5> FM;
8120b57cec5SDimitry Andric
813480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
8140b57cec5SDimitry Andric
8150b57cec5SDimitry Andric  let Inst{6-10}  = FM;
8160b57cec5SDimitry Andric  let Inst{11-20} = 0;
8170b57cec5SDimitry Andric  let Inst{21-30} = xo;
8180b57cec5SDimitry Andric  let Inst{31}    = RC;
8190b57cec5SDimitry Andric}
8200b57cec5SDimitry Andric
8210b57cec5SDimitry Andricclass XForm_44<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
8220b57cec5SDimitry Andric               InstrItinClass itin>
8230b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
8240b57cec5SDimitry Andric  bits<5> RT;
8250b57cec5SDimitry Andric  bits<3> BFA;
8260b57cec5SDimitry Andric
8270b57cec5SDimitry Andric  let Inst{6-10}  = RT;
8280b57cec5SDimitry Andric  let Inst{11-13} = BFA;
8290b57cec5SDimitry Andric  let Inst{14-15} = 0;
8300b57cec5SDimitry Andric  let Inst{16-20} = 0;
8310b57cec5SDimitry Andric  let Inst{21-30} = xo;
8320b57cec5SDimitry Andric  let Inst{31}    = 0;
8330b57cec5SDimitry Andric}
8340b57cec5SDimitry Andric
8350b57cec5SDimitry Andricclass XForm_45<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
8360b57cec5SDimitry Andric               InstrItinClass itin>
8370b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
8380b57cec5SDimitry Andric  bits<5> RT;
8390b57cec5SDimitry Andric  bits<2> L;
8400b57cec5SDimitry Andric
8410b57cec5SDimitry Andric  let Inst{6-10}  = RT;
8420b57cec5SDimitry Andric  let Inst{11-13} = 0;
8430b57cec5SDimitry Andric  let Inst{14-15} = L;
8440b57cec5SDimitry Andric  let Inst{16-20} = 0;
8450b57cec5SDimitry Andric  let Inst{21-30} = xo;
8460b57cec5SDimitry Andric  let Inst{31}    = 0;
8470b57cec5SDimitry Andric}
8480b57cec5SDimitry Andric
8490b57cec5SDimitry Andricclass X_FRT5_XO2_XO3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2, bits<10> xo,
8500b57cec5SDimitry Andric                         dag OOL, dag IOL, string asmstr, InstrItinClass itin,
8510b57cec5SDimitry Andric                         list<dag> pattern>
8520b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
8530b57cec5SDimitry Andric  let Pattern = pattern;
8540b57cec5SDimitry Andric
8550b57cec5SDimitry Andric  let Inst{6-10}  = RST;
8560b57cec5SDimitry Andric  let Inst{11-12} = xo1;
8570b57cec5SDimitry Andric  let Inst{13-15} = xo2;
8580b57cec5SDimitry Andric  let Inst{16-20} = 0;
8590b57cec5SDimitry Andric  let Inst{21-30} = xo;
8600b57cec5SDimitry Andric  let Inst{31}    = 0;
8610b57cec5SDimitry Andric}
8620b57cec5SDimitry Andric
8630b57cec5SDimitry Andricclass X_FRT5_XO2_XO3_FRB5_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
8640b57cec5SDimitry Andric                              bits<10> xo, dag OOL, dag IOL, string asmstr,
8650b57cec5SDimitry Andric                              InstrItinClass itin, list<dag> pattern>
8660b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
8670b57cec5SDimitry Andric  let Pattern = pattern;
8680b57cec5SDimitry Andric  bits<5> FRB;
8690b57cec5SDimitry Andric
8700b57cec5SDimitry Andric  let Inst{6-10}  = RST;
8710b57cec5SDimitry Andric  let Inst{11-12} = xo1;
8720b57cec5SDimitry Andric  let Inst{13-15} = xo2;
8730b57cec5SDimitry Andric  let Inst{16-20} = FRB;
8740b57cec5SDimitry Andric  let Inst{21-30} = xo;
8750b57cec5SDimitry Andric  let Inst{31}    = 0;
8760b57cec5SDimitry Andric}
8770b57cec5SDimitry Andric
8780b57cec5SDimitry Andricclass X_FRT5_XO2_XO3_DRM3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
8790b57cec5SDimitry Andric                              bits<10> xo, dag OOL, dag IOL, string asmstr,
8800b57cec5SDimitry Andric                              InstrItinClass itin, list<dag> pattern>
8810b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
8820b57cec5SDimitry Andric  let Pattern = pattern;
8830b57cec5SDimitry Andric  bits<3> DRM;
8840b57cec5SDimitry Andric
8850b57cec5SDimitry Andric  let Inst{6-10}  = RST;
8860b57cec5SDimitry Andric  let Inst{11-12} = xo1;
8870b57cec5SDimitry Andric  let Inst{13-15} = xo2;
8880b57cec5SDimitry Andric  let Inst{16-17} = 0;
8890b57cec5SDimitry Andric  let Inst{18-20} = DRM;
8900b57cec5SDimitry Andric  let Inst{21-30} = xo;
8910b57cec5SDimitry Andric  let Inst{31}    = 0;
8920b57cec5SDimitry Andric}
8930b57cec5SDimitry Andric
8940b57cec5SDimitry Andricclass X_FRT5_XO2_XO3_RM2_X10<bits<6> opcode, bits<2> xo1, bits<3> xo2,
8950b57cec5SDimitry Andric                            bits<10> xo, dag OOL, dag IOL, string asmstr,
8960b57cec5SDimitry Andric                            InstrItinClass itin, list<dag> pattern>
8970b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
8980b57cec5SDimitry Andric  let Pattern = pattern;
8990b57cec5SDimitry Andric  bits<2> RM;
9000b57cec5SDimitry Andric
9010b57cec5SDimitry Andric  let Inst{6-10}  = RST;
9020b57cec5SDimitry Andric  let Inst{11-12} = xo1;
9030b57cec5SDimitry Andric  let Inst{13-15} = xo2;
9040b57cec5SDimitry Andric  let Inst{16-18} = 0;
9050b57cec5SDimitry Andric  let Inst{19-20} = RM;
9060b57cec5SDimitry Andric  let Inst{21-30} = xo;
9070b57cec5SDimitry Andric  let Inst{31}    = 0;
9080b57cec5SDimitry Andric}
9090b57cec5SDimitry Andric
9100b57cec5SDimitry Andric
9110b57cec5SDimitry Andricclass XForm_0<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
9120b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
9130b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
9140b57cec5SDimitry Andric  let RST = 0;
91506c3fb27SDimitry Andric  let RA = 0;
91606c3fb27SDimitry Andric  let RB = 0;
9170b57cec5SDimitry Andric}
9180b57cec5SDimitry Andric
9190b57cec5SDimitry Andricclass XForm_16b<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
9200b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
9210b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
9220b57cec5SDimitry Andric  let RST = 0;
92306c3fb27SDimitry Andric  let RA = 0;
9240b57cec5SDimitry Andric}
9250b57cec5SDimitry Andric
9260b57cec5SDimitry Andricclass XForm_htm0<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
927349cc55cSDimitry Andric                 string asmstr, InstrItinClass itin>
9280b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
9290b57cec5SDimitry Andric  bit R;
9300b57cec5SDimitry Andric
9310b57cec5SDimitry Andric  bit RC = 1;
9320b57cec5SDimitry Andric
9330b57cec5SDimitry Andric  let Inst{6-9}   = 0;
9340b57cec5SDimitry Andric  let Inst{10}    = R;
9350b57cec5SDimitry Andric  let Inst{11-20} = 0;
9360b57cec5SDimitry Andric  let Inst{21-30} = xo;
9370b57cec5SDimitry Andric  let Inst{31}    = RC;
9380b57cec5SDimitry Andric}
9390b57cec5SDimitry Andric
9400b57cec5SDimitry Andricclass XForm_htm1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
941349cc55cSDimitry Andric                 string asmstr, InstrItinClass itin>
9420b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
9430b57cec5SDimitry Andric  bit A;
9440b57cec5SDimitry Andric
9450b57cec5SDimitry Andric  bit RC = 1;
9460b57cec5SDimitry Andric
9470b57cec5SDimitry Andric  let Inst{6}     = A;
9480b57cec5SDimitry Andric  let Inst{7-20}  = 0;
9490b57cec5SDimitry Andric  let Inst{21-30} = xo;
9500b57cec5SDimitry Andric  let Inst{31}    = RC;
9510b57cec5SDimitry Andric}
9520b57cec5SDimitry Andric
9530b57cec5SDimitry Andricclass XForm_htm2<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
954349cc55cSDimitry Andric              InstrItinClass itin>
9550b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
9560b57cec5SDimitry Andric  bit L;
9570b57cec5SDimitry Andric
958480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
9590b57cec5SDimitry Andric
9600b57cec5SDimitry Andric  let Inst{7-9}   = 0;
9610b57cec5SDimitry Andric  let Inst{10}    = L;
9620b57cec5SDimitry Andric  let Inst{11-20} = 0;
9630b57cec5SDimitry Andric  let Inst{21-30} = xo;
9640b57cec5SDimitry Andric  let Inst{31}    = RC;
9650b57cec5SDimitry Andric}
9660b57cec5SDimitry Andric
9670b57cec5SDimitry Andricclass XForm_htm3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
968349cc55cSDimitry Andric              InstrItinClass itin>
9690b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
9700b57cec5SDimitry Andric  bits<3> BF;
9710b57cec5SDimitry Andric
9720b57cec5SDimitry Andric  bit RC = 0;
9730b57cec5SDimitry Andric
9740b57cec5SDimitry Andric  let Inst{6-8}   = BF;
9750b57cec5SDimitry Andric  let Inst{9-20}  = 0;
9760b57cec5SDimitry Andric  let Inst{21-30} = xo;
9770b57cec5SDimitry Andric  let Inst{31}    = RC;
9780b57cec5SDimitry Andric}
9790b57cec5SDimitry Andric
9800b57cec5SDimitry Andric// [PO RT RA RB XO /]
9810b57cec5SDimitry Andricclass X_BF3_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
9820b57cec5SDimitry Andric                       string asmstr, InstrItinClass itin, list<dag> pattern>
9830b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
9840b57cec5SDimitry Andric  bits<3> BF;
9850b57cec5SDimitry Andric  bits<1> L;
9860b57cec5SDimitry Andric  bits<5> RA;
9870b57cec5SDimitry Andric  bits<5> RB;
9880b57cec5SDimitry Andric
9890b57cec5SDimitry Andric  let Pattern = pattern;
9900b57cec5SDimitry Andric
9910b57cec5SDimitry Andric  let Inst{6-8}   = BF;
9920b57cec5SDimitry Andric  let Inst{9}     = 0;
9930b57cec5SDimitry Andric  let Inst{10}    = L;
9940b57cec5SDimitry Andric  let Inst{11-15} = RA;
9950b57cec5SDimitry Andric  let Inst{16-20} = RB;
9960b57cec5SDimitry Andric  let Inst{21-30} = xo;
9970b57cec5SDimitry Andric  let Inst{31}    = 0;
9980b57cec5SDimitry Andric}
9990b57cec5SDimitry Andric
10000b57cec5SDimitry Andric// Same as XForm_17 but with GPR's and new naming convention
10010b57cec5SDimitry Andricclass X_BF3_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
10020b57cec5SDimitry Andric                    string asmstr, InstrItinClass itin, list<dag> pattern>
10030b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
10040b57cec5SDimitry Andric  bits<3> BF;
10050b57cec5SDimitry Andric  bits<5> RA;
10060b57cec5SDimitry Andric  bits<5> RB;
10070b57cec5SDimitry Andric
10080b57cec5SDimitry Andric  let Pattern = pattern;
10090b57cec5SDimitry Andric
10100b57cec5SDimitry Andric  let Inst{6-8}   = BF;
10110b57cec5SDimitry Andric  let Inst{9-10}  = 0;
10120b57cec5SDimitry Andric  let Inst{11-15} = RA;
10130b57cec5SDimitry Andric  let Inst{16-20} = RB;
10140b57cec5SDimitry Andric  let Inst{21-30} = xo;
10150b57cec5SDimitry Andric  let Inst{31}    = 0;
10160b57cec5SDimitry Andric}
10170b57cec5SDimitry Andric
10180b57cec5SDimitry Andric// e.g. [PO VRT XO VRB XO /] or [PO VRT XO VRB XO RO]
10190b57cec5SDimitry Andricclass X_RD5_XO5_RS5<bits<6> opcode, bits<5> xo2, bits<10> xo, dag OOL, dag IOL,
10200b57cec5SDimitry Andric                    string asmstr, InstrItinClass itin, list<dag> pattern>
10210b57cec5SDimitry Andric  : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
102206c3fb27SDimitry Andric  let RA = xo2;
10230b57cec5SDimitry Andric}
10240b57cec5SDimitry Andric
10250b57cec5SDimitry Andricclass X_BF3_DCMX7_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
10260b57cec5SDimitry Andric                      string asmstr, InstrItinClass itin, list<dag> pattern>
10270b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
10280b57cec5SDimitry Andric  bits<3> BF;
10290b57cec5SDimitry Andric  bits<7> DCMX;
10300b57cec5SDimitry Andric  bits<5> VB;
10310b57cec5SDimitry Andric
10320b57cec5SDimitry Andric  let Pattern = pattern;
10330b57cec5SDimitry Andric
10340b57cec5SDimitry Andric  let Inst{6-8}  = BF;
10350b57cec5SDimitry Andric  let Inst{9-15} = DCMX;
10360b57cec5SDimitry Andric  let Inst{16-20} = VB;
10370b57cec5SDimitry Andric  let Inst{21-30} = xo;
10380b57cec5SDimitry Andric  let Inst{31}    = 0;
10390b57cec5SDimitry Andric}
10400b57cec5SDimitry Andric
10410b57cec5SDimitry Andricclass X_RD6_IMM8<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
10420b57cec5SDimitry Andric                 string asmstr, InstrItinClass itin, list<dag> pattern>
10430b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
10440b57cec5SDimitry Andric  bits<6> XT;
10450b57cec5SDimitry Andric  bits<8> IMM8;
10460b57cec5SDimitry Andric
10470b57cec5SDimitry Andric  let Pattern = pattern;
10480b57cec5SDimitry Andric
10490b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
10500b57cec5SDimitry Andric  let Inst{11-12} = 0;
10510b57cec5SDimitry Andric  let Inst{13-20} = IMM8;
10520b57cec5SDimitry Andric  let Inst{21-30} = xo;
10530b57cec5SDimitry Andric  let Inst{31}    = XT{5};
10540b57cec5SDimitry Andric}
10550b57cec5SDimitry Andric
10560b57cec5SDimitry Andric// XForm_base_r3xo for instructions such as P9 atomics where we don't want
10570b57cec5SDimitry Andric// to specify an SDAG pattern for matching.
10580b57cec5SDimitry Andricclass X_RD5_RS5_IM5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
10590b57cec5SDimitry Andric                    string asmstr, InstrItinClass itin>
10600b57cec5SDimitry Andric  : XForm_base_r3xo_memOp<opcode, xo, OOL, IOL, asmstr, itin, []> {
10610b57cec5SDimitry Andric}
10620b57cec5SDimitry Andric
10630b57cec5SDimitry Andricclass X_BF3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
10640b57cec5SDimitry Andric            InstrItinClass itin>
10650b57cec5SDimitry Andric  : XForm_17<opcode, xo, OOL, IOL, asmstr, itin> {
106606c3fb27SDimitry Andric  let RA = 0;
106706c3fb27SDimitry Andric  let RB = 0;
10680b57cec5SDimitry Andric}
10690b57cec5SDimitry Andric
10700b57cec5SDimitry Andric// [PO /// L RA RB XO /]
10710b57cec5SDimitry Andricclass X_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
10720b57cec5SDimitry Andric                   string asmstr, InstrItinClass itin, list<dag> pattern>
10730b57cec5SDimitry Andric  : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> {
10740b57cec5SDimitry Andric  let BF = 0;
10750b57cec5SDimitry Andric  let Pattern = pattern;
10760b57cec5SDimitry Andric
10770b57cec5SDimitry Andric  bit RC = 0;
10780b57cec5SDimitry Andric  let Inst{31} = RC;
10790b57cec5SDimitry Andric}
10800b57cec5SDimitry Andric
10810b57cec5SDimitry Andric// XX*-Form (VSX)
10820b57cec5SDimitry Andricclass XX1Form<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
10830b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
10840b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
10850b57cec5SDimitry Andric  bits<6> XT;
108606c3fb27SDimitry Andric  bits<5> RA;
108706c3fb27SDimitry Andric  bits<5> RB;
10880b57cec5SDimitry Andric
10890b57cec5SDimitry Andric  let Pattern = pattern;
10900b57cec5SDimitry Andric
10910b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
109206c3fb27SDimitry Andric  let Inst{11-15} = RA;
109306c3fb27SDimitry Andric  let Inst{16-20} = RB;
10940b57cec5SDimitry Andric  let Inst{21-30} = xo;
10950b57cec5SDimitry Andric  let Inst{31}    = XT{5};
10960b57cec5SDimitry Andric}
10970b57cec5SDimitry Andric
10980b57cec5SDimitry Andricclass XX1Form_memOp<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
10990b57cec5SDimitry Andric                    string asmstr, InstrItinClass itin, list<dag> pattern>
11000b57cec5SDimitry Andric  : XX1Form<opcode, xo, OOL, IOL, asmstr, itin, pattern>, XFormMemOp;
11010b57cec5SDimitry Andric
11020b57cec5SDimitry Andricclass XX1_RS6_RD5_XO<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
11030b57cec5SDimitry Andric                     string asmstr, InstrItinClass itin, list<dag> pattern>
11040b57cec5SDimitry Andric  : XX1Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
110506c3fb27SDimitry Andric  let RB = 0;
11060b57cec5SDimitry Andric}
11070b57cec5SDimitry Andric
11080b57cec5SDimitry Andricclass XX2Form<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
11090b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
11100b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
11110b57cec5SDimitry Andric  bits<6> XT;
11120b57cec5SDimitry Andric  bits<6> XB;
11130b57cec5SDimitry Andric
11140b57cec5SDimitry Andric  let Pattern = pattern;
11150b57cec5SDimitry Andric
11160b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
11170b57cec5SDimitry Andric  let Inst{11-15} = 0;
11180b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
11190b57cec5SDimitry Andric  let Inst{21-29} = xo;
11200b57cec5SDimitry Andric  let Inst{30}    = XB{5};
11210b57cec5SDimitry Andric  let Inst{31}    = XT{5};
11220b57cec5SDimitry Andric}
11230b57cec5SDimitry Andric
11240b57cec5SDimitry Andricclass XX2Form_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
11250b57cec5SDimitry Andric                InstrItinClass itin, list<dag> pattern>
11260b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
11270b57cec5SDimitry Andric  bits<3> CR;
11280b57cec5SDimitry Andric  bits<6> XB;
11290b57cec5SDimitry Andric
11300b57cec5SDimitry Andric  let Pattern = pattern;
11310b57cec5SDimitry Andric
11320b57cec5SDimitry Andric  let Inst{6-8}   = CR;
11330b57cec5SDimitry Andric  let Inst{9-15}  = 0;
11340b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
11350b57cec5SDimitry Andric  let Inst{21-29} = xo;
11360b57cec5SDimitry Andric  let Inst{30}    = XB{5};
11370b57cec5SDimitry Andric  let Inst{31}    = 0;
11380b57cec5SDimitry Andric}
11390b57cec5SDimitry Andric
11400b57cec5SDimitry Andricclass XX2Form_2<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
11410b57cec5SDimitry Andric                InstrItinClass itin, list<dag> pattern>
11420b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
11430b57cec5SDimitry Andric  bits<6> XT;
11440b57cec5SDimitry Andric  bits<6> XB;
11450b57cec5SDimitry Andric  bits<2> D;
11460b57cec5SDimitry Andric
11470b57cec5SDimitry Andric  let Pattern = pattern;
11480b57cec5SDimitry Andric
11490b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
11500b57cec5SDimitry Andric  let Inst{11-13} = 0;
11510b57cec5SDimitry Andric  let Inst{14-15} = D;
11520b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
11530b57cec5SDimitry Andric  let Inst{21-29} = xo;
11540b57cec5SDimitry Andric  let Inst{30}    = XB{5};
11550b57cec5SDimitry Andric  let Inst{31}    = XT{5};
11560b57cec5SDimitry Andric}
11570b57cec5SDimitry Andric
11580b57cec5SDimitry Andricclass XX2_RD6_UIM5_RS6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
11590b57cec5SDimitry Andric                       string asmstr, InstrItinClass itin, list<dag> pattern>
11600b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
11610b57cec5SDimitry Andric  bits<6> XT;
11620b57cec5SDimitry Andric  bits<6> XB;
11630b57cec5SDimitry Andric  bits<5> UIM5;
11640b57cec5SDimitry Andric
11650b57cec5SDimitry Andric  let Pattern = pattern;
11660b57cec5SDimitry Andric
11670b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
11680b57cec5SDimitry Andric  let Inst{11-15} = UIM5;
11690b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
11700b57cec5SDimitry Andric  let Inst{21-29} = xo;
11710b57cec5SDimitry Andric  let Inst{30}    = XB{5};
11720b57cec5SDimitry Andric  let Inst{31}    = XT{5};
11730b57cec5SDimitry Andric}
11740b57cec5SDimitry Andric
11750b57cec5SDimitry Andric// [PO T XO B XO BX /]
11760b57cec5SDimitry Andricclass XX2_RD5_XO5_RS6<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL, dag IOL,
11770b57cec5SDimitry Andric                       string asmstr, InstrItinClass itin, list<dag> pattern>
11780b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
11790b57cec5SDimitry Andric  bits<5> RT;
11800b57cec5SDimitry Andric  bits<6> XB;
11810b57cec5SDimitry Andric
11820b57cec5SDimitry Andric  let Pattern = pattern;
11830b57cec5SDimitry Andric
11840b57cec5SDimitry Andric  let Inst{6-10}  = RT;
11850b57cec5SDimitry Andric  let Inst{11-15} = xo2;
11860b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
11870b57cec5SDimitry Andric  let Inst{21-29} = xo;
11880b57cec5SDimitry Andric  let Inst{30}    = XB{5};
11890b57cec5SDimitry Andric  let Inst{31}    = 0;
11900b57cec5SDimitry Andric}
11910b57cec5SDimitry Andric
11920b57cec5SDimitry Andric// [PO T XO B XO BX TX]
11930b57cec5SDimitry Andricclass XX2_RD6_XO5_RS6<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL, dag IOL,
11940b57cec5SDimitry Andric                      string asmstr, InstrItinClass itin, list<dag> pattern>
11950b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
11960b57cec5SDimitry Andric  bits<6> XT;
11970b57cec5SDimitry Andric  bits<6> XB;
11980b57cec5SDimitry Andric
11990b57cec5SDimitry Andric  let Pattern = pattern;
12000b57cec5SDimitry Andric
12010b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
12020b57cec5SDimitry Andric  let Inst{11-15} = xo2;
12030b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
12040b57cec5SDimitry Andric  let Inst{21-29} = xo;
12050b57cec5SDimitry Andric  let Inst{30}    = XB{5};
12060b57cec5SDimitry Andric  let Inst{31}    = XT{5};
12070b57cec5SDimitry Andric}
12080b57cec5SDimitry Andric
12090b57cec5SDimitry Andricclass XX2_BF3_DCMX7_RS6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
12100b57cec5SDimitry Andric                      string asmstr, InstrItinClass itin, list<dag> pattern>
12110b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
12120b57cec5SDimitry Andric  bits<3> BF;
12130b57cec5SDimitry Andric  bits<7> DCMX;
12140b57cec5SDimitry Andric  bits<6> XB;
12150b57cec5SDimitry Andric
12160b57cec5SDimitry Andric  let Pattern = pattern;
12170b57cec5SDimitry Andric
12180b57cec5SDimitry Andric  let Inst{6-8}  = BF;
12190b57cec5SDimitry Andric  let Inst{9-15} = DCMX;
12200b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
12210b57cec5SDimitry Andric  let Inst{21-29} = xo;
12220b57cec5SDimitry Andric  let Inst{30}    = XB{5};
12230b57cec5SDimitry Andric  let Inst{31}    = 0;
12240b57cec5SDimitry Andric}
12250b57cec5SDimitry Andric
12260b57cec5SDimitry Andricclass XX2_RD6_DCMX7_RS6<bits<6> opcode, bits<4> xo1, bits<3> xo2,
12270b57cec5SDimitry Andric                        dag OOL, dag IOL, string asmstr, InstrItinClass itin,
12280b57cec5SDimitry Andric                        list<dag> pattern>
12290b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
12300b57cec5SDimitry Andric  bits<6> XT;
12310b57cec5SDimitry Andric  bits<7> DCMX;
12320b57cec5SDimitry Andric  bits<6> XB;
12330b57cec5SDimitry Andric
12340b57cec5SDimitry Andric  let Pattern = pattern;
12350b57cec5SDimitry Andric
12360b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
12370b57cec5SDimitry Andric  let Inst{11-15} = DCMX{4-0};
12380b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
12390b57cec5SDimitry Andric  let Inst{21-24} = xo1;
12400b57cec5SDimitry Andric  let Inst{25}    = DCMX{6};
12410b57cec5SDimitry Andric  let Inst{26-28} = xo2;
12420b57cec5SDimitry Andric  let Inst{29}    = DCMX{5};
12430b57cec5SDimitry Andric  let Inst{30}    = XB{5};
12440b57cec5SDimitry Andric  let Inst{31}    = XT{5};
12450b57cec5SDimitry Andric}
12460b57cec5SDimitry Andric
1247fe6060f1SDimitry Andricclass XForm_XD6_RA5_RB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
1248fe6060f1SDimitry Andric                        string asmstr, InstrItinClass itin, list<dag> pattern>
1249fe6060f1SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
125006c3fb27SDimitry Andric  bits<5> RA;
125106c3fb27SDimitry Andric  bits<6> D;
1252fe6060f1SDimitry Andric  bits<5> RB;
1253fe6060f1SDimitry Andric
1254fe6060f1SDimitry Andric  let Pattern = pattern;
1255fe6060f1SDimitry Andric
125606c3fb27SDimitry Andric  let Inst{6-10}  = D{4-0};  // D
125706c3fb27SDimitry Andric  let Inst{11-15} = RA;
1258fe6060f1SDimitry Andric  let Inst{16-20} = RB;
1259fe6060f1SDimitry Andric  let Inst{21-30} = xo;
126006c3fb27SDimitry Andric  let Inst{31}    = D{5};    // DX
126106c3fb27SDimitry Andric}
126206c3fb27SDimitry Andric
126306c3fb27SDimitry Andricclass XForm_BF3_UIM6_FRB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
126406c3fb27SDimitry Andric                          string asmstr, InstrItinClass itin, list<dag> pattern>
126506c3fb27SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
126606c3fb27SDimitry Andric  bits<3> BF;
126706c3fb27SDimitry Andric  bits<6> UIM;
126806c3fb27SDimitry Andric  bits<5> FRB;
126906c3fb27SDimitry Andric
127006c3fb27SDimitry Andric  let Pattern = pattern;
127106c3fb27SDimitry Andric
127206c3fb27SDimitry Andric  let Inst{6-8}   = BF;
127306c3fb27SDimitry Andric  let Inst{9}     = 0;
127406c3fb27SDimitry Andric  let Inst{10-15} = UIM;
127506c3fb27SDimitry Andric  let Inst{16-20} = FRB;
127606c3fb27SDimitry Andric  let Inst{21-30} = xo;
127706c3fb27SDimitry Andric  let Inst{31}    = 0;
127806c3fb27SDimitry Andric}
127906c3fb27SDimitry Andric
128006c3fb27SDimitry Andricclass XForm_SP2_FRTB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
128106c3fb27SDimitry Andric                  list<dag> pattern, InstrItinClass itin>
128206c3fb27SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
128306c3fb27SDimitry Andric  bits<2> SP;
128406c3fb27SDimitry Andric  bits<5> FRT;
128506c3fb27SDimitry Andric  bits<5> FRB;
128606c3fb27SDimitry Andric
128706c3fb27SDimitry Andric  let Pattern = pattern;
128806c3fb27SDimitry Andric
128906c3fb27SDimitry Andric  bit RC = 0; // set by isRecordForm
129006c3fb27SDimitry Andric
129106c3fb27SDimitry Andric  let Inst{6 - 10} = FRT;
129206c3fb27SDimitry Andric  let Inst{11 - 12} = SP;
129306c3fb27SDimitry Andric  let Inst{13 - 15} = 0;
129406c3fb27SDimitry Andric  let Inst{16 - 20} = FRB;
129506c3fb27SDimitry Andric  let Inst{21 - 30} = xo;
129606c3fb27SDimitry Andric  let Inst{31} = RC;
129706c3fb27SDimitry Andric}
129806c3fb27SDimitry Andric
129906c3fb27SDimitry Andricclass XForm_S1_FRTB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
130006c3fb27SDimitry Andric                 string asmstr, list<dag> pattern, InstrItinClass itin>
130106c3fb27SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
130206c3fb27SDimitry Andric  bit S;
130306c3fb27SDimitry Andric  bits<5> FRT;
130406c3fb27SDimitry Andric  bits<5> FRB;
130506c3fb27SDimitry Andric
130606c3fb27SDimitry Andric  let Pattern = pattern;
130706c3fb27SDimitry Andric
130806c3fb27SDimitry Andric  bit RC = 0; // set by isRecordForm
130906c3fb27SDimitry Andric
131006c3fb27SDimitry Andric  let Inst{6 - 10} = FRT;
131106c3fb27SDimitry Andric  let Inst{11} = S;
131206c3fb27SDimitry Andric  let Inst{12 - 15} = 0;
131306c3fb27SDimitry Andric  let Inst{16 - 20} = FRB;
131406c3fb27SDimitry Andric  let Inst{21 - 30} = xo;
131506c3fb27SDimitry Andric  let Inst{31} = RC;
1316fe6060f1SDimitry Andric}
1317fe6060f1SDimitry Andric
13180b57cec5SDimitry Andricclass XX3Form<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
13190b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
13200b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
13210b57cec5SDimitry Andric  bits<6> XT;
13220b57cec5SDimitry Andric  bits<6> XA;
13230b57cec5SDimitry Andric  bits<6> XB;
13240b57cec5SDimitry Andric
13250b57cec5SDimitry Andric  let Pattern = pattern;
13260b57cec5SDimitry Andric
13270b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
13280b57cec5SDimitry Andric  let Inst{11-15} = XA{4-0};
13290b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
13300b57cec5SDimitry Andric  let Inst{21-28} = xo;
13310b57cec5SDimitry Andric  let Inst{29}    = XA{5};
13320b57cec5SDimitry Andric  let Inst{30}    = XB{5};
13330b57cec5SDimitry Andric  let Inst{31}    = XT{5};
13340b57cec5SDimitry Andric}
13350b57cec5SDimitry Andric
13368bcb0991SDimitry Andricclass XX3Form_SameOp<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
13370b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
13380b57cec5SDimitry Andric  : XX3Form<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
13390b57cec5SDimitry Andric  let XA = XT;
13400b57cec5SDimitry Andric  let XB = XT;
13410b57cec5SDimitry Andric}
13420b57cec5SDimitry Andric
13430b57cec5SDimitry Andricclass XX3Form_1<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
13440b57cec5SDimitry Andric                InstrItinClass itin, list<dag> pattern>
13450b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
13460b57cec5SDimitry Andric  bits<3> CR;
13470b57cec5SDimitry Andric  bits<6> XA;
13480b57cec5SDimitry Andric  bits<6> XB;
13490b57cec5SDimitry Andric
13500b57cec5SDimitry Andric  let Pattern = pattern;
13510b57cec5SDimitry Andric
13520b57cec5SDimitry Andric  let Inst{6-8}   = CR;
13530b57cec5SDimitry Andric  let Inst{9-10}  = 0;
13540b57cec5SDimitry Andric  let Inst{11-15} = XA{4-0};
13550b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
13560b57cec5SDimitry Andric  let Inst{21-28} = xo;
13570b57cec5SDimitry Andric  let Inst{29}    = XA{5};
13580b57cec5SDimitry Andric  let Inst{30}    = XB{5};
13590b57cec5SDimitry Andric  let Inst{31}    = 0;
13600b57cec5SDimitry Andric}
13610b57cec5SDimitry Andric
13620b57cec5SDimitry Andricclass XX3Form_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
13630b57cec5SDimitry Andric                InstrItinClass itin, list<dag> pattern>
13640b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
13650b57cec5SDimitry Andric  bits<6> XT;
13660b57cec5SDimitry Andric  bits<6> XA;
13670b57cec5SDimitry Andric  bits<6> XB;
13680b57cec5SDimitry Andric  bits<2> D;
13690b57cec5SDimitry Andric
13700b57cec5SDimitry Andric  let Pattern = pattern;
13710b57cec5SDimitry Andric
13720b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
13730b57cec5SDimitry Andric  let Inst{11-15} = XA{4-0};
13740b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
13750b57cec5SDimitry Andric  let Inst{21}    = 0;
13760b57cec5SDimitry Andric  let Inst{22-23} = D;
13770b57cec5SDimitry Andric  let Inst{24-28} = xo;
13780b57cec5SDimitry Andric  let Inst{29}    = XA{5};
13790b57cec5SDimitry Andric  let Inst{30}    = XB{5};
13800b57cec5SDimitry Andric  let Inst{31}    = XT{5};
13810b57cec5SDimitry Andric}
13820b57cec5SDimitry Andric
13830b57cec5SDimitry Andricclass XX3Form_Rc<bits<6> opcode, bits<7> xo, dag OOL, dag IOL, string asmstr,
13840b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
13850b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
13860b57cec5SDimitry Andric  bits<6> XT;
13870b57cec5SDimitry Andric  bits<6> XA;
13880b57cec5SDimitry Andric  bits<6> XB;
13890b57cec5SDimitry Andric
13900b57cec5SDimitry Andric  let Pattern = pattern;
13910b57cec5SDimitry Andric
1392480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
13930b57cec5SDimitry Andric
13940b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
13950b57cec5SDimitry Andric  let Inst{11-15} = XA{4-0};
13960b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
13970b57cec5SDimitry Andric  let Inst{21}    = RC;
13980b57cec5SDimitry Andric  let Inst{22-28} = xo;
13990b57cec5SDimitry Andric  let Inst{29}    = XA{5};
14000b57cec5SDimitry Andric  let Inst{30}    = XB{5};
14010b57cec5SDimitry Andric  let Inst{31}    = XT{5};
14020b57cec5SDimitry Andric}
14030b57cec5SDimitry Andric
14040b57cec5SDimitry Andricclass XX4Form<bits<6> opcode, bits<2> xo, dag OOL, dag IOL, string asmstr,
14050b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
14060b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
14070b57cec5SDimitry Andric  bits<6> XT;
14080b57cec5SDimitry Andric  bits<6> XA;
14090b57cec5SDimitry Andric  bits<6> XB;
14100b57cec5SDimitry Andric  bits<6> XC;
14110b57cec5SDimitry Andric
14120b57cec5SDimitry Andric  let Pattern = pattern;
14130b57cec5SDimitry Andric
14140b57cec5SDimitry Andric  let Inst{6-10}  = XT{4-0};
14150b57cec5SDimitry Andric  let Inst{11-15} = XA{4-0};
14160b57cec5SDimitry Andric  let Inst{16-20} = XB{4-0};
14170b57cec5SDimitry Andric  let Inst{21-25} = XC{4-0};
14180b57cec5SDimitry Andric  let Inst{26-27} = xo;
14190b57cec5SDimitry Andric  let Inst{28}    = XC{5};
14200b57cec5SDimitry Andric  let Inst{29}    = XA{5};
14210b57cec5SDimitry Andric  let Inst{30}    = XB{5};
14220b57cec5SDimitry Andric  let Inst{31}    = XT{5};
14230b57cec5SDimitry Andric}
14240b57cec5SDimitry Andric
14250b57cec5SDimitry Andric// DCB_Form - Form X instruction, used for dcb* instructions.
14260b57cec5SDimitry Andricclass DCB_Form<bits<10> xo, bits<5> immfield, dag OOL, dag IOL, string asmstr,
14270b57cec5SDimitry Andric                      InstrItinClass itin, list<dag> pattern>
14280b57cec5SDimitry Andric  : I<31, OOL, IOL, asmstr, itin> {
142906c3fb27SDimitry Andric  bits<5> RA;
143006c3fb27SDimitry Andric  bits<5> RB;
14310b57cec5SDimitry Andric
14320b57cec5SDimitry Andric  let Pattern = pattern;
14330b57cec5SDimitry Andric
14340b57cec5SDimitry Andric  let Inst{6-10}  = immfield;
143506c3fb27SDimitry Andric  let Inst{11-15} = RA;
143606c3fb27SDimitry Andric  let Inst{16-20} = RB;
14370b57cec5SDimitry Andric  let Inst{21-30} = xo;
14380b57cec5SDimitry Andric  let Inst{31}    = 0;
14390b57cec5SDimitry Andric}
14400b57cec5SDimitry Andric
14410b57cec5SDimitry Andricclass DCB_Form_hint<bits<10> xo, dag OOL, dag IOL, string asmstr,
14420b57cec5SDimitry Andric                    InstrItinClass itin, list<dag> pattern>
14430b57cec5SDimitry Andric  : I<31, OOL, IOL, asmstr, itin> {
14440b57cec5SDimitry Andric  bits<5> TH;
144506c3fb27SDimitry Andric  bits<5> RA;
144606c3fb27SDimitry Andric  bits<5> RB;
14470b57cec5SDimitry Andric
14480b57cec5SDimitry Andric  let Pattern = pattern;
14490b57cec5SDimitry Andric
14500b57cec5SDimitry Andric  let Inst{6-10}  = TH;
145106c3fb27SDimitry Andric  let Inst{11-15} = RA;
145206c3fb27SDimitry Andric  let Inst{16-20} = RB;
14530b57cec5SDimitry Andric  let Inst{21-30} = xo;
14540b57cec5SDimitry Andric  let Inst{31}    = 0;
14550b57cec5SDimitry Andric}
14560b57cec5SDimitry Andric
14570b57cec5SDimitry Andric// DSS_Form - Form X instruction, used for altivec dss* instructions.
14580b57cec5SDimitry Andricclass DSS_Form<bits<1> T, bits<10> xo, dag OOL, dag IOL, string asmstr,
14590b57cec5SDimitry Andric                      InstrItinClass itin, list<dag> pattern>
14600b57cec5SDimitry Andric  : I<31, OOL, IOL, asmstr, itin> {
14610b57cec5SDimitry Andric  bits<2> STRM;
146206c3fb27SDimitry Andric  bits<5> RA;
146306c3fb27SDimitry Andric  bits<5> RB;
14640b57cec5SDimitry Andric
14650b57cec5SDimitry Andric  let Pattern = pattern;
14660b57cec5SDimitry Andric
14670b57cec5SDimitry Andric  let Inst{6}     = T;
14680b57cec5SDimitry Andric  let Inst{7-8}   = 0;
14690b57cec5SDimitry Andric  let Inst{9-10}  = STRM;
147006c3fb27SDimitry Andric  let Inst{11-15} = RA;
147106c3fb27SDimitry Andric  let Inst{16-20} = RB;
14720b57cec5SDimitry Andric  let Inst{21-30} = xo;
14730b57cec5SDimitry Andric  let Inst{31}    = 0;
14740b57cec5SDimitry Andric}
14750b57cec5SDimitry Andric
14760b57cec5SDimitry Andric// 1.7.7 XL-Form
14770b57cec5SDimitry Andricclass XLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
14780b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
14790b57cec5SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
14800b57cec5SDimitry Andric  bits<5> CRD;
14810b57cec5SDimitry Andric  bits<5> CRA;
14820b57cec5SDimitry Andric  bits<5> CRB;
14830b57cec5SDimitry Andric
14840b57cec5SDimitry Andric  let Pattern = pattern;
14850b57cec5SDimitry Andric
14860b57cec5SDimitry Andric  let Inst{6-10}  = CRD;
14870b57cec5SDimitry Andric  let Inst{11-15} = CRA;
14880b57cec5SDimitry Andric  let Inst{16-20} = CRB;
14890b57cec5SDimitry Andric  let Inst{21-30} = xo;
14900b57cec5SDimitry Andric  let Inst{31}    = 0;
14910b57cec5SDimitry Andric}
14920b57cec5SDimitry Andric
1493bdd1243dSDimitry Andric// XL-Form for unary alias for CRNOR (CRNOT)
1494bdd1243dSDimitry Andricclass XLForm_1s<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
1495bdd1243dSDimitry Andric                InstrItinClass itin, list<dag> pattern>
1496bdd1243dSDimitry Andric    : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
1497bdd1243dSDimitry Andric  let CRB = CRA;
1498bdd1243dSDimitry Andric}
1499bdd1243dSDimitry Andric
15000b57cec5SDimitry Andricclass XLForm_1_np<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
15010b57cec5SDimitry Andric                  InstrItinClass itin, list<dag> pattern>
15020b57cec5SDimitry Andric  : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
15030b57cec5SDimitry Andric  let CRD = 0;
15040b57cec5SDimitry Andric  let CRA = 0;
15050b57cec5SDimitry Andric  let CRB = 0;
15060b57cec5SDimitry Andric}
15070b57cec5SDimitry Andric
15080b57cec5SDimitry Andricclass XLForm_1_gen<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
15090b57cec5SDimitry Andric                   InstrItinClass itin, list<dag> pattern>
15100b57cec5SDimitry Andric  : XLForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
15110b57cec5SDimitry Andric  bits<5> RT;
15120b57cec5SDimitry Andric  bits<5> RB;
15130b57cec5SDimitry Andric
15140b57cec5SDimitry Andric  let CRD = RT;
15150b57cec5SDimitry Andric  let CRA = 0;
15160b57cec5SDimitry Andric  let CRB = RB;
15170b57cec5SDimitry Andric}
15180b57cec5SDimitry Andric
15190b57cec5SDimitry Andricclass XLForm_1_ext<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
15200b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
15210b57cec5SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
15220b57cec5SDimitry Andric  bits<5> CRD;
15230b57cec5SDimitry Andric
15240b57cec5SDimitry Andric  let Pattern = pattern;
15250b57cec5SDimitry Andric
15260b57cec5SDimitry Andric  let Inst{6-10}  = CRD;
15270b57cec5SDimitry Andric  let Inst{11-15} = CRD;
15280b57cec5SDimitry Andric  let Inst{16-20} = CRD;
15290b57cec5SDimitry Andric  let Inst{21-30} = xo;
15300b57cec5SDimitry Andric  let Inst{31}    = 0;
15310b57cec5SDimitry Andric}
15320b57cec5SDimitry Andric
15330b57cec5SDimitry Andricclass XLForm_2<bits<6> opcode, bits<10> xo, bit lk, dag OOL, dag IOL, string asmstr,
15340b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
15350b57cec5SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
15360b57cec5SDimitry Andric  bits<5> BO;
15370b57cec5SDimitry Andric  bits<5> BI;
15380b57cec5SDimitry Andric  bits<2> BH;
15390b57cec5SDimitry Andric
15400b57cec5SDimitry Andric  let Pattern = pattern;
15410b57cec5SDimitry Andric
15420b57cec5SDimitry Andric  let Inst{6-10}  = BO;
15430b57cec5SDimitry Andric  let Inst{11-15} = BI;
15440b57cec5SDimitry Andric  let Inst{16-18} = 0;
15450b57cec5SDimitry Andric  let Inst{19-20} = BH;
15460b57cec5SDimitry Andric  let Inst{21-30} = xo;
15470b57cec5SDimitry Andric  let Inst{31}    = lk;
15480b57cec5SDimitry Andric}
15490b57cec5SDimitry Andric
15500b57cec5SDimitry Andricclass XLForm_2_br<bits<6> opcode, bits<10> xo, bit lk,
15510b57cec5SDimitry Andric                  dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
15520b57cec5SDimitry Andric  : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
15530b57cec5SDimitry Andric  bits<7> BIBO;  // 2 bits of BI and 5 bits of BO.
15540b57cec5SDimitry Andric  bits<3>  CR;
15550b57cec5SDimitry Andric
15560b57cec5SDimitry Andric  let BO = BIBO{4-0};
15570b57cec5SDimitry Andric  let BI{0-1} = BIBO{5-6};
15580b57cec5SDimitry Andric  let BI{2-4} = CR{0-2};
15590b57cec5SDimitry Andric  let BH = 0;
15600b57cec5SDimitry Andric}
15610b57cec5SDimitry Andric
15620b57cec5SDimitry Andricclass XLForm_2_br2<bits<6> opcode, bits<10> xo, bits<5> bo, bit lk,
15630b57cec5SDimitry Andric                   dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
15640b57cec5SDimitry Andric  : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
15650b57cec5SDimitry Andric  let BO = bo;
15660b57cec5SDimitry Andric  let BH = 0;
15670b57cec5SDimitry Andric}
15680b57cec5SDimitry Andric
15690b57cec5SDimitry Andricclass XLForm_2_ext<bits<6> opcode, bits<10> xo, bits<5> bo,  bits<5> bi, bit lk,
15700b57cec5SDimitry Andric                  dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
15710b57cec5SDimitry Andric  : XLForm_2<opcode, xo, lk, OOL, IOL, asmstr, itin, pattern> {
15720b57cec5SDimitry Andric  let BO = bo;
15730b57cec5SDimitry Andric  let BI = bi;
15740b57cec5SDimitry Andric  let BH = 0;
15750b57cec5SDimitry Andric}
15760b57cec5SDimitry Andric
15770b57cec5SDimitry Andricclass XLForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
15780b57cec5SDimitry Andric               InstrItinClass itin>
15790b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
15800b57cec5SDimitry Andric  bits<3> BF;
15810b57cec5SDimitry Andric  bits<3> BFA;
15820b57cec5SDimitry Andric
15830b57cec5SDimitry Andric  let Inst{6-8}   = BF;
15840b57cec5SDimitry Andric  let Inst{9-10}  = 0;
15850b57cec5SDimitry Andric  let Inst{11-13} = BFA;
15860b57cec5SDimitry Andric  let Inst{14-15} = 0;
15870b57cec5SDimitry Andric  let Inst{16-20} = 0;
15880b57cec5SDimitry Andric  let Inst{21-30} = xo;
15890b57cec5SDimitry Andric  let Inst{31}    = 0;
15900b57cec5SDimitry Andric}
15910b57cec5SDimitry Andric
15920b57cec5SDimitry Andricclass XLForm_4<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
15930b57cec5SDimitry Andric               InstrItinClass itin>
15940b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
15950b57cec5SDimitry Andric  bits<3> BF;
15960b57cec5SDimitry Andric  bit W;
15970b57cec5SDimitry Andric  bits<4> U;
15980b57cec5SDimitry Andric
15990b57cec5SDimitry Andric  bit RC = 0;
16000b57cec5SDimitry Andric
16010b57cec5SDimitry Andric  let Inst{6-8}   = BF;
16020b57cec5SDimitry Andric  let Inst{9-10}  = 0;
16030b57cec5SDimitry Andric  let Inst{11-14} = 0;
16040b57cec5SDimitry Andric  let Inst{15}    = W;
16050b57cec5SDimitry Andric  let Inst{16-19} = U;
16060b57cec5SDimitry Andric  let Inst{20}    = 0;
16070b57cec5SDimitry Andric  let Inst{21-30} = xo;
16080b57cec5SDimitry Andric  let Inst{31}    = RC;
16090b57cec5SDimitry Andric}
16100b57cec5SDimitry Andric
16110b57cec5SDimitry Andricclass XLForm_S<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
16120b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
16130b57cec5SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
16140b57cec5SDimitry Andric  bits<1> S;
16150b57cec5SDimitry Andric
16160b57cec5SDimitry Andric  let Pattern = pattern;
16170b57cec5SDimitry Andric
16180b57cec5SDimitry Andric  let Inst{6-19}  = 0;
16190b57cec5SDimitry Andric  let Inst{20}    = S;
16200b57cec5SDimitry Andric  let Inst{21-30} = xo;
16210b57cec5SDimitry Andric  let Inst{31}    = 0;
16220b57cec5SDimitry Andric}
16230b57cec5SDimitry Andric
16240b57cec5SDimitry Andricclass XLForm_2_and_DSForm_1<bits<6> opcode1, bits<10> xo1, bit lk,
16250b57cec5SDimitry Andric                            bits<6> opcode2, bits<2> xo2,
16260b57cec5SDimitry Andric                            dag OOL, dag IOL, string asmstr,
16270b57cec5SDimitry Andric                            InstrItinClass itin, list<dag> pattern>
16280b57cec5SDimitry Andric        : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
16290b57cec5SDimitry Andric  bits<5> BO;
16300b57cec5SDimitry Andric  bits<5> BI;
16310b57cec5SDimitry Andric  bits<2> BH;
16320b57cec5SDimitry Andric
16330b57cec5SDimitry Andric  bits<5>  RST;
163406c3fb27SDimitry Andric  bits<5>  RA;
163506c3fb27SDimitry Andric  bits<14> D;
16360b57cec5SDimitry Andric
16370b57cec5SDimitry Andric  let Pattern = pattern;
16380b57cec5SDimitry Andric
16390b57cec5SDimitry Andric  let Inst{6-10}  = BO;
16400b57cec5SDimitry Andric  let Inst{11-15} = BI;
16410b57cec5SDimitry Andric  let Inst{16-18} = 0;
16420b57cec5SDimitry Andric  let Inst{19-20} = BH;
16430b57cec5SDimitry Andric  let Inst{21-30} = xo1;
16440b57cec5SDimitry Andric  let Inst{31}    = lk;
16450b57cec5SDimitry Andric
16460b57cec5SDimitry Andric  let Inst{38-42} = RST;
164706c3fb27SDimitry Andric  let Inst{43-47} = RA;
164806c3fb27SDimitry Andric  let Inst{48-61} = D;
16490b57cec5SDimitry Andric  let Inst{62-63} = xo2;
16500b57cec5SDimitry Andric}
16510b57cec5SDimitry Andric
16520b57cec5SDimitry Andricclass XLForm_2_ext_and_DSForm_1<bits<6> opcode1, bits<10> xo1,
16530b57cec5SDimitry Andric                                bits<5> bo, bits<5> bi, bit lk,
16540b57cec5SDimitry Andric                                bits<6> opcode2, bits<2> xo2,
16550b57cec5SDimitry Andric                                dag OOL, dag IOL, string asmstr,
16560b57cec5SDimitry Andric                                InstrItinClass itin, list<dag> pattern>
16570b57cec5SDimitry Andric  : XLForm_2_and_DSForm_1<opcode1, xo1, lk, opcode2, xo2,
16580b57cec5SDimitry Andric                          OOL, IOL, asmstr, itin, pattern> {
16590b57cec5SDimitry Andric  let BO = bo;
16600b57cec5SDimitry Andric  let BI = bi;
16610b57cec5SDimitry Andric  let BH = 0;
16620b57cec5SDimitry Andric}
16630b57cec5SDimitry Andric
1664480093f4SDimitry Andricclass XLForm_2_ext_and_DForm_1<bits<6> opcode1, bits<10> xo1, bits<5> bo,
1665480093f4SDimitry Andric                               bits<5> bi, bit lk, bits<6> opcode2, dag OOL,
1666480093f4SDimitry Andric                               dag IOL, string asmstr, InstrItinClass itin,
1667480093f4SDimitry Andric                               list<dag> pattern>
1668480093f4SDimitry Andric  : I2<opcode1, opcode2, OOL, IOL, asmstr, itin> {
1669480093f4SDimitry Andric
1670480093f4SDimitry Andric  bits<5>  RST;
167106c3fb27SDimitry Andric  bits<5>  RA;
167206c3fb27SDimitry Andric  bits<16> D;
1673480093f4SDimitry Andric
1674480093f4SDimitry Andric  let Pattern = pattern;
1675480093f4SDimitry Andric
1676480093f4SDimitry Andric  let Inst{6-10} = bo;
1677480093f4SDimitry Andric  let Inst{11-15} = bi;
1678480093f4SDimitry Andric  let Inst{16-18} = 0;
1679480093f4SDimitry Andric  let Inst{19-20} = 0;  // Unused (BH)
1680480093f4SDimitry Andric  let Inst{21-30} = xo1;
1681480093f4SDimitry Andric  let Inst{31} = lk;
1682480093f4SDimitry Andric
1683480093f4SDimitry Andric  let Inst{38-42} = RST;
168406c3fb27SDimitry Andric  let Inst{43-47} = RA;
168506c3fb27SDimitry Andric  let Inst{48-63} = D;
1686480093f4SDimitry Andric}
1687480093f4SDimitry Andric
16880b57cec5SDimitry Andric// 1.7.8 XFX-Form
16890b57cec5SDimitry Andricclass XFXForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
16900b57cec5SDimitry Andric                InstrItinClass itin>
16910b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
169206c3fb27SDimitry Andric  bits<5>  RST;
16930b57cec5SDimitry Andric  bits<10> SPR;
16940b57cec5SDimitry Andric
169506c3fb27SDimitry Andric  let Inst{6-10}  = RST;
16960b57cec5SDimitry Andric  let Inst{11}    = SPR{4};
16970b57cec5SDimitry Andric  let Inst{12}    = SPR{3};
16980b57cec5SDimitry Andric  let Inst{13}    = SPR{2};
16990b57cec5SDimitry Andric  let Inst{14}    = SPR{1};
17000b57cec5SDimitry Andric  let Inst{15}    = SPR{0};
17010b57cec5SDimitry Andric  let Inst{16}    = SPR{9};
17020b57cec5SDimitry Andric  let Inst{17}    = SPR{8};
17030b57cec5SDimitry Andric  let Inst{18}    = SPR{7};
17040b57cec5SDimitry Andric  let Inst{19}    = SPR{6};
17050b57cec5SDimitry Andric  let Inst{20}    = SPR{5};
17060b57cec5SDimitry Andric  let Inst{21-30} = xo;
17070b57cec5SDimitry Andric  let Inst{31}    = 0;
17080b57cec5SDimitry Andric}
17090b57cec5SDimitry Andric
17100b57cec5SDimitry Andricclass XFXForm_1_ext<bits<6> opcode, bits<10> xo, bits<10> spr,
17110b57cec5SDimitry Andric                   dag OOL, dag IOL, string asmstr, InstrItinClass itin>
17120b57cec5SDimitry Andric  : XFXForm_1<opcode, xo, OOL, IOL, asmstr, itin> {
17130b57cec5SDimitry Andric  let SPR = spr;
17140b57cec5SDimitry Andric}
17150b57cec5SDimitry Andric
17160b57cec5SDimitry Andricclass XFXForm_3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
17170b57cec5SDimitry Andric                InstrItinClass itin>
17180b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
17190b57cec5SDimitry Andric  bits<5>  RT;
17200b57cec5SDimitry Andric
17210b57cec5SDimitry Andric  let Inst{6-10}  = RT;
17220b57cec5SDimitry Andric  let Inst{11-20} = 0;
17230b57cec5SDimitry Andric  let Inst{21-30} = xo;
17240b57cec5SDimitry Andric  let Inst{31}    = 0;
17250b57cec5SDimitry Andric}
17260b57cec5SDimitry Andric
17270b57cec5SDimitry Andricclass XFXForm_3p<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
17280b57cec5SDimitry Andric                 InstrItinClass itin, list<dag> pattern>
17290b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
17300b57cec5SDimitry Andric  bits<5>  RT;
173106c3fb27SDimitry Andric  bits<10> imm;
17320b57cec5SDimitry Andric  let Pattern = pattern;
17330b57cec5SDimitry Andric
17340b57cec5SDimitry Andric  let Inst{6-10}  = RT;
173506c3fb27SDimitry Andric  let Inst{11-20} = imm;
17360b57cec5SDimitry Andric  let Inst{21-30} = xo;
17370b57cec5SDimitry Andric  let Inst{31}    = 0;
17380b57cec5SDimitry Andric}
17390b57cec5SDimitry Andric
17400b57cec5SDimitry Andricclass XFXForm_5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
17410b57cec5SDimitry Andric                InstrItinClass itin>
17420b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
17430b57cec5SDimitry Andric  bits<8>  FXM;
174406c3fb27SDimitry Andric  bits<5>  RST;
17450b57cec5SDimitry Andric
174606c3fb27SDimitry Andric  let Inst{6-10}  = RST;
17470b57cec5SDimitry Andric  let Inst{11}    = 0;
17480b57cec5SDimitry Andric  let Inst{12-19} = FXM;
17490b57cec5SDimitry Andric  let Inst{20}    = 0;
17500b57cec5SDimitry Andric  let Inst{21-30} = xo;
17510b57cec5SDimitry Andric  let Inst{31}    = 0;
17520b57cec5SDimitry Andric}
17530b57cec5SDimitry Andric
17540b57cec5SDimitry Andricclass XFXForm_5a<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
17550b57cec5SDimitry Andric                 InstrItinClass itin>
17560b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
175706c3fb27SDimitry Andric  bits<5>  RST;
17580b57cec5SDimitry Andric  bits<8>  FXM;
17590b57cec5SDimitry Andric
176006c3fb27SDimitry Andric  let Inst{6-10}  = RST;
17610b57cec5SDimitry Andric  let Inst{11}    = 1;
17620b57cec5SDimitry Andric  let Inst{12-19} = FXM;
17630b57cec5SDimitry Andric  let Inst{20}    = 0;
17640b57cec5SDimitry Andric  let Inst{21-30} = xo;
17650b57cec5SDimitry Andric  let Inst{31}    = 0;
17660b57cec5SDimitry Andric}
17670b57cec5SDimitry Andric
17680b57cec5SDimitry Andric// XFL-Form - MTFSF
17690b57cec5SDimitry Andric// This is probably 1.7.9, but I don't have the reference that uses this
17700b57cec5SDimitry Andric// numbering scheme...
17710b57cec5SDimitry Andricclass XFLForm<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
17720b57cec5SDimitry Andric              InstrItinClass itin, list<dag>pattern>
17730b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
17740b57cec5SDimitry Andric  bits<8> FM;
177506c3fb27SDimitry Andric  bits<5> RT;
17760b57cec5SDimitry Andric
1777480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
17780b57cec5SDimitry Andric  let Pattern = pattern;
17790b57cec5SDimitry Andric
17800b57cec5SDimitry Andric  let Inst{6} = 0;
17810b57cec5SDimitry Andric  let Inst{7-14}  = FM;
17820b57cec5SDimitry Andric  let Inst{15} = 0;
178306c3fb27SDimitry Andric  let Inst{16-20} = RT;
17840b57cec5SDimitry Andric  let Inst{21-30} = xo;
17850b57cec5SDimitry Andric  let Inst{31}    = RC;
17860b57cec5SDimitry Andric}
17870b57cec5SDimitry Andric
17880b57cec5SDimitry Andricclass XFLForm_1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
17890b57cec5SDimitry Andric                InstrItinClass itin, list<dag>pattern>
17900b57cec5SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
17910b57cec5SDimitry Andric  bit L;
17920b57cec5SDimitry Andric  bits<8> FLM;
17930b57cec5SDimitry Andric  bit W;
17940b57cec5SDimitry Andric  bits<5> FRB;
17950b57cec5SDimitry Andric
1796480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
17970b57cec5SDimitry Andric  let Pattern = pattern;
17980b57cec5SDimitry Andric
17990b57cec5SDimitry Andric  let Inst{6}     = L;
18000b57cec5SDimitry Andric  let Inst{7-14}  = FLM;
18010b57cec5SDimitry Andric  let Inst{15}    = W;
18020b57cec5SDimitry Andric  let Inst{16-20} = FRB;
18030b57cec5SDimitry Andric  let Inst{21-30} = xo;
18040b57cec5SDimitry Andric  let Inst{31}    = RC;
18050b57cec5SDimitry Andric}
18060b57cec5SDimitry Andric
18070b57cec5SDimitry Andric// 1.7.10 XS-Form - SRADI.
18080b57cec5SDimitry Andricclass XSForm_1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL, string asmstr,
18090b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
18100b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
181106c3fb27SDimitry Andric  bits<5> RA;
18120b57cec5SDimitry Andric  bits<5> RS;
18130b57cec5SDimitry Andric  bits<6> SH;
18140b57cec5SDimitry Andric
1815480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
18160b57cec5SDimitry Andric  let Pattern = pattern;
18170b57cec5SDimitry Andric
18180b57cec5SDimitry Andric  let Inst{6-10}  = RS;
181906c3fb27SDimitry Andric  let Inst{11-15} = RA;
18200b57cec5SDimitry Andric  let Inst{16-20} = SH{4,3,2,1,0};
18210b57cec5SDimitry Andric  let Inst{21-29} = xo;
18220b57cec5SDimitry Andric  let Inst{30}    = SH{5};
18230b57cec5SDimitry Andric  let Inst{31}    = RC;
18240b57cec5SDimitry Andric}
18250b57cec5SDimitry Andric
18260b57cec5SDimitry Andric// 1.7.11 XO-Form
18270b57cec5SDimitry Andricclass XOForm_1<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL, string asmstr,
18280b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
18290b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
18300b57cec5SDimitry Andric  bits<5> RT;
18310b57cec5SDimitry Andric  bits<5> RA;
18320b57cec5SDimitry Andric  bits<5> RB;
18330b57cec5SDimitry Andric
18340b57cec5SDimitry Andric  let Pattern = pattern;
18350b57cec5SDimitry Andric
1836480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
18370b57cec5SDimitry Andric
18380b57cec5SDimitry Andric  let Inst{6-10}  = RT;
18390b57cec5SDimitry Andric  let Inst{11-15} = RA;
18400b57cec5SDimitry Andric  let Inst{16-20} = RB;
18410b57cec5SDimitry Andric  let Inst{21}    = oe;
18420b57cec5SDimitry Andric  let Inst{22-30} = xo;
18430b57cec5SDimitry Andric  let Inst{31}    = RC;
18440b57cec5SDimitry Andric}
18450b57cec5SDimitry Andric
18460b57cec5SDimitry Andricclass XOForm_3<bits<6> opcode, bits<9> xo, bit oe,
18470b57cec5SDimitry Andric               dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern>
18480b57cec5SDimitry Andric  : XOForm_1<opcode, xo, oe, OOL, IOL, asmstr, itin, pattern> {
18490b57cec5SDimitry Andric  let RB = 0;
18500b57cec5SDimitry Andric}
18510b57cec5SDimitry Andric
18520b57cec5SDimitry Andric// 1.7.12 A-Form
18530b57cec5SDimitry Andricclass AForm_1<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
18540b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
18550b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
18560b57cec5SDimitry Andric  bits<5> FRT;
18570b57cec5SDimitry Andric  bits<5> FRA;
18580b57cec5SDimitry Andric  bits<5> FRC;
18590b57cec5SDimitry Andric  bits<5> FRB;
18600b57cec5SDimitry Andric
18610b57cec5SDimitry Andric  let Pattern = pattern;
18620b57cec5SDimitry Andric
1863480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
18640b57cec5SDimitry Andric
18650b57cec5SDimitry Andric  let Inst{6-10}  = FRT;
18660b57cec5SDimitry Andric  let Inst{11-15} = FRA;
18670b57cec5SDimitry Andric  let Inst{16-20} = FRB;
18680b57cec5SDimitry Andric  let Inst{21-25} = FRC;
18690b57cec5SDimitry Andric  let Inst{26-30} = xo;
18700b57cec5SDimitry Andric  let Inst{31}    = RC;
18710b57cec5SDimitry Andric}
18720b57cec5SDimitry Andric
18730b57cec5SDimitry Andricclass AForm_2<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
18740b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
18750b57cec5SDimitry Andric  : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
18760b57cec5SDimitry Andric  let FRC = 0;
18770b57cec5SDimitry Andric}
18780b57cec5SDimitry Andric
18790b57cec5SDimitry Andricclass AForm_3<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
18800b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
18810b57cec5SDimitry Andric  : AForm_1<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
18820b57cec5SDimitry Andric  let FRB = 0;
18830b57cec5SDimitry Andric}
18840b57cec5SDimitry Andric
18850b57cec5SDimitry Andricclass AForm_4<bits<6> opcode, bits<5> xo, dag OOL, dag IOL, string asmstr,
18860b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
18870b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
18880b57cec5SDimitry Andric  bits<5> RT;
18890b57cec5SDimitry Andric  bits<5> RA;
18900b57cec5SDimitry Andric  bits<5> RB;
18910b57cec5SDimitry Andric  bits<5> COND;
18920b57cec5SDimitry Andric
18930b57cec5SDimitry Andric  let Pattern = pattern;
18940b57cec5SDimitry Andric
18950b57cec5SDimitry Andric  let Inst{6-10}  = RT;
18960b57cec5SDimitry Andric  let Inst{11-15} = RA;
18970b57cec5SDimitry Andric  let Inst{16-20} = RB;
18980b57cec5SDimitry Andric  let Inst{21-25} = COND;
18990b57cec5SDimitry Andric  let Inst{26-30} = xo;
19000b57cec5SDimitry Andric  let Inst{31}    = 0;
19010b57cec5SDimitry Andric}
19020b57cec5SDimitry Andric
19030b57cec5SDimitry Andric// 1.7.13 M-Form
19040b57cec5SDimitry Andricclass MForm_1<bits<6> opcode, dag OOL, dag IOL, string asmstr,
19050b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
19060b57cec5SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
19070b57cec5SDimitry Andric  bits<5> RA;
19080b57cec5SDimitry Andric  bits<5> RS;
19090b57cec5SDimitry Andric  bits<5> RB;
19100b57cec5SDimitry Andric  bits<5> MB;
19110b57cec5SDimitry Andric  bits<5> ME;
19120b57cec5SDimitry Andric
19130b57cec5SDimitry Andric  let Pattern = pattern;
19140b57cec5SDimitry Andric
1915480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
19160b57cec5SDimitry Andric
19170b57cec5SDimitry Andric  let Inst{6-10}  = RS;
19180b57cec5SDimitry Andric  let Inst{11-15} = RA;
19190b57cec5SDimitry Andric  let Inst{16-20} = RB;
19200b57cec5SDimitry Andric  let Inst{21-25} = MB;
19210b57cec5SDimitry Andric  let Inst{26-30} = ME;
19220b57cec5SDimitry Andric  let Inst{31}    = RC;
19230b57cec5SDimitry Andric}
19240b57cec5SDimitry Andric
19250b57cec5SDimitry Andricclass MForm_2<bits<6> opcode, dag OOL, dag IOL, string asmstr,
19260b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
192706c3fb27SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
192806c3fb27SDimitry Andric  bits<5> RA;
192906c3fb27SDimitry Andric  bits<5> RS;
193006c3fb27SDimitry Andric  bits<5> SH;
193106c3fb27SDimitry Andric  bits<5> MB;
193206c3fb27SDimitry Andric  bits<5> ME;
193306c3fb27SDimitry Andric
193406c3fb27SDimitry Andric  let Pattern = pattern;
193506c3fb27SDimitry Andric
193606c3fb27SDimitry Andric  bit RC = 0;    // set by isRecordForm
193706c3fb27SDimitry Andric
193806c3fb27SDimitry Andric  let Inst{6-10}  = RS;
193906c3fb27SDimitry Andric  let Inst{11-15} = RA;
194006c3fb27SDimitry Andric  let Inst{16-20} = SH;
194106c3fb27SDimitry Andric  let Inst{21-25} = MB;
194206c3fb27SDimitry Andric  let Inst{26-30} = ME;
194306c3fb27SDimitry Andric  let Inst{31}    = RC;
19440b57cec5SDimitry Andric}
19450b57cec5SDimitry Andric
19460b57cec5SDimitry Andric// 1.7.14 MD-Form
19470b57cec5SDimitry Andricclass MDForm_1<bits<6> opcode, bits<3> xo, dag OOL, dag IOL, string asmstr,
19480b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
19490b57cec5SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
19500b57cec5SDimitry Andric  bits<5> RA;
19510b57cec5SDimitry Andric  bits<5> RS;
19520b57cec5SDimitry Andric  bits<6> SH;
19530b57cec5SDimitry Andric  bits<6> MBE;
19540b57cec5SDimitry Andric
19550b57cec5SDimitry Andric  let Pattern = pattern;
19560b57cec5SDimitry Andric
1957480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
19580b57cec5SDimitry Andric
19590b57cec5SDimitry Andric  let Inst{6-10}  = RS;
19600b57cec5SDimitry Andric  let Inst{11-15} = RA;
19610b57cec5SDimitry Andric  let Inst{16-20} = SH{4,3,2,1,0};
19620b57cec5SDimitry Andric  let Inst{21-26} = MBE{4,3,2,1,0,5};
19630b57cec5SDimitry Andric  let Inst{27-29} = xo;
19640b57cec5SDimitry Andric  let Inst{30}    = SH{5};
19650b57cec5SDimitry Andric  let Inst{31}    = RC;
19660b57cec5SDimitry Andric}
19670b57cec5SDimitry Andric
19680b57cec5SDimitry Andricclass MDSForm_1<bits<6> opcode, bits<4> xo, dag OOL, dag IOL, string asmstr,
19690b57cec5SDimitry Andric                InstrItinClass itin, list<dag> pattern>
19700b57cec5SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
19710b57cec5SDimitry Andric  bits<5> RA;
19720b57cec5SDimitry Andric  bits<5> RS;
19730b57cec5SDimitry Andric  bits<5> RB;
19740b57cec5SDimitry Andric  bits<6> MBE;
19750b57cec5SDimitry Andric
19760b57cec5SDimitry Andric  let Pattern = pattern;
19770b57cec5SDimitry Andric
1978480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
19790b57cec5SDimitry Andric
19800b57cec5SDimitry Andric  let Inst{6-10}  = RS;
19810b57cec5SDimitry Andric  let Inst{11-15} = RA;
19820b57cec5SDimitry Andric  let Inst{16-20} = RB;
19830b57cec5SDimitry Andric  let Inst{21-26} = MBE{4,3,2,1,0,5};
19840b57cec5SDimitry Andric  let Inst{27-30} = xo;
19850b57cec5SDimitry Andric  let Inst{31}    = RC;
19860b57cec5SDimitry Andric}
19870b57cec5SDimitry Andric
19880b57cec5SDimitry Andric
19890b57cec5SDimitry Andric// E-1 VA-Form
19900b57cec5SDimitry Andric
19910b57cec5SDimitry Andric// VAForm_1 - DACB ordering.
19920b57cec5SDimitry Andricclass VAForm_1<bits<6> xo, dag OOL, dag IOL, string asmstr,
19930b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
19940b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
199506c3fb27SDimitry Andric  bits<5> RT;
199606c3fb27SDimitry Andric  bits<5> RA;
199706c3fb27SDimitry Andric  bits<5> RC;
199806c3fb27SDimitry Andric  bits<5> RB;
19990b57cec5SDimitry Andric
20000b57cec5SDimitry Andric  let Pattern = pattern;
20010b57cec5SDimitry Andric
200206c3fb27SDimitry Andric  let Inst{6-10}  = RT;
200306c3fb27SDimitry Andric  let Inst{11-15} = RA;
200406c3fb27SDimitry Andric  let Inst{16-20} = RB;
200506c3fb27SDimitry Andric  let Inst{21-25} = RC;
20060b57cec5SDimitry Andric  let Inst{26-31} = xo;
20070b57cec5SDimitry Andric}
20080b57cec5SDimitry Andric
20090b57cec5SDimitry Andric// VAForm_1a - DABC ordering.
20100b57cec5SDimitry Andricclass VAForm_1a<bits<6> xo, dag OOL, dag IOL, string asmstr,
20110b57cec5SDimitry Andric                InstrItinClass itin, list<dag> pattern>
20120b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
201306c3fb27SDimitry Andric  bits<5> RT;
201406c3fb27SDimitry Andric  bits<5> RA;
201506c3fb27SDimitry Andric  bits<5> RB;
201606c3fb27SDimitry Andric  bits<5> RC;
20170b57cec5SDimitry Andric
20180b57cec5SDimitry Andric  let Pattern = pattern;
20190b57cec5SDimitry Andric
202006c3fb27SDimitry Andric  let Inst{6-10}  = RT;
202106c3fb27SDimitry Andric  let Inst{11-15} = RA;
202206c3fb27SDimitry Andric  let Inst{16-20} = RB;
202306c3fb27SDimitry Andric  let Inst{21-25} = RC;
20240b57cec5SDimitry Andric  let Inst{26-31} = xo;
20250b57cec5SDimitry Andric}
20260b57cec5SDimitry Andric
20270b57cec5SDimitry Andricclass VAForm_2<bits<6> xo, dag OOL, dag IOL, string asmstr,
20280b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
20290b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
203006c3fb27SDimitry Andric  bits<5> RT;
203106c3fb27SDimitry Andric  bits<5> RA;
203206c3fb27SDimitry Andric  bits<5> RB;
20330b57cec5SDimitry Andric  bits<4> SH;
20340b57cec5SDimitry Andric
20350b57cec5SDimitry Andric  let Pattern = pattern;
20360b57cec5SDimitry Andric
203706c3fb27SDimitry Andric  let Inst{6-10}  = RT;
203806c3fb27SDimitry Andric  let Inst{11-15} = RA;
203906c3fb27SDimitry Andric  let Inst{16-20} = RB;
20400b57cec5SDimitry Andric  let Inst{21}    = 0;
20410b57cec5SDimitry Andric  let Inst{22-25} = SH;
20420b57cec5SDimitry Andric  let Inst{26-31} = xo;
20430b57cec5SDimitry Andric}
20440b57cec5SDimitry Andric
20450b57cec5SDimitry Andric// E-2 VX-Form
20460b57cec5SDimitry Andricclass VXForm_1<bits<11> xo, dag OOL, dag IOL, string asmstr,
20470b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
20480b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
20490b57cec5SDimitry Andric  bits<5> VD;
20500b57cec5SDimitry Andric  bits<5> VA;
20510b57cec5SDimitry Andric  bits<5> VB;
20520b57cec5SDimitry Andric
20530b57cec5SDimitry Andric  let Pattern = pattern;
20540b57cec5SDimitry Andric
20550b57cec5SDimitry Andric  let Inst{6-10}  = VD;
20560b57cec5SDimitry Andric  let Inst{11-15} = VA;
20570b57cec5SDimitry Andric  let Inst{16-20} = VB;
20580b57cec5SDimitry Andric  let Inst{21-31} = xo;
20590b57cec5SDimitry Andric}
20600b57cec5SDimitry Andric
20610b57cec5SDimitry Andricclass VXForm_setzero<bits<11> xo, dag OOL, dag IOL, string asmstr,
20620b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
20630b57cec5SDimitry Andric    : VXForm_1<xo, OOL, IOL, asmstr, itin, pattern> {
20640b57cec5SDimitry Andric  let VA = VD;
20650b57cec5SDimitry Andric  let VB = VD;
20660b57cec5SDimitry Andric}
20670b57cec5SDimitry Andric
20680b57cec5SDimitry Andric
20690b57cec5SDimitry Andricclass VXForm_2<bits<11> xo, dag OOL, dag IOL, string asmstr,
20700b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
20710b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
20720b57cec5SDimitry Andric  bits<5> VD;
20730b57cec5SDimitry Andric  bits<5> VB;
20740b57cec5SDimitry Andric
20750b57cec5SDimitry Andric  let Pattern = pattern;
20760b57cec5SDimitry Andric
20770b57cec5SDimitry Andric  let Inst{6-10}  = VD;
20780b57cec5SDimitry Andric  let Inst{11-15} = 0;
20790b57cec5SDimitry Andric  let Inst{16-20} = VB;
20800b57cec5SDimitry Andric  let Inst{21-31} = xo;
20810b57cec5SDimitry Andric}
20820b57cec5SDimitry Andric
20830b57cec5SDimitry Andricclass VXForm_3<bits<11> xo, dag OOL, dag IOL, string asmstr,
20840b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
20850b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
20860b57cec5SDimitry Andric  bits<5> VD;
20870b57cec5SDimitry Andric  bits<5> IMM;
20880b57cec5SDimitry Andric
20890b57cec5SDimitry Andric  let Pattern = pattern;
20900b57cec5SDimitry Andric
20910b57cec5SDimitry Andric  let Inst{6-10}  = VD;
20920b57cec5SDimitry Andric  let Inst{11-15} = IMM;
20930b57cec5SDimitry Andric  let Inst{16-20} = 0;
20940b57cec5SDimitry Andric  let Inst{21-31} = xo;
20950b57cec5SDimitry Andric}
20960b57cec5SDimitry Andric
20970b57cec5SDimitry Andric/// VXForm_4 - VX instructions with "VD,0,0" register fields, like mfvscr.
20980b57cec5SDimitry Andricclass VXForm_4<bits<11> xo, dag OOL, dag IOL, string asmstr,
20990b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
21000b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
21010b57cec5SDimitry Andric  bits<5> VD;
21020b57cec5SDimitry Andric
21030b57cec5SDimitry Andric  let Pattern = pattern;
21040b57cec5SDimitry Andric
21050b57cec5SDimitry Andric  let Inst{6-10}  = VD;
21060b57cec5SDimitry Andric  let Inst{11-15} = 0;
21070b57cec5SDimitry Andric  let Inst{16-20} = 0;
21080b57cec5SDimitry Andric  let Inst{21-31} = xo;
21090b57cec5SDimitry Andric}
21100b57cec5SDimitry Andric
21110b57cec5SDimitry Andric/// VXForm_5 - VX instructions with "0,0,VB" register fields, like mtvscr.
21120b57cec5SDimitry Andricclass VXForm_5<bits<11> xo, dag OOL, dag IOL, string asmstr,
21130b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
21140b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
21150b57cec5SDimitry Andric  bits<5> VB;
21160b57cec5SDimitry Andric
21170b57cec5SDimitry Andric  let Pattern = pattern;
21180b57cec5SDimitry Andric
21190b57cec5SDimitry Andric  let Inst{6-10}  = 0;
21200b57cec5SDimitry Andric  let Inst{11-15} = 0;
21210b57cec5SDimitry Andric  let Inst{16-20} = VB;
21220b57cec5SDimitry Andric  let Inst{21-31} = xo;
21230b57cec5SDimitry Andric}
21240b57cec5SDimitry Andric
21250b57cec5SDimitry Andric// e.g. [PO VRT EO VRB XO]
21260b57cec5SDimitry Andricclass VXForm_RD5_XO5_RS5<bits<11> xo, bits<5> eo, dag OOL, dag IOL,
21270b57cec5SDimitry Andric                         string asmstr, InstrItinClass itin, list<dag> pattern>
21280b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
212906c3fb27SDimitry Andric  bits<5> VD;
21300b57cec5SDimitry Andric  bits<5> VB;
21310b57cec5SDimitry Andric
21320b57cec5SDimitry Andric  let Pattern = pattern;
21330b57cec5SDimitry Andric
213406c3fb27SDimitry Andric  let Inst{6-10}  = VD;
21350b57cec5SDimitry Andric  let Inst{11-15} = eo;
21360b57cec5SDimitry Andric  let Inst{16-20} = VB;
21370b57cec5SDimitry Andric  let Inst{21-31} = xo;
21380b57cec5SDimitry Andric}
21390b57cec5SDimitry Andric
21400b57cec5SDimitry Andric/// VXForm_CR - VX crypto instructions with "VRT, VRA, ST, SIX"
21410b57cec5SDimitry Andricclass VXForm_CR<bits<11> xo, dag OOL, dag IOL, string asmstr,
21420b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
21430b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
21440b57cec5SDimitry Andric  bits<5> VD;
21450b57cec5SDimitry Andric  bits<5> VA;
21460b57cec5SDimitry Andric  bits<1> ST;
21470b57cec5SDimitry Andric  bits<4> SIX;
21480b57cec5SDimitry Andric
21490b57cec5SDimitry Andric  let Pattern = pattern;
21500b57cec5SDimitry Andric
21510b57cec5SDimitry Andric  let Inst{6-10}  = VD;
21520b57cec5SDimitry Andric  let Inst{11-15} = VA;
21530b57cec5SDimitry Andric  let Inst{16} =  ST;
21540b57cec5SDimitry Andric  let Inst{17-20} = SIX;
21550b57cec5SDimitry Andric  let Inst{21-31} = xo;
21560b57cec5SDimitry Andric}
21570b57cec5SDimitry Andric
21580b57cec5SDimitry Andric/// VXForm_BX - VX crypto instructions with "VRT, VRA, 0 - like vsbox"
21590b57cec5SDimitry Andricclass VXForm_BX<bits<11> xo, dag OOL, dag IOL, string asmstr,
21600b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
21610b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
21620b57cec5SDimitry Andric  bits<5> VD;
21630b57cec5SDimitry Andric  bits<5> VA;
21640b57cec5SDimitry Andric
21650b57cec5SDimitry Andric  let Pattern = pattern;
21660b57cec5SDimitry Andric
21670b57cec5SDimitry Andric  let Inst{6-10}  = VD;
21680b57cec5SDimitry Andric  let Inst{11-15} = VA;
21690b57cec5SDimitry Andric  let Inst{16-20} = 0;
21700b57cec5SDimitry Andric  let Inst{21-31} = xo;
21710b57cec5SDimitry Andric}
21720b57cec5SDimitry Andric
21730b57cec5SDimitry Andric// E-4 VXR-Form
21740b57cec5SDimitry Andricclass VXRForm_1<bits<10> xo, dag OOL, dag IOL, string asmstr,
21750b57cec5SDimitry Andric               InstrItinClass itin, list<dag> pattern>
21760b57cec5SDimitry Andric    : I<4, OOL, IOL, asmstr, itin> {
21770b57cec5SDimitry Andric  bits<5> VD;
21780b57cec5SDimitry Andric  bits<5> VA;
21790b57cec5SDimitry Andric  bits<5> VB;
21800b57cec5SDimitry Andric  bit RC = 0;
21810b57cec5SDimitry Andric
21820b57cec5SDimitry Andric  let Pattern = pattern;
21830b57cec5SDimitry Andric
21840b57cec5SDimitry Andric  let Inst{6-10}  = VD;
21850b57cec5SDimitry Andric  let Inst{11-15} = VA;
21860b57cec5SDimitry Andric  let Inst{16-20} = VB;
21870b57cec5SDimitry Andric  let Inst{21}    = RC;
21880b57cec5SDimitry Andric  let Inst{22-31} = xo;
21890b57cec5SDimitry Andric}
21900b57cec5SDimitry Andric
21910b57cec5SDimitry Andric// VX-Form: [PO VRT EO VRB 1 PS XO]
21920b57cec5SDimitry Andricclass VX_RD5_EO5_RS5_PS1_XO9<bits<5> eo, bits<9> xo,
21930b57cec5SDimitry Andric                             dag OOL, dag IOL, string asmstr,
21940b57cec5SDimitry Andric                             InstrItinClass itin, list<dag> pattern>
21950b57cec5SDimitry Andric  : I<4, OOL, IOL, asmstr, itin> {
21960b57cec5SDimitry Andric  bits<5> VD;
21970b57cec5SDimitry Andric  bits<5> VB;
21980b57cec5SDimitry Andric  bit PS;
21990b57cec5SDimitry Andric
22000b57cec5SDimitry Andric  let Pattern = pattern;
22010b57cec5SDimitry Andric
22020b57cec5SDimitry Andric  let Inst{6-10}  = VD;
22030b57cec5SDimitry Andric  let Inst{11-15} = eo;
22040b57cec5SDimitry Andric  let Inst{16-20} = VB;
22050b57cec5SDimitry Andric  let Inst{21}    = 1;
22060b57cec5SDimitry Andric  let Inst{22}    = PS;
22070b57cec5SDimitry Andric  let Inst{23-31} = xo;
22080b57cec5SDimitry Andric}
22090b57cec5SDimitry Andric
22100b57cec5SDimitry Andric// VX-Form: [PO VRT VRA VRB 1 PS XO] or [PO VRT VRA VRB 1 / XO]
22110b57cec5SDimitry Andricclass VX_RD5_RSp5_PS1_XO9<bits<9> xo, dag OOL, dag IOL, string asmstr,
22120b57cec5SDimitry Andric                          InstrItinClass itin, list<dag> pattern>
22130b57cec5SDimitry Andric  : I<4, OOL, IOL, asmstr, itin> {
22140b57cec5SDimitry Andric  bits<5> VD;
22150b57cec5SDimitry Andric  bits<5> VA;
22160b57cec5SDimitry Andric  bits<5> VB;
22170b57cec5SDimitry Andric  bit PS;
22180b57cec5SDimitry Andric
22190b57cec5SDimitry Andric  let Pattern = pattern;
22200b57cec5SDimitry Andric
22210b57cec5SDimitry Andric  let Inst{6-10}  = VD;
22220b57cec5SDimitry Andric  let Inst{11-15} = VA;
22230b57cec5SDimitry Andric  let Inst{16-20} = VB;
22240b57cec5SDimitry Andric  let Inst{21}    = 1;
22250b57cec5SDimitry Andric  let Inst{22}    = PS;
22260b57cec5SDimitry Andric  let Inst{23-31} = xo;
22270b57cec5SDimitry Andric}
22280b57cec5SDimitry Andric
222906c3fb27SDimitry Andricclass Z22Form_BF3_FRA5_DCM6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
223006c3fb27SDimitry Andric                            string asmstr, InstrItinClass itin,
223106c3fb27SDimitry Andric                            list<dag> pattern>
223206c3fb27SDimitry Andric  : I<opcode, OOL, IOL, asmstr, itin> {
223306c3fb27SDimitry Andric  bits<3> BF;
223406c3fb27SDimitry Andric  bits<5> FRA;
223506c3fb27SDimitry Andric  bits<6> DCM;
223606c3fb27SDimitry Andric
223706c3fb27SDimitry Andric  let Pattern = pattern;
223806c3fb27SDimitry Andric
223906c3fb27SDimitry Andric  let Inst{6-8}   = BF;
224006c3fb27SDimitry Andric  let Inst{9-10}  = 0;
224106c3fb27SDimitry Andric  let Inst{11-15} = FRA;
224206c3fb27SDimitry Andric  let Inst{16-21} = DCM;
224306c3fb27SDimitry Andric  let Inst{22-30} = xo;
224406c3fb27SDimitry Andric  let Inst{31}    = 0;
224506c3fb27SDimitry Andric}
224606c3fb27SDimitry Andric
224706c3fb27SDimitry Andricclass Z22Form_FRTA5_SH6<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
224806c3fb27SDimitry Andric              string asmstr, list<dag> pattern, InstrItinClass itin>
224906c3fb27SDimitry Andric    : I<opcode, OOL, IOL, asmstr, itin> {
225006c3fb27SDimitry Andric
225106c3fb27SDimitry Andric  bits<5> FRT;
225206c3fb27SDimitry Andric  bits<5> FRA;
225306c3fb27SDimitry Andric  bits<6> SH;
225406c3fb27SDimitry Andric
225506c3fb27SDimitry Andric  let Pattern = pattern;
225606c3fb27SDimitry Andric
225706c3fb27SDimitry Andric  bit RC = 0; // set by isRecordForm
225806c3fb27SDimitry Andric
225906c3fb27SDimitry Andric  let Inst{6 - 10} = FRT;
226006c3fb27SDimitry Andric  let Inst{11 - 15} = FRA;
226106c3fb27SDimitry Andric  let Inst{16 - 21} = SH;
226206c3fb27SDimitry Andric  let Inst{22 - 30} = xo;
226306c3fb27SDimitry Andric  let Inst{31} = RC;
226406c3fb27SDimitry Andric}
226506c3fb27SDimitry Andric
22660b57cec5SDimitry Andricclass Z23Form_8<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
22670b57cec5SDimitry Andric              InstrItinClass itin, list<dag> pattern>
22680b57cec5SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
22690b57cec5SDimitry Andric  bits<5> VRT;
22700b57cec5SDimitry Andric  bit R;
22710b57cec5SDimitry Andric  bits<5> VRB;
22720b57cec5SDimitry Andric  bits<2> idx;
22730b57cec5SDimitry Andric
22740b57cec5SDimitry Andric  let Pattern = pattern;
22750b57cec5SDimitry Andric
2276480093f4SDimitry Andric  bit RC = 0;    // set by isRecordForm
22770b57cec5SDimitry Andric
22780b57cec5SDimitry Andric  let Inst{6-10}  = VRT;
22790b57cec5SDimitry Andric  let Inst{11-14} = 0;
22800b57cec5SDimitry Andric  let Inst{15} = R;
22810b57cec5SDimitry Andric  let Inst{16-20} = VRB;
22820b57cec5SDimitry Andric  let Inst{21-22} = idx;
22830b57cec5SDimitry Andric  let Inst{23-30} = xo;
22840b57cec5SDimitry Andric  let Inst{31}    = RC;
22850b57cec5SDimitry Andric}
22860b57cec5SDimitry Andric
2287fe6060f1SDimitry Andricclass Z23Form_RTAB5_CY2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
2288fe6060f1SDimitry Andric                        string asmstr, InstrItinClass itin, list<dag> pattern>
2289fe6060f1SDimitry Andric         : I<opcode, OOL, IOL, asmstr, itin> {
2290fe6060f1SDimitry Andric  bits<5> RT;
2291fe6060f1SDimitry Andric  bits<5> RA;
2292fe6060f1SDimitry Andric  bits<5> RB;
2293fe6060f1SDimitry Andric  bits<2> CY;
2294fe6060f1SDimitry Andric
2295fe6060f1SDimitry Andric  let Pattern = pattern;
2296fe6060f1SDimitry Andric
2297fe6060f1SDimitry Andric  let Inst{6-10}  = RT;
2298fe6060f1SDimitry Andric  let Inst{11-15} = RA;
2299fe6060f1SDimitry Andric  let Inst{16-20} = RB;
2300fe6060f1SDimitry Andric  let Inst{21-22} = CY;
2301fe6060f1SDimitry Andric  let Inst{23-30} = xo;
2302fe6060f1SDimitry Andric  let Inst{31} = 0;
2303fe6060f1SDimitry Andric}
2304fe6060f1SDimitry Andric
230506c3fb27SDimitry Andricclass Z23Form_FRTAB5_RMC2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
230606c3fb27SDimitry Andric                          string asmstr, list<dag> pattern>
230706c3fb27SDimitry Andric    : I<opcode, OOL, IOL, asmstr, NoItinerary> {
230806c3fb27SDimitry Andric  bits<5> FRT;
230906c3fb27SDimitry Andric  bits<5> FRA;
231006c3fb27SDimitry Andric  bits<5> FRB;
231106c3fb27SDimitry Andric  bits<2> RMC;
231206c3fb27SDimitry Andric
231306c3fb27SDimitry Andric  let Pattern = pattern;
231406c3fb27SDimitry Andric
231506c3fb27SDimitry Andric  bit RC = 0; // set by isRecordForm
231606c3fb27SDimitry Andric
231706c3fb27SDimitry Andric  let Inst{6 - 10} = FRT;
231806c3fb27SDimitry Andric  let Inst{11 - 15} = FRA;
231906c3fb27SDimitry Andric  let Inst{16 - 20} = FRB;
232006c3fb27SDimitry Andric  let Inst{21 - 22} = RMC;
232106c3fb27SDimitry Andric  let Inst{23 - 30} = xo;
232206c3fb27SDimitry Andric  let Inst{31} = RC;
232306c3fb27SDimitry Andric}
232406c3fb27SDimitry Andric
232506c3fb27SDimitry Andricclass Z23Form_TE5_FRTB5_RMC2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
232606c3fb27SDimitry Andric                             string asmstr, list<dag> pattern>
232706c3fb27SDimitry Andric    : Z23Form_FRTAB5_RMC2<opcode, xo, OOL, IOL, asmstr, pattern> {
232806c3fb27SDimitry Andric  bits<5> TE;
232906c3fb27SDimitry Andric  let FRA = TE;
233006c3fb27SDimitry Andric}
233106c3fb27SDimitry Andric
233206c3fb27SDimitry Andricclass Z23Form_FRTB5_R1_RMC2<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
233306c3fb27SDimitry Andric                            string asmstr, list<dag> pattern>
233406c3fb27SDimitry Andric    : I<opcode, OOL, IOL, asmstr, NoItinerary> {
233506c3fb27SDimitry Andric  bits<5> FRT;
233606c3fb27SDimitry Andric  bits<1> R;
233706c3fb27SDimitry Andric  bits<5> FRB;
233806c3fb27SDimitry Andric  bits<2> RMC;
233906c3fb27SDimitry Andric
234006c3fb27SDimitry Andric  let Pattern = pattern;
234106c3fb27SDimitry Andric
234206c3fb27SDimitry Andric  bit RC = 0; // set by isRecordForm
234306c3fb27SDimitry Andric
234406c3fb27SDimitry Andric  let Inst{6 - 10} = FRT;
234506c3fb27SDimitry Andric  let Inst{11 - 14} = 0;
234606c3fb27SDimitry Andric  let Inst{15} = R;
234706c3fb27SDimitry Andric  let Inst{16 - 20} = FRB;
234806c3fb27SDimitry Andric  let Inst{21 - 22} = RMC;
234906c3fb27SDimitry Andric  let Inst{23 - 30} = xo;
235006c3fb27SDimitry Andric  let Inst{31} = RC;
235106c3fb27SDimitry Andric}
235206c3fb27SDimitry Andric
23530b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
23540b57cec5SDimitry Andric// EmitTimePseudo won't have encoding information for the [MC]CodeEmitter
23550b57cec5SDimitry Andric// stuff
23560b57cec5SDimitry Andricclass PPCEmitTimePseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
23570b57cec5SDimitry Andric    : I<0, OOL, IOL, asmstr, NoItinerary> {
23580b57cec5SDimitry Andric  let isCodeGenOnly = 1;
23590b57cec5SDimitry Andric  let PPC64 = 0;
23600b57cec5SDimitry Andric  let Pattern = pattern;
23610b57cec5SDimitry Andric  let Inst{31-0} = 0;
23620b57cec5SDimitry Andric  let hasNoSchedulingInfo = 1;
23630b57cec5SDimitry Andric}
23640b57cec5SDimitry Andric
23650b57cec5SDimitry Andric// Instruction that require custom insertion support
23660b57cec5SDimitry Andric// a.k.a. ISelPseudos, however, these won't have isPseudo set
23670b57cec5SDimitry Andricclass PPCCustomInserterPseudo<dag OOL, dag IOL, string asmstr,
23680b57cec5SDimitry Andric                              list<dag> pattern>
23690b57cec5SDimitry Andric    : PPCEmitTimePseudo<OOL, IOL, asmstr, pattern> {
23700b57cec5SDimitry Andric  let usesCustomInserter = 1;
23710b57cec5SDimitry Andric}
23720b57cec5SDimitry Andric
23730b57cec5SDimitry Andric// PostRAPseudo will be expanded in expandPostRAPseudo, isPseudo flag in td
23740b57cec5SDimitry Andric// files is set only for PostRAPseudo
23750b57cec5SDimitry Andricclass PPCPostRAExpPseudo<dag OOL, dag IOL, string asmstr, list<dag> pattern>
23760b57cec5SDimitry Andric    : PPCEmitTimePseudo<OOL, IOL, asmstr, pattern> {
23770b57cec5SDimitry Andric  let isPseudo = 1;
23780b57cec5SDimitry Andric}
23790b57cec5SDimitry Andric
23800b57cec5SDimitry Andricclass PseudoXFormMemOp<dag OOL, dag IOL, string asmstr, list<dag> pattern>
23810b57cec5SDimitry Andric    : PPCPostRAExpPseudo<OOL, IOL, asmstr, pattern>, XFormMemOp;
23820b57cec5SDimitry Andric
2383