sh4.md revision 1.1 1 1.1 mrg ;; DFA scheduling description for SH4.
2 1.1 mrg ;; Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
3 1.1 mrg
4 1.1 mrg ;; This file is part of GCC.
5 1.1 mrg
6 1.1 mrg ;; GCC is free software; you can redistribute it and/or modify
7 1.1 mrg ;; it under the terms of the GNU General Public License as published by
8 1.1 mrg ;; the Free Software Foundation; either version 3, or (at your option)
9 1.1 mrg ;; any later version.
10 1.1 mrg
11 1.1 mrg ;; GCC is distributed in the hope that it will be useful,
12 1.1 mrg ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 1.1 mrg ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 1.1 mrg ;; GNU General Public License for more details.
15 1.1 mrg
16 1.1 mrg ;; You should have received a copy of the GNU General Public License
17 1.1 mrg ;; along with GCC; see the file COPYING3. If not see
18 1.1 mrg ;; <http://www.gnu.org/licenses/>.
19 1.1 mrg
20 1.1 mrg ;; Load and store instructions save a cycle if they are aligned on a
21 1.1 mrg ;; four byte boundary. Using a function unit for stores encourages
22 1.1 mrg ;; gcc to separate load and store instructions by one instruction,
23 1.1 mrg ;; which makes it more likely that the linker will be able to word
24 1.1 mrg ;; align them when relaxing.
25 1.1 mrg
26 1.1 mrg ;; The following description models the SH4 pipeline using the DFA based
27 1.1 mrg ;; scheduler. The DFA based description is better way to model a
28 1.1 mrg ;; superscalar pipeline as compared to function unit reservation model.
29 1.1 mrg ;; 1. The function unit based model is oriented to describe at most one
30 1.1 mrg ;; unit reservation by each insn. It is difficult to model unit reservations
31 1.1 mrg ;; in multiple pipeline units by same insn. This can be done using DFA
32 1.1 mrg ;; based description.
33 1.1 mrg ;; 2. The execution performance of DFA based scheduler does not depend on
34 1.1 mrg ;; processor complexity.
35 1.1 mrg ;; 3. Writing all unit reservations for an instruction class is a more natural
36 1.1 mrg ;; description of the pipeline and makes the interface to the hazard
37 1.1 mrg ;; recognizer simpler than the old function unit based model.
38 1.1 mrg ;; 4. The DFA model is richer and is a part of greater overall framework
39 1.1 mrg ;; of RCSP.
40 1.1 mrg
41 1.1 mrg
42 1.1 mrg ;; Two automata are defined to reduce number of states
43 1.1 mrg ;; which a single large automaton will have. (Factoring)
44 1.1 mrg
45 1.1 mrg (define_automaton "inst_pipeline,fpu_pipe")
46 1.1 mrg
47 1.1 mrg ;; This unit is basically the decode unit of the processor.
48 1.1 mrg ;; Since SH4 is a dual issue machine,it is as if there are two
49 1.1 mrg ;; units so that any insn can be processed by either one
50 1.1 mrg ;; of the decoding unit.
51 1.1 mrg
52 1.1 mrg (define_cpu_unit "pipe_01,pipe_02" "inst_pipeline")
53 1.1 mrg
54 1.1 mrg
55 1.1 mrg ;; The fixed point arithmetic calculator(?? EX Unit).
56 1.1 mrg
57 1.1 mrg (define_cpu_unit "int" "inst_pipeline")
58 1.1 mrg
59 1.1 mrg ;; f1_1 and f1_2 are floating point units.Actually there is
60 1.1 mrg ;; a f1 unit which can overlap with other f1 unit but
61 1.1 mrg ;; not another F1 unit.It is as though there were two
62 1.1 mrg ;; f1 units.
63 1.1 mrg
64 1.1 mrg (define_cpu_unit "f1_1,f1_2" "fpu_pipe")
65 1.1 mrg
66 1.1 mrg ;; The floating point units (except FS - F2 always precedes it.)
67 1.1 mrg
68 1.1 mrg (define_cpu_unit "F0,F1,F2,F3" "fpu_pipe")
69 1.1 mrg
70 1.1 mrg ;; This is basically the MA unit of SH4
71 1.1 mrg ;; used in LOAD/STORE pipeline.
72 1.1 mrg
73 1.1 mrg (define_cpu_unit "memory" "inst_pipeline")
74 1.1 mrg
75 1.1 mrg ;; However, there are LS group insns that don't use it, even ones that
76 1.1 mrg ;; complete in 0 cycles. So we use an extra unit for the issue of LS insns.
77 1.1 mrg (define_cpu_unit "load_store" "inst_pipeline")
78 1.1 mrg
79 1.1 mrg ;; The address calculator used for branch instructions.
80 1.1 mrg ;; This will be reserved after "issue" of branch instructions
81 1.1 mrg ;; and this is to make sure that no two branch instructions
82 1.1 mrg ;; can be issued in parallel.
83 1.1 mrg
84 1.1 mrg (define_cpu_unit "pcr_addrcalc" "inst_pipeline")
85 1.1 mrg
86 1.1 mrg ;; ----------------------------------------------------
87 1.1 mrg ;; This reservation is to simplify the dual issue description.
88 1.1 mrg
89 1.1 mrg (define_reservation "issue" "pipe_01|pipe_02")
90 1.1 mrg
91 1.1 mrg ;; This is to express the locking of D stage.
92 1.1 mrg ;; Note that the issue of a CO group insn also effectively locks the D stage.
93 1.1 mrg
94 1.1 mrg (define_reservation "d_lock" "pipe_01+pipe_02")
95 1.1 mrg
96 1.1 mrg ;; Every FE instruction but fipr / ftrv starts with issue and this.
97 1.1 mrg (define_reservation "F01" "F0+F1")
98 1.1 mrg
99 1.1 mrg ;; This is to simplify description where F1,F2,FS
100 1.1 mrg ;; are used simultaneously.
101 1.1 mrg
102 1.1 mrg (define_reservation "fpu" "F1+F2")
103 1.1 mrg
104 1.1 mrg ;; This is to highlight the fact that f1
105 1.1 mrg ;; cannot overlap with F1.
106 1.1 mrg
107 1.1 mrg (exclusion_set "f1_1,f1_2" "F1")
108 1.1 mrg
109 1.1 mrg (define_insn_reservation "nil" 0 (eq_attr "type" "nil") "nothing")
110 1.1 mrg
111 1.1 mrg ;; Although reg moves have a latency of zero
112 1.1 mrg ;; we need to highlight that they use D stage
113 1.1 mrg ;; for one cycle.
114 1.1 mrg
115 1.1 mrg ;; Group: MT
116 1.1 mrg
117 1.1 mrg (define_insn_reservation "reg_mov" 0
118 1.1 mrg (and (eq_attr "pipe_model" "sh4")
119 1.1 mrg (eq_attr "type" "move"))
120 1.1 mrg "issue")
121 1.1 mrg
122 1.1 mrg ;; Group: LS
123 1.1 mrg
124 1.1 mrg (define_insn_reservation "freg_mov" 0
125 1.1 mrg (and (eq_attr "pipe_model" "sh4")
126 1.1 mrg (eq_attr "type" "fmove"))
127 1.1 mrg "issue+load_store")
128 1.1 mrg
129 1.1 mrg ;; We don't model all pipeline stages; we model the issue ('D') stage
130 1.1 mrg ;; inasmuch as we allow only two instructions to issue simultaneously,
131 1.1 mrg ;; and CO instructions prevent any simultaneous issue of another instruction.
132 1.1 mrg ;; (This uses pipe_01 and pipe_02).
133 1.1 mrg ;; Double issue of EX insns is prevented by using the int unit in the EX stage.
134 1.1 mrg ;; Double issue of EX / BR insns is prevented by using the int unit /
135 1.1 mrg ;; pcr_addrcalc unit in the EX stage.
136 1.1 mrg ;; Double issue of BR / LS instructions is prevented by using the
137 1.1 mrg ;; pcr_addrcalc / load_store unit in the issue cycle.
138 1.1 mrg ;; Double issue of FE instructions is prevented by using F0 in the first
139 1.1 mrg ;; pipeline stage after the first D stage.
140 1.1 mrg ;; There is no need to describe the [ES]X / [MN]A / S stages after a D stage
141 1.1 mrg ;; (except in the cases outlined above), nor to describe the FS stage after
142 1.1 mrg ;; the F2 stage.
143 1.1 mrg
144 1.1 mrg ;; Other MT group instructions(1 step operations)
145 1.1 mrg ;; Group: MT
146 1.1 mrg ;; Latency: 1
147 1.1 mrg ;; Issue Rate: 1
148 1.1 mrg
149 1.1 mrg (define_insn_reservation "mt" 1
150 1.1 mrg (and (eq_attr "pipe_model" "sh4")
151 1.1 mrg (eq_attr "type" "mt_group"))
152 1.1 mrg "issue")
153 1.1 mrg
154 1.1 mrg ;; Fixed Point Arithmetic Instructions(1 step operations)
155 1.1 mrg ;; Group: EX
156 1.1 mrg ;; Latency: 1
157 1.1 mrg ;; Issue Rate: 1
158 1.1 mrg
159 1.1 mrg (define_insn_reservation "sh4_simple_arith" 1
160 1.1 mrg (and (eq_attr "pipe_model" "sh4")
161 1.1 mrg (eq_attr "insn_class" "ex_group"))
162 1.1 mrg "issue,int")
163 1.1 mrg
164 1.1 mrg ;; Load and store instructions have no alignment peculiarities for the SH4,
165 1.1 mrg ;; but they use the load-store unit, which they share with the fmove type
166 1.1 mrg ;; insns (fldi[01]; fmov frn,frm; flds; fsts; fabs; fneg) .
167 1.1 mrg ;; Loads have a latency of two.
168 1.1 mrg ;; However, call insns can only paired with a preceding insn, and have
169 1.1 mrg ;; a delay slot, so that we want two more insns to be scheduled between the
170 1.1 mrg ;; load of the function address and the call. This is equivalent to a
171 1.1 mrg ;; latency of three.
172 1.1 mrg ;; ADJUST_COST can only properly handle reductions of the cost, so we
173 1.1 mrg ;; use a latency of three here, which gets multiplied by 10 to yield 30.
174 1.1 mrg ;; We only do this for SImode loads of general registers, to make the work
175 1.1 mrg ;; for ADJUST_COST easier.
176 1.1 mrg
177 1.1 mrg ;; Load Store instructions. (MOV.[BWL]@(d,GBR)
178 1.1 mrg ;; Group: LS
179 1.1 mrg ;; Latency: 2
180 1.1 mrg ;; Issue Rate: 1
181 1.1 mrg
182 1.1 mrg (define_insn_reservation "sh4_load" 2
183 1.1 mrg (and (eq_attr "pipe_model" "sh4")
184 1.1 mrg (eq_attr "type" "load,pcload"))
185 1.1 mrg "issue+load_store,nothing,memory")
186 1.1 mrg
187 1.1 mrg ;; calls / sfuncs need an extra instruction for their delay slot.
188 1.1 mrg ;; Moreover, estimating the latency for SImode loads as 3 will also allow
189 1.1 mrg ;; adjust_cost to meaningfully bump it back up to 3 if they load the shift
190 1.1 mrg ;; count of a dynamic shift.
191 1.1 mrg (define_insn_reservation "sh4_load_si" 3
192 1.1 mrg (and (eq_attr "pipe_model" "sh4")
193 1.1 mrg (eq_attr "type" "load_si,pcload_si"))
194 1.1 mrg "issue+load_store,nothing,memory")
195 1.1 mrg
196 1.1 mrg ;; (define_bypass 2 "sh4_load_si" "!sh4_call")
197 1.1 mrg
198 1.1 mrg ;; The load latency is upped to three higher if the dependent insn does
199 1.1 mrg ;; double precision computation. We want the 'default' latency to reflect
200 1.1 mrg ;; that increased latency because otherwise the insn priorities won't
201 1.1 mrg ;; allow proper scheduling.
202 1.1 mrg (define_insn_reservation "sh4_fload" 3
203 1.1 mrg (and (eq_attr "pipe_model" "sh4")
204 1.1 mrg (eq_attr "type" "fload,pcfload"))
205 1.1 mrg "issue+load_store,nothing,memory")
206 1.1 mrg
207 1.1 mrg ;; (define_bypass 2 "sh4_fload" "!")
208 1.1 mrg
209 1.1 mrg (define_insn_reservation "sh4_store" 1
210 1.1 mrg (and (eq_attr "pipe_model" "sh4")
211 1.1 mrg (eq_attr "type" "store,fstore"))
212 1.1 mrg "issue+load_store,nothing,memory")
213 1.1 mrg
214 1.1 mrg (define_insn_reservation "mac_mem" 1
215 1.1 mrg (and (eq_attr "pipe_model" "sh4")
216 1.1 mrg (eq_attr "type" "mac_mem"))
217 1.1 mrg "d_lock,nothing,memory")
218 1.1 mrg
219 1.1 mrg ;; Load Store instructions.
220 1.1 mrg ;; Group: LS
221 1.1 mrg ;; Latency: 1
222 1.1 mrg ;; Issue Rate: 1
223 1.1 mrg
224 1.1 mrg (define_insn_reservation "sh4_gp_fpul" 1
225 1.1 mrg (and (eq_attr "pipe_model" "sh4")
226 1.1 mrg (eq_attr "type" "gp_fpul"))
227 1.1 mrg "issue+load_store")
228 1.1 mrg
229 1.1 mrg ;; Load Store instructions.
230 1.1 mrg ;; Group: LS
231 1.1 mrg ;; Latency: 3
232 1.1 mrg ;; Issue Rate: 1
233 1.1 mrg
234 1.1 mrg (define_insn_reservation "sh4_fpul_gp" 3
235 1.1 mrg (and (eq_attr "pipe_model" "sh4")
236 1.1 mrg (eq_attr "type" "fpul_gp"))
237 1.1 mrg "issue+load_store")
238 1.1 mrg
239 1.1 mrg ;; Branch (BF,BF/S,BT,BT/S,BRA)
240 1.1 mrg ;; Group: BR
241 1.1 mrg ;; Latency when taken: 2 (or 1)
242 1.1 mrg ;; Issue Rate: 1
243 1.1 mrg ;; The latency is 1 when displacement is 0.
244 1.1 mrg ;; We can't really do much with the latency, even if we could express it,
245 1.1 mrg ;; but the pairing restrictions are useful to take into account.
246 1.1 mrg ;; ??? If the branch is likely, we might want to fill the delay slot;
247 1.1 mrg ;; if the branch is likely, but not very likely, should we pretend to use
248 1.1 mrg ;; a resource that CO instructions use, to get a pairable delay slot insn?
249 1.1 mrg
250 1.1 mrg (define_insn_reservation "sh4_branch" 1
251 1.1 mrg (and (eq_attr "pipe_model" "sh4")
252 1.1 mrg (eq_attr "type" "cbranch,jump"))
253 1.1 mrg "issue+pcr_addrcalc")
254 1.1 mrg
255 1.1 mrg ;; Branch Far (JMP,RTS,BRAF)
256 1.1 mrg ;; Group: CO
257 1.1 mrg ;; Latency: 3
258 1.1 mrg ;; Issue Rate: 2
259 1.1 mrg ;; ??? Scheduling happens before branch shortening, and hence jmp and braf
260 1.1 mrg ;; can't be distinguished from bra for the "jump" pattern.
261 1.1 mrg
262 1.1 mrg (define_insn_reservation "sh4_return" 3
263 1.1 mrg (and (eq_attr "pipe_model" "sh4")
264 1.1 mrg (eq_attr "type" "return,jump_ind"))
265 1.1 mrg "d_lock*2")
266 1.1 mrg
267 1.1 mrg ;; RTE
268 1.1 mrg ;; Group: CO
269 1.1 mrg ;; Latency: 5
270 1.1 mrg ;; Issue Rate: 5
271 1.1 mrg ;; this instruction can be executed in any of the pipelines
272 1.1 mrg ;; and blocks the pipeline for next 4 stages.
273 1.1 mrg
274 1.1 mrg (define_insn_reservation "sh4_return_from_exp" 5
275 1.1 mrg (and (eq_attr "pipe_model" "sh4")
276 1.1 mrg (eq_attr "type" "rte"))
277 1.1 mrg "d_lock*5")
278 1.1 mrg
279 1.1 mrg ;; OCBP, OCBWB
280 1.1 mrg ;; Group: CO
281 1.1 mrg ;; Latency: 1-5
282 1.1 mrg ;; Issue Rate: 1
283 1.1 mrg
284 1.1 mrg ;; cwb is used for the sequence ocbwb @%0; extu.w %0,%2; or %1,%2; mov.l %0,@%2
285 1.1 mrg ;; ocbwb on its own would be "d_lock,nothing,memory*5"
286 1.1 mrg (define_insn_reservation "ocbwb" 6
287 1.1 mrg (and (eq_attr "pipe_model" "sh4")
288 1.1 mrg (eq_attr "type" "cwb"))
289 1.1 mrg "d_lock*2,(d_lock+memory)*3,issue+load_store+memory,memory*2")
290 1.1 mrg
291 1.1 mrg ;; LDS to PR,JSR
292 1.1 mrg ;; Group: CO
293 1.1 mrg ;; Latency: 3
294 1.1 mrg ;; Issue Rate: 2
295 1.1 mrg ;; The SX stage is blocked for last 2 cycles.
296 1.1 mrg ;; OTOH, the only time that has an effect for insns generated by the compiler
297 1.1 mrg ;; is when lds to PR is followed by sts from PR - and that is highly unlikely -
298 1.1 mrg ;; or when we are doing a function call - and we don't do inter-function
299 1.1 mrg ;; scheduling. For the function call case, it's really best that we end with
300 1.1 mrg ;; something that models an rts.
301 1.1 mrg
302 1.1 mrg (define_insn_reservation "sh4_lds_to_pr" 3
303 1.1 mrg (and (eq_attr "pipe_model" "sh4")
304 1.1 mrg (eq_attr "type" "prset") )
305 1.1 mrg "d_lock*2")
306 1.1 mrg
307 1.1 mrg ;; calls introduce a longisch delay that is likely to flush the pipelines
308 1.1 mrg ;; of the caller's instructions. Ordinary functions tend to end with a
309 1.1 mrg ;; load to restore a register (in the delay slot of rts), while sfuncs
310 1.1 mrg ;; tend to end with an EX or MT insn. But that is not actually relevant,
311 1.1 mrg ;; since there are no instructions that contend for memory access early.
312 1.1 mrg ;; We could, of course, provide exact scheduling information for specific
313 1.1 mrg ;; sfuncs, if that should prove useful.
314 1.1 mrg
315 1.1 mrg (define_insn_reservation "sh4_call" 16
316 1.1 mrg (and (eq_attr "pipe_model" "sh4")
317 1.1 mrg (eq_attr "type" "call,sfunc"))
318 1.1 mrg "d_lock*16")
319 1.1 mrg
320 1.1 mrg ;; LDS.L to PR
321 1.1 mrg ;; Group: CO
322 1.1 mrg ;; Latency: 3
323 1.1 mrg ;; Issue Rate: 2
324 1.1 mrg ;; The SX unit is blocked for last 2 cycles.
325 1.1 mrg
326 1.1 mrg (define_insn_reservation "ldsmem_to_pr" 3
327 1.1 mrg (and (eq_attr "pipe_model" "sh4")
328 1.1 mrg (eq_attr "type" "pload"))
329 1.1 mrg "d_lock*2")
330 1.1 mrg
331 1.1 mrg ;; STS from PR
332 1.1 mrg ;; Group: CO
333 1.1 mrg ;; Latency: 2
334 1.1 mrg ;; Issue Rate: 2
335 1.1 mrg ;; The SX unit in second and third cycles.
336 1.1 mrg
337 1.1 mrg (define_insn_reservation "sts_from_pr" 2
338 1.1 mrg (and (eq_attr "pipe_model" "sh4")
339 1.1 mrg (eq_attr "type" "prget"))
340 1.1 mrg "d_lock*2")
341 1.1 mrg
342 1.1 mrg ;; STS.L from PR
343 1.1 mrg ;; Group: CO
344 1.1 mrg ;; Latency: 2
345 1.1 mrg ;; Issue Rate: 2
346 1.1 mrg
347 1.1 mrg (define_insn_reservation "sh4_prstore_mem" 2
348 1.1 mrg (and (eq_attr "pipe_model" "sh4")
349 1.1 mrg (eq_attr "type" "pstore"))
350 1.1 mrg "d_lock*2,nothing,memory")
351 1.1 mrg
352 1.1 mrg ;; LDS to FPSCR
353 1.1 mrg ;; Group: CO
354 1.1 mrg ;; Latency: 4
355 1.1 mrg ;; Issue Rate: 1
356 1.1 mrg ;; F1 is blocked for last three cycles.
357 1.1 mrg
358 1.1 mrg (define_insn_reservation "fpscr_load" 4
359 1.1 mrg (and (eq_attr "pipe_model" "sh4")
360 1.1 mrg (eq_attr "type" "gp_fpscr"))
361 1.1 mrg "d_lock,nothing,F1*3")
362 1.1 mrg
363 1.1 mrg ;; LDS.L to FPSCR
364 1.1 mrg ;; Group: CO
365 1.1 mrg ;; Latency: 1 / 4
366 1.1 mrg ;; Latency to update Rn is 1 and latency to update FPSCR is 4
367 1.1 mrg ;; Issue Rate: 1
368 1.1 mrg ;; F1 is blocked for last three cycles.
369 1.1 mrg
370 1.1 mrg (define_insn_reservation "fpscr_load_mem" 4
371 1.1 mrg (and (eq_attr "pipe_model" "sh4")
372 1.1 mrg (eq_attr "type" "mem_fpscr"))
373 1.1 mrg "d_lock,nothing,(F1+memory),F1*2")
374 1.1 mrg
375 1.1 mrg
377 1.1 mrg ;; Fixed point multiplication (DMULS.L DMULU.L MUL.L MULS.W,MULU.W)
378 1.1 mrg ;; Group: CO
379 1.1 mrg ;; Latency: 4 / 4
380 1.1 mrg ;; Issue Rate: 2
381 1.1 mrg
382 1.1 mrg (define_insn_reservation "multi" 4
383 1.1 mrg (and (eq_attr "pipe_model" "sh4")
384 1.1 mrg (eq_attr "type" "smpy,dmpy"))
385 1.1 mrg "d_lock,(d_lock+f1_1),(f1_1|f1_2)*3,F2")
386 1.1 mrg
387 1.1 mrg ;; Fixed STS from, and LDS to MACL / MACH
388 1.1 mrg ;; Group: CO
389 1.1 mrg ;; Latency: 3
390 1.1 mrg ;; Issue Rate: 1
391 1.1 mrg
392 1.1 mrg (define_insn_reservation "sh4_mac_gp" 3
393 1.1 mrg (and (eq_attr "pipe_model" "sh4")
394 1.1 mrg (eq_attr "type" "mac_gp,gp_mac,mem_mac"))
395 1.1 mrg "d_lock")
396 1.1 mrg
397 1.1 mrg
398 1.1 mrg ;; Single precision floating point computation FCMP/EQ,
399 1.1 mrg ;; FCMP/GT, FADD, FLOAT, FMAC, FMUL, FSUB, FTRC, FRCHG, FSCHG
400 1.1 mrg ;; Group: FE
401 1.1 mrg ;; Latency: 3/4
402 1.1 mrg ;; Issue Rate: 1
403 1.1 mrg
404 1.1 mrg (define_insn_reservation "fp_arith" 3
405 1.1 mrg (and (eq_attr "pipe_model" "sh4")
406 1.1 mrg (eq_attr "type" "fp,fp_cmp"))
407 1.1 mrg "issue,F01,F2")
408 1.1 mrg
409 1.1 mrg ;; We don't model the resource usage of this exactly because that would
410 1.1 mrg ;; introduce a bogus latency.
411 1.1 mrg (define_insn_reservation "sh4_fpscr_toggle" 1
412 1.1 mrg (and (eq_attr "pipe_model" "sh4")
413 1.1 mrg (eq_attr "type" "fpscr_toggle"))
414 1.1 mrg "issue")
415 1.1 mrg
416 1.1 mrg (define_insn_reservation "fp_arith_ftrc" 3
417 1.1 mrg (and (eq_attr "pipe_model" "sh4")
418 1.1 mrg (eq_attr "type" "ftrc_s"))
419 1.1 mrg "issue,F01,F2")
420 1.1 mrg
421 1.1 mrg (define_bypass 1 "fp_arith_ftrc" "sh4_fpul_gp")
422 1.1 mrg
423 1.1 mrg ;; Single Precision FDIV/SQRT
424 1.1 mrg ;; Group: FE
425 1.1 mrg ;; Latency: 12/13 (FDIV); 11/12 (FSQRT)
426 1.1 mrg ;; Issue Rate: 1
427 1.1 mrg ;; We describe fdiv here; fsqrt is actually one cycle faster.
428 1.1 mrg
429 1.1 mrg (define_insn_reservation "fp_div" 12
430 1.1 mrg (and (eq_attr "pipe_model" "sh4")
431 1.1 mrg (eq_attr "type" "fdiv"))
432 1.1 mrg "issue,F01+F3,F2+F3,F3*7,F1+F3,F2")
433 1.1 mrg
434 1.1 mrg ;; Double Precision floating point computation
435 1.1 mrg ;; (FCNVDS, FCNVSD, FLOAT, FTRC)
436 1.1 mrg ;; Group: FE
437 1.1 mrg ;; Latency: (3,4)/5
438 1.1 mrg ;; Issue Rate: 1
439 1.1 mrg
440 1.1 mrg (define_insn_reservation "dp_float" 4
441 1.1 mrg (and (eq_attr "pipe_model" "sh4")
442 1.1 mrg (eq_attr "type" "dfp_conv"))
443 1.1 mrg "issue,F01,F1+F2,F2")
444 1.1 mrg
445 1.1 mrg ;; Double-precision floating-point (FADD,FMUL,FSUB)
446 1.1 mrg ;; Group: FE
447 1.1 mrg ;; Latency: (7,8)/9
448 1.1 mrg ;; Issue Rate: 1
449 1.1 mrg
450 1.1 mrg (define_insn_reservation "fp_double_arith" 8
451 1.1 mrg (and (eq_attr "pipe_model" "sh4")
452 1.1 mrg (eq_attr "type" "dfp_arith,dfp_mul"))
453 1.1 mrg "issue,F01,F1+F2,fpu*4,F2")
454 1.1 mrg
455 1.1 mrg ;; Double-precision FCMP (FCMP/EQ,FCMP/GT)
456 1.1 mrg ;; Group: CO
457 1.1 mrg ;; Latency: 3/5
458 1.1 mrg ;; Issue Rate: 2
459 1.1 mrg
460 1.1 mrg (define_insn_reservation "fp_double_cmp" 3
461 1.1 mrg (and (eq_attr "pipe_model" "sh4")
462 1.1 mrg (eq_attr "type" "dfp_cmp"))
463 1.1 mrg "d_lock,(d_lock+F01),F1+F2,F2")
464 1.1 mrg
465 1.1 mrg ;; Double precision FDIV/SQRT
466 1.1 mrg ;; Group: FE
467 1.1 mrg ;; Latency: (24,25)/26
468 1.1 mrg ;; Issue Rate: 1
469 1.1 mrg
470 1.1 mrg (define_insn_reservation "dp_div" 25
471 1.1 mrg (and (eq_attr "pipe_model" "sh4")
472 1.1 mrg (eq_attr "type" "dfdiv"))
473 1.1 mrg "issue,F01+F3,F1+F2+F3,F2+F3,F3*16,F1+F3,(fpu+F3)*2,F2")
474 1.1 mrg
475 1.1 mrg
476 1.1 mrg ;; Use the branch-not-taken case to model arith3 insns. For the branch taken
477 1.1 mrg ;; case, we'd get a d_lock instead of issue at the end.
478 1.1 mrg (define_insn_reservation "arith3" 3
479 1.1 mrg (and (eq_attr "pipe_model" "sh4")
480 1.1 mrg (eq_attr "type" "arith3"))
481 1.1 mrg "issue,d_lock+pcr_addrcalc,issue")
482 1.1 mrg
483 1.1 mrg ;; arith3b insns schedule the same no matter if the branch is taken or not.
484 1.1 mrg (define_insn_reservation "arith3b" 2
485 1.1 mrg (and (eq_attr "pipe_model" "sh4")
486 1.1 mrg (eq_attr "type" "arith3"))
487 "issue,d_lock+pcr_addrcalc")
488