1 ;; DFA-based pipeline description for the RM7000.
2 ;; Copyright (C) 2003, 2004 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify it
7 ;; under the terms of the GNU General Public License as published
8 ;; by the Free Software Foundation; either version 2, or (at your
9 ;; option) any later version.
11 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
12 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 ;; 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 the
18 ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19 ;; MA 02111-1307, USA.
21 ;; .........................
23 ;; The RM7000 is a dual-issue processor that can bundle instructions as:
24 ;; {arith|load|store}{arith|imul|idiv|branch|float}
27 ;; "RM7000 Family User Manual, PMC-2002296"
29 ;; .........................
31 ;; Use three automata to isolate long latency operations, reducing space.
32 (define_automaton "rm7000_other, rm7000_fdiv, rm7000_idiv")
35 ;; Describe the resources.
39 (define_cpu_unit "rm7_iss0,rm7_iss1" "rm7000_other")
41 ;; Integer execution unit (M-Pipe).
42 (define_cpu_unit "ixum_addsub_agen" "rm7000_other")
44 ;; Integer execution unit (F-Pipe).
45 (define_cpu_unit "ixuf_addsub" "rm7000_other")
46 (define_cpu_unit "ixuf_branch" "rm7000_other")
47 (define_cpu_unit "ixuf_mpydiv" "rm7000_other")
48 (define_cpu_unit "ixuf_mpydiv_iter" "rm7000_idiv")
49 ;; Floating-point unit (F-Pipe).
50 (define_cpu_unit "fxuf_add" "rm7000_other")
51 (define_cpu_unit "fxuf_mpy" "rm7000_other")
52 (define_cpu_unit "fxuf_mpy_iter" "rm7000_fdiv")
53 (define_cpu_unit "fxuf_divsqrt" "rm7000_other")
54 (define_cpu_unit "fxuf_divsqrt_iter" "rm7000_fdiv")
56 (exclusion_set "ixuf_addsub"
57 "ixuf_branch,ixuf_mpydiv,fxuf_add,fxuf_mpy,fxuf_divsqrt")
58 (exclusion_set "ixuf_branch" "ixuf_mpydiv,fxuf_add,fxuf_mpy,fxuf_divsqrt")
59 (exclusion_set "ixuf_mpydiv" "fxuf_add,fxuf_mpy,fxuf_divsqrt")
60 (exclusion_set "fxuf_add" "fxuf_mpy,fxuf_divsqrt")
61 (exclusion_set "fxuf_mpy" "fxuf_divsqrt")
63 ;; After branch any insn cannot be issued.
64 (absence_set "rm7_iss0,rm7_iss1" "ixuf_branch")
67 ;; Define reservations for unit name mnemonics or combinations.
70 (define_reservation "rm7_iss" "rm7_iss0|rm7_iss1")
71 (define_reservation "rm7_single_dispatch" "rm7_iss0+rm7_iss1")
73 (define_reservation "rm7_iaddsub" "rm7_iss+(ixum_addsub_agen|ixuf_addsub)")
74 (define_reservation "rm7_imem" "rm7_iss+ixum_addsub_agen")
75 (define_reservation "rm7_impydiv" "rm7_iss+ixuf_mpydiv")
76 (define_reservation "rm7_impydiv_iter" "ixuf_mpydiv_iter")
77 (define_reservation "rm7_branch" "rm7_iss+ixuf_branch")
79 (define_reservation "rm7_fpadd" "rm7_iss+fxuf_add")
80 (define_reservation "rm7_fpmpy" "rm7_iss+fxuf_mpy")
81 (define_reservation "rm7_fpmpy_iter" "fxuf_mpy_iter")
82 (define_reservation "rm7_fpdivsqr" "rm7_iss+fxuf_divsqrt")
83 (define_reservation "rm7_fpdivsqr_iter" "fxuf_divsqrt_iter")
86 ;; Describe instruction reservations for integer operations.
89 (define_insn_reservation "rm7_int_other" 1
90 (and (eq_attr "cpu" "r7000")
91 (eq_attr "type" "arith,shift,slt,clz,const,condmove,nop,trap"))
94 (define_insn_reservation "rm7_ld" 2 (and (eq_attr "cpu" "r7000")
95 (eq_attr "type" "load,fpload,fpidxload"))
98 (define_insn_reservation "rm7_st" 1 (and (eq_attr "cpu" "r7000")
99 (eq_attr "type" "store,fpstore,fpidxstore"))
102 (define_insn_reservation "rm7_idiv_si" 36 (and (eq_attr "cpu" "r7000")
103 (and (eq_attr "type" "idiv")
104 (eq_attr "mode" "SI")))
105 "rm7_impydiv+(rm7_impydiv_iter*36)")
107 (define_insn_reservation "rm7_idiv_di" 68 (and (eq_attr "cpu" "r7000")
108 (and (eq_attr "type" "idiv")
109 (eq_attr "mode" "DI")))
110 "rm7_impydiv+(rm7_impydiv_iter*68)")
112 (define_insn_reservation "rm7_impy_si_mult" 5
113 (and (eq_attr "cpu" "r7000")
114 (and (eq_attr "type" "imul,imadd")
115 (and (eq_attr "mode" "SI")
116 (match_operand 0 "hilo_operand"))))
117 "rm7_impydiv+(rm7_impydiv_iter*3)")
119 ;; There are an additional 2 stall cycles.
120 (define_insn_reservation "rm7_impy_si_mul" 2
121 (and (eq_attr "cpu" "r7000")
122 (and (eq_attr "type" "imul,imadd")
123 (and (eq_attr "mode" "SI")
124 (not (match_operand 0 "hilo_operand")))))
127 (define_insn_reservation "rm7_impy_di" 9 (and (eq_attr "cpu" "r7000")
128 (and (eq_attr "type" "imul")
129 (eq_attr "mode" "DI")))
130 "rm7_impydiv+(rm7_impydiv_iter*8)")
132 ;; Move to/from HI/LO.
133 (define_insn_reservation "rm7_mthilo" 3
134 (and (eq_attr "cpu" "r7000")
135 (eq_attr "type" "mthilo"))
138 (define_insn_reservation "rm7_mfhilo" 1
139 (and (eq_attr "cpu" "r7000")
140 (eq_attr "type" "mfhilo"))
143 ;; Move to/from fp coprocessor.
144 (define_insn_reservation "rm7_ixfer" 2 (and (eq_attr "cpu" "r7000")
145 (eq_attr "type" "xfer"))
148 (define_insn_reservation "rm7_ibr" 3 (and (eq_attr "cpu" "r7000")
149 (eq_attr "type" "branch,jump,call"))
153 ;; Describe instruction reservations for the floating-point operations.
155 (define_insn_reservation "rm7_fp_quick" 4
156 (and (eq_attr "cpu" "r7000")
157 (eq_attr "type" "fneg,fcmp,fabs,fmove"))
160 (define_insn_reservation "rm7_fp_other" 4
161 (and (eq_attr "cpu" "r7000")
162 (eq_attr "type" "fadd"))
165 (define_insn_reservation "rm7_fp_cvt" 4
166 (and (eq_attr "cpu" "r7000")
167 (eq_attr "type" "fcvt"))
170 (define_insn_reservation "rm7_fp_divsqrt_df" 36
171 (and (eq_attr "cpu" "r7000")
172 (and (eq_attr "type" "fdiv,frdiv,fsqrt")
173 (eq_attr "mode" "DF")))
174 "rm7_fpdivsqr+(rm7_fpdivsqr_iter*36)")
176 (define_insn_reservation "rm7_fp_divsqrt_sf" 21
177 (and (eq_attr "cpu" "r7000")
178 (and (eq_attr "type" "fdiv,frdiv,fsqrt")
179 (eq_attr "mode" "SF")))
180 "rm7_fpdivsqr+(rm7_fpdivsqr_iter*21)")
182 (define_insn_reservation "rm7_fp_rsqrt_df" 68
183 (and (eq_attr "cpu" "r7000")
184 (and (eq_attr "type" "frsqrt")
185 (eq_attr "mode" "DF")))
186 "rm7_fpdivsqr+(rm7_fpdivsqr_iter*68)")
188 (define_insn_reservation "rm7_fp_rsqrt_sf" 38
189 (and (eq_attr "cpu" "r7000")
190 (and (eq_attr "type" "frsqrt")
191 (eq_attr "mode" "SF")))
192 "rm7_fpdivsqr+(rm7_fpdivsqr_iter*38)")
194 (define_insn_reservation "rm7_fp_mpy_sf" 4
195 (and (eq_attr "cpu" "r7000")
196 (and (eq_attr "type" "fmul,fmadd")
197 (eq_attr "mode" "SF")))
198 "rm7_fpmpy+rm7_fpmpy_iter")
200 (define_insn_reservation "rm7_fp_mpy_df" 5
201 (and (eq_attr "cpu" "r7000")
202 (and (eq_attr "type" "fmul,fmadd")
203 (eq_attr "mode" "DF")))
204 "rm7_fpmpy+(rm7_fpmpy_iter*2)")
206 ;; Force single-dispatch for unknown or multi.
207 (define_insn_reservation "rm7_unknown" 1 (and (eq_attr "cpu" "r7000")
208 (eq_attr "type" "unknown,multi"))
209 "rm7_single_dispatch")