Debian Codegraph @

gcc/config/riscv/generic.md

raw
1 ;; Generic DFA-based pipeline description for RISC-V targets.
2 ;; Copyright (C) 2011-2025 Free Software Foundation, Inc.
3 ;; Contributed by Andrew Waterman ([email protected]).
4 ;; Based on MIPS target for GNU compiler.
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
23 (define_automaton "pipe0")
24 (define_cpu_unit "alu" "pipe0")
25 (define_cpu_unit "imuldiv" "pipe0")
26 (define_cpu_unit "fdivsqrt" "pipe0")
27
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"))
33 "alu")
34
35 (define_insn_reservation "generic_load" 3
36 (and (eq_attr "tune" "generic")
37 (eq_attr "type" "load,fpload"))
38 "alu")
39
40 (define_insn_reservation "generic_store" 1
41 (and (eq_attr "tune" "generic")
42 (eq_attr "type" "store,fpstore"))
43 "alu")
44
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"))
48 "alu")
49
50 (define_insn_reservation "generic_branch" 1
51 (and (eq_attr "tune" "generic")
52 (eq_attr "type" "branch,jump,call,jalr,ret,trap"))
53 "alu")
54
55 (define_insn_reservation "generic_sfb_alu" 2
56 (and (eq_attr "tune" "generic")
57 (eq_attr "type" "sfb_alu"))
58 "alu")
59
60 (define_insn_reservation "generic_imul" 10
61 (and (eq_attr "tune" "generic")
62 (eq_attr "type" "imul,clmul,cpop"))
63 "imuldiv*10")
64
65 (define_insn_reservation "generic_idivsi" 34
66 (and (eq_attr "tune" "generic")
67 (and (eq_attr "type" "idiv")
68 (eq_attr "mode" "SI")))
69 "imuldiv*34")
70
71 (define_insn_reservation "generic_idivdi" 66
72 (and (eq_attr "tune" "generic")
73 (and (eq_attr "type" "idiv")
74 (eq_attr "mode" "DI")))
75 "imuldiv*66")
76
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")))
81 "alu")
82
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")))
87 "alu")
88
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")))
93 "alu")
94
95 (define_insn_reservation "generic_fdiv" 20
96 (and (eq_attr "tune" "generic")
97 (eq_attr "type" "fdiv"))
98 "fdivsqrt*20")
99
100 (define_insn_reservation "generic_fsqrt" 25
101 (and (eq_attr "tune" "generic")
102 (eq_attr "type" "fsqrt"))
103 "fdivsqrt*25")
104