Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / config / rs6000 / e5500.md
1 ;; Pipeline description for Freescale PowerPC e5500 core.
2 ;;   Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 ;;   Contributed by Edmar Wienskoski (edmar@freescale.com)
4 ;;
5 ;; This file is part of GCC.
6 ;;
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 3, or (at your
10 ;; option) any later version.
11 ;;
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.
16 ;;
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/>.
20 ;;
21 ;; e5500 64-bit SFX(2), CFX, LSU, FPU, BU
22 ;; Max issue 3 insns/clock cycle (includes 1 branch)
23
24 (define_automaton "e5500_most,e5500_long")
25 (define_cpu_unit "e5500_decode_0,e5500_decode_1" "e5500_most")
26
27 ;; SFX.
28 (define_cpu_unit "e5500_sfx_0,e5500_sfx_1" "e5500_most")
29
30 ;; CFX.
31 (define_cpu_unit "e5500_cfx_stage0,e5500_cfx_stage1" "e5500_most")
32
33 ;; Non-pipelined division.
34 (define_cpu_unit "e5500_cfx_div" "e5500_long")
35
36 ;; LSU.
37 (define_cpu_unit "e5500_lsu" "e5500_most")
38
39 ;; FPU.
40 (define_cpu_unit "e5500_fpu" "e5500_long")
41
42 ;; BU.
43 (define_cpu_unit "e5500_bu" "e5500_most")
44
45 ;; The following units are used to make the automata deterministic.
46 (define_cpu_unit "present_e5500_decode_0" "e5500_most")
47 (define_cpu_unit "present_e5500_sfx_0" "e5500_most")
48 (presence_set "present_e5500_decode_0" "e5500_decode_0")
49 (presence_set "present_e5500_sfx_0" "e5500_sfx_0")
50
51 ;; Some useful abbreviations.
52 (define_reservation "e5500_decode"
53     "e5500_decode_0|e5500_decode_1+present_e5500_decode_0")
54 (define_reservation "e5500_sfx"
55    "e5500_sfx_0|e5500_sfx_1+present_e5500_sfx_0")
56
57 ;; SFX.
58 (define_insn_reservation "e5500_sfx" 1
59   (and (eq_attr "type" "integer,insert_word,insert_dword,delayed_compare,\
60         shift,cntlz,exts")
61        (eq_attr "cpu" "ppce5500"))
62   "e5500_decode,e5500_sfx")
63
64 (define_insn_reservation "e5500_sfx2" 2
65   (and (eq_attr "type" "cmp,compare,fast_compare,trap")
66        (eq_attr "cpu" "ppce5500"))
67   "e5500_decode,e5500_sfx")
68
69 (define_insn_reservation "e5500_delayed" 2
70   (and (eq_attr "type" "var_shift_rotate,var_delayed_compare")
71        (eq_attr "cpu" "ppce5500"))
72   "e5500_decode,e5500_sfx*2")
73
74 (define_insn_reservation "e5500_two" 2
75   (and (eq_attr "type" "two")
76        (eq_attr "cpu" "ppce5500"))
77   "e5500_decode,e5500_decode+e5500_sfx,e5500_sfx")
78
79 (define_insn_reservation "e5500_three" 3
80   (and (eq_attr "type" "three")
81        (eq_attr "cpu" "ppce5500"))
82   "e5500_decode,(e5500_decode+e5500_sfx)*2,e5500_sfx")
83
84 ;; SFX - Mfcr.
85 (define_insn_reservation "e5500_mfcr" 4
86   (and (eq_attr "type" "mfcr")
87        (eq_attr "cpu" "ppce5500"))
88   "e5500_decode,e5500_sfx_0*4")
89
90 ;; SFX - Mtcrf.
91 (define_insn_reservation "e5500_mtcrf" 1
92   (and (eq_attr "type" "mtcr")
93        (eq_attr "cpu" "ppce5500"))
94   "e5500_decode,e5500_sfx_0")
95
96 ;; SFX - Mtjmpr.
97 (define_insn_reservation "e5500_mtjmpr" 1
98   (and (eq_attr "type" "mtjmpr,mfjmpr")
99        (eq_attr "cpu" "ppce5500"))
100   "e5500_decode,e5500_sfx")
101
102 ;; CFX - Multiply.
103 (define_insn_reservation "e5500_multiply" 4
104   (and (eq_attr "type" "imul")
105        (eq_attr "cpu" "ppce5500"))
106   "e5500_decode,e5500_cfx_stage0,e5500_cfx_stage1")
107
108 (define_insn_reservation "e5500_multiply_i" 5
109   (and (eq_attr "type" "imul2,imul3,imul_compare")
110        (eq_attr "cpu" "ppce5500"))
111   "e5500_decode,e5500_cfx_stage0,\
112    e5500_cfx_stage0+e5500_cfx_stage1,e5500_cfx_stage1")
113
114 ;; CFX - Divide.
115 (define_insn_reservation "e5500_divide" 16
116   (and (eq_attr "type" "idiv")
117        (eq_attr "cpu" "ppce5500"))
118   "e5500_decode,e5500_cfx_stage0+e5500_cfx_div,\
119    e5500_cfx_div*15")
120
121 (define_insn_reservation "e5500_divide_d" 26
122   (and (eq_attr "type" "ldiv")
123        (eq_attr "cpu" "ppce5500"))
124   "e5500_decode,e5500_cfx_stage0+e5500_cfx_div,\
125    e5500_cfx_div*25")
126
127 ;; LSU - Loads.
128 (define_insn_reservation "e5500_load" 3
129   (and (eq_attr "type" "load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,\
130                         load_l,sync")
131        (eq_attr "cpu" "ppce5500"))
132   "e5500_decode,e5500_lsu")
133
134 (define_insn_reservation "e5500_fpload" 4
135   (and (eq_attr "type" "fpload,fpload_ux,fpload_u")
136        (eq_attr "cpu" "ppce5500"))
137   "e5500_decode,e5500_lsu")
138
139 ;; LSU - Stores.
140 (define_insn_reservation "e5500_store" 3
141   (and (eq_attr "type" "store,store_ux,store_u,store_c")
142        (eq_attr "cpu" "ppce5500"))
143   "e5500_decode,e5500_lsu")
144
145 (define_insn_reservation "e5500_fpstore" 3
146   (and (eq_attr "type" "fpstore,fpstore_ux,fpstore_u")
147        (eq_attr "cpu" "ppce5500"))
148   "e5500_decode,e5500_lsu")
149
150 ;; FP.
151 (define_insn_reservation "e5500_float" 7
152   (and (eq_attr "type" "fpsimple,fp,fpcompare,dmul")
153        (eq_attr "cpu" "ppce5500"))
154   "e5500_decode,e5500_fpu")
155
156 (define_insn_reservation "e5500_sdiv" 20
157   (and (eq_attr "type" "sdiv")
158        (eq_attr "cpu" "ppce5500"))
159   "e5500_decode,e5500_fpu*20")
160
161 (define_insn_reservation "e5500_ddiv" 35
162   (and (eq_attr "type" "ddiv")
163        (eq_attr "cpu" "ppce5500"))
164   "e5500_decode,e5500_fpu*35")
165
166 ;; BU.
167 (define_insn_reservation "e5500_branch" 1
168   (and (eq_attr "type" "jmpreg,branch,isync")
169        (eq_attr "cpu" "ppce5500"))
170   "e5500_decode,e5500_bu")
171
172 ;; BU - CR logical.
173 (define_insn_reservation "e5500_cr_logical" 1
174   (and (eq_attr "type" "cr_logical,delayed_cr")
175        (eq_attr "cpu" "ppce5500"))
176   "e5500_decode,e5500_bu")