OSDN Git Service

* config/elfos.h, config/gofast.h, config/interix.h,
[pf3gnuchains/gcc-fork.git] / gcc / config / alpha / ev4.md
1 ;; Scheduling description for Alpha EV4.
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.
10 ;;
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.
15 ;;
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.
20
21 ; On EV4 there are two classes of resources to consider: resources needed
22 ; to issue, and resources needed to execute.  IBUS[01] are in the first
23 ; category.  ABOX, BBOX, EBOX, FBOX, IMUL & FDIV make up the second.
24 ; (There are a few other register-like resources, but ...)
25
26 (define_automaton "ev4_0,ev4_1,ev4_2")
27 (define_cpu_unit "ev4_ib0,ev4_ib1,ev4_abox,ev4_bbox" "ev4_0")
28 (define_cpu_unit "ev4_ebox,ev4_imul" "ev4_1")
29 (define_cpu_unit "ev4_fbox,ev4_fdiv" "ev4_2")
30 (define_reservation "ev4_ib01" "ev4_ib0|ev4_ib1")
31
32 ; Assume type "multi" single issues.
33 (define_insn_reservation "ev4_multi" 1
34   (and (eq_attr "cpu" "ev4")
35        (eq_attr "type" "multi"))
36   "ev4_ib0+ev4_ib1")
37
38 ; Loads from L0 completes in three cycles.  adjust_cost still factors
39 ; in user-specified memory latency, so return 1 here.
40 (define_insn_reservation "ev4_ld" 1
41   (and (eq_attr "cpu" "ev4")
42        (eq_attr "type" "ild,fld,ldsym"))
43   "ev4_ib01+ev4_abox")
44
45 ; Stores can issue before the data (but not address) is ready.
46 (define_insn_reservation "ev4_ist" 1
47   (and (eq_attr "cpu" "ev4")
48        (eq_attr "type" "ist"))
49   "ev4_ib1+ev4_abox")
50
51 (define_insn_reservation "ev4_fst" 1
52   (and (eq_attr "cpu" "ev4")
53        (eq_attr "type" "fst"))
54   "ev4_ib0+ev4_abox")
55
56 ; Branches have no delay cost, but do tie up the unit for two cycles.
57 (define_insn_reservation "ev4_ibr" 2
58   (and (eq_attr "cpu" "ev4")
59        (eq_attr "type" "ibr,jsr"))
60   "ev4_ib1+ev4_bbox,ev4_bbox")
61
62 (define_insn_reservation "ev4_callpal" 2
63   (and (eq_attr "cpu" "ev4")
64        (eq_attr "type" "callpal"))
65   "ev4_ib1+ev4_bbox,ev4_bbox")
66
67 (define_insn_reservation "ev4_fbr" 2
68   (and (eq_attr "cpu" "ev4")
69        (eq_attr "type" "fbr"))
70   "ev4_ib0+ev4_bbox,ev4_bbox")
71
72 ; Arithmetic insns are normally have their results available after
73 ; two cycles.  There are a number of exceptions.
74
75 (define_insn_reservation "ev4_iaddlog" 2
76   (and (eq_attr "cpu" "ev4")
77        (eq_attr "type" "iadd,ilog"))
78   "ev4_ib0+ev4_ebox")
79
80 (define_bypass 1
81   "ev4_iaddlog"
82   "ev4_ibr,ev4_iaddlog,ev4_shiftcm,ev4_icmp,ev4_imulsi,ev4_imuldi")
83
84 (define_insn_reservation "ev4_shiftcm" 2
85   (and (eq_attr "cpu" "ev4")
86        (eq_attr "type" "shift,icmov"))
87   "ev4_ib0+ev4_ebox")
88
89 (define_insn_reservation "ev4_icmp" 2
90   (and (eq_attr "cpu" "ev4")
91        (eq_attr "type" "icmp"))
92   "ev4_ib0+ev4_ebox")
93
94 (define_bypass 1 "ev4_icmp" "ev4_ibr")
95
96 (define_bypass 0
97   "ev4_iaddlog,ev4_shiftcm,ev4_icmp"
98   "ev4_ist"
99   "store_data_bypass_p")
100
101 ; Multiplies use a non-pipelined imul unit.  Also, "no [ebox] insn can
102 ; be issued exactly three cycles before an integer multiply completes".
103
104 (define_insn_reservation "ev4_imulsi" 21
105   (and (eq_attr "cpu" "ev4")
106        (and (eq_attr "type" "imul")
107             (eq_attr "opsize" "si")))
108   "ev4_ib0+ev4_imul,ev4_imul*18,ev4_ebox")
109
110 (define_bypass 20 "ev4_imulsi" "ev4_ist" "store_data_bypass_p")
111
112 (define_insn_reservation "ev4_imuldi" 23
113   (and (eq_attr "cpu" "ev4")
114        (and (eq_attr "type" "imul")
115             (eq_attr "opsize" "!si")))
116   "ev4_ib0+ev4_imul,ev4_imul*20,ev4_ebox")
117
118 (define_bypass 22 "ev4_imuldi" "ev4_ist" "store_data_bypass_p")
119
120 ; Most FP insns have a 6 cycle latency, but with a 4 cycle bypass back in.
121 (define_insn_reservation "ev4_fpop" 6
122   (and (eq_attr "cpu" "ev4")
123        (eq_attr "type" "fadd,fmul,fcpys,fcmov"))
124   "ev4_ib1+ev4_fbox")
125
126 (define_bypass 4 "ev4_fpop" "ev4_fpop")
127
128 ; The floating point divider is not pipelined.  Also, "no FPOP insn can be
129 ; issued exactly five or exactly six cycles before an fdiv insn completes".
130
131 (define_insn_reservation "ev4_fdivsf" 34
132   (and (eq_attr "cpu" "ev4")
133        (and (eq_attr "type" "fdiv")
134             (eq_attr "opsize" "si")))
135   "ev4_ib1+ev4_fdiv,ev4_fdiv*28,ev4_fdiv+ev4_fbox,ev4_fbox")
136
137 (define_insn_reservation "ev4_fdivdf" 63
138   (and (eq_attr "cpu" "ev4")
139        (and (eq_attr "type" "fdiv")
140             (eq_attr "opsize" "di")))
141   "ev4_ib1+ev4_fdiv,ev4_fdiv*57,ev4_fdiv+ev4_fbox,ev4_fbox")
142
143 ; Traps don't consume or produce data.
144 (define_insn_reservation "ev4_misc" 1
145   (and (eq_attr "cpu" "ev4")
146        (eq_attr "type" "misc"))
147   "ev4_ib1")