Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / config / rs6000 / 6xx.md
blob5bfd77cfd97201987383a6ec3da22bf17a6e7c29
1 ;; Scheduling description for PowerPC 604, PowerPC 604e, PowerPC 620,
2 ;; and PowerPC 630 processors.
3 ;;   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
4 ;;
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published
9 ;; by the Free Software Foundation; either version 2, or (at your
10 ;; option) any later version.
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15 ;; License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING.  If not, write to the
19 ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
20 ;; MA 02111-1307, USA.
22 (define_automaton "ppc6xx,ppc6xxfp,ppc6xxfp2")
23 (define_cpu_unit "iu1_6xx,iu2_6xx,mciu_6xx" "ppc6xx")
24 (define_cpu_unit "fpu_6xx" "ppc6xxfp")
25 (define_cpu_unit "fpu1_6xx,fpu2_6xx" "ppc6xxfp2")
26 (define_cpu_unit "lsu_6xx,bpu_6xx,cru_6xx" "ppc6xx")
28 ;; PPC604  32-bit 2xSCIU, MCIU, LSU, FPU, BPU
29 ;; PPC604e  32-bit 2xSCIU, MCIU, LSU, FPU, BPU, CRU
30 ;; MCIU used for imul/idiv and moves from/to spr
31 ;; LSU 2 stage pipelined
32 ;; FPU 3 stage pipelined
33 ;; Max issue 4 insns/clock cycle
35 ;; PPC604e is PPC604 with larger caches and a CRU.  In the 604
36 ;; the CR logical operations are handled in the BPU.
37 ;; In the 604e, the CRU shares bus with BPU so only one condition
38 ;; register or branch insn can be issued per clock.  Not modelled.
40 ;; PPC620  64-bit 2xSCIU, MCIU, LSU, FPU, BPU, CRU
41 ;; PPC630 64-bit 2xSCIU, MCIU, LSU, 2xFPU, BPU, CRU
42 ;; Max issue 4 insns/clock cycle
43 ;; Out-of-order execution, in-order completion
45 ;; No following instruction can dispatch in the same cycle as a branch
46 ;; instruction.  Not modelled.  This is no problem if RCSP is not
47 ;; enabled since the scheduler stops a schedule when it gets to a branch.
49 ;; Four insns can be dispatched per cycle.
51 (define_insn_reservation "ppc604-load" 2
52   (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u")
53        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
54   "lsu_6xx")
56 (define_insn_reservation "ppc604-fpload" 3
57   (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
58        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
59   "lsu_6xx")
61 (define_insn_reservation "ppc604-store" 1
62   (and (eq_attr "type" "store,fpstore,store_ux,store_u,fpstore_ux,fpstore_u")
63        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
64   "lsu_6xx")
66 (define_insn_reservation "ppc604-integer" 1
67   (and (eq_attr "type" "integer,insert_word")
68        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
69   "iu1_6xx|iu2_6xx")
71 (define_insn_reservation "ppc604-two" 1
72   (and (eq_attr "type" "two")
73        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
74   "iu1_6xx|iu2_6xx,iu1_6xx|iu2_6xx")
76 (define_insn_reservation "ppc604-three" 1
77   (and (eq_attr "type" "three")
78        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
79   "iu1_6xx|iu2_6xx,iu1_6xx|iu2_6xx,iu1_6xx|iu2_6xx")
81 (define_insn_reservation "ppc604-imul" 4
82   (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
83        (eq_attr "cpu" "ppc604"))
84   "mciu_6xx*2")
86 (define_insn_reservation "ppc604e-imul" 2
87   (and (eq_attr "type" "imul,imul2,imul3,imul_compare")
88        (eq_attr "cpu" "ppc604e"))
89   "mciu_6xx")
91 (define_insn_reservation "ppc620-imul" 5
92   (and (eq_attr "type" "imul,imul_compare")
93        (eq_attr "cpu" "ppc620,ppc630"))
94   "mciu_6xx*3")
96 (define_insn_reservation "ppc620-imul2" 4
97   (and (eq_attr "type" "imul2")
98        (eq_attr "cpu" "ppc620,ppc630"))
99   "mciu_6xx*3")
101 (define_insn_reservation "ppc620-imul3" 3
102   (and (eq_attr "type" "imul3")
103        (eq_attr "cpu" "ppc620,ppc630"))
104   "mciu_6xx*3")
106 (define_insn_reservation "ppc620-lmul" 7
107   (and (eq_attr "type" "lmul,lmul_compare")
108        (eq_attr "cpu" "ppc620,ppc630"))
109   "mciu_6xx*5")
111 (define_insn_reservation "ppc604-idiv" 20
112   (and (eq_attr "type" "idiv")
113        (eq_attr "cpu" "ppc604,ppc604e"))
114   "mciu_6xx*19")
116 (define_insn_reservation "ppc620-idiv" 37
117   (and (eq_attr "type" "idiv")
118        (eq_attr "cpu" "ppc620"))
119   "mciu_6xx*36")
121 (define_insn_reservation "ppc630-idiv" 21
122   (and (eq_attr "type" "idiv")
123        (eq_attr "cpu" "ppc630"))
124   "mciu_6xx*20")
126 (define_insn_reservation "ppc620-ldiv" 37
127   (and (eq_attr "type" "ldiv")
128        (eq_attr "cpu" "ppc620,ppc630"))
129   "mciu_6xx*36")
131 (define_insn_reservation "ppc604-compare" 3
132   (and (eq_attr "type" "cmp,fast_compare,compare,delayed_compare")
133        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
134   "(iu1_6xx|iu2_6xx)")
136 ; FPU PPC604{,e},PPC620
137 (define_insn_reservation "ppc604-fpcompare" 5
138   (and (eq_attr "type" "fpcompare")
139        (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
140   "fpu_6xx")
142 (define_insn_reservation "ppc604-fp" 3
143   (and (eq_attr "type" "fp")
144        (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
145   "fpu_6xx")
147 (define_insn_reservation "ppc604-dmul" 3
148   (and (eq_attr "type" "dmul")
149        (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
150   "fpu_6xx")
152 ; Divides are not pipelined
153 (define_insn_reservation "ppc604-sdiv" 18
154   (and (eq_attr "type" "sdiv")
155        (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
156   "fpu_6xx*18")
158 (define_insn_reservation "ppc604-ddiv" 32
159   (and (eq_attr "type" "ddiv")
160        (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
161   "fpu_6xx*32")
163 (define_insn_reservation "ppc620-ssqrt" 31
164   (and (eq_attr "type" "ssqrt")
165        (eq_attr "cpu" "ppc620"))
166   "fpu_6xx*31")
168 (define_insn_reservation "ppc620-dsqrt" 31
169   (and (eq_attr "type" "dsqrt")
170        (eq_attr "cpu" "ppc620"))
171   "fpu_6xx*31")
174 ; 2xFPU PPC630
175 (define_insn_reservation "ppc630-fpcompare" 5
176   (and (eq_attr "type" "fpcompare")
177        (eq_attr "cpu" "ppc630"))
178   "fpu1_6xx|fpu2_6xx")
180 (define_insn_reservation "ppc630-fp" 3
181   (and (eq_attr "type" "fp,dmul")
182        (eq_attr "cpu" "ppc630"))
183   "fpu1_6xx|fpu2_6xx")
185 (define_insn_reservation "ppc630-sdiv" 17
186   (and (eq_attr "type" "sdiv")
187        (eq_attr "cpu" "ppc630"))
188   "fpu1_6xx*17|fpu2_6xx*17")
190 (define_insn_reservation "ppc630-ddiv" 21
191   (and (eq_attr "type" "ddiv")
192        (eq_attr "cpu" "ppc630"))
193   "fpu1_6xx*21|fpu2_6xx*21")
195 (define_insn_reservation "ppc630-ssqrt" 18
196   (and (eq_attr "type" "ssqrt")
197        (eq_attr "cpu" "ppc630"))
198   "fpu1_6xx*18|fpu2_6xx*18")
200 (define_insn_reservation "ppc630-dsqrt" 25
201   (and (eq_attr "type" "dsqrt")
202        (eq_attr "cpu" "ppc630"))
203   "fpu1_6xx*25|fpu2_6xx*25")
205 (define_insn_reservation "ppc604-mfcr" 3
206   (and (eq_attr "type" "mfcr")
207        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
208   "mciu_6xx")
210 (define_insn_reservation "ppc604-mtcr" 2
211   (and (eq_attr "type" "mtcr")
212        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
213   "iu1_6xx|iu2_6xx")
215 (define_insn_reservation "ppc604-crlogical" 2
216   (and (eq_attr "type" "cr_logical,delayed_cr")
217        (eq_attr "cpu" "ppc604"))
218   "bpu_6xx")
220 (define_insn_reservation "ppc604e-crlogical" 2
221   (and (eq_attr "type" "cr_logical,delayed_cr")
222        (eq_attr "cpu" "ppc604e,ppc620,ppc630"))
223   "cru_6xx")
225 (define_insn_reservation "ppc604-mtjmpr" 2
226   (and (eq_attr "type" "mtjmpr")
227        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
228   "mciu_6xx")
230 (define_insn_reservation "ppc604-mfjmpr" 3
231   (and (eq_attr "type" "mfjmpr")
232        (eq_attr "cpu" "ppc604,ppc604e,ppc620"))
233   "mciu_6xx")
235 (define_insn_reservation "ppc630-mfjmpr" 2
236   (and (eq_attr "type" "mfjmpr")
237        (eq_attr "cpu" "ppc630"))
238   "mciu_6xx")
240 (define_insn_reservation "ppc604-jmpreg" 1
241   (and (eq_attr "type" "jmpreg,branch")
242        (eq_attr "cpu" "ppc604,ppc604e,ppc620,ppc630"))
243   "bpu_6xx")