1 ;; Scheduling description for Alpha EV5.
2 ;; Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 2, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING. If not, write to
18 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 ;; Boston, MA 02110-1301, USA.
21 ;; EV5 has two asymmetric integer units, E0 and E1, plus separate
22 ;; FP add and multiply units.
24 (define_automaton "ev5_0,ev5_1")
25 (define_cpu_unit "ev5_e0,ev5_e1,ev5_fa,ev5_fm" "ev5_0")
26 (define_reservation "ev5_e01" "ev5_e0|ev5_e1")
27 (define_reservation "ev5_fam" "ev5_fa|ev5_fm")
28 (define_cpu_unit "ev5_imul" "ev5_0")
29 (define_cpu_unit "ev5_fdiv" "ev5_1")
31 ; Assume type "multi" single issues.
32 (define_insn_reservation "ev5_multi" 1
33 (and (eq_attr "tune" "ev5")
34 (eq_attr "type" "multi"))
35 "ev5_e0+ev5_e1+ev5_fa+ev5_fm")
37 ; Stores can only issue to E0, and may not issue with loads.
38 ; Model this with some fake units.
40 (define_cpu_unit "ev5_l0,ev5_l1,ev5_st" "ev5_0")
41 (define_reservation "ev5_ld" "ev5_l0|ev5_l1")
42 (exclusion_set "ev5_l0,ev5_l1" "ev5_st")
44 (define_insn_reservation "ev5_st" 1
45 (and (eq_attr "tune" "ev5")
46 (eq_attr "type" "ist,fst,st_c,mb"))
49 ; Loads from L0 complete in two cycles. adjust_cost still factors
50 ; in user-specified memory latency, so return 1 here.
51 (define_insn_reservation "ev5_ld" 1
52 (and (eq_attr "tune" "ev5")
53 (eq_attr "type" "ild,fld,ldsym"))
56 (define_insn_reservation "ev5_ld_l" 1
57 (and (eq_attr "tune" "ev5")
58 (eq_attr "type" "ld_l"))
61 ; Integer branches slot only to E1.
62 (define_insn_reservation "ev5_ibr" 1
63 (and (eq_attr "tune" "ev5")
64 (eq_attr "type" "ibr"))
67 (define_insn_reservation "ev5_callpal" 1
68 (and (eq_attr "tune" "ev5")
69 (eq_attr "type" "callpal"))
72 (define_insn_reservation "ev5_jsr" 1
73 (and (eq_attr "tune" "ev5")
74 (eq_attr "type" "jsr"))
77 (define_insn_reservation "ev5_shift" 1
78 (and (eq_attr "tune" "ev5")
79 (eq_attr "type" "shift"))
82 (define_insn_reservation "ev5_mvi" 2
83 (and (eq_attr "tune" "ev5")
84 (eq_attr "type" "mvi"))
87 (define_insn_reservation "ev5_cmov" 2
88 (and (eq_attr "tune" "ev5")
89 (eq_attr "type" "icmov"))
92 (define_insn_reservation "ev5_iadd" 1
93 (and (eq_attr "tune" "ev5")
94 (eq_attr "type" "iadd"))
97 (define_insn_reservation "ev5_ilogcmp" 1
98 (and (eq_attr "tune" "ev5")
99 (eq_attr "type" "ilog,icmp"))
102 ; Conditional move and branch can issue the same cycle as the test.
103 (define_bypass 0 "ev5_ilogcmp" "ev5_ibr,ev5_cmov" "if_test_bypass_p")
105 ; Multiplies use a non-pipelined imul unit. Also, "no insn can be issued
106 ; to E0 exactly two cycles before an integer multiply completes".
108 (define_insn_reservation "ev5_imull" 8
109 (and (eq_attr "tune" "ev5")
110 (and (eq_attr "type" "imul")
111 (eq_attr "opsize" "si")))
112 "ev5_e0+ev5_imul,ev5_imul*3,nothing,ev5_e0")
114 (define_insn_reservation "ev5_imulq" 12
115 (and (eq_attr "tune" "ev5")
116 (and (eq_attr "type" "imul")
117 (eq_attr "opsize" "di")))
118 "ev5_e0+ev5_imul,ev5_imul*7,nothing,ev5_e0")
120 (define_insn_reservation "ev5_imulh" 14
121 (and (eq_attr "tune" "ev5")
122 (and (eq_attr "type" "imul")
123 (eq_attr "opsize" "udi")))
124 "ev5_e0+ev5_imul,ev5_imul*7,nothing*3,ev5_e0")
126 ; The multiplier is unable to receive data from Ebox bypass paths. The
127 ; instruction issues at the expected time, but its latency is increased
128 ; by the time it takes for the input data to become available to the
129 ; multiplier. For example, an IMULL instruction issued one cycle later
130 ; than an ADDL instruction, which produced one of its operands, has a
131 ; latency of 10 (8 + 2). If the IMULL instruction is issued two cycles
132 ; later than the ADDL instruction, the latency is 9 (8 + 1).
134 ; Model this instead with increased latency on the input instruction.
137 "ev5_ld,ev5_ld_l,ev5_shift,ev5_mvi,ev5_cmov,ev5_iadd,ev5_ilogcmp"
138 "ev5_imull,ev5_imulq,ev5_imulh")
140 (define_bypass 9 "ev5_imull" "ev5_imull,ev5_imulq,ev5_imulh")
141 (define_bypass 13 "ev5_imulq" "ev5_imull,ev5_imulq,ev5_imulh")
142 (define_bypass 15 "ev5_imulh" "ev5_imull,ev5_imulq,ev5_imulh")
144 ; Similarly for the FPU we have two asymmetric units.
146 (define_insn_reservation "ev5_fadd" 4
147 (and (eq_attr "tune" "ev5")
148 (eq_attr "type" "fadd,fcmov"))
151 (define_insn_reservation "ev5_fbr" 1
152 (and (eq_attr "tune" "ev5")
153 (eq_attr "type" "fbr"))
156 (define_insn_reservation "ev5_fcpys" 4
157 (and (eq_attr "tune" "ev5")
158 (eq_attr "type" "fcpys"))
161 (define_insn_reservation "ev5_fmul" 4
162 (and (eq_attr "tune" "ev5")
163 (eq_attr "type" "fmul"))
166 ; The floating point divider is not pipelined. Also, "no insn can be issued
167 ; to FA exactly five before an fdiv insn completes".
169 ; ??? Do not model this late reservation due to the enormously increased
170 ; size of the resulting DFA.
172 ; ??? Putting ev5_fa and ev5_fdiv alone into the same automata produces
173 ; a DFA of acceptable size, but putting ev5_fm and ev5_fa into separate
174 ; automata produces incorrect results for insns that can choose one or
175 ; the other, i.e. ev5_fcpys.
177 (define_insn_reservation "ev5_fdivsf" 15
178 (and (eq_attr "tune" "ev5")
179 (and (eq_attr "type" "fdiv")
180 (eq_attr "opsize" "si")))
181 ; "ev5_fa+ev5_fdiv,ev5_fdiv*9,ev5_fa+ev5_fdiv,ev5_fdiv*4"
182 "ev5_fa+ev5_fdiv,ev5_fdiv*14")
184 (define_insn_reservation "ev5_fdivdf" 22
185 (and (eq_attr "tune" "ev5")
186 (and (eq_attr "type" "fdiv")
187 (eq_attr "opsize" "di")))
188 ; "ev5_fa+ev5_fdiv,ev5_fdiv*17,ev5_fa+ev5_fdiv,ev5_fdiv*4"
189 "ev5_fa+ev5_fdiv,ev5_fdiv*21")
191 ; Traps don't consume or produce data; rpcc is latency 2 if we ever add it.
192 (define_insn_reservation "ev5_misc" 2
193 (and (eq_attr "tune" "ev5")
194 (eq_attr "type" "misc"))