summaryrefslogtreecommitdiff
path: root/gcc/config/visium/gr6.md
blob: cd8d81493d22c198670319504928e6d5ef31c847 (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
;; Scheduling description for GR6.
;; Copyright (C) 2013-2019 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/>.

;; GR6 is a dual-issue, superscalar, out-of-order processor.
;;
;; The GR6 pipeline has 3 major components:
;;  1. The FETCH/DECODE/DISPATCH stages, an in-order front-end,
;;  2. The PROCESS stage, which is the out-of-order core,
;;  3. The STORE stage, an in-order register storage stage.
;;
;; The front-end and the back-end (PROCESS + STORE) are connected through a set
;; of reservation stations which, among other things, serve as buffers for the
;; decoded instructions.  The reservation stations are attached to a specific
;; execution unit of the PROCESS stage and the DISPATCH stage is responsible
;; for dispatching the decoded instructions to the appropriate stations.  Most
;; execution units have multiple reservation stations, thus making it possible
;; to dispatch two instructions per unit on a given cycle, but only one of them
;; can be executed on the next cycle.
;;
;; Since the core executes the instructions out of order, the most important
;; consideration for performance tuning is to make sure that enough decoded
;; instructions are ready for execution in the PROCESS stage while not stalling
;; the front-end, i.e while not trying to dispatch a decoded instruction to an
;; execution unit whose reservation stations are full.  Therefore, we do not
;; model the reservation stations (which is equivalent to pretending that there
;; is only one of them for each execution unit) but only the execution unit,
;; thus preserving some margin in case the unit itself stalls unexpectedly.

;; CPU execution units:
;;
;; inst[1|2]             The front-end: 2 instructions can be issued on a given
;;                       cycle by the FETCH/DECODE/DISPATCH stages, except for
;;                       the Block Move instructions.
;;
;; mov                   Move Execution Unit: immediate moves into registers.
;;
;; alu[1|2]              The 2 Arithmetic and Logic Units: other instructions
;;                       operating on the registers.
;;
;; bru                   Branch Resolution Unit: all branches.
;;
;; mem_wr                Memory Write Unit: all writes to memory.
;;
;; mem_rd                Memory Read Unit: all reads from memory.
;;
;; mem_eam               EAM interface: reads and writes from and to the EAM
;;                       and reads from the FP registers.
;;
;; eam                   Extended Arithmetic Module: multiply, divide and
;;                       64-bit shifts.
;;
;; fpcu                  Floating-Point Compare Unit: FP comparisons.
;;
;; fpu[1|2|3|4]          The 4 Floating-Point Units: all other instructions
;;                       operating on the FP registers.

(define_automaton "gr6,gr6_fpu")

(define_cpu_unit "gr6_inst1, gr6_inst2" "gr6")
(define_cpu_unit "gr6_mov" "gr6")
(define_cpu_unit "gr6_alu1,gr6_alu2" "gr6")
(define_cpu_unit "gr6_bru" "gr6")
(define_cpu_unit "gr6_mem_wr,gr6_mem_rd,gr6_mem_eam" "gr6")
(define_cpu_unit "gr6_eam" "gr6")
(define_cpu_unit "gr6_fpcu" "gr6")
(define_cpu_unit "gr6_fpu1,gr6_fpu2,gr6_fpu3,gr6_fpu4" "gr6_fpu")

(define_reservation "gr6_issue" "(gr6_inst1 | gr6_inst2)")
(define_reservation "gr6_single_issue" "gr6_inst1 + gr6_inst2")

(define_insn_reservation "gr6_immediate" 1
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "imm_reg"))
  "gr6_issue + gr6_mov")

(define_insn_reservation "gr6_alu" 1
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "arith,arith2,logic,cmp"))
  "gr6_issue + (gr6_alu1 | gr6_alu2)")

(define_insn_reservation "gr6_branch" 1
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "abs_branch,branch,call,ret,rfi"))
  "gr6_issue + gr6_bru")

(define_insn_reservation "gr6_block_move" 16
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "bmi"))
  "gr6_single_issue*16")

(define_insn_reservation "gr6_cpu_other" 1
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "dsi,nop"))
  "gr6_issue")

(define_insn_reservation "gr6_write_mem" 1
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "reg_mem"))
  "gr6_issue + gr6_mem_wr")

(define_insn_reservation "gr6_read_mem" 6
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "mem_reg"))
  "gr6_issue + gr6_mem_rd, nothing*5")

;; EAM instructions.

(define_insn_reservation "gr6_write_eam" 2
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "reg_eam"))
  "gr6_issue + gr6_mem_eam, nothing")

(define_reservation "gr6_issue_eam" "gr6_issue + gr6_mem_eam + gr6_eam")

(define_insn_reservation "gr6_read_eam" 2
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "eam_reg"))
  "gr6_issue_eam, nothing")

(define_insn_reservation "gr6_shiftdi" 2
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "shiftdi"))
  "gr6_issue_eam, gr6_eam")

(define_insn_reservation "gr6_mul" 3
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "mul"))
  "gr6_issue_eam, gr6_eam*2")

(define_insn_reservation "gr6_div" 34
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "div"))
  "gr6_issue_eam, gr6_eam*33")

(define_insn_reservation "gr6_divd" 66
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "divd"))
  "gr6_issue_eam, gr6_eam*65")

;; FPU instructions.

(define_insn_reservation "gr6_read_fp" 2
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "fp_reg"))
  "gr6_issue + gr6_mem_eam, nothing")

(define_insn_reservation "gr6_cmp_fp" 1
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "fcmp"))
  "gr6_issue + gr6_fpcu")

(define_insn_reservation "gr6_fp_1cycle" 1
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "fmove,ftoi,itof"))
  "gr6_issue + gr6_fpu1")

(define_insn_reservation "gr6_fp_3cycle" 3
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "fp"))
  "gr6_issue + gr6_fpu2, nothing*2")

(define_insn_reservation "gr6_fp_17cycle" 17
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "fdiv,fsqrt"))
  "gr6_issue + gr6_fpu3, gr6_fpu3*14, nothing*2")

(define_insn_reservation "gr6_write_fp" 1
  (and (eq_attr "cpu" "gr6")
       (eq_attr "type" "reg_fp"))
  "gr6_issue + gr6_fpu4")