Debian Codegraph @

gcc/config/i386/c86-4g.md

raw
1 ;; Copyright (C) 2026 Free Software Foundation, Inc.
2 ;;
3 ;; This file is part of GCC.
4 ;;
5 ;; GCC is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; GCC is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with GCC; see the file COPYING3. If not see
17 ;; <http://www.gnu.org/licenses/>.
18 ;;
19
20
21 (define_attr "c86_decode" "direct,vector,double"
22 (const_string "direct"))
23
24 (define_attr "c86_attr" "other,abs,sqrt,maxmin,blend,blendv,rcp,movnt,avg,
25 sign,sadbw,insr,perm2,perm,insertx,shufx,madd,
26 compress,sselogic,cmpestr,extr,vpmovx,expand,aes,
27 hplus,ptest"
28 (const_string "other"))
29
30 ;; HYGON Scheduling
31 ;; Modeling automatons for decoders, integer execution pipes,
32 ;; AGU pipes, floating point execution units, integer and
33 ;; floating point dividers. Split fp1 into its own automaton
34 ;; to keep this unit independent without increasing the main
35 ;; c86_4g_fp state space.
36 (define_automaton "c86_4g, c86_4g_ieu, c86_4g_fp024, c86_4g_fp1, c86_4g_agu, c86_4g_idiv, c86_4g_fdiv")
37
38 ;; Decoders unit has 4 decoders and all of them can decode fast path
39 ;; and vector type instructions.
40 (define_cpu_unit "c86-4g-decode0" "c86_4g")
41 (define_cpu_unit "c86-4g-decode1" "c86_4g")
42 (define_cpu_unit "c86-4g-decode2" "c86_4g")
43 (define_cpu_unit "c86-4g-decode3" "c86_4g")
44
45 ;; Currently blocking all decoders for vector path instructions as
46 ;; they are dispatched separetely as microcode sequence.
47 ;; Fix me: Need to revisit this.
48 (define_reservation "c86-4g-vector" "c86-4g-decode0+c86-4g-decode1+c86-4g-decode2+c86-4g-decode3")
49
50 ;; Direct instructions can be issued to any of the four decoders.
51 (define_reservation "c86-4g-direct" "c86-4g-decode0|c86-4g-decode1|c86-4g-decode2|c86-4g-decode3")
52
53 ;; Fix me: Need to revisit this later to simulate fast path double behavior.
54 (define_reservation "c86-4g-double" "c86-4g-direct")
55
56 ;; Integer unit 4 ALU pipes.
57 (define_cpu_unit "c86-4g-ieu0" "c86_4g_ieu")
58 (define_cpu_unit "c86-4g-ieu1" "c86_4g_ieu")
59 (define_cpu_unit "c86-4g-ieu2" "c86_4g_ieu")
60 (define_cpu_unit "c86-4g-ieu3" "c86_4g_ieu")
61 (define_reservation "c86-4g-ieu" "c86-4g-ieu0|c86-4g-ieu1|c86-4g-ieu2|c86-4g-ieu3")
62
63 ;; One separated integer divider.
64 (define_cpu_unit "c86-4g-idiv" "c86_4g_idiv")
65
66 ;; 2 AGU pipes in c86_4g
67 ;; According to CPU diagram last AGU unit is used only for stores.
68 (define_cpu_unit "c86-4g-agu0" "c86_4g_agu")
69 (define_cpu_unit "c86-4g-agu1" "c86_4g_agu")
70 (define_reservation "c86-4g-agu-reserve" "c86-4g-agu0|c86-4g-agu1")
71
72 ;; Load is 4 cycles. We do not model reservation of load unit.
73 ;;(define_reservation "c86-4g-load" "c86-4g-agu-reserve, nothing, nothing, nothing")
74 (define_reservation "c86-4g-load" "c86-4g-agu-reserve")
75 (define_reservation "c86-4g-store" "c86-4g-agu-reserve")
76
77 ;; vectorpath (microcoded) instructions are single issue instructions.
78 ;; So, they occupy all the integer units.
79 (define_reservation "c86-4g-ivector" "c86-4g-ieu0+c86-4g-ieu1
80 +c86-4g-ieu2+c86-4g-ieu3
81 +c86-4g-agu0+c86-4g-agu1")
82
83 ;; Floating point unit 4 FP pipes.
84 (define_cpu_unit "c86-4g-fp0" "c86_4g_fp024")
85 (define_cpu_unit "c86-4g-fp1" "c86_4g_fp1")
86 (define_cpu_unit "c86-4g-fp2" "c86_4g_fp024")
87 (define_cpu_unit "c86-4g-fp3" "c86_4g_fp024")
88
89 (define_reservation "c86-4g-fpu" "c86-4g-fp0|c86-4g-fp1|c86-4g-fp2|c86-4g-fp3")
90
91 (define_reservation "c86-4g-fvector" "c86-4g-fp0+c86-4g-fp1
92 +c86-4g-fp2+c86-4g-fp3
93 +c86-4g-agu0+c86-4g-agu1")
94
95 ;; One separated FP divider.
96 (define_cpu_unit "c86-4g-fdiv" "c86_4g_fdiv")
97
98 (define_reservation "c86-4g-fp1fdivx4" "(c86-4g-fp1+c86-4g-fdiv)*4")
99
100 ;; Call instruction
101 (define_insn_reservation "c86_4g_call" 1
102 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
103 (eq_attr "type" "call,callv"))
104 "c86-4g-double,c86-4g-store,c86-4g-ieu0+c86-4g-ieu3")
105
106 ;; General instructions
107 (define_insn_reservation "c86_4g_push" 1
108 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
109 (and (eq_attr "type" "push")
110 (eq_attr "memory" "store")))
111 "c86-4g-direct,c86-4g-store")
112
113 (define_insn_reservation "c86_4g_push_load" 4
114 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
115 (and (eq_attr "type" "push")
116 (eq_attr "memory" "both")))
117 "c86-4g-direct,c86-4g-load+c86-4g-store")
118
119 (define_insn_reservation "c86_4g_pop" 4
120 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
121 (and (eq_attr "type" "pop")
122 (eq_attr "memory" "load")))
123 "c86-4g-direct,c86-4g-load")
124
125 (define_insn_reservation "c86_4g_pop_mem" 4
126 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
127 (and (eq_attr "type" "pop")
128 (eq_attr "memory" "both")))
129 "c86-4g-direct,c86-4g-load,c86-4g-store")
130
131 ;; Leave
132 (define_insn_reservation "c86_4g_leave" 1
133 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
134 (eq_attr "type" "leave"))
135 "c86-4g-double,c86-4g-ieu+c86-4g-store")
136
137 ;; Integer Instructions or General instructions
138 ;; Multiplications
139 ;; Reg operands
140 (define_insn_reservation "c86_4g_imul" 3
141 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
142 (and (eq_attr "type" "imul")
143 (eq_attr "memory" "none")))
144 "c86-4g-direct,c86-4g-ieu1")
145
146 (define_insn_reservation "c86_4g_imul_mem" 7
147 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
148 (and (eq_attr "type" "imul")
149 (eq_attr "memory" "!none")))
150 "c86-4g-direct,c86-4g-load, c86-4g-ieu1")
151
152 ;; Divisions
153 ;; Reg operands
154 (define_insn_reservation "c86_4g_idiv_DI" 41
155 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
156 (and (eq_attr "type" "idiv")
157 (and (eq_attr "mode" "DI")
158 (eq_attr "memory" "none"))))
159 "c86-4g-double,c86-4g-ieu2,c86-4g-idiv*41")
160
161 (define_insn_reservation "c86_4g_idiv_SI" 25
162 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
163 (and (eq_attr "type" "idiv")
164 (and (eq_attr "mode" "SI")
165 (eq_attr "memory" "none"))))
166 "c86-4g-double,c86-4g-ieu2,c86-4g-idiv*25")
167
168 (define_insn_reservation "c86_4g_idiv_HI" 17
169 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
170 (and (eq_attr "type" "idiv")
171 (and (eq_attr "mode" "HI")
172 (eq_attr "memory" "none"))))
173 "c86-4g-double,c86-4g-ieu2,c86-4g-idiv*17")
174
175 (define_insn_reservation "c86_4g_idiv_QI" 15
176 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
177 (and (eq_attr "type" "idiv")
178 (and (eq_attr "mode" "QI")
179 (eq_attr "memory" "none"))))
180 "c86-4g-direct,c86-4g-ieu2,c86-4g-idiv*15")
181
182 ;; Mem operands
183 (define_insn_reservation "c86_4g_idiv_mem_DI" 45
184 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
185 (and (eq_attr "type" "idiv")
186 (and (eq_attr "mode" "DI")
187 (eq_attr "memory" "load"))))
188 "c86-4g-double,c86-4g-load,c86-4g-ieu2,c86-4g-idiv*41")
189
190 (define_insn_reservation "c86_4g_idiv_mem_SI" 29
191 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
192 (and (eq_attr "type" "idiv")
193 (and (eq_attr "mode" "SI")
194 (eq_attr "memory" "load"))))
195 "c86-4g-double,c86-4g-load,c86-4g-ieu2,c86-4g-idiv*25")
196
197 (define_insn_reservation "c86_4g_idiv_mem_HI" 21
198 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
199 (and (eq_attr "type" "idiv")
200 (and (eq_attr "mode" "HI")
201 (eq_attr "memory" "load"))))
202 "c86-4g-double,c86-4g-load,c86-4g-ieu2,c86-4g-idiv*17")
203
204 (define_insn_reservation "c86_4g_idiv_mem_QI" 19
205 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
206 (and (eq_attr "type" "idiv")
207 (and (eq_attr "mode" "QI")
208 (eq_attr "memory" "load"))))
209 "c86-4g-direct,c86-4g-load,c86-4g-ieu2,c86-4g-idiv*15")
210
211 ;; STR ISHIFT which are micro coded.
212 ;; Fix me: Latency need to be rechecked.
213 (define_insn_reservation "c86_4g_str_ishift" 6
214 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
215 (and (eq_attr "type" "str,ishift")
216 (eq_attr "memory" "both,store")))
217 "c86-4g-vector,c86-4g-ivector")
218
219 ;; MOV - integer moves
220 (define_insn_reservation "c86_4g_load_imov_double" 2
221 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
222 (and (eq_attr "c86_decode" "double")
223 (and (eq_attr "type" "imovx")
224 (eq_attr "memory" "none"))))
225 "c86-4g-double,c86-4g-ieu")
226
227 (define_insn_reservation "c86_4g_load_imov_direct" 1
228 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
229 (and (eq_attr "c86_decode" "!double")
230 (and (eq_attr "type" "imov,imovx")
231 (eq_attr "memory" "none"))))
232 "c86-4g-direct,c86-4g-ieu")
233
234 (define_insn_reservation "c86_4g_load_imov_double_store" 2
235 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
236 (and (eq_attr "c86_decode" "double")
237 (and (eq_attr "type" "imovx")
238 (eq_attr "memory" "store"))))
239 "c86-4g-double,c86-4g-ieu,c86-4g-store")
240
241 (define_insn_reservation "c86_4g_load_imov_direct_store" 1
242 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
243 (and (eq_attr "c86_decode" "!double")
244 (and (eq_attr "type" "imov,imovx")
245 (eq_attr "memory" "store"))))
246 "c86-4g-direct,c86-4g-ieu,c86-4g-store")
247
248 (define_insn_reservation "c86_4g_load_imov_double_load" 5
249 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
250 (and (eq_attr "c86_decode" "double")
251 (and (eq_attr "type" "imovx")
252 (eq_attr "memory" "load"))))
253 "c86-4g-double,c86-4g-load,c86-4g-ieu")
254
255 (define_insn_reservation "c86_4g_load_imov_direct_load" 4
256 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
257 (and (eq_attr "c86_decode" "!double")
258 (and (eq_attr "type" "imov,imovx")
259 (eq_attr "memory" "load"))))
260 "c86-4g-direct,c86-4g-load")
261
262 ;; INTEGER/GENERAL instructions
263 ;; register/imm operands only: ALU, ICMP, NEG, NOT, ROTATE, ISHIFT, TEST
264 (define_insn_reservation "c86_4g_insn" 1
265 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
266 (and (eq_attr "type" "alu,icmp,negnot,rotate,rotate1,ishift,ishift1,test,setcc,incdec,icmov")
267 (eq_attr "memory" "none,unknown")))
268 "c86-4g-direct,c86-4g-ieu")
269
270 (define_insn_reservation "c86_4g_insn_load" 5
271 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
272 (and (eq_attr "type" "alu,icmp,negnot,rotate,rotate1,ishift,ishift1,test,setcc,incdec,icmov")
273 (eq_attr "memory" "load")))
274 "c86-4g-direct,c86-4g-load,c86-4g-ieu")
275
276 ;; FIXME: The instructions matched here has only two operands, which means memory type can only be none, load or both.
277 ;; Store memory type handling should never take effect here?
278 (define_insn_reservation "c86_4g_insn_store" 1
279 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
280 (and (eq_attr "type" "alu,icmp,negnot,rotate,rotate1,ishift1,test,setcc,incdec")
281 (eq_attr "memory" "store")))
282 "c86-4g-direct,c86-4g-ieu,c86-4g-store")
283
284 (define_insn_reservation "c86_4g_insn_both" 5
285 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
286 (and (eq_attr "type" "alu,icmp,negnot,rotate,rotate1,ishift1,test,setcc,incdec")
287 (eq_attr "memory" "both")))
288 "c86-4g-direct,c86-4g-load,c86-4g-ieu,c86-4g-store")
289
290 ;; Special latency for multi type.
291 (define_insn_reservation "c86_4g_fp_fcomp" 1
292 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
293 (and (eq_attr "memory" "none")
294 (and (eq_attr "unit" "i387")
295 (eq_attr "type" "multi"))))
296 "c86-4g-double,c86-4g-fp0|c86-4g-fp2")
297
298 ;; Fix me: Other vector type insns keeping latency 6 as of now.
299 (define_insn_reservation "c86_4g_ieu_vector" 6
300 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
301 (and (eq_attr "memory" "none")
302 (and (eq_attr "unit" "!i387")
303 (eq_attr "type" "other,str,multi"))))
304 "c86-4g-vector,c86-4g-ivector")
305
306 ;; ALU1 register operands.
307 (define_insn_reservation "c86_4g_alu1_vector" 3
308 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
309 (and (eq_attr "c86_decode" "vector")
310 (and (eq_attr "type" "alu1")
311 (eq_attr "memory" "none,unknown"))))
312 "c86-4g-vector,c86-4g-ivector")
313
314 (define_insn_reservation "c86_4g_alu1_double" 2
315 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
316 (and (eq_attr "c86_decode" "double")
317 (and (eq_attr "type" "alu1")
318 (eq_attr "memory" "none,unknown"))))
319 "c86-4g-double,c86-4g-ieu")
320
321 (define_insn_reservation "c86_4g_alu1_direct" 1
322 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
323 (and (eq_attr "c86_decode" "direct")
324 (and (eq_attr "type" "alu1")
325 (eq_attr "memory" "none,unknown"))))
326 "c86-4g-direct,c86-4g-ieu")
327
328 ;; Branches : Fix me need to model conditional branches.
329 (define_insn_reservation "c86_4g_branch" 1
330 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
331 (and (eq_attr "type" "ibr")
332 (eq_attr "memory" "none")))
333 "c86-4g-direct")
334
335 ;; Indirect branches check latencies.
336 (define_insn_reservation "c86_4g_indirect_branch_mem" 6
337 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
338 (and (eq_attr "type" "ibr")
339 (eq_attr "memory" "load")))
340 "c86-4g-vector,c86-4g-ivector")
341
342 ;; LEA executes in ALU units with 1 cycle latency.
343 (define_insn_reservation "c86_4g_lea" 1
344 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
345 (eq_attr "type" "lea"))
346 "c86-4g-direct,c86-4g-ieu")
347
348 ;; Floating point
349 (define_insn_reservation "c86_4g_fp_cmov" 6
350 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
351 (eq_attr "type" "fcmov"))
352 "c86-4g-vector,c86-4g-fvector")
353
354
355 (define_insn_reservation "c86_4g_fp_mov_direct_load" 8
356 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
357 (and (eq_attr "c86_decode" "direct")
358 (and (eq_attr "type" "fmov")
359 (eq_attr "memory" "load"))))
360 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
361
362 (define_insn_reservation "c86_4g_fp_mov_direct_store" 5
363 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
364 (and (eq_attr "c86_decode" "direct")
365 (and (eq_attr "type" "fmov")
366 (eq_attr "memory" "store"))))
367 "c86-4g-direct,c86-4g-fp2|c86-4g-fp3,c86-4g-store")
368
369 (define_insn_reservation "c86_4g_fp_mov_double" 4
370 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
371 (and (eq_attr "c86_decode" "double")
372 (and (eq_attr "type" "fmov")
373 (eq_attr "memory" "none"))))
374 "c86-4g-double,c86-4g-fp1")
375
376 (define_insn_reservation "c86_4g_fp_mov_double_load" 12
377 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
378 (and (eq_attr "c86_decode" "double")
379 (and (eq_attr "type" "fmov")
380 (eq_attr "memory" "load"))))
381 "c86-4g-double,c86-4g-load,c86-4g-fp1")
382
383 (define_insn_reservation "c86_4g_fp_mov_direct" 1
384 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
385 (and (eq_attr "c86_decode" "direct")
386 (and (eq_attr "type" "fmov")
387 (eq_attr "memory" "none"))))
388 "c86-4g-direct,c86-4g-fp1")
389
390 ;; SQRT
391 (define_insn_reservation "c86_4g_fp_sqrt" 22
392 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
393 (and (eq_attr "type" "fpspc")
394 (eq_attr "c86_attr" "sqrt")))
395 "c86-4g-direct,c86-4g-fp1fdivx4,c86-4g-fdiv*18")
396
397 (define_insn_reservation "c86_4g_sse_sqrt_sf" 14
398 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
399 (and (eq_attr "mode" "SF,V4SF,V8SF")
400 (and (eq_attr "memory" "none,unknown")
401 (and (eq_attr "c86_attr" "sqrt")
402 (eq_attr "type" "sse")))))
403 "c86-4g-direct,c86-4g-fp1fdivx4,c86-4g-fdiv*10")
404
405 (define_insn_reservation "c86_4g_sse_sqrt_sf_mem" 21
406 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
407 (and (eq_attr "mode" "SF,V4SF,V8SF")
408 (and (eq_attr "memory" "load")
409 (and (eq_attr "c86_attr" "sqrt")
410 (eq_attr "type" "sse")))))
411 "c86-4g-direct,c86-4g-load,c86-4g-fp1fdivx4,c86-4g-fdiv*10")
412
413 (define_insn_reservation "c86_4g_sse_sqrt_df" 20
414 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
415 (and (eq_attr "mode" "DF,V2DF,V4DF")
416 (and (eq_attr "memory" "none,unknown")
417 (and (eq_attr "c86_attr" "sqrt")
418 (eq_attr "type" "sse")))))
419 "c86-4g-direct,c86-4g-fp1fdivx4,c86-4g-fdiv*16")
420
421 (define_insn_reservation "c86_4g_sse_sqrt_df_mem" 27
422 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
423 (and (eq_attr "mode" "DF,V2DF,V4DF")
424 (and (eq_attr "memory" "load")
425 (and (eq_attr "c86_attr" "sqrt")
426 (eq_attr "type" "sse")))))
427 "c86-4g-direct,c86-4g-load,c86-4g-fp1fdivx4,c86-4g-fdiv*16")
428
429 ;; RCP
430 (define_insn_reservation "c86_4g_sse_rcp" 5
431 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
432 (and (eq_attr "mode" "V4SF,V8SF,SF")
433 (and (eq_attr "memory" "none")
434 (and (eq_attr "c86_attr" "rcp")
435 (eq_attr "type" "sse")))))
436 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
437
438 (define_insn_reservation "c86_4g_sse_rcp_mem" 12
439 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
440 (and (eq_attr "mode" "V4SF,V8SF,SF")
441 (and (eq_attr "memory" "load")
442 (and (eq_attr "c86_attr" "rcp")
443 (eq_attr "type" "sse")))))
444 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
445
446 ;; TODO: AGU?
447 (define_insn_reservation "c86_4g_fp_spc_direct" 5
448 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
449 (and (eq_attr "c86_decode" "direct")
450 (and (eq_attr "type" "fpspc")
451 (eq_attr "memory" "store"))))
452 "c86-4g-direct,c86-4g-fp3")
453
454 ;; FABS
455 (define_insn_reservation "c86_4g_fp_absneg" 1
456 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
457 (eq_attr "type" "fsgn"))
458 "c86-4g-direct,c86-4g-fp1|c86-4g-fp3")
459
460 ;; FCMP
461 (define_insn_reservation "c86_4g_fp_fcmp" 5
462 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
463 (and (eq_attr "memory" "none")
464 (and (eq_attr "c86_decode" "double")
465 (eq_attr "type" "fcmp"))))
466 "c86-4g-double,c86-4g-fp0,c86-4g-fp1")
467
468 (define_insn_reservation "c86_4g_fp_fcmp_load" 12
469 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
470 (and (eq_attr "memory" "load")
471 (and (eq_attr "c86_decode" "double")
472 (eq_attr "type" "fcmp"))))
473 "c86-4g-double,c86-4g-load, c86-4g-fp0,c86-4g-fp1")
474
475 ;;FADD FSUB FMUL
476 (define_insn_reservation "c86_4g_fp_op_mul" 5
477 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
478 (and (eq_attr "type" "fop,fmul")
479 (eq_attr "memory" "none")))
480 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
481
482 (define_insn_reservation "c86_4g_fp_op_mul_load" 12
483 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
484 (and (eq_attr "type" "fop,fmul")
485 (and (eq_attr "fp_int_src" "false")
486 (eq_attr "memory" "load"))))
487 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
488
489 (define_insn_reservation "c86_4g_fp_op_imul_load" 16
490 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
491 (and (eq_attr "type" "fop,fmul")
492 (and (eq_attr "fp_int_src" "true")
493 (eq_attr "memory" "load"))))
494 "c86-4g-double,c86-4g-load,c86-4g-fp0,c86-4g-fp0|c86-4g-fp2")
495
496 (define_insn_reservation "c86_4g_fp_op_div" 15
497 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
498 (and (eq_attr "type" "fdiv")
499 (eq_attr "memory" "none")))
500 "c86-4g-direct,c86-4g-fp1fdivx4,c86-4g-fdiv*11")
501
502 (define_insn_reservation "c86_4g_fp_op_div_load" 22
503 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
504 (and (eq_attr "type" "fdiv")
505 (eq_attr "memory" "load")))
506 "c86-4g-direct,c86-4g-load,c86-4g-fp1fdivx4,c86-4g-fdiv*11")
507
508 (define_insn_reservation "c86_4g_fp_op_idiv_load" 26
509 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
510 (and (eq_attr "type" "fdiv")
511 (and (eq_attr "fp_int_src" "true")
512 (eq_attr "memory" "load"))))
513 "c86-4g-double,c86-4g-load,c86-4g-fp1*4,c86-4g-fp1fdivx4,c86-4g-fdiv*11")
514
515 ;; MMX, SSE, SSEn.n, AVX, AVX2 instructions
516 (define_insn_reservation "c86_4g_fp_insn" 1
517 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
518 (eq_attr "type" "mmx"))
519 "c86-4g-direct,c86-4g-fpu")
520
521 (define_insn_reservation "c86_4g_mmx_add" 1
522 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
523 (and (eq_attr "type" "mmxadd")
524 (eq_attr "memory" "none")))
525 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1|c86-4g-fp3")
526
527 (define_insn_reservation "c86_4g_mmx_add_load" 8
528 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
529 (and (eq_attr "type" "mmxadd")
530 (eq_attr "memory" "load")))
531 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1|c86-4g-fp3")
532
533 (define_insn_reservation "c86_4g_mmx_hadd" 3
534 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
535 (and (eq_attr "type" "sseadd1")
536 (eq_attr "memory" "none")))
537 "c86-4g-direct,c86-4g-fp0")
538
539 (define_insn_reservation "c86_4g_mmx_hadd_load" 10
540 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
541 (and (eq_attr "type" "sseadd1")
542 (eq_attr "memory" "load")))
543 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
544
545 (define_insn_reservation "c86_4g_mmx_cmp" 1
546 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
547 (and (eq_attr "type" "mmxcmp")
548 (eq_attr "memory" "none")))
549 "c86-4g-direct,c86-4g-fp0|c86-4g-fp3")
550
551 (define_insn_reservation "c86_4g_mmx_cmp_load" 8
552 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
553 (and (eq_attr "type" "mmxcmp")
554 (eq_attr "memory" "load")))
555 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp3")
556
557 (define_insn_reservation "c86_4g_mmx_cvt_pck_shuf" 1
558 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
559 (and (eq_attr "type" "mmxcvt,sseshuf,sseshuf1")
560 (eq_attr "memory" "none")))
561 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
562
563 (define_insn_reservation "c86_4g_mmx_cvt_pck_shuf_load" 8
564 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
565 (and (eq_attr "type" "mmxcvt,sseshuf,sseshuf1")
566 (eq_attr "memory" "load")))
567 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1")
568
569 (define_insn_reservation "c86_4g_mmx_shift" 1
570 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
571 (and (eq_attr "type" "mmxshft")
572 (eq_attr "memory" "none")))
573 "c86-4g-direct,c86-4g-fp1")
574
575 (define_insn_reservation "c86_4g_mmx_move" 4
576 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
577 (and (eq_attr "type" "mmxmov")
578 (eq_attr "memory" "none")))
579 "c86-4g-direct,c86-4g-fp1")
580
581 (define_insn_reservation "c86_4g_mmx_shift_load" 8
582 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
583 (and (eq_attr "type" "mmxshft")
584 (eq_attr "memory" "load")))
585 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
586
587 (define_insn_reservation "c86_4g_mmx_move_load" 11
588 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
589 (and (eq_attr "type" "mmxshft")
590 (eq_attr "memory" "load")))
591 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
592
593 (define_insn_reservation "c86_4g_mmx_move_store" 1
594 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
595 (and (eq_attr "type" "mmxshft,mmxmov")
596 (eq_attr "memory" "store,both")))
597 "c86-4g-direct,c86-4g-fp2,c86-4g-store")
598
599 (define_insn_reservation "c86_4g_mmx_mul" 3
600 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
601 (and (eq_attr "type" "mmxmul")
602 (eq_attr "memory" "none")))
603 "c86-4g-direct,c86-4g-fp0")
604
605 (define_insn_reservation "c86_4g_mmx_mul_load" 10
606 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
607 (and (eq_attr "type" "mmxmul")
608 (eq_attr "memory" "load")))
609 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
610
611 ;; sseabs
612 (define_insn_reservation "c86_4g_sse_abs" 1
613 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
614 (and (eq_attr "c86_attr" "abs")
615 (and (eq_attr "type" "sselog1")
616 (eq_attr "memory" "none"))))
617 "c86-4g-double,c86-4g-fpu")
618
619 (define_insn_reservation "c86_4g_sse_pinsr_reg" 3
620 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
621 (and (eq_attr "type" "sselog")
622 (and (eq_attr "c86_attr" "insr")
623 (and (match_operand 2 "register_operand")
624 (eq_attr "memory" "none")))))
625 "c86-4g-direct,c86-4g-ieu2,c86-4g-fp0|c86-4g-fp1")
626
627 (define_insn_reservation "c86_4g_sse_pinsr" 1
628 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
629 (and (eq_attr "type" "sselog")
630 (and (eq_attr "c86_attr" "insr")
631 (and (not (match_operand 2 "register_operand"))
632 (eq_attr "memory" "none")))))
633 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
634
635 (define_insn_reservation "c86_4g_sse_log" 1
636 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
637 (and (eq_attr "type" "sselog")
638 (and (eq_attr "c86_attr" "other")
639 (eq_attr "memory" "none"))))
640 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
641
642 (define_insn_reservation "c86_4g_sse_log_load" 8
643 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
644 (and (eq_attr "type" "sselog")
645 (and (eq_attr "c86_attr" "other")
646 (eq_attr "memory" "load"))))
647 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1")
648
649 (define_insn_reservation "c86_4g_sse_sign" 1
650 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
651 (and (eq_attr "type" "sselog1")
652 (and (eq_attr "c86_attr" "sign")
653 (eq_attr "memory" "none"))))
654 "c86-4g-direct,c86-4g-fpu")
655
656 (define_insn_reservation "c86_4g_sse_sign_load" 8
657 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
658 (and (eq_attr "type" "sselog1")
659 (and (eq_attr "c86_attr" "sign")
660 (eq_attr "memory" "!none"))))
661 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
662
663
664 (define_insn_reservation "c86_4g_sse_log1" 1
665 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
666 (and (eq_attr "type" "sselog1")
667 (and (eq_attr "c86_attr" "other")
668 (eq_attr "memory" "none"))))
669 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
670
671 (define_insn_reservation "c86_4g_sse_log1_load" 8
672 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
673 (and (eq_attr "type" "sselog1")
674 (and (eq_attr "c86_attr" "other")
675 (eq_attr "memory" "!none"))))
676 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1")
677
678 (define_insn_reservation "c86_4g_sse_extrq" 5
679 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
680 (and (eq_attr "type" "sse")
681 (and (eq_attr "memory" "none")
682 (eq_attr "prefix_data16" "1"))))
683 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
684
685 (define_insn_reservation "c86_4g_sse_movsdup" 1
686 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
687 (and (eq_attr "type" "sse")
688 (and (eq_attr "memory" "none")
689 (eq_attr "prefix" "vex"))))
690 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
691
692 (define_insn_reservation "c86_4g_sse_alignr" 1
693 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
694 (eq_attr "prefix_extra" "1"))
695 (and (eq_attr "type" "sseishft")
696 (eq_attr "memory" "none")))
697 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
698
699 (define_insn_reservation "c86_4g_sse_ishift" 1
700 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
701 (eq_attr "prefix_extra" "!1"))
702 (and (eq_attr "type" "sseishft")
703 (eq_attr "memory" "none")))
704 "c86-4g-direct,c86-4g-fp1")
705
706 (define_insn_reservation "c86_4g_sse_ishift_load" 8
707 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
708 (eq_attr "prefix_extra" "!1"))
709 (and (eq_attr "type" "sseishft")
710 (eq_attr "memory" "!none")))
711 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
712
713 (define_insn_reservation "c86_4g_sse_insertimm" 3
714 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
715 (and (eq_attr "type" "sseins")
716 (and (eq_attr "memory" "none")
717 (eq_attr "length_immediate" "2"))))
718 "c86-4g-direct,c86-4g-fp0")
719
720 (define_insn_reservation "c86_4g_sse_insert" 4
721 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
722 (and (eq_attr "type" "sseins")
723 (and (eq_attr "memory" "none")
724 (eq_attr "length_immediate" "!2"))))
725 "c86-4g-direct,c86-4g-fpu,c86-4g-fp0")
726
727 (define_insn_reservation "c86_4g_sse_comi" 5
728 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
729 (and (eq_attr "mode" "SF,DF,V4SF,V2DF")
730 (and (eq_attr "prefix" "!vex")
731 (and (eq_attr "prefix_extra" "0")
732 (and (eq_attr "type" "ssecomi")
733 (eq_attr "memory" "none"))))))
734 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2,c86-4g-fp1")
735
736 (define_insn_reservation "c86_4g_sse_comi_load" 12
737 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
738 (eq_attr "mode" "SF,DF,V4SF,V2DF"))
739 (and (eq_attr "prefix_extra" "0")
740 (and (eq_attr "type" "ssecomi")
741 (eq_attr "memory" "load"))))
742 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2,c86-4g-fp1")
743
744 (define_insn_reservation "c86_4g_sse_comi_double" 2
745 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
746 (eq_attr "mode" "V4SF,V2DF,TI"))
747 (and (eq_attr "prefix" "vex")
748 (and (eq_attr "prefix_extra" "0")
749 (and (eq_attr "type" "ssecomi")
750 (eq_attr "memory" "none")))))
751 "c86-4g-double,c86-4g-fp0|c86-4g-fp1")
752
753 (define_insn_reservation "c86_4g_sse_comi_double_load" 10
754 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
755 (eq_attr "mode" "V4SF,V2DF,TI"))
756 (and (eq_attr "prefix" "vex")
757 (and (eq_attr "prefix_extra" "0")
758 (and (eq_attr "type" "ssecomi")
759 (eq_attr "memory" "load")))))
760 "c86-4g-double,c86-4g-load,c86-4g-fp0|c86-4g-fp1")
761
762 (define_insn_reservation "c86_4g_sse_test" 4
763 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
764 (eq_attr "mode" "SF,DF,V4SF,V2DF,TI"))
765 (and (eq_attr "prefix_extra" "1")
766 (and (eq_attr "type" "ssecomi")
767 (eq_attr "memory" "none"))))
768 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
769
770 (define_insn_reservation "c86_4g_sse_test_load" 11
771 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
772 (eq_attr "mode" "SF,DF,V4SF,V2DF,TI"))
773 (and (eq_attr "prefix_extra" "1")
774 (and (eq_attr "type" "ssecomi")
775 (eq_attr "memory" "load"))))
776 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
777
778 (define_insn_reservation "c86_4g_avx256_test" 8
779 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
780 (eq_attr "mode" "V8SF,V4DF,OI"))
781 (and (eq_attr "prefix_extra" "1")
782 (and (eq_attr "type" "ssecomi")
783 (eq_attr "memory" "none"))))
784 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
785
786 (define_insn_reservation "c86_4g_avx256_test_load" 15
787 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
788 (eq_attr "mode" "V8SF,V4DF,OI"))
789 (and (eq_attr "prefix_extra" "1")
790 (and (eq_attr "type" "ssecomi")
791 (eq_attr "memory" "load"))))
792 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
793
794 ;; SSE moves
795 ;; Fix me: Need to revist this again some of the moves may be restricted
796 ;; to some fpu pipes.
797
798 ;; movnt doesn't touch cache, so latency modeling has little impact.
799 (define_insn_reservation "c86_4g_sse_movnt_load" 8
800 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
801 (and (eq_attr "c86_attr" "movnt")
802 (and (eq_attr "type" "ssemov,mmxmov,ssecvt")
803 (eq_attr "memory" "load"))))
804 "c86-4g-direct,c86-4g-load")
805
806 (define_insn_reservation "c86_4g_sse_movnt_store" 8
807 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
808 (and (eq_attr "c86_attr" "movnt")
809 (and (eq_attr "type" "ssemov,mmxmov,ssecvt")
810 (eq_attr "memory" "store"))))
811 "c86-4g-direct,c86-4g-fp1")
812
813 (define_insn_reservation "c86_4g_sse_mov" 2
814 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
815 (and (eq_attr "mode" "SI")
816 (and (eq_attr "isa" "avx")
817 (and (eq_attr "type" "ssemov")
818 (eq_attr "memory" "none")))))
819 "c86-4g-direct,c86-4g-ieu0")
820
821 (define_insn_reservation "c86_4g_avx_mov" 2
822 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
823 (and (eq_attr "mode" "TI")
824 (and (eq_attr "isa" "avx")
825 (and (eq_attr "type" "ssemov")
826 (and (match_operand:SI 1 "register_operand")
827 (eq_attr "memory" "none"))))))
828 "c86-4g-direct,c86-4g-ieu2")
829
830 (define_insn_reservation "c86_4g_sseavx_mov" 1
831 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
832 (eq_attr "mode" "SF,DF,V4SF,V2DF,TI"))
833 (and (eq_attr "prefix_extra" "0")
834 (and (eq_attr "type" "ssemov")
835 (eq_attr "memory" "none"))))
836 "c86-4g-direct,c86-4g-fpu")
837
838 (define_insn_reservation "c86_4g_sseavx_blend" 1
839 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
840 (eq_attr "mode" "SF,DF,V4SF,V2DF"))
841 (and (eq_attr "type" "ssemov,sselog1")
842 (and (eq_attr "c86_attr" "blend,blendv")
843 (eq_attr "memory" "none"))))
844 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
845
846 (define_insn_reservation "c86_4g_sseavx_mov_store" 1
847 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
848 (and (eq_attr "mode" "SF,DF,V4SF,V2DF,TI")
849 (and (eq_attr "type" "ssemov")
850 (eq_attr "memory" "store"))))
851 "c86-4g-direct,c86-4g-fpu,c86-4g-store")
852
853 (define_insn_reservation "c86_4g_sseavx_mov_load" 8
854 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
855 (eq_attr "mode" "SF,DF,V4SF,V2DF,TI"))
856 (and (eq_attr "type" "ssemov")
857 (eq_attr "memory" "load")))
858 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
859
860 (define_insn_reservation "c86_4g_avx256_mov" 1
861 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
862 (and (eq_attr "mode" "V8SF,V4DF,OI")
863 (and (eq_attr "type" "ssemov")
864 (eq_attr "memory" "none"))))
865 "c86-4g-double,c86-4g-fpu")
866
867 (define_insn_reservation "c86_4g_avx256_mov_store" 1
868 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
869 (and (eq_attr "mode" "V8SF,V4DF,OI")
870 (and (eq_attr "type" "ssemov")
871 (eq_attr "memory" "store"))))
872 "c86-4g-double,c86-4g-fpu,c86-4g-store")
873
874 (define_insn_reservation "c86_4g_avx256_mov_load" 8
875 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
876 (and (eq_attr "mode" "V8SF,V4DF,OI")
877 (and (eq_attr "type" "ssemov")
878 (eq_attr "memory" "load"))))
879 "c86-4g-double,c86-4g-load,c86-4g-fpu")
880
881 ;; SSE max & min
882 (define_insn_reservation "c86_4g_sse_maxmin" 1
883 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
884 (eq_attr "mode" "SF,DF,V4SF,V8SF,V2DF,V4DF,TI"))
885 (and (eq_attr "type" "sseadd")
886 (and (eq_attr "memory" "none")
887 (eq_attr "c86_attr" "maxmin"))))
888 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
889
890 (define_insn_reservation "c86_4g_sse_maxmin_load" 8
891 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
892 (eq_attr "mode" "SF,DF,V4SF,V8SF,V2DF,V4DF,TI"))
893 (and (eq_attr "type" "sseadd")
894 (and (eq_attr "memory" "load")
895 (eq_attr "c86_attr" "maxmin"))))
896 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
897
898 (define_insn_reservation "c86_4g_sse_pmaxmin" 1
899 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
900 (eq_attr "mode" "TI,OI"))
901 (and (eq_attr "type" "mmxadd,sseiadd")
902 (and (eq_attr "memory" "none")
903 (eq_attr "c86_attr" "maxmin"))))
904 "c86-4g-direct,c86-4g-fpu")
905
906 (define_insn_reservation "c86_4g_sse_pmaxmin_load" 8
907 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
908 (eq_attr "mode" "TI,OI"))
909 (and (eq_attr "type" "mmxadd,sseiadd")
910 (and (eq_attr "memory" "load")
911 (eq_attr "c86_attr" "maxmin"))))
912 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
913
914 ;; SSE avg
915 (define_insn_reservation "c86_4g_sse_avg" 1
916 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
917 (eq_attr "c86_attr" "avg"))
918 (and (eq_attr "type" "sseiadd,mmxshft")
919 (eq_attr "memory" "none")))
920 "c86-4g-direct,c86-4g-fpu")
921
922 (define_insn_reservation "c86_4g_sse_avg_load" 8
923 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
924 (eq_attr "c86_attr" "avg"))
925 (and (eq_attr "type" "sseiadd,mmxshft")
926 (eq_attr "memory" "load")))
927 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp3")
928
929 ;;MMX sadbw
930 (define_insn_reservation "c86_4g_sse_sadbw" 3
931 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
932 (and (eq_attr "type" "sseiadd,mmxshft")
933 (and (eq_attr "c86_attr" "sadbw")
934 (eq_attr "memory" "none"))))
935 "c86-4g-direct,c86-4g-fp0")
936
937 (define_insn_reservation "c86_4g_sse_sadbw_load" 10
938 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
939 (and (eq_attr "type" "sseiadd,mmxshft")
940 (and (eq_attr "c86_attr" "sadbw")
941 (eq_attr "memory" "load"))))
942 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
943
944 ;; SSE add
945 (define_insn_reservation "c86_4g_sse_add" 3
946 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
947 (and (eq_attr "type" "sseadd")
948 (and (eq_attr "memory" "none")
949 (eq_attr "c86_attr" "other"))))
950 "c86-4g-direct,c86-4g-fp1|c86-4g-fp3")
951
952 (define_insn_reservation "c86_4g_sse_add_load" 10
953 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
954 (and (eq_attr "type" "sseadd")
955 (and (eq_attr "memory" "load")
956 (eq_attr "c86_attr" "!maxmin"))))
957 "c86-4g-direct,c86-4g-load,c86-4g-fp1|c86-4g-fp3")
958
959 (define_insn_reservation "c86_4g_sse_fma" 5
960 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
961 (and (eq_attr "type" "ssemuladd")
962 (eq_attr "memory" "none")))
963 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
964
965 (define_insn_reservation "c86_4g_sse_fma_load" 12
966 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
967 (and (eq_attr "type" "ssemuladd")
968 (eq_attr "memory" "load")))
969 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
970
971 (define_insn_reservation "c86_4g_sse_iadd" 1
972 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
973 (and (eq_attr "type" "sseiadd")
974 (and (eq_attr "c86_attr" "other")
975 (eq_attr "memory" "none"))))
976 "c86-4g-direct,c86-4g-fpu")
977
978 (define_insn_reservation "c86_4g_sse_iadd_load" 8
979 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
980 (and (eq_attr "type" "sseiadd")
981 (eq_attr "memory" "load")))
982 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
983
984 ;; SSE conversions.
985 (define_insn_reservation "c86_4g_ssecvtsf_si_load" 12
986 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
987 (and (eq_attr "mode" "SI")
988 (and (eq_attr "type" "sseicvt")
989 (and (match_operand:SF 1 "memory_operand")
990 (eq_attr "memory" "load")))))
991 "c86-4g-double,c86-4g-load,c86-4g-fp3,c86-4g-ieu0")
992
993 (define_insn_reservation "c86_4g_ssecvtdf_si" 5
994 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
995 (and (eq_attr "mode" "SI")
996 (and (match_operand:DF 1 "register_operand")
997 (and (eq_attr "type" "sseicvt")
998 (eq_attr "memory" "none")))))
999 "c86-4g-double,c86-4g-fp3,c86-4g-ieu0")
1000
1001 (define_insn_reservation "c86_4g_ssecvtdf_si_load" 12
1002 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1003 (and (eq_attr "mode" "SI")
1004 (and (eq_attr "type" "sseicvt")
1005 (and (match_operand:DF 1 "memory_operand")
1006 (eq_attr "memory" "load")))))
1007 "c86-4g-double,c86-4g-load,c86-4g-fp3,c86-4g-ieu0")
1008
1009 ;; All other used ssecvt fp3 pipes
1010 ;; Check: Need to revisit this again.
1011 ;; Some SSE converts may use different pipe combinations.
1012 (define_insn_reservation "c86_4g_ssecvt" 4
1013 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1014 (and (eq_attr "type" "ssecvt")
1015 (and (eq_attr "c86_attr" "other")
1016 (eq_attr "memory" "none"))))
1017 "c86-4g-direct,c86-4g-fp1")
1018
1019 (define_insn_reservation "c86_4g_ssecvt_load" 11
1020 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1021 (and (eq_attr "type" "ssecvt")
1022 (and (eq_attr "c86_attr" "other")
1023 (eq_attr "memory" "load"))))
1024 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
1025
1026 ;; SSE div
1027 (define_insn_reservation "c86_4g_ssediv_ss_ps" 10
1028 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1029 (eq_attr "mode" "V4SF,SF"))
1030 (and (eq_attr "type" "ssediv")
1031 (eq_attr "memory" "none")))
1032 "c86-4g-direct,c86-4g-fp1fdivx4,c86-4g-fdiv*6")
1033
1034 (define_insn_reservation "c86_4g_ssediv_ss_ps_load" 17
1035 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1036 (eq_attr "mode" "V4SF,SF"))
1037 (and (eq_attr "type" "ssediv")
1038 (eq_attr "memory" "load")))
1039 "c86-4g-direct,c86-4g-load,c86-4g-fp1fdivx4,c86-4g-fdiv*6")
1040
1041 (define_insn_reservation "c86_4g_ssediv_sd_pd" 13
1042 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1043 (eq_attr "mode" "V2DF,DF"))
1044 (and (eq_attr "type" "ssediv")
1045 (eq_attr "memory" "none")))
1046 "c86-4g-direct,c86-4g-fp1fdivx4,c86-4g-fdiv*9")
1047
1048 (define_insn_reservation "c86_4g_ssediv_sd_pd_load" 20
1049 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1050 (eq_attr "mode" "V2DF,DF"))
1051 (and (eq_attr "type" "ssediv")
1052 (eq_attr "memory" "load")))
1053 "c86-4g-direct,c86-4g-load,c86-4g-fp1fdivx4,c86-4g-fdiv*9")
1054
1055
1056 (define_insn_reservation "c86_4g_ssediv_avx256_ps" 10
1057 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1058 (and (eq_attr "mode" "V8SF")
1059 (and (eq_attr "memory" "none")
1060 (eq_attr "type" "ssediv"))))
1061 "c86-4g-double,c86-4g-fp1fdivx4,c86-4g-fdiv*6")
1062
1063 (define_insn_reservation "c86_4g_ssediv_avx256_ps_load" 17
1064 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1065 (and (eq_attr "mode" "V8SF")
1066 (and (eq_attr "type" "ssediv")
1067 (eq_attr "memory" "load"))))
1068 "c86-4g-double,c86-4g-load,c86-4g-fp1fdivx4,c86-4g-fdiv*6")
1069
1070 (define_insn_reservation "c86_4g_ssediv_avx256_pd" 13
1071 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1072 (and (eq_attr "mode" "V4DF")
1073 (and (eq_attr "type" "ssediv")
1074 (eq_attr "memory" "none"))))
1075 "c86-4g-double,c86-4g-fp1fdivx4,c86-4g-fdiv*9")
1076
1077 (define_insn_reservation "c86_4g_ssediv_avx256_pd_load" 20
1078 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1079 (and (eq_attr "mode" "V4DF")
1080 (and (eq_attr "type" "ssediv")
1081 (eq_attr "memory" "load"))))
1082 "c86-4g-double,c86-4g-load,c86-4g-fp1fdivx4,c86-4g-fdiv*9")
1083 ;; SSE MUL
1084 (define_insn_reservation "c86_4g_ssemul_ss_ps" 3
1085 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1086 (eq_attr "mode" "V8SF,V4SF,SF"))
1087 (and (eq_attr "type" "ssemul")
1088 (eq_attr "memory" "none")))
1089 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
1090
1091 (define_insn_reservation "c86_4g_ssemul_ss_ps_load" 10
1092 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1093 (eq_attr "mode" "V8SF,V4SF,SF"))
1094 (and (eq_attr "type" "ssemul")
1095 (eq_attr "memory" "load")))
1096 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
1097
1098 (define_insn_reservation "c86_4g_ssemul_sd_pd" 4
1099 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1100 (eq_attr "mode" "V4DF,V2DF,DF"))
1101 (and (eq_attr "type" "ssemul")
1102 (eq_attr "memory" "none")))
1103 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
1104
1105 (define_insn_reservation "c86_4g_ssemul_sd_pd_load" 11
1106 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1107 (eq_attr "mode" "V4DF,V2DF,DF"))
1108 (and (eq_attr "type" "ssemul")
1109 (eq_attr "memory" "load")))
1110 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
1111
1112 ;;SSE imul
1113 (define_insn_reservation "c86_4g_sseimul" 3
1114 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1115 (eq_attr "mode" "TI"))
1116 (and (eq_attr "type" "sseimul")
1117 (eq_attr "memory" "none")))
1118 "c86-4g-direct,c86-4g-fp0")
1119
1120 (define_insn_reservation "c86_4g_sseimul_avx256" 4
1121 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1122 (and (eq_attr "mode" "OI")
1123 (and (eq_attr "type" "sseimul")
1124 (eq_attr "memory" "none"))))
1125 "c86-4g-double,c86-4g-fp0")
1126
1127 (define_insn_reservation "c86_4g_sseimul_load" 10
1128 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1129 (eq_attr "mode" "TI"))
1130 (and (eq_attr "type" "sseimul")
1131 (eq_attr "memory" "load")))
1132 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
1133
1134 (define_insn_reservation "c86_4g_sseimul_avx256_load" 11
1135 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1136 (and (eq_attr "mode" "OI")
1137 (and (eq_attr "type" "sseimul")
1138 (eq_attr "memory" "load"))))
1139 "c86-4g-double,c86-4g-load,c86-4g-fp0")
1140
1141 (define_insn_reservation "c86_4g_sseimul_di" 3
1142 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1143 (and (eq_attr "mode" "DI")
1144 (and (eq_attr "memory" "none")
1145 (eq_attr "type" "sseimul"))))
1146 "c86-4g-direct,c86-4g-fp0")
1147
1148 (define_insn_reservation "c86_4g_sseimul_load_di" 10
1149 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1150 (and (eq_attr "mode" "DI")
1151 (and (eq_attr "type" "sseimul")
1152 (eq_attr "memory" "load"))))
1153 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
1154
1155 ;; SSE compares
1156 (define_insn_reservation "c86_4g_sse_cmp" 1
1157 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1158 (eq_attr "mode" "SF,DF,V4SF,V2DF"))
1159 (and (eq_attr "type" "ssecmp")
1160 (eq_attr "memory" "none")))
1161 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
1162
1163 (define_insn_reservation "c86_4g_sse_cmp_load" 8
1164 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1165 (eq_attr "mode" "SF,DF,V4SF,V2DF"))
1166 (and (eq_attr "type" "ssecmp")
1167 (eq_attr "memory" "load")))
1168 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
1169
1170
1171 (define_insn_reservation "c86_4g_sse_cmp_avx256" 1
1172 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1173 (and (eq_attr "mode" "V8SF,V4DF")
1174 (and (eq_attr "type" "ssecmp")
1175 (eq_attr "memory" "none"))))
1176 "c86-4g-double,c86-4g-fp0|c86-4g-fp2")
1177
1178 (define_insn_reservation "c86_4g_sse_cmp_avx256_load" 8
1179 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1180 (and (eq_attr "mode" "V8SF,V4DF")
1181 (and (eq_attr "type" "ssecmp")
1182 (eq_attr "memory" "load"))))
1183 "c86-4g-double,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
1184
1185 (define_insn_reservation "c86_4g_sse_icmp" 1
1186 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1187 (eq_attr "mode" "QI,HI,SI,DI,TI"))
1188 (and (eq_attr "type" "ssecmp")
1189 (eq_attr "memory" "none")))
1190 "c86-4g-direct,c86-4g-fpu")
1191
1192
1193 (define_insn_reservation "c86_4g_sse_icmp_load" 8
1194 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1195 (eq_attr "mode" "QI,HI,SI,DI,TI"))
1196 (and (eq_attr "type" "ssecmp")
1197 (eq_attr "memory" "load")))
1198 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
1199
1200
1201 (define_insn_reservation "c86_4g_sse_icmp_avx256" 1
1202 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1203 (and (eq_attr "mode" "OI")
1204 (and (eq_attr "type" "ssecmp")
1205 (eq_attr "memory" "none"))))
1206 "c86-4g-double,c86-4g-fpu")
1207
1208
1209 (define_insn_reservation "c86_4g_sse_icmp_avx256_load" 8
1210 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
1211 (and (eq_attr "mode" "OI")
1212 (and (eq_attr "type" "ssecmp")
1213 (eq_attr "memory" "load"))))
1214 "c86-4g-double,c86-4g-load,c86-4g-fpu")