1 ;; Scheduling description for Alpha EV4.
2 ;; Copyright (C) 2002 Free Software Foundation, Inc.
4 ;; This file is part of GNU CC.
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)
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.
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.
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 ...)
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")
32 ; Assume type "multi" single issues.
33 (define_insn_reservation "ev4_multi" 1
34 (and (eq_attr "cpu" "ev4")
35 (eq_attr "type" "multi"))
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"))
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"))
51 (define_insn_reservation "ev4_fst" 1
52 (and (eq_attr "cpu" "ev4")
53 (eq_attr "type" "fst"))
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")
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")
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")
72 ; Arithmetic insns are normally have their results available after
73 ; two cycles. There are a number of exceptions.
75 (define_insn_reservation "ev4_iaddlog" 2
76 (and (eq_attr "cpu" "ev4")
77 (eq_attr "type" "iadd,ilog"))
82 "ev4_ibr,ev4_iaddlog,ev4_shiftcm,ev4_icmp,ev4_imulsi,ev4_imuldi")
84 (define_insn_reservation "ev4_shiftcm" 2
85 (and (eq_attr "cpu" "ev4")
86 (eq_attr "type" "shift,icmov"))
89 (define_insn_reservation "ev4_icmp" 2
90 (and (eq_attr "cpu" "ev4")
91 (eq_attr "type" "icmp"))
94 (define_bypass 1 "ev4_icmp" "ev4_ibr")
97 "ev4_iaddlog,ev4_shiftcm,ev4_icmp"
99 "store_data_bypass_p")
101 ; Multiplies use a non-piplined imul unit. Also, "no [ebox] insn can
102 ; be issued exactly three cycles before an integer multiply completes".
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")
110 (define_bypass 20 "ev4_imulsi" "ev4_ist" "store_data_bypass_p")
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")
118 (define_bypass 22 "ev4_imuldi" "ev4_ist" "store_data_bypass_p")
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"))
126 (define_bypass 4 "ev4_fpop" "ev4_fpop")
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".
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")
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")
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"))