* config/sh/sh.h: Delete dead GO_IF_LEGITIMATE_INDEX macro.
[official-gcc.git] / gcc / config / alpha / ev6.md
blobadfe504bf8bd553be8e7130a03330c433a76590d
1 ;; Scheduling description for Alpha EV6.
2 ;;   Copyright (C) 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
3 ;;
4 ;; This file is part of GCC.
5 ;;
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 3, or (at your option)
9 ;; any later version.
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 COPYING3.  If not see
18 ;; <http://www.gnu.org/licenses/>.
20 ; EV6 can issue 4 insns per clock.  It's out-of-order, so this isn't
21 ; expected to help over-much, but a precise description can be important
22 ; for software pipelining.
24 ; EV6 has two symmetric pairs ("clusters") of two asymmetric integer
25 ; units ("upper" and "lower"), yielding pipe names U0, U1, L0, L1.
27 ; ??? The clusters have independent register files that are re-synced
28 ; every cycle.  Thus there is one additional cycle of latency between
29 ; insns issued on different clusters.  Possibly model that by duplicating
30 ; all EBOX insn_reservations that can issue to either cluster, increasing
31 ; all latencies by one, and adding bypasses within the cluster.
33 ; ??? In addition, instruction order affects cluster issue.
35 (define_automaton "ev6_0,ev6_1")
36 (define_cpu_unit "ev6_u0,ev6_u1,ev6_l0,ev6_l1" "ev6_0")
37 (define_reservation "ev6_u" "ev6_u0|ev6_u1")
38 (define_reservation "ev6_l" "ev6_l0|ev6_l1")
39 (define_reservation "ev6_ebox" "ev6_u|ev6_l")
41 (define_cpu_unit "ev6_fa" "ev6_1")
42 (define_cpu_unit "ev6_fm,ev6_fst0,ev6_fst1" "ev6_0")
43 (define_reservation "ev6_fst" "ev6_fst0|ev6_fst1")
45 ; Assume type "multi" single issues.
46 (define_insn_reservation "ev6_multi" 1
47   (and (eq_attr "tune" "ev6")
48        (eq_attr "type" "multi"))
49   "ev6_u0+ev6_u1+ev6_l0+ev6_l1+ev6_fa+ev6_fm+ev6_fst0+ev6_fst1")
51 ; Integer loads take at least 3 clocks, and only issue to lower units.
52 ; adjust_cost still factors in user-specified memory latency, so return 1 here.
53 (define_insn_reservation "ev6_ild" 1
54   (and (eq_attr "tune" "ev6")
55        (eq_attr "type" "ild,ldsym,ld_l"))
56   "ev6_l")
58 (define_insn_reservation "ev6_ist" 1
59   (and (eq_attr "tune" "ev6")
60        (eq_attr "type" "ist,st_c"))
61   "ev6_l")
63 (define_insn_reservation "ev6_mb" 1
64   (and (eq_attr "tune" "ev6")
65        (eq_attr "type" "mb"))
66   "ev6_l1")
68 ; FP loads take at least 4 clocks.  adjust_cost still factors
69 ; in user-specified memory latency, so return 2 here.
70 (define_insn_reservation "ev6_fld" 2
71   (and (eq_attr "tune" "ev6")
72        (eq_attr "type" "fld"))
73   "ev6_l")
75 ; The FPU communicates with memory and the integer register file
76 ; via two fp store units.  We need a slot in the fst immediately, and
77 ; a slot in LOW after the operand data is ready.  At which point the
78 ; data may be moved either to the store queue or the integer register
79 ; file and the insn retired.
81 (define_insn_reservation "ev6_fst" 3
82   (and (eq_attr "tune" "ev6")
83        (eq_attr "type" "fst"))
84   "ev6_fst,nothing,ev6_l")
86 ; Arithmetic goes anywhere.
87 (define_insn_reservation "ev6_arith" 1
88   (and (eq_attr "tune" "ev6")
89        (eq_attr "type" "iadd,ilog,icmp"))
90   "ev6_ebox")
92 ; Motion video insns also issue only to U0, and take three ticks.
93 (define_insn_reservation "ev6_mvi" 3
94   (and (eq_attr "tune" "ev6")
95        (eq_attr "type" "mvi"))
96   "ev6_u0")
98 ; Shifts issue to upper units.
99 (define_insn_reservation "ev6_shift" 1
100   (and (eq_attr "tune" "ev6")
101        (eq_attr "type" "shift"))
102   "ev6_u")
104 ; Multiplies issue only to U1, and all take 7 ticks.
105 (define_insn_reservation "ev6_imul" 7
106   (and (eq_attr "tune" "ev6")
107        (eq_attr "type" "imul"))
108   "ev6_u1")
110 ; Conditional moves decompose into two independent primitives, each taking
111 ; one cycle.  Since ev6 is out-of-order, we can't see anything but two cycles.
112 (define_insn_reservation "ev6_icmov" 2
113   (and (eq_attr "tune" "ev6")
114        (eq_attr "type" "icmov"))
115   "ev6_ebox,ev6_ebox")
117 ; Integer branches issue to upper units
118 (define_insn_reservation "ev6_ibr" 1
119   (and (eq_attr "tune" "ev6")
120        (eq_attr "type" "ibr,callpal"))
121   "ev6_u")
123 ; Calls only issue to L0.
124 (define_insn_reservation "ev6_jsr" 1
125   (and (eq_attr "tune" "ev6")
126        (eq_attr "type" "jsr"))
127   "ev6_l0")
129 ; Ftoi/itof only issue to lower pipes.
130 (define_insn_reservation "ev6_itof" 3
131   (and (eq_attr "tune" "ev6")
132        (eq_attr "type" "itof"))
133   "ev6_l")
135 (define_insn_reservation "ev6_ftoi" 3
136   (and (eq_attr "tune" "ev6")
137        (eq_attr "type" "ftoi"))
138   "ev6_fst,nothing,ev6_l")
140 (define_insn_reservation "ev6_fmul" 4
141   (and (eq_attr "tune" "ev6")
142        (eq_attr "type" "fmul"))
143   "ev6_fm")
145 (define_insn_reservation "ev6_fadd" 4
146   (and (eq_attr "tune" "ev6")
147        (eq_attr "type" "fadd,fcpys,fbr"))
148   "ev6_fa")
150 (define_insn_reservation "ev6_fcmov" 8
151   (and (eq_attr "tune" "ev6")
152        (eq_attr "type" "fcmov"))
153   "ev6_fa,nothing*3,ev6_fa")
155 (define_insn_reservation "ev6_fdivsf" 12
156   (and (eq_attr "tune" "ev6")
157        (and (eq_attr "type" "fdiv")
158             (eq_attr "opsize" "si")))
159   "ev6_fa*9")
161 (define_insn_reservation "ev6_fdivdf" 15
162   (and (eq_attr "tune" "ev6")
163        (and (eq_attr "type" "fdiv")
164             (eq_attr "opsize" "di")))
165   "ev6_fa*12")
167 (define_insn_reservation "ev6_sqrtsf" 18
168   (and (eq_attr "tune" "ev6")
169        (and (eq_attr "type" "fsqrt")
170             (eq_attr "opsize" "si")))
171   "ev6_fa*15")
173 (define_insn_reservation "ev6_sqrtdf" 33
174   (and (eq_attr "tune" "ev6")
175        (and (eq_attr "type" "fsqrt")
176             (eq_attr "opsize" "di")))
177   "ev6_fa*30")