Line 0
Link Here
|
|
|
1 |
;; Atom Scheduling |
2 |
;; Copyright (C) 2009 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 |
;; Atom is an in-order core with two integer pipelines. |
21 |
|
22 |
|
23 |
(define_attr "atom_unit" "sishuf,simul,jeu,complex,other" |
24 |
(const_string "other")) |
25 |
|
26 |
(define_attr "atom_sse_attr" "rcp,movdup,lfence,fence,prefetch,sqrt,mxcsr,other" |
27 |
(const_string "other")) |
28 |
|
29 |
(define_automaton "atom") |
30 |
|
31 |
;; Atom has two ports: port 0 and port 1 connecting to all execution units |
32 |
(define_cpu_unit "atom-port-0,atom-port-1" "atom") |
33 |
|
34 |
;; EU: Execution Unit |
35 |
;; Atom EUs are connected by port 0 or port 1. |
36 |
|
37 |
(define_cpu_unit "atom-eu-0, atom-eu-1, |
38 |
atom-imul-1, atom-imul-2, atom-imul-3, atom-imul-4" |
39 |
"atom") |
40 |
|
41 |
;; Some EUs have duplicated copied and can be accessed via either |
42 |
;; port 0 or port 1 |
43 |
;; (define_reservation "atom-port-either" "(atom-port-0 | atom-port-1)") |
44 |
|
45 |
;;; Some instructions is dual-pipe execution, need both ports |
46 |
;;; Complex multi-op macro-instructoins need both ports and all EUs |
47 |
(define_reservation "atom-port-dual" "(atom-port-0 + atom-port-1)") |
48 |
(define_reservation "atom-all-eu" "(atom-eu-0 + atom-eu-1 + |
49 |
atom-imul-1 + atom-imul-2 + atom-imul-3 + |
50 |
atom-imul-4)") |
51 |
|
52 |
;;; Most of simple instructions have 1 cycle latency. Some of them |
53 |
;;; issue in port 0, some in port 0 and some in either port. |
54 |
(define_reservation "atom-simple-0" "(atom-port-0 + atom-eu-0)") |
55 |
(define_reservation "atom-simple-1" "(atom-port-1 + atom-eu-1)") |
56 |
(define_reservation "atom-simple-either" "(atom-simple-0 | atom-simple-1)") |
57 |
|
58 |
;;; Some insn issues in port 0 with 3 cycle latency and 1 cycle tput |
59 |
(define_reservation "atom-eu-0-3-1" "(atom-port-0 + atom-eu-0, nothing*2)") |
60 |
|
61 |
;;; fmul insn can have 4 or 5 cycles latency |
62 |
(define_reservation "atom-fmul-5c" "(atom-port-0 + atom-eu-0), nothing*4") |
63 |
(define_reservation "atom-fmul-4c" "(atom-port-0 + atom-eu-0), nothing*3") |
64 |
|
65 |
;;; fadd can has 5 cycles latency depends on instruction forms |
66 |
(define_reservation "atom-fadd-5c" "(atom-port-1 + atom-eu-1), nothing*5") |
67 |
|
68 |
;;; imul insn has 5 cycles latency |
69 |
(define_reservation "atom-imul-32" |
70 |
"atom-imul-1, atom-imul-2, atom-imul-3, atom-imul-4, |
71 |
atom-port-0") |
72 |
;;; imul instruction excludes other non-FP instructions. |
73 |
(exclusion_set "atom-eu-0, atom-eu-1" |
74 |
"atom-imul-1, atom-imul-2, atom-imul-3, atom-imul-4") |
75 |
|
76 |
;;; dual-execution instructions can have 1,2,4,5 cycles latency depends on |
77 |
;;; instruction forms |
78 |
(define_reservation "atom-dual-1c" "(atom-port-dual + atom-eu-0 + atom-eu-1)") |
79 |
(define_reservation "atom-dual-2c" |
80 |
"(atom-port-dual + atom-eu-0 + atom-eu-1, nothing)") |
81 |
(define_reservation "atom-dual-5c" |
82 |
"(atom-port-dual + atom-eu-0 + atom-eu-1, nothing*4)") |
83 |
|
84 |
;;; Complex macro-instruction has variants of latency, and uses both ports. |
85 |
(define_reservation "atom-complex" "(atom-port-dual + atom-all-eu)") |
86 |
|
87 |
(define_insn_reservation "atom_other" 9 |
88 |
(and (eq_attr "cpu" "atom") |
89 |
(and (eq_attr "type" "other") |
90 |
(eq_attr "atom_unit" "!jeu"))) |
91 |
"atom-complex, atom-all-eu*8") |
92 |
|
93 |
;; return has type "other" with atom_unit "jeu" |
94 |
(define_insn_reservation "atom_other_2" 1 |
95 |
(and (eq_attr "cpu" "atom") |
96 |
(and (eq_attr "type" "other") |
97 |
(eq_attr "atom_unit" "jeu"))) |
98 |
"atom-dual-1c") |
99 |
|
100 |
(define_insn_reservation "atom_multi" 9 |
101 |
(and (eq_attr "cpu" "atom") |
102 |
(eq_attr "type" "multi")) |
103 |
"atom-complex, atom-all-eu*8") |
104 |
|
105 |
;; Normal alu insns without carry |
106 |
(define_insn_reservation "atom_alu" 1 |
107 |
(and (eq_attr "cpu" "atom") |
108 |
(and (eq_attr "type" "alu") |
109 |
(and (eq_attr "memory" "none") |
110 |
(eq_attr "use_carry" "0")))) |
111 |
"atom-simple-either") |
112 |
|
113 |
;; Normal alu insns without carry |
114 |
(define_insn_reservation "atom_alu_mem" 1 |
115 |
(and (eq_attr "cpu" "atom") |
116 |
(and (eq_attr "type" "alu") |
117 |
(and (eq_attr "memory" "!none") |
118 |
(eq_attr "use_carry" "0")))) |
119 |
"atom-simple-either") |
120 |
|
121 |
;; Alu insn consuming CF, such as add/sbb |
122 |
(define_insn_reservation "atom_alu_carry" 1 |
123 |
(and (eq_attr "cpu" "atom") |
124 |
(and (eq_attr "type" "alu") |
125 |
(and (eq_attr "memory" "none") |
126 |
(eq_attr "use_carry" "1")))) |
127 |
"atom-simple-either") |
128 |
|
129 |
;; Alu insn consuming CF, such as add/sbb |
130 |
(define_insn_reservation "atom_alu_carry_mem" 1 |
131 |
(and (eq_attr "cpu" "atom") |
132 |
(and (eq_attr "type" "alu") |
133 |
(and (eq_attr "memory" "!none") |
134 |
(eq_attr "use_carry" "1")))) |
135 |
"atom-simple-either") |
136 |
|
137 |
(define_insn_reservation "atom_alu1" 1 |
138 |
(and (eq_attr "cpu" "atom") |
139 |
(and (eq_attr "type" "alu1") |
140 |
(eq_attr "memory" "none"))) |
141 |
"atom-simple-either") |
142 |
|
143 |
(define_insn_reservation "atom_alu1_mem" 1 |
144 |
(and (eq_attr "cpu" "atom") |
145 |
(and (eq_attr "type" "alu1") |
146 |
(eq_attr "memory" "!none"))) |
147 |
"atom-simple-either") |
148 |
|
149 |
(define_insn_reservation "atom_negnot" 1 |
150 |
(and (eq_attr "cpu" "atom") |
151 |
(and (eq_attr "type" "negnot") |
152 |
(eq_attr "memory" "none"))) |
153 |
"atom-simple-either") |
154 |
|
155 |
(define_insn_reservation "atom_negnot_mem" 1 |
156 |
(and (eq_attr "cpu" "atom") |
157 |
(and (eq_attr "type" "negnot") |
158 |
(eq_attr "memory" "!none"))) |
159 |
"atom-simple-either") |
160 |
|
161 |
(define_insn_reservation "atom_imov" 1 |
162 |
(and (eq_attr "cpu" "atom") |
163 |
(and (eq_attr "type" "imov") |
164 |
(eq_attr "memory" "none"))) |
165 |
"atom-simple-either") |
166 |
|
167 |
(define_insn_reservation "atom_imov_mem" 1 |
168 |
(and (eq_attr "cpu" "atom") |
169 |
(and (eq_attr "type" "imov") |
170 |
(eq_attr "memory" "!none"))) |
171 |
"atom-simple-either") |
172 |
|
173 |
;; 16<-16, 32<-32 |
174 |
(define_insn_reservation "atom_imovx" 1 |
175 |
(and (eq_attr "cpu" "atom") |
176 |
(and (eq_attr "type" "imovx") |
177 |
(and (eq_attr "memory" "none") |
178 |
(ior (and (match_operand:HI 0 "register_operand") |
179 |
(match_operand:HI 1 "general_operand")) |
180 |
(and (match_operand:SI 0 "register_operand") |
181 |
(match_operand:SI 1 "general_operand")))))) |
182 |
"atom-simple-either") |
183 |
|
184 |
;; 16<-16, 32<-32, mem |
185 |
(define_insn_reservation "atom_imovx_mem" 1 |
186 |
(and (eq_attr "cpu" "atom") |
187 |
(and (eq_attr "type" "imovx") |
188 |
(and (eq_attr "memory" "!none") |
189 |
(ior (and (match_operand:HI 0 "register_operand") |
190 |
(match_operand:HI 1 "general_operand")) |
191 |
(and (match_operand:SI 0 "register_operand") |
192 |
(match_operand:SI 1 "general_operand")))))) |
193 |
"atom-simple-either") |
194 |
|
195 |
;; 32<-16, 32<-8, 64<-16, 64<-8, 64<-32, 8<-8 |
196 |
(define_insn_reservation "atom_imovx_2" 1 |
197 |
(and (eq_attr "cpu" "atom") |
198 |
(and (eq_attr "type" "imovx") |
199 |
(and (eq_attr "memory" "none") |
200 |
(ior (match_operand:QI 0 "register_operand") |
201 |
(ior (and (match_operand:SI 0 "register_operand") |
202 |
(not (match_operand:SI 1 "general_operand"))) |
203 |
(match_operand:DI 0 "register_operand")))))) |
204 |
"atom-simple-0") |
205 |
|
206 |
;; 32<-16, 32<-8, 64<-16, 64<-8, 64<-32, 8<-8, mem |
207 |
(define_insn_reservation "atom_imovx_2_mem" 1 |
208 |
(and (eq_attr "cpu" "atom") |
209 |
(and (eq_attr "type" "imovx") |
210 |
(and (eq_attr "memory" "!none") |
211 |
(ior (match_operand:QI 0 "register_operand") |
212 |
(ior (and (match_operand:SI 0 "register_operand") |
213 |
(not (match_operand:SI 1 "general_operand"))) |
214 |
(match_operand:DI 0 "register_operand")))))) |
215 |
"atom-simple-0") |
216 |
|
217 |
;; 16<-8 |
218 |
(define_insn_reservation "atom_imovx_3" 3 |
219 |
(and (eq_attr "cpu" "atom") |
220 |
(and (eq_attr "type" "imovx") |
221 |
(and (match_operand:HI 0 "register_operand") |
222 |
(match_operand:QI 1 "general_operand")))) |
223 |
"atom-complex, atom-all-eu*2") |
224 |
|
225 |
(define_insn_reservation "atom_lea" 1 |
226 |
(and (eq_attr "cpu" "atom") |
227 |
(and (eq_attr "type" "lea") |
228 |
(eq_attr "mode" "!HI"))) |
229 |
"atom-simple-either") |
230 |
|
231 |
;; lea 16bit address is complex insn |
232 |
(define_insn_reservation "atom_lea_2" 2 |
233 |
(and (eq_attr "cpu" "atom") |
234 |
(and (eq_attr "type" "lea") |
235 |
(eq_attr "mode" "HI"))) |
236 |
"atom-complex, atom-all-eu") |
237 |
|
238 |
(define_insn_reservation "atom_incdec" 1 |
239 |
(and (eq_attr "cpu" "atom") |
240 |
(and (eq_attr "type" "incdec") |
241 |
(eq_attr "memory" "none"))) |
242 |
"atom-simple-either") |
243 |
|
244 |
(define_insn_reservation "atom_incdec_mem" 1 |
245 |
(and (eq_attr "cpu" "atom") |
246 |
(and (eq_attr "type" "incdec") |
247 |
(eq_attr "memory" "!none"))) |
248 |
"atom-simple-either") |
249 |
|
250 |
;; simple shift instruction use SHIFT eu, none memory |
251 |
(define_insn_reservation "atom_ishift" 1 |
252 |
(and (eq_attr "cpu" "atom") |
253 |
(and (eq_attr "type" "ishift") |
254 |
(and (eq_attr "memory" "none") (eq_attr "prefix_0f" "0")))) |
255 |
"atom-simple-0") |
256 |
|
257 |
;; simple shift instruction use SHIFT eu, memory |
258 |
(define_insn_reservation "atom_ishift_mem" 1 |
259 |
(and (eq_attr "cpu" "atom") |
260 |
(and (eq_attr "type" "ishift") |
261 |
(and (eq_attr "memory" "!none") (eq_attr "prefix_0f" "0")))) |
262 |
"atom-simple-0") |
263 |
|
264 |
;; DF shift (prefixed with 0f) is complex insn with latency of 7 cycles |
265 |
(define_insn_reservation "atom_ishift_3" 7 |
266 |
(and (eq_attr "cpu" "atom") |
267 |
(and (eq_attr "type" "ishift") |
268 |
(eq_attr "prefix_0f" "1"))) |
269 |
"atom-complex, atom-all-eu*6") |
270 |
|
271 |
(define_insn_reservation "atom_ishift1" 1 |
272 |
(and (eq_attr "cpu" "atom") |
273 |
(and (eq_attr "type" "ishift1") |
274 |
(eq_attr "memory" "none"))) |
275 |
"atom-simple-0") |
276 |
|
277 |
(define_insn_reservation "atom_ishift1_mem" 1 |
278 |
(and (eq_attr "cpu" "atom") |
279 |
(and (eq_attr "type" "ishift1") |
280 |
(eq_attr "memory" "!none"))) |
281 |
"atom-simple-0") |
282 |
|
283 |
(define_insn_reservation "atom_rotate" 1 |
284 |
(and (eq_attr "cpu" "atom") |
285 |
(and (eq_attr "type" "rotate") |
286 |
(eq_attr "memory" "none"))) |
287 |
"atom-simple-0") |
288 |
|
289 |
(define_insn_reservation "atom_rotate_mem" 1 |
290 |
(and (eq_attr "cpu" "atom") |
291 |
(and (eq_attr "type" "rotate") |
292 |
(eq_attr "memory" "!none"))) |
293 |
"atom-simple-0") |
294 |
|
295 |
(define_insn_reservation "atom_rotate1" 1 |
296 |
(and (eq_attr "cpu" "atom") |
297 |
(and (eq_attr "type" "rotate1") |
298 |
(eq_attr "memory" "none"))) |
299 |
"atom-simple-0") |
300 |
|
301 |
(define_insn_reservation "atom_rotate1_mem" 1 |
302 |
(and (eq_attr "cpu" "atom") |
303 |
(and (eq_attr "type" "rotate1") |
304 |
(eq_attr "memory" "!none"))) |
305 |
"atom-simple-0") |
306 |
|
307 |
(define_insn_reservation "atom_imul" 5 |
308 |
(and (eq_attr "cpu" "atom") |
309 |
(and (eq_attr "type" "imul") |
310 |
(and (eq_attr "memory" "none") (eq_attr "mode" "SI")))) |
311 |
"atom-imul-32") |
312 |
|
313 |
(define_insn_reservation "atom_imul_mem" 5 |
314 |
(and (eq_attr "cpu" "atom") |
315 |
(and (eq_attr "type" "imul") |
316 |
(and (eq_attr "memory" "!none") (eq_attr "mode" "SI")))) |
317 |
"atom-imul-32") |
318 |
|
319 |
;; latency set to 10 as common 64x64 imul |
320 |
(define_insn_reservation "atom_imul_3" 10 |
321 |
(and (eq_attr "cpu" "atom") |
322 |
(and (eq_attr "type" "imul") |
323 |
(eq_attr "mode" "!SI"))) |
324 |
"atom-complex, atom-all-eu*9") |
325 |
|
326 |
(define_insn_reservation "atom_idiv" 65 |
327 |
(and (eq_attr "cpu" "atom") |
328 |
(eq_attr "type" "idiv")) |
329 |
"atom-complex, atom-all-eu*32, nothing*32") |
330 |
|
331 |
(define_insn_reservation "atom_icmp" 1 |
332 |
(and (eq_attr "cpu" "atom") |
333 |
(and (eq_attr "type" "icmp") |
334 |
(eq_attr "memory" "none"))) |
335 |
"atom-simple-either") |
336 |
|
337 |
(define_insn_reservation "atom_icmp_mem" 1 |
338 |
(and (eq_attr "cpu" "atom") |
339 |
(and (eq_attr "type" "icmp") |
340 |
(eq_attr "memory" "!none"))) |
341 |
"atom-simple-either") |
342 |
|
343 |
(define_insn_reservation "atom_test" 1 |
344 |
(and (eq_attr "cpu" "atom") |
345 |
(and (eq_attr "type" "test") |
346 |
(eq_attr "memory" "none"))) |
347 |
"atom-simple-either") |
348 |
|
349 |
(define_insn_reservation "atom_test_mem" 1 |
350 |
(and (eq_attr "cpu" "atom") |
351 |
(and (eq_attr "type" "test") |
352 |
(eq_attr "memory" "!none"))) |
353 |
"atom-simple-either") |
354 |
|
355 |
(define_insn_reservation "atom_ibr" 1 |
356 |
(and (eq_attr "cpu" "atom") |
357 |
(and (eq_attr "type" "ibr") |
358 |
(eq_attr "memory" "!load"))) |
359 |
"atom-simple-1") |
360 |
|
361 |
;; complex if jump target is from address |
362 |
(define_insn_reservation "atom_ibr_2" 2 |
363 |
(and (eq_attr "cpu" "atom") |
364 |
(and (eq_attr "type" "ibr") |
365 |
(eq_attr "memory" "load"))) |
366 |
"atom-complex, atom-all-eu") |
367 |
|
368 |
(define_insn_reservation "atom_setcc" 1 |
369 |
(and (eq_attr "cpu" "atom") |
370 |
(and (eq_attr "type" "setcc") |
371 |
(eq_attr "memory" "!store"))) |
372 |
"atom-simple-either") |
373 |
|
374 |
;; 2 cycles complex if target is in memory |
375 |
(define_insn_reservation "atom_setcc_2" 2 |
376 |
(and (eq_attr "cpu" "atom") |
377 |
(and (eq_attr "type" "setcc") |
378 |
(eq_attr "memory" "store"))) |
379 |
"atom-complex, atom-all-eu") |
380 |
|
381 |
(define_insn_reservation "atom_icmov" 1 |
382 |
(and (eq_attr "cpu" "atom") |
383 |
(and (eq_attr "type" "icmov") |
384 |
(eq_attr "memory" "none"))) |
385 |
"atom-simple-either") |
386 |
|
387 |
(define_insn_reservation "atom_icmov_mem" 1 |
388 |
(and (eq_attr "cpu" "atom") |
389 |
(and (eq_attr "type" "icmov") |
390 |
(eq_attr "memory" "!none"))) |
391 |
"atom-simple-either") |
392 |
|
393 |
;; UCODE if segreg, ignored |
394 |
(define_insn_reservation "atom_push" 2 |
395 |
(and (eq_attr "cpu" "atom") |
396 |
(eq_attr "type" "push")) |
397 |
"atom-dual-2c") |
398 |
|
399 |
;; pop r64 is 1 cycle. UCODE if segreg, ignored |
400 |
(define_insn_reservation "atom_pop" 1 |
401 |
(and (eq_attr "cpu" "atom") |
402 |
(and (eq_attr "type" "pop") |
403 |
(eq_attr "mode" "DI"))) |
404 |
"atom-dual-1c") |
405 |
|
406 |
;; pop non-r64 is 2 cycles. UCODE if segreg, ignored |
407 |
(define_insn_reservation "atom_pop_2" 2 |
408 |
(and (eq_attr "cpu" "atom") |
409 |
(and (eq_attr "type" "pop") |
410 |
(eq_attr "mode" "!DI"))) |
411 |
"atom-dual-2c") |
412 |
|
413 |
;; UCODE if segreg, ignored |
414 |
(define_insn_reservation "atom_call" 1 |
415 |
(and (eq_attr "cpu" "atom") |
416 |
(eq_attr "type" "call")) |
417 |
"atom-dual-1c") |
418 |
|
419 |
(define_insn_reservation "atom_callv" 1 |
420 |
(and (eq_attr "cpu" "atom") |
421 |
(eq_attr "type" "callv")) |
422 |
"atom-dual-1c") |
423 |
|
424 |
(define_insn_reservation "atom_leave" 3 |
425 |
(and (eq_attr "cpu" "atom") |
426 |
(eq_attr "type" "leave")) |
427 |
"atom-complex, atom-all-eu*2") |
428 |
|
429 |
(define_insn_reservation "atom_str" 3 |
430 |
(and (eq_attr "cpu" "atom") |
431 |
(eq_attr "type" "str")) |
432 |
"atom-complex, atom-all-eu*2") |
433 |
|
434 |
(define_insn_reservation "atom_sselog" 1 |
435 |
(and (eq_attr "cpu" "atom") |
436 |
(and (eq_attr "type" "sselog") |
437 |
(eq_attr "memory" "none"))) |
438 |
"atom-simple-either") |
439 |
|
440 |
(define_insn_reservation "atom_sselog_mem" 1 |
441 |
(and (eq_attr "cpu" "atom") |
442 |
(and (eq_attr "type" "sselog") |
443 |
(eq_attr "memory" "!none"))) |
444 |
"atom-simple-either") |
445 |
|
446 |
(define_insn_reservation "atom_sselog1" 1 |
447 |
(and (eq_attr "cpu" "atom") |
448 |
(and (eq_attr "type" "sselog1") |
449 |
(eq_attr "memory" "none"))) |
450 |
"atom-simple-0") |
451 |
|
452 |
(define_insn_reservation "atom_sselog1_mem" 1 |
453 |
(and (eq_attr "cpu" "atom") |
454 |
(and (eq_attr "type" "sselog1") |
455 |
(eq_attr "memory" "!none"))) |
456 |
"atom-simple-0") |
457 |
|
458 |
;; not pmad, not psad |
459 |
(define_insn_reservation "atom_sseiadd" 1 |
460 |
(and (eq_attr "cpu" "atom") |
461 |
(and (eq_attr "type" "sseiadd") |
462 |
(and (not (match_operand:V2DI 0 "register_operand")) |
463 |
(and (eq_attr "atom_unit" "!simul") |
464 |
(eq_attr "atom_unit" "!complex"))))) |
465 |
"atom-simple-either") |
466 |
|
467 |
;; pmad, psad and 64 |
468 |
(define_insn_reservation "atom_sseiadd_2" 4 |
469 |
(and (eq_attr "cpu" "atom") |
470 |
(and (eq_attr "type" "sseiadd") |
471 |
(and (not (match_operand:V2DI 0 "register_operand")) |
472 |
(and (eq_attr "atom_unit" "simul" ) |
473 |
(eq_attr "mode" "DI"))))) |
474 |
"atom-fmul-4c") |
475 |
|
476 |
;; pmad, psad and 128 |
477 |
(define_insn_reservation "atom_sseiadd_3" 5 |
478 |
(and (eq_attr "cpu" "atom") |
479 |
(and (eq_attr "type" "sseiadd") |
480 |
(and (not (match_operand:V2DI 0 "register_operand")) |
481 |
(and (eq_attr "atom_unit" "simul" ) |
482 |
(eq_attr "mode" "TI"))))) |
483 |
"atom-fmul-5c") |
484 |
|
485 |
;; if paddq(64 bit op), phadd/phsub |
486 |
(define_insn_reservation "atom_sseiadd_4" 6 |
487 |
(and (eq_attr "cpu" "atom") |
488 |
(and (eq_attr "type" "sseiadd") |
489 |
(ior (match_operand:V2DI 0 "register_operand") |
490 |
(eq_attr "atom_unit" "complex")))) |
491 |
"atom-complex, atom-all-eu*5") |
492 |
|
493 |
;; if immediate op. |
494 |
(define_insn_reservation "atom_sseishft" 1 |
495 |
(and (eq_attr "cpu" "atom") |
496 |
(and (eq_attr "type" "sseishft") |
497 |
(and (eq_attr "atom_unit" "!sishuf") |
498 |
(match_operand 2 "immediate_operand")))) |
499 |
"atom-simple-either") |
500 |
|
501 |
;; if palignr or psrldq |
502 |
(define_insn_reservation "atom_sseishft_2" 1 |
503 |
(and (eq_attr "cpu" "atom") |
504 |
(and (eq_attr "type" "sseishft") |
505 |
(and (eq_attr "atom_unit" "sishuf") |
506 |
(match_operand 2 "immediate_operand")))) |
507 |
"atom-simple-0") |
508 |
|
509 |
;; if reg/mem op |
510 |
(define_insn_reservation "atom_sseishft_3" 2 |
511 |
(and (eq_attr "cpu" "atom") |
512 |
(and (eq_attr "type" "sseishft") |
513 |
(not (match_operand 2 "immediate_operand")))) |
514 |
"atom-complex, atom-all-eu") |
515 |
|
516 |
(define_insn_reservation "atom_sseimul" 1 |
517 |
(and (eq_attr "cpu" "atom") |
518 |
(eq_attr "type" "sseimul")) |
519 |
"atom-simple-0") |
520 |
|
521 |
;; rcpss or rsqrtss |
522 |
(define_insn_reservation "atom_sse" 4 |
523 |
(and (eq_attr "cpu" "atom") |
524 |
(and (eq_attr "type" "sse") |
525 |
(and (eq_attr "atom_sse_attr" "rcp") (eq_attr "mode" "SF")))) |
526 |
"atom-fmul-4c") |
527 |
|
528 |
;; movshdup, movsldup. Suggest to type sseishft |
529 |
(define_insn_reservation "atom_sse_2" 1 |
530 |
(and (eq_attr "cpu" "atom") |
531 |
(and (eq_attr "type" "sse") |
532 |
(eq_attr "atom_sse_attr" "movdup"))) |
533 |
"atom-simple-0") |
534 |
|
535 |
;; lfence |
536 |
(define_insn_reservation "atom_sse_3" 1 |
537 |
(and (eq_attr "cpu" "atom") |
538 |
(and (eq_attr "type" "sse") |
539 |
(eq_attr "atom_sse_attr" "lfence"))) |
540 |
"atom-simple-either") |
541 |
|
542 |
;; sfence,clflush,mfence, prefetch |
543 |
(define_insn_reservation "atom_sse_4" 1 |
544 |
(and (eq_attr "cpu" "atom") |
545 |
(and (eq_attr "type" "sse") |
546 |
(ior (eq_attr "atom_sse_attr" "fence") |
547 |
(eq_attr "atom_sse_attr" "prefetch")))) |
548 |
"atom-simple-0") |
549 |
|
550 |
;; rcpps, rsqrtss, sqrt, ldmxcsr |
551 |
(define_insn_reservation "atom_sse_5" 7 |
552 |
(and (eq_attr "cpu" "atom") |
553 |
(and (eq_attr "type" "sse") |
554 |
(ior (ior (eq_attr "atom_sse_attr" "sqrt") |
555 |
(eq_attr "atom_sse_attr" "mxcsr")) |
556 |
(and (eq_attr "atom_sse_attr" "rcp") |
557 |
(eq_attr "mode" "V4SF"))))) |
558 |
"atom-complex, atom-all-eu*6") |
559 |
|
560 |
;; xmm->xmm |
561 |
(define_insn_reservation "atom_ssemov" 1 |
562 |
(and (eq_attr "cpu" "atom") |
563 |
(and (eq_attr "type" "ssemov") |
564 |
(and (match_operand 0 "register_operand" "xy") (match_operand 1 "register_operand" "xy")))) |
565 |
"atom-simple-either") |
566 |
|
567 |
;; reg->xmm |
568 |
(define_insn_reservation "atom_ssemov_2" 1 |
569 |
(and (eq_attr "cpu" "atom") |
570 |
(and (eq_attr "type" "ssemov") |
571 |
(and (match_operand 0 "register_operand" "xy") (match_operand 1 "register_operand" "r")))) |
572 |
"atom-simple-0") |
573 |
|
574 |
;; xmm->reg |
575 |
(define_insn_reservation "atom_ssemov_3" 3 |
576 |
(and (eq_attr "cpu" "atom") |
577 |
(and (eq_attr "type" "ssemov") |
578 |
(and (match_operand 0 "register_operand" "r") (match_operand 1 "register_operand" "xy")))) |
579 |
"atom-eu-0-3-1") |
580 |
|
581 |
;; mov mem |
582 |
(define_insn_reservation "atom_ssemov_4" 1 |
583 |
(and (eq_attr "cpu" "atom") |
584 |
(and (eq_attr "type" "ssemov") |
585 |
(and (eq_attr "movu" "0") (eq_attr "memory" "!none")))) |
586 |
"atom-simple-0") |
587 |
|
588 |
;; movu mem |
589 |
(define_insn_reservation "atom_ssemov_5" 2 |
590 |
(and (eq_attr "cpu" "atom") |
591 |
(and (eq_attr "type" "ssemov") |
592 |
(ior (eq_attr "movu" "1") (eq_attr "memory" "!none")))) |
593 |
"atom-complex, atom-all-eu") |
594 |
|
595 |
;; no memory simple |
596 |
(define_insn_reservation "atom_sseadd" 5 |
597 |
(and (eq_attr "cpu" "atom") |
598 |
(and (eq_attr "type" "sseadd") |
599 |
(and (eq_attr "memory" "none") |
600 |
(and (eq_attr "mode" "!V2DF") |
601 |
(eq_attr "atom_unit" "!complex"))))) |
602 |
"atom-fadd-5c") |
603 |
|
604 |
;; memory simple |
605 |
(define_insn_reservation "atom_sseadd_mem" 5 |
606 |
(and (eq_attr "cpu" "atom") |
607 |
(and (eq_attr "type" "sseadd") |
608 |
(and (eq_attr "memory" "!none") |
609 |
(and (eq_attr "mode" "!V2DF") |
610 |
(eq_attr "atom_unit" "!complex"))))) |
611 |
"atom-dual-5c") |
612 |
|
613 |
;; maxps, minps, *pd, hadd, hsub |
614 |
(define_insn_reservation "atom_sseadd_3" 8 |
615 |
(and (eq_attr "cpu" "atom") |
616 |
(and (eq_attr "type" "sseadd") |
617 |
(ior (eq_attr "mode" "V2DF") (eq_attr "atom_unit" "complex")))) |
618 |
"atom-complex, atom-all-eu*7") |
619 |
|
620 |
;; Except dppd/dpps |
621 |
(define_insn_reservation "atom_ssemul" 5 |
622 |
(and (eq_attr "cpu" "atom") |
623 |
(and (eq_attr "type" "ssemul") |
624 |
(eq_attr "mode" "!SF"))) |
625 |
"atom-fmul-5c") |
626 |
|
627 |
;; Except dppd/dpps, 4 cycle if mulss |
628 |
(define_insn_reservation "atom_ssemul_2" 4 |
629 |
(and (eq_attr "cpu" "atom") |
630 |
(and (eq_attr "type" "ssemul") |
631 |
(eq_attr "mode" "SF"))) |
632 |
"atom-fmul-4c") |
633 |
|
634 |
(define_insn_reservation "atom_ssecmp" 1 |
635 |
(and (eq_attr "cpu" "atom") |
636 |
(eq_attr "type" "ssecmp")) |
637 |
"atom-simple-either") |
638 |
|
639 |
(define_insn_reservation "atom_ssecomi" 10 |
640 |
(and (eq_attr "cpu" "atom") |
641 |
(eq_attr "type" "ssecomi")) |
642 |
"atom-complex, atom-all-eu*9") |
643 |
|
644 |
;; no memory and cvtpi2ps, cvtps2pi, cvttps2pi |
645 |
(define_insn_reservation "atom_ssecvt" 5 |
646 |
(and (eq_attr "cpu" "atom") |
647 |
(and (eq_attr "type" "ssecvt") |
648 |
(ior (and (match_operand:V2SI 0 "register_operand") |
649 |
(match_operand:V4SF 1 "register_operand")) |
650 |
(and (match_operand:V4SF 0 "register_operand") |
651 |
(match_operand:V2SI 1 "register_operand"))))) |
652 |
"atom-fadd-5c") |
653 |
|
654 |
;; memory and cvtpi2ps, cvtps2pi, cvttps2pi |
655 |
(define_insn_reservation "atom_ssecvt_2" 5 |
656 |
(and (eq_attr "cpu" "atom") |
657 |
(and (eq_attr "type" "ssecvt") |
658 |
(ior (and (match_operand:V2SI 0 "register_operand") |
659 |
(match_operand:V4SF 1 "memory_operand")) |
660 |
(and (match_operand:V4SF 0 "register_operand") |
661 |
(match_operand:V2SI 1 "memory_operand"))))) |
662 |
"atom-dual-5c") |
663 |
|
664 |
;; otherwise. 7 cycles average for cvtss2sd |
665 |
(define_insn_reservation "atom_ssecvt_3" 7 |
666 |
(and (eq_attr "cpu" "atom") |
667 |
(and (eq_attr "type" "ssecvt") |
668 |
(not (ior (and (match_operand:V2SI 0 "register_operand") |
669 |
(match_operand:V4SF 1 "nonimmediate_operand")) |
670 |
(and (match_operand:V4SF 0 "register_operand") |
671 |
(match_operand:V2SI 1 "nonimmediate_operand")))))) |
672 |
"atom-complex, atom-all-eu*6") |
673 |
|
674 |
;; memory and cvtsi2sd |
675 |
(define_insn_reservation "atom_sseicvt" 5 |
676 |
(and (eq_attr "cpu" "atom") |
677 |
(and (eq_attr "type" "sseicvt") |
678 |
(and (match_operand:V2DF 0 "register_operand") |
679 |
(match_operand:SI 1 "memory_operand")))) |
680 |
"atom-dual-5c") |
681 |
|
682 |
;; otherwise. 8 cycles average for cvtsd2si |
683 |
(define_insn_reservation "atom_sseicvt_2" 8 |
684 |
(and (eq_attr "cpu" "atom") |
685 |
(and (eq_attr "type" "sseicvt") |
686 |
(not (and (match_operand:V2DF 0 "register_operand") |
687 |
(match_operand:SI 1 "memory_operand"))))) |
688 |
"atom-complex, atom-all-eu*7") |
689 |
|
690 |
(define_insn_reservation "atom_ssediv" 62 |
691 |
(and (eq_attr "cpu" "atom") |
692 |
(eq_attr "type" "ssediv")) |
693 |
"atom-complex, atom-all-eu*12, nothing*49") |
694 |
|
695 |
;; simple for fmov |
696 |
(define_insn_reservation "atom_fmov" 1 |
697 |
(and (eq_attr "cpu" "atom") |
698 |
(and (eq_attr "type" "fmov") |
699 |
(eq_attr "memory" "none"))) |
700 |
"atom-simple-either") |
701 |
|
702 |
;; simple for fmov |
703 |
(define_insn_reservation "atom_fmov_mem" 1 |
704 |
(and (eq_attr "cpu" "atom") |
705 |
(and (eq_attr "type" "fmov") |
706 |
(eq_attr "memory" "!none"))) |
707 |
"atom-simple-either") |
708 |
|
709 |
;; Define bypass here |
710 |
|
711 |
;; There will be no stall from lea to non-mem EX insns |
712 |
(define_bypass 0 "atom_lea" |
713 |
"atom_alu_carry, |
714 |
atom_alu,atom_alu1,atom_negnot,atom_imov,atom_imovx, |
715 |
atom_incdec, atom_setcc, atom_icmov, atom_pop") |
716 |
|
717 |
(define_bypass 0 "atom_lea" |
718 |
"atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem, |
719 |
atom_imovx_mem, atom_imovx_2_mem, |
720 |
atom_imov_mem, atom_icmov_mem, atom_fmov_mem" |
721 |
"!ix86_agi_dependent") |
722 |
|
723 |
;; There will be 3 cycles stall from EX insns to AGAN insns LEA |
724 |
(define_bypass 4 "atom_alu_carry, |
725 |
atom_alu,atom_alu1,atom_negnot,atom_imov,atom_imovx, |
726 |
atom_incdec,atom_ishift,atom_ishift1,atom_rotate, |
727 |
atom_rotate1, atom_setcc, atom_icmov, atom_pop, |
728 |
atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem, |
729 |
atom_imovx_mem, atom_imovx_2_mem, |
730 |
atom_imov_mem, atom_icmov_mem, atom_fmov_mem" |
731 |
"atom_lea") |
732 |
|
733 |
;; There will be 3 cycles stall from EX insns to insns need addr calculation |
734 |
(define_bypass 4 "atom_alu_carry, |
735 |
atom_alu,atom_alu1,atom_negnot,atom_imov,atom_imovx, |
736 |
atom_incdec,atom_ishift,atom_ishift1,atom_rotate, |
737 |
atom_rotate1, atom_setcc, atom_icmov, atom_pop, |
738 |
atom_imovx_mem, atom_imovx_2_mem, |
739 |
atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem, |
740 |
atom_imov_mem, atom_icmov_mem, atom_fmov_mem" |
741 |
"atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem, |
742 |
atom_negnot_mem, atom_imov_mem, atom_incdec_mem, |
743 |
atom_imovx_mem, atom_imovx_2_mem, |
744 |
atom_imul_mem, atom_icmp_mem, |
745 |
atom_test_mem, atom_icmov_mem, atom_sselog_mem, |
746 |
atom_sselog1_mem, atom_fmov_mem, atom_sseadd_mem, |
747 |
atom_ishift_mem, atom_ishift1_mem, |
748 |
atom_rotate_mem, atom_rotate1_mem" |
749 |
"ix86_agi_dependent") |
750 |
|
751 |
;; Stall from imul to lea is 8 cycles. |
752 |
(define_bypass 9 "atom_imul, atom_imul_mem" "atom_lea") |
753 |
|
754 |
;; Stall from imul to memory address is 8 cycles. |
755 |
(define_bypass 9 "atom_imul, atom_imul_mem" |
756 |
"atom_alu_mem, atom_alu_carry_mem, atom_alu1_mem, |
757 |
atom_negnot_mem, atom_imov_mem, atom_incdec_mem, |
758 |
atom_ishift_mem, atom_ishift1_mem, atom_rotate_mem, |
759 |
atom_rotate1_mem, atom_imul_mem, atom_icmp_mem, |
760 |
atom_test_mem, atom_icmov_mem, atom_sselog_mem, |
761 |
atom_sselog1_mem, atom_fmov_mem, atom_sseadd_mem" |
762 |
"ix86_agi_dependent") |
763 |
|
764 |
;; There will be 0 cycle stall from cmp/test to jcc |
765 |
|
766 |
;; There will be 1 cycle stall from flag producer to cmov and adc/sbb |
767 |
(define_bypass 2 "atom_icmp, atom_test, atom_alu, atom_alu_carry, |
768 |
atom_alu1, atom_negnot, atom_incdec, atom_ishift, |
769 |
atom_ishift1, atom_rotate, atom_rotate1" |
770 |
"atom_icmov, atom_alu_carry") |