1219374Smm;; Geode Scheduling
2219374Smm;; Copyright (C) 2006
3219374Smm;; Free Software Foundation, Inc.
4219374Smm;;
5219374Smm;; This file is part of GCC.
6219374Smm;;
7219374Smm;; GCC is free software; you can redistribute it and/or modify
8219374Smm;; it under the terms of the GNU General Public License as published by
9219374Smm;; the Free Software Foundation; either version 2, or (at your option)
10219374Smm;; any later version.
11219374Smm;;
12219374Smm;; GCC is distributed in the hope that it will be useful,
13219374Smm;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14219374Smm;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15219374Smm;; GNU General Public License for more details.
16219374Smm;;
17219374Smm;; You should have received a copy of the GNU General Public License
18219374Smm;; along with GCC; see the file COPYING.  If not, write to
19219374Smm;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20219374Smm;; Boston, MA 02110-1301, USA.
21219374Smm;;
22219374Smm;; The Geode architecture is one insn issue processor.
23219374Smm;;
24219374Smm;; This description is based on data from the following documents:
25219374Smm;;
26219374Smm;;    "AMD Geode GX Processor Data Book"
27219374Smm;;    Advanced Micro Devices, Inc., Aug 2005.
28219374Smm;;
29219374Smm;;    "AMD Geode LX Processor Data Book"
30219374Smm;;    Advanced Micro Devices, Inc., Jan 2006.
31219374Smm;;
32219374Smm;;
33219374Smm;; CPU execution units of the Geode:
34219374Smm;;
35219374Smm;; issue	describes the issue pipeline.
36219374Smm;; alu		describes the Integer unit
37219374Smm;; fpu		describes the FP unit
38219374Smm;;
39219374Smm;; The fp unit is out of order execution unit with register renaming.
40219374Smm;; There is also memory management unit and execution pipeline for
41219374Smm;; load/store operations.  We ignore it and difference between insns
42219374Smm;; using memory and registers.
43219374Smm
44219374Smm(define_automaton "geode")
45219374Smm
46219374Smm(define_cpu_unit "geode_issue,geode_alu,geode_fpu" "geode")
47219374Smm
48219374Smm(define_insn_reservation "alu" 1
49219374Smm			 (and (eq_attr "cpu" "geode")
50219374Smm			      (eq_attr "type" "alu,alu1,negnot,icmp,lea,test,imov,imovx,icmov,incdec,setcc"))
51219374Smm			 "geode_issue,geode_alu")
52219374Smm
53219374Smm(define_insn_reservation "shift" 2
54219374Smm			 (and (eq_attr "cpu" "geode")
55219374Smm			      (eq_attr "type" "ishift,ishift1,rotate,rotate1,cld"))
56219374Smm			 "geode_issue,geode_alu*2")
57219374Smm
58219374Smm(define_insn_reservation "imul" 7
59219374Smm			 (and (eq_attr "cpu" "geode")
60219374Smm			      (eq_attr "type" "imul"))
61219374Smm			 "geode_issue,geode_alu*7")
62219374Smm
63219374Smm(define_insn_reservation "idiv" 40
64219374Smm			 (and (eq_attr "cpu" "geode")
65219374Smm			      (eq_attr "type" "idiv"))
66219374Smm			 "geode_issue,geode_alu*40")
67219374Smm
68219374Smm;; The branch unit.
69219374Smm(define_insn_reservation "call" 2
70219374Smm			 (and (eq_attr "cpu" "geode")
71219374Smm			      (eq_attr "type" "call,callv"))
72219374Smm			 "geode_issue,geode_alu*2")
73219374Smm
74219374Smm(define_insn_reservation "geode_branch" 1
75219374Smm			 (and (eq_attr "cpu" "geode")
76219374Smm			      (eq_attr "type" "ibr"))
77219374Smm			 "geode_issue,geode_alu")
78219374Smm
79219374Smm(define_insn_reservation "geode_pop_push" 1
80219374Smm			 (and (eq_attr "cpu" "geode")
81219374Smm			      (eq_attr "type" "pop,push"))
82219374Smm			 "geode_issue,geode_alu")
83219374Smm
84219374Smm(define_insn_reservation "geode_leave" 2
85219374Smm			 (and (eq_attr "cpu" "geode")
86219374Smm			      (eq_attr "type" "leave"))
87219374Smm			 "geode_issue,geode_alu*2")
88219374Smm
89219374Smm(define_insn_reservation "geode_load_str" 4
90219374Smm			 (and (eq_attr "cpu" "geode")
91219374Smm			      (and (eq_attr "type" "str")
92219374Smm				   (eq_attr "memory" "load,both")))
93219374Smm			 "geode_issue,geode_alu*4")
94219374Smm
95219374Smm(define_insn_reservation "geode_store_str" 2
96219374Smm			 (and (eq_attr "cpu" "geode")
97219374Smm			      (and (eq_attr "type" "str")
98219374Smm				   (eq_attr "memory" "store")))
99219374Smm			 "geode_issue,geode_alu*2")
100219374Smm
101219374Smm;; Be optimistic
102219374Smm(define_insn_reservation "geode_unknown" 1
103219374Smm			 (and (eq_attr "cpu" "geode")
104219374Smm			      (eq_attr "type" "multi,other"))
105219374Smm			 "geode_issue,geode_alu")
106219374Smm
107219374Smm;; FPU
108219374Smm
109219374Smm(define_insn_reservation "geode_fop" 6
110219374Smm			 (and (eq_attr "cpu" "geode")
111219374Smm			      (eq_attr "type" "fop,fcmp"))
112219374Smm			 "geode_issue,geode_fpu*6")
113219374Smm
114219374Smm(define_insn_reservation "geode_fsimple" 1
115219374Smm			 (and (eq_attr "cpu" "geode")
116219374Smm			      (eq_attr "type" "fmov,fcmov,fsgn,fxch"))
117219374Smm			 "geode_issue,geode_fpu")
118219374Smm
119219374Smm(define_insn_reservation "geode_fist" 4
120219374Smm			 (and (eq_attr "cpu" "geode")
121219374Smm			      (eq_attr "type" "fistp,fisttp"))
122219374Smm			 "geode_issue,geode_fpu*4")
123219374Smm
124219374Smm(define_insn_reservation "geode_fmul" 10
125219374Smm			 (and (eq_attr "cpu" "geode")
126219374Smm			      (eq_attr "type" "fmul"))
127219374Smm			 "geode_issue,geode_fpu*10")
128219374Smm
129219374Smm(define_insn_reservation "geode_fdiv" 47
130219374Smm			 (and (eq_attr "cpu" "geode")
131219374Smm			      (eq_attr "type" "fdiv"))
132219374Smm			 "geode_issue,geode_fpu*47")
133219374Smm
134219374Smm;; We use minimal latency (fsin) here
135219374Smm(define_insn_reservation "geode_fpspc" 54
136219374Smm			 (and (eq_attr "cpu" "geode")
137219374Smm			      (eq_attr "type" "fpspc"))
138219374Smm			 "geode_issue,geode_fpu*54")
139219374Smm
140219374Smm(define_insn_reservation "geode_frndint" 12
141219374Smm			 (and (eq_attr "cpu" "geode")
142219374Smm			      (eq_attr "type" "frndint"))
143219374Smm			 "geode_issue,geode_fpu*12")
144219374Smm
145219374Smm(define_insn_reservation "geode_mmxmov" 1
146219374Smm			 (and (eq_attr "cpu" "geode")
147219374Smm			      (eq_attr "type" "mmxmov"))
148219374Smm			 "geode_issue,geode_fpu")
149219374Smm
150219374Smm(define_insn_reservation "geode_mmx" 2
151219374Smm			 (and (eq_attr "cpu" "geode")
152219374Smm			      (eq_attr "type" "mmx,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"))
153219374Smm			 "geode_issue,geode_fpu*2")
154