1 ;; Scheduling description for PowerPC 604, PowerPC 604e, PowerPC 620,
2 ;; and PowerPC 630 processors.
3 ;; Copyright (C) 2003, 2004 Free Software Foundation, Inc.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 2, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
20 ;; MA 02110-1301, USA.
22 (define_automaton "ppc6xx,ppc6xxfp,ppc6xxfp2")
23 (define_cpu_unit "iu1_6xx,iu2_6xx,mciu_6xx" "ppc6xx")
24 (define_cpu_unit "fpu_6xx" "ppc6xxfp")
25 (define_cpu_unit "fpu1_6xx,fpu2_6xx" "ppc6xxfp2")
26 (define_cpu_unit "lsu_6xx,bpu_6xx,cru_6xx" "ppc6xx")
28 ;; PPC604 32-bit 2xSCIU, MCIU, LSU, FPU, BPU
29 ;; PPC604e 32-bit 2xSCIU, MCIU, LSU, FPU, BPU, CRU
30 ;; MCIU used for imul/idiv and moves from/to spr
31 ;; LSU 2 stage pipelined
32 ;; FPU 3 stage pipelined
33 ;; Max issue 4 insns/clock cycle
35 ;; PPC604e is PPC604 with larger caches and a CRU. In the 604
36 ;; the CR logical operations are handled in the BPU.
37 ;; In the 604e, the CRU shares bus with BPU so only one condition
38 ;; register or branch insn can be issued per clock. Not modelled.
40 ;; PPC620 64-bit 2xSCIU, MCIU, LSU, FPU, BPU, CRU
41 ;; PPC630 64-bit 2xSCIU, MCIU, LSU, 2xFPU, BPU, CRU
42 ;; Max issue 4 insns/clock cycle
43 ;; Out-of-order execution, in-order completion
45 ;; No following instruction can dispatch in the same cycle as a branch
46 ;; instruction. Not modelled. This is no problem if RCSP is not
47 ;; enabled since the scheduler stops a schedule when it gets to a branch.
49 ;; Four insns can be dispatched per cycle.
51 (define_insn_reservation "ppc604-load" 2
52 (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u")
53 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
56 (define_insn_reservation "ppc604-fpload" 3
57 (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
58 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
61 (define_insn_reservation "ppc604-store" 3
62 (and (eq_attr "type" "store,fpstore,store_ux,store_u,fpstore_ux,fpstore_u")
63 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
66 (define_insn_reservation "ppc604-llsc" 3
67 (and (eq_attr "type" "load_l,store_c")
68 (eq_attr "cpu" "ppc604,ppc604e"))
71 (define_insn_reservation "ppc630-llsc" 4
72 (and (eq_attr "type" "load_l,store_c")
73 (eq_attr "cpu" "ppc620,ppc630"))
76 (define_insn_reservation "ppc604-integer" 1
77 (and (eq_attr "type" "integer,insert_word,insert_dword,shift,trap,\
78 var_shift_rotate,cntlz,exts")
79 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
82 (define_insn_reservation "ppc604-two" 1
83 (and (eq_attr "type" "two")
84 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
85 "iu1_6xx|iu2_6xx,iu1_6xx|iu2_6xx")
87 (define_insn_reservation "ppc604-three" 1
88 (and (eq_attr "type" "three")
89 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
90 "iu1_6xx|iu2_6xx,iu1_6xx|iu2_6xx,iu1_6xx|iu2_6xx")
92 (define_insn_reservation "ppc604-imul" 4
93 (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
94 (eq_attr "cpu" "ppc604"))
97 (define_insn_reservation "ppc604e-imul" 2
98 (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
99 (eq_attr "cpu" "ppc604e"))
102 (define_insn_reservation "ppc620-imul" 5
103 (and (eq_attr "type" "imul,imul_compare")
104 (eq_attr "cpu" "ppc620,ppc630"))
107 (define_insn_reservation "ppc620-imul2" 4
108 (and (eq_attr "type" "imul2")
109 (eq_attr "cpu" "ppc620,ppc630"))
112 (define_insn_reservation "ppc620-imul3" 3
113 (and (eq_attr "type" "imul3")
114 (eq_attr "cpu" "ppc620,ppc630"))
117 (define_insn_reservation "ppc620-lmul" 7
118 (and (eq_attr "type" "lmul,lmul_compare")
119 (eq_attr "cpu" "ppc620,ppc630"))
122 (define_insn_reservation "ppc604-idiv" 20
123 (and (eq_attr "type" "idiv")
124 (eq_attr "cpu" "ppc604,ppc604e"))
127 (define_insn_reservation "ppc620-idiv" 37
128 (and (eq_attr "type" "idiv")
129 (eq_attr "cpu" "ppc620"))
132 (define_insn_reservation "ppc630-idiv" 21
133 (and (eq_attr "type" "idiv")
134 (eq_attr "cpu" "ppc630"))
137 (define_insn_reservation "ppc620-ldiv" 37
138 (and (eq_attr "type" "ldiv")
139 (eq_attr "cpu" "ppc620,ppc630"))
142 (define_insn_reservation "ppc604-compare" 3
143 (and (eq_attr "type" "cmp,fast_compare,compare,delayed_compare,\
144 var_delayed_compare")
145 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
148 ; FPU PPC604{,e},PPC620
149 (define_insn_reservation "ppc604-fpcompare" 5
150 (and (eq_attr "type" "fpcompare")
151 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
154 (define_insn_reservation "ppc604-fp" 3
155 (and (eq_attr "type" "fp")
156 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
159 (define_insn_reservation "ppc604-dmul" 3
160 (and (eq_attr "type" "dmul")
161 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
164 ; Divides are not pipelined
165 (define_insn_reservation "ppc604-sdiv" 18
166 (and (eq_attr "type" "sdiv")
167 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
170 (define_insn_reservation "ppc604-ddiv" 32
171 (and (eq_attr "type" "ddiv")
172 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
175 (define_insn_reservation "ppc620-ssqrt" 31
176 (and (eq_attr "type" "ssqrt")
177 (eq_attr "cpu" "ppc620"))
180 (define_insn_reservation "ppc620-dsqrt" 31
181 (and (eq_attr "type" "dsqrt")
182 (eq_attr "cpu" "ppc620"))
187 (define_insn_reservation "ppc630-fpcompare" 5
188 (and (eq_attr "type" "fpcompare")
189 (eq_attr "cpu" "ppc630"))
192 (define_insn_reservation "ppc630-fp" 3
193 (and (eq_attr "type" "fp,dmul")
194 (eq_attr "cpu" "ppc630"))
197 (define_insn_reservation "ppc630-sdiv" 17
198 (and (eq_attr "type" "sdiv")
199 (eq_attr "cpu" "ppc630"))
200 "fpu1_6xx*17|fpu2_6xx*17")
202 (define_insn_reservation "ppc630-ddiv" 21
203 (and (eq_attr "type" "ddiv")
204 (eq_attr "cpu" "ppc630"))
205 "fpu1_6xx*21|fpu2_6xx*21")
207 (define_insn_reservation "ppc630-ssqrt" 18
208 (and (eq_attr "type" "ssqrt")
209 (eq_attr "cpu" "ppc630"))
210 "fpu1_6xx*18|fpu2_6xx*18")
212 (define_insn_reservation "ppc630-dsqrt" 25
213 (and (eq_attr "type" "dsqrt")
214 (eq_attr "cpu" "ppc630"))
215 "fpu1_6xx*25|fpu2_6xx*25")
217 (define_insn_reservation "ppc604-mfcr" 3
218 (and (eq_attr "type" "mfcr")
219 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
222 (define_insn_reservation "ppc604-mtcr" 2
223 (and (eq_attr "type" "mtcr")
224 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
227 (define_insn_reservation "ppc604-crlogical" 2
228 (and (eq_attr "type" "cr_logical,delayed_cr")
229 (eq_attr "cpu" "ppc604"))
232 (define_insn_reservation "ppc604e-crlogical" 2
233 (and (eq_attr "type" "cr_logical,delayed_cr")
234 (eq_attr "cpu" "ppc604e,ppc620,ppc630"))
237 (define_insn_reservation "ppc604-mtjmpr" 2
238 (and (eq_attr "type" "mtjmpr")
239 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
242 (define_insn_reservation "ppc604-mfjmpr" 3
243 (and (eq_attr "type" "mfjmpr")
244 (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
247 (define_insn_reservation "ppc630-mfjmpr" 2
248 (and (eq_attr "type" "mfjmpr")
249 (eq_attr "cpu" "ppc630"))
252 (define_insn_reservation "ppc604-jmpreg" 1
253 (and (eq_attr "type" "jmpreg,branch")
254 (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
257 (define_insn_reservation "ppc604-isync" 0
258 (and (eq_attr "type" "isync")
259 (eq_attr "cpu" "ppc604,ppc604e"))
262 (define_insn_reservation "ppc630-isync" 6
263 (and (eq_attr "type" "isync")
264 (eq_attr "cpu" "ppc620,ppc630"))
267 (define_insn_reservation "ppc604-sync" 35
268 (and (eq_attr "type" "sync")
269 (eq_attr "cpu" "ppc604,ppc604e"))
272 (define_insn_reservation "ppc630-sync" 26
273 (and (eq_attr "type" "sync")
274 (eq_attr "cpu" "ppc620,ppc630"))