@@ -1023,6 +1023,32 @@ multiclass XOForm_1r<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
10231023 }
10241024}
10251025
1026+ // Multiclass for instructions which have a record overflow form as well
1027+ // as a record form but no carry (i.e. mulld, mulldo, subf, subfo, etc.)
1028+ multiclass XOForm_1rx<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
1029+ string asmbase, string asmstr, InstrItinClass itin,
1030+ list<dag> pattern> {
1031+ let BaseName = asmbase in {
1032+ def NAME : XOForm_1<opcode, xo, 0, OOL, IOL,
1033+ !strconcat(asmbase, !strconcat(" ", asmstr)), itin,
1034+ pattern>, RecFormRel;
1035+ let Defs = [CR0] in
1036+ def o : XOForm_1<opcode, xo, 0, OOL, IOL,
1037+ !strconcat(asmbase, !strconcat(". ", asmstr)), itin,
1038+ []>, isDOT, RecFormRel;
1039+ }
1040+ let BaseName = !strconcat(asmbase, "O") in {
1041+ let Defs = [XER] in
1042+ def O : XOForm_1<opcode, xo, 1, OOL, IOL,
1043+ !strconcat(asmbase, !strconcat("o ", asmstr)), itin,
1044+ []>, RecFormRel;
1045+ let Defs = [XER, CR0] in
1046+ def Oo : XOForm_1<opcode, xo, 1, OOL, IOL,
1047+ !strconcat(asmbase, !strconcat("o. ", asmstr)), itin,
1048+ []>, isDOT, RecFormRel;
1049+ }
1050+ }
1051+
10261052// Multiclass for instructions for which the non record form is not cracked
10271053// and the record form is cracked (i.e. divw, mullw, etc.)
10281054multiclass XOForm_1rcr<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
@@ -1038,6 +1064,16 @@ multiclass XOForm_1rcr<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
10381064 []>, isDOT, RecFormRel, PPC970_DGroup_First,
10391065 PPC970_DGroup_Cracked;
10401066 }
1067+ let BaseName = !strconcat(asmbase, "O") in {
1068+ let Defs = [XER] in
1069+ def O : XOForm_1<opcode, xo, 1, OOL, IOL,
1070+ !strconcat(asmbase, !strconcat("o ", asmstr)), itin,
1071+ []>, RecFormRel;
1072+ let Defs = [XER, CR0] in
1073+ def Oo : XOForm_1<opcode, xo, 1, OOL, IOL,
1074+ !strconcat(asmbase, !strconcat("o. ", asmstr)), itin,
1075+ []>, isDOT, RecFormRel;
1076+ }
10411077}
10421078
10431079multiclass XOForm_1rc<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
@@ -1053,6 +1089,16 @@ multiclass XOForm_1rc<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
10531089 !strconcat(asmbase, !strconcat(". ", asmstr)), itin,
10541090 []>, isDOT, RecFormRel;
10551091 }
1092+ let BaseName = !strconcat(asmbase, "O") in {
1093+ let Defs = [CARRY, XER] in
1094+ def O : XOForm_1<opcode, xo, 1, OOL, IOL,
1095+ !strconcat(asmbase, !strconcat("o ", asmstr)), itin,
1096+ []>, RecFormRel;
1097+ let Defs = [CARRY, XER, CR0] in
1098+ def Oo : XOForm_1<opcode, xo, 1, OOL, IOL,
1099+ !strconcat(asmbase, !strconcat("o. ", asmstr)), itin,
1100+ []>, isDOT, RecFormRel;
1101+ }
10561102}
10571103
10581104multiclass XOForm_3r<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
@@ -1067,6 +1113,16 @@ multiclass XOForm_3r<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
10671113 !strconcat(asmbase, !strconcat(". ", asmstr)), itin,
10681114 []>, isDOT, RecFormRel;
10691115 }
1116+ let BaseName = !strconcat(asmbase, "O") in {
1117+ let Defs = [XER] in
1118+ def O : XOForm_3<opcode, xo, 1, OOL, IOL,
1119+ !strconcat(asmbase, !strconcat("o ", asmstr)), itin,
1120+ []>, RecFormRel;
1121+ let Defs = [XER, CR0] in
1122+ def Oo : XOForm_3<opcode, xo, 1, OOL, IOL,
1123+ !strconcat(asmbase, !strconcat("o. ", asmstr)), itin,
1124+ []>, isDOT, RecFormRel;
1125+ }
10701126}
10711127
10721128multiclass XOForm_3rc<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
@@ -1082,6 +1138,16 @@ multiclass XOForm_3rc<bits<6> opcode, bits<9> xo, bit oe, dag OOL, dag IOL,
10821138 !strconcat(asmbase, !strconcat(". ", asmstr)), itin,
10831139 []>, isDOT, RecFormRel;
10841140 }
1141+ let BaseName = !strconcat(asmbase, "O") in {
1142+ let Defs = [CARRY, XER] in
1143+ def O : XOForm_3<opcode, xo, 1, OOL, IOL,
1144+ !strconcat(asmbase, !strconcat("o ", asmstr)), itin,
1145+ []>, RecFormRel;
1146+ let Defs = [CARRY, XER, CR0] in
1147+ def Oo : XOForm_3<opcode, xo, 1, OOL, IOL,
1148+ !strconcat(asmbase, !strconcat("o. ", asmstr)), itin,
1149+ []>, isDOT, RecFormRel;
1150+ }
10851151}
10861152
10871153multiclass MForm_2r<bits<6> opcode, dag OOL, dag IOL,
@@ -2776,9 +2842,9 @@ def MODUW : XForm_8<31, 267, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
27762842let PPC970_Unit = 1, hasSideEffects = 0 in { // FXU Operations.
27772843// XO-Form instructions. Arithmetic instructions that can set overflow bit
27782844let isCommutable = 1 in
2779- defm ADD4 : XOForm_1r <31, 266, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2780- "add", "$rT, $rA, $rB", IIC_IntSimple,
2781- [(set i32:$rT, (add i32:$rA, i32:$rB))]>;
2845+ defm ADD4 : XOForm_1rx <31, 266, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2846+ "add", "$rT, $rA, $rB", IIC_IntSimple,
2847+ [(set i32:$rT, (add i32:$rA, i32:$rB))]>;
27822848let isCodeGenOnly = 1 in
27832849def ADD4TLS : XOForm_1<31, 266, 0, (outs gprc:$rT), (ins gprc:$rA, tlsreg32:$rB),
27842850 "add $rT, $rA, $rB", IIC_IntSimple,
@@ -2795,38 +2861,28 @@ defm DIVW : XOForm_1rcr<31, 491, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
27952861defm DIVWU : XOForm_1rcr<31, 459, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
27962862 "divwu", "$rT, $rA, $rB", IIC_IntDivW,
27972863 [(set i32:$rT, (udiv i32:$rA, i32:$rB))]>;
2798- def DIVWE : XOForm_1<31, 427, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2799- "divwe $rT, $rA, $rB", IIC_IntDivW,
2800- [(set i32:$rT, (int_ppc_divwe gprc:$rA, gprc:$rB))]>,
2801- Requires<[HasExtDiv]>;
2802- let Defs = [CR0] in
2803- def DIVWEo : XOForm_1<31, 427, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2804- "divwe. $rT, $rA, $rB", IIC_IntDivW,
2805- []>, isDOT, PPC970_DGroup_Cracked, PPC970_DGroup_First,
2806- Requires<[HasExtDiv]>;
2807- def DIVWEU : XOForm_1<31, 395, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2808- "divweu $rT, $rA, $rB", IIC_IntDivW,
2809- [(set i32:$rT, (int_ppc_divweu gprc:$rA, gprc:$rB))]>,
2810- Requires<[HasExtDiv]>;
2811- let Defs = [CR0] in
2812- def DIVWEUo : XOForm_1<31, 395, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2813- "divweu. $rT, $rA, $rB", IIC_IntDivW,
2814- []>, isDOT, PPC970_DGroup_Cracked, PPC970_DGroup_First,
2815- Requires<[HasExtDiv]>;
2864+ defm DIVWE : XOForm_1rcr<31, 427, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2865+ "divwe", "$rT, $rA, $rB", IIC_IntDivW,
2866+ [(set i32:$rT, (int_ppc_divwe gprc:$rA, gprc:$rB))]>,
2867+ Requires<[HasExtDiv]>;
2868+ defm DIVWEU : XOForm_1rcr<31, 395, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2869+ "divweu", "$rT, $rA, $rB", IIC_IntDivW,
2870+ [(set i32:$rT, (int_ppc_divweu gprc:$rA, gprc:$rB))]>,
2871+ Requires<[HasExtDiv]>;
28162872let isCommutable = 1 in {
28172873defm MULHW : XOForm_1r<31, 75, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
28182874 "mulhw", "$rT, $rA, $rB", IIC_IntMulHW,
28192875 [(set i32:$rT, (mulhs i32:$rA, i32:$rB))]>;
28202876defm MULHWU : XOForm_1r<31, 11, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
28212877 "mulhwu", "$rT, $rA, $rB", IIC_IntMulHWU,
28222878 [(set i32:$rT, (mulhu i32:$rA, i32:$rB))]>;
2823- defm MULLW : XOForm_1r <31, 235, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2824- "mullw", "$rT, $rA, $rB", IIC_IntMulHW,
2825- [(set i32:$rT, (mul i32:$rA, i32:$rB))]>;
2879+ defm MULLW : XOForm_1rx <31, 235, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2880+ "mullw", "$rT, $rA, $rB", IIC_IntMulHW,
2881+ [(set i32:$rT, (mul i32:$rA, i32:$rB))]>;
28262882} // isCommutable
2827- defm SUBF : XOForm_1r <31, 40, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2828- "subf", "$rT, $rA, $rB", IIC_IntGeneral,
2829- [(set i32:$rT, (sub i32:$rB, i32:$rA))]>;
2883+ defm SUBF : XOForm_1rx <31, 40, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
2884+ "subf", "$rT, $rA, $rB", IIC_IntGeneral,
2885+ [(set i32:$rT, (sub i32:$rB, i32:$rA))]>;
28302886defm SUBFC : XOForm_1rc<31, 8, 0, (outs gprc:$rT), (ins gprc:$rA, gprc:$rB),
28312887 "subfc", "$rT, $rA, $rB", IIC_IntGeneral,
28322888 [(set i32:$rT, (subc i32:$rB, i32:$rA))]>,
0 commit comments