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