2008-11-18 Kai Tietz <kai.tietz@onevision.com>
[official-gcc.git] / gcc / config / i386 / geode.md
blobc063e58b9cce8c3c0e8673fe0d6f35869a96fb2a
1 ;; Geode Scheduling
2 ;; Copyright (C) 2006, 2007
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 3, or (at your option)
10 ;; any later version.
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.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3.  If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;; The Geode architecture is one insn issue processor.
23 ;; This description is based on data from the following documents:
25 ;;    "AMD Geode GX Processor Data Book"
26 ;;    Advanced Micro Devices, Inc., Aug 2005.
28 ;;    "AMD Geode LX Processor Data Book"
29 ;;    Advanced Micro Devices, Inc., Jan 2006.
32 ;; CPU execution units of the Geode:
34 ;; issue        describes the issue pipeline.
35 ;; alu          describes the Integer unit
36 ;; fpu          describes the FP unit
38 ;; The fp unit is out of order execution unit with register renaming.
39 ;; There is also memory management unit and execution pipeline for
40 ;; load/store operations.  We ignore it and difference between insns
41 ;; using memory and registers.
43 (define_automaton "geode")
45 (define_cpu_unit "geode_issue,geode_alu,geode_fpu" "geode")
47 (define_insn_reservation "alu" 1
48                          (and (eq_attr "cpu" "geode")
49                               (eq_attr "type" "alu,alu1,negnot,icmp,lea,test,imov,imovx,icmov,incdec,setcc"))
50                          "geode_issue,geode_alu")
52 (define_insn_reservation "shift" 2
53                          (and (eq_attr "cpu" "geode")
54                               (eq_attr "type" "ishift,ishift1,rotate,rotate1"))
55                          "geode_issue,geode_alu*2")
57 (define_insn_reservation "imul" 7
58                          (and (eq_attr "cpu" "geode")
59                               (eq_attr "type" "imul"))
60                          "geode_issue,geode_alu*7")
62 (define_insn_reservation "idiv" 40
63                          (and (eq_attr "cpu" "geode")
64                               (eq_attr "type" "idiv"))
65                          "geode_issue,geode_alu*40")
67 ;; The branch unit.
68 (define_insn_reservation "call" 2
69                          (and (eq_attr "cpu" "geode")
70                               (eq_attr "type" "call,callv"))
71                          "geode_issue,geode_alu*2")
73 (define_insn_reservation "geode_branch" 1
74                          (and (eq_attr "cpu" "geode")
75                               (eq_attr "type" "ibr"))
76                          "geode_issue,geode_alu")
78 (define_insn_reservation "geode_pop_push" 1
79                          (and (eq_attr "cpu" "geode")
80                               (eq_attr "type" "pop,push"))
81                          "geode_issue,geode_alu")
83 (define_insn_reservation "geode_leave" 2
84                          (and (eq_attr "cpu" "geode")
85                               (eq_attr "type" "leave"))
86                          "geode_issue,geode_alu*2")
88 (define_insn_reservation "geode_load_str" 4
89                          (and (eq_attr "cpu" "geode")
90                               (and (eq_attr "type" "str")
91                                    (eq_attr "memory" "load,both")))
92                          "geode_issue,geode_alu*4")
94 (define_insn_reservation "geode_store_str" 2
95                          (and (eq_attr "cpu" "geode")
96                               (and (eq_attr "type" "str")
97                                    (eq_attr "memory" "store")))
98                          "geode_issue,geode_alu*2")
100 ;; Be optimistic
101 (define_insn_reservation "geode_unknown" 1
102                          (and (eq_attr "cpu" "geode")
103                               (eq_attr "type" "multi,other"))
104                          "geode_issue,geode_alu")
106 ;; FPU
108 (define_insn_reservation "geode_fop" 6
109                          (and (eq_attr "cpu" "geode")
110                               (eq_attr "type" "fop,fcmp"))
111                          "geode_issue,geode_fpu*6")
113 (define_insn_reservation "geode_fsimple" 1
114                          (and (eq_attr "cpu" "geode")
115                               (eq_attr "type" "fmov,fcmov,fsgn,fxch"))
116                          "geode_issue,geode_fpu")
118 (define_insn_reservation "geode_fist" 4
119                          (and (eq_attr "cpu" "geode")
120                               (eq_attr "type" "fistp,fisttp"))
121                          "geode_issue,geode_fpu*4")
123 (define_insn_reservation "geode_fmul" 10
124                          (and (eq_attr "cpu" "geode")
125                               (eq_attr "type" "fmul"))
126                          "geode_issue,geode_fpu*10")
128 (define_insn_reservation "geode_fdiv" 47
129                          (and (eq_attr "cpu" "geode")
130                               (eq_attr "type" "fdiv"))
131                          "geode_issue,geode_fpu*47")
133 ;; We use minimal latency (fsin) here
134 (define_insn_reservation "geode_fpspc" 54
135                          (and (eq_attr "cpu" "geode")
136                               (eq_attr "type" "fpspc"))
137                          "geode_issue,geode_fpu*54")
139 (define_insn_reservation "geode_frndint" 12
140                          (and (eq_attr "cpu" "geode")
141                               (eq_attr "type" "frndint"))
142                          "geode_issue,geode_fpu*12")
144 (define_insn_reservation "geode_mmxmov" 1
145                          (and (eq_attr "cpu" "geode")
146                               (eq_attr "type" "mmxmov"))
147                          "geode_issue,geode_fpu")
149 (define_insn_reservation "geode_mmx" 2
150                          (and (eq_attr "cpu" "geode")
151                               (eq_attr "type" "mmx,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"))
152                          "geode_issue,geode_fpu*2")