OSDN Git Service

2010-05-17 Christian Borntraeger <borntraeger@de.ibm.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / s390 / 2097.md
1 ;; Scheduling description for z10 (cpu 2097).
2 ;; Copyright (C) 2008 Free Software Foundation, Inc.
3 ;; Contributed by Wolfgang Gellerich (gellerich@de.ibm.com).
4
5
6 ; General naming conventions used in this file:
7 ; - The two pipelines are called S and T, respectively.
8 ; - A name ending "_S" or "_T" indicates that something happens in
9 ;   (or belongs to) this pipeline.
10 ; - A name ending "_ANY" indicates that something happens in (or belongs
11 ;   to) either of the two pipelines.
12 ; - A name ending "_BOTH" indicates that something happens in (or belongs
13 ;   to) both pipelines.
14
15
16 ;; Automaton and components.
17
18 (define_automaton "z10_cpu")
19
20 (define_cpu_unit "z10_e1_S, z10_e1_T"  "z10_cpu")
21 (define_reservation "z10_e1_ANY" "(z10_e1_S | z10_e1_T)")
22 (define_reservation "z10_e1_BOTH" "(z10_e1_S + z10_e1_T)")
23
24
25 ; Both pipelines can execute a branch instruction, and branch
26 ; instructions can be grouped with all other groupable instructions
27 ; but not with a second branch instruction.
28
29 (define_cpu_unit "z10_branch_ANY"  "z10_cpu")
30
31 (define_insn_reservation "z10_branch" 4
32   (and (eq_attr "cpu" "z10")
33        (eq_attr "type" "branch"))
34   "z10_branch_ANY + z10_e1_ANY, z10_Gate_ANY")
35
36
37 ; Z10 operand and result forwarding.
38
39 ; Instructions marked with the attributes as z10_fwd or z10_fr can
40 ; forward a value they load from one of their operants into a register
41 ; if the instruction in the second pipeline reads the same register.
42 ; The second operation must be superscalar.  Instructions marked as
43 ; z10_rec or z10_fr can receive a value they read from a register is
44 ; this register gets updated by an instruction in the first pipeline.
45 ; The first instruction must be superscalar.
46
47
48 ; Forwarding from z10_fwd and z10_fr to z10_super.
49
50 (define_bypass 0 "z10_la_fwd, z10_la_fwd_A1, z10_larl_fwd, z10_larl_fwd_A3, \
51                   z10_load_fwd, z10_load_fwd_A3, \
52                   z10_other_fwd, z10_other_fwd_A1, z10_other_fwd_A3, \
53                   z10_other_fr, z10_other_fr_A3, z10_other_fr_E1, \
54                   z10_other_fwd_E1, z10_lr_fr, z10_lr_fr_E1, \
55                   z10_int_fwd, z10_int_fwd_A1, z10_int_fwd_A3, \
56                   z10_int_fwd_E1, z10_int_fr, z10_int_fr_E1, \
57                   z10_int_fr_A3"
58                   "z10_other_super, z10_other_super_c_E1, z10_other_super_E1, \
59                   z10_int_super, z10_int_super_E1, \
60                   z10_lr, z10_store_super"
61                   " ! s390_agen_dep_p")
62
63
64 ; Forwarding from z10_super to frz10_ and z10_rec.
65
66 (define_bypass 0 "z10_other_super, z10_other_super_E1, z10_other_super_c_E1, \
67                   z10_int_super, z10_int_super_E1, \
68                   z10_larl_super_E1, z10_larl_super, \
69                   z10_store_super"
70                   "z10_int_fr, z10_int_fr_E1, z10_int_fr_A3, \
71                   z10_other_fr, z10_other_fr_A3, z10_lr_fr, z10_lr_fr_E1, \
72                   z10_other_fr_E1, z10_store_rec"
73                   " ! s390_agen_dep_p")
74
75
76 ; Forwarding from z10_fwd and z10_fr to z10_rec and z10_fr.
77
78 (define_bypass 0 "z10_la_fwd, z10_la_fwd_A1, z10_larl_fwd, z10_larl_fwd_A3, \
79                   z10_load_fwd, z10_load_fwd_A3, \
80                   z10_other_fwd, z10_other_fwd_A1, z10_other_fwd_A3, \
81                   z10_other_fr, z10_other_fr_A3, z10_other_fr_E1, \
82                   z10_other_fwd_E1, \
83                   z10_lr_fr, z10_lr_fr_E1, \
84                   z10_int_fwd, z10_int_fwd_A1, z10_int_fwd_A3, \
85                   z10_int_fwd_E1, z10_int_fr, z10_int_fr_E1, \
86                   z10_int_fr_A3"
87                   "z10_int_fr, z10_int_fr_E1, z10_int_fr_A3, \
88                   z10_other_fr, z10_other_fr_A3, z10_lr_fr, z10_lr_fr_E1, \
89                   z10_other_fr_E1, z10_store_rec"
90                   " ! s390_agen_dep_p")
91
92
93 ;
94 ; Simple insns
95 ;
96
97 ; Here is the cycle diagram for FXU-executed instructions:
98 ; ... A1 A2 A3 E1 P1 P2 P3 R0 ...
99 ;        ^              ^  ^
100 ;        |              |  updated GPR is available
101 ;        |              write to GPR
102 ;        instruction reads GPR during this cycle
103
104
105 ; Variants of z10_int follow.
106
107 (define_insn_reservation "z10_int" 6
108   (and (and (eq_attr "cpu" "z10")
109             (eq_attr "type" "integer"))
110        (and (eq_attr "atype" "reg")
111              (and (and (eq_attr "z10prop" "!z10_super")
112                        (eq_attr "z10prop" "!z10_super_c"))
113                   (and (and (and (and (eq_attr "z10prop" "!z10_super_E1")
114                                       (eq_attr "z10prop" "!z10_super_c_E1"))
115                                   (eq_attr "z10prop" "!z10_fwd"))
116                              (and (eq_attr "z10prop" "!z10_fwd_A1")
117                                   (eq_attr "z10prop" "!z10_fwd_A3")))
118                         (and (and (eq_attr "z10prop" "!z10_fwd_E1")
119                                   (eq_attr "z10prop" "!z10_fr"))
120                              (and (eq_attr "z10prop" "!z10_fr_E1")
121                                   (eq_attr "z10prop" "!z10_fr_A3")))))))
122   "z10_e1_ANY, z10_Gate_ANY")
123
124 (define_insn_reservation "z10_int_super" 6
125   (and (eq_attr "cpu" "z10")
126        (and (eq_attr "type" "integer")
127             (and (eq_attr "atype" "reg")
128                  (ior (eq_attr "z10prop" "z10_super")
129                       (eq_attr "z10prop" "z10_super_c")))))
130   "z10_e1_ANY, z10_Gate_ANY")
131
132 (define_insn_reservation "z10_int_super_E1" 6
133   (and (eq_attr "cpu" "z10")
134        (and (eq_attr "type" "integer")
135             (and (eq_attr "atype" "reg")
136                  (ior (eq_attr "z10prop" "z10_super_E1")
137                       (eq_attr "z10prop" "z10_super_c_E1")))))
138   "z10_e1_ANY, z10_Gate_ANY")
139
140 (define_insn_reservation "z10_int_fwd" 6
141   (and (eq_attr "cpu" "z10")
142        (and (eq_attr "type" "integer")
143             (and (eq_attr "atype" "reg")
144                  (eq_attr "z10prop" "z10_fwd"))))
145   "z10_e1_ANY, z10_Gate_ANY")
146
147 (define_insn_reservation "z10_int_fwd_A1" 6
148   (and (eq_attr "cpu" "z10")
149        (and (eq_attr "type" "integer")
150             (and (eq_attr "atype" "reg")
151                  (eq_attr "z10prop" "z10_fwd_A1"))))
152   "z10_e1_ANY, z10_Gate_ANY")
153
154 (define_insn_reservation "z10_int_fwd_A3" 6
155   (and (eq_attr "cpu" "z10")
156        (and (eq_attr "type" "integer")
157             (and (eq_attr "atype" "reg")
158                  (eq_attr "z10prop" "z10_fwd_A3"))))
159   "z10_e1_ANY, z10_Gate_ANY")
160
161 (define_insn_reservation "z10_int_fwd_E1" 6
162   (and (eq_attr "cpu" "z10")
163        (and (eq_attr "type" "integer")
164             (and (eq_attr "atype" "reg")
165                  (eq_attr "z10prop" "z10_fwd_E1"))))
166   "z10_e1_ANY, z10_Gate_ANY")
167
168 (define_insn_reservation "z10_int_fr" 6
169   (and (eq_attr "cpu" "z10")
170        (and (eq_attr "type" "integer")
171             (and (eq_attr "atype" "reg")
172                  (eq_attr "z10prop" "z10_fr"))))
173   "z10_e1_ANY, z10_Gate_ANY")
174
175 (define_insn_reservation "z10_int_fr_E1" 6
176   (and (eq_attr "cpu" "z10")
177        (and (eq_attr "type" "integer")
178             (and (eq_attr "atype" "reg")
179                  (eq_attr "z10prop" "z10_fr_E1"))))
180   "z10_e1_ANY, z10_Gate_ANY")
181
182 (define_insn_reservation "z10_int_fr_A3" 6
183   (and (eq_attr "cpu" "z10")
184        (and (eq_attr "type" "integer")
185             (and (eq_attr "atype" "reg")
186                  (eq_attr "z10prop" "z10_fr_A3"))))
187   "z10_e1_ANY, z10_Gate_ANY")
188
189 ; END of z10_int variants
190
191
192 (define_insn_reservation "z10_agen" 6
193   (and (eq_attr "cpu" "z10")
194        (and (eq_attr "type" "integer")
195             (eq_attr "atype" "agen")))
196   "z10_e1_ANY, z10_Gate_ANY")
197
198
199 (define_insn_reservation "z10_lr" 6
200   (and (eq_attr "cpu" "z10")
201        (and (eq_attr "type" "lr")
202             (and (eq_attr "z10prop" "!z10_fr")
203                  (eq_attr "z10prop" "!z10_fr_E1"))))
204   "z10_e1_ANY, z10_Gate_ANY")
205
206 (define_insn_reservation "z10_lr_fr" 6
207   (and (eq_attr "cpu" "z10")
208        (and (eq_attr "type" "lr")
209             (eq_attr "z10prop" "z10_fr")))
210   "z10_e1_ANY, z10_Gate_ANY")
211
212 (define_insn_reservation "z10_lr_fr_E1" 6
213   (and (eq_attr "cpu" "z10")
214        (and (eq_attr "type" "lr")
215             (eq_attr "z10prop" "z10_fr_E1")))
216   "z10_e1_ANY, z10_Gate_ANY")
217
218 (define_insn_reservation "z10_la" 6
219   (and (eq_attr "cpu" "z10")
220        (and (eq_attr "type" "la")
221             (and (eq_attr "z10prop" "!z10_fwd")
222                  (eq_attr "z10prop" "!z10_fwd_A1"))))
223   "z10_e1_ANY, z10_Gate_ANY")
224
225 (define_insn_reservation "z10_la_fwd" 6
226   (and (eq_attr "cpu" "z10")
227        (and (eq_attr "type" "la")
228             (eq_attr "z10prop" "z10_fwd")))
229   "z10_e1_ANY, z10_Gate_ANY")
230
231 (define_insn_reservation "z10_la_fwd_A1" 6
232   (and (eq_attr "cpu" "z10")
233        (and (eq_attr "type" "la")
234             (eq_attr "z10prop" "z10_fwd_A1")))
235   "z10_e1_ANY, z10_Gate_ANY")
236
237
238 ; larl-type instructions
239
240 (define_insn_reservation "z10_larl" 6
241   (and (eq_attr "cpu" "z10")
242        (and (eq_attr "type" "larl")
243                  (and (eq_attr "z10prop" "!z10_super_A1")
244                       (and (eq_attr "z10prop" "!z10_fwd")
245                            (and (eq_attr "z10prop" "!z10_fwd_A3")
246                                 (and (eq_attr "z10prop" "!z10_super")
247                                      (eq_attr "z10prop" "!z10_super_c"))
248                                 (and (eq_attr "z10prop" "!z10_super_E1")
249                                      (eq_attr "z10prop" "!z10_super_c_E1")))))))
250   "z10_e1_ANY, z10_Gate_ANY")
251
252 (define_insn_reservation "z10_larl_super" 6
253   (and (eq_attr "cpu" "z10")
254        (and (eq_attr "type" "larl")
255             (and (eq_attr "z10prop" "z10_super")
256                  (eq_attr "z10prop" "z10_super_c"))))
257   "z10_e1_ANY, z10_Gate_ANY")
258
259 (define_insn_reservation "z10_larl_fwd" 6
260   (and (eq_attr "cpu" "z10")
261        (and (eq_attr "type" "larl")
262             (eq_attr "z10prop" "z10_fwd")))
263   "z10_e1_ANY, z10_Gate_ANY")
264
265 (define_insn_reservation "z10_larl_fwd_A3" 6
266   (and (eq_attr "cpu" "z10")
267        (and (eq_attr "type" "larl")
268             (eq_attr "z10prop" "z10_fwd_A3")))
269   "z10_e1_ANY, z10_Gate_ANY")
270
271
272 (define_insn_reservation "z10_larl_A1" 6
273   (and (eq_attr "cpu" "z10")
274        (and (eq_attr "type" "larl")
275             (eq_attr "z10prop" "z10_super_A1")))
276   "z10_e1_ANY, z10_Gate_ANY")
277 ;  "z10_e1_ANY")
278
279 (define_insn_reservation "z10_larl_super_E1" 6
280   (and (eq_attr "cpu" "z10")
281        (and (eq_attr "type" "larl")
282             (ior (eq_attr "z10prop" "z10_super_E1")
283                  (eq_attr "z10prop" "z10_super_c_E1"))))
284   "z10_e1_ANY, z10_Gate_ANY")
285 ;  "z10_e1_ANY")
286
287
288 (define_insn_reservation "z10_load" 6
289   (and (eq_attr "cpu" "z10")
290        (and (eq_attr "type" "load")
291             (and (eq_attr "z10prop" "!z10_fwd")
292                  (eq_attr "z10prop" "!z10_fwd_A3"))))
293   "z10_e1_ANY, z10_Gate_ANY")
294
295 (define_insn_reservation "z10_load_fwd" 6
296   (and (eq_attr "cpu" "z10")
297        (and (eq_attr "type" "load")
298             (eq_attr "z10prop" "z10_fwd")))
299   "z10_e1_ANY, z10_Gate_ANY")
300 ;  "z10_e1_ANY")
301
302 (define_insn_reservation "z10_load_fwd_A3" 6
303   (and (eq_attr "cpu" "z10")
304        (and (eq_attr "type" "load")
305             (eq_attr "z10prop" "z10_fwd_A3")))
306   "z10_e1_ANY, z10_Gate_ANY")
307 ;  "z10_e1_ANY")
308
309 (define_insn_reservation "z10_store" 6
310   (and (eq_attr "cpu" "z10")
311        (and (eq_attr "type" "store")
312             (and (eq_attr "z10prop" "!z10_rec")
313                  (and (eq_attr "z10prop" "!z10_super")
314                       (eq_attr "z10prop" "!z10_super_c")))))
315   "z10_e1_ANY, z10_Gate_ANY")
316
317 (define_insn_reservation "z10_store_super" 6
318   (and (eq_attr "cpu" "z10")
319        (and (eq_attr "type" "store")
320             (ior (eq_attr "z10prop" "z10_super")
321                  (eq_attr "z10prop" "z10_super_c"))))
322   "z10_e1_ANY, z10_Gate_ANY")
323
324 (define_insn_reservation "z10_store_rec" 6
325   (and (eq_attr "cpu" "z10")
326        (and (eq_attr "type" "store")
327             (eq_attr "z10prop" "z10_rec")))
328   "z10_e1_ANY, z10_Gate_ANY")
329
330 ; The default_latency is chosen to drain off the pipeline.
331 (define_insn_reservation "z10_call" 14
332   (and (eq_attr "cpu" "z10")
333        (eq_attr "type" "jsr"))
334   "z10_e1_BOTH*4, z10_Gate_BOTH")
335
336 ; The default latency is for worst case.  CS and CSG take one
337 ; cycle only (i.e. latency would be 6).
338 (define_insn_reservation "z10_sem" 9
339   (and (eq_attr "cpu" "z10")
340        (eq_attr "type" "sem"))
341   "z10_e1_BOTH*5, z10_Gate_ANY")
342
343 (define_insn_reservation "z10_cs" 6
344   (and (eq_attr "cpu" "z10")
345        (eq_attr "type" "cs"))
346   "z10_e1_BOTH, z10_Gate_BOTH")
347
348 (define_insn_reservation "z10_vs" 6
349   (and (eq_attr "cpu" "z10")
350        (eq_attr "type" "vs"))
351   "z10_e1_BOTH*4, z10_Gate_BOTH")
352
353 ; Load and store multiple. Actual number of cycles
354 ; in unknown at compile.time.
355 (define_insn_reservation "z10_stm" 10
356   (and (eq_attr "cpu" "z10")
357        (ior (eq_attr "type" "stm")
358             (eq_attr "type" "lm")))
359   "z10_e1_BOTH*4, z10_Gate_BOTH")
360
361
362 ; Subsets of z10_other follow.
363
364 (define_insn_reservation "z10_other" 6
365   (and (and (eq_attr "cpu" "z10")
366             (eq_attr "type" "other"))
367        (and (and (eq_attr "z10prop" "!z10_fwd")
368                  (eq_attr "z10prop" "!z10_fwd_A1"))
369             (and (and  (and (eq_attr "z10prop" "!z10_fr_A3")
370                             (eq_attr "z10prop" "!z10_fwd_A3"))
371                        (and (eq_attr "z10prop" "!z10_fr")
372                             (eq_attr "z10prop" "!z10_fr_E1")))
373                  (and  (and (and (eq_attr "z10prop" "!z10_super")
374                                   (eq_attr "z10prop" "!z10_super_c"))
375                             (eq_attr "z10prop" "!z10_super_c_E1"))
376                        (and (eq_attr "z10prop" "!z10_super_E1")
377                             (eq_attr "z10prop" "!z10_fwd_E1"))))))
378   "z10_e1_BOTH, z10_Gate_BOTH")
379
380 (define_insn_reservation "z10_other_fr_E1" 6
381   (and (eq_attr "cpu" "z10")
382        (and (eq_attr "type" "other")
383             (eq_attr "z10prop" "z10_fr_E1")))
384   "z10_e1_BOTH, z10_Gate_BOTH")
385
386 (define_insn_reservation "z10_other_super_c_E1" 6
387   (and (eq_attr "cpu" "z10")
388        (and (eq_attr "type" "other")
389             (eq_attr "z10prop" "z10_super_c_E1")))
390   "z10_e1_BOTH, z10_Gate_BOTH")
391
392 (define_insn_reservation "z10_other_super_E1" 6
393   (and (eq_attr "cpu" "z10")
394        (and (eq_attr "type" "other")
395             (eq_attr "z10prop" "z10_super_E1")))
396   "z10_e1_BOTH, z10_Gate_BOTH")
397
398 (define_insn_reservation "z10_other_fwd_E1" 6
399   (and (eq_attr "cpu" "z10")
400        (and (eq_attr "type" "other")
401             (eq_attr "z10prop" "z10_fwd_E1")))
402   "z10_e1_BOTH, z10_Gate_BOTH")
403
404 (define_insn_reservation "z10_other_fwd" 6
405   (and (eq_attr "cpu" "z10")
406        (and (eq_attr "type" "other")
407             (eq_attr "z10prop" "z10_fwd")))
408   "z10_e1_BOTH, z10_Gate_BOTH")
409
410 (define_insn_reservation "z10_other_fwd_A3" 6
411   (and (eq_attr "cpu" "z10")
412        (and (eq_attr "type" "other")
413             (eq_attr "z10prop" "z10_fwd_A3")))
414   "z10_e1_BOTH, z10_Gate_BOTH")
415
416 (define_insn_reservation "z10_other_fwd_A1" 6
417   (and (eq_attr "cpu" "z10")
418        (and (eq_attr "type" "other")
419             (eq_attr "z10prop" "z10_fwd_A1")))
420   "z10_e1_BOTH, z10_Gate_BOTH")
421
422 (define_insn_reservation "z10_other_fr" 6
423   (and (eq_attr "cpu" "z10")
424        (and (eq_attr "type" "other")
425             (eq_attr "z10prop" "z10_fr")))
426   "z10_e1_BOTH, z10_Gate_BOTH")
427
428 (define_insn_reservation "z10_other_fr_A3" 6
429   (and (eq_attr "cpu" "z10")
430        (and (eq_attr "type" "other")
431             (eq_attr "z10prop" "z10_fr_A3")))
432   "z10_e1_BOTH, z10_Gate_BOTH")
433
434 (define_insn_reservation "z10_other_super" 6
435   (and (eq_attr "cpu" "z10")
436        (and (eq_attr "type" "other")
437             (ior (eq_attr "z10prop" "z10_super")
438                  (eq_attr "z10prop" "z10_super_c"))))
439   "z10_e1_BOTH, z10_Gate_BOTH")
440
441 ; END of z10_other subsets.
442
443
444 ;
445 ; Floating point insns
446 ;
447
448 ; Z10 executes the following integer operations in the BFU pipeline.
449
450 (define_insn_reservation "z10_mul_sidi" 12
451   (and (eq_attr "cpu" "z10")
452        (eq_attr "type" "imulsi,imuldi,imulhi"))
453   "z10_e1_BOTH, z10_Gate_FP")
454
455 ; Some variants take fewer cycles, but that is not relevant here.
456 (define_insn_reservation "z10_div" 162
457   (and (eq_attr "cpu" "z10")
458        (eq_attr "type" "idiv"))
459   "z10_e1_BOTH*4, z10_Gate_FP")
460
461
462 ; BFP multiplication and general instructions
463
464 (define_insn_reservation "z10_fsimpdf" 6
465   (and (eq_attr "cpu" "z10")
466        (eq_attr "type" "fsimpdf,fmuldf"))
467   "z10_e1_BOTH, z10_Gate_FP")
468
469 ; LOAD ZERO produces a hex value but we need bin. Using the stage 7
470 ; bypass causes an exception for format conversion which is very
471 ; expensive. So, make sure subsequent instructions only get the zero
472 ; in the normal way.
473 (define_insn_reservation "z10_fhex" 12
474   (and (eq_attr "cpu" "z10")
475        (eq_attr "type" "fhex"))
476   "z10_e1_BOTH, z10_Gate_FP")
477
478 (define_insn_reservation "z10_fsimpsf" 6
479   (and (eq_attr "cpu" "z10")
480        (eq_attr "type" "fsimpsf,fmulsf"))
481   "z10_e1_BOTH, z10_Gate_FP")
482
483 (define_insn_reservation "z10_fmultf" 52
484   (and (eq_attr "cpu" "z10")
485        (eq_attr "type" "fmultf"))
486   "z10_e1_BOTH*4, z10_Gate_FP")
487
488 (define_insn_reservation "z10_fsimptf" 14
489   (and (eq_attr "cpu" "z10")
490        (eq_attr "type" "fsimptf"))
491   "z10_e1_BOTH*2, z10_Gate_FP")
492
493
494 ; BFP division
495
496 (define_insn_reservation "z10_fdivtf" 113
497   (and (eq_attr "cpu" "z10")
498        (eq_attr "type" "fdivtf"))
499   "z10_e1_T*4, z10_Gate_FP")
500
501 (define_insn_reservation "z10_fdivdf" 41
502   (and (eq_attr "cpu" "z10")
503        (eq_attr "type" "fdivdf"))
504   "z10_e1_T*4, z10_Gate_FP")
505
506 (define_insn_reservation "z10_fdivsf" 34
507   (and (eq_attr "cpu" "z10")
508        (eq_attr "type" "fdivsf"))
509   "z10_e1_T*4, z10_Gate_FP")
510
511
512 ; BFP sqrt
513
514 (define_insn_reservation "z10_fsqrtsf" 41
515   (and (eq_attr "cpu" "z10")
516        (eq_attr "type" "fsqrtsf"))
517   "z10_e1_T*4, z10_Gate_FP")
518
519 (define_insn_reservation "z10_fsqrtdf" 54
520   (and (eq_attr "cpu" "z10")
521        (eq_attr "type" "fsqrtdf"))
522   "z10_e1_T*4, z10_Gate_FP")
523
524 (define_insn_reservation "z10_fsqrtf" 122
525   (and (eq_attr "cpu" "z10")
526        (eq_attr "type" "fsqrttf"))
527   "z10_e1_T*4, z10_Gate_FP")
528
529
530 ; BFP load and store
531
532 (define_insn_reservation "z10_floadtf" 12
533   (and (eq_attr "cpu" "z10")
534        (eq_attr "type" "floadtf"))
535   "z10_e1_T, z10_Gate_FP")
536
537 (define_insn_reservation "z10_floaddf" 1
538   (and (eq_attr "cpu" "z10")
539        (eq_attr "type" "floaddf"))
540   "z10_e1_T, z10_Gate_FP")
541
542 (define_insn_reservation "z10_floadsf" 1
543   (and (eq_attr "cpu" "z10")
544        (eq_attr "type" "floadsf"))
545   "z10_e1_T, z10_Gate_FP")
546
547 (define_insn_reservation "z10_fstoredf" 12
548   (and (eq_attr "cpu" "z10")
549        (eq_attr "type" "fstoredf,fstoredd"))
550   "z10_e1_T, z10_Gate_FP")
551
552 (define_insn_reservation "z10_fstoresf" 12
553   (and (eq_attr "cpu" "z10")
554        (eq_attr "type" "fstoresf,fstoresd"))
555   "z10_e1_T, z10_Gate_FP")
556
557
558 ; BFP truncate
559 (define_insn_reservation "z10_ftrunctf" 16
560   (and (eq_attr "cpu" "z10")
561        (eq_attr "type" "ftrunctf"))
562   "z10_e1_T, z10_Gate_FP")
563
564 (define_insn_reservation "z10_ftruncdf" 12
565   (and (eq_attr "cpu" "z10")
566        (eq_attr "type" "ftruncdf"))
567   "z10_e1_T, z10_Gate_FP")
568
569
570 ; Conversion between BFP and int.
571 (define_insn_reservation "z10_ftoi" 13
572   (and (eq_attr "cpu" "z10")
573        (eq_attr "type" "ftoi"))
574   "z10_e1_T, z10_Gate_FP")
575
576 (define_insn_reservation "z10_itoftf" 14
577   (and (eq_attr "cpu" "z10")
578        (eq_attr "type" "itoftf"))
579   "z10_e1_T*2, z10_Gate_FP")
580
581 (define_insn_reservation "z10_itofsfdf" 12
582   (and (eq_attr "cpu" "z10")
583        (eq_attr "type" "itofdf,itofsf"))
584   "z10_e1_T, z10_Gate_FP")
585
586
587
588 ; BFP-related bypasses.  There is no bypass for extended mode.
589 (define_bypass 1 "z10_fsimpdf" "z10_fstoredf")
590 (define_bypass 1 "z10_fsimpsf" "z10_fstoresf")
591 (define_bypass 1 "z10_floaddf" "z10_fsimpdf, z10_fstoredf")
592 (define_bypass 1 "z10_floadsf" "z10_fsimpsf, z10_fstoresf")
593
594
595 ;
596 ; insn_reservations for DFP instructions.
597 ;
598
599 ; Exact number of cycles is not known at compile-time.
600 (define_insn_reservation "z10_fdivddtd" 40
601   (and (eq_attr "cpu" "z10")
602        (eq_attr "type" "fdivdd,fdivtd"))
603   "z10_e1_BOTH,z10_Gate_DFU")
604
605 (define_insn_reservation "z10_ftruncsd" 38
606   (and (eq_attr "cpu" "z10")
607        (eq_attr "type" "ftruncsd"))
608   "z10_e1_BOTH*4,z10_Gate_DFU")
609
610 (define_insn_reservation "z10_ftruncdd" 340
611   (and (eq_attr "cpu" "z10")
612        (eq_attr "type" "ftruncsd"))
613   "z10_e1_BOTH*4,z10_Gate_DFU")
614
615 (define_insn_reservation "z10_floaddd" 12
616   (and (eq_attr "cpu" "z10")
617        (eq_attr "type" "floaddd"))
618   "z10_e1_BOTH,z10_Gate_DFU")
619
620 (define_insn_reservation "z10_floadsd" 12
621   (and (eq_attr "cpu" "z10")
622        (eq_attr "type" "floadsd"))
623   "z10_e1_BOTH,z10_Gate_DFU")
624
625 ; Exact number of cycles is not known at compile-time.
626 (define_insn_reservation "z10_fmulddtd" 35
627   (and (eq_attr "cpu" "z10")
628        (eq_attr "type" "fmuldd,fmultd"))
629   "z10_e1_BOTH,z10_Gate_DFU")
630
631 (define_insn_reservation "z10_fsimpdd" 17
632   (and (eq_attr "cpu" "z10")
633        (eq_attr "type" "fsimpdd"))
634   "z10_e1_BOTH,z10_Gate_DFU")
635
636 (define_insn_reservation "z10_fsimpsd" 17
637   (and (eq_attr "cpu" "z10")
638        (eq_attr "type" "fsimpsd"))
639   "z10_e1_BOTH,z10_Gate_DFU")
640
641 (define_insn_reservation "z10_fsimptd" 18
642   (and (eq_attr "cpu" "z10")
643        (eq_attr "type" "fsimptd"))
644   "z10_e1_BOTH,z10_Gate_DFU")
645
646 (define_insn_reservation "z10_itofdd" 36
647   (and (eq_attr "cpu" "z10")
648        (eq_attr "type" "itofdd"))
649   "z10_e1_BOTH*3,z10_Gate_DFU")
650
651 (define_insn_reservation "z10_itoftd" 49
652   (and (eq_attr "cpu" "z10")
653        (eq_attr "type" "itoftd"))
654   "z10_e1_BOTH*3,z10_Gate_DFU")
655
656 ; Exact number of cycles is not known at compile-time.
657 (define_insn_reservation "z10_ftoidfp" 30
658   (and (eq_attr "cpu" "z10")
659        (eq_attr "type" "ftoidfp"))
660   "z10_e1_BOTH*3,z10_Gate_DFU")
661
662
663 ;
664 ; Address-related bypasses
665 ;
666
667 ; Here is the cycle diagram for address-related bypasses:
668 ; ... G1 G2 G3 A0 A1 A2 A3 E1 P1 P2 P3 R0 ...
669 ;         ^  ^    ^     ^  ^        ^
670 ;         |  |    |     |  |        without bypass, its available AFTER this cycle
671 ;         |  |    |     |  E1-type bypasses provide the new value AFTER this cycle
672 ;         |  |    |     A3-type bypasses provide the new value AFTER this cycle
673 ;         |  |    A1-type bypasses provide the new value AFTER this cycle
674 ;         |  AGI resolution, actual USE of new value is DURING this cycle
675 ;         AGI detection
676
677 (define_bypass 3 "z10_larl_A1, z10_la_fwd_A1, z10_other_fwd_A1, \
678                   z10_int_fwd_A1"
679                  "z10_agen, z10_la, z10_branch, z10_call, z10_load, \
680                   z10_store, \
681                   z10_cs, z10_stm, z10_other"
682                  "s390_agen_dep_p")
683
684 (define_bypass 5 "z10_larl_fwd_A3, z10_load_fwd_A3, z10_other_fwd_A3, \
685                   z10_other_fr_A3, z10_int_fwd_A3, z10_int_fr_A3"
686                  "z10_agen, z10_la, z10_branch, z10_call, z10_load, \
687                   z10_store, \
688                   z10_cs, z10_stm, z10_other"
689                  "s390_agen_dep_p")
690
691 (define_bypass 6 "z10_other_fr_E1, z10_other_super_c_E1, z10_other_super_E1, \
692                   z10_other_fwd_E1, \
693                   z10_lr_fr_E1, z10_larl_super_E1, \
694                   z10_int_super_E1, z10_int_fwd_E1, z10_int_fr_E1"
695                  "z10_agen, z10_la, z10_branch, z10_call, z10_load, \
696                   z10_store, \
697                   z10_cs, z10_stm, z10_other"
698                  "s390_agen_dep_p")
699
700 (define_bypass 9 "z10_int_super, z10_int_fwd, z10_int_fr"
701                  "z10_agen, z10_la, z10_branch, z10_call, z10_load, \
702                   z10_store, \
703                   z10_cs, z10_stm, z10_other"
704                  "s390_agen_dep_p")
705
706
707
708 ;
709 ; Try to avoid transitions between DFU-, BFU- and FXU-executed instructions as there is a
710 ; dispatch delay required.
711 ;
712
713
714 ; Declaration for some pseudo-pipeline stages that reflect the
715 ; dispatch gap when issueing an INT/FXU/BFU-executed instruction after
716 ; an instruction executed by a different unit has been executed.  The
717 ; approach is that we pretend a pipelined execution of BFU operations
718 ; with as many stages as the gap is long and request that none of
719 ; these stages is busy when issueing a FXU- or DFU-executed
720 ; instruction.  Similar for FXU- and DFU-executed instructions.
721
722 ; Declaration for FPU stages.
723 (define_cpu_unit "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, \
724                   z10_f7, z10_f8, z10_f9, z10_f10, z10_f11, z10_f12" "z10_cpu")
725 (define_reservation "z10_FP_PP" "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, \
726                   z10_f5, z10_f6, z10_f7, z10_f8, z10_f9, z10_f10, z10_f11, \
727                   z10_f12")
728
729 ; Declaration for FXU stages.
730 (define_cpu_unit "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6"  "z10_cpu")
731 (define_cpu_unit "z10_T1, z10_T2, z10_T3, z10_T4, z10_T5, z10_T6"  "z10_cpu")
732 (define_reservation "z10_INT_PP" "z10_S1 | z10_T1, z10_S2 | z10_T2, z10_S3 \
733                                   | z10_T3, z10_S4 | z10_T4, z10_S5 | \
734                                   z10_T5, z10_S6 | z10_T6")
735
736 ; Declaration for DFU stages.
737 (define_cpu_unit "z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6"
738                  "z10_cpu")
739 (define_reservation "z10_DFU_PP" "z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, \
740                                  z10_d5, z10_d6")
741
742
743 ; Pseudo-units representing whether the respective unit is available
744 ; in the sense that using it does not cause a dispatch delay.
745
746 (define_cpu_unit "z10_S_avail, z10_T_avail, z10_FP_avail, z10_DFU_avail"
747                  "z10_cpu")
748
749 (absence_set "z10_FP_avail"
750              "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6, z10_T1, z10_T2, z10_T3, z10_T4, \
751               z10_T5, z10_T6, \
752               z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6")
753
754 (absence_set "z10_S_avail,z10_T_avail"
755              "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, z10_f7, \
756               z10_f8, z10_f9, z10_f10, z10_f11, z10_f12, \
757               z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6")
758
759 (absence_set "z10_DFU_avail"
760              "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6, z10_T1, z10_T2, z10_T3, z10_T4, \
761               z10_T5, z10_T6, \
762               z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, z10_f7, \
763               z10_f8, z10_f9, z10_f10, z10_f11, z10_f12")
764
765
766 ; Pseudo-units to be used in insn_reservations.
767
768 (define_reservation "z10_Gate_ANY" "((z10_S_avail | z10_T_avail), z10_INT_PP)")
769 (define_reservation "z10_Gate_BOTH" "((z10_S_avail + z10_T_avail), z10_INT_PP)")
770
771 (define_reservation "z10_Gate_FP" "z10_FP_avail, z10_FP_PP")
772
773 (define_reservation "z10_Gate_DFU" "z10_DFU_avail, z10_DFU_PP")