1 ;; Scheduling description for IBM POWER7 processor.
2 ;; Copyright (C) 2009-2014 Free Software Foundation, Inc.
4 ;; Contributed by Pat Haugen (pthaugen@us.ibm.com).
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 3, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 (define_automaton "power7iu,power7lsu,power7vsu,power7misc")
24 (define_cpu_unit "iu1_power7,iu2_power7" "power7iu")
25 (define_cpu_unit "lsu1_power7,lsu2_power7" "power7lsu")
26 (define_cpu_unit "vsu1_power7,vsu2_power7" "power7vsu")
27 (define_cpu_unit "bpu_power7,cru_power7" "power7misc")
28 (define_cpu_unit "du1_power7,du2_power7,du3_power7,du4_power7,du5_power7"
32 (define_reservation "DU_power7"
33 "du1_power7|du2_power7|du3_power7|du4_power7")
35 (define_reservation "DU2F_power7"
36 "du1_power7+du2_power7")
38 (define_reservation "DU4_power7"
39 "du1_power7+du2_power7+du3_power7+du4_power7")
41 (define_reservation "FXU_power7"
42 "iu1_power7|iu2_power7")
44 (define_reservation "VSU_power7"
45 "vsu1_power7|vsu2_power7")
47 (define_reservation "LSU_power7"
48 "lsu1_power7|lsu2_power7")
51 ; Dispatch slots are allocated in order conforming to program order.
52 (absence_set "du1_power7" "du2_power7,du3_power7,du4_power7,du5_power7")
53 (absence_set "du2_power7" "du3_power7,du4_power7,du5_power7")
54 (absence_set "du3_power7" "du4_power7,du5_power7")
55 (absence_set "du4_power7" "du5_power7")
59 (define_insn_reservation "power7-load" 2
60 (and (eq_attr "type" "load")
61 (eq_attr "sign_extend" "no")
62 (eq_attr "update" "no")
63 (eq_attr "cpu" "power7"))
64 "DU_power7,LSU_power7")
66 (define_insn_reservation "power7-load-ext" 3
67 (and (eq_attr "type" "load")
68 (eq_attr "sign_extend" "yes")
69 (eq_attr "update" "no")
70 (eq_attr "cpu" "power7"))
71 "DU2F_power7,LSU_power7,FXU_power7")
73 (define_insn_reservation "power7-load-update" 2
74 (and (eq_attr "type" "load")
75 (eq_attr "sign_extend" "no")
76 (eq_attr "update" "yes")
77 (eq_attr "indexed" "no")
78 (eq_attr "cpu" "power7"))
79 "DU2F_power7,LSU_power7+FXU_power7")
81 (define_insn_reservation "power7-load-update-indexed" 3
82 (and (eq_attr "type" "load")
83 (eq_attr "sign_extend" "no")
84 (eq_attr "update" "yes")
85 (eq_attr "indexed" "yes")
86 (eq_attr "cpu" "power7"))
87 "DU4_power7,FXU_power7,LSU_power7+FXU_power7")
89 (define_insn_reservation "power7-load-ext-update" 4
90 (and (eq_attr "type" "load")
91 (eq_attr "sign_extend" "yes")
92 (eq_attr "update" "yes")
93 (eq_attr "indexed" "no")
94 (eq_attr "cpu" "power7"))
95 "DU2F_power7,LSU_power7+FXU_power7,FXU_power7")
97 (define_insn_reservation "power7-load-ext-update-indexed" 4
98 (and (eq_attr "type" "load")
99 (eq_attr "sign_extend" "yes")
100 (eq_attr "update" "yes")
101 (eq_attr "indexed" "yes")
102 (eq_attr "cpu" "power7"))
103 "DU4_power7,FXU_power7,LSU_power7+FXU_power7,FXU_power7")
105 (define_insn_reservation "power7-fpload" 3
106 (and (eq_attr "type" "fpload")
107 (eq_attr "update" "no")
108 (eq_attr "cpu" "power7"))
109 "DU_power7,LSU_power7")
111 (define_insn_reservation "power7-fpload-update" 3
112 (and (eq_attr "type" "fpload")
113 (eq_attr "update" "yes")
114 (eq_attr "cpu" "power7"))
115 "DU2F_power7,LSU_power7+FXU_power7")
117 (define_insn_reservation "power7-store" 6 ; store-forwarding latency
118 (and (eq_attr "type" "store")
119 (eq_attr "update" "no")
120 (eq_attr "cpu" "power7"))
121 "DU_power7,LSU_power7+FXU_power7")
123 (define_insn_reservation "power7-store-update" 6
124 (and (eq_attr "type" "store")
125 (eq_attr "update" "yes")
126 (eq_attr "indexed" "no")
127 (eq_attr "cpu" "power7"))
128 "DU2F_power7,LSU_power7+FXU_power7,FXU_power7")
130 (define_insn_reservation "power7-store-update-indexed" 6
131 (and (eq_attr "type" "store")
132 (eq_attr "update" "yes")
133 (eq_attr "indexed" "yes")
134 (eq_attr "cpu" "power7"))
135 "DU4_power7,LSU_power7+FXU_power7,FXU_power7")
137 (define_insn_reservation "power7-fpstore" 6
138 (and (eq_attr "type" "fpstore")
139 (eq_attr "update" "no")
140 (eq_attr "cpu" "power7"))
141 "DU_power7,LSU_power7+VSU_power7")
143 (define_insn_reservation "power7-fpstore-update" 6
144 (and (eq_attr "type" "fpstore")
145 (eq_attr "update" "yes")
146 (eq_attr "cpu" "power7"))
147 "DU_power7,LSU_power7+VSU_power7+FXU_power7")
149 (define_insn_reservation "power7-larx" 3
150 (and (eq_attr "type" "load_l")
151 (eq_attr "cpu" "power7"))
152 "DU4_power7,LSU_power7")
154 (define_insn_reservation "power7-stcx" 10
155 (and (eq_attr "type" "store_c")
156 (eq_attr "cpu" "power7"))
157 "DU4_power7,LSU_power7")
159 (define_insn_reservation "power7-vecload" 3
160 (and (eq_attr "type" "vecload")
161 (eq_attr "cpu" "power7"))
162 "DU_power7,LSU_power7")
164 (define_insn_reservation "power7-vecstore" 6
165 (and (eq_attr "type" "vecstore")
166 (eq_attr "cpu" "power7"))
167 "DU_power7,LSU_power7+vsu2_power7")
169 (define_insn_reservation "power7-sync" 11
170 (and (eq_attr "type" "sync")
171 (eq_attr "cpu" "power7"))
172 "DU4_power7,LSU_power7")
176 (define_insn_reservation "power7-integer" 1
177 (and (eq_attr "type" "integer,insert,shift,trap,\
178 var_shift_rotate,exts,isel,popcnt")
179 (eq_attr "cpu" "power7"))
180 "DU_power7,FXU_power7")
182 (define_insn_reservation "power7-cntlz" 2
183 (and (eq_attr "type" "cntlz")
184 (eq_attr "cpu" "power7"))
185 "DU_power7,FXU_power7")
187 (define_insn_reservation "power7-two" 2
188 (and (eq_attr "type" "two")
189 (eq_attr "cpu" "power7"))
190 "DU_power7+DU_power7,FXU_power7,FXU_power7")
192 (define_insn_reservation "power7-three" 3
193 (and (eq_attr "type" "three")
194 (eq_attr "cpu" "power7"))
195 "DU_power7+DU_power7+DU_power7,FXU_power7,FXU_power7,FXU_power7")
197 (define_insn_reservation "power7-cmp" 1
198 (and (eq_attr "type" "cmp,fast_compare")
199 (eq_attr "cpu" "power7"))
200 "DU_power7,FXU_power7")
202 (define_insn_reservation "power7-compare" 2
203 (and (eq_attr "type" "compare,delayed_compare,var_delayed_compare")
204 (eq_attr "cpu" "power7"))
205 "DU2F_power7,FXU_power7,FXU_power7")
207 (define_bypass 3 "power7-cmp,power7-compare" "power7-crlogical,power7-delayedcr")
209 (define_insn_reservation "power7-mul" 4
210 (and (eq_attr "type" "mul")
212 (eq_attr "cpu" "power7"))
213 "DU_power7,FXU_power7")
215 (define_insn_reservation "power7-mul-compare" 5
216 (and (eq_attr "type" "mul")
217 (eq_attr "dot" "yes")
218 (eq_attr "cpu" "power7"))
219 "DU2F_power7,FXU_power7,nothing*3,FXU_power7")
221 (define_insn_reservation "power7-idiv" 36
222 (and (eq_attr "type" "div")
223 (eq_attr "size" "32")
224 (eq_attr "cpu" "power7"))
225 "DU2F_power7,iu1_power7*36|iu2_power7*36")
227 (define_insn_reservation "power7-ldiv" 68
228 (and (eq_attr "type" "div")
229 (eq_attr "size" "64")
230 (eq_attr "cpu" "power7"))
231 "DU2F_power7,iu1_power7*68|iu2_power7*68")
233 (define_insn_reservation "power7-isync" 1 ;
234 (and (eq_attr "type" "isync")
235 (eq_attr "cpu" "power7"))
236 "DU4_power7,FXU_power7")
240 (define_insn_reservation "power7-mtjmpr" 4
241 (and (eq_attr "type" "mtjmpr")
242 (eq_attr "cpu" "power7"))
243 "du1_power7,FXU_power7")
245 (define_insn_reservation "power7-mfjmpr" 5
246 (and (eq_attr "type" "mfjmpr")
247 (eq_attr "cpu" "power7"))
248 "du1_power7,cru_power7+FXU_power7")
250 (define_insn_reservation "power7-crlogical" 3
251 (and (eq_attr "type" "cr_logical")
252 (eq_attr "cpu" "power7"))
253 "du1_power7,cru_power7")
255 (define_insn_reservation "power7-delayedcr" 3
256 (and (eq_attr "type" "delayed_cr")
257 (eq_attr "cpu" "power7"))
258 "du1_power7,cru_power7")
260 (define_insn_reservation "power7-mfcr" 6
261 (and (eq_attr "type" "mfcr")
262 (eq_attr "cpu" "power7"))
263 "du1_power7,cru_power7")
265 (define_insn_reservation "power7-mfcrf" 3
266 (and (eq_attr "type" "mfcrf")
267 (eq_attr "cpu" "power7"))
268 "du1_power7,cru_power7")
270 (define_insn_reservation "power7-mtcr" 3
271 (and (eq_attr "type" "mtcr")
272 (eq_attr "cpu" "power7"))
273 "DU4_power7,cru_power7+FXU_power7")
277 ; Branches take dispatch Slot 4. The presence_sets prevent other insn from
278 ; grabbing previous dispatch slots once this is assigned.
279 (define_insn_reservation "power7-branch" 3
280 (and (eq_attr "type" "jmpreg,branch")
281 (eq_attr "cpu" "power7"))
283 |du4_power7+du5_power7\
284 |du3_power7+du4_power7+du5_power7\
285 |du2_power7+du3_power7+du4_power7+du5_power7\
286 |du1_power7+du2_power7+du3_power7+du4_power7+du5_power7),bpu_power7")
289 ; VS Unit (includes FP/VSX/VMX/DFP)
290 (define_insn_reservation "power7-fp" 6
291 (and (eq_attr "type" "fp,dmul")
292 (eq_attr "cpu" "power7"))
293 "DU_power7,VSU_power7")
295 (define_bypass 8 "power7-fp" "power7-branch")
297 (define_insn_reservation "power7-fpcompare" 8
298 (and (eq_attr "type" "fpcompare")
299 (eq_attr "cpu" "power7"))
300 "DU_power7,VSU_power7")
302 (define_insn_reservation "power7-sdiv" 27
303 (and (eq_attr "type" "sdiv")
304 (eq_attr "cpu" "power7"))
305 "DU_power7,VSU_power7")
307 (define_insn_reservation "power7-ddiv" 33
308 (and (eq_attr "type" "ddiv")
309 (eq_attr "cpu" "power7"))
310 "DU_power7,VSU_power7")
312 (define_insn_reservation "power7-sqrt" 32
313 (and (eq_attr "type" "ssqrt")
314 (eq_attr "cpu" "power7"))
315 "DU_power7,VSU_power7")
317 (define_insn_reservation "power7-dsqrt" 44
318 (and (eq_attr "type" "dsqrt")
319 (eq_attr "cpu" "power7"))
320 "DU_power7,VSU_power7")
322 (define_insn_reservation "power7-vecsimple" 2
323 (and (eq_attr "type" "vecsimple,veccmp")
324 (eq_attr "cpu" "power7"))
325 "DU_power7,vsu1_power7")
327 (define_insn_reservation "power7-vecfloat" 6
328 (and (eq_attr "type" "vecfloat")
329 (eq_attr "cpu" "power7"))
330 "DU_power7,vsu1_power7")
332 (define_bypass 7 "power7-vecfloat" "power7-vecsimple,power7-veccomplex,\
335 (define_insn_reservation "power7-veccomplex" 7
336 (and (eq_attr "type" "veccomplex")
337 (eq_attr "cpu" "power7"))
338 "DU_power7,vsu1_power7")
340 (define_insn_reservation "power7-vecperm" 3
341 (and (eq_attr "type" "vecperm")
342 (eq_attr "cpu" "power7"))
343 "DU_power7,vsu2_power7")
345 (define_insn_reservation "power7-vecdouble" 6
346 (and (eq_attr "type" "vecdouble")
347 (eq_attr "cpu" "power7"))
348 "DU_power7,VSU_power7")
350 (define_bypass 7 "power7-vecdouble" "power7-vecsimple,power7-veccomplex,\
353 (define_insn_reservation "power7-vecfdiv" 26
354 (and (eq_attr "type" "vecfdiv")
355 (eq_attr "cpu" "power7"))
356 "DU_power7,VSU_power7")
358 (define_insn_reservation "power7-vecdiv" 32
359 (and (eq_attr "type" "vecdiv")
360 (eq_attr "cpu" "power7"))
361 "DU_power7,VSU_power7")