1;; Generic DFA-based pipeline description for RISC-V targets.
2;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
3;; Contributed by Andrew Waterman (andrew@sifive.com).
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,move"))
31  "alu")
32
33(define_insn_reservation "generic_load" 3
34  (and (eq_attr "tune" "generic")
35       (eq_attr "type" "load,fpload"))
36  "alu")
37
38(define_insn_reservation "generic_store" 1
39  (and (eq_attr "tune" "generic")
40       (eq_attr "type" "store,fpstore"))
41  "alu")
42
43(define_insn_reservation "generic_xfer" 3
44  (and (eq_attr "tune" "generic")
45       (eq_attr "type" "mfc,mtc,fcvt,fmove,fcmp"))
46  "alu")
47
48(define_insn_reservation "generic_branch" 1
49  (and (eq_attr "tune" "generic")
50       (eq_attr "type" "branch,jump,call"))
51  "alu")
52
53(define_insn_reservation "generic_imul" 10
54  (and (eq_attr "tune" "generic")
55       (eq_attr "type" "imul"))
56  "imuldiv*10")
57
58(define_insn_reservation "generic_idivsi" 34
59  (and (eq_attr "tune" "generic")
60       (and (eq_attr "type" "idiv")
61	    (eq_attr "mode" "SI")))
62  "imuldiv*34")
63
64(define_insn_reservation "generic_idivdi" 66
65  (and (eq_attr "tune" "generic")
66       (and (eq_attr "type" "idiv")
67	    (eq_attr "mode" "DI")))
68  "imuldiv*66")
69
70(define_insn_reservation "generic_fmul_single" 5
71  (and (eq_attr "tune" "generic")
72       (and (eq_attr "type" "fadd,fmul,fmadd")
73	    (eq_attr "mode" "SF")))
74  "alu")
75
76(define_insn_reservation "generic_fmul_double" 7
77  (and (eq_attr "tune" "generic")
78       (and (eq_attr "type" "fadd,fmul,fmadd")
79	    (eq_attr "mode" "DF")))
80  "alu")
81
82(define_insn_reservation "generic_fdiv" 20
83  (and (eq_attr "tune" "generic")
84       (eq_attr "type" "fdiv"))
85  "fdivsqrt*20")
86
87(define_insn_reservation "generic_fsqrt" 25
88  (and (eq_attr "tune" "generic")
89       (eq_attr "type" "fsqrt"))
90  "fdivsqrt*25")
91