OSDN Git Service

832cf6be8f365a7394d2929c6dbb094ec0d435b0
[pf3gnuchains/gcc-fork.git] / gcc / config / alpha / ev5.md
1 ;; Scheduling description for Alpha EV5.
2 ;;   Copyright (C) 2002 Free Software Foundation, Inc.
3 ;;
4 ;; This file is part of GNU CC.
5 ;;
6 ;; GNU CC 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)
9 ;; any later version.
10 ;;
11 ;; GNU CC 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.
15 ;;
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GNU CC; see the file COPYING.  If not, write to
18 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
19 ;; Boston, MA 02111-1307, USA.
20
21 ;; EV5 has two asymetric integer units, E0 and E1, plus separate
22 ;; FP add and multiply units.
23
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")
30
31 ; Assume type "multi" single issues.
32 (define_insn_reservation "ev5_multi" 1
33   (and (eq_attr "cpu" "ev5")
34        (eq_attr "type" "multi"))
35   "ev5_e0+ev5_e1+ev5_fa+ev5_fm")
36
37 ; Stores can only issue to E0, and may not issue with loads.
38 ; Model this with some fake units.
39
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")
43
44 (define_insn_reservation "ev5_st" 1
45   (and (eq_attr "cpu" "ev5")
46        (eq_attr "type" "ist,fst"))
47   "ev5_e0+ev5_st")
48
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 "cpu" "ev5")
53        (eq_attr "type" "ild,fld,ldsym"))
54   "ev5_e01+ev5_ld")
55
56 ; Integer branches slot only to E1.
57 (define_insn_reservation "ev5_ibr" 1
58   (and (eq_attr "cpu" "ev5")
59        (eq_attr "type" "ibr"))
60   "ev5_e1")
61
62 (define_insn_reservation "ev5_callpal" 1
63   (and (eq_attr "cpu" "ev5")
64        (eq_attr "type" "callpal"))
65   "ev5_e1")
66
67 (define_insn_reservation "ev5_jsr" 1
68   (and (eq_attr "cpu" "ev5")
69        (eq_attr "type" "jsr"))
70   "ev5_e1")
71
72 (define_insn_reservation "ev5_shift" 1
73   (and (eq_attr "cpu" "ev5")
74        (eq_attr "type" "shift"))
75   "ev5_e0")
76
77 (define_insn_reservation "ev5_mvi" 2
78   (and (eq_attr "cpu" "ev5")
79        (eq_attr "type" "mvi"))
80   "ev5_e0")
81
82 (define_insn_reservation "ev5_cmov" 2
83   (and (eq_attr "cpu" "ev5")
84        (eq_attr "type" "icmov"))
85   "ev5_e01")
86
87 (define_insn_reservation "ev5_iadd" 1
88   (and (eq_attr "cpu" "ev5")
89        (eq_attr "type" "iadd"))
90   "ev5_e01")
91
92 (define_insn_reservation "ev5_ilogcmp" 1
93   (and (eq_attr "cpu" "ev5")
94        (eq_attr "type" "ilog,icmp"))
95   "ev5_e01")
96
97 ; Conditional move and branch can issue the same cycle as the test.
98 (define_bypass 0 "ev5_ilogcmp" "ev5_ibr,ev5_cmov" "if_test_bypass_p")
99
100 ; Multiplies use a non-piplined imul unit.  Also, "no insn can be issued
101 ; to E0 exactly two cycles before an integer multiply completes".
102
103 (define_insn_reservation "ev5_imull" 8
104   (and (eq_attr "cpu" "ev5")
105        (and (eq_attr "type" "imul")
106             (eq_attr "opsize" "si")))
107   "ev5_e0+ev5_imul,ev5_imul*3,nothing,ev5_e0")
108
109 (define_insn_reservation "ev5_imulq" 12
110   (and (eq_attr "cpu" "ev5")
111        (and (eq_attr "type" "imul")
112             (eq_attr "opsize" "di")))
113   "ev5_e0+ev5_imul,ev5_imul*7,nothing,ev5_e0")
114
115 (define_insn_reservation "ev5_imulh" 14
116   (and (eq_attr "cpu" "ev5")
117        (and (eq_attr "type" "imul")
118             (eq_attr "opsize" "udi")))
119   "ev5_e0+ev5_imul,ev5_imul*7,nothing*3,ev5_e0")
120
121 ; The multiplier is unable to receive data from Ebox bypass paths.  The
122 ; instruction issues at the expected time, but its latency is increased
123 ; by the time it takes for the input data to become available to the
124 ; multiplier.  For example, an IMULL instruction issued one cycle later
125 ; than an ADDL instruction, which produced one of its operands, has a
126 ; latency of 10 (8 + 2).  If the IMULL instruction is issued two cycles
127 ; later than the ADDL instruction, the latency is 9 (8 + 1).
128 ;
129 ; Model this instead with increased latency on the input instruction.
130
131 (define_bypass 3
132   "ev5_ld,ev5_shift,ev5_mvi,ev5_cmov,ev5_iadd,ev5_ilogcmp"
133   "ev5_imull,ev5_imulq,ev5_imulh")
134
135 (define_bypass  9 "ev5_imull" "ev5_imull,ev5_imulq,ev5_imulh")
136 (define_bypass 13 "ev5_imulq" "ev5_imull,ev5_imulq,ev5_imulh")
137 (define_bypass 15 "ev5_imulh" "ev5_imull,ev5_imulq,ev5_imulh")
138
139 ; Similarly for the FPU we have two asymetric units.
140
141 (define_insn_reservation "ev5_fadd" 4
142   (and (eq_attr "cpu" "ev5")
143        (eq_attr "type" "fadd,fcmov"))
144   "ev5_fa")
145
146 (define_insn_reservation "ev5_fbr" 1
147   (and (eq_attr "cpu" "ev5")
148        (eq_attr "type" "fbr"))
149   "ev5_fa")
150
151 (define_insn_reservation "ev5_fcpys" 4
152   (and (eq_attr "cpu" "ev5")
153        (eq_attr "type" "fcpys"))
154   "ev5_fam")
155
156 (define_insn_reservation "ev5_fmul" 4
157   (and (eq_attr "cpu" "ev5")
158        (eq_attr "type" "fmul"))
159   "ev5_fm")
160
161 ; The floating point divider is not pipelined.  Also, "no insn can be issued
162 ; to FA exactly five before an fdiv insn completes".
163 ;
164 ; ??? Do not model this late reservation due to the enormously increased
165 ; size of the resulting DFA.
166 ;
167 ; ??? Putting ev5_fa and ev5_fdiv alone into the same automata produces
168 ; a DFA of acceptable size, but putting ev5_fm and ev5_fa into separate
169 ; automata produces incorrect results for insns that can choose one or
170 ; the other, i.e. ev5_fcpys.
171
172 (define_insn_reservation "ev5_fdivsf" 15
173   (and (eq_attr "cpu" "ev5")
174        (and (eq_attr "type" "fdiv")
175             (eq_attr "opsize" "si")))
176   ; "ev5_fa+ev5_fdiv,ev5_fdiv*9,ev5_fa+ev5_fdiv,ev5_fdiv*4"
177   "ev5_fa+ev5_fdiv,ev5_fdiv*14")
178
179 (define_insn_reservation "ev5_fdivdf" 22
180   (and (eq_attr "cpu" "ev5")
181        (and (eq_attr "type" "fdiv")
182             (eq_attr "opsize" "di")))
183   ; "ev5_fa+ev5_fdiv,ev5_fdiv*17,ev5_fa+ev5_fdiv,ev5_fdiv*4"
184   "ev5_fa+ev5_fdiv,ev5_fdiv*21")
185
186 ; Traps don't consume or produce data; rpcc is latency 2 if we ever add it.
187 (define_insn_reservation "ev5_misc" 2
188   (and (eq_attr "cpu" "ev5")
189        (eq_attr "type" "misc"))
190   "ev5_e0")