summaryrefslogtreecommitdiff
path: root/gcc/config/riscv/generic.md
blob: 13c198113199729c879a5c877116087a72c785b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
;; Generic DFA-based pipeline description for RISC-V targets.
;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
;; Contributed by Andrew Waterman (andrew@sifive.com).
;; Based on MIPS target for GNU compiler.

;; This file is part of GCC.

;; GCC is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published
;; by the Free Software Foundation; either version 3, or (at your
;; option) any later version.

;; GCC is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
;; License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.


(define_automaton "pipe0")
(define_cpu_unit "alu" "pipe0")
(define_cpu_unit "imuldiv" "pipe0")
(define_cpu_unit "fdivsqrt" "pipe0")

(define_insn_reservation "generic_alu" 1
  (eq_attr "type" "unknown,const,arith,shift,slt,multi,nop,logical,move")
  "alu")

(define_insn_reservation "generic_load" 3
  (eq_attr "type" "load,fpload")
  "alu")

(define_insn_reservation "generic_store" 1
  (eq_attr "type" "store,fpstore")
  "alu")

(define_insn_reservation "generic_xfer" 3
  (eq_attr "type" "mfc,mtc,fcvt,fmove,fcmp")
  "alu")

(define_insn_reservation "generic_branch" 1
  (eq_attr "type" "branch,jump,call")
  "alu")

(define_insn_reservation "generic_imul" 10
  (eq_attr "type" "imul")
  "imuldiv*10")

(define_insn_reservation "generic_idivsi" 34
  (and (eq_attr "type" "idiv")
       (eq_attr "mode" "SI"))
  "imuldiv*34")

(define_insn_reservation "generic_idivdi" 66
  (and (eq_attr "type" "idiv")
       (eq_attr "mode" "DI"))
  "imuldiv*66")

(define_insn_reservation "generic_fmul_single" 5
  (and (eq_attr "type" "fadd,fmul,fmadd")
       (eq_attr "mode" "SF"))
  "alu")

(define_insn_reservation "generic_fmul_double" 7
  (and (eq_attr "type" "fadd,fmul,fmadd")
       (eq_attr "mode" "DF"))
  "alu")

(define_insn_reservation "generic_fdiv" 20
  (eq_attr "type" "fdiv")
  "fdivsqrt*20")

(define_insn_reservation "generic_fsqrt" 25
  (eq_attr "type" "fsqrt")
  "fdivsqrt*25")