aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/config/arc/arc700.md
blob: 8e80b4f7c2e44fa6ae35798fa03a1b68024cc4e8 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
;; DFA scheduling description of the Synopsys DesignWare ARC700 cpu
;; for GNU C compiler
;;    Comments and Support For ARC700 instructions added by
;;    Saurabh Verma (saurabh.verma@codito.com)
;;    Ramana Radhakrishnan(ramana.radhakrishnan@codito.com)
;;    Factoring out and improvement of ARC700 Scheduling by
;;    Joern Rennecke (joern.rennecke@embecosm.com)
;; Copyright (C) 2006-2014 Free Software Foundation, Inc.

;; 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 "ARC700")

;; aux to be added here
(define_cpu_unit "core, dmp,  write_port, dmp_write_port, multiplier, issue, blockage, simd_unit" "ARC700")

(define_insn_reservation "core_insn_DI" 2
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "unary, move, cmove, binary")
       (match_operand:DI 0 "" ""))
  "issue+core, issue+core+write_port, write_port")

(define_insn_reservation "lr" 2
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "lr"))
  "issue+blockage, blockage*2, write_port")

(define_insn_reservation "sr" 1
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "sr"))
  "issue+dmp_write_port+blockage, blockage*9")

(define_insn_reservation "core_insn" 1
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "unary, move, binary"))
  "issue+core, nothing, write_port")

(define_insn_reservation "cmove" 1
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "cmove"))
  "issue+core, nothing, write_port")

(define_insn_reservation "cc_arith" 1
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "cc_arith"))
  "issue+core, nothing, write_port")

(define_insn_reservation "two_cycle_core_insn" 2
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "two_cycle_core"))
  "issue+core, nothing, write_port")

(define_insn_reservation "divaw_insn" 2
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "divaw"))
  "issue+core, nothing, write_port")

(define_insn_reservation "shift_insn" 2
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "shift"))
  "issue+core, nothing, write_port")

; Latency from flag setters to arithmetic with carry is 3.
(define_insn_reservation "compare_700" 3
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "compare"))
  "issue+core, nothing, write_port")

; Assume here the branch is predicted correctly and has a delay slot insn
; or is properly unaligned.
(define_insn_reservation "branch_700" 1
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "compare"))
  "issue+core, nothing, write_port")

; TODOs: is this correct ??
(define_insn_reservation "multi_DI" 10
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "multi")
       (match_operand:DI 0 "" ""))
  "issue+multiplier, multiplier*2,issue+multiplier, multiplier*2,
   nothing,write_port,nothing*2, write_port")

(define_insn_reservation "umulti_DI" 9
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "umulti")
       (match_operand:DI 0 "" ""))
  "issue+multiplier, multiplier,issue+multiplier, multiplier*2,
   write_port,nothing*3, write_port")

(define_insn_reservation "umulti_xmac" 5
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "umulti"))
  "issue+multiplier, multiplier, nothing*3, write_port")

; latency of mpyu is lower than mpy / mpyh / mpyhu
(define_insn_reservation "umulti_std" 6
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "umulti"))
  "issue+multiplier, multiplier*3, nothing*2, write_port")

;; arc700 xmac multiplier
(define_insn_reservation "multi_xmac" 5
  (and (eq_attr "tune" "arc700_4_2_xmac")
       (eq_attr "type" "multi"))
  "issue+multiplier,multiplier,nothing*3,write_port")

; arc700 standard multiplier
(define_insn_reservation "multi_std" 7
  (and (eq_attr "tune" "arc700_4_2_std")
       (eq_attr "type" "multi"))
  "issue+multiplier,multiplier*4,nothing*2,write_port")

;(define_insn_reservation "multi_SI" 7
;       (eq_attr "type" "multi")
;  "issue+multiplier, multiplier*2, nothing*4, write_port")

; There is no multiplier -> multiplier bypass except for the
; mac -> mac dependency on the accumulator.

; divaw -> divaw latency is 1 cycle
(define_bypass 1 "divaw_insn" "divaw_insn")

(define_bypass 1 "compare_700" "branch_700,core_insn,data_store,data_load")

; we could shedule the cmove immediately after the compare, but then
; the cmove would have higher latency... so just keep the cmove apart
; from the compare.
(define_bypass 2 "compare_700" "cmove")

; no functional unit runs when blockage is reserved
(exclusion_set "blockage" "core, multiplier")

(define_insn_reservation "data_load_DI" 4
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "load")
       (match_operand:DI 0 "" ""))
  "issue+dmp, issue+dmp, dmp_write_port, dmp_write_port")

(define_insn_reservation "data_load" 3
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "load")
       (not (match_operand:DI 0 "" "")))
  "issue+dmp, nothing, dmp_write_port")

(define_insn_reservation "data_store_DI" 2
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "store")
       (match_operand:DI 0 "" ""))
  "issue+dmp_write_port, issue+dmp_write_port")

(define_insn_reservation "data_store" 1
  (and (eq_attr "tune_arc700" "true")
       (eq_attr "type" "store")
       (not (match_operand:DI 0 "" "")))
  "issue+dmp_write_port")