1 //===-- PPCInstrP10.td - Power10 Instruction Set -----------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 //===----------------------------------------------------------------------===//
11 // This file describes the instructions introduced for the Power10 CPU.
13 //===----------------------------------------------------------------------===//
15 //===----------------------------------------------------------------------===//
16 // Naming convention for future instruction formats
18 // <INSTR_FORM>{_<OP_TYPE><OP_LENGTH>}+
21 // <INSTR_FORM> - name of instruction format as per the ISA
22 // (X-Form, VX-Form, etc.)
23 // <OP_TYPE> - operand type
24 // * FRT/RT/VT/XT/BT - target register
25 // (FPR, GPR, VR, VSR, CR-bit respectively)
26 // In some situations, the 'T' is replaced by
27 // 'D' when describing the target register.
28 // * [FR|R|V|X|B][A-Z] - register source (i.e. FRA, RA, XB, etc.)
29 // * IMM - immediate (where signedness matters,
30 // this is SI/UI for signed/unsigned)
31 // * [R|X|FR]Tp - register pair target (i.e. FRTp, RTp)
32 // * R - PC-Relative bit
33 // (denotes that the address is computed pc-relative)
34 // * VRM - Masked Registers
35 // * AT - target accumulator
36 // * N - the Nth bit in a VSR
37 // * Additional 1-bit operands may be required for certain
38 // instruction formats such as: MC, P, MP
39 // * X / Y / P - mask values. In the instruction encoding, this is
40 // represented as XMSK, YMSK and PMSK.
41 // * MEM - indicates if the instruction format requires any memory
42 // accesses. This does not have <OP_LENGTH> attached to it.
43 // <OP_LENGTH> - the length of each operand in bits.
44 // For operands that are 1 bit, the '1' is omitted from the name.
46 // Example: 8RR_XX4Form_IMM8_XTAB6
47 // 8RR_XX4Form is the instruction format.
48 // The operand is an 8-bit immediate (IMM), the destination (XT)
49 // and sources (XA, XB) that are all 6-bits. The destination and
50 // source registers are combined if they are of the same length.
51 // Moreover, the order of operands reflects the order of operands
54 //-------------------------- Predicate definitions ---------------------------//
55 def IsPPC32 : Predicate<"!Subtarget->isPPC64()">;
58 //===----------------------------------------------------------------------===//
59 // PowerPC ISA 3.1 specific type constraints.
62 def SDT_PPCSplat32 : SDTypeProfile<1, 3, [ SDTCisVT<0, v2i64>,
63 SDTCisVec<1>, SDTCisInt<2>, SDTCisInt<3>
65 def SDT_PPCAccBuild : SDTypeProfile<1, 4, [
66 SDTCisVT<0, v512i1>, SDTCisVT<1, v4i32>, SDTCisVT<2, v4i32>,
67 SDTCisVT<3, v4i32>, SDTCisVT<4, v4i32>
69 def SDT_PPCPairBuild : SDTypeProfile<1, 2, [
70 SDTCisVT<0, v256i1>, SDTCisVT<1, v4i32>, SDTCisVT<2, v4i32>
72 def SDT_PPCAccExtractVsx : SDTypeProfile<1, 2, [
73 SDTCisVT<0, v4i32>, SDTCisVT<1, v512i1>, SDTCisPtrTy<2>
75 def SDT_PPCPairExtractVsx : SDTypeProfile<1, 2, [
76 SDTCisVT<0, v4i32>, SDTCisVT<1, v256i1>, SDTCisPtrTy<2>
78 def SDT_PPCxxmfacc : SDTypeProfile<1, 1, [
79 SDTCisVT<0, v512i1>, SDTCisVT<1, v512i1>
82 def SDT_PPCsetbc : SDTypeProfile<1, 1, [
83 SDTCisInt<0>, SDTCisInt<1>
86 //===----------------------------------------------------------------------===//
87 // ISA 3.1 specific PPCISD nodes.
90 def PPCxxsplti32dx : SDNode<"PPCISD::XXSPLTI32DX", SDT_PPCSplat32, []>;
91 def PPCAccBuild : SDNode<"PPCISD::ACC_BUILD", SDT_PPCAccBuild, []>;
92 def PPCPairBuild : SDNode<"PPCISD::PAIR_BUILD", SDT_PPCPairBuild, []>;
93 def PPCAccExtractVsx : SDNode<"PPCISD::EXTRACT_VSX_REG", SDT_PPCAccExtractVsx,
95 def PPCPairExtractVsx : SDNode<"PPCISD::EXTRACT_VSX_REG", SDT_PPCPairExtractVsx,
97 def PPCxxmfacc : SDNode<"PPCISD::XXMFACC", SDT_PPCxxmfacc, []>;
98 def PPCsetbc : SDNode<"PPCISD::SETBC", SDT_PPCsetbc, []>;
99 def PPCsetbcr : SDNode<"PPCISD::SETBCR", SDT_PPCsetbc, []>;
101 //===----------------------------------------------------------------------===//
103 // PC Relative flag (for instructions that use the address of the prefix for
104 // address computations).
105 class isPCRel { bit PCRel = 1; }
107 // PowerPC specific type constraints.
108 def SDT_PPCLXVRZX : SDTypeProfile<1, 2, [
109 SDTCisVT<0, v1i128>, SDTCisPtrTy<1>, SDTCisPtrTy<2>
112 // PPC Specific DAG Nodes.
113 def PPClxvrzx : SDNode<"PPCISD::LXVRZX", SDT_PPCLXVRZX,
114 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
116 // Top-level class for prefixed instructions.
117 class PI<bits<6> pref, bits<6> opcode, dag OOL, dag IOL, string asmstr,
118 InstrItinClass itin> : Instruction {
120 field bits<64> SoftFail = 0;
121 bit PCRel = 0; // Default value, set by isPCRel.
124 let Namespace = "PPC";
125 let OutOperandList = OOL;
126 let InOperandList = IOL;
127 let AsmString = asmstr;
128 let Itinerary = itin;
129 let Inst{0-5} = pref;
130 let Inst{32-37} = opcode;
132 bits<1> PPC970_First = 0;
133 bits<1> PPC970_Single = 0;
134 bits<1> PPC970_Cracked = 0;
135 bits<3> PPC970_Unit = 0;
137 /// These fields correspond to the fields in PPCInstrInfo.h. Any changes to
138 /// these must be reflected there! See comments there for what these are.
139 let TSFlags{0} = PPC970_First;
140 let TSFlags{1} = PPC970_Single;
141 let TSFlags{2} = PPC970_Cracked;
142 let TSFlags{5-3} = PPC970_Unit;
144 bits<1> Prefixed = 1; // This is a prefixed instruction.
145 let TSFlags{7} = Prefixed;
147 // Indicate that this instruction takes a register+immediate memory operand.
149 let TSFlags{10} = MemriOp;
151 // For cases where multiple instruction definitions really represent the
152 // same underlying instruction but with one definition for 64-bit arguments
153 // and one for 32-bit arguments, this bit breaks the degeneracy between
154 // the two forms and allows TableGen to generate mapping tables.
155 bit Interpretation64Bit = 0;
157 // Fields used for relation models.
158 string BaseName = "";
161 // VX-Form: [ PO VT R VB RC XO ]
162 class VXForm_VTB5_RC<bits<10> xo, bits<5> R, dag OOL, dag IOL, string asmstr,
163 InstrItinClass itin, list<dag> pattern>
164 : I<4, OOL, IOL, asmstr, itin> {
169 let Pattern = pattern;
173 let Inst{16-20} = VB;
175 let Inst{22-31} = xo;
178 // Multiclass definition to account for record and non-record form
179 // instructions of VXRForm.
180 multiclass VXForm_VTB5_RCr<bits<10> xo, bits<5> R, dag OOL, dag IOL,
181 string asmbase, string asmstr,
182 InstrItinClass itin, list<dag> pattern> {
183 let BaseName = asmbase in {
184 def NAME : VXForm_VTB5_RC<xo, R, OOL, IOL,
185 !strconcat(asmbase, !strconcat(" ", asmstr)),
186 itin, pattern>, RecFormRel;
188 def _rec : VXForm_VTB5_RC<xo, R, OOL, IOL,
189 !strconcat(asmbase, !strconcat(". ", asmstr)),
190 itin, []>, isRecordForm, RecFormRel;
194 class MLS_DForm_R_SI34_RTA5_MEM<bits<6> opcode, dag OOL, dag IOL, string asmstr,
195 InstrItinClass itin, list<dag> pattern>
196 : PI<1, opcode, OOL, IOL, asmstr, itin>, MemriOp {
201 let Pattern = pattern;
206 let Inst{11} = PCRel;
208 let Inst{14-31} = D{33-16}; // d0
211 let Inst{38-42} = RST{4-0};
212 let Inst{43-47} = RA;
213 let Inst{48-63} = D{15-0}; // d1
216 class MLS_DForm_R_SI34_RTA5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
217 InstrItinClass itin, list<dag> pattern>
218 : PI<1, opcode, OOL, IOL, asmstr, itin> {
223 let Pattern = pattern;
228 let Inst{11} = PCRel;
230 let Inst{14-31} = SI{33-16};
233 let Inst{38-42} = RT;
234 let Inst{43-47} = RA;
235 let Inst{48-63} = SI{15-0};
238 class MLS_DForm_SI34_RT5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
239 InstrItinClass itin, list<dag> pattern>
240 : PI<1, opcode, OOL, IOL, asmstr, itin> {
244 let Pattern = pattern;
251 let Inst{14-31} = SI{33-16};
254 let Inst{38-42} = RT;
256 let Inst{48-63} = SI{15-0};
259 multiclass MLS_DForm_R_SI34_RTA5_p<bits<6> opcode, dag OOL, dag IOL,
260 dag PCRel_IOL, string asmstr,
261 InstrItinClass itin> {
262 def NAME : MLS_DForm_R_SI34_RTA5<opcode, OOL, IOL,
263 !strconcat(asmstr, ", 0"), itin, []>;
264 def pc : MLS_DForm_R_SI34_RTA5<opcode, OOL, PCRel_IOL,
265 !strconcat(asmstr, ", 1"), itin, []>, isPCRel;
268 class 8LS_DForm_R_SI34_RTA5_MEM<bits<6> opcode, dag OOL, dag IOL, string asmstr,
269 InstrItinClass itin, list<dag> pattern>
270 : PI<1, opcode, OOL, IOL, asmstr, itin>, MemriOp {
275 let Pattern = pattern;
279 let Inst{11} = PCRel;
281 let Inst{14-31} = D{33-16}; // d0
284 let Inst{38-42} = RST{4-0};
285 let Inst{43-47} = RA;
286 let Inst{48-63} = D{15-0}; // d1
289 // 8LS:D-Form: [ 1 0 0 // R // d0
291 class 8LS_DForm_R_SI34_XT6_RA5_MEM<bits<5> opcode, dag OOL, dag IOL,
292 string asmstr, InstrItinClass itin,
294 : PI<1, { opcode, ? }, OOL, IOL, asmstr, itin>, MemriOp {
299 let Pattern = pattern;
304 let Inst{9-10} = 0; // reserved
305 let Inst{11} = PCRel;
306 let Inst{12-13} = 0; // reserved
307 let Inst{14-31} = D{33-16}; // d0
310 let Inst{37} = XST{5};
311 let Inst{38-42} = XST{4-0};
312 let Inst{43-47} = RA;
313 let Inst{48-63} = D{15-0}; // d1
316 // X-Form: [PO T IMM VRB XO TX]
317 class XForm_XT6_IMM5_VB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
318 string asmstr, InstrItinClass itin, list<dag> pattern>
319 : I<opcode, OOL, IOL, asmstr, itin> {
324 let Pattern = pattern;
325 let Inst{6-10} = XT{4-0};
326 let Inst{11-15} = IMM;
327 let Inst{16-20} = VRB;
328 let Inst{21-30} = xo;
329 let Inst{31} = XT{5};
332 class 8RR_XX4Form_IMM8_XTAB6<bits<6> opcode, bits<2> xo,
333 dag OOL, dag IOL, string asmstr,
334 InstrItinClass itin, list<dag> pattern>
335 : PI<1, opcode, OOL, IOL, asmstr, itin> {
342 let Pattern = pattern;
350 let Inst{24-31} = IMM;
353 let Inst{38-42} = XT{4-0};
354 let Inst{43-47} = XA{4-0};
355 let Inst{48-52} = XB{4-0};
356 let Inst{53-57} = XC{4-0};
357 let Inst{58-59} = xo;
358 let Inst{60} = XC{5};
359 let Inst{61} = XA{5};
360 let Inst{62} = XB{5};
361 let Inst{63} = XT{5};
364 class VXForm_RD5_N3_VB5<bits<11> xo, dag OOL, dag IOL, string asmstr,
365 InstrItinClass itin, list<dag> pattern>
366 : I<4, OOL, IOL, asmstr, itin> {
371 let Pattern = pattern;
376 let Inst{16-20} = VB;
377 let Inst{21-31} = xo;
381 // VX-Form: [PO VRT RA VRB XO].
382 // Destructive (insert) forms are suffixed with _ins.
383 class VXForm_VTB5_RA5_ins<bits<11> xo, string opc, list<dag> pattern>
384 : VXForm_1<xo, (outs vrrc:$VD), (ins vrrc:$VDi, gprc:$VA, vrrc:$VB),
385 !strconcat(opc, " $VD, $VA, $VB"), IIC_VecGeneral, pattern>,
386 RegConstraint<"$VDi = $VD">, NoEncode<"$VDi">;
388 // VX-Form: [PO VRT RA RB XO].
389 // Destructive (insert) forms are suffixed with _ins.
390 class VXForm_VRT5_RAB5_ins<bits<11> xo, string opc, list<dag> pattern>
391 : VXForm_1<xo, (outs vrrc:$VD), (ins vrrc:$VDi, gprc:$VA, gprc:$VB),
392 !strconcat(opc, " $VD, $VA, $VB"), IIC_VecGeneral, pattern>,
393 RegConstraint<"$VDi = $VD">, NoEncode<"$VDi">;
395 // VX-Form: [ PO BF // VRA VRB XO ]
396 class VXForm_BF3_VAB5<bits<11> xo, dag OOL, dag IOL, string asmstr,
397 InstrItinClass itin, list<dag> pattern>
398 : I<4, OOL, IOL, asmstr, itin> {
403 let Pattern = pattern;
407 let Inst{11-15} = VA;
408 let Inst{16-20} = VB;
409 let Inst{21-31} = xo;
412 // VN-Form: [PO VRT VRA VRB PS SD XO]
413 // SD is "Shift Direction"
414 class VNForm_VTAB5_SD3<bits<6> xo, bits<2> ps, dag OOL, dag IOL, string asmstr,
415 InstrItinClass itin, list<dag> pattern>
416 : I<4, OOL, IOL, asmstr, itin> {
422 let Pattern = pattern;
424 let Inst{6-10} = VRT;
425 let Inst{11-15} = VRA;
426 let Inst{16-20} = VRB;
427 let Inst{21-22} = ps;
428 let Inst{23-25} = SD;
429 let Inst{26-31} = xo;
432 class VXForm_RD5_MP_VB5<bits<11> xo, bits<4> eo, dag OOL, dag IOL,
433 string asmstr, InstrItinClass itin, list<dag> pattern>
434 : I<4, OOL, IOL, asmstr, itin> {
439 let Pattern = pattern;
442 let Inst{11-14} = eo;
444 let Inst{16-20} = VB;
445 let Inst{21-31} = xo;
448 // 8RR:D-Form: [ 1 1 0 // // imm0
449 // PO T XO TX imm1 ].
450 class 8RR_DForm_IMM32_XT6<bits<6> opcode, bits<4> xo, dag OOL, dag IOL,
451 string asmstr, InstrItinClass itin,
453 : PI<1, opcode, OOL, IOL, asmstr, itin> {
457 let Pattern = pattern;
462 let Inst{12-13} = 0; // reserved
463 let Inst{14-15} = 0; // reserved
464 let Inst{16-31} = IMM32{31-16};
467 let Inst{38-42} = XT{4-0};
468 let Inst{43-46} = xo;
469 let Inst{47} = XT{5};
470 let Inst{48-63} = IMM32{15-0};
473 // 8RR:D-Form: [ 1 1 0 // // imm0
474 // PO T XO IX TX imm1 ].
475 class 8RR_DForm_IMM32_XT6_IX<bits<6> opcode, bits<3> xo, dag OOL, dag IOL,
476 string asmstr, InstrItinClass itin,
478 : PI<1, opcode, OOL, IOL, asmstr, itin> {
483 let Pattern = pattern;
488 let Inst{12-13} = 0; // reserved
489 let Inst{14-15} = 0; // reserved
490 let Inst{16-31} = IMM32{31-16};
493 let Inst{38-42} = XT{4-0};
494 let Inst{43-45} = xo;
496 let Inst{47} = XT{5};
497 let Inst{48-63} = IMM32{15-0};
500 class 8RR_XX4Form_XTABC6<bits<6> opcode, bits<2> xo, dag OOL, dag IOL,
501 string asmstr, InstrItinClass itin, list<dag> pattern>
502 : PI<1, opcode, OOL, IOL, asmstr, itin> {
508 let Pattern = pattern;
517 let Inst{38-42} = XT{4-0};
518 let Inst{43-47} = XA{4-0};
519 let Inst{48-52} = XB{4-0};
520 let Inst{53-57} = XC{4-0};
521 let Inst{58-59} = xo;
522 let Inst{60} = XC{5};
523 let Inst{61} = XA{5};
524 let Inst{62} = XB{5};
525 let Inst{63} = XT{5};
528 class 8RR_XX4Form_IMM3_XTABC6<bits<6> opcode, bits<2> xo, dag OOL, dag IOL,
529 string asmstr, InstrItinClass itin,
531 : PI<1, opcode, OOL, IOL, asmstr, itin> {
538 let Pattern = pattern;
545 let Inst{29-31} = IMM;
548 let Inst{38-42} = XT{4-0};
549 let Inst{43-47} = XA{4-0};
550 let Inst{48-52} = XB{4-0};
551 let Inst{53-57} = XC{4-0};
552 let Inst{58-59} = xo;
553 let Inst{60} = XC{5};
554 let Inst{61} = XA{5};
555 let Inst{62} = XB{5};
556 let Inst{63} = XT{5};
559 // [PO BF / XO2 B XO BX /]
560 class XX2_BF3_XO5_XB6_XO9<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL,
561 dag IOL, string asmstr, InstrItinClass itin,
563 : I<opcode, OOL, IOL, asmstr, itin> {
567 let Pattern = pattern;
571 let Inst{11-15} = xo2;
572 let Inst{16-20} = XB{4-0};
573 let Inst{21-29} = xo;
574 let Inst{30} = XB{5};
578 // X-Form: [ PO RT BI /// XO / ]
579 class XForm_XT5_BI5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
580 string asmstr, InstrItinClass itin, list<dag> pattern>
581 : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
587 multiclass MLS_DForm_R_SI34_RTA5_MEM_p<bits<6> opcode, dag OOL, dag IOL,
588 dag PCRel_IOL, dag PCRelOnly_IOL,
589 string asmstr, string asmstr_pcext,
590 InstrItinClass itin> {
591 def NAME : MLS_DForm_R_SI34_RTA5_MEM<opcode, OOL, IOL,
592 !strconcat(asmstr, ", 0"), itin, []>;
593 def pc : MLS_DForm_R_SI34_RTA5_MEM<opcode, OOL, PCRel_IOL,
594 !strconcat(asmstr, ", 1"), itin, []>,
596 let isAsmParserOnly = 1, hasNoSchedulingInfo = 1 in {
597 def nopc : MLS_DForm_R_SI34_RTA5_MEM<opcode, OOL, IOL, asmstr, itin, []>;
598 let RA = 0, MemriOp = 0 in
599 def onlypc : MLS_DForm_R_SI34_RTA5_MEM<opcode, OOL, PCRelOnly_IOL,
600 asmstr_pcext, itin, []>, isPCRel;
604 multiclass 8LS_DForm_R_SI34_RTA5_MEM_p<bits<6> opcode, dag OOL, dag IOL,
605 dag PCRel_IOL, dag PCRelOnly_IOL,
606 string asmstr, string asmstr_pcext,
607 InstrItinClass itin> {
608 def NAME : 8LS_DForm_R_SI34_RTA5_MEM<opcode, OOL, IOL,
609 !strconcat(asmstr, ", 0"), itin, []>;
610 def pc : 8LS_DForm_R_SI34_RTA5_MEM<opcode, OOL, PCRel_IOL,
611 !strconcat(asmstr, ", 1"), itin, []>,
613 let isAsmParserOnly = 1, hasNoSchedulingInfo = 1 in {
614 def nopc : 8LS_DForm_R_SI34_RTA5_MEM<opcode, OOL, IOL, asmstr, itin, []>;
615 let RA = 0, MemriOp = 0 in
616 def onlypc : 8LS_DForm_R_SI34_RTA5_MEM<opcode, OOL, PCRelOnly_IOL,
617 asmstr_pcext, itin, []>, isPCRel;
621 multiclass 8LS_DForm_R_SI34_XT6_RA5_MEM_p<bits<5> opcode, dag OOL, dag IOL,
622 dag PCRel_IOL, dag PCRelOnly_IOL,
623 string asmstr, string asmstr_pcext,
624 InstrItinClass itin> {
625 def NAME : 8LS_DForm_R_SI34_XT6_RA5_MEM<opcode, OOL, IOL,
626 !strconcat(asmstr, ", 0"), itin, []>;
627 def pc : 8LS_DForm_R_SI34_XT6_RA5_MEM<opcode, OOL, PCRel_IOL,
628 !strconcat(asmstr, ", 1"), itin, []>,
630 let isAsmParserOnly = 1, hasNoSchedulingInfo = 1 in {
631 def nopc : 8LS_DForm_R_SI34_XT6_RA5_MEM<opcode, OOL, IOL, asmstr, itin, []>;
632 let RA = 0, MemriOp = 0 in
633 def onlypc : 8LS_DForm_R_SI34_XT6_RA5_MEM<opcode, OOL, PCRelOnly_IOL,
634 asmstr_pcext, itin, []>, isPCRel;
638 def PrefixInstrs : Predicate<"Subtarget->hasPrefixInstrs()">;
639 def IsISA3_1 : Predicate<"Subtarget->isISA3_1()">;
640 def PairedVectorMemops : Predicate<"Subtarget->pairedVectorMemops()">;
642 dag AToVSRC = (COPY_TO_REGCLASS $XA, VSRC);
643 dag BToVSRC = (COPY_TO_REGCLASS $XB, VSRC);
646 let Predicates = [PrefixInstrs] in {
647 let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
649 MLS_DForm_R_SI34_RTA5_p<14, (outs g8rc:$RT), (ins g8rc_nox0:$RA, s34imm:$SI),
650 (ins immZero:$RA, s34imm_pcrel:$SI),
651 "paddi $RT, $RA, $SI", IIC_LdStLFD>;
652 let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
653 def PLI8 : MLS_DForm_SI34_RT5<14, (outs g8rc:$RT),
655 "pli $RT, $SI", IIC_IntSimple, []>;
659 MLS_DForm_R_SI34_RTA5_p<14, (outs gprc:$RT), (ins gprc_nor0:$RA, s34imm:$SI),
660 (ins immZero:$RA, s34imm_pcrel:$SI),
661 "paddi $RT, $RA, $SI", IIC_LdStLFD>;
662 let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
663 def PLI : MLS_DForm_SI34_RT5<14, (outs gprc:$RT),
665 "pli $RT, $SI", IIC_IntSimple, []>;
668 let mayLoad = 1, mayStore = 0 in {
669 let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
671 MLS_DForm_R_SI34_RTA5_MEM_p<34, (outs g8rc:$RST), (ins (memri34 $D, $RA):$addr),
672 (ins (memri34_pcrel $D, $RA):$addr),
673 (ins s34imm_pcrel:$D), "plbz $RST, $addr",
674 "plbz $RST, $D", IIC_LdStLFD>;
676 MLS_DForm_R_SI34_RTA5_MEM_p<40, (outs g8rc:$RST), (ins (memri34 $D, $RA):$addr),
677 (ins (memri34_pcrel $D, $RA):$addr),
678 (ins s34imm_pcrel:$D), "plhz $RST, $addr",
679 "plhz $RST, $D", IIC_LdStLFD>;
681 MLS_DForm_R_SI34_RTA5_MEM_p<42, (outs g8rc:$RST), (ins (memri34 $D, $RA):$addr),
682 (ins (memri34_pcrel $D, $RA):$addr),
683 (ins s34imm_pcrel:$D), "plha $RST, $addr",
684 "plha $RST, $D", IIC_LdStLFD>;
686 8LS_DForm_R_SI34_RTA5_MEM_p<41, (outs g8rc:$RST), (ins (memri34 $D, $RA):$addr),
687 (ins (memri34_pcrel $D, $RA):$addr),
688 (ins s34imm_pcrel:$D),
689 "plwa $RST, $addr", "plwa $RST, $D", IIC_LdStLFD>;
691 MLS_DForm_R_SI34_RTA5_MEM_p<32, (outs g8rc:$RST), (ins (memri34 $D, $RA):$addr),
692 (ins (memri34_pcrel $D, $RA):$addr),
693 (ins s34imm_pcrel:$D), "plwz $RST, $addr",
694 "plwz $RST, $D", IIC_LdStLFD>;
697 MLS_DForm_R_SI34_RTA5_MEM_p<34, (outs gprc:$RST), (ins (memri34 $D, $RA):$addr),
698 (ins (memri34_pcrel $D, $RA):$addr),
699 (ins s34imm_pcrel:$D), "plbz $RST, $addr",
700 "plbz $RST, $D", IIC_LdStLFD>;
702 MLS_DForm_R_SI34_RTA5_MEM_p<40, (outs gprc:$RST), (ins (memri34 $D, $RA):$addr),
703 (ins (memri34_pcrel $D, $RA):$addr),
704 (ins s34imm_pcrel:$D), "plhz $RST, $addr",
705 "plhz $RST, $D", IIC_LdStLFD>;
707 MLS_DForm_R_SI34_RTA5_MEM_p<42, (outs gprc:$RST), (ins (memri34 $D, $RA):$addr),
708 (ins (memri34_pcrel $D, $RA):$addr),
709 (ins s34imm_pcrel:$D), "plha $RST, $addr",
710 "plha $RST, $D", IIC_LdStLFD>;
712 MLS_DForm_R_SI34_RTA5_MEM_p<32, (outs gprc:$RST), (ins (memri34 $D, $RA):$addr),
713 (ins (memri34_pcrel $D, $RA):$addr),
714 (ins s34imm_pcrel:$D), "plwz $RST, $addr",
715 "plwz $RST, $D", IIC_LdStLFD>;
717 8LS_DForm_R_SI34_RTA5_MEM_p<41, (outs gprc:$RST), (ins (memri34 $D, $RA):$addr),
718 (ins (memri34_pcrel $D, $RA):$addr),
719 (ins s34imm_pcrel:$D),
720 "plwa $RST, $addr", "plwa $RST, $D",
723 8LS_DForm_R_SI34_RTA5_MEM_p<57, (outs g8rc:$RST), (ins (memri34 $D, $RA):$addr),
724 (ins (memri34_pcrel $D, $RA):$addr),
725 (ins s34imm_pcrel:$D),
726 "pld $RST, $addr", "pld $RST, $D",
730 let mayStore = 1, mayLoad = 0 in {
731 let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
733 MLS_DForm_R_SI34_RTA5_MEM_p<38, (outs), (ins g8rc:$RST, (memri34 $D, $RA):$addr),
734 (ins g8rc:$RST, (memri34_pcrel $D, $RA):$addr),
735 (ins g8rc:$RST, s34imm_pcrel:$D),
736 "pstb $RST, $addr", "pstb $RST, $D", IIC_LdStLFD>;
738 MLS_DForm_R_SI34_RTA5_MEM_p<44, (outs), (ins g8rc:$RST, (memri34 $D, $RA):$addr),
739 (ins g8rc:$RST, (memri34_pcrel $D, $RA):$addr),
740 (ins g8rc:$RST, s34imm_pcrel:$D),
741 "psth $RST, $addr", "psth $RST, $D", IIC_LdStLFD>;
743 MLS_DForm_R_SI34_RTA5_MEM_p<36, (outs), (ins g8rc:$RST, (memri34 $D, $RA):$addr),
744 (ins g8rc:$RST, (memri34_pcrel $D, $RA):$addr),
745 (ins g8rc:$RST, s34imm_pcrel:$D),
746 "pstw $RST, $addr", "pstw $RST, $D", IIC_LdStLFD>;
749 MLS_DForm_R_SI34_RTA5_MEM_p<38, (outs), (ins gprc:$RST, (memri34 $D, $RA):$addr),
750 (ins gprc:$RST, (memri34_pcrel $D, $RA):$addr),
751 (ins gprc:$RST, s34imm_pcrel:$D),
752 "pstb $RST, $addr", "pstb $RST, $D", IIC_LdStLFD>;
754 MLS_DForm_R_SI34_RTA5_MEM_p<44, (outs), (ins gprc:$RST, (memri34 $D, $RA):$addr),
755 (ins gprc:$RST, (memri34_pcrel $D, $RA):$addr),
756 (ins gprc:$RST, s34imm_pcrel:$D),
757 "psth $RST, $addr", "psth $RST, $D", IIC_LdStLFD>;
759 MLS_DForm_R_SI34_RTA5_MEM_p<36, (outs), (ins gprc:$RST, (memri34 $D, $RA):$addr),
760 (ins gprc:$RST, (memri34_pcrel $D, $RA):$addr),
761 (ins gprc:$RST, s34imm_pcrel:$D),
762 "pstw $RST, $addr", "pstw $RST, $D", IIC_LdStLFD>;
764 8LS_DForm_R_SI34_RTA5_MEM_p<61, (outs), (ins g8rc:$RST, (memri34 $D, $RA):$addr),
765 (ins g8rc:$RST, (memri34_pcrel $D, $RA):$addr),
766 (ins g8rc:$RST, s34imm_pcrel:$D),
767 "pstd $RST, $addr", "pstd $RST, $D", IIC_LdStLFD>;
771 let Predicates = [PrefixInstrs, HasFPU] in {
772 let mayLoad = 1, mayStore = 0 in {
774 MLS_DForm_R_SI34_RTA5_MEM_p<48, (outs f4rc:$RST), (ins (memri34 $D, $RA):$addr),
775 (ins (memri34_pcrel $D, $RA):$addr),
776 (ins s34imm_pcrel:$D), "plfs $RST, $addr",
777 "plfs $RST, $D", IIC_LdStLFD>;
779 MLS_DForm_R_SI34_RTA5_MEM_p<50, (outs f8rc:$RST), (ins (memri34 $D, $RA):$addr),
780 (ins (memri34_pcrel $D, $RA):$addr),
781 (ins s34imm_pcrel:$D), "plfd $RST, $addr",
782 "plfd $RST, $D", IIC_LdStLFD>;
784 let mayStore = 1, mayLoad = 0 in {
786 MLS_DForm_R_SI34_RTA5_MEM_p<52, (outs), (ins f4rc:$RST, (memri34 $D, $RA):$addr),
787 (ins f4rc:$RST, (memri34_pcrel $D, $RA):$addr),
788 (ins f4rc:$RST, s34imm_pcrel:$D),
789 "pstfs $RST, $addr", "pstfs $RST, $D", IIC_LdStLFD>;
791 MLS_DForm_R_SI34_RTA5_MEM_p<54, (outs), (ins f8rc:$RST, (memri34 $D, $RA):$addr),
792 (ins f8rc:$RST, (memri34_pcrel $D, $RA):$addr),
793 (ins f8rc:$RST, s34imm_pcrel:$D),
794 "pstfd $RST, $addr", "pstfd $RST, $D", IIC_LdStLFD>;
798 let Predicates = [PrefixInstrs, HasP10Vector] in {
799 let mayLoad = 1, mayStore = 0 in {
801 8LS_DForm_R_SI34_XT6_RA5_MEM_p<25, (outs vsrc:$XST), (ins (memri34 $D, $RA):$addr),
802 (ins (memri34_pcrel $D, $RA):$addr),
803 (ins s34imm_pcrel:$D),
804 "plxv $XST, $addr", "plxv $XST, $D", IIC_LdStLFD>;
806 8LS_DForm_R_SI34_RTA5_MEM_p<43, (outs vfrc:$RST), (ins (memri34 $D, $RA):$addr),
807 (ins (memri34_pcrel $D, $RA):$addr),
808 (ins s34imm_pcrel:$D),
809 "plxssp $RST, $addr", "plxssp $RST, $D",
812 8LS_DForm_R_SI34_RTA5_MEM_p<42, (outs vfrc:$RST), (ins (memri34 $D, $RA):$addr),
813 (ins (memri34_pcrel $D, $RA):$addr),
814 (ins s34imm_pcrel:$D),
815 "plxsd $RST, $addr", "plxsd $RST, $D",
818 let mayStore = 1, mayLoad = 0 in {
820 8LS_DForm_R_SI34_XT6_RA5_MEM_p<27, (outs), (ins vsrc:$XST, (memri34 $D, $RA):$addr),
821 (ins vsrc:$XST, (memri34_pcrel $D, $RA):$addr),
822 (ins vsrc:$XST, s34imm_pcrel:$D),
823 "pstxv $XST, $addr", "pstxv $XST, $D", IIC_LdStLFD>;
825 8LS_DForm_R_SI34_RTA5_MEM_p<47, (outs), (ins vfrc:$RST, (memri34 $D, $RA):$addr),
826 (ins vfrc:$RST, (memri34_pcrel $D, $RA):$addr),
827 (ins vfrc:$RST, s34imm_pcrel:$D),
828 "pstxssp $RST, $addr", "pstxssp $RST, $D", IIC_LdStLFD>;
830 8LS_DForm_R_SI34_RTA5_MEM_p<46, (outs), (ins vfrc:$RST, (memri34 $D, $RA):$addr),
831 (ins vfrc:$RST, (memri34_pcrel $D, $RA):$addr),
832 (ins vfrc:$RST, s34imm_pcrel:$D),
833 "pstxsd $RST, $addr", "pstxsd $RST, $D", IIC_LdStLFD>;
836 8RR_XX4Form_IMM3_XTABC6<34, 0, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
837 vsrc:$XC, u3imm:$IMM),
838 "xxpermx $XT, $XA, $XB, $XC, $IMM",
841 8RR_XX4Form_XTABC6<33, 0, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
842 vsrc:$XC), "xxblendvb $XT, $XA, $XB, $XC",
845 8RR_XX4Form_XTABC6<33, 1, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
846 vsrc:$XC), "xxblendvh $XT, $XA, $XB, $XC",
849 8RR_XX4Form_XTABC6<33, 2, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
850 vsrc:$XC), "xxblendvw $XT, $XA, $XB, $XC",
853 8RR_XX4Form_XTABC6<33, 3, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
854 vsrc:$XC), "xxblendvd $XT, $XA, $XB, $XC",
858 class DQForm_XTp5_RA17_MEM<bits<6> opcode, bits<4> xo, dag OOL, dag IOL,
859 string asmstr, InstrItinClass itin, list<dag> pattern>
860 : I<opcode, OOL, IOL, asmstr, itin>, MemriOp {
865 let Pattern = pattern;
867 let Inst{6-9} = XTp{3-0};
868 let Inst{10} = XTp{4};
869 let Inst{11-15} = RA;
870 let Inst{16-27} = DQ;
871 let Inst{28-31} = xo;
874 class XForm_XTp5_XAB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
875 string asmstr, InstrItinClass itin, list<dag> pattern>
876 : I<opcode, OOL, IOL, asmstr, itin>, XFormMemOp {
881 let Pattern = pattern;
882 let Inst{6-9} = XTp{3-0};
883 let Inst{10} = XTp{4};
884 let Inst{11-15} = RA;
885 let Inst{16-20} = RB;
886 let Inst{21-30} = xo;
890 class 8LS_DForm_R_XTp5_SI34_MEM<bits<6> opcode, dag OOL, dag IOL, string asmstr,
891 InstrItinClass itin, list<dag> pattern>
892 : PI<1, opcode, OOL, IOL, asmstr, itin>, MemriOp {
897 let Pattern = pattern;
901 let Inst{11} = PCRel;
903 let Inst{14-31} = D{33-16}; // Imm18
906 let Inst{38-41} = XTp{3-0};
907 let Inst{42} = XTp{4};
908 let Inst{43-47} = RA;
909 let Inst{48-63} = D{15-0};
912 multiclass 8LS_DForm_R_XTp5_SI34_MEM_p<bits<6> opcode, dag OOL,
913 dag IOL, dag PCRel_IOL, dag PCRelOnly_IOL,
914 string asmstr, string asmstr_pcext,
915 InstrItinClass itin> {
916 def NAME : 8LS_DForm_R_XTp5_SI34_MEM<opcode, OOL, IOL,
917 !strconcat(asmstr, ", 0"), itin, []>;
918 def pc : 8LS_DForm_R_XTp5_SI34_MEM<opcode, OOL, PCRel_IOL,
919 !strconcat(asmstr, ", 1"), itin, []>,
921 let isAsmParserOnly = 1, hasNoSchedulingInfo = 1 in {
922 def nopc : 8LS_DForm_R_XTp5_SI34_MEM<opcode, OOL, IOL, asmstr, itin, []>;
923 let RA = 0, MemriOp = 0 in
924 def onlypc : 8LS_DForm_R_XTp5_SI34_MEM<opcode, OOL, PCRelOnly_IOL,
925 asmstr_pcext, itin, []>, isPCRel;
932 class XForm_AT3<bits<6> opcode, bits<5> xo2, bits<10> xo, dag OOL, dag IOL,
933 string asmstr, InstrItinClass itin, list<dag> pattern>
934 : I<opcode, OOL, IOL, asmstr, itin> {
937 let Pattern = pattern;
941 let Inst{11-15} = xo2;
943 let Inst{21-30} = xo;
947 // X-Form: [ PO T EO UIM XO TX ]
948 class XForm_XT6_IMM5<bits<6> opcode, bits<5> eo, bits<10> xo, dag OOL, dag IOL,
949 string asmstr, InstrItinClass itin, list<dag> pattern>
950 : I<opcode, OOL, IOL, asmstr, itin> {
954 let Pattern = pattern;
956 let Inst{6-10} = XT{4-0};
957 let Inst{11-15} = eo;
958 let Inst{16-20} = UIM;
959 let Inst{21-30} = xo;
960 let Inst{31} = XT{5};
963 class XX3Form_AT3_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
964 string asmstr, InstrItinClass itin,
966 : I<opcode, OOL, IOL, asmstr, itin> {
971 let Pattern = pattern;
975 let Inst{11-15} = XA{4-0};
976 let Inst{16-20} = XB{4-0};
977 let Inst{21-28} = xo;
978 let Inst{29} = XA{5};
979 let Inst{30} = XB{5};
983 class MMIRR_XX3Form_XY4P2_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
984 string asmstr, InstrItinClass itin,
986 : PI<1, opcode, OOL, IOL, asmstr, itin> {
994 let Pattern = pattern;
1000 let Inst{16-17} = PMSK;
1001 let Inst{18-23} = 0;
1002 let Inst{24-27} = XMSK;
1003 let Inst{28-31} = YMSK;
1006 let Inst{38-40} = AT;
1007 let Inst{41-42} = 0;
1008 let Inst{43-47} = XA{4-0};
1009 let Inst{48-52} = XB{4-0};
1010 let Inst{53-60} = xo;
1011 let Inst{61} = XA{5};
1012 let Inst{62} = XB{5};
1016 class MMIRR_XX3Form_XY4_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
1017 string asmstr, InstrItinClass itin,
1019 : PI<1, opcode, OOL, IOL, asmstr, itin> {
1026 let Pattern = pattern;
1031 let Inst{12-23} = 0;
1032 let Inst{24-27} = XMSK;
1033 let Inst{28-31} = YMSK;
1036 let Inst{38-40} = AT;
1037 let Inst{41-42} = 0;
1038 let Inst{43-47} = XA{4-0};
1039 let Inst{48-52} = XB{4-0};
1040 let Inst{53-60} = xo;
1041 let Inst{61} = XA{5};
1042 let Inst{62} = XB{5};
1046 class MMIRR_XX3Form_X4Y2_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
1047 string asmstr, InstrItinClass itin,
1049 : PI<1, opcode, OOL, IOL, asmstr, itin> {
1056 let Pattern = pattern;
1061 let Inst{12-23} = 0;
1062 let Inst{24-27} = XMSK;
1063 let Inst{28-29} = YMSK;
1064 let Inst{30-31} = 0;
1067 let Inst{38-40} = AT;
1068 let Inst{41-42} = 0;
1069 let Inst{43-47} = XA{4-0};
1070 let Inst{48-52} = XB{4-0};
1071 let Inst{53-60} = xo;
1072 let Inst{61} = XA{5};
1073 let Inst{62} = XB{5};
1077 class MMIRR_XX3Form_XY4P8_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
1078 string asmstr, InstrItinClass itin,
1080 : PI<1, opcode, OOL, IOL, asmstr, itin> {
1088 let Pattern = pattern;
1093 let Inst{12-15} = 0;
1094 let Inst{16-23} = PMSK;
1095 let Inst{24-27} = XMSK;
1096 let Inst{28-31} = YMSK;
1099 let Inst{38-40} = AT;
1100 let Inst{41-42} = 0;
1101 let Inst{43-47} = XA{4-0};
1102 let Inst{48-52} = XB{4-0};
1103 let Inst{53-60} = xo;
1104 let Inst{61} = XA{5};
1105 let Inst{62} = XB{5};
1109 class MMIRR_XX3Form_XYP4_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
1110 string asmstr, InstrItinClass itin,
1112 : PI<1, opcode, OOL, IOL, asmstr, itin> {
1120 let Pattern = pattern;
1125 let Inst{12-15} = 0;
1126 let Inst{16-19} = PMSK;
1127 let Inst{20-23} = 0;
1128 let Inst{24-27} = XMSK;
1129 let Inst{28-31} = YMSK;
1132 let Inst{38-40} = AT;
1133 let Inst{41-42} = 0;
1134 let Inst{43-47} = XA{4-0};
1135 let Inst{48-52} = XB{4-0};
1136 let Inst{53-60} = xo;
1137 let Inst{61} = XA{5};
1138 let Inst{62} = XB{5};
1145 dag VecsToVecPair0 =
1146 (v256i1 (INSERT_SUBREG
1147 (INSERT_SUBREG (IMPLICIT_DEF), $vs0, sub_vsx1),
1149 dag VecsToVecPair1 =
1150 (v256i1 (INSERT_SUBREG
1151 (INSERT_SUBREG (IMPLICIT_DEF), $vs2, sub_vsx1),
1155 let Predicates = [PairedVectorMemops] in {
1156 def : Pat<(v256i1 (PPCPairBuild v4i32:$vs1, v4i32:$vs0)),
1157 Concats.VecsToVecPair0>;
1158 def : Pat<(v256i1 (int_ppc_vsx_assemble_pair v16i8:$vs1, v16i8:$vs0)),
1159 Concats.VecsToVecPair0>;
1160 def : Pat<(v4i32 (PPCPairExtractVsx vsrpevenrc:$v, 0)),
1161 (v4i32 (EXTRACT_SUBREG $v, sub_vsx0))>;
1162 def : Pat<(v4i32 (PPCPairExtractVsx vsrpevenrc:$v, 1)),
1163 (v4i32 (EXTRACT_SUBREG $v, sub_vsx1))>;
1165 let mayLoad = 1, mayStore = 0 in {
1166 def LXVP : DQForm_XTp5_RA17_MEM<6, 0, (outs vsrprc:$XTp),
1167 (ins (memrix16 $DQ, $RA):$addr), "lxvp $XTp, $addr",
1169 def LXVPX : XForm_XTp5_XAB5<31, 333, (outs vsrprc:$XTp), (ins (memrr $RA, $RB):$addr),
1170 "lxvpx $XTp, $addr", IIC_LdStLFD,
1174 let mayLoad = 0, mayStore = 1 in {
1175 def STXVP : DQForm_XTp5_RA17_MEM<6, 1, (outs), (ins vsrprc:$XTp,
1176 (memrix16 $DQ, $RA):$addr), "stxvp $XTp, $addr",
1178 def STXVPX : XForm_XTp5_XAB5<31, 461, (outs), (ins vsrprc:$XTp, (memrr $RA, $RB):$addr),
1179 "stxvpx $XTp, $addr", IIC_LdStLFD,
1183 let mayLoad = 1, mayStore = 0, Predicates = [PairedVectorMemops, PrefixInstrs, HasP10Vector] in {
1185 8LS_DForm_R_XTp5_SI34_MEM_p<58, (outs vsrprc:$XTp), (ins (memri34 $D, $RA):$addr),
1186 (ins (memri34_pcrel $D, $RA):$addr),
1187 (ins s34imm_pcrel:$D),
1188 "plxvp $XTp, $addr", "plxvp $XTp, $D",
1192 let mayLoad = 0, mayStore = 1, Predicates = [PairedVectorMemops, PrefixInstrs, HasP10Vector] in {
1194 8LS_DForm_R_XTp5_SI34_MEM_p<62, (outs), (ins vsrprc:$XTp, (memri34 $D, $RA):$addr),
1195 (ins vsrprc:$XTp, (memri34_pcrel $D, $RA):$addr),
1196 (ins vsrprc:$XTp, s34imm_pcrel:$D),
1197 "pstxvp $XTp, $addr", "pstxvp $XTp, $D", IIC_LdStLFD>;
1200 let Predicates = [PairedVectorMemops] in {
1201 // Intrinsics for Paired Vector Loads.
1202 def : Pat<(v256i1 (int_ppc_vsx_lxvp DQForm:$src)), (LXVP memrix16:$src)>;
1203 def : Pat<(v256i1 (int_ppc_vsx_lxvp XForm:$src)), (LXVPX XForm:$src)>;
1204 let Predicates = [PairedVectorMemops, PrefixInstrs, HasP10Vector] in {
1205 def : Pat<(v256i1 (int_ppc_vsx_lxvp PDForm:$src)), (PLXVP memri34:$src)>;
1207 // Intrinsics for Paired Vector Stores.
1208 def : Pat<(int_ppc_vsx_stxvp v256i1:$XSp, DQForm:$dst),
1209 (STXVP $XSp, memrix16:$dst)>;
1210 def : Pat<(int_ppc_vsx_stxvp v256i1:$XSp, XForm:$dst),
1211 (STXVPX $XSp, XForm:$dst)>;
1212 let Predicates = [PairedVectorMemops, PrefixInstrs, HasP10Vector] in {
1213 def : Pat<(int_ppc_vsx_stxvp v256i1:$XSp, PDForm:$dst),
1214 (PSTXVP $XSp, memri34:$dst)>;
1218 let Predicates = [IsISA3_1] in {
1219 def XSCMPEQQP : X_VT5_VA5_VB5<63, 68, "xscmpeqqp", []>;
1220 def XSCMPGEQP : X_VT5_VA5_VB5<63, 196, "xscmpgeqp", []>;
1221 def XSCMPGTQP : X_VT5_VA5_VB5<63, 228, "xscmpgtqp", []>;
1224 let Predicates = [PCRelativeMemops] in {
1226 def : Pat<(i32 (zextloadi1 (PPCmatpcreladdr PCRelForm:$ga))),
1228 def : Pat<(i32 (extloadi1 (PPCmatpcreladdr PCRelForm:$ga))),
1230 def : Pat<(i32 (zextloadi8 (PPCmatpcreladdr PCRelForm:$ga))),
1232 def : Pat<(i32 (extloadi8 (PPCmatpcreladdr PCRelForm:$ga))),
1234 def : Pat<(i32 (sextloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
1236 def : Pat<(i32 (zextloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
1238 def : Pat<(i32 (extloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
1240 def : Pat<(i32 (load (PPCmatpcreladdr PCRelForm:$ga))), (PLWZpc $ga, 0)>;
1243 def : Pat<(truncstorei8 i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1244 (PSTBpc $RS, $ga, 0)>;
1245 def : Pat<(truncstorei16 i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1246 (PSTHpc $RS, $ga, 0)>;
1247 def : Pat<(store i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1248 (PSTWpc $RS, $ga, 0)>;
1251 def : Pat<(i64 (zextloadi1 (PPCmatpcreladdr PCRelForm:$ga))),
1253 def : Pat<(i64 (extloadi1 (PPCmatpcreladdr PCRelForm:$ga))),
1255 def : Pat<(i64 (zextloadi8 (PPCmatpcreladdr PCRelForm:$ga))),
1257 def : Pat<(i64 (extloadi8 (PPCmatpcreladdr PCRelForm:$ga))),
1259 def : Pat<(i64 (sextloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
1261 def : Pat<(i64 (zextloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
1263 def : Pat<(i64 (extloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
1265 def : Pat<(i64 (zextloadi32 (PPCmatpcreladdr PCRelForm:$ga))),
1267 def : Pat<(i64 (sextloadi32 (PPCmatpcreladdr PCRelForm:$ga))),
1269 def : Pat<(i64 (extloadi32 (PPCmatpcreladdr PCRelForm:$ga))),
1271 def : Pat<(i64 (load (PPCmatpcreladdr PCRelForm:$ga))), (PLDpc $ga, 0)>;
1274 def : Pat<(truncstorei8 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1275 (PSTB8pc $RS, $ga, 0)>;
1276 def : Pat<(truncstorei16 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1277 (PSTH8pc $RS, $ga, 0)>;
1278 def : Pat<(truncstorei32 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1279 (PSTW8pc $RS, $ga, 0)>;
1280 def : Pat<(store i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1281 (PSTDpc $RS, $ga, 0)>;
1284 def : Pat<(i32 (atomic_load_8 (PPCmatpcreladdr PCRelForm:$ga))),
1286 def : Pat<(i32 (atomic_load_16 (PPCmatpcreladdr PCRelForm:$ga))),
1288 def : Pat<(i32 (atomic_load_32 (PPCmatpcreladdr PCRelForm:$ga))),
1290 def : Pat<(i64 (atomic_load_64 (PPCmatpcreladdr PCRelForm:$ga))),
1294 def : Pat<(atomic_store_8 i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1295 (PSTBpc $RS, $ga, 0)>;
1296 def : Pat<(atomic_store_16 i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1297 (PSTHpc $RS, $ga, 0)>;
1298 def : Pat<(atomic_store_32 i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1299 (PSTWpc $RS, $ga, 0)>;
1300 def : Pat<(atomic_store_8 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1301 (PSTB8pc $RS, $ga, 0)>;
1302 def : Pat<(atomic_store_16 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1303 (PSTH8pc $RS, $ga, 0)>;
1304 def : Pat<(atomic_store_32 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1305 (PSTW8pc $RS, $ga, 0)>;
1306 def : Pat<(atomic_store_64 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
1307 (PSTDpc $RS, $ga, 0)>;
1309 // If the PPCmatpcreladdr node is not caught by any other pattern it should be
1310 // caught here and turned into a paddi instruction to materialize the address.
1311 def : Pat<(PPCmatpcreladdr PCRelForm:$addr), (PADDI8pc 0, $addr)>;
1312 // PPCtlsdynamatpcreladdr node is used for TLS dynamic models to materialize
1313 // tls global address with paddi instruction.
1314 def : Pat<(PPCtlsdynamatpcreladdr PCRelForm:$addr), (PADDI8pc 0, $addr)>;
1315 // PPCtlslocalexecmataddr node is used for TLS local exec models to
1316 // materialize tls global address with paddi instruction.
1317 def : Pat<(PPCaddTls i64:$in, (PPCtlslocalexecmataddr tglobaltlsaddr:$addr)),
1318 (PADDI8 $in, $addr)>;
1321 let Predicates = [PCRelativeMemops, HasFPU] in {
1323 def : Pat<(f32 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLFSpc $addr, 0)>;
1326 def : Pat<(store f32:$FRS, (PPCmatpcreladdr PCRelForm:$ga)),
1327 (PSTFSpc $FRS, $ga, 0)>;
1330 def : Pat<(f64 (extloadf32 (PPCmatpcreladdr PCRelForm:$addr))),
1331 (COPY_TO_REGCLASS (PLFSpc $addr, 0), VSFRC)>;
1332 def : Pat<(f64 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLFDpc $addr, 0)>;
1335 def : Pat<(store f64:$FRS, (PPCmatpcreladdr PCRelForm:$ga)),
1336 (PSTFDpc $FRS, $ga, 0)>;
1338 def : Pat<(v4f32 (PPCldvsxlh (PPCmatpcreladdr PCRelForm:$addr))),
1339 (SUBREG_TO_REG (i64 1), (PLFDpc $addr, 0), sub_64)>;
1342 let Predicates = [PCRelativeMemops, HasP10Vector] in {
1344 def : Pat<(f128 (load (PPCmatpcreladdr PCRelForm:$addr))),
1345 (COPY_TO_REGCLASS (PLXVpc $addr, 0), VRRC)>;
1348 def : Pat<(store f128:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
1349 (PSTXVpc (COPY_TO_REGCLASS $XS, VSRC), $ga, 0)>;
1352 def : Pat<(v4i32 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLXVpc $addr, 0)>;
1355 def : Pat<(store v4i32:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
1356 (PSTXVpc $XS, $ga, 0)>;
1359 def : Pat<(v2i64 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLXVpc $addr, 0)>;
1362 def : Pat<(store v2i64:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
1363 (PSTXVpc $XS, $ga, 0)>;
1366 def : Pat<(v4f32 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLXVpc $addr, 0)>;
1369 def : Pat<(store v4f32:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
1370 (PSTXVpc $XS, $ga, 0)>;
1373 def : Pat<(v2f64 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLXVpc $addr, 0)>;
1376 def : Pat<(store v2f64:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
1377 (PSTXVpc $XS, $ga, 0)>;
1379 // Special Cases For PPCstore_scal_int_from_vsr
1380 def : Pat<(PPCstore_scal_int_from_vsr f64:$src, (PPCmatpcreladdr PCRelForm:$dst), 8),
1381 (PSTXSDpc $src, $dst, 0)>;
1382 def : Pat<(PPCstore_scal_int_from_vsr f128:$src, (PPCmatpcreladdr PCRelForm:$dst), 8),
1383 (PSTXSDpc (COPY_TO_REGCLASS $src, VFRC), $dst, 0)>;
1386 // XXSPLTIW/DP/32DX need extra flags to make sure the compiler does not attempt
1387 // to spill part of the instruction when the values are similar.
1388 let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1, Predicates = [PrefixInstrs] in {
1389 def XXSPLTIW : 8RR_DForm_IMM32_XT6<32, 3, (outs vsrc:$XT),
1390 (ins i32imm:$IMM32),
1391 "xxspltiw $XT, $IMM32", IIC_VecGeneral,
1393 def XXSPLTIDP : 8RR_DForm_IMM32_XT6<32, 2, (outs vsrc:$XT),
1394 (ins i32imm:$IMM32),
1395 "xxspltidp $XT, $IMM32", IIC_VecGeneral,
1397 (PPCxxspltidp i32:$IMM32))]>;
1399 8RR_DForm_IMM32_XT6_IX<32, 0, (outs vsrc:$XT),
1400 (ins vsrc:$XTi, u1imm:$IX, i32imm:$IMM32),
1401 "xxsplti32dx $XT, $IX, $IMM32", IIC_VecGeneral,
1403 (PPCxxsplti32dx v2i64:$XTi, i32:$IX,
1405 RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">;
1408 let Predicates = [IsISA3_1] in {
1409 def SETBC : XForm_XT5_BI5<31, 384, (outs gprc:$RST), (ins crbitrc:$BI),
1410 "setbc $RST, $BI", IIC_IntCompare,
1411 [(set i32:$RST, (PPCsetbc i1:$BI))]>,
1412 SExt32To64, ZExt32To64;
1413 def SETBCR : XForm_XT5_BI5<31, 416, (outs gprc:$RST), (ins crbitrc:$BI),
1414 "setbcr $RST, $BI", IIC_IntCompare,
1415 [(set i32:$RST, (PPCsetbcr i1:$BI))]>,
1416 SExt32To64, ZExt32To64;
1417 def SETNBC : XForm_XT5_BI5<31, 448, (outs gprc:$RST), (ins crbitrc:$BI),
1418 "setnbc $RST, $BI", IIC_IntCompare, []>,
1420 def SETNBCR : XForm_XT5_BI5<31, 480, (outs gprc:$RST), (ins crbitrc:$BI),
1421 "setnbcr $RST, $BI", IIC_IntCompare, []>,
1424 let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
1425 def SETBC8 : XForm_XT5_BI5<31, 384, (outs g8rc:$RST), (ins crbitrc:$BI),
1426 "setbc $RST, $BI", IIC_IntCompare, []>,
1427 SExt32To64, ZExt32To64;
1428 def SETBCR8 : XForm_XT5_BI5<31, 416, (outs g8rc:$RST), (ins crbitrc:$BI),
1429 "setbcr $RST, $BI", IIC_IntCompare, []>,
1430 SExt32To64, ZExt32To64;
1431 def SETNBC8 : XForm_XT5_BI5<31, 448, (outs g8rc:$RST), (ins crbitrc:$BI),
1432 "setnbc $RST, $BI", IIC_IntCompare, []>,
1434 def SETNBCR8 : XForm_XT5_BI5<31, 480, (outs g8rc:$RST), (ins crbitrc:$BI),
1435 "setnbcr $RST, $BI", IIC_IntCompare, []>,
1439 def VSLDBI : VNForm_VTAB5_SD3<22, 0, (outs vrrc:$VRT),
1440 (ins vrrc:$VRA, vrrc:$VRB, u3imm:$SD),
1441 "vsldbi $VRT, $VRA, $VRB, $SD",
1444 (int_ppc_altivec_vsldbi v16i8:$VRA,
1447 def VSRDBI : VNForm_VTAB5_SD3<22, 1, (outs vrrc:$VRT),
1448 (ins vrrc:$VRA, vrrc:$VRB, u3imm:$SD),
1449 "vsrdbi $VRT, $VRA, $VRB, $SD",
1452 (int_ppc_altivec_vsrdbi v16i8:$VRA,
1455 defm VSTRIBR : VXForm_VTB5_RCr<13, 1, (outs vrrc:$VT), (ins vrrc:$VB),
1456 "vstribr", "$VT, $VB", IIC_VecGeneral,
1458 (int_ppc_altivec_vstribr v16i8:$VB))]>;
1459 defm VSTRIBL : VXForm_VTB5_RCr<13, 0, (outs vrrc:$VT), (ins vrrc:$VB),
1460 "vstribl", "$VT, $VB", IIC_VecGeneral,
1462 (int_ppc_altivec_vstribl v16i8:$VB))]>;
1463 defm VSTRIHR : VXForm_VTB5_RCr<13, 3, (outs vrrc:$VT), (ins vrrc:$VB),
1464 "vstrihr", "$VT, $VB", IIC_VecGeneral,
1466 (int_ppc_altivec_vstrihr v8i16:$VB))]>;
1467 defm VSTRIHL : VXForm_VTB5_RCr<13, 2, (outs vrrc:$VT), (ins vrrc:$VB),
1468 "vstrihl", "$VT, $VB", IIC_VecGeneral,
1470 (int_ppc_altivec_vstrihl v8i16:$VB))]>;
1472 VXForm_1<207, (outs vrrc:$VD), (ins vrrc:$VDi, u4imm:$VA, gprc:$VB),
1473 "vinsw $VD, $VB, $VA", IIC_VecGeneral,
1475 (int_ppc_altivec_vinsw v4i32:$VDi, i32:$VB, timm:$VA))]>,
1476 RegConstraint<"$VDi = $VD">, NoEncode<"$VDi">;
1478 VXForm_1<463, (outs vrrc:$VD), (ins vrrc:$VDi, u4imm:$VA, g8rc:$VB),
1479 "vinsd $VD, $VB, $VA", IIC_VecGeneral,
1481 (int_ppc_altivec_vinsd v2i64:$VDi, i64:$VB, timm:$VA))]>,
1482 RegConstraint<"$VDi = $VD">, NoEncode<"$VDi">;
1484 VXForm_VTB5_RA5_ins<15, "vinsbvlx",
1486 (int_ppc_altivec_vinsbvlx v16i8:$VDi, i32:$VA,
1489 VXForm_VTB5_RA5_ins<271, "vinsbvrx",
1491 (int_ppc_altivec_vinsbvrx v16i8:$VDi, i32:$VA,
1494 VXForm_VTB5_RA5_ins<79, "vinshvlx",
1496 (int_ppc_altivec_vinshvlx v8i16:$VDi, i32:$VA,
1499 VXForm_VTB5_RA5_ins<335, "vinshvrx",
1501 (int_ppc_altivec_vinshvrx v8i16:$VDi, i32:$VA,
1504 VXForm_VTB5_RA5_ins<143, "vinswvlx",
1506 (int_ppc_altivec_vinswvlx v4i32:$VDi, i32:$VA,
1509 VXForm_VTB5_RA5_ins<399, "vinswvrx",
1511 (int_ppc_altivec_vinswvrx v4i32:$VDi, i32:$VA,
1514 VXForm_VRT5_RAB5_ins<527, "vinsblx",
1516 (int_ppc_altivec_vinsblx v16i8:$VDi, i32:$VA,
1519 VXForm_VRT5_RAB5_ins<783, "vinsbrx",
1521 (int_ppc_altivec_vinsbrx v16i8:$VDi, i32:$VA,
1524 VXForm_VRT5_RAB5_ins<591, "vinshlx",
1526 (int_ppc_altivec_vinshlx v8i16:$VDi, i32:$VA,
1529 VXForm_VRT5_RAB5_ins<847, "vinshrx",
1531 (int_ppc_altivec_vinshrx v8i16:$VDi, i32:$VA,
1534 VXForm_VRT5_RAB5_ins<655, "vinswlx",
1536 (int_ppc_altivec_vinswlx v4i32:$VDi, i32:$VA,
1539 VXForm_VRT5_RAB5_ins<911, "vinswrx",
1541 (int_ppc_altivec_vinswrx v4i32:$VDi, i32:$VA,
1544 VXForm_1<719, (outs vrrc:$VD), (ins vrrc:$VDi, g8rc:$VA, g8rc:$VB),
1545 "vinsdlx $VD, $VA, $VB", IIC_VecGeneral,
1547 (int_ppc_altivec_vinsdlx v2i64:$VDi, i64:$VA, i64:$VB))]>,
1548 RegConstraint<"$VDi = $VD">, NoEncode<"$VDi">;
1550 VXForm_1<975, (outs vrrc:$VD), (ins vrrc:$VDi, g8rc:$VA, g8rc:$VB),
1551 "vinsdrx $VD, $VA, $VB", IIC_VecGeneral,
1553 (int_ppc_altivec_vinsdrx v2i64:$VDi, i64:$VA, i64:$VB))]>,
1554 RegConstraint<"$VDi = $VD">, NoEncode<"$VDi">;
1555 def VEXTRACTBM : VXForm_RD5_XO5_RS5<1602, 8, (outs gprc:$VD), (ins vrrc:$VB),
1556 "vextractbm $VD, $VB", IIC_VecGeneral,
1558 (int_ppc_altivec_vextractbm v16i8:$VB))]>,
1560 def VEXTRACTHM : VXForm_RD5_XO5_RS5<1602, 9, (outs gprc:$VD), (ins vrrc:$VB),
1561 "vextracthm $VD, $VB", IIC_VecGeneral,
1563 (int_ppc_altivec_vextracthm v8i16:$VB))]>,
1565 def VEXTRACTWM : VXForm_RD5_XO5_RS5<1602, 10, (outs gprc:$VD), (ins vrrc:$VB),
1566 "vextractwm $VD, $VB", IIC_VecGeneral,
1568 (int_ppc_altivec_vextractwm v4i32:$VB))]>,
1570 def VEXTRACTDM : VXForm_RD5_XO5_RS5<1602, 11, (outs gprc:$VD), (ins vrrc:$VB),
1571 "vextractdm $VD, $VB", IIC_VecGeneral,
1573 (int_ppc_altivec_vextractdm v2i64:$VB))]>,
1575 def VEXTRACTQM : VXForm_RD5_XO5_RS5<1602, 12, (outs gprc:$VD), (ins vrrc:$VB),
1576 "vextractqm $VD, $VB", IIC_VecGeneral,
1578 (int_ppc_altivec_vextractqm v1i128:$VB))]>;
1579 def VEXPANDBM : VXForm_RD5_XO5_RS5<1602, 0, (outs vrrc:$VD), (ins vrrc:$VB),
1580 "vexpandbm $VD, $VB", IIC_VecGeneral,
1581 [(set v16i8:$VD, (int_ppc_altivec_vexpandbm
1583 def VEXPANDHM : VXForm_RD5_XO5_RS5<1602, 1, (outs vrrc:$VD), (ins vrrc:$VB),
1584 "vexpandhm $VD, $VB", IIC_VecGeneral,
1585 [(set v8i16:$VD, (int_ppc_altivec_vexpandhm
1587 def VEXPANDWM : VXForm_RD5_XO5_RS5<1602, 2, (outs vrrc:$VD), (ins vrrc:$VB),
1588 "vexpandwm $VD, $VB", IIC_VecGeneral,
1589 [(set v4i32:$VD, (int_ppc_altivec_vexpandwm
1591 def VEXPANDDM : VXForm_RD5_XO5_RS5<1602, 3, (outs vrrc:$VD), (ins vrrc:$VB),
1592 "vexpanddm $VD, $VB", IIC_VecGeneral,
1593 [(set v2i64:$VD, (int_ppc_altivec_vexpanddm
1595 def VEXPANDQM : VXForm_RD5_XO5_RS5<1602, 4, (outs vrrc:$VD), (ins vrrc:$VB),
1596 "vexpandqm $VD, $VB", IIC_VecGeneral,
1597 [(set v1i128:$VD, (int_ppc_altivec_vexpandqm
1599 def MTVSRBM : VXForm_RD5_XO5_RS5<1602, 16, (outs vrrc:$VD), (ins g8rc:$VB),
1600 "mtvsrbm $VD, $VB", IIC_VecGeneral,
1602 (int_ppc_altivec_mtvsrbm i64:$VB))]>;
1603 def MTVSRHM : VXForm_RD5_XO5_RS5<1602, 17, (outs vrrc:$VD), (ins g8rc:$VB),
1604 "mtvsrhm $VD, $VB", IIC_VecGeneral,
1606 (int_ppc_altivec_mtvsrhm i64:$VB))]>;
1607 def MTVSRWM : VXForm_RD5_XO5_RS5<1602, 18, (outs vrrc:$VD), (ins g8rc:$VB),
1608 "mtvsrwm $VD, $VB", IIC_VecGeneral,
1610 (int_ppc_altivec_mtvsrwm i64:$VB))]>;
1611 def MTVSRDM : VXForm_RD5_XO5_RS5<1602, 19, (outs vrrc:$VD), (ins g8rc:$VB),
1612 "mtvsrdm $VD, $VB", IIC_VecGeneral,
1614 (int_ppc_altivec_mtvsrdm i64:$VB))]>;
1615 def MTVSRQM : VXForm_RD5_XO5_RS5<1602, 20, (outs vrrc:$VD), (ins g8rc:$VB),
1616 "mtvsrqm $VD, $VB", IIC_VecGeneral,
1618 (int_ppc_altivec_mtvsrqm i64:$VB))]>;
1619 def MTVSRBMI : DXForm<4, 10, (outs vrrc:$RT), (ins u16imm64:$D),
1620 "mtvsrbmi $RT, $D", IIC_VecGeneral,
1622 (int_ppc_altivec_mtvsrbm imm:$D))]>;
1623 def VCNTMBB : VXForm_RD5_MP_VB5<1602, 12, (outs g8rc:$RD),
1624 (ins vrrc:$VB, u1imm:$MP),
1625 "vcntmbb $RD, $VB, $MP", IIC_VecGeneral,
1626 [(set i64:$RD, (int_ppc_altivec_vcntmbb
1627 v16i8:$VB, timm:$MP))]>;
1628 def VCNTMBH : VXForm_RD5_MP_VB5<1602, 13, (outs g8rc:$RD),
1629 (ins vrrc:$VB, u1imm:$MP),
1630 "vcntmbh $RD, $VB, $MP", IIC_VecGeneral,
1631 [(set i64:$RD, (int_ppc_altivec_vcntmbh
1632 v8i16:$VB, timm:$MP))]>;
1633 def VCNTMBW : VXForm_RD5_MP_VB5<1602, 14, (outs g8rc:$RD),
1634 (ins vrrc:$VB, u1imm:$MP),
1635 "vcntmbw $RD, $VB, $MP", IIC_VecGeneral,
1636 [(set i64:$RD, (int_ppc_altivec_vcntmbw
1637 v4i32:$VB, timm:$MP))]>;
1638 def VCNTMBD : VXForm_RD5_MP_VB5<1602, 15, (outs g8rc:$RD),
1639 (ins vrrc:$VB, u1imm:$MP),
1640 "vcntmbd $RD, $VB, $MP", IIC_VecGeneral,
1641 [(set i64:$RD, (int_ppc_altivec_vcntmbd
1642 v2i64:$VB, timm:$MP))]>;
1643 def VEXTDUBVLX : VAForm_1a<24, (outs vrrc:$RT),
1644 (ins vrrc:$RA, vrrc:$RB, gprc:$RC),
1645 "vextdubvlx $RT, $RA, $RB, $RC",
1648 (int_ppc_altivec_vextdubvlx v16i8:$RA,
1651 def VEXTDUBVRX : VAForm_1a<25, (outs vrrc:$RT),
1652 (ins vrrc:$RA, vrrc:$RB, gprc:$RC),
1653 "vextdubvrx $RT, $RA, $RB, $RC",
1656 (int_ppc_altivec_vextdubvrx v16i8:$RA,
1659 def VEXTDUHVLX : VAForm_1a<26, (outs vrrc:$RT),
1660 (ins vrrc:$RA, vrrc:$RB, gprc:$RC),
1661 "vextduhvlx $RT, $RA, $RB, $RC",
1664 (int_ppc_altivec_vextduhvlx v8i16:$RA,
1667 def VEXTDUHVRX : VAForm_1a<27, (outs vrrc:$RT),
1668 (ins vrrc:$RA, vrrc:$RB, gprc:$RC),
1669 "vextduhvrx $RT, $RA, $RB, $RC",
1672 (int_ppc_altivec_vextduhvrx v8i16:$RA,
1675 def VEXTDUWVLX : VAForm_1a<28, (outs vrrc:$RT),
1676 (ins vrrc:$RA, vrrc:$RB, gprc:$RC),
1677 "vextduwvlx $RT, $RA, $RB, $RC",
1680 (int_ppc_altivec_vextduwvlx v4i32:$RA,
1683 def VEXTDUWVRX : VAForm_1a<29, (outs vrrc:$RT),
1684 (ins vrrc:$RA, vrrc:$RB, gprc:$RC),
1685 "vextduwvrx $RT, $RA, $RB, $RC",
1688 (int_ppc_altivec_vextduwvrx v4i32:$RA,
1691 def VEXTDDVLX : VAForm_1a<30, (outs vrrc:$RT),
1692 (ins vrrc:$RA, vrrc:$RB, gprc:$RC),
1693 "vextddvlx $RT, $RA, $RB, $RC",
1696 (int_ppc_altivec_vextddvlx v2i64:$RA,
1699 def VEXTDDVRX : VAForm_1a<31, (outs vrrc:$RT),
1700 (ins vrrc:$RA, vrrc:$RB, gprc:$RC),
1701 "vextddvrx $RT, $RA, $RB, $RC",
1704 (int_ppc_altivec_vextddvrx v2i64:$RA,
1707 def VPDEPD : VXForm_1<1485, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1708 "vpdepd $VD, $VA, $VB", IIC_VecGeneral,
1710 (int_ppc_altivec_vpdepd v2i64:$VA, v2i64:$VB))]>;
1711 def VPEXTD : VXForm_1<1421, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1712 "vpextd $VD, $VA, $VB", IIC_VecGeneral,
1714 (int_ppc_altivec_vpextd v2i64:$VA, v2i64:$VB))]>;
1715 def PDEPD : XForm_6<31, 156, (outs g8rc:$RA), (ins g8rc:$RST, g8rc:$RB),
1716 "pdepd $RA, $RST, $RB", IIC_IntGeneral,
1717 [(set i64:$RA, (int_ppc_pdepd i64:$RST, i64:$RB))]>;
1718 def PEXTD : XForm_6<31, 188, (outs g8rc:$RA), (ins g8rc:$RST, g8rc:$RB),
1719 "pextd $RA, $RST, $RB", IIC_IntGeneral,
1720 [(set i64:$RA, (int_ppc_pextd i64:$RST, i64:$RB))]>;
1721 def VCFUGED : VXForm_1<1357, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1722 "vcfuged $VD, $VA, $VB", IIC_VecGeneral,
1724 (int_ppc_altivec_vcfuged v2i64:$VA, v2i64:$VB))]>;
1725 def VGNB : VXForm_RD5_N3_VB5<1228, (outs g8rc:$RD), (ins vrrc:$VB, u3imm:$N),
1726 "vgnb $RD, $VB, $N", IIC_VecGeneral,
1728 (int_ppc_altivec_vgnb v1i128:$VB, timm:$N))]>;
1729 def CFUGED : XForm_6<31, 220, (outs g8rc:$RA), (ins g8rc:$RST, g8rc:$RB),
1730 "cfuged $RA, $RST, $RB", IIC_IntGeneral,
1731 [(set i64:$RA, (int_ppc_cfuged i64:$RST, i64:$RB))]>;
1733 8RR_XX4Form_IMM8_XTAB6<34, 1, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
1734 vsrc:$XC, u8imm:$IMM),
1735 "xxeval $XT, $XA, $XB, $XC, $IMM", IIC_VecGeneral,
1736 [(set v2i64:$XT, (int_ppc_vsx_xxeval v2i64:$XA,
1737 v2i64:$XB, v2i64:$XC, timm:$IMM))]>;
1738 def VCLZDM : VXForm_1<1924, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1739 "vclzdm $VD, $VA, $VB", IIC_VecGeneral,
1741 (int_ppc_altivec_vclzdm v2i64:$VA, v2i64:$VB))]>;
1742 def VCTZDM : VXForm_1<1988, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1743 "vctzdm $VD, $VA, $VB", IIC_VecGeneral,
1745 (int_ppc_altivec_vctzdm v2i64:$VA, v2i64:$VB))]>;
1746 def CNTLZDM : XForm_6<31, 59, (outs g8rc:$RA), (ins g8rc:$RST, g8rc:$RB),
1747 "cntlzdm $RA, $RST, $RB", IIC_IntGeneral,
1749 (int_ppc_cntlzdm i64:$RST, i64:$RB))]>;
1750 def CNTTZDM : XForm_6<31, 571, (outs g8rc:$RA), (ins g8rc:$RST, g8rc:$RB),
1751 "cnttzdm $RA, $RST, $RB", IIC_IntGeneral,
1753 (int_ppc_cnttzdm i64:$RST, i64:$RB))]>;
1755 XForm_XT6_IMM5_VB5<60, 916, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
1756 "xxgenpcvbm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
1758 XForm_XT6_IMM5_VB5<60, 917, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
1759 "xxgenpcvhm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
1761 XForm_XT6_IMM5_VB5<60, 948, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
1762 "xxgenpcvwm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
1764 XForm_XT6_IMM5_VB5<60, 949, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
1765 "xxgenpcvdm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
1766 def VCLRLB : VXForm_1<397, (outs vrrc:$VD), (ins vrrc:$VA, gprc:$VB),
1767 "vclrlb $VD, $VA, $VB", IIC_VecGeneral,
1769 (int_ppc_altivec_vclrlb v16i8:$VA, i32:$VB))]>;
1770 def VCLRRB : VXForm_1<461, (outs vrrc:$VD), (ins vrrc:$VA, gprc:$VB),
1771 "vclrrb $VD, $VA, $VB", IIC_VecGeneral,
1773 (int_ppc_altivec_vclrrb v16i8:$VA, i32:$VB))]>;
1774 def VMULLD : VXForm_1<457, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1775 "vmulld $VD, $VA, $VB", IIC_VecGeneral,
1776 [(set v2i64:$VD, (mul v2i64:$VA, v2i64:$VB))]>;
1777 def VMULHSW : VXForm_1<905, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1778 "vmulhsw $VD, $VA, $VB", IIC_VecGeneral,
1779 [(set v4i32:$VD, (mulhs v4i32:$VA, v4i32:$VB))]>;
1780 def VMULHUW : VXForm_1<649, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1781 "vmulhuw $VD, $VA, $VB", IIC_VecGeneral,
1782 [(set v4i32:$VD, (mulhu v4i32:$VA, v4i32:$VB))]>;
1783 def VMULHSD : VXForm_1<969, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1784 "vmulhsd $VD, $VA, $VB", IIC_VecGeneral,
1785 [(set v2i64:$VD, (mulhs v2i64:$VA, v2i64:$VB))]>;
1786 def VMULHUD : VXForm_1<713, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1787 "vmulhud $VD, $VA, $VB", IIC_VecGeneral,
1788 [(set v2i64:$VD, (mulhu v2i64:$VA, v2i64:$VB))]>;
1789 def VMODSW : VXForm_1<1931, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1790 "vmodsw $VD, $VA, $VB", IIC_VecGeneral,
1791 [(set v4i32:$VD, (srem v4i32:$VA, v4i32:$VB))]>;
1792 def VMODUW : VXForm_1<1675, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1793 "vmoduw $VD, $VA, $VB", IIC_VecGeneral,
1794 [(set v4i32:$VD, (urem v4i32:$VA, v4i32:$VB))]>;
1795 def VMODSD : VXForm_1<1995, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1796 "vmodsd $VD, $VA, $VB", IIC_VecGeneral,
1797 [(set v2i64:$VD, (srem v2i64:$VA, v2i64:$VB))]>;
1798 def VMODUD : VXForm_1<1739, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1799 "vmodud $VD, $VA, $VB", IIC_VecGeneral,
1800 [(set v2i64:$VD, (urem v2i64:$VA, v2i64:$VB))]>;
1801 def VDIVSW : VXForm_1<395, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1802 "vdivsw $VD, $VA, $VB", IIC_VecGeneral,
1803 [(set v4i32:$VD, (sdiv v4i32:$VA, v4i32:$VB))]>;
1804 def VDIVUW : VXForm_1<139, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1805 "vdivuw $VD, $VA, $VB", IIC_VecGeneral,
1806 [(set v4i32:$VD, (udiv v4i32:$VA, v4i32:$VB))]>;
1807 def VDIVSD : VXForm_1<459, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1808 "vdivsd $VD, $VA, $VB", IIC_VecGeneral,
1809 [(set v2i64:$VD, (sdiv v2i64:$VA, v2i64:$VB))]>;
1810 def VDIVUD : VXForm_1<203, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1811 "vdivud $VD, $VA, $VB", IIC_VecGeneral,
1812 [(set v2i64:$VD, (udiv v2i64:$VA, v2i64:$VB))]>;
1813 def VDIVESW : VXForm_1<907, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1814 "vdivesw $VD, $VA, $VB", IIC_VecGeneral,
1815 [(set v4i32:$VD, (int_ppc_altivec_vdivesw v4i32:$VA,
1817 def VDIVEUW : VXForm_1<651, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1818 "vdiveuw $VD, $VA, $VB", IIC_VecGeneral,
1819 [(set v4i32:$VD, (int_ppc_altivec_vdiveuw v4i32:$VA,
1821 def VDIVESD : VXForm_1<971, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1822 "vdivesd $VD, $VA, $VB", IIC_VecGeneral,
1823 [(set v2i64:$VD, (int_ppc_altivec_vdivesd v2i64:$VA,
1825 def VDIVEUD : VXForm_1<715, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1826 "vdiveud $VD, $VA, $VB", IIC_VecGeneral,
1827 [(set v2i64:$VD, (int_ppc_altivec_vdiveud v2i64:$VA,
1829 def XVTLSBB : XX2_BF3_XO5_XB6_XO9<60, 2, 475, (outs crrc:$BF), (ins vsrc:$XB),
1830 "xvtlsbb $BF, $XB", IIC_VecGeneral, []>;
1831 def BRH : XForm_11<31, 219, (outs gprc:$RA), (ins gprc:$RST),
1832 "brh $RA, $RST", IIC_IntRotate, []>;
1833 def BRW : XForm_11<31, 155, (outs gprc:$RA), (ins gprc:$RST),
1834 "brw $RA, $RST", IIC_IntRotate,
1835 [(set i32:$RA, (bswap i32:$RST))]>;
1836 let isCodeGenOnly = 1 in {
1837 def BRH8 : XForm_11<31, 219, (outs g8rc:$RA), (ins g8rc:$RST),
1838 "brh $RA, $RST", IIC_IntRotate, []>;
1839 def BRW8 : XForm_11<31, 155, (outs g8rc:$RA), (ins g8rc:$RST),
1840 "brw $RA, $RST", IIC_IntRotate, []>;
1842 def BRD : XForm_11<31, 187, (outs g8rc:$RA), (ins g8rc:$RST),
1843 "brd $RA, $RST", IIC_IntRotate,
1844 [(set i64:$RA, (bswap i64:$RST))]>;
1846 // The XFormMemOp flag for the following 8 instructions is set on
1847 // the instruction format.
1848 let mayLoad = 1, mayStore = 0 in {
1849 def LXVRBX : X_XT6_RA5_RB5<31, 13, "lxvrbx", vsrc, []>;
1850 def LXVRHX : X_XT6_RA5_RB5<31, 45, "lxvrhx", vsrc, []>;
1851 def LXVRWX : X_XT6_RA5_RB5<31, 77, "lxvrwx", vsrc, []>;
1852 def LXVRDX : X_XT6_RA5_RB5<31, 109, "lxvrdx", vsrc, []>;
1855 let mayLoad = 0, mayStore = 1 in {
1856 def STXVRBX : X_XS6_RA5_RB5<31, 141, "stxvrbx", vsrc, []>;
1857 def STXVRHX : X_XS6_RA5_RB5<31, 173, "stxvrhx", vsrc, []>;
1858 def STXVRWX : X_XS6_RA5_RB5<31, 205, "stxvrwx", vsrc, []>;
1859 def STXVRDX : X_XS6_RA5_RB5<31, 237, "stxvrdx", vsrc, []>;
1862 def VMULESD : VXForm_1<968, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1863 "vmulesd $VD, $VA, $VB", IIC_VecGeneral,
1864 [(set v1i128:$VD, (int_ppc_altivec_vmulesd v2i64:$VA,
1866 def VMULEUD : VXForm_1<712, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1867 "vmuleud $VD, $VA, $VB", IIC_VecGeneral,
1868 [(set v1i128:$VD, (int_ppc_altivec_vmuleud v2i64:$VA,
1870 def VMULOSD : VXForm_1<456, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1871 "vmulosd $VD, $VA, $VB", IIC_VecGeneral,
1872 [(set v1i128:$VD, (int_ppc_altivec_vmulosd v2i64:$VA,
1874 def VMULOUD : VXForm_1<200, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1875 "vmuloud $VD, $VA, $VB", IIC_VecGeneral,
1876 [(set v1i128:$VD, (int_ppc_altivec_vmuloud v2i64:$VA,
1878 def VMSUMCUD : VAForm_1a<23, (outs vrrc:$RT), (ins vrrc:$RA, vrrc:$RB, vrrc:$RC),
1879 "vmsumcud $RT, $RA, $RB, $RC", IIC_VecGeneral,
1880 [(set v1i128:$RT, (int_ppc_altivec_vmsumcud
1881 v2i64:$RA, v2i64:$RB, v1i128:$RC))]>;
1882 def VDIVSQ : VXForm_1<267, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1883 "vdivsq $VD, $VA, $VB", IIC_VecGeneral,
1884 [(set v1i128:$VD, (sdiv v1i128:$VA, v1i128:$VB))]>;
1885 def VDIVUQ : VXForm_1<11, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1886 "vdivuq $VD, $VA, $VB", IIC_VecGeneral,
1887 [(set v1i128:$VD, (udiv v1i128:$VA, v1i128:$VB))]>;
1888 def VDIVESQ : VXForm_1<779, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1889 "vdivesq $VD, $VA, $VB", IIC_VecGeneral,
1890 [(set v1i128:$VD, (int_ppc_altivec_vdivesq v1i128:$VA,
1892 def VDIVEUQ : VXForm_1<523, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1893 "vdiveuq $VD, $VA, $VB", IIC_VecGeneral,
1894 [(set v1i128:$VD, (int_ppc_altivec_vdiveuq v1i128:$VA,
1896 def VCMPEQUQ : VCMP <455, "vcmpequq $VD, $VA, $VB" , v1i128>;
1897 def VCMPGTSQ : VCMP <903, "vcmpgtsq $VD, $VA, $VB" , v1i128>;
1898 def VCMPGTUQ : VCMP <647, "vcmpgtuq $VD, $VA, $VB" , v1i128>;
1899 def VCMPEQUQ_rec : VCMP_rec <455, "vcmpequq. $VD, $VA, $VB" , v1i128>;
1900 def VCMPGTSQ_rec : VCMP_rec <903, "vcmpgtsq. $VD, $VA, $VB" , v1i128>;
1901 def VCMPGTUQ_rec : VCMP_rec <647, "vcmpgtuq. $VD, $VA, $VB" , v1i128>;
1902 def VMODSQ : VXForm_1<1803, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1903 "vmodsq $VD, $VA, $VB", IIC_VecGeneral,
1904 [(set v1i128:$VD, (srem v1i128:$VA, v1i128:$VB))]>;
1905 def VMODUQ : VXForm_1<1547, (outs vrrc:$VD), (ins vrrc:$VA, vrrc:$VB),
1906 "vmoduq $VD, $VA, $VB", IIC_VecGeneral,
1907 [(set v1i128:$VD, (urem v1i128:$VA, v1i128:$VB))]>;
1908 def VEXTSD2Q : VXForm_RD5_XO5_RS5<1538, 27, (outs vrrc:$VD), (ins vrrc:$VB),
1909 "vextsd2q $VD, $VB", IIC_VecGeneral,
1910 [(set v1i128:$VD, (int_ppc_altivec_vextsd2q v2i64:$VB))]>;
1911 def VCMPUQ : VXForm_BF3_VAB5<257, (outs crrc:$BF), (ins vrrc:$VA, vrrc:$VB),
1912 "vcmpuq $BF, $VA, $VB", IIC_VecGeneral, []>;
1913 def VCMPSQ : VXForm_BF3_VAB5<321, (outs crrc:$BF), (ins vrrc:$VA, vrrc:$VB),
1914 "vcmpsq $BF, $VA, $VB", IIC_VecGeneral, []>;
1915 def VRLQNM : VX1_VT5_VA5_VB5<325, "vrlqnm",
1917 (int_ppc_altivec_vrlqnm v1i128:$VA,
1919 def VRLQMI : VXForm_1<69, (outs vrrc:$VD),
1920 (ins vrrc:$VA, vrrc:$VB, vrrc:$VDi),
1921 "vrlqmi $VD, $VA, $VB", IIC_VecFP,
1923 (int_ppc_altivec_vrlqmi v1i128:$VA, v1i128:$VB,
1925 RegConstraint<"$VDi = $VD">, NoEncode<"$VDi">;
1926 def VSLQ : VX1_VT5_VA5_VB5<261, "vslq", []>;
1927 def VSRAQ : VX1_VT5_VA5_VB5<773, "vsraq", []>;
1928 def VSRQ : VX1_VT5_VA5_VB5<517, "vsrq", []>;
1929 def VRLQ : VX1_VT5_VA5_VB5<5, "vrlq", []>;
1930 def XSCVQPUQZ : X_VT5_XO5_VB5<63, 0, 836, "xscvqpuqz", []>;
1931 def XSCVQPSQZ : X_VT5_XO5_VB5<63, 8, 836, "xscvqpsqz", []>;
1932 def XSCVUQQP : X_VT5_XO5_VB5<63, 3, 836, "xscvuqqp", []>;
1933 def XSCVSQQP : X_VT5_XO5_VB5<63, 11, 836, "xscvsqqp", []>;
1934 def LXVKQ : XForm_XT6_IMM5<60, 31, 360, (outs vsrc:$XT), (ins u5imm:$UIM),
1935 "lxvkq $XT, $UIM", IIC_VecGeneral, []>;
1938 let Predicates = [IsISA3_1, HasVSX] in {
1939 def XVCVSPBF16 : XX2_XT6_XO5_XB6<60, 17, 475, "xvcvspbf16", vsrc, []>;
1940 def XVCVBF16SPN : XX2_XT6_XO5_XB6<60, 16, 475, "xvcvbf16spn", vsrc, []>;
1941 def XSMAXCQP : X_VT5_VA5_VB5<63, 676, "xsmaxcqp",
1942 [(set f128:$RST, (PPCxsmaxc f128:$RA, f128:$RB))]>;
1943 def XSMINCQP : X_VT5_VA5_VB5<63, 740, "xsmincqp",
1944 [(set f128:$RST, (PPCxsminc f128:$RA, f128:$RB))]>;
1947 let Predicates = [IsISA3_1] in {
1948 def WAITP10 : XForm_IMM2_IMM2<31, 30, (outs), (ins u2imm:$L, u2imm:$PL),
1949 "wait $L $PL", IIC_LdStLoad, []>;
1950 def SYNCP10 : XForm_IMM3_IMM2<31, 598, (outs), (ins u3imm:$L, u2imm:$SC),
1951 "sync $L, $SC", IIC_LdStSync, []>;
1954 // Multiclass defining patterns for Set Boolean Extension Reverse Instructions.
1955 // This is analogous to the CRNotPat multiclass but specifically for Power10
1956 // and newer subtargets since the extended forms use Set Boolean instructions.
1957 // The first two anonymous patterns defined are actually a duplicate of those
1958 // in CRNotPat, but it is preferable to define both multiclasses as complete
1959 // ones rather than pulling that small common section out.
1960 multiclass P10ReverseSetBool<dag pattern, dag result> {
1961 def : Pat<pattern, (crnot result)>;
1962 def : Pat<(not pattern), result>;
1964 def : Pat<(i32 (zext pattern)),
1966 def : Pat<(i64 (zext pattern)),
1969 def : Pat<(i32 (sext pattern)),
1971 def : Pat<(i64 (sext pattern)),
1974 def : Pat<(i32 (anyext pattern)),
1976 def : Pat<(i64 (anyext pattern)),
1980 multiclass IntSetP10RevSetBool<SDNode SetCC, ValueType Ty, PatLeaf ZExtTy,
1981 ImmLeaf SExtTy, I Cmpi, I Cmpli,
1983 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETUGE)),
1984 (EXTRACT_SUBREG (Cmpl $s1, $s2), sub_lt)>;
1985 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETGE)),
1986 (EXTRACT_SUBREG (Cmp $s1, $s2), sub_lt)>;
1987 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETULE)),
1988 (EXTRACT_SUBREG (Cmpl $s1, $s2), sub_gt)>;
1989 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETLE)),
1990 (EXTRACT_SUBREG (Cmp $s1, $s2), sub_gt)>;
1991 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETNE)),
1992 (EXTRACT_SUBREG (Cmp $s1, $s2), sub_eq)>;
1994 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, ZExtTy:$imm, SETUGE)),
1995 (EXTRACT_SUBREG (Cmpli $s1, imm:$imm), sub_lt)>;
1996 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, SExtTy:$imm, SETGE)),
1997 (EXTRACT_SUBREG (Cmpi $s1, imm:$imm), sub_lt)>;
1998 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, ZExtTy:$imm, SETULE)),
1999 (EXTRACT_SUBREG (Cmpli $s1, imm:$imm), sub_gt)>;
2000 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, SExtTy:$imm, SETLE)),
2001 (EXTRACT_SUBREG (Cmpi $s1, imm:$imm), sub_gt)>;
2002 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, SExtTy:$imm, SETNE)),
2003 (EXTRACT_SUBREG (Cmpi $s1, imm:$imm), sub_eq)>;
2004 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, ZExtTy:$imm, SETNE)),
2005 (EXTRACT_SUBREG (Cmpli $s1, imm:$imm), sub_eq)>;
2008 multiclass FSetP10RevSetBool<SDNode SetCC, ValueType Ty, I FCmp> {
2009 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETUGE)),
2010 (EXTRACT_SUBREG (FCmp $s1, $s2), sub_lt)>;
2011 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETGE)),
2012 (EXTRACT_SUBREG (FCmp $s1, $s2), sub_lt)>;
2013 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETULE)),
2014 (EXTRACT_SUBREG (FCmp $s1, $s2), sub_gt)>;
2015 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETLE)),
2016 (EXTRACT_SUBREG (FCmp $s1, $s2), sub_gt)>;
2017 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETUNE)),
2018 (EXTRACT_SUBREG (FCmp $s1, $s2), sub_eq)>;
2019 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETNE)),
2020 (EXTRACT_SUBREG (FCmp $s1, $s2), sub_eq)>;
2021 defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETO)),
2022 (EXTRACT_SUBREG (FCmp $s1, $s2), sub_un)>;
2025 let Predicates = [IsISA3_1] in {
2026 def : Pat<(i32 (zext i1:$in)),
2028 def : Pat<(i64 (zext i1:$in)),
2030 def : Pat<(i32 (sext i1:$in)),
2032 def : Pat<(i64 (sext i1:$in)),
2034 def : Pat<(i32 (anyext i1:$in)),
2036 def : Pat<(i64 (anyext i1:$in)),
2039 // Instantiation of the set boolean reverse patterns for 32-bit integers.
2040 defm : IntSetP10RevSetBool<setcc, i32, immZExt16, imm32SExt16,
2041 CMPWI, CMPLWI, CMPW, CMPLW>;
2042 defm : P10ReverseSetBool<(i1 (setcc i32:$s1, imm:$imm, SETNE)),
2043 (EXTRACT_SUBREG (CMPLWI (XORIS $s1, (HI16 imm:$imm)),
2044 (LO16 imm:$imm)), sub_eq)>;
2046 // Instantiation of the set boolean reverse patterns for 64-bit integers.
2047 defm : IntSetP10RevSetBool<setcc, i64, immZExt16, imm64SExt16,
2048 CMPDI, CMPLDI, CMPD, CMPLD>;
2049 defm : P10ReverseSetBool<(i1 (setcc i64:$s1, imm64ZExt32:$imm, SETNE)),
2050 (EXTRACT_SUBREG (CMPLDI (XORIS8 $s1, (HI16 imm:$imm)),
2051 (LO16 imm:$imm)), sub_eq)>;
2054 // Instantiation of the set boolean reverse patterns for f32, f64, f128.
2055 let Predicates = [IsISA3_1, HasFPU] in {
2056 defm : FSetP10RevSetBool<setcc, f32, FCMPUS>;
2057 defm : FSetP10RevSetBool<setcc, f64, FCMPUD>;
2058 defm : FSetP10RevSetBool<setcc, f128, XSCMPUQP>;
2061 //---------------------------- Anonymous Patterns ----------------------------//
2062 let Predicates = [IsISA3_1] in {
2063 // Exploit the vector multiply high instructions using intrinsics.
2064 def : Pat<(v4i32 (int_ppc_altivec_vmulhsw v4i32:$vA, v4i32:$vB)),
2065 (v4i32 (VMULHSW $vA, $vB))>;
2066 def : Pat<(v4i32 (int_ppc_altivec_vmulhuw v4i32:$vA, v4i32:$vB)),
2067 (v4i32 (VMULHUW $vA, $vB))>;
2068 def : Pat<(v2i64 (int_ppc_altivec_vmulhsd v2i64:$vA, v2i64:$vB)),
2069 (v2i64 (VMULHSD $vA, $vB))>;
2070 def : Pat<(v2i64 (int_ppc_altivec_vmulhud v2i64:$vA, v2i64:$vB)),
2071 (v2i64 (VMULHUD $vA, $vB))>;
2072 def : Pat<(v16i8 (int_ppc_vsx_xxgenpcvbm v16i8:$VRB, imm:$IMM)),
2073 (v16i8 (COPY_TO_REGCLASS (XXGENPCVBM $VRB, imm:$IMM), VRRC))>;
2074 def : Pat<(v8i16 (int_ppc_vsx_xxgenpcvhm v8i16:$VRB, imm:$IMM)),
2075 (v8i16 (COPY_TO_REGCLASS (XXGENPCVHM $VRB, imm:$IMM), VRRC))>;
2076 def : Pat<(v4i32 (int_ppc_vsx_xxgenpcvwm v4i32:$VRB, imm:$IMM)),
2077 (v4i32 (COPY_TO_REGCLASS (XXGENPCVWM $VRB, imm:$IMM), VRRC))>;
2078 def : Pat<(v2i64 (int_ppc_vsx_xxgenpcvdm v2i64:$VRB, imm:$IMM)),
2079 (v2i64 (COPY_TO_REGCLASS (XXGENPCVDM $VRB, imm:$IMM), VRRC))>;
2080 def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, 1)),
2081 (EXTRACT_SUBREG (XVTLSBB (COPY_TO_REGCLASS $XB, VSRC)), sub_lt)>;
2082 def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, 0)),
2083 (EXTRACT_SUBREG (XVTLSBB (COPY_TO_REGCLASS $XB, VSRC)), sub_eq)>;
2084 def : Pat<(srl (bswap i32:$RS), (i32 16)),
2085 (RLDICL_32 (BRH $RS), 0, 48)>;
2086 def : Pat<(i64 (zext (i32 (srl (bswap i32:$RS), (i32 16))))),
2087 (RLDICL_32_64 (BRH $RS), 0, 48)>;
2088 def : Pat <(v1i128 (PPClxvrzx ForceXForm:$src, 8)),
2089 (v1i128 (COPY_TO_REGCLASS (LXVRBX ForceXForm:$src), VRRC))>;
2090 def : Pat <(v1i128 (PPClxvrzx ForceXForm:$src, 16)),
2091 (v1i128 (COPY_TO_REGCLASS (LXVRHX ForceXForm:$src), VRRC))>;
2092 def : Pat <(v1i128 (PPClxvrzx ForceXForm:$src, 32)),
2093 (v1i128 (COPY_TO_REGCLASS (LXVRWX ForceXForm:$src), VRRC))>;
2094 def : Pat <(v1i128 (PPClxvrzx ForceXForm:$src, 64)),
2095 (v1i128 (COPY_TO_REGCLASS (LXVRDX ForceXForm:$src), VRRC))>;
2097 def : Pat<(v1i128 (rotl v1i128:$vA, v1i128:$vB)),
2098 (v1i128 (VRLQ v1i128:$vA, v1i128:$vB))>;
2100 def : Pat <(v2i64 (PPCxxsplti32dx v2i64:$XT, i32:$XI, i32:$IMM32)),
2101 (v2i64 (XXSPLTI32DX v2i64:$XT, i32:$XI, i32:$IMM32))>;
2104 let Predicates = [IsISA3_1, HasVSX] in {
2105 def : Pat<(v16i8 (int_ppc_vsx_xvcvspbf16 v16i8:$XA)),
2106 (COPY_TO_REGCLASS (XVCVSPBF16 RCCp.AToVSRC), VRRC)>;
2107 def : Pat<(v16i8 (int_ppc_vsx_xvcvbf16spn v16i8:$XA)),
2108 (COPY_TO_REGCLASS (XVCVBF16SPN RCCp.AToVSRC), VRRC)>;
2111 let AddedComplexity = 400, Predicates = [IsISA3_1, IsLittleEndian] in {
2112 // Store element 0 of a VSX register to memory
2113 def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$src, 0)), ForceXForm:$dst),
2114 (STXVRBX (COPY_TO_REGCLASS v16i8:$src, VSRC), ForceXForm:$dst)>;
2115 def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$src, 0)), ForceXForm:$dst),
2116 (STXVRHX (COPY_TO_REGCLASS v8i16:$src, VSRC), ForceXForm:$dst)>;
2117 def : Pat<(store (i32 (extractelt v4i32:$src, 0)), ForceXForm:$dst),
2118 (STXVRWX $src, ForceXForm:$dst)>;
2119 def : Pat<(store (f32 (extractelt v4f32:$src, 0)), ForceXForm:$dst),
2120 (STXVRWX $src, ForceXForm:$dst)>;
2121 def : Pat<(store (i64 (extractelt v2i64:$src, 0)), ForceXForm:$dst),
2122 (STXVRDX $src, ForceXForm:$dst)>;
2123 def : Pat<(store (f64 (extractelt v2f64:$src, 0)), ForceXForm:$dst),
2124 (STXVRDX $src, ForceXForm:$dst)>;
2125 // Load element 0 of a VSX register to memory
2126 def : Pat<(v8i16 (scalar_to_vector (i32 (extloadi16 ForceXForm:$src)))),
2127 (v8i16 (COPY_TO_REGCLASS (LXVRHX ForceXForm:$src), VSRC))>;
2128 def : Pat<(v16i8 (scalar_to_vector (i32 (extloadi8 ForceXForm:$src)))),
2129 (v16i8 (COPY_TO_REGCLASS (LXVRBX ForceXForm:$src), VSRC))>;
2130 def : Pat<(store (i64 (extractelt v2i64:$A, 1)), ForceXForm:$src),
2131 (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>;
2134 let Predicates = [IsISA3_1, IsBigEndian] in {
2135 def : Pat<(store (i64 (extractelt v2i64:$A, 0)), ForceXForm:$src),
2136 (XFSTOREf64 (EXTRACT_SUBREG $A, sub_64), ForceXForm:$src)>;
2139 // FIXME: The swap is overkill when the shift amount is a constant.
2140 // We should just fix the constant in the DAG.
2141 let AddedComplexity = 400, Predicates = [IsISA3_1, HasVSX] in {
2142 def : Pat<(v1i128 (shl v1i128:$VRA, v1i128:$VRB)),
2143 (v1i128 (VSLQ v1i128:$VRA,
2144 (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
2145 (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
2146 def : Pat<(v1i128 (PPCshl v1i128:$VRA, v1i128:$VRB)),
2147 (v1i128 (VSLQ v1i128:$VRA,
2148 (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
2149 (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
2150 def : Pat<(v1i128 (srl v1i128:$VRA, v1i128:$VRB)),
2151 (v1i128 (VSRQ v1i128:$VRA,
2152 (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
2153 (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
2154 def : Pat<(v1i128 (PPCsrl v1i128:$VRA, v1i128:$VRB)),
2155 (v1i128 (VSRQ v1i128:$VRA,
2156 (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
2157 (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
2158 def : Pat<(v1i128 (sra v1i128:$VRA, v1i128:$VRB)),
2159 (v1i128 (VSRAQ v1i128:$VRA,
2160 (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
2161 (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
2162 def : Pat<(v1i128 (PPCsra v1i128:$VRA, v1i128:$VRB)),
2163 (v1i128 (VSRAQ v1i128:$VRA,
2164 (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
2165 (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
2168 class xxevalPattern <dag pattern, bits<8> imm> :
2169 Pat<(v4i32 pattern), (XXEVAL $vA, $vB, $vC, imm)> {}
2171 let Predicates = [PrefixInstrs, HasP10Vector] in {
2172 let AddedComplexity = 400 in {
2173 def : Pat<(v4i32 (build_vector i32immNonAllOneNonZero:$A,
2174 i32immNonAllOneNonZero:$A,
2175 i32immNonAllOneNonZero:$A,
2176 i32immNonAllOneNonZero:$A)),
2177 (v4i32 (XXSPLTIW imm:$A))>;
2178 def : Pat<(f32 nzFPImmAsi32:$A),
2179 (COPY_TO_REGCLASS (XXSPLTIDP (getFPAs32BitInt fpimm:$A)),
2181 def : Pat<(f64 nzFPImmAsi32:$A),
2182 (COPY_TO_REGCLASS (XXSPLTIDP (getFPAs32BitInt fpimm:$A)),
2185 // To replace constant pool with XXSPLTI32DX for scalars.
2186 def : Pat<(f32 nzFPImmAsi64:$A),
2187 (COPY_TO_REGCLASS (XXSPLTI32DX (XXSPLTI32DX(IMPLICIT_DEF), 0,
2188 (getFPAs64BitIntHi $A)),
2189 1, (getFPAs64BitIntLo $A)),
2192 def : Pat<(f64 nzFPImmAsi64:$A),
2193 (COPY_TO_REGCLASS (XXSPLTI32DX (XXSPLTI32DX (IMPLICIT_DEF), 0,
2194 (getFPAs64BitIntHi $A)),
2195 1, (getFPAs64BitIntLo $A)),
2198 // Anonymous patterns for XXEVAL
2201 def : xxevalPattern<(and v4i32:$vA, (and v4i32:$vB, v4i32:$vC)), 1>;
2202 // and(A, xor(B, C))
2203 def : xxevalPattern<(and v4i32:$vA, (xor v4i32:$vB, v4i32:$vC)), 6>;
2205 def : xxevalPattern<(and v4i32:$vA, (or v4i32:$vB, v4i32:$vC)), 7>;
2206 // and(A, nor(B, C))
2207 def : xxevalPattern<(and v4i32:$vA, (vnot (or v4i32:$vB, v4i32:$vC))), 8>;
2208 // and(A, eqv(B, C))
2209 def : xxevalPattern<(and v4i32:$vA, (vnot (xor v4i32:$vB, v4i32:$vC))), 9>;
2210 // and(A, nand(B, C))
2211 def : xxevalPattern<(and v4i32:$vA, (vnot (and v4i32:$vB, v4i32:$vC))), 14>;
2215 def : xxevalPattern<(vnot (and v4i32:$vA, (and v4i32:$vB, v4i32:$vC))),
2217 // nand(A, xor(B, C))
2218 def : xxevalPattern<(vnot (and v4i32:$vA, (xor v4i32:$vB, v4i32:$vC))),
2220 // nand(A, or(B, C))
2221 def : xxevalPattern<(vnot (and v4i32:$vA, (or v4i32:$vB, v4i32:$vC))),
2223 // nand(A, nor(B, C))
2224 def : xxevalPattern<(or (vnot v4i32:$vA), (or v4i32:$vB, v4i32:$vC)),
2226 // nand(A, eqv(B, C))
2227 def : xxevalPattern<(or (vnot v4i32:$vA), (xor v4i32:$vB, v4i32:$vC)),
2229 // nand(A, nand(B, C))
2230 def : xxevalPattern<(or (vnot v4i32:$vA), (and v4i32:$vB, v4i32:$vC)),
2235 def : xxevalPattern<(or (and v4i32:$vA, (and v4i32:$vB, v4i32:$vC)),
2236 (vnot (or v4i32:$vA, (or v4i32:$vB, v4i32:$vC)))),
2238 // (eqv A, (and B, C))
2239 def : xxevalPattern<(vnot (xor v4i32:$vA, (and v4i32:$vB, v4i32:$vC))), 225>;
2240 // (eqv A, (or B, C))
2241 def : xxevalPattern<(vnot (xor v4i32:$vA, (or v4i32:$vB, v4i32:$vC))), 135>;
2245 def : xxevalPattern<(vnot (or v4i32:$vA, (or v4i32:$vB, v4i32:$vC))), 128>;
2246 // (nor A, (and B, C))
2247 def : xxevalPattern<(vnot (or v4i32:$vA, (and v4i32:$vB, v4i32:$vC))), 224>;
2248 // (nor A, (eqv B, C))
2249 def : xxevalPattern<(and (vnot v4i32:$vA), (xor v4i32:$vB, v4i32:$vC)), 96>;
2250 // (nor A, (nand B, C))
2251 def : xxevalPattern<(and (vnot v4i32:$vA), (and v4i32:$vB, v4i32:$vC)), 16>;
2252 // (nor A, (nor B, C))
2253 def : xxevalPattern<(and (vnot v4i32:$vA), (or v4i32:$vB, v4i32:$vC)), 112>;
2254 // (nor A, (xor B, C))
2255 def : xxevalPattern<(vnot (or v4i32:$vA, (xor v4i32:$vB, v4i32:$vC))), 144>;
2259 def : xxevalPattern<(or v4i32:$vA, (or v4i32:$vB, v4i32:$vC)), 127>;
2260 // (or A, (and B, C))
2261 def : xxevalPattern<(or v4i32:$vA, (and v4i32:$vB, v4i32:$vC)), 31>;
2262 // (or A, (eqv B, C))
2263 def : xxevalPattern<(or v4i32:$vA, (vnot (xor v4i32:$vB, v4i32:$vC))), 159>;
2264 // (or A, (nand B, C))
2265 def : xxevalPattern<(or v4i32:$vA, (vnot (and v4i32:$vB, v4i32:$vC))), 239>;
2266 // (or A, (nor B, C))
2267 def : xxevalPattern<(or v4i32:$vA, (vnot (or v4i32:$vB, v4i32:$vC))), 143>;
2268 // (or A, (xor B, C))
2269 def : xxevalPattern<(or v4i32:$vA, (xor v4i32:$vB, v4i32:$vC)), 111>;
2273 def : xxevalPattern<(xor v4i32:$vA, (xor v4i32:$vB, v4i32:$vC)), 105>;
2274 // (xor A, (and B, C))
2275 def : xxevalPattern<(xor v4i32:$vA, (and v4i32:$vB, v4i32:$vC)), 30>;
2276 // (xor A, (or B, C))
2277 def : xxevalPattern<(xor v4i32:$vA, (or v4i32:$vB, v4i32:$vC)), 120>;
2279 // Anonymous patterns to select prefixed VSX loads and stores.
2280 // Load / Store f128
2281 def : Pat<(f128 (load PDForm:$src)),
2282 (COPY_TO_REGCLASS (PLXV memri34:$src), VRRC)>;
2283 def : Pat<(store f128:$XS, PDForm:$dst),
2284 (PSTXV (COPY_TO_REGCLASS $XS, VSRC), memri34:$dst)>;
2286 // Load / Store v4i32
2287 def : Pat<(v4i32 (load PDForm:$src)), (PLXV memri34:$src)>;
2288 def : Pat<(store v4i32:$XS, PDForm:$dst), (PSTXV $XS, memri34:$dst)>;
2290 // Load / Store v2i64
2291 def : Pat<(v2i64 (load PDForm:$src)), (PLXV memri34:$src)>;
2292 def : Pat<(store v2i64:$XS, PDForm:$dst), (PSTXV $XS, memri34:$dst)>;
2294 // Load / Store v4f32
2295 def : Pat<(v4f32 (load PDForm:$src)), (PLXV memri34:$src)>;
2296 def : Pat<(store v4f32:$XS, PDForm:$dst), (PSTXV $XS, memri34:$dst)>;
2298 // Load / Store v2f64
2299 def : Pat<(v2f64 (load PDForm:$src)), (PLXV memri34:$src)>;
2300 def : Pat<(store v2f64:$XS, PDForm:$dst), (PSTXV $XS, memri34:$dst)>;
2302 // Cases For PPCstore_scal_int_from_vsr
2303 def : Pat<(PPCstore_scal_int_from_vsr f64:$src, PDForm:$dst, 8),
2304 (PSTXSD $src, PDForm:$dst)>;
2305 def : Pat<(PPCstore_scal_int_from_vsr f128:$src, PDForm:$dst, 8),
2306 (PSTXSD (COPY_TO_REGCLASS $src, VFRC), PDForm:$dst)>;
2310 def : Pat<(i32 imm34:$imm), (PLI (getImmAs64BitInt imm:$imm))>;
2311 def : Pat<(i64 imm34:$imm), (PLI8 (getImmAs64BitInt imm:$imm))>;
2312 def : Pat<(v16i8 (int_ppc_vsx_xxpermx v16i8:$A, v16i8:$B, v16i8:$C, timm:$D)),
2313 (COPY_TO_REGCLASS (XXPERMX (COPY_TO_REGCLASS $A, VSRC),
2314 (COPY_TO_REGCLASS $B, VSRC),
2315 (COPY_TO_REGCLASS $C, VSRC), $D), VSRC)>;
2316 def : Pat<(v16i8 (int_ppc_vsx_xxblendvb v16i8:$A, v16i8:$B, v16i8:$C)),
2318 (XXBLENDVB (COPY_TO_REGCLASS $A, VSRC),
2319 (COPY_TO_REGCLASS $B, VSRC),
2320 (COPY_TO_REGCLASS $C, VSRC)), VSRC)>;
2321 def : Pat<(v8i16 (int_ppc_vsx_xxblendvh v8i16:$A, v8i16:$B, v8i16:$C)),
2323 (XXBLENDVH (COPY_TO_REGCLASS $A, VSRC),
2324 (COPY_TO_REGCLASS $B, VSRC),
2325 (COPY_TO_REGCLASS $C, VSRC)), VSRC)>;
2326 def : Pat<(int_ppc_vsx_xxblendvw v4i32:$A, v4i32:$B, v4i32:$C),
2327 (XXBLENDVW $A, $B, $C)>;
2328 def : Pat<(int_ppc_vsx_xxblendvd v2i64:$A, v2i64:$B, v2i64:$C),
2329 (XXBLENDVD $A, $B, $C)>;
2332 let Predicates = [PrefixInstrs] in {
2333 // Anonymous patterns to select prefixed loads and stores.
2335 def : Pat<(i32 (extloadi1 PDForm:$src)), (PLBZ memri34:$src)>;
2336 def : Pat<(i32 (zextloadi1 PDForm:$src)), (PLBZ memri34:$src)>;
2337 def : Pat<(i32 (extloadi8 PDForm:$src)), (PLBZ memri34:$src)>;
2338 def : Pat<(i32 (zextloadi8 PDForm:$src)), (PLBZ memri34:$src)>;
2339 def : Pat<(i32 (extloadi16 PDForm:$src)), (PLHZ memri34:$src)>;
2340 def : Pat<(i32 (zextloadi16 PDForm:$src)), (PLHZ memri34:$src)>;
2341 def : Pat<(i32 (sextloadi16 PDForm:$src)), (PLHA memri34:$src)>;
2342 def : Pat<(i32 (load PDForm:$src)), (PLWZ memri34:$src)>;
2345 def : Pat<(truncstorei8 i32:$rS, PDForm:$dst), (PSTB gprc:$rS, memri34:$dst)>;
2346 def : Pat<(truncstorei16 i32:$rS, PDForm:$dst), (PSTH gprc:$rS, memri34:$dst)>;
2347 def : Pat<(store i32:$rS, PDForm:$dst), (PSTW gprc:$rS, memri34:$dst)>;
2350 def : Pat<(i64 (extloadi1 PDForm:$src)), (PLBZ8 memri34:$src)>;
2351 def : Pat<(i64 (zextloadi1 PDForm:$src)), (PLBZ8 memri34:$src)>;
2352 def : Pat<(i64 (extloadi8 PDForm:$src)), (PLBZ8 memri34:$src)>;
2353 def : Pat<(i64 (zextloadi8 PDForm:$src)), (PLBZ8 memri34:$src)>;
2354 def : Pat<(i64 (extloadi16 PDForm:$src)), (PLHZ8 memri34:$src)>;
2355 def : Pat<(i64 (zextloadi16 PDForm:$src)), (PLHZ8 memri34:$src)>;
2356 def : Pat<(i64 (sextloadi16 PDForm:$src)), (PLHA8 memri34:$src)>;
2357 def : Pat<(i64 (extloadi32 PDForm:$src)), (PLWZ8 memri34:$src)>;
2358 def : Pat<(i64 (zextloadi32 PDForm:$src)), (PLWZ8 memri34:$src)>;
2359 def : Pat<(i64 (sextloadi32 PDForm:$src)), (PLWA8 memri34:$src)>;
2360 def : Pat<(i64 (load PDForm:$src)), (PLD memri34:$src)>;
2363 def : Pat<(truncstorei8 i64:$rS, PDForm:$dst), (PSTB8 g8rc:$rS, memri34:$dst)>;
2364 def : Pat<(truncstorei16 i64:$rS, PDForm:$dst), (PSTH8 g8rc:$rS, memri34:$dst)>;
2365 def : Pat<(truncstorei32 i64:$rS, PDForm:$dst), (PSTW8 g8rc:$rS, memri34:$dst)>;
2366 def : Pat<(store i64:$rS, PDForm:$dst), (PSTD g8rc:$rS, memri34:$dst)>;
2369 def : Pat<(i32 (atomic_load_8 PDForm:$src)), (PLBZ memri34:$src)>;
2370 def : Pat<(i32 (atomic_load_16 PDForm:$src)), (PLHZ memri34:$src)>;
2371 def : Pat<(i32 (atomic_load_32 PDForm:$src)), (PLWZ memri34:$src)>;
2372 def : Pat<(i64 (atomic_load_64 PDForm:$src)), (PLD memri34:$src)>;
2375 def : Pat<(atomic_store_8 i32:$RS, PDForm:$dst), (PSTB $RS, memri34:$dst)>;
2376 def : Pat<(atomic_store_16 i32:$RS, PDForm:$dst), (PSTH $RS, memri34:$dst)>;
2377 def : Pat<(atomic_store_32 i32:$RS, PDForm:$dst), (PSTW $RS, memri34:$dst)>;
2378 def : Pat<(atomic_store_64 i64:$RS, PDForm:$dst), (PSTD $RS, memri34:$dst)>;
2381 let Predicates = [PrefixInstrs, HasFPU] in {
2383 def : Pat<(f32 (load PDForm:$src)), (PLFS memri34:$src)>;
2384 def : Pat<(store f32:$FRS, PDForm:$dst), (PSTFS $FRS, memri34:$dst)>;
2387 def : Pat<(f64 (extloadf32 PDForm:$src)),
2388 (COPY_TO_REGCLASS (PLFS memri34:$src), VSFRC)>;
2389 def : Pat<(f64 (load PDForm:$src)), (PLFD memri34:$src)>;
2390 def : Pat<(store f64:$FRS, PDForm:$dst), (PSTFD $FRS, memri34:$dst)>;
2391 // Prefixed fpext to v2f64
2392 def : Pat<(v4f32 (PPCldvsxlh PDForm:$src)),
2393 (SUBREG_TO_REG (i64 1), (PLFD PDForm:$src), sub_64)>;
2397 def InsertEltShift {
2398 dag Sub32 = (i32 (EXTRACT_SUBREG $rB, sub_32));
2399 dag Sub32Left1 = (RLWINM (EXTRACT_SUBREG $rB, sub_32), 1, 0, 30);
2400 dag Sub32Left2 = (RLWINM (EXTRACT_SUBREG $rB, sub_32), 2, 0, 29);
2401 dag Left1 = (RLWINM $rB, 1, 0, 30);
2402 dag Left2 = (RLWINM $rB, 2, 0, 29);
2403 dag Left3 = (RLWINM8 $rB, 3, 0, 28);
2406 let Predicates = [IsISA3_1, HasVSX, IsLittleEndian] in {
2407 // Indexed vector insert element
2408 def : Pat<(v16i8 (vector_insert v16i8:$vDi, i32:$rA, i64:$rB)),
2409 (VINSBRX $vDi, InsertEltShift.Sub32, $rA)>;
2410 def : Pat<(v8i16 (vector_insert v8i16:$vDi, i32:$rA, i64:$rB)),
2411 (VINSHRX $vDi, InsertEltShift.Sub32Left1, $rA)>;
2412 def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, i64:$rB)),
2413 (VINSWRX $vDi, InsertEltShift.Sub32Left2, $rA)>;
2414 def : Pat<(v2i64 (insertelt v2i64:$vDi, i64:$rA, i64:$rB)),
2415 (VINSDRX $vDi, InsertEltShift.Left3, $rA)>;
2417 def : Pat<(v4f32 (insertelt v4f32:$vDi, f32:$rA, i64:$rB)),
2418 (VINSWVRX $vDi, InsertEltShift.Sub32Left2, (XSCVDPSPN $rA))>;
2420 def : Pat<(v2f64 (insertelt v2f64:$vDi, f64:$A, i64:$rB)),
2421 (VINSDRX $vDi, InsertEltShift.Left3, Bitcast.DblToLong)>;
2422 def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load DSForm:$rA)), i64:$rB)),
2423 (VINSDRX $vDi, InsertEltShift.Left3, (LD memrix:$rA))>;
2424 def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load PDForm:$rA)), i64:$rB)),
2425 (VINSDRX $vDi, InsertEltShift.Left3, (PLD memri34:$rA))>;
2426 def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load XForm:$rA)), i64:$rB)),
2427 (VINSDRX $vDi, InsertEltShift.Left3, (LDX memrr:$rA))>;
2428 let AddedComplexity = 400 in {
2429 // Immediate vector insert element
2430 foreach Idx = [0, 1, 2, 3] in {
2431 def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, Idx)),
2432 (VINSW $vDi, !mul(!sub(3, Idx), 4), $rA)>;
2434 foreach i = [0, 1] in
2435 def : Pat<(v2i64 (insertelt v2i64:$vDi, i64:$rA, (i64 i))),
2436 (VINSD $vDi, !mul(!sub(1, i), 8), $rA)>;
2440 let Predicates = [IsISA3_1, HasVSX, IsBigEndian, IsPPC32] in {
2441 // Indexed vector insert element
2442 def : Pat<(v16i8 (vector_insert v16i8:$vDi, i32:$rA, i32:$rB)),
2443 (VINSBLX $vDi, $rB, $rA)>;
2444 def : Pat<(v8i16 (vector_insert v8i16:$vDi, i32:$rA, i32:$rB)),
2445 (VINSHLX $vDi, InsertEltShift.Left1, $rA)>;
2446 def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, i32:$rB)),
2447 (VINSWLX $vDi, InsertEltShift.Left2, $rA)>;
2449 def : Pat<(v4f32 (insertelt v4f32:$vDi, f32:$rA, i32:$rB)),
2450 (VINSWVLX $vDi, InsertEltShift.Left2, (XSCVDPSPN $rA))>;
2453 let Predicates = [IsISA3_1, HasVSX, IsBigEndian, IsPPC64] in {
2454 // Indexed vector insert element
2455 def : Pat<(v16i8 (vector_insert v16i8:$vDi, i32:$rA, i64:$rB)),
2456 (VINSBLX $vDi, InsertEltShift.Sub32, $rA)>;
2457 def : Pat<(v8i16 (vector_insert v8i16:$vDi, i32:$rA, i64:$rB)),
2458 (VINSHLX $vDi, InsertEltShift.Sub32Left1, $rA)>;
2459 def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, i64:$rB)),
2460 (VINSWLX $vDi, InsertEltShift.Sub32Left2, $rA)>;
2461 def : Pat<(v2i64 (insertelt v2i64:$vDi, i64:$rA, i64:$rB)),
2462 (VINSDLX $vDi, InsertEltShift.Left3, $rA)>;
2464 def : Pat<(v4f32 (insertelt v4f32:$vDi, f32:$rA, i64:$rB)),
2465 (VINSWVLX $vDi, InsertEltShift.Sub32Left2, (XSCVDPSPN $rA))>;
2467 def : Pat<(v2f64 (insertelt v2f64:$vDi, f64:$A, i64:$rB)),
2468 (VINSDLX $vDi, InsertEltShift.Left3, Bitcast.DblToLong)>;
2469 def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load DSForm:$rA)), i64:$rB)),
2470 (VINSDLX $vDi, InsertEltShift.Left3, (LD memrix:$rA))>;
2471 def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load PDForm:$rA)), i64:$rB)),
2472 (VINSDLX $vDi, InsertEltShift.Left3, (PLD memri34:$rA))>;
2473 def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load XForm:$rA)), i64:$rB)),
2474 (VINSDLX $vDi, InsertEltShift.Left3, (LDX memrr:$rA))>;
2477 let AddedComplexity = 400, Predicates = [IsISA3_1, HasVSX, IsBigEndian] in {
2478 // Immediate vector insert element
2479 foreach Ty = [i32, i64] in {
2480 foreach Idx = [0, 1, 2, 3] in {
2481 def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, (Ty Idx))),
2482 (VINSW $vDi, !mul(Idx, 4), $rA)>;
2486 foreach Idx = [0, 1] in
2487 def : Pat<(v2i64 (insertelt v2i64:$vDi, i64:$rA, Idx)),
2488 (VINSD $vDi, !mul(Idx, 8), $rA)>;
2492 //===----------------------------------------------------------------------===//
2493 // PowerPC ISA 3.1 Extended Mnemonics.
2496 let Predicates = [IsISA3_1] in {
2497 def : InstAlias<"wait", (WAITP10 0, 0)>;
2498 def : InstAlias<"wait 0", (WAITP10 0, 0), 0>;
2499 def : InstAlias<"wait 1", (WAITP10 1, 0), 0>;
2500 def : InstAlias<"waitrsv", (WAITP10 1, 0)>;
2501 def : InstAlias<"pause_short", (WAITP10 2, 0), 0>;
2503 def : InstAlias<"sync", (SYNCP10 0, 0)>;
2504 def : InstAlias<"hwsync", (SYNCP10 0, 0), 0>;
2505 def : InstAlias<"wsync", (SYNCP10 1, 0), 0>;
2506 def : InstAlias<"ptesync", (SYNCP10 2, 0)>;
2507 def : InstAlias<"phwsync", (SYNCP10 4, 0)>;
2508 def : InstAlias<"plwsync", (SYNCP10 5, 0)>;
2509 def : InstAlias<"sync $L", (SYNCP10 u3imm:$L, 0)>;
2510 def : InstAlias<"stncisync", (SYNCP10 1, 1)>;
2511 def : InstAlias<"stcisync", (SYNCP10 0, 2)>;
2512 def : InstAlias<"stsync", (SYNCP10 0, 3)>;
2514 def : InstAlias<"paddi $RT, $RA, $SI", (PADDI8 g8rc:$RT, g8rc_nox0:$RA, s34imm:$SI)>;
2517 let Predicates = [IsISA3_1, PrefixInstrs], isAsmParserOnly = 1, hasNoSchedulingInfo = 1 in {
2518 let Interpretation64Bit = 1 in {
2519 def PLA8 : MLS_DForm_SI34_RT5<14, (outs g8rc:$RT),
2520 (ins g8rc_nox0:$RA, s34imm:$SI),
2521 "pla $RT, ${SI} ${RA}", IIC_IntSimple, []>, MemriOp;
2522 def PLA8pc : MLS_DForm_SI34_RT5<14, (outs g8rc:$RT),
2523 (ins s34imm_pcrel:$SI),
2524 "pla $RT, $SI", IIC_IntSimple, []>, isPCRel;
2527 def PSUBI : PPCAsmPseudo<"psubi $RT, $RA, $SI",
2528 (ins g8rc:$RT, g8rc_nox0:$RA, s34imm:$SI)>;
2530 def PLA : MLS_DForm_SI34_RT5<14, (outs gprc:$RT),
2531 (ins gprc_nor0:$RA, s34imm:$SI),
2532 "pla $RT, ${SI} ${RA}", IIC_IntSimple, []>, MemriOp;
2533 def PLApc : MLS_DForm_SI34_RT5<14, (outs gprc:$RT),
2534 (ins s34imm_pcrel:$SI),
2535 "pla $RT, $SI", IIC_IntSimple, []>, isPCRel;