1;; Geode Scheduling
2;; Copyright (C) 2006
3;; Free Software Foundation, Inc.
4;;
5;; This file is part of GCC.
6;;
7;; GCC is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 2, or (at your option)
10;; any later version.
11;;
12;; GCC is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15;; GNU General Public License for more details.
16;;
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
19;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20;; Boston, MA 02110-1301, USA.
21;;
22;; The Geode architecture is one insn issue processor.
23;;
24;; This description is based on data from the following documents:
25;;
26;;    "AMD Geode GX Processor Data Book"
27;;    Advanced Micro Devices, Inc., Aug 2005.
28;;
29;;    "AMD Geode LX Processor Data Book"
30;;    Advanced Micro Devices, Inc., Jan 2006.
31;;
32;;
33;; CPU execution units of the Geode:
34;;
35;; issue	describes the issue pipeline.
36;; alu		describes the Integer unit
37;; fpu		describes the FP unit
38;;
39;; The fp unit is out of order execution unit with register renaming.
40;; There is also memory management unit and execution pipeline for
41;; load/store operations.  We ignore it and difference between insns
42;; using memory and registers.
43
44(define_automaton "geode")
45
46(define_cpu_unit "geode_issue,geode_alu,geode_fpu" "geode")
47
48(define_insn_reservation "alu" 1
49			 (and (eq_attr "cpu" "geode")
50			      (eq_attr "type" "alu,alu1,negnot,icmp,lea,test,imov,imovx,icmov,incdec,setcc"))
51			 "geode_issue,geode_alu")
52
53(define_insn_reservation "shift" 2
54			 (and (eq_attr "cpu" "geode")
55			      (eq_attr "type" "ishift,ishift1,rotate,rotate1,cld"))
56			 "geode_issue,geode_alu*2")
57
58(define_insn_reservation "imul" 7
59			 (and (eq_attr "cpu" "geode")
60			      (eq_attr "type" "imul"))
61			 "geode_issue,geode_alu*7")
62
63(define_insn_reservation "idiv" 40
64			 (and (eq_attr "cpu" "geode")
65			      (eq_attr "type" "idiv"))
66			 "geode_issue,geode_alu*40")
67
68;; The branch unit.
69(define_insn_reservation "call" 2
70			 (and (eq_attr "cpu" "geode")
71			      (eq_attr "type" "call,callv"))
72			 "geode_issue,geode_alu*2")
73
74(define_insn_reservation "geode_branch" 1
75			 (and (eq_attr "cpu" "geode")
76			      (eq_attr "type" "ibr"))
77			 "geode_issue,geode_alu")
78
79(define_insn_reservation "geode_pop_push" 1
80			 (and (eq_attr "cpu" "geode")
81			      (eq_attr "type" "pop,push"))
82			 "geode_issue,geode_alu")
83
84(define_insn_reservation "geode_leave" 2
85			 (and (eq_attr "cpu" "geode")
86			      (eq_attr "type" "leave"))
87			 "geode_issue,geode_alu*2")
88
89(define_insn_reservation "geode_load_str" 4
90			 (and (eq_attr "cpu" "geode")
91			      (and (eq_attr "type" "str")
92				   (eq_attr "memory" "load,both")))
93			 "geode_issue,geode_alu*4")
94
95(define_insn_reservation "geode_store_str" 2
96			 (and (eq_attr "cpu" "geode")
97			      (and (eq_attr "type" "str")
98				   (eq_attr "memory" "store")))
99			 "geode_issue,geode_alu*2")
100
101;; Be optimistic
102(define_insn_reservation "geode_unknown" 1
103			 (and (eq_attr "cpu" "geode")
104			      (eq_attr "type" "multi,other"))
105			 "geode_issue,geode_alu")
106
107;; FPU
108
109(define_insn_reservation "geode_fop" 6
110			 (and (eq_attr "cpu" "geode")
111			      (eq_attr "type" "fop,fcmp"))
112			 "geode_issue,geode_fpu*6")
113
114(define_insn_reservation "geode_fsimple" 1
115			 (and (eq_attr "cpu" "geode")
116			      (eq_attr "type" "fmov,fcmov,fsgn,fxch"))
117			 "geode_issue,geode_fpu")
118
119(define_insn_reservation "geode_fist" 4
120			 (and (eq_attr "cpu" "geode")
121			      (eq_attr "type" "fistp,fisttp"))
122			 "geode_issue,geode_fpu*4")
123
124(define_insn_reservation "geode_fmul" 10
125			 (and (eq_attr "cpu" "geode")
126			      (eq_attr "type" "fmul"))
127			 "geode_issue,geode_fpu*10")
128
129(define_insn_reservation "geode_fdiv" 47
130			 (and (eq_attr "cpu" "geode")
131			      (eq_attr "type" "fdiv"))
132			 "geode_issue,geode_fpu*47")
133
134;; We use minimal latency (fsin) here
135(define_insn_reservation "geode_fpspc" 54
136			 (and (eq_attr "cpu" "geode")
137			      (eq_attr "type" "fpspc"))
138			 "geode_issue,geode_fpu*54")
139
140(define_insn_reservation "geode_frndint" 12
141			 (and (eq_attr "cpu" "geode")
142			      (eq_attr "type" "frndint"))
143			 "geode_issue,geode_fpu*12")
144
145(define_insn_reservation "geode_mmxmov" 1
146			 (and (eq_attr "cpu" "geode")
147			      (eq_attr "type" "mmxmov"))
148			 "geode_issue,geode_fpu")
149
150(define_insn_reservation "geode_mmx" 2
151			 (and (eq_attr "cpu" "geode")
152			      (eq_attr "type" "mmx,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"))
153			 "geode_issue,geode_fpu*2")
154