Home | History | Annotate | Line # | Download | only in rs6000
power9.md revision 1.1
      1 ;; Scheduling description for IBM POWER9 processor.
      2 ;; Copyright (C) 2016 Free Software Foundation, Inc.
      3 ;;
      4 ;; Contributed by Pat Haugen (pthaugen (a] us.ibm.com).
      5 
      6 ;; This file is part of GCC.
      7 ;;
      8 ;; GCC is free software; you can redistribute it and/or modify it
      9 ;; under the terms of the GNU General Public License as published
     10 ;; by the Free Software Foundation; either version 3, or (at your
     11 ;; option) any later version.
     12 ;;
     13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
     14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     15 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
     16 ;; License for more details.
     17 ;;
     18 ;; You should have received a copy of the GNU General Public License
     19 ;; along with GCC; see the file COPYING3.  If not see
     20 ;; <http://www.gnu.org/licenses/>.
     21 
     22 (define_automaton "power9dsp,power9lsu,power9vsu,power9misc")
     23 
     24 (define_cpu_unit "lsu0_power9,lsu1_power9,lsu2_power9,lsu3_power9" "power9lsu")
     25 (define_cpu_unit "vsu0_power9,vsu1_power9,vsu2_power9,vsu3_power9" "power9vsu")
     26 ; Two vector permute units, part of vsu
     27 (define_cpu_unit "prm0_power9,prm1_power9" "power9vsu")
     28 ; Two fixed point divide units, not pipelined
     29 (define_cpu_unit "fx_div0_power9,fx_div1_power9" "power9misc")
     30 (define_cpu_unit "bru_power9,cryptu_power9,dfu_power9" "power9misc")
     31 
     32 (define_cpu_unit "x0_power9,x1_power9,xa0_power9,xa1_power9,
     33 		  x2_power9,x3_power9,xb0_power9,xb1_power9,
     34 		  br0_power9,br1_power9" "power9dsp")
     35 
     36 
     37 ; Dispatch port reservations
     38 ;
     39 ; Power9 can dispatch a maximum of 6 iops per cycle with the following
     40 ; general restrictions (other restrictions also apply):
     41 ;   1) At most 2 iops per execution slice
     42 ;   2) At most 2 iops to the branch unit
     43 ; Note that insn position in a dispatch group of 6 insns does not infer which
     44 ; execution slice the insn is routed to.  The units are used to infer the
     45 ; conflicts that exist (i.e. an 'even' requirement will preclude dispatch
     46 ; with 2 insns with 'superslice' requirement).
     47 
     48 ; The xa0/xa1 units really represent the 3rd dispatch port for a superslice but
     49 ; are listed as separate units to allow those insns that preclude its use to
     50 ; still be scheduled two to a superslice while reserving the 3rd slot.  The
     51 ; same applies for xb0/xb1.
     52 (define_reservation "DU_xa_power9" "xa0_power9+xa1_power9")
     53 (define_reservation "DU_xb_power9" "xb0_power9+xb1_power9")
     54 
     55 ; Any execution slice dispatch
     56 (define_reservation "DU_any_power9"
     57 		    "x0_power9|x1_power9|DU_xa_power9|x2_power9|x3_power9|
     58 		     DU_xb_power9")
     59 
     60 ; Even slice, actually takes even/odd slots
     61 (define_reservation "DU_even_power9" "x0_power9+x1_power9|x2_power9+x3_power9")
     62 
     63 ; Slice plus 3rd slot
     64 (define_reservation "DU_slice_3_power9"
     65 		    "x0_power9+xa0_power9|x1_power9+xa1_power9|
     66 		     x2_power9+xb0_power9|x3_power9+xb1_power9")
     67 
     68 ; Superslice
     69 (define_reservation "DU_super_power9"
     70 		    "x0_power9+x1_power9|x2_power9+x3_power9")
     71 
     72 ; 2-way cracked
     73 (define_reservation "DU_C2_power9" "x0_power9+x1_power9|
     74 				    x1_power9+DU_xa_power9|
     75 				    x1_power9+x2_power9|
     76 				    DU_xa_power9+x2_power9|
     77 				    x2_power9+x3_power9|
     78 				    x3_power9+DU_xb_power9")
     79 
     80 ; 2-way cracked plus 3rd slot
     81 (define_reservation "DU_C2_3_power9" "x0_power9+x1_power9+xa0_power9|
     82 				      x1_power9+x2_power9+xa0_power9|
     83 				      x1_power9+x2_power9+xb0_power9|
     84 				      x2_power9+x3_power9+xb0_power9")
     85 
     86 ; 3-way cracked (consumes whole decode/dispatch cycle)
     87 (define_reservation "DU_C3_power9"
     88 		    "x0_power9+x1_power9+xa0_power9+xa1_power9+x2_power9+
     89 		     x3_power9+xb0_power9+xb1_power9+br0_power9+br1_power9")
     90 
     91 ; Branch ports
     92 (define_reservation "DU_branch_power9" "br0_power9|br1_power9")
     93 
     94 
     95 ; Execution unit reservations
     96 (define_reservation "LSU_power9"
     97 		    "lsu0_power9|lsu1_power9|lsu2_power9|lsu3_power9")
     98 
     99 (define_reservation "LSU_pair_power9"
    100 		    "lsu0_power9+lsu1_power9|lsu1_power9+lsu2_power9|
    101 		     lsu2_power9+lsu3_power9|lsu3_power9+lsu0_power9")
    102 
    103 (define_reservation "VSU_power9"
    104 		    "vsu0_power9|vsu1_power9|vsu2_power9|vsu3_power9")
    105 
    106 (define_reservation "VSU_super_power9"
    107 		    "vsu0_power9+vsu1_power9|vsu2_power9+vsu3_power9")
    108 
    109 (define_reservation "VSU_PRM_power9" "prm0_power9|prm1_power9")
    110 
    111 
    112 ; LS Unit
    113 (define_insn_reservation "power9-load" 4
    114   (and (eq_attr "type" "load")
    115        (eq_attr "sign_extend" "no")
    116        (eq_attr "update" "no")
    117        (eq_attr "cpu" "power9"))
    118   "DU_any_power9,LSU_power9")
    119 
    120 (define_insn_reservation "power9-load-update" 4
    121   (and (eq_attr "type" "load")
    122        (eq_attr "sign_extend" "no")
    123        (eq_attr "update" "yes")
    124        (eq_attr "cpu" "power9"))
    125   "DU_C2_power9,LSU_power9+VSU_power9")
    126 
    127 (define_insn_reservation "power9-load-ext" 6
    128   (and (eq_attr "type" "load")
    129        (eq_attr "sign_extend" "yes")
    130        (eq_attr "update" "no")
    131        (eq_attr "cpu" "power9"))
    132   "DU_C2_power9,LSU_power9")
    133 
    134 (define_insn_reservation "power9-load-ext-update" 6
    135   (and (eq_attr "type" "load")
    136        (eq_attr "sign_extend" "yes")
    137        (eq_attr "update" "yes")
    138        (eq_attr "cpu" "power9"))
    139   "DU_C3_power9,LSU_power9+VSU_power9")
    140 
    141 (define_insn_reservation "power9-fpload-double" 4
    142   (and (eq_attr "type" "fpload")
    143        (eq_attr "update" "no")
    144        (eq_attr "size" "64")
    145        (eq_attr "cpu" "power9"))
    146   "DU_slice_3_power9,LSU_power9")
    147 
    148 (define_insn_reservation "power9-fpload-update-double" 4
    149   (and (eq_attr "type" "fpload")
    150        (eq_attr "update" "yes")
    151        (eq_attr "size" "64")
    152        (eq_attr "cpu" "power9"))
    153   "DU_C2_3_power9,LSU_power9+VSU_power9")
    154 
    155 ; SFmode loads are cracked and have additional 2 cycles over DFmode
    156 (define_insn_reservation "power9-fpload-single" 6
    157   (and (eq_attr "type" "fpload")
    158        (eq_attr "update" "no")
    159        (eq_attr "size" "32")
    160        (eq_attr "cpu" "power9"))
    161   "DU_C2_3_power9,LSU_power9")
    162 
    163 (define_insn_reservation "power9-fpload-update-single" 6
    164   (and (eq_attr "type" "fpload")
    165        (eq_attr "update" "yes")
    166        (eq_attr "size" "32")
    167        (eq_attr "cpu" "power9"))
    168   "DU_C3_power9,LSU_power9+VSU_power9")
    169 
    170 (define_insn_reservation "power9-vecload" 5
    171   (and (eq_attr "type" "vecload")
    172        (eq_attr "cpu" "power9"))
    173   "DU_any_power9,LSU_pair_power9")
    174 
    175 ; Store data can issue 2 cycles after AGEN issue, 3 cycles for vector store
    176 (define_insn_reservation "power9-store" 0
    177   (and (eq_attr "type" "store")
    178        (eq_attr "update" "no")
    179        (eq_attr "indexed" "no")
    180        (eq_attr "cpu" "power9"))
    181   "DU_slice_3_power9,LSU_power9")
    182 
    183 (define_insn_reservation "power9-store-indexed" 0
    184   (and (eq_attr "type" "store")
    185        (eq_attr "update" "no")
    186        (eq_attr "indexed" "yes")
    187        (eq_attr "cpu" "power9"))
    188   "DU_slice_3_power9,LSU_power9")
    189 
    190 ; Update forms have 2 cycle latency for updated addr reg
    191 (define_insn_reservation "power9-store-update" 2
    192   (and (eq_attr "type" "store")
    193        (eq_attr "update" "yes")
    194        (eq_attr "indexed" "no")
    195        (eq_attr "cpu" "power9"))
    196   "DU_C2_3_power9,LSU_power9+VSU_power9")
    197 
    198 ; Update forms have 2 cycle latency for updated addr reg
    199 (define_insn_reservation "power9-store-update-indexed" 2
    200   (and (eq_attr "type" "store")
    201        (eq_attr "update" "yes")
    202        (eq_attr "indexed" "yes")
    203        (eq_attr "cpu" "power9"))
    204   "DU_C2_3_power9,LSU_power9+VSU_power9")
    205 
    206 (define_insn_reservation "power9-fpstore" 0
    207   (and (eq_attr "type" "fpstore")
    208        (eq_attr "update" "no")
    209        (eq_attr "cpu" "power9"))
    210   "DU_slice_3_power9,LSU_power9")
    211 
    212 ; Update forms have 2 cycle latency for updated addr reg
    213 (define_insn_reservation "power9-fpstore-update" 2
    214   (and (eq_attr "type" "fpstore")
    215        (eq_attr "update" "yes")
    216        (eq_attr "cpu" "power9"))
    217   "DU_C2_3_power9,LSU_power9+VSU_power9")
    218 
    219 (define_insn_reservation "power9-vecstore" 0
    220   (and (eq_attr "type" "vecstore")
    221        (eq_attr "cpu" "power9"))
    222   "DU_super_power9,LSU_pair_power9")
    223 
    224 (define_insn_reservation "power9-larx" 4
    225   (and (eq_attr "type" "load_l")
    226        (eq_attr "cpu" "power9"))
    227   "DU_any_power9,LSU_power9")
    228 
    229 (define_insn_reservation "power9-stcx" 2
    230   (and (eq_attr "type" "store_c")
    231        (eq_attr "cpu" "power9"))
    232   "DU_C2_3_power9,LSU_power9+VSU_power9")
    233 
    234 (define_insn_reservation "power9-sync" 4
    235   (and (eq_attr "type" "sync,isync")
    236        (eq_attr "cpu" "power9"))
    237   "DU_any_power9,LSU_power9")
    238 
    239 
    240 ; VSU Execution Unit
    241 
    242 ; Fixed point ops
    243 
    244 ; Most ALU insns are simple 2 cycle, including record form
    245 (define_insn_reservation "power9-alu" 2
    246   (and (ior (eq_attr "type" "add,cmp,exts,integer,logical,isel")
    247 	    (and (eq_attr "type" "insert,shift")
    248 		 (eq_attr "dot" "no")))
    249        (eq_attr "cpu" "power9"))
    250   "DU_any_power9,VSU_power9")
    251 
    252 ; Record form rotate/shift are cracked
    253 (define_insn_reservation "power9-cracked-alu" 2
    254   (and (eq_attr "type" "insert,shift")
    255        (eq_attr "dot" "yes")
    256        (eq_attr "cpu" "power9"))
    257   "DU_C2_power9,VSU_power9")
    258 ; 4 cycle CR latency
    259 (define_bypass 4 "power9-cracked-alu"
    260 		 "power9-crlogical,power9-mfcr,power9-mfcrf,power9-branch")
    261 
    262 (define_insn_reservation "power9-alu2" 3
    263   (and (eq_attr "type" "cntlz,popcnt,trap")
    264        (eq_attr "cpu" "power9"))
    265   "DU_any_power9,VSU_power9")
    266 
    267 ; Treat 'two' and 'three' types as 2 or 3 way cracked
    268 (define_insn_reservation "power9-two" 4
    269   (and (eq_attr "type" "two")
    270        (eq_attr "cpu" "power9"))
    271   "DU_C2_power9,VSU_power9")
    272 
    273 (define_insn_reservation "power9-three" 6
    274   (and (eq_attr "type" "three")
    275        (eq_attr "cpu" "power9"))
    276   "DU_C3_power9,VSU_power9")
    277 
    278 (define_insn_reservation "power9-mul" 4
    279   (and (eq_attr "type" "mul")
    280        (eq_attr "dot" "no")
    281        (eq_attr "cpu" "power9"))
    282   "DU_any_power9,VSU_power9")
    283 
    284 (define_insn_reservation "power9-mul-compare" 4
    285   (and (eq_attr "type" "mul")
    286        (eq_attr "dot" "yes")
    287        (eq_attr "cpu" "power9"))
    288   "DU_C2_power9,VSU_power9")
    289 ; 6 cycle CR latency
    290 (define_bypass 6 "power9-mul-compare"
    291 		 "power9-crlogical,power9-mfcr,power9-mfcrf,power9-branch")
    292 
    293 ; Fixed point divides reserve the divide units for a minimum of 8 cycles
    294 (define_insn_reservation "power9-idiv" 16
    295   (and (eq_attr "type" "div")
    296        (eq_attr "size" "32")
    297        (eq_attr "cpu" "power9"))
    298   "DU_even_power9,fx_div0_power9*8|fx_div1_power9*8")
    299 
    300 (define_insn_reservation "power9-ldiv" 24
    301   (and (eq_attr "type" "div")
    302        (eq_attr "size" "64")
    303        (eq_attr "cpu" "power9"))
    304   "DU_even_power9,fx_div0_power9*8|fx_div1_power9*8")
    305 
    306 (define_insn_reservation "power9-crlogical" 2
    307   (and (eq_attr "type" "cr_logical,delayed_cr")
    308        (eq_attr "cpu" "power9"))
    309   "DU_any_power9,VSU_power9")
    310 
    311 (define_insn_reservation "power9-mfcrf" 2
    312   (and (eq_attr "type" "mfcrf")
    313        (eq_attr "cpu" "power9"))
    314   "DU_any_power9,VSU_power9")
    315 
    316 (define_insn_reservation "power9-mfcr" 6
    317   (and (eq_attr "type" "mfcr")
    318        (eq_attr "cpu" "power9"))
    319   "DU_C3_power9,VSU_power9")
    320 
    321 ; Should differentiate between 1 cr field and > 1 since target of > 1 cr
    322 ; is cracked
    323 (define_insn_reservation "power9-mtcr" 2
    324   (and (eq_attr "type" "mtcr")
    325        (eq_attr "cpu" "power9"))
    326   "DU_any_power9,VSU_power9")
    327 
    328 ; Move to LR/CTR are executed in VSU
    329 (define_insn_reservation "power9-mtjmpr" 5
    330   (and (eq_attr "type" "mtjmpr")
    331        (eq_attr "cpu" "power9"))
    332   "DU_any_power9,VSU_power9")
    333 
    334 ; Floating point/Vector ops
    335 (define_insn_reservation "power9-fpsimple" 2
    336   (and (eq_attr "type" "fpsimple")
    337        (eq_attr "cpu" "power9"))
    338   "DU_slice_3_power9,VSU_power9")
    339 
    340 (define_insn_reservation "power9-fp" 7
    341   (and (eq_attr "type" "fp,dmul")
    342        (eq_attr "cpu" "power9"))
    343   "DU_slice_3_power9,VSU_power9")
    344 
    345 (define_insn_reservation "power9-fpcompare" 3
    346   (and (eq_attr "type" "fpcompare")
    347        (eq_attr "cpu" "power9"))
    348   "DU_slice_3_power9,VSU_power9")
    349 
    350 ; FP div/sqrt are executed in the VSU slices.  They are not pipelined wrt other
    351 ; divide insns, but for the most part do not block pipelined ops.
    352 (define_insn_reservation "power9-sdiv" 22
    353   (and (eq_attr "type" "sdiv")
    354        (eq_attr "cpu" "power9"))
    355   "DU_slice_3_power9,VSU_power9")
    356 
    357 (define_insn_reservation "power9-ddiv" 33
    358   (and (eq_attr "type" "ddiv")
    359        (eq_attr "cpu" "power9"))
    360   "DU_slice_3_power9,VSU_power9")
    361 
    362 (define_insn_reservation "power9-sqrt" 26
    363   (and (eq_attr "type" "ssqrt")
    364        (eq_attr "cpu" "power9"))
    365   "DU_slice_3_power9,VSU_power9")
    366 
    367 (define_insn_reservation "power9-dsqrt" 36
    368   (and (eq_attr "type" "dsqrt")
    369        (eq_attr "cpu" "power9"))
    370   "DU_slice_3_power9,VSU_power9")
    371 
    372 (define_insn_reservation "power9-vec-2cyc" 2
    373   (and (eq_attr "type" "vecmove,veclogical,vecexts,veccmpfx")
    374        (eq_attr "cpu" "power9"))
    375   "DU_super_power9,VSU_super_power9")
    376 
    377 (define_insn_reservation "power9-veccmp" 3
    378   (and (eq_attr "type" "veccmp")
    379        (eq_attr "cpu" "power9"))
    380   "DU_super_power9,VSU_super_power9")
    381 
    382 (define_insn_reservation "power9-vecsimple" 3
    383   (and (eq_attr "type" "vecsimple")
    384        (eq_attr "cpu" "power9"))
    385   "DU_super_power9,VSU_super_power9")
    386 
    387 (define_insn_reservation "power9-vecnormal" 7
    388   (and (eq_attr "type" "vecfloat,vecdouble")
    389        (eq_attr "size" "!128")
    390        (eq_attr "cpu" "power9"))
    391   "DU_super_power9,VSU_super_power9")
    392 
    393 ; Quad-precision FP ops, execute in DFU
    394 (define_insn_reservation "power9-qp" 12
    395   (and (eq_attr "type" "vecfloat,vecdouble")
    396        (eq_attr "size" "128")
    397        (eq_attr "cpu" "power9"))
    398   "DU_super_power9,dfu_power9")
    399 
    400 (define_insn_reservation "power9-vecperm" 3
    401   (and (eq_attr "type" "vecperm")
    402        (eq_attr "cpu" "power9"))
    403   "DU_super_power9,VSU_PRM_power9")
    404 
    405 (define_insn_reservation "power9-veccomplex" 7
    406   (and (eq_attr "type" "veccomplex")
    407        (eq_attr "cpu" "power9"))
    408   "DU_super_power9,VSU_super_power9")
    409 
    410 (define_insn_reservation "power9-vecfdiv" 28
    411   (and (eq_attr "type" "vecfdiv")
    412        (eq_attr "cpu" "power9"))
    413   "DU_super_power9,VSU_super_power9")
    414 
    415 (define_insn_reservation "power9-vecdiv" 32
    416   (and (eq_attr "type" "vecdiv")
    417        (eq_attr "size" "!128")
    418        (eq_attr "cpu" "power9"))
    419   "DU_super_power9,VSU_super_power9")
    420 
    421 (define_insn_reservation "power9-qpdiv" 56
    422   (and (eq_attr "type" "vecdiv")
    423        (eq_attr "size" "128")
    424        (eq_attr "cpu" "power9"))
    425   "DU_super_power9,dfu_power9")
    426 
    427 (define_insn_reservation "power9-mffgpr" 2
    428   (and (eq_attr "type" "mffgpr")
    429        (eq_attr "cpu" "power9"))
    430   "DU_slice_3_power9,VSU_power9")
    431 
    432 (define_insn_reservation "power9-mftgpr" 2
    433   (and (eq_attr "type" "mftgpr")
    434        (eq_attr "cpu" "power9"))
    435   "DU_slice_3_power9,VSU_power9")
    436 
    437 
    438 ; Branch Unit
    439 ; Move from LR/CTR are executed in BRU but consume a writeback port from an
    440 ; execution slice.
    441 (define_insn_reservation "power9-mfjmpr" 6
    442   (and (eq_attr "type" "mfjmpr")
    443        (eq_attr "cpu" "power9"))
    444   "DU_branch_power9,bru_power9+VSU_power9")
    445 
    446 ; Branch is 2 cycles
    447 (define_insn_reservation "power9-branch" 2
    448   (and (eq_attr "type" "jmpreg,branch")
    449        (eq_attr "cpu" "power9"))
    450   "DU_branch_power9,bru_power9")
    451 
    452 
    453 ; Crypto Unit
    454 (define_insn_reservation "power9-crypto" 6
    455   (and (eq_attr "type" "crypto")
    456        (eq_attr "cpu" "power9"))
    457   "DU_super_power9,cryptu_power9")
    458 
    459 
    460 ; HTM Unit
    461 (define_insn_reservation "power9-htm" 4
    462   (and (eq_attr "type" "htm")
    463        (eq_attr "cpu" "power9"))
    464   "DU_C2_power9,LSU_power9")
    465 
    466 (define_insn_reservation "power9-htm-simple" 2
    467   (and (eq_attr "type" "htmsimple")
    468        (eq_attr "cpu" "power9"))
    469   "DU_any_power9,VSU_power9")
    470 
    471 
    472 ; DFP Unit
    473 (define_insn_reservation "power9-dfp" 12
    474   (and (eq_attr "type" "dfp")
    475        (eq_attr "cpu" "power9"))
    476   "DU_even_power9,dfu_power9")
    477 
    478