1 //===- P9InstrResources.td - P9 Instruction Resource Defs -*- tablegen -*-==//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines the resources required by P9 instructions. This is part of
10 // the P9 processor model used for instruction scheduling. This file should
11 // contain all the instructions that may be used on Power 9. This is not
12 // just instructions that are new on Power 9 but also instructions that were
13 // available on earlier architectures and are still used in Power 9.
15 // The makeup of the P9 CPU is modeled as follows:
16 // - Each CPU is made up of two superslices.
17 // - Each superslice is made up of two slices. Therefore, there are 4 slices
19 // - Up to 6 instructions can be dispatched to each CPU. Three per superslice.
21 // - One CY (Crypto) unit P9_CY_*
22 // - One DFU (Decimal Floating Point and Quad Precision) unit P9_DFU_*
23 // - Two PM (Permute) units. One on each superslice. P9_PM_*
24 // - Two DIV (Fixed Point Divide) units. One on each superslize. P9_DIV_*
25 // - Four ALU (Fixed Point Arithmetic) units. One on each slice. P9_ALU_*
26 // - Four DP (Floating Point) units. One on each slice. P9_DP_*
27 // This also includes fixed point multiply add.
28 // - Four AGEN (Address Generation) units. One for each slice. P9_AGEN_*
29 // - Four Load/Store Queues. P9_LS_*
30 // - Each set of instructions will require a number of these resources.
31 //===----------------------------------------------------------------------===//
33 // Two cycle ALU vector operation that uses an entire superslice.
34 // Uses both ALU units (the even ALUE and odd ALUO units), two pipelines
35 // (EXECE, EXECO) and 1 dispatch (DISP) to the given superslice.
36 def : InstRW<[P9_ALUE_2C, P9_ALUO_2C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
38 (instregex "VADDU(B|H|W|D)M$"),
39 (instregex "VAND(C)?$"),
40 (instregex "VEXTS(B|H|W)2(D|W)(s)?$"),
41 (instregex "V_SET0(B|H)?$"),
42 (instregex "VS(R|L)(B|H|W|D)$"),
43 (instregex "VSUBU(B|H|W|D)M$"),
44 (instregex "VPOPCNT(B|H)$"),
45 (instregex "VRL(B|H|W|D)$"),
46 (instregex "VSRA(B|H|W|D)$"),
47 (instregex "XV(N)?ABS(D|S)P$"),
48 (instregex "XVCPSGN(D|S)P$"),
49 (instregex "XV(I|X)EXP(D|S)P$"),
50 (instregex "VRL(D|W)(MI|NM)$"),
51 (instregex "VMRG(E|O)W$"),
86 // Restricted Dispatch ALU operation for 3 cycles. The operation runs on a
87 // single slice. However, since it is Restricted, it requires all 3 dispatches
88 // (DISP) for that superslice.
89 def : InstRW<[P9_ALU_3C, IP_EXEC_1C, DISP_3SLOTS_1C],
91 (instregex "TABORT(D|W)C(I)?$"),
92 (instregex "MTFSB(0|1)$"),
93 (instregex "MFFSC(D)?RN(I)?$"),
94 (instregex "CMPRB(8)?$"),
95 (instregex "TD(I)?$"),
96 (instregex "TW(I)?$"),
97 (instregex "FCMP(O|U)(S|D)$"),
98 (instregex "XSTSTDC(S|D)P$"),
104 // Standard Dispatch ALU operation for 3 cycles. Only one slice used.
105 def : InstRW<[P9_ALU_3C, IP_EXEC_1C, DISP_1C],
107 (instregex "XSMAX(C|J)?DP$"),
108 (instregex "XSMIN(C|J)?DP$"),
109 (instregex "XSCMP(EQ|EXP|GE|GT|O|U)DP$"),
110 (instregex "CNT(L|T)Z(D|W)(8)?(_rec)?$"),
111 (instregex "POPCNT(D|W)$"),
112 (instregex "CMPB(8)?$"),
113 (instregex "SETB(8)?$"),
121 // Standard Dispatch ALU operation for 2 cycles. Only one slice used.
122 def : InstRW<[P9_ALU_2C, IP_EXEC_1C, DISP_1C],
124 (instregex "S(L|R)D$"),
125 (instregex "SRAD(I)?$"),
126 (instregex "EXTSWSLI_32_64$"),
127 (instregex "MFV(S)?RD$"),
128 (instregex "MTV(S)?RD$"),
129 (instregex "MTV(S)?RW(A|Z)$"),
130 (instregex "CMP(WI|LWI|W|LW)(8)?$"),
131 (instregex "CMP(L)?D(I)?$"),
132 (instregex "SUBF(I)?C(8)?(O)?$"),
133 (instregex "ANDI(S)?(8)?(_rec)?$"),
134 (instregex "ADDC(8)?(O)?$"),
135 (instregex "ADDIC(8)?(_rec)?$"),
136 (instregex "ADD(8|4)(O)?(_rec)?$"),
137 (instregex "ADD(E|ME|ZE)(8)?(O)?(_rec)?$"),
138 (instregex "SUBF(E|ME|ZE)?(8)?(O)?(_rec)?$"),
139 (instregex "NEG(8)?(O)?(_rec)?$"),
140 (instregex "POPCNTB$"),
141 (instregex "POPCNTB8$"),
142 (instregex "ADD(I|IS)?(8)?$"),
143 (instregex "LI(S)?(8)?$"),
144 (instregex "(X)?OR(I|IS)?(8)?(_rec)?$"),
145 (instregex "NAND(8)?(_rec)?$"),
146 (instregex "AND(C)?(8)?(_rec)?$"),
147 (instregex "NOR(8)?(_rec)?$"),
148 (instregex "OR(C)?(8)?(_rec)?$"),
149 (instregex "EQV(8)?(_rec)?$"),
150 (instregex "EXTS(B|H|W)(8)?(_32)?(_64)?(_rec)?$"),
151 (instregex "ADD(4|8)(TLS)?(_)?$"),
152 (instregex "NEG(8)?(O)?$"),
153 (instregex "ADDI(S)?toc(HA|L)(8)?$"),
154 (instregex "LA(8)?$"),
176 // Restricted Dispatch ALU operation for 2 cycles. The operation runs on a
177 // single slice. However, since it is Restricted, it requires all 3 dispatches
178 // (DISP) for that superslice.
179 def : InstRW<[P9_ALU_2C, IP_EXEC_1C, DISP_3SLOTS_1C],
181 (instregex "RLDC(L|R)$"),
182 (instregex "RLWIMI(8)?$"),
183 (instregex "RLDIC(L|R)(_32)?(_64)?$"),
184 (instregex "M(F|T)OCRF(8)?$"),
185 (instregex "CR(6)?(UN)?SET$"),
186 (instregex "CR(N)?(OR|AND)(C)?$"),
187 (instregex "S(L|R)W(8)?$"),
188 (instregex "RLW(INM|NM)(8)?$"),
189 (instregex "F(N)?ABS(D|S)$"),
190 (instregex "FNEG(D|S)$"),
191 (instregex "FCPSGN(D|S)$"),
192 (instregex "SRAW(8)?$"),
193 (instregex "SRAWI(8)?$"),
194 (instregex "ISEL(8)?$"),
206 // Three cycle ALU vector operation that uses an entire superslice.
207 // Uses both ALU units (the even ALUE and odd ALUO units), two pipelines
208 // (EXECE, EXECO) and 1 dispatch (DISP) to the given superslice.
209 def : InstRW<[P9_ALUE_3C, P9_ALUO_3C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
211 (instregex "M(T|F)VSCR$"),
212 (instregex "VCMPNEZ(B|H|W)$"),
213 (instregex "VCMPEQU(B|H|W|D)$"),
214 (instregex "VCMPNE(B|H|W)$"),
215 (instregex "VABSDU(B|H|W)$"),
216 (instregex "VADDU(B|H|W)S$"),
217 (instregex "VAVG(S|U)(B|H|W)$"),
218 (instregex "VCMP(EQ|GE|GT)FP(_rec)?$"),
219 (instregex "VCMPBFP(_rec)?$"),
220 (instregex "VC(L|T)Z(B|H|W|D)$"),
221 (instregex "VADDS(B|H|W)S$"),
222 (instregex "V(MIN|MAX)FP$"),
223 (instregex "V(MIN|MAX)(S|U)(B|H|W|D)$"),
291 // 7 cycle DP vector operation that uses an entire superslice.
292 // Uses both DP units (the even DPE and odd DPO units), two pipelines (EXECE,
293 // EXECO) and all three dispatches (DISP) to the given superslice.
294 def : InstRW<[P9_DPE_7C, P9_DPO_7C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
402 // 5 cycle Restricted DP operation. One DP unit, one EXEC pipeline and all three
403 // dispatch units for the superslice.
404 def : InstRW<[P9_DP_5C, IP_EXEC_1C, DISP_3SLOTS_1C],
406 (instregex "MADD(HD|HDU|LD|LD8)$"),
407 (instregex "MUL(HD|HW|LD|LI|LI8|LW)(U)?(O)?$")
410 // 7 cycle Restricted DP operation. One DP unit, one EXEC pipeline and all three
411 // dispatch units for the superslice.
412 def : InstRW<[P9_DP_7C, IP_EXEC_1C, DISP_3SLOTS_1C],
415 (instregex "FRI(N|P|Z|M)(D|S)$"),
416 (instregex "FRE(S)?$"),
417 (instregex "FADD(S)?$"),
418 (instregex "FMSUB(S)?$"),
419 (instregex "FMADD(S)?$"),
420 (instregex "FSUB(S)?$"),
421 (instregex "FCFID(U)?(S)?$"),
422 (instregex "FCTID(U)?(Z)?$"),
423 (instregex "FCTIW(U)?(Z)?$"),
424 (instregex "FRSQRTE(S)?$"),
453 // 7 cycle Restricted DP operation and one 3 cycle ALU operation.
454 // These operations can be done in parallel. The DP is restricted so we need a
455 // full 4 dispatches.
456 def : InstRW<[P9_DP_7C, P9_ALU_3C, IP_EXEC_1C, IP_EXEC_1C,
457 DISP_3SLOTS_1C, DISP_1C],
459 (instregex "FSEL(D|S)_rec$")
462 // 5 Cycle Restricted DP operation and one 2 cycle ALU operation.
463 def : InstRW<[P9_DPOpAndALUOp_7C, IP_EXEC_1C, IP_EXEC_1C,
464 DISP_3SLOTS_1C, DISP_1C],
466 (instregex "MUL(H|L)(D|W)(U)?(O)?_rec$")
469 // 7 cycle Restricted DP operation and one 3 cycle ALU operation.
470 // These operations must be done sequentially.The DP is restricted so we need a
471 // full 4 dispatches.
472 def : InstRW<[P9_DPOpAndALU2Op_10C, IP_EXEC_1C, IP_EXEC_1C,
473 DISP_3SLOTS_1C, DISP_1C],
475 (instregex "FRI(N|P|Z|M)(D|S)_rec$"),
476 (instregex "FRE(S)?_rec$"),
477 (instregex "FADD(S)?_rec$"),
478 (instregex "FSUB(S)?_rec$"),
479 (instregex "F(N)?MSUB(S)?_rec$"),
480 (instregex "F(N)?MADD(S)?_rec$"),
481 (instregex "FCFID(U)?(S)?_rec$"),
482 (instregex "FCTID(U)?(Z)?_rec$"),
483 (instregex "FCTIW(U)?(Z)?_rec$"),
484 (instregex "FMUL(S)?_rec$"),
485 (instregex "FRSQRTE(S)?_rec$"),
489 // 7 cycle DP operation. One DP unit, one EXEC pipeline and 1 dispatch units.
490 def : InstRW<[P9_DP_7C, IP_EXEC_1C, DISP_1C],
525 // Three Cycle PM operation. Only one PM unit per superslice so we use the whole
526 // superslice. That includes both exec pipelines (EXECO, EXECE) and one
528 def : InstRW<[P9_PM_3C, IP_EXECO_1C, IP_EXECE_1C, DISP_1C],
530 (instregex "LVS(L|R)$"),
531 (instregex "VSPLTIS(W|H|B)$"),
532 (instregex "VSPLT(W|H|B)(s)?$"),
533 (instregex "V_SETALLONES(B|H)?$"),
534 (instregex "VEXTRACTU(B|H|W)$"),
535 (instregex "VINSERT(B|H|W|D)$"),
635 // 12 Cycle DFU operation. Only one DFU unit per CPU so we use a whole
636 // superslice. That includes both exec pipelines (EXECO, EXECE) and one
638 def : InstRW<[P9_DFU_12C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
659 // 23 Cycle DFU operation. Only one DFU unit per CPU so we use a whole
660 // superslice. That includes both exec pipelines (EXECO, EXECE) and one
662 def : InstRW<[P9_DFU_23C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
667 // 24 Cycle DFU operation. Only one DFU unit per CPU so we use a whole
668 // superslice. That includes both exec pipelines (EXECO, EXECE) and one
670 def : InstRW<[P9_DFU_24C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
684 // 37 Cycle DFU operation. Only one DFU unit per CPU so we use a whole
685 // superslice. That includes both exec pipelines (EXECO, EXECE) and one
687 def : InstRW<[P9_DFU_37C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
692 // 58 Cycle DFU operation. Only one DFU unit per CPU so we use a whole
693 // superslice. That includes both exec pipelines (EXECO, EXECE) and one
695 def : InstRW<[P9_DFU_58C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
701 // 76 Cycle DFU operation. Only one DFU unit per CPU so we use a whole
702 // superslice. That includes both exec pipelines (EXECO, EXECE) and all three
704 def : InstRW<[P9_DFU_76C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
710 // 6 Cycle Load uses a single slice.
711 def : InstRW<[P9_LS_6C, IP_AGEN_1C, DISP_1C],
713 (instregex "LXVL(L)?")
716 // 5 Cycle Load uses a single slice.
717 def : InstRW<[P9_LS_5C, IP_AGEN_1C, DISP_1C],
719 (instregex "LVE(B|H|W)X$"),
720 (instregex "LVX(L)?"),
721 (instregex "LXSI(B|H)ZX$"),
735 // 4 Cycle Load uses a single slice.
736 def : InstRW<[P9_LS_4C, IP_AGEN_1C, DISP_1C],
738 (instregex "DCB(F|T|ST)(EP)?$"),
739 (instregex "DCBZ(L)?(EP)?$"),
740 (instregex "DCBTST(EP)?$"),
741 (instregex "CP_COPY(8)?$"),
742 (instregex "ICBI(EP)?$"),
743 (instregex "ICBT(LS)?$"),
744 (instregex "LBARX(L)?$"),
745 (instregex "LBZ(CIX|8|X|X8|XTLS|XTLS_32)?(_)?$"),
746 (instregex "LD(ARX|ARXL|BRX|CIX|X|XTLS)?(_)?$"),
747 (instregex "LH(A|B)RX(L)?(8)?$"),
748 (instregex "LHZ(8|CIX|X|X8|XTLS|XTLS_32)?(_)?$"),
749 (instregex "LWARX(L)?$"),
750 (instregex "LWBRX(8)?$"),
751 (instregex "LWZ(8|CIX|X|X8|XTLS|XTLS_32)?(_)?$"),
763 // 4 Cycle Restricted load uses a single slice but the dispatch for the whole
765 def : InstRW<[P9_LS_4C, IP_AGEN_1C, DISP_3SLOTS_1C],
769 (instregex "LFDXTLS?(_)?$"),
773 // Cracked Load Instructions.
774 // Load instructions that can be done in parallel.
775 def : InstRW<[P9_LS_4C, P9_LS_4C, IP_AGEN_1C, IP_AGEN_1C,
786 // Cracked Load Instruction.
787 // Requires Load and ALU pieces totaling 6 cycles. The Load and ALU
788 // operations can be run in parallel.
789 def : InstRW<[P9_LS_4C, P9_ALU_2C, IP_EXEC_1C, IP_AGEN_1C,
790 DISP_PAIR_1C, DISP_PAIR_1C],
792 (instregex "L(W|H)ZU(X)?(8)?$")
795 // Cracked TEND Instruction.
796 // Requires Load and ALU pieces totaling 6 cycles. The Load and ALU
797 // operations can be run in parallel.
798 def : InstRW<[P9_LS_4C, P9_ALU_2C, IP_EXEC_1C, IP_AGEN_1C,
805 // Cracked Store Instruction
806 // Consecutive Store and ALU instructions. The store is restricted and requires
808 def : InstRW<[P9_StoreAndALUOp_3C, IP_EXEC_1C, IP_EXEC_1C, IP_AGEN_1C,
809 DISP_3SLOTS_1C, DISP_1C],
811 (instregex "ST(B|H|W|D)CX$")
814 // Cracked Load instruction.
815 // Requires consecutive Load and ALU pieces totaling 6 cycles. The Load and ALU
816 // operations cannot be done at the same time and so their latencies are added.
817 def : InstRW<[P9_LoadAndALUOp_6C, IP_EXEC_1C, IP_AGEN_1C,
820 (instregex "LHA(X)?(TLS)?(8)?(_32)?(_)?$"),
821 (instregex "CP_PASTE(8)?_rec$"),
822 (instregex "LWA(X)?(TLS)?(_32)?(_)?$"),
826 // Cracked Restricted Load instruction.
827 // Requires consecutive Load and ALU pieces totaling 6 cycles. The Load and ALU
828 // operations cannot be done at the same time and so their latencies are added.
829 // Full 6 dispatches are required as this is both cracked and restricted.
830 def : InstRW<[P9_LoadAndALUOp_6C, IP_EXEC_1C, IP_AGEN_1C,
831 DISP_3SLOTS_1C, DISP_3SLOTS_1C],
836 // Cracked Load instruction.
837 // Requires consecutive Load and ALU pieces totaling 7 cycles. The Load and ALU
838 // operations cannot be done at the same time and so their latencies are added.
839 // Full 4 dispatches are required as this is a cracked instruction.
840 def : InstRW<[P9_LoadAndALUOp_7C, IP_AGEN_1C, IP_EXEC_1C, DISP_1C, DISP_1C],
846 // Cracked Load instruction.
847 // Requires consecutive Load (4 cycles) and ALU (3 cycles) pieces totaling 7
848 // cycles. The Load and ALU operations cannot be done at the same time and so
849 // their latencies are added.
850 // Full 6 dispatches are required as this is a restricted instruction.
851 def : InstRW<[P9_LoadAndALU2Op_7C, IP_AGEN_1C, IP_EXEC_1C,
852 DISP_3SLOTS_1C, DISP_3SLOTS_1C],
855 (instregex "LFSXTLS?(_)?$"),
859 // Cracked Load instruction.
860 // Requires consecutive Load and ALU pieces totaling 8 cycles. The Load and ALU
861 // operations cannot be done at the same time and so their latencies are added.
862 // Full 4 dispatches are required as this is a cracked instruction.
863 def : InstRW<[P9_LoadAndALU2Op_8C, IP_AGEN_1C, IP_EXEC_1C, DISP_1C, DISP_1C],
871 // Cracked 3-Way Load Instruction
872 // Load with two ALU operations that depend on each other
873 def : InstRW<[P9_LoadAndALUOp_6C, P9_ALU_2C, IP_AGEN_1C, IP_EXEC_1C, IP_EXEC_1C,
874 DISP_PAIR_1C, DISP_PAIR_1C, DISP_1C],
876 (instregex "LHAU(X)?(8)?$"),
880 // Cracked Load that requires the PM resource.
881 // Since the Load and the PM cannot be done at the same time the latencies are
882 // added. Requires 8 cycles. Since the PM requires the full superslice we need
883 // both EXECE, EXECO pipelines as well as 1 dispatch for the PM. The Load
884 // requires the remaining 1 dispatch.
885 def : InstRW<[P9_LoadAndPMOp_8C, IP_AGEN_1C, IP_EXECE_1C, IP_EXECO_1C,
893 // Single slice Restricted store operation. The restricted operation requires
894 // all three dispatches for the superslice.
895 def : InstRW<[P9_LS_1C, IP_EXEC_1C, IP_AGEN_1C, DISP_3SLOTS_1C],
897 (instregex "STF(S|D|IWX|SX|DX|SXTLS|DXTLS|SXTLS_|DXTLS_)$"),
898 (instregex "STXS(D|DX|SPX|IWX|IBX|IHX|SP)(v)?$"),
899 (instregex "STW(8)?$"),
900 (instregex "(D|X)FSTORE(f32|f64)$"),
901 (instregex "ST(W|H|D)BRX$"),
902 (instregex "ST(B|H|D)(8)?$"),
903 (instregex "ST(B|W|H|D)(CI)?X(TLS|TLS_32)?(8)?(_)?$"),
911 // Vector Store Instruction
912 // Requires the whole superslice and therefore requires one dispatch
913 // as well as both the Even and Odd exec pipelines.
914 def : InstRW<[P9_LS_1C, IP_EXECE_1C, IP_EXECO_1C, IP_AGEN_1C, DISP_1C],
916 (instregex "STVE(B|H|W)X$"),
917 (instregex "STVX(L)?$"),
918 (instregex "STXV(B16X|H8X|W4X|D2X|L|LL|X)?$")
921 // 5 Cycle DIV operation. Only one DIV unit per superslice so we use the whole
922 // superslice. That includes both exec pipelines (EXECO, EXECE) and two
924 def : InstRW<[P9_DIV_5C, IP_EXECE_1C, IP_EXECO_1C, DISP_EVEN_1C],
926 (instregex "MTCTR(8)?(loop)?$"),
927 (instregex "MTLR(8)?$")
930 // 12 Cycle DIV operation. Only one DIV unit per superslice so we use the whole
931 // superslice. That includes both exec pipelines (EXECO, EXECE) and two
933 def : InstRW<[P9_DIV_12C, IP_EXECE_1C, IP_EXECO_1C, DISP_EVEN_1C],
935 (instregex "M(T|F)VRSAVE(v)?$"),
936 (instregex "M(T|F)PMR$"),
937 (instregex "M(T|F)TB(8)?$"),
938 (instregex "MF(SPR|CTR|LR)(8)?$"),
939 (instregex "M(T|F)MSR(D)?$"),
940 (instregex "M(T|F)(U)?DSCR$"),
941 (instregex "MTSPR(8)?$")
944 // 16 Cycle DIV operation. Only one DIV unit per superslice so we use the whole
945 // superslice. That includes both exec pipelines (EXECO, EXECE) and two
947 def : InstRW<[P9_DIV_16C_8, IP_EXECO_1C, IP_EXECE_1C, DISP_EVEN_1C],
956 // 24 Cycle DIV operation. Only one DIV unit per superslice so we use the whole
957 // superslice. That includes both exec pipelines (EXECO, EXECE) and two
959 def : InstRW<[P9_DIV_24C_8, IP_EXECO_1C, IP_EXECE_1C, DISP_EVEN_1C],
974 // 40 Cycle DIV operation. Only one DIV unit per superslice so we use the whole
975 // superslice. That includes both exec pipelines (EXECO, EXECE) and all three
977 def : InstRW<[P9_DIV_40C_8, IP_EXECO_1C, IP_EXECE_1C, DISP_EVEN_1C],
985 // Cracked DIV and ALU operation. Requires one full slice for the ALU operation
986 // and one full superslice for the DIV operation since there is only one DIV per
987 // superslice. Latency of DIV plus ALU is 26.
988 def : InstRW<[P9_IntDivAndALUOp_18C_8, IP_EXECE_1C, IP_EXECO_1C, IP_EXEC_1C,
989 DISP_EVEN_1C, DISP_1C],
991 (instregex "DIVW(U)?(O)?_rec$")
994 // Cracked DIV and ALU operation. Requires one full slice for the ALU operation
995 // and one full superslice for the DIV operation since there is only one DIV per
996 // superslice. Latency of DIV plus ALU is 26.
997 def : InstRW<[P9_IntDivAndALUOp_26C_8, IP_EXECE_1C, IP_EXECO_1C, IP_EXEC_1C,
998 DISP_EVEN_1C, DISP_1C],
1010 // Cracked DIV and ALU operation. Requires one full slice for the ALU operation
1011 // and one full superslice for the DIV operation since there is only one DIV per
1012 // superslice. Latency of DIV plus ALU is 42.
1013 def : InstRW<[P9_IntDivAndALUOp_42C_8, IP_EXECE_1C, IP_EXECO_1C, IP_EXEC_1C,
1014 DISP_EVEN_1C, DISP_1C],
1022 // CR access instructions in _BrMCR, IIC_BrMCRX.
1024 // Cracked, restricted, ALU operations.
1025 // Here the two ALU ops can actually be done in parallel and therefore the
1026 // latencies are not added together. Otherwise this is like having two
1027 // instructions running together on two pipelines and 6 dispatches. ALU ops are
1029 def : InstRW<[P9_ALU_2C, P9_ALU_2C, IP_EXEC_1C, IP_EXEC_1C,
1030 DISP_3SLOTS_1C, DISP_3SLOTS_1C],
1036 // Cracked ALU operations.
1037 // Here the two ALU ops can actually be done in parallel and therefore the
1038 // latencies are not added together. Otherwise this is like having two
1039 // instructions running together on two pipelines and 2 dispatches. ALU ops are
1041 def : InstRW<[P9_ALU_2C, P9_ALU_2C, IP_EXEC_1C, IP_EXEC_1C,
1044 (instregex "ADDC(8)?(O)?_rec$"),
1045 (instregex "SUBFC(8)?(O)?_rec$")
1048 // Cracked ALU operations.
1049 // Two ALU ops can be done in parallel.
1050 // One is three cycle ALU the ohter is a two cycle ALU.
1051 // One of the ALU ops is restricted the other is not so we have a total of
1053 def : InstRW<[P9_ALU_2C, P9_ALU_3C, IP_EXEC_1C, IP_EXEC_1C,
1054 DISP_3SLOTS_1C, DISP_1C],
1056 (instregex "F(N)?ABS(D|S)_rec$"),
1057 (instregex "FCPSGN(D|S)_rec$"),
1058 (instregex "FNEG(D|S)_rec$"),
1062 // Cracked ALU operations.
1063 // Here the two ALU ops can actually be done in parallel and therefore the
1064 // latencies are not added together. Otherwise this is like having two
1065 // instructions running together on two pipelines and 2 dispatches.
1066 // ALU ops are 3 cycles each.
1067 def : InstRW<[P9_ALU_3C, P9_ALU_3C, IP_EXEC_1C, IP_EXEC_1C,
1073 // Cracked Restricted ALU operations.
1074 // Here the two ALU ops can actually be done in parallel and therefore the
1075 // latencies are not added together. Otherwise this is like having two
1076 // instructions running together on two pipelines and 6 dispatches.
1077 // ALU ops are 3 cycles each.
1078 def : InstRW<[P9_ALU_3C, P9_ALU_3C, IP_EXEC_1C, IP_EXEC_1C,
1079 DISP_3SLOTS_1C, DISP_3SLOTS_1C],
1081 (instregex "MTFSF(b|_rec)?$"),
1082 (instregex "MTFSFI(_rec)?$"),
1086 // Cracked instruction made of two ALU ops.
1087 // The two ops cannot be done in parallel.
1088 // One of the ALU ops is restricted and takes 3 dispatches.
1089 def : InstRW<[P9_ALUOpAndALUOp_4C, IP_EXEC_1C, IP_EXEC_1C,
1090 DISP_3SLOTS_1C, DISP_1C],
1092 (instregex "RLD(I)?C(R|L)_rec$"),
1093 (instregex "RLW(IMI|INM|NM)(8)?_rec$"),
1094 (instregex "SLW(8)?_rec$"),
1095 (instregex "SRAW(8)?_rec$"),
1096 (instregex "SRAWI(8)?_rec$"),
1097 (instregex "SRW(8)?_rec$"),
1102 // Cracked instruction made of two ALU ops.
1103 // The two ops cannot be done in parallel.
1104 // Both of the ALU ops are restricted and take 3 dispatches.
1105 def : InstRW<[P9_ALU2OpAndALU2Op_6C, IP_EXEC_1C, IP_EXEC_1C,
1106 DISP_3SLOTS_1C, DISP_3SLOTS_1C],
1108 (instregex "MFFS(L|CE|_rec)?$")
1111 // Cracked ALU instruction composed of three consecutive 2 cycle loads for a
1112 // total of 6 cycles. All of the ALU operations are also restricted so each
1113 // takes 3 dispatches for a total of 9.
1114 def : InstRW<[P9_ALUOpAndALUOpAndALUOp_6C, IP_EXEC_1C, IP_EXEC_1C, IP_EXEC_1C,
1115 DISP_3SLOTS_1C, DISP_3SLOTS_1C, DISP_3SLOTS_1C],
1117 (instregex "MFCR(8)?$")
1120 // Cracked instruction made of two ALU ops.
1121 // The two ops cannot be done in parallel.
1122 def : InstRW<[P9_ALUOpAndALUOp_4C, IP_EXEC_1C, IP_EXEC_1C, DISP_1C, DISP_1C],
1124 (instregex "EXTSWSLI_32_64_rec$"),
1125 (instregex "SRAD(I)?_rec$"),
1132 // 33 Cycle DP Instruction Restricted. Takes one slice and 3 dispatches.
1133 def : InstRW<[P9_DP_33C_8, IP_EXEC_1C, DISP_3SLOTS_1C],
1138 // 33 Cycle DP Instruction Restricted and Cracked with 3 Cycle ALU.
1139 def : InstRW<[P9_DPOpAndALU2Op_36C_8, IP_EXEC_1C, IP_EXEC_1C,
1140 DISP_3SLOTS_1C, DISP_1C],
1145 // 36 Cycle DP Instruction.
1146 // Instruction can be done on a single slice.
1147 def : InstRW<[P9_DP_36C_10, IP_EXEC_1C, DISP_1C],
1152 // 36 Cycle DP Instruction Restricted. Takes one slice and 3 dispatches.
1153 def : InstRW<[P9_DP_36C_10, IP_EXEC_1C, DISP_3SLOTS_1C],
1158 // 36 Cycle DP Vector Instruction.
1159 def : InstRW<[P9_DPE_36C_10, P9_DPO_36C_10, IP_EXECE_1C, IP_EXECO_1C,
1165 // 27 Cycle DP Vector Instruction.
1166 def : InstRW<[P9_DPE_27C_10, P9_DPO_27C_10, IP_EXECE_1C, IP_EXECO_1C,
1172 // 36 Cycle DP Instruction Restricted and Cracked with 3 Cycle ALU.
1173 def : InstRW<[P9_DPOpAndALU2Op_39C_10, IP_EXEC_1C, IP_EXEC_1C,
1174 DISP_3SLOTS_1C, DISP_1C],
1179 // 26 Cycle DP Instruction.
1180 def : InstRW<[P9_DP_26C_5, IP_EXEC_1C, DISP_1C],
1185 // 26 Cycle DP Instruction Restricted. Takes one slice and 3 dispatches.
1186 def : InstRW<[P9_DP_26C_5, IP_EXEC_1C, DISP_3SLOTS_1C],
1191 // 26 Cycle DP Instruction Restricted and Cracked with 3 Cycle ALU.
1192 def : InstRW<[P9_DPOpAndALU2Op_29C_5, IP_EXEC_1C, IP_EXEC_1C,
1193 DISP_3SLOTS_1C, DISP_1C],
1198 // 33 Cycle DP Instruction. Takes one slice and 1 dispatch.
1199 def : InstRW<[P9_DP_33C_8, IP_EXEC_1C, DISP_1C],
1204 // 22 Cycle DP Instruction Restricted. Takes one slice and 3 dispatches.
1205 def : InstRW<[P9_DP_22C_5, IP_EXEC_1C, DISP_3SLOTS_1C],
1210 // 22 Cycle DP Instruction Restricted and Cracked with 2 Cycle ALU.
1211 def : InstRW<[P9_DPOpAndALU2Op_25C_5, IP_EXEC_1C, IP_EXEC_1C,
1212 DISP_3SLOTS_1C, DISP_1C],
1217 // 22 Cycle DP Instruction. Takes one slice and 1 dispatch.
1218 def : InstRW<[P9_DP_22C_5, IP_EXEC_1C, DISP_1C],
1223 // 24 Cycle DP Vector Instruction. Takes one full superslice.
1224 // Includes both EXECE, EXECO pipelines and 1 dispatch for the given
1226 def : InstRW<[P9_DPE_24C_8, P9_DPO_24C_8, IP_EXECE_1C, IP_EXECO_1C,
1232 // 33 Cycle DP Vector Instruction. Takes one full superslice.
1233 // Includes both EXECE, EXECO pipelines and 1 dispatch for the given
1235 def : InstRW<[P9_DPE_33C_8, P9_DPO_33C_8, IP_EXECE_1C, IP_EXECO_1C,
1241 // Instruction cracked into three pieces. One Load and two ALU operations.
1242 // The Load and one of the ALU ops cannot be run at the same time and so the
1243 // latencies are added together for 6 cycles. The remainaing ALU is 2 cycles.
1244 // Both the load and the ALU that depends on it are restricted and so they take
1245 // a total of 7 dispatches. The final 2 dispatches come from the second ALU op.
1246 // The two EXEC pipelines are for the 2 ALUs while the AGEN is for the load.
1247 def : InstRW<[P9_LoadAndALU2Op_7C, P9_ALU_2C,
1248 IP_AGEN_1C, IP_EXEC_1C, IP_EXEC_1C,
1249 DISP_3SLOTS_1C, DISP_3SLOTS_1C, DISP_1C],
1251 (instregex "LF(SU|SUX)$")
1254 // Cracked instruction made up of a Store and an ALU. The ALU does not depend on
1255 // the store and so it can be run at the same time as the store. The store is
1257 def : InstRW<[P9_LS_1C, P9_ALU_2C, IP_AGEN_1C, IP_EXEC_1C, IP_EXEC_1C,
1258 DISP_3SLOTS_1C, DISP_1C],
1260 (instregex "STF(S|D)U(X)?$"),
1261 (instregex "ST(B|H|W|D)U(X)?(8)?$")
1264 // Cracked instruction made up of a Load and an ALU. The ALU does not depend on
1265 // the load and so it can be run at the same time as the load.
1266 def : InstRW<[P9_LS_4C, P9_ALU_2C, IP_AGEN_1C, IP_EXEC_1C,
1267 DISP_PAIR_1C, DISP_PAIR_1C],
1269 (instregex "LBZU(X)?(8)?$"),
1270 (instregex "LDU(X)?$")
1273 // Cracked instruction made up of a Load and an ALU. The ALU does not depend on
1274 // the load and so it can be run at the same time as the load. The load is also
1275 // restricted. 3 dispatches are from the restricted load while the other two
1276 // are from the ALU. The AGEN pipeline is from the load and the EXEC pipeline
1277 // is required for the ALU.
1278 def : InstRW<[P9_LS_4C, P9_ALU_2C, IP_AGEN_1C, IP_EXEC_1C,
1279 DISP_3SLOTS_1C, DISP_1C],
1281 (instregex "LF(DU|DUX)$")
1284 // Crypto Instructions
1286 // 6 Cycle CY operation. Only one CY unit per CPU so we use a whole
1287 // superslice. That includes both exec pipelines (EXECO, EXECE) and one
1289 def : InstRW<[P9_CY_6C, IP_EXECO_1C, IP_EXECE_1C, DISP_1C],
1291 (instregex "VPMSUM(B|H|W|D)$"),
1292 (instregex "V(N)?CIPHER(LAST)?$"),
1296 // Branch Instructions
1299 def : InstRW<[P9_BR_2C, DISP_BR_1C],
1301 (instregex "BCCCTR(L)?(8)?$"),
1302 (instregex "BCCL(A|R|RL)?$"),
1303 (instregex "BCCTR(L)?(8)?(n)?$"),
1304 (instregex "BD(N)?Z(8|A|Am|Ap|m|p)?$"),
1305 (instregex "BD(N)?ZL(A|Am|Ap|R|R8|RL|RLm|RLp|Rm|Rp|m|p)?$"),
1306 (instregex "BL(_TLS|_NOP)?(_RM)?$"),
1307 (instregex "BL8(_TLS|_NOP|_NOP_TLS|_TLS_)?(_RM)?$"),
1308 (instregex "BLA(8|8_NOP)?(_RM)?$"),
1309 (instregex "BLR(8|L)?$"),
1310 (instregex "TAILB(A)?(8)?$"),
1311 (instregex "TAILBCTR(8)?$"),
1312 (instregex "gBC(A|Aat|CTR|CTRL|L|LA|LAat|LR|LRL|Lat|at)?$"),
1313 (instregex "BCLR(L)?(n)?$"),
1314 (instregex "BCTR(L)?(8)?(_RM)?$"),
1325 BCTRL8_LDinto_toc_RM,
1326 BCTRL_LWZinto_toc_RM,
1331 // Five Cycle Branch with a 2 Cycle ALU Op
1332 // Operations must be done consecutively and not in parallel.
1333 def : InstRW<[P9_BROpAndALUOp_7C, IP_EXEC_1C, DISP_BR_1C, DISP_1C],
1338 // Special Extracted Instructions For Atomics
1341 def : InstRW<[P9_LS_1C, P9_LS_1C, P9_LS_4C, P9_LS_4C, P9_LS_4C,
1342 IP_EXEC_1C, IP_EXEC_1C, IP_AGEN_1C, IP_AGEN_1C, IP_AGEN_1C,
1343 IP_AGEN_1C, IP_AGEN_1C, DISP_1C, DISP_3SLOTS_1C,
1344 DISP_3SLOTS_1C, DISP_1C, DISP_1C, DISP_1C],
1346 (instregex "L(D|W)AT$")
1350 def : InstRW<[P9_LS_1C, P9_LS_4C, P9_LS_4C, IP_EXEC_1C, IP_AGEN_1C, IP_AGEN_1C,
1351 IP_AGEN_1C, DISP_1C, DISP_3SLOTS_1C, DISP_1C],
1353 (instregex "ST(D|W)AT$")
1356 // Signal Processing Engine (SPE) Instructions
1357 // These instructions are not supported on Power 9
1366 (instregex "EVADD(I)?W$"),
1367 (instregex "EVADD(SM|SS|UM|US)IAAW$"),
1368 (instregex "EVAND(C)?$"),
1369 (instregex "EVCMP(EQ|GTS|GTU|LTS|LTU)$"),
1370 (instregex "EVCNTL(S|Z)W$"),
1371 (instregex "EVDIVW(S|U)$"),
1372 (instregex "EVEXTS(B|H)$"),
1373 (instregex "EVLD(H|W|D)(X)?$"),
1374 (instregex "EVLHH(E|OS|OU)SPLAT(X)?$"),
1375 (instregex "EVLWHE(X)?$"),
1376 (instregex "EVLWHO(S|U)(X)?$"),
1377 (instregex "EVLW(H|W)SPLAT(X)?$"),
1378 (instregex "EVMERGE(HI|LO|HILO|LOHI)$"),
1379 (instregex "EVMHEG(S|U)M(F|I)A(A|N)$"),
1380 (instregex "EVMHES(M|S)(F|I)(A|AA|AAW|ANW)?$"),
1381 (instregex "EVMHEU(M|S)I(A|AA|AAW|ANW)?$"),
1382 (instregex "EVMHOG(U|S)M(F|I)A(A|N)$"),
1383 (instregex "EVMHOS(M|S)(F|I)(A|AA|AAW|ANW)?$"),
1384 (instregex "EVMHOU(M|S)I(A|AA|ANW|AAW)?$"),
1385 (instregex "EVMWHS(M|S)(F|FA|I|IA)$"),
1386 (instregex "EVMWHUMI(A)?$"),
1387 (instregex "EVMWLS(M|S)IA(A|N)W$"),
1388 (instregex "EVMWLU(M|S)I(A|AA|AAW|ANW)?$"),
1389 (instregex "EVMWSM(F|I)(A|AA|AN)?$"),
1390 (instregex "EVMWSSF(A|AA|AN)?$"),
1391 (instregex "EVMWUMI(A|AA|AN)?$"),
1392 (instregex "EV(N|X)?OR(C)?$"),
1393 (instregex "EVR(LW|LWI|NDW)$"),
1394 (instregex "EVSLW(I)?$"),
1395 (instregex "EVSPLAT(F)?I$"),
1396 (instregex "EVSRW(I)?(S|U)$"),
1397 (instregex "EVST(DD|DH|DW|WHE|WHO|WWE|WWO)(X)?$"),
1398 (instregex "EVSUBF(S|U)(M|S)IAAW$"),
1399 (instregex "EVSUB(I)?FW$")
1400 )> { let Unsupported = 1; }
1402 // General Instructions without scheduling support.
1405 (instregex "(H)?RFI(D)?$"),
1406 (instregex "DSS(ALL)?$"),
1407 (instregex "DST(ST)?(T)?(64)?$"),
1408 (instregex "ICBL(C|Q)$"),
1409 (instregex "L(W|H|B)EPX$"),
1410 (instregex "ST(W|H|B)EPX$"),
1411 (instregex "(L|ST)FDEPX$"),
1412 (instregex "M(T|F)SR(IN)?$"),
1413 (instregex "M(T|F)DCR$"),
1414 (instregex "NOP_GT_PWR(6|7)$"),
1415 (instregex "TLB(IA|IVAX|SX|SX2|SX2D|LD|LI|RE|RE2|WE|WE2)$"),
1416 (instregex "WRTEE(I)?$"),
1417 (instregex "HASH(ST|STP|CHK|CHKP)(8)?$"),
1441 )> { let Unsupported = 1; }