1 ;; Generic DFA-based pipeline description for RISC-V targets.
2 ;; Copyright (C) 2011-2024 Free Software Foundation, Inc.
3 ;; Contributed by Andrew Waterman (andrew@sifive.com).
4 ;; Based on MIPS target for GNU compiler.
6 ;; This file is part of GCC.
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.
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.
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/>.
23 (define_automaton "pipe0")
24 (define_cpu_unit "alu" "pipe0")
25 (define_cpu_unit "imuldiv" "pipe0")
26 (define_cpu_unit "fdivsqrt" "pipe0")
28 (define_insn_reservation "generic_alu" 1
29 (and (eq_attr "tune" "generic")
30 (eq_attr "type" "unknown,const,arith,shift,slt,multi,auipc,nop,logical,\
31 move,bitmanip,min,max,minu,maxu,clz,ctz,rotate,atomic,\
32 condmove,crypto,mvpair,zicond"))
35 (define_insn_reservation "generic_load" 3
36 (and (eq_attr "tune" "generic")
37 (eq_attr "type" "load,fpload"))
40 (define_insn_reservation "generic_store" 1
41 (and (eq_attr "tune" "generic")
42 (eq_attr "type" "store,fpstore"))
45 (define_insn_reservation "generic_xfer" 3
46 (and (eq_attr "tune" "generic")
47 (eq_attr "type" "mfc,mtc,fcvt,fcvt_i2f,fcvt_f2i,fmove,fcmp"))
50 (define_insn_reservation "generic_branch" 1
51 (and (eq_attr "tune" "generic")
52 (eq_attr "type" "branch,jump,call,jalr,ret,trap"))
55 (define_insn_reservation "generic_sfb_alu" 2
56 (and (eq_attr "tune" "generic")
57 (eq_attr "type" "sfb_alu"))
60 (define_insn_reservation "generic_imul" 10
61 (and (eq_attr "tune" "generic")
62 (eq_attr "type" "imul,clmul,cpop"))
65 (define_insn_reservation "generic_idivsi" 34
66 (and (eq_attr "tune" "generic")
67 (and (eq_attr "type" "idiv")
68 (eq_attr "mode" "SI")))
71 (define_insn_reservation "generic_idivdi" 66
72 (and (eq_attr "tune" "generic")
73 (and (eq_attr "type" "idiv")
74 (eq_attr "mode" "DI")))
77 (define_insn_reservation "generic_fmul_half" 5
78 (and (eq_attr "tune" "generic")
79 (and (eq_attr "type" "fadd,fmul,fmadd")
80 (eq_attr "mode" "HF")))
83 (define_insn_reservation "generic_fmul_single" 5
84 (and (eq_attr "tune" "generic")
85 (and (eq_attr "type" "fadd,fmul,fmadd")
86 (eq_attr "mode" "SF")))
89 (define_insn_reservation "generic_fmul_double" 7
90 (and (eq_attr "tune" "generic")
91 (and (eq_attr "type" "fadd,fmul,fmadd")
92 (eq_attr "mode" "DF")))
95 (define_insn_reservation "generic_fdiv" 20
96 (and (eq_attr "tune" "generic")
97 (eq_attr "type" "fdiv"))
100 (define_insn_reservation "generic_fsqrt" 25
101 (and (eq_attr "tune" "generic")
102 (eq_attr "type" "fsqrt"))