| 1 |
;; Scheduling description for LEON5. |
| 2 |
;; Copyright (C) 2021-2025 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 |
|
| 21 |
;; The LEON5 can often dual issue instructions from the same 64-bit aligned |
| 22 |
;; double word if there are no data dependencies. |
| 23 |
;; |
| 24 |
;; Avoid scheduling load/store, FPU, and multiply instructions back to |
| 25 |
;; back, regardless of data dependencies. |
| 26 |
;; |
| 27 |
;; Push comparisons away from the associated branch instruction. |
| 28 |
;; |
| 29 |
;; Avoid scheduling ALU instructions with data dependencies back to back. |
| 30 |
;; |
| 31 |
;; Schedule three instructions between load and dependent instruction. |
| 32 |
|
| 33 |
(define_automaton "leon5") |
| 34 |
|
| 35 |
(define_cpu_unit "leon5_memory" "leon5") |
| 36 |
(define_cpu_unit "leon5_mul" "leon5") |
| 37 |
(define_cpu_unit "grfpu_d" "grfpu") |
| 38 |
(define_cpu_unit "grfpu_s" "grfpu") |
| 39 |
|
| 40 |
(define_insn_reservation "leon5_load" 4 |
| 41 |
(and (eq_attr "cpu" "leon5") |
| 42 |
(eq_attr "type" "load,sload")) |
| 43 |
"leon5_memory * 2, nothing * 2") |
| 44 |
|
| 45 |
(define_insn_reservation "leon5_fpload" 2 |
| 46 |
(and (eq_attr "cpu" "leon5") |
| 47 |
(eq_attr "type" "fpload")) |
| 48 |
"leon5_memory * 2 + grfpu_alu * 2") |
| 49 |
|
| 50 |
(define_insn_reservation "leon5_store" 2 |
| 51 |
(and (eq_attr "cpu" "leon5") |
| 52 |
(eq_attr "type" "store")) |
| 53 |
"leon5_memory * 2") |
| 54 |
|
| 55 |
(define_insn_reservation "leon5_fpstore" 2 |
| 56 |
(and (eq_attr "cpu" "leon5") |
| 57 |
(eq_attr "type" "fpstore")) |
| 58 |
"leon5_memory * 2 + grfpu_alu * 2") |
| 59 |
|
| 60 |
(define_insn_reservation "leon5_ialu" 2 |
| 61 |
(and (eq_attr "cpu" "leon5") |
| 62 |
(eq_attr "type" "ialu, shift, ialuX")) |
| 63 |
"nothing * 2") |
| 64 |
|
| 65 |
(define_insn_reservation "leon5_compare" 5 |
| 66 |
(and (eq_attr "cpu" "leon5") |
| 67 |
(eq_attr "type" "compare")) |
| 68 |
"nothing * 5") |
| 69 |
|
| 70 |
(define_insn_reservation "leon5_imul" 4 |
| 71 |
(and (eq_attr "cpu" "leon5") |
| 72 |
(eq_attr "type" "imul")) |
| 73 |
"leon5_mul * 2, nothing * 2") |
| 74 |
|
| 75 |
(define_insn_reservation "leon5_idiv" 35 |
| 76 |
(and (eq_attr "cpu" "leon5") |
| 77 |
(eq_attr "type" "imul")) |
| 78 |
"nothing * 35") |
| 79 |
|
| 80 |
(define_insn_reservation "leon5_fp_alu" 5 |
| 81 |
(and (eq_attr "cpu" "leon5") |
| 82 |
(eq_attr "type" "fp,fpcmp,fpmul,fpmove")) |
| 83 |
"grfpu_alu * 2, nothing*3") |
| 84 |
|
| 85 |
(define_insn_reservation "leon5_fp_divs" 17 |
| 86 |
(and (eq_attr "cpu" "leon5") |
| 87 |
(eq_attr "type" "fpdivs")) |
| 88 |
"grfpu_alu * 2 + grfpu_d*16, nothing") |
| 89 |
|
| 90 |
(define_insn_reservation "leon5_fp_divd" 18 |
| 91 |
(and (eq_attr "cpu" "leon5") |
| 92 |
(eq_attr "type" "fpdivd")) |
| 93 |
"grfpu_alu * 2 + grfpu_d*17, nothing") |
| 94 |
|
| 95 |
(define_insn_reservation "leon5_fp_sqrts" 25 |
| 96 |
(and (eq_attr "cpu" "leon5") |
| 97 |
(eq_attr "type" "fpsqrts")) |
| 98 |
"grfpu_alu * 2 + grfpu_s*24, nothing") |
| 99 |
|
| 100 |
(define_insn_reservation "leon5_fp_sqrtd" 26 |
| 101 |
(and (eq_attr "cpu" "leon5") |
| 102 |
(eq_attr "type" "fpsqrtd")) |
| 103 |
"grfpu_alu * 2 + grfpu_s*25, nothing") |