Home | History | Annotate | Line # | Download | only in mips
      1   1.1  mrg ;; DFA-based pipeline descriptions for MIPS32 5K processor family
      2   1.1  mrg ;; Contributed by David Ung (davidu (a] mips.com)
      3   1.1  mrg ;;   and Nigel Stephens (nigel (a] mips.com)
      4   1.1  mrg ;;
      5   1.1  mrg ;; References:
      6   1.1  mrg ;;   "MIPS64 5K Processor Core Family Software User's Manual,
      7   1.1  mrg ;;     Doc no: MD00012, Rev 2.09, Jan 28, 2005."
      8   1.1  mrg ;;
      9   1.1  mrg ;; 5Kc - Single issue with no floating point unit.
     10   1.1  mrg ;; 5kf - Separate floating point pipe which can dual-issue with the
     11   1.1  mrg ;;       integer pipe.
     12   1.1  mrg ;;
     13  1.12  mrg ;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
     14   1.1  mrg ;;
     15   1.1  mrg ;; This file is part of GCC.
     16   1.1  mrg ;;
     17   1.1  mrg ;; GCC is free software; you can redistribute it and/or modify it
     18   1.1  mrg ;; under the terms of the GNU General Public License as published
     19   1.1  mrg ;; by the Free Software Foundation; either version 3, or (at your
     20   1.1  mrg ;; option) any later version.
     21   1.1  mrg 
     22   1.1  mrg ;; GCC is distributed in the hope that it will be useful, but WITHOUT
     23   1.1  mrg ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     24   1.1  mrg ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
     25   1.1  mrg ;; License for more details.
     26   1.1  mrg 
     27   1.1  mrg ;; You should have received a copy of the GNU General Public License
     28   1.1  mrg ;; along with GCC; see the file COPYING3.  If not see
     29   1.1  mrg ;; <http://www.gnu.org/licenses/>.
     30   1.1  mrg 
     31   1.1  mrg (define_automaton "r5k_cpu, r5k_mdu, r5k_fpu")
     32   1.1  mrg 
     33   1.1  mrg ;; Integer execution unit.
     34   1.1  mrg (define_cpu_unit "r5k_ixu_arith"       "r5k_cpu")
     35   1.1  mrg (define_cpu_unit "r5k_ixu_mpydiv"      "r5k_mdu")
     36   1.1  mrg (define_cpu_unit "r5kf_fpu_arith"      "r5k_fpu")
     37   1.1  mrg 
     38   1.1  mrg (define_insn_reservation "r5k_int_load" 2
     39   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     40   1.1  mrg        (eq_attr "type" "load"))
     41   1.1  mrg   "r5k_ixu_arith")
     42   1.1  mrg 
     43   1.1  mrg (define_insn_reservation "r5k_int_prefetch" 1
     44   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     45   1.1  mrg        (eq_attr "type" "prefetch,prefetchx"))
     46   1.1  mrg   "r5k_ixu_arith")
     47   1.1  mrg 
     48   1.1  mrg (define_insn_reservation "r5k_int_store" 1
     49   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     50   1.1  mrg        (eq_attr "type" "store"))
     51   1.1  mrg   "r5k_ixu_arith")
     52   1.1  mrg 
     53   1.1  mrg ;; Divides
     54   1.1  mrg (define_insn_reservation "r5k_int_divsi" 34
     55   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     56   1.1  mrg        (and (eq_attr "type" "idiv")
     57   1.1  mrg 	    (eq_attr "mode" "!DI")))
     58   1.1  mrg  "r5k_ixu_arith+(r5k_ixu_mpydiv*34)")
     59   1.1  mrg 
     60   1.1  mrg (define_insn_reservation "r5k_int_divdi" 66
     61   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     62   1.1  mrg        (and (eq_attr "type" "idiv")
     63   1.1  mrg 	    (eq_attr "mode" "DI")))
     64   1.1  mrg   "r5k_ixu_arith+(r5k_ixu_mpydiv*66)")
     65   1.1  mrg 
     66   1.1  mrg ;; 32x32 multiply
     67   1.1  mrg ;; 32x16 is faster, but there's no way to detect this
     68   1.1  mrg (define_insn_reservation "r5k_int_mult" 2
     69   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     70   1.1  mrg        (and (eq_attr "type" "imul,imadd")
     71   1.1  mrg 	    (eq_attr "mode" "SI")))
     72   1.1  mrg   "r5k_ixu_arith+(r5k_ixu_mpydiv*2)")
     73   1.1  mrg 
     74   1.1  mrg ;; 64x64 multiply
     75   1.1  mrg (define_insn_reservation "r5k_int_mult_64" 9
     76   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     77   1.1  mrg        (and (eq_attr "type" "imul,imadd")
     78   1.1  mrg 	    (eq_attr "mode" "DI")))
     79   1.1  mrg   "r5k_ixu_arith+(r5k_ixu_mpydiv*2)")
     80   1.1  mrg 
     81   1.1  mrg ;; 3 operand MUL 32x32
     82   1.1  mrg (define_insn_reservation "r5k_int_mul" 4
     83   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     84   1.1  mrg        (and (eq_attr "type" "imul3")
     85   1.1  mrg 	    (eq_attr "mode" "SI")))
     86   1.1  mrg   "r5k_ixu_arith+(r5k_ixu_mpydiv*2)")
     87   1.1  mrg 
     88   1.1  mrg ;; Move to HI/LO -> MADD/MSUB,MFHI/MFLO has a 1 cycle latency.
     89   1.1  mrg (define_insn_reservation "r5k_int_mthilo" 1
     90   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     91   1.3  mrg        (eq_attr "type" "mthi,mtlo"))
     92   1.1  mrg   "r5k_ixu_arith+r5k_ixu_mpydiv")
     93   1.1  mrg 
     94   1.1  mrg ;; Move from HI/LO -> integer operation has a 2 cycle latency.
     95   1.1  mrg (define_insn_reservation "r5k_int_mfhilo" 2
     96   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
     97   1.3  mrg        (eq_attr "type" "mfhi,mflo"))
     98   1.1  mrg   "r5k_ixu_arith+r5k_ixu_mpydiv")
     99   1.1  mrg 
    100   1.1  mrg ;; All other integer insns.
    101   1.1  mrg (define_insn_reservation "r5k_int_alu" 1
    102   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
    103   1.1  mrg        (eq_attr "type" "arith,condmove,const,logical,move,nop,shift,signext,slt"))
    104   1.1  mrg   "r5k_ixu_arith")
    105   1.1  mrg 
    106   1.1  mrg (define_insn_reservation "r5k_int_branch" 1
    107   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
    108   1.1  mrg        (eq_attr "type" "branch"))
    109   1.1  mrg   "r5k_ixu_arith")
    110   1.1  mrg 
    111   1.1  mrg ;; JR/JALR always cause one pipeline bubble because of interlock.
    112   1.1  mrg (define_insn_reservation "r5k_int_jump" 2
    113   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
    114   1.1  mrg        (eq_attr "type" "jump,call"))
    115   1.1  mrg   "r5k_ixu_arith")
    116   1.1  mrg 
    117   1.1  mrg ;; Any    -> JR/JALR (without dependency) : 1 clock issue delay
    118   1.1  mrg ;; Any    -> JR/JALR (with dependency)    : 2 clock issue delay
    119   1.1  mrg ;; load   -> JR/JALR (with dependency)    : 3 clock issue delay
    120   1.1  mrg ;; mfhilo -> JR/JALR (with dependency)    : 3 clock issue delay
    121   1.1  mrg ;; mul    -> JR/JALR (with dependency)    : 3 clock issue delay
    122   1.1  mrg (define_bypass 2 "r5k_int_alu"    "r5k_int_jump")
    123   1.1  mrg (define_bypass 3 "r5k_int_load"   "r5k_int_jump")
    124   1.1  mrg (define_bypass 3 "r5k_int_mfhilo" "r5k_int_jump")
    125   1.1  mrg (define_bypass 3 "r5k_int_mul"    "r5k_int_jump")
    126   1.1  mrg 
    127   1.1  mrg ;; Unknown or multi - single issue
    128   1.1  mrg (define_insn_reservation "r5k_int_unknown" 1
    129   1.1  mrg   (and (eq_attr "cpu" "5kc,5kf")
    130   1.3  mrg        (eq_attr "type" "unknown,multi,atomic,syncloop"))
    131   1.1  mrg   "r5k_ixu_arith+r5k_ixu_mpydiv")
    132   1.1  mrg 
    133   1.1  mrg 
    134   1.1  mrg ;; Floating Point Instructions
    135   1.1  mrg ;; The 5Kf is a partial dual-issue cpu which can dual issue an integer
    136   1.1  mrg ;; and floating-point instruction in the same cycle.
    137   1.1  mrg 
    138   1.1  mrg ;; fadd, fabs, fneg
    139   1.1  mrg (define_insn_reservation "r5kf_fadd" 4
    140   1.1  mrg   (and (eq_attr "cpu" "5kf")
    141   1.1  mrg        (eq_attr "type" "fadd,fabs,fneg"))
    142   1.1  mrg   "r5kf_fpu_arith")
    143   1.1  mrg 
    144   1.1  mrg ;; fmove, fcmove
    145   1.1  mrg (define_insn_reservation "r5kf_fmove" 4
    146   1.1  mrg   (and (eq_attr "cpu" "5kf")
    147   1.1  mrg        (eq_attr "type" "fmove"))
    148   1.1  mrg   "r5kf_fpu_arith")
    149   1.1  mrg 
    150   1.1  mrg ;; fload
    151   1.1  mrg (define_insn_reservation "r5kf_fload" 3
    152   1.1  mrg   (and (eq_attr "cpu" "5kf")
    153   1.1  mrg        (eq_attr "type" "fpload,fpidxload"))
    154   1.1  mrg   "r5kf_fpu_arith")
    155   1.1  mrg 
    156   1.1  mrg ;; fstore
    157   1.1  mrg (define_insn_reservation "r5kf_fstore" 1
    158   1.1  mrg   (and (eq_attr "cpu" "5kf")
    159   1.1  mrg        (eq_attr "type" "fpstore"))
    160   1.1  mrg   "r5kf_fpu_arith")
    161   1.1  mrg 
    162   1.1  mrg ;; fmul, fmadd
    163   1.1  mrg (define_insn_reservation "r5kf_fmul_sf" 4
    164   1.1  mrg   (and (eq_attr "cpu" "5kf")
    165   1.1  mrg        (and (eq_attr "type" "fmul,fmadd")
    166   1.1  mrg 	    (eq_attr "mode" "SF")))
    167   1.1  mrg   "r5kf_fpu_arith")
    168   1.1  mrg 
    169   1.1  mrg (define_insn_reservation "r5kf_fmul_df" 5
    170   1.1  mrg   (and (eq_attr "cpu" "5kf")
    171   1.1  mrg        (and (eq_attr "type" "fmul,fmadd")
    172   1.1  mrg 	    (eq_attr "mode" "DF")))
    173   1.1  mrg   "r5kf_fpu_arith*2")
    174   1.1  mrg 
    175   1.1  mrg ;; fdiv, fsqrt, frsqrt
    176   1.1  mrg (define_insn_reservation "r5kf_fdiv_sf" 17
    177   1.1  mrg   (and (eq_attr "cpu" "5kf")
    178   1.1  mrg        (and (eq_attr "type" "fdiv,fsqrt,frsqrt")
    179   1.1  mrg 	    (eq_attr "mode" "SF")))
    180   1.1  mrg   "r5kf_fpu_arith*14")
    181   1.1  mrg 
    182   1.1  mrg (define_insn_reservation "r5kf_fdiv_df" 32
    183   1.1  mrg   (and (eq_attr "cpu" "5kf")
    184   1.1  mrg        (and (eq_attr "type" "fdiv,fsqrt")
    185   1.1  mrg 	    (eq_attr "mode" "DF")))
    186   1.1  mrg   "r5kf_fpu_arith*29")
    187   1.1  mrg 
    188   1.1  mrg ;; frsqrt
    189   1.1  mrg (define_insn_reservation "r5kf_frsqrt_df" 35
    190   1.1  mrg   (and (eq_attr "cpu" "5kf")
    191   1.1  mrg        (and (eq_attr "type" "frsqrt")
    192   1.1  mrg 	    (eq_attr "mode" "DF")))
    193   1.1  mrg   "r5kf_fpu_arith*31")
    194   1.1  mrg 
    195   1.1  mrg ;; fcmp
    196   1.1  mrg (define_insn_reservation "r5kf_fcmp" 2
    197   1.1  mrg   (and (eq_attr "cpu" "5kf")
    198   1.1  mrg        (eq_attr "type" "fcmp"))
    199   1.1  mrg   "r5kf_fpu_arith")
    200   1.1  mrg 
    201   1.1  mrg ;; fcmp -> movf.fmt & movt.fmt bypass (dependency must be on condition)
    202   1.1  mrg (define_bypass 1 "r5kf_fcmp" "r5kf_fmove")
    203   1.1  mrg 
    204   1.1  mrg ;; fcvt (cvt.d.s, cvt.[sd].[wl]
    205   1.1  mrg (define_insn_reservation "r5kf_fcvt_d2s" 4
    206   1.1  mrg   (and (eq_attr "cpu" "5kf")
    207   1.1  mrg        (and (eq_attr "type" "fcvt")
    208   1.1  mrg 	    (eq_attr "cnv_mode" "I2S,I2D,S2D")))
    209   1.1  mrg   "r5kf_fpu_arith")
    210   1.1  mrg 
    211   1.1  mrg ;; fcvt (cvt.s.d)
    212   1.1  mrg (define_insn_reservation "r5kf_fcvt_s2d" 6
    213   1.1  mrg   (and (eq_attr "cpu" "5kc")
    214   1.1  mrg        (and (eq_attr "type" "fcvt")
    215   1.1  mrg 	    (eq_attr "cnv_mode" "D2S")))
    216   1.1  mrg   "r5kf_fpu_arith")
    217   1.1  mrg 
    218   1.1  mrg ;; fcvt (cvt.[wl].[sd], etc)
    219   1.1  mrg (define_insn_reservation "r5kf_fcvt_f2i" 5
    220   1.1  mrg   (and (eq_attr "cpu" "5kf")
    221   1.1  mrg        (and (eq_attr "type" "fcvt")
    222   1.1  mrg 	    (eq_attr "cnv_mode" "S2I,D2I")))
    223   1.1  mrg   "r5kf_fpu_arith")
    224   1.1  mrg 
    225   1.1  mrg ;; fxfer (mfc1, mfhc1, mtc1, mthc1) - single issue
    226   1.1  mrg (define_insn_reservation "r5kf_fxfer" 2
    227   1.1  mrg   (and (eq_attr "cpu" "5kf")
    228   1.1  mrg        (eq_attr "type" "mfc,mtc"))
    229   1.1  mrg   "r5k_ixu_arith+r5kf_fpu_arith")
    230