Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / config / alpha / ev6.md
blobd17ff5877fd673d8ba51a8b41523179cfe9799f9
1 ;; Scheduling description for Alpha EV6.
2 ;;   Copyright (C) 2002, 2004 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 2, 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 COPYING.  If not, write to
18 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
19 ;; Boston, MA 02111-1307, USA.
21 ; EV6 can issue 4 insns per clock.  It's out-of-order, so this isn't
22 ; expected to help over-much, but a precise description can be important
23 ; for software pipelining.
25 ; EV6 has two symmetric pairs ("clusters") of two asymmetric integer
26 ; units ("upper" and "lower"), yielding pipe names U0, U1, L0, L1.
28 ; ??? The clusters have independent register files that are re-synced
29 ; every cycle.  Thus there is one additional cycle of latency between
30 ; insns issued on different clusters.  Possibly model that by duplicating
31 ; all EBOX insn_reservations that can issue to either cluster, increasing
32 ; all latencies by one, and adding bypasses within the cluster.
34 ; ??? In addition, instruction order affects cluster issue.
36 (define_automaton "ev6_0,ev6_1")
37 (define_cpu_unit "ev6_u0,ev6_u1,ev6_l0,ev6_l1" "ev6_0")
38 (define_reservation "ev6_u" "ev6_u0|ev6_u1")
39 (define_reservation "ev6_l" "ev6_l0|ev6_l1")
40 (define_reservation "ev6_ebox" "ev6_u|ev6_l")
42 (define_cpu_unit "ev6_fa" "ev6_1")
43 (define_cpu_unit "ev6_fm,ev6_fst0,ev6_fst1" "ev6_0")
44 (define_reservation "ev6_fst" "ev6_fst0|ev6_fst1")
46 ; Assume type "multi" single issues.
47 (define_insn_reservation "ev6_multi" 1
48   (and (eq_attr "cpu" "ev6")
49        (eq_attr "type" "multi"))
50   "ev6_u0+ev6_u1+ev6_l0+ev6_l1+ev6_fa+ev6_fm+ev6_fst0+ev6_fst1")
52 ; Integer loads take at least 3 clocks, and only issue to lower units.
53 ; adjust_cost still factors in user-specified memory latency, so return 1 here.
54 (define_insn_reservation "ev6_ild" 1
55   (and (eq_attr "cpu" "ev6")
56        (eq_attr "type" "ild,ldsym"))
57   "ev6_l")
59 (define_insn_reservation "ev6_ist" 1
60   (and (eq_attr "cpu" "ev6")
61        (eq_attr "type" "ist"))
62   "ev6_l")
64 ; FP loads take at least 4 clocks.  adjust_cost still factors
65 ; in user-specified memory latency, so return 2 here.
66 (define_insn_reservation "ev6_fld" 2
67   (and (eq_attr "cpu" "ev6")
68        (eq_attr "type" "fld"))
69   "ev6_l")
71 ; The FPU communicates with memory and the integer register file
72 ; via two fp store units.  We need a slot in the fst immediately, and
73 ; a slot in LOW after the operand data is ready.  At which point the
74 ; data may be moved either to the store queue or the integer register
75 ; file and the insn retired.
77 (define_insn_reservation "ev6_fst" 3
78   (and (eq_attr "cpu" "ev6")
79        (eq_attr "type" "fst"))
80   "ev6_fst,nothing,ev6_l")
82 ; Arithmetic goes anywhere.
83 (define_insn_reservation "ev6_arith" 1
84   (and (eq_attr "cpu" "ev6")
85        (eq_attr "type" "iadd,ilog,icmp"))
86   "ev6_ebox")
88 ; Motion video insns also issue only to U0, and take three ticks.
89 (define_insn_reservation "ev6_mvi" 3
90   (and (eq_attr "cpu" "ev6")
91        (eq_attr "type" "mvi"))
92   "ev6_u0")
94 ; Shifts issue to upper units.
95 (define_insn_reservation "ev6_shift" 1
96   (and (eq_attr "cpu" "ev6")
97        (eq_attr "type" "shift"))
98   "ev6_u")
100 ; Multiplies issue only to U1, and all take 7 ticks.
101 (define_insn_reservation "ev6_imul" 7
102   (and (eq_attr "cpu" "ev6")
103        (eq_attr "type" "imul"))
104   "ev6_u1")
106 ; Conditional moves decompose into two independent primitives, each taking
107 ; one cycle.  Since ev6 is out-of-order, we can't see anything but two cycles.
108 (define_insn_reservation "ev6_icmov" 2
109   (and (eq_attr "cpu" "ev6")
110        (eq_attr "type" "icmov"))
111   "ev6_ebox,ev6_ebox")
113 ; Integer branches issue to upper units
114 (define_insn_reservation "ev6_ibr" 1
115   (and (eq_attr "cpu" "ev6")
116        (eq_attr "type" "ibr,callpal"))
117   "ev6_u")
119 ; Calls only issue to L0.
120 (define_insn_reservation "ev6_jsr" 1
121   (and (eq_attr "cpu" "ev6")
122        (eq_attr "type" "jsr"))
123   "ev6_l0")
125 ; Ftoi/itof only issue to lower pipes.
126 (define_insn_reservation "ev6_itof" 3
127   (and (eq_attr "cpu" "ev6")
128        (eq_attr "type" "itof"))
129   "ev6_l")
131 (define_insn_reservation "ev6_ftoi" 3
132   (and (eq_attr "cpu" "ev6")
133        (eq_attr "type" "ftoi"))
134   "ev6_fst,nothing,ev6_l")
136 (define_insn_reservation "ev6_fmul" 4
137   (and (eq_attr "cpu" "ev6")
138        (eq_attr "type" "fmul"))
139   "ev6_fm")
141 (define_insn_reservation "ev6_fadd" 4
142   (and (eq_attr "cpu" "ev6")
143        (eq_attr "type" "fadd,fcpys,fbr"))
144   "ev6_fa")
146 (define_insn_reservation "ev6_fcmov" 8
147   (and (eq_attr "cpu" "ev6")
148        (eq_attr "type" "fcmov"))
149   "ev6_fa,nothing*3,ev6_fa")
151 (define_insn_reservation "ev6_fdivsf" 12
152   (and (eq_attr "cpu" "ev6")
153        (and (eq_attr "type" "fdiv")
154             (eq_attr "opsize" "si")))
155   "ev6_fa*9")
157 (define_insn_reservation "ev6_fdivdf" 15
158   (and (eq_attr "cpu" "ev6")
159        (and (eq_attr "type" "fdiv")
160             (eq_attr "opsize" "di")))
161   "ev6_fa*12")
163 (define_insn_reservation "ev6_sqrtsf" 18
164   (and (eq_attr "cpu" "ev6")
165        (and (eq_attr "type" "fsqrt")
166             (eq_attr "opsize" "si")))
167   "ev6_fa*15")
169 (define_insn_reservation "ev6_sqrtdf" 33
170   (and (eq_attr "cpu" "ev6")
171        (and (eq_attr "type" "fsqrt")
172             (eq_attr "opsize" "di")))
173   "ev6_fa*30")