| 1 |
;; DFA scheduling description of the Synopsys DesignWare ARC HS4x cpu |
| 2 |
;; for GNU C compiler |
| 3 |
;; Copyright (C) 2017-2025 Free Software Foundation, Inc. |
| 4 |
|
| 5 |
;; This file is part of GCC. |
| 6 |
|
| 7 |
;; GCC is free software; you can redistribute it and/or modify |
| 8 |
;; it under the terms of the GNU General Public License as published by |
| 9 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 10 |
;; any later version. |
| 11 |
|
| 12 |
;; GCC is distributed in the hope that it will be useful, |
| 13 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
;; GNU General Public License for more details. |
| 16 |
|
| 17 |
;; You should have received a copy of the GNU General Public License |
| 18 |
;; along with GCC; see the file COPYING3. If not see |
| 19 |
;; <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
(define_automaton "ARCHS4x") |
| 22 |
|
| 23 |
(define_cpu_unit "hs4x_issue0" "ARCHS4x") |
| 24 |
(define_cpu_unit "hs4x_issue1" "ARCHS4x") |
| 25 |
(define_cpu_unit "hs4x_ld_st" "ARCHS4x") |
| 26 |
(define_cpu_unit "hs4x_divrem" "ARCHS4x") |
| 27 |
(define_cpu_unit "hs4x_mult" "ARCHS4x") |
| 28 |
(define_cpu_unit "hs4x_x1, hs4x_x2" "ARCHS4x") |
| 29 |
(define_cpu_unit "hs4x_y1, hs4x_y2" "ARCHS4x") |
| 30 |
(define_cpu_unit "hs4x_brcc0, hs4x_brcc1" "ARCHS4x") |
| 31 |
|
| 32 |
(define_insn_reservation "hs4x_brj_op" 1 |
| 33 |
(and (match_test "TARGET_HS") |
| 34 |
(eq_attr "tune" "archs4x, archs4xd") |
| 35 |
(eq_attr "type" "call, call_no_delay_slot, uncond_branch, jump, \ |
| 36 |
branch, sfunc")) |
| 37 |
"hs4x_issue0") |
| 38 |
|
| 39 |
(define_insn_reservation "hs4x_brcc_op" 1 |
| 40 |
(and (match_test "TARGET_HS") |
| 41 |
(eq_attr "tune" "archs4x, archs4xd") |
| 42 |
(eq_attr "type" "brcc,brcc_no_delay_slot,loop_end")) |
| 43 |
"hs4x_issue0 + hs4x_brcc0 + hs4x_brcc1") |
| 44 |
|
| 45 |
(define_insn_reservation "hs4x_data_load_op" 4 |
| 46 |
(and (match_test "TARGET_HS") |
| 47 |
(eq_attr "tune" "archs4x, archs4xd") |
| 48 |
(eq_attr "type" "load")) |
| 49 |
"hs4x_issue1 + hs4x_ld_st,hs4x_ld_st") |
| 50 |
|
| 51 |
(define_insn_reservation "hs4x_data_store_op" 1 |
| 52 |
(and (match_test "TARGET_HS") |
| 53 |
(eq_attr "tune_store" "normal") |
| 54 |
(eq_attr "type" "store")) |
| 55 |
"hs4x_issue1 + hs4x_ld_st") |
| 56 |
|
| 57 |
(define_insn_reservation "hs4x_data_store_1_op" 2 |
| 58 |
(and (match_test "TARGET_HS") |
| 59 |
(eq_attr "tune_store" "rel31a") |
| 60 |
(eq_attr "type" "store")) |
| 61 |
"hs4x_issue1 + hs4x_ld_st + hs4x_brcc0, hs4x_brcc1") |
| 62 |
|
| 63 |
;; Advanced ALU |
| 64 |
(define_insn_reservation "hs4x_adv_alue_op" 4 |
| 65 |
(and (match_test "TARGET_HS") |
| 66 |
(eq_attr "tune" "archs4x, archs4xd") |
| 67 |
(eq_attr "type" "cc_arith, two_cycle_core, shift, lr, sr")) |
| 68 |
"(hs4x_issue0 | hs4x_issue1), hs4x_x1") |
| 69 |
|
| 70 |
(define_insn_reservation "hs4x_adv_alul_op" 6 |
| 71 |
(and (match_test "TARGET_HS") |
| 72 |
(eq_attr "tune" "archs4xd") |
| 73 |
(eq_attr "type" "cc_arith, two_cycle_core, shift, lr, sr")) |
| 74 |
"(hs4x_issue0 | hs4x_issue1), nothing*2, hs4x_x2") |
| 75 |
|
| 76 |
;; Basic ALU |
| 77 |
(define_insn_reservation "hs4x_basic_alue_op" 1 |
| 78 |
(and (match_test "TARGET_HS") |
| 79 |
(eq_attr "tune" "archs4x, archs4xd") |
| 80 |
(eq_attr "type" "move, cmove, unary, binary, compare, misc, add, sub, bxor")) |
| 81 |
"(hs4x_issue0 | hs4x_issue1) + hs4x_y1") |
| 82 |
|
| 83 |
(define_insn_reservation "hs4x_basic_alul_op" 4 |
| 84 |
(and (match_test "TARGET_HS") |
| 85 |
(eq_attr "tune" "archs4x, archs4xd") |
| 86 |
(eq_attr "type" "move, cmove, unary, binary, compare, misc")) |
| 87 |
"(hs4x_issue0 | hs4x_issue1), nothing*2, hs4x_y2") |
| 88 |
|
| 89 |
(define_insn_reservation "hs4x_divrem_op" 13 |
| 90 |
(and (match_test "TARGET_HS") |
| 91 |
(eq_attr "tune" "archs4x, archs4xd") |
| 92 |
(eq_attr "type" "div_rem")) |
| 93 |
"hs4x_issue0 + hs4x_divrem, (hs4x_divrem)*12") |
| 94 |
|
| 95 |
;;Consider the DSPMPY fast here |
| 96 |
(define_insn_reservation "hs4x_mul_fast_op" 7 |
| 97 |
(and (match_test "TARGET_HS") |
| 98 |
(eq_attr "tune_dspmpy" "fast") |
| 99 |
(eq_attr "type" "mul16_em, multi, umulti")) |
| 100 |
"hs4x_issue0 + hs4x_mult") |
| 101 |
|
| 102 |
(define_insn_reservation "hs4x_mul_slow_op" 8 |
| 103 |
(and (match_test "TARGET_HS") |
| 104 |
(eq_attr "tune_dspmpy" "slow") |
| 105 |
(eq_attr "type" "mul16_em, multi, umulti")) |
| 106 |
"hs4x_issue0 + hs4x_mult") |
| 107 |
|
| 108 |
;; FPU unit |
| 109 |
(define_insn_reservation "hs4x_fpu_op" 8 |
| 110 |
(and (match_test "TARGET_HS") |
| 111 |
(eq_attr "tune" "archs4x, archs4xd") |
| 112 |
(eq_attr "type" "fpu")) |
| 113 |
"hs4x_issue0") |
| 114 |
|
| 115 |
;; FPU FUSE unit |
| 116 |
(define_insn_reservation "hs4x_fpu_fuse_op" 12 |
| 117 |
(and (match_test "TARGET_HS") |
| 118 |
(eq_attr "tune" "archs4x, archs4xd") |
| 119 |
(eq_attr "type" "fpu_fuse")) |
| 120 |
"hs4x_issue0") |
| 121 |
|
| 122 |
;; FPU SP SQRT/DIV unit |
| 123 |
(define_insn_reservation "hs4x_fpu_sdiv_op" 20 |
| 124 |
(and (match_test "TARGET_HS") |
| 125 |
(eq_attr "tune" "archs4x, archs4xd") |
| 126 |
(eq_attr "type" "fpu_sdiv")) |
| 127 |
"hs4x_issue0") |
| 128 |
|
| 129 |
;; FPU DP SQRT/DIV unit |
| 130 |
(define_insn_reservation "hs4x_fpu_ddiv_op" 34 |
| 131 |
(and (match_test "TARGET_HS") |
| 132 |
(eq_attr "tune" "archs4x, archs4xd") |
| 133 |
(eq_attr "type" "fpu_ddiv")) |
| 134 |
"hs4x_issue0") |
| 135 |
|
| 136 |
;; FPU CVT unit |
| 137 |
(define_insn_reservation "hs4x_fpu_cvt_op" 5 |
| 138 |
(and (match_test "TARGET_HS") |
| 139 |
(eq_attr "tune" "archs4x, archs4xd") |
| 140 |
(eq_attr "type" "fpu_cvt")) |
| 141 |
"hs4x_issue0") |
| 142 |
|
| 143 |
;; BYPASS Advanced ALU -> |
| 144 |
(define_bypass 1 "hs4x_adv_alue_op" "hs4x_divrem_op") |
| 145 |
(define_bypass 1 "hs4x_adv_alue_op" "hs4x_mul_*op") |
| 146 |
(define_bypass 2 "hs4x_adv_alue_op" "hs4x_adv_alue_op") |
| 147 |
(define_bypass 1 "hs4x_adv_alue_op" "hs4x_basic_alue_op") |
| 148 |
(define_bypass 1 "hs4x_adv_alue_op" "hs4x_basic_alul_op") |
| 149 |
(define_bypass 1 "hs4x_adv_alue_op" "hs4x_data_load_op") |
| 150 |
(define_bypass 0 "hs4x_adv_alue_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 151 |
(define_bypass 2 "hs4x_adv_alue_op" "hs4x_data_store_op") |
| 152 |
(define_bypass 1 "hs4x_adv_alue_op" "hs4x_fpu_*op") |
| 153 |
|
| 154 |
(define_bypass 2 "hs4x_adv_alul_op" "hs4x_basic_alul_op") |
| 155 |
(define_bypass 2 "hs4x_adv_alul_op" "hs4x_adv_alul_op") |
| 156 |
(define_bypass 2 "hs4x_adv_alul_op" "hs4x_mul_*op") |
| 157 |
(define_bypass 0 "hs4x_adv_alul_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 158 |
(define_bypass 4 "hs4x_adv_alul_op" "hs4x_divrem_op") |
| 159 |
(define_bypass 5 "hs4x_adv_alul_op" "hs4x_fpu_*op") |
| 160 |
|
| 161 |
;; BYPASS Basic ALU -> |
| 162 |
(define_bypass 0 "hs4x_basic_alue_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 163 |
|
| 164 |
(define_bypass 1 "hs4x_basic_alul_op" "hs4x_basic_alul_op") |
| 165 |
(define_bypass 1 "hs4x_basic_alul_op" "hs4x_adv_alul_op") |
| 166 |
(define_bypass 0 "hs4x_basic_alul_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 167 |
(define_bypass 1 "hs4x_basic_alul_op" "hs4x_mul_*op") |
| 168 |
(define_bypass 3 "hs4x_basic_alul_op" "hs4x_divrem_op") |
| 169 |
(define_bypass 3 "hs4x_basic_alul_op" "hs4x_fpu_*op") |
| 170 |
|
| 171 |
;; BYPASS LD -> |
| 172 |
(define_bypass 1 "hs4x_data_load_op" "hs4x_basic_alul_op") |
| 173 |
(define_bypass 1 "hs4x_data_load_op" "hs4x_adv_alul_op") |
| 174 |
(define_bypass 3 "hs4x_data_load_op" "hs4x_divrem_op") |
| 175 |
(define_bypass 3 "hs4x_data_load_op" "hs4x_data_load_op") |
| 176 |
(define_bypass 3 "hs4x_data_load_op" "hs4x_mul_*op") |
| 177 |
(define_bypass 0 "hs4x_data_load_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 178 |
(define_bypass 3 "hs4x_data_load_op" "hs4x_fpu_*op") |
| 179 |
|
| 180 |
;; BYPASS FAST MPY -> |
| 181 |
(define_bypass 4 "hs4x_mul_fast_op" "hs4x_basic_alul_op") |
| 182 |
(define_bypass 4 "hs4x_mul_fast_op" "hs4x_adv_alul_op") |
| 183 |
(define_bypass 4 "hs4x_mul_fast_op" "hs4x_mul_fast_op") |
| 184 |
(define_bypass 6 "hs4x_mul_fast_op" "hs4x_divrem_op") |
| 185 |
(define_bypass 0 "hs4x_mul_fast_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 186 |
(define_bypass 6 "hs4x_mul_fast_op" "hs4x_fpu_*op") |
| 187 |
|
| 188 |
;; BYPASS SLOW MPY -> |
| 189 |
(define_bypass 5 "hs4x_mul_slow_op" "hs4x_basic_alul_op") |
| 190 |
(define_bypass 5 "hs4x_mul_slow_op" "hs4x_adv_alul_op") |
| 191 |
(define_bypass 5 "hs4x_mul_slow_op" "hs4x_mul_slow_op") |
| 192 |
(define_bypass 7 "hs4x_mul_slow_op" "hs4x_divrem_op") |
| 193 |
(define_bypass 0 "hs4x_mul_slow_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 194 |
(define_bypass 7 "hs4x_mul_slow_op" "hs4x_fpu_*op") |
| 195 |
|
| 196 |
;;BYPASS FPU -> |
| 197 |
(define_bypass 5 "hs4x_fpu_op" "hs4x_basic_alul_op") |
| 198 |
(define_bypass 5 "hs4x_fpu_op" "hs4x_adv_alul_op") |
| 199 |
(define_bypass 5 "hs4x_fpu_op" "hs4x_mul_*op") |
| 200 |
(define_bypass 7 "hs4x_fpu_op" "hs4x_divrem_op") |
| 201 |
(define_bypass 5 "hs4x_fpu_op" "hs4x_fpu_*op") |
| 202 |
(define_bypass 0 "hs4x_fpu_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 203 |
|
| 204 |
;;BYPASS FPU FUSE -> |
| 205 |
(define_bypass 9 "hs4x_fpu_fuse_op" "hs4x_basic_alul_op") |
| 206 |
(define_bypass 9 "hs4x_fpu_fuse_op" "hs4x_adv_alul_op") |
| 207 |
(define_bypass 9 "hs4x_fpu_fuse_op" "hs4x_mul_*op") |
| 208 |
(define_bypass 11 "hs4x_fpu_fuse_op" "hs4x_divrem_op") |
| 209 |
(define_bypass 11 "hs4x_fpu_fuse_op" "hs4x_fpu_*op") |
| 210 |
(define_bypass 0 "hs4x_fpu_fuse_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 211 |
|
| 212 |
;;BYPASS FPU SP DIV -> |
| 213 |
(define_bypass 16 "hs4x_fpu_sdiv_op" "hs4x_basic_alul_op") |
| 214 |
(define_bypass 16 "hs4x_fpu_sdiv_op" "hs4x_adv_alul_op") |
| 215 |
(define_bypass 16 "hs4x_fpu_sdiv_op" "hs4x_mul_*op") |
| 216 |
(define_bypass 19 "hs4x_fpu_sdiv_op" "hs4x_divrem_op") |
| 217 |
(define_bypass 19 "hs4x_fpu_sdiv_op" "hs4x_fpu_*op") |
| 218 |
(define_bypass 0 "hs4x_fpu_sdiv_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 219 |
|
| 220 |
;;BYPASS FPU DP DIV -> |
| 221 |
(define_bypass 31 "hs4x_fpu_ddiv_op" "hs4x_basic_alul_op") |
| 222 |
(define_bypass 31 "hs4x_fpu_ddiv_op" "hs4x_adv_alul_op") |
| 223 |
(define_bypass 31 "hs4x_fpu_ddiv_op" "hs4x_mul_*op") |
| 224 |
(define_bypass 34 "hs4x_fpu_ddiv_op" "hs4x_divrem_op") |
| 225 |
(define_bypass 34 "hs4x_fpu_ddiv_op" "hs4x_fpu_*op") |
| 226 |
(define_bypass 0 "hs4x_fpu_ddiv_op" "hs4x_data_store_op" "store_data_bypass_p") |
| 227 |
|
| 228 |
;;BYPASS FPU CVT -> |
| 229 |
(define_bypass 1 "hs4x_fpu_cvt_op" "hs4x_basic_alul_op") |
| 230 |
(define_bypass 1 "hs4x_fpu_cvt_op" "hs4x_adv_alul_op") |
| 231 |
(define_bypass 1 "hs4x_fpu_cvt_op" "hs4x_mul_*op") |
| 232 |
(define_bypass 4 "hs4x_fpu_cvt_op" "hs4x_divrem_op") |
| 233 |
(define_bypass 4 "hs4x_fpu_cvt_op" "hs4x_fpu_*op") |
| 234 |
(define_bypass 0 "hs4x_fpu_cvt_op" "hs4x_data_store_op" "store_data_bypass_p") |