@@ -120,6 +120,74 @@ class VXForm_VRTAB5<bits<11> xo, dag OOL, dag IOL, string asmstr,
120120 let Inst{21...31} = xo;
121121}
122122
123+ class XX3Form_XTBp5_M2<bits<9> xo, dag OOL, dag IOL, string asmstr,
124+ list<dag> pattern>
125+ : I<60, OOL, IOL, asmstr, NoItinerary> {
126+
127+ bits<5> XTp;
128+ bits<5> XBp;
129+ bits<2> M;
130+
131+ let Pattern = pattern;
132+
133+ let Inst{6...9} = XTp{3...0};
134+ let Inst {10} = XTp{4};
135+ let Inst{15} = M{0};
136+ let Inst{16...19} = XBp{3...0};
137+ let Inst{20} = M{1};
138+ let Inst{21...29} = xo;
139+ let Inst{30} = XBp{4};
140+ }
141+
142+ class XX3Form_XTABp5_M2<bits<8> xo, dag OOL, dag IOL, string asmstr,
143+ list<dag> pattern>
144+ : I<60, OOL, IOL, asmstr, NoItinerary> {
145+
146+ bits<5> XTp;
147+ bits<5> XAp;
148+ bits<5> XBp;
149+ bits<2> M;
150+
151+ let Pattern = pattern;
152+
153+ let Inst{6...9} = XTp{3...0};
154+ let Inst{10} = XTp{4};
155+ let Inst{11...14} = XAp{3...0};
156+ let Inst{15} = M{0};
157+ let Inst{16...19} = XBp{3...0};
158+ let Inst{20} = M{1};
159+ let Inst{21...28} = xo;
160+ let Inst{29} = XAp{4};
161+ let Inst{30} = XBp{4};
162+ }
163+
164+ class XX3Form_XTAB6_P1<bits<5> xo, dag OOL, dag IOL, string asmstr,
165+ list<dag> pattern>
166+ : I<60, OOL, IOL, asmstr, NoItinerary> {
167+
168+ bits<6> XT;
169+ bits<6> XA;
170+ bits<6> XB;
171+ bits<1> P;
172+
173+ let Pattern = pattern;
174+
175+ let Inst{6...10} = XT{4...0};
176+ let Inst{11...15} = XA{4...0};
177+ let Inst{16...20} = XB{4...0};
178+ let Inst{21...22} = 3;
179+ let Inst{23} = P;
180+ let Inst{24...28} = xo;
181+ let Inst{29} = XA{5};
182+ let Inst{30} = XB{5};
183+ let Inst{31} = XT{5};
184+ }
185+
186+ //-------------------------- Instruction definitions -------------------------//
187+ // Predicate combinations available:
188+ // [IsISAFuture]
189+ // [HasVSX, IsISAFuture]
190+
123191let Predicates = [IsISAFuture] in {
124192 defm SUBFUS : XOForm_RTAB5_L1r<31, 72, (outs g8rc:$RT),
125193 (ins g8rc:$RA, g8rc:$RB, u1imm:$L), "subfus",
@@ -191,6 +259,53 @@ let Predicates = [HasVSX, IsISAFuture] in {
191259 def VUCMPRLH
192260 : VXForm_VRTAB5<323, (outs vrrc:$VRT), (ins vrrc:$VRA, vrrc:$VRB),
193261 "vucmprlh $VRT, $VRA, $VRB", []>;
262+
263+ // AES Acceleration Instructions
264+ def XXAESENCP : XX3Form_XTABp5_M2<194, (outs vsrprc:$XTp),
265+ (ins vsrprc:$XAp, vsrprc:$XBp, u2imm:$M),
266+ "xxaesencp $XTp, $XAp, $XBp, $M", []>;
267+ def XXAESDECP : XX3Form_XTABp5_M2<202, (outs vsrprc:$XTp),
268+ (ins vsrprc:$XAp, vsrprc:$XBp, u2imm:$M),
269+ "xxaesdecp $XTp, $XAp, $XBp, $M", []>;
270+ def XXAESGENLKP : XX3Form_XTBp5_M2<420, (outs vsrprc:$XTp),
271+ (ins vsrprc:$XBp, u2imm:$M),
272+ "xxaesgenlkp $XTp, $XBp, $M", []>;
273+ def XXGFMUL128 : XX3Form_XTAB6_P1<26, (outs vsrc:$XT),
274+ (ins vsrc:$XA, vsrc:$XB, u1imm:$P),
275+ "xxgfmul128 $XT, $XA, $XB, $P", []>;
276+ }
277+
278+ //---------------------------- Anonymous Patterns ----------------------------//
279+ // Predicate combinations available:
280+
281+
282+ //---------------------------- Instruction aliases ---------------------------//
283+ // Predicate combinations available:
284+ // [HasVSX, IsISAFuture]
285+
286+ let Predicates = [HasVSX, IsISAFuture] in {
287+ def : InstAlias<"xxaes128encp $XTp, $XAp, $XBp",
288+ (XXAESENCP vsrprc:$XTp, vsrprc:$XAp, vsrprc:$XBp, 0)>;
289+ def : InstAlias<"xxaes192encp $XTp, $XAp, $XBp",
290+ (XXAESENCP vsrprc:$XTp, vsrprc:$XAp, vsrprc:$XBp, 1)>;
291+ def : InstAlias<"xxaes256encp $XTp, $XAp, $XBp",
292+ (XXAESENCP vsrprc:$XTp, vsrprc:$XAp, vsrprc:$XBp, 2)>;
293+ def : InstAlias<"xxaes128decp $XTp, $XAp, $XBp",
294+ (XXAESDECP vsrprc:$XTp, vsrprc:$XAp, vsrprc:$XBp, 0)>;
295+ def : InstAlias<"xxaes192decp $XTp, $XAp, $XBp",
296+ (XXAESDECP vsrprc:$XTp, vsrprc:$XAp, vsrprc:$XBp, 1)>;
297+ def : InstAlias<"xxaes256decp $XTp, $XAp, $XBp",
298+ (XXAESDECP vsrprc:$XTp, vsrprc:$XAp, vsrprc:$XBp, 2)>;
299+ def : InstAlias<"xxaes128genlkp $XTp, $XBp", (XXAESGENLKP vsrprc:$XTp,
300+ vsrprc:$XBp, 0)>;
301+ def : InstAlias<"xxaes192genlkp $XTp, $XBp", (XXAESGENLKP vsrprc:$XTp,
302+ vsrprc:$XBp, 1)>;
303+ def : InstAlias<"xxaes256genlkp $XTp, $XBp", (XXAESGENLKP vsrprc:$XTp,
304+ vsrprc:$XBp, 2)>;
305+ def : InstAlias<"xxgfmul128gcm $XT, $XA, $XB", (XXGFMUL128 vsrc:$XT, vsrc:$XA,
306+ vsrc:$XB, 0)>;
307+ def : InstAlias<"xxgfmul128xts $XT, $XA, $XB", (XXGFMUL128 vsrc:$XT, vsrc:$XA,
308+ vsrc:$XB, 1)>;
194309}
195310
196311//---------------------------- Anonymous Patterns ----------------------------//
0 commit comments