gcc/ChangeLog:
[official-gcc.git] / gcc / config / riscv / generic.md
blob294c7ef729dadbab5f8c5f416211e8b7a2173034
1 ;; Generic DFA-based pipeline description for RISC-V targets.
2 ;; Copyright (C) 2011-2017 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   (eq_attr "type" "unknown,const,arith,shift,slt,multi,nop,logical,move")
30   "alu")
32 (define_insn_reservation "generic_load" 3
33   (eq_attr "type" "load,fpload")
34   "alu")
36 (define_insn_reservation "generic_store" 1
37   (eq_attr "type" "store,fpstore")
38   "alu")
40 (define_insn_reservation "generic_xfer" 3
41   (eq_attr "type" "mfc,mtc,fcvt,fmove,fcmp")
42   "alu")
44 (define_insn_reservation "generic_branch" 1
45   (eq_attr "type" "branch,jump,call")
46   "alu")
48 (define_insn_reservation "generic_imul" 10
49   (eq_attr "type" "imul")
50   "imuldiv*10")
52 (define_insn_reservation "generic_idivsi" 34
53   (and (eq_attr "type" "idiv")
54        (eq_attr "mode" "SI"))
55   "imuldiv*34")
57 (define_insn_reservation "generic_idivdi" 66
58   (and (eq_attr "type" "idiv")
59        (eq_attr "mode" "DI"))
60   "imuldiv*66")
62 (define_insn_reservation "generic_fmul_single" 5
63   (and (eq_attr "type" "fadd,fmul,fmadd")
64        (eq_attr "mode" "SF"))
65   "alu")
67 (define_insn_reservation "generic_fmul_double" 7
68   (and (eq_attr "type" "fadd,fmul,fmadd")
69        (eq_attr "mode" "DF"))
70   "alu")
72 (define_insn_reservation "generic_fdiv" 20
73   (eq_attr "type" "fdiv")
74   "fdivsqrt*20")
76 (define_insn_reservation "generic_fsqrt" 25
77   (eq_attr "type" "fsqrt")
78   "fdivsqrt*25")