aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/config/mips/xlp.md
blob: 905808dd78d24529d7fde23b48d3728c8c989c9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
;; DFA-based pipeline description for the XLP.
;; Copyright (C) 2012-2014 Free Software Foundation, Inc.
;;
;; xlp.md   Machine Description for the Broadcom XLP Microprocessor
;; This file is part of GCC.

;; GCC is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published
;; by the Free Software Foundation; either version 3, or (at your
;; option) any later version.

;; GCC is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
;; License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

(define_automaton "xlp_cpu")

;; CPU function units.
(define_cpu_unit "xlp_ex0" "xlp_cpu")
(define_cpu_unit "xlp_ex1" "xlp_cpu")
(define_cpu_unit "xlp_ex2" "xlp_cpu")
(define_cpu_unit "xlp_ex3" "xlp_cpu")

;; Integer Multiply Unit
(define_cpu_unit "xlp_div" "xlp_cpu")

;; ALU2 completion port.
(define_cpu_unit "xlp_ex2_wrb" "xlp_cpu")

(define_automaton "xlp_fpu")

;; Floating-point units.
(define_cpu_unit "xlp_fp" "xlp_fpu")

;; Floating Point Sqrt/Divide
(define_cpu_unit "xlp_divsq" "xlp_fpu")

;; FPU completion port.
(define_cpu_unit "xlp_fp_wrb" "xlp_fpu")

;; Define reservations for common combinations.

;;
;; The ordering of the instruction-execution-path/resource-usage
;; descriptions (also known as reservation RTL) is roughly ordered
;; based on the define attribute RTL for the "type" classification.
;; When modifying, remember that the first test that matches is the
;; reservation used!
;;
(define_insn_reservation "ir_xlp_unknown" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "unknown,multi"))
  "xlp_ex0+xlp_ex1+xlp_ex2+xlp_ex3")

(define_insn_reservation "ir_xlp_branch" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "branch,jump,call"))
  "xlp_ex3")

(define_insn_reservation "ir_xlp_prefetch" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "prefetch,prefetchx"))
  "xlp_ex0|xlp_ex1")

(define_insn_reservation "ir_xlp_load" 4
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "load"))
  "xlp_ex0|xlp_ex1")

(define_insn_reservation "ir_xlp_fpload" 5
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "fpload,fpidxload"))
  "xlp_ex0|xlp_ex1")

(define_insn_reservation "ir_xlp_alu" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "const,arith,shift,slt,clz,signext,logical,move,trap,nop"))
  "xlp_ex0|xlp_ex1|(xlp_ex2,xlp_ex2_wrb)|xlp_ex3")

(define_insn_reservation "ir_xlp_condmov" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "condmove")
       (eq_attr "mode" "SI,DI"))
  "xlp_ex2,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_mul" 5
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "imul,imadd"))
  "xlp_ex2,nothing*4,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_mul3" 3
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "imul3"))
  "xlp_ex2,nothing*2,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_div" 24
  (and (eq_attr "cpu" "xlp")
       (eq_attr "mode" "SI")
       (eq_attr "type" "idiv"))
  "xlp_ex2+xlp_div,xlp_div*23,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_ddiv" 48
  (and (eq_attr "cpu" "xlp")
       (eq_attr "mode" "DI")
       (eq_attr "type" "idiv"))
  "xlp_ex2+xlp_div,xlp_div*47,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_store" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "store,fpstore,fpidxstore"))
  "xlp_ex0|xlp_ex1")

(define_insn_reservation "ir_xlp_fpmove" 2
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "mfc"))
 "xlp_ex3,xlp_fp,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_mfhi" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "mfhi"))
  "xlp_ex2,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_mflo" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "mflo"))
  "xlp_ex2,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_mthi" 1
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "mthi"))
  "xlp_ex2,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_mtlo" 3
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "mtlo"))
  "xlp_ex2,nothing*2,xlp_ex2_wrb")

(define_insn_reservation "ir_xlp_fp2" 2
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "fmove,fneg,fabs,condmove"))
  "xlp_fp,nothing,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_fp3" 3
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "fcmp"))
  "xlp_fp,nothing*2,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_fp4" 4
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "fcvt"))
  "xlp_fp,nothing*3,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_fp5" 5
  (and (eq_attr "cpu" "xlp")
       (eq_attr "mode" "SF")
       (eq_attr "type" "fadd,fmul"))
  "xlp_fp,nothing*4,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_fp6" 6
  (and (eq_attr "cpu" "xlp")
       (eq_attr "mode" "DF")
       (eq_attr "type" "fadd,fmul"))
  "xlp_fp,nothing*5,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_fp9" 9
  (and (eq_attr "cpu" "xlp")
       (eq_attr "mode" "SF")
       (eq_attr "type" "fmadd"))
  "xlp_fp,nothing*3,xlp_fp,nothing*3,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_fp11" 11
  (and (eq_attr "cpu" "xlp")
       (eq_attr "mode" "DF")
       (eq_attr "type" "fmadd"))
  "xlp_fp,nothing*4,xlp_fp,nothing*4,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_fpcomplex_s" 23
  (and (eq_attr "cpu" "xlp")
       (eq_attr "mode" "SF")
       (eq_attr "type" "fdiv,frdiv,frdiv1,frdiv2,fsqrt,frsqrt,frsqrt1,frsqrt2"))
  "xlp_fp+xlp_divsq,xlp_divsq*22,xlp_fp_wrb")

(define_insn_reservation "ir_xlp_fpcomplex_d" 38
  (and (eq_attr "cpu" "xlp")
       (eq_attr "mode" "DF")
       (eq_attr "type" "fdiv,frdiv,frdiv1,frdiv2,fsqrt,frsqrt,frsqrt1,frsqrt2"))
  "xlp_fp+xlp_divsq,xlp_divsq*37,xlp_fp_wrb")

(define_bypass 3 "ir_xlp_mul" "ir_xlp_mfhi")

(define_insn_reservation "ir_xlp_atomic" 15
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "atomic"))
  "xlp_ex0|xlp_ex1")

;; Sync loop consists of (in order)
;; (1) optional sync,
;; (2) LL instruction,
;; (3) branch and 1-2 ALU instructions,
;; (4) SC instruction,
;; (5) optional sync,
;; (6) branch and ALU instruction.
;; The net result of this reservation is a big delay with flush of
;; ALU pipeline and outgoing reservations discouraging use of EX3.
(define_insn_reservation "ir_xlp_sync_loop" 40
  (and (eq_attr "cpu" "xlp")
       (eq_attr "type" "syncloop"))
  "(xlp_ex0+xlp_ex1+xlp_ex2+xlp_ex3)*39,xlp_ex3+(xlp_ex0|xlp_ex1|(xlp_ex2,xlp_ex2_wrb))")