annotate gcc/config/epiphany/epiphany-sched.md @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ;; DFA scheduling description for EPIPHANY
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 ;; Copyright (C) 2004-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 ;; Contributed by Embecosm on behalf of Adapteva, Inc.
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 ;; This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 ;; GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
8 ;; it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
9 ;; the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
10 ;; any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 ;; GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
15 ;; GNU General Public License for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 ;; along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 ;; <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 ;; Two automata are defined to reduce number of states
kono
parents:
diff changeset
22 ;; which a single large automaton will have. (Factoring)
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 (define_automaton "inst_pipeline,fpu_pipe")
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 ;; This unit is basically the decode unit of the processor.
kono
parents:
diff changeset
27 ;; Since epiphany is a dual issue machine, it is as if there are two
kono
parents:
diff changeset
28 ;; units so that any insn can be processed by either one
kono
parents:
diff changeset
29 ;; of the decoding unit.
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 (define_cpu_unit "pipe_01,pipe_02" "inst_pipeline")
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 ;; The fixed point arithmetic unit.
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 (define_cpu_unit "int" "inst_pipeline")
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 ;; The floating point unit.
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 (define_cpu_unit "F0" "fpu_pipe")
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 ;; ----------------------------------------------------
kono
parents:
diff changeset
42 ;; This reservation is to simplify the dual issue description.
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 (define_reservation "issue" "pipe_01|pipe_02")
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 ;; This is to express instructions that cannot be paired.
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 (define_reservation "d_lock" "pipe_01+pipe_02")
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 ;; We don't model all pipeline stages; we model the issue stage
kono
parents:
diff changeset
51 ;; inasmuch as we allow only two instructions to issue simultaneously,
kono
parents:
diff changeset
52 ;; and flow instructions prevent any simultaneous issue of another instruction.
kono
parents:
diff changeset
53 ;; (This uses pipe_01 and pipe_02).
kono
parents:
diff changeset
54 ;; Double issue of 'other' insns is prevented by using the int unit in the
kono
parents:
diff changeset
55 ;; E1 stage.
kono
parents:
diff changeset
56 ;; Double issue of float instructions is prevented by using F0 in the E1 stage.
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 (define_insn_reservation "simple_arith" 2
kono
parents:
diff changeset
59 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
60 (eq_attr "type" "move,cmove,compare,shift,misc,mul")
kono
parents:
diff changeset
61 (eq_attr "length" "4"))
kono
parents:
diff changeset
62 "issue,int")
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 ; anything but fp / fp_int / v2fp has a bypass
kono
parents:
diff changeset
65 (define_bypass 1 "simple_arith" "simple_arith,simple_arith_2,simple_arith_4,load,store,branch,call,flow")
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 (define_insn_reservation "simple_arith_2" 2
kono
parents:
diff changeset
68 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
69 (eq_attr "type" "move,cmove,compare,shift,misc,mul")
kono
parents:
diff changeset
70 (eq_attr "length" "8"))
kono
parents:
diff changeset
71 "issue,issue+int,int")
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 (define_insn_reservation "simple_arith_4" 4
kono
parents:
diff changeset
74 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
75 (eq_attr "type" "move,compare,shift,misc,mul")
kono
parents:
diff changeset
76 (eq_attr "length" "12,16,20,24"))
kono
parents:
diff changeset
77 "issue,issue+int,issue+int,issue+int,int")
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 ;; Loads have a latency of two.
kono
parents:
diff changeset
80 ;; Note that we fix up the latency of post_modify in epiphany.c:epiphany_adjust_cost
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 (define_insn_reservation "load" 3
kono
parents:
diff changeset
83 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
84 (eq_attr "type" "load"))
kono
parents:
diff changeset
85 "issue,int")
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 ; anything but fp / fp_int / v2fp has a bypass
kono
parents:
diff changeset
88 (define_bypass 2 "load" "simple_arith,simple_arith_2,simple_arith_4,load,store,branch,call,flow")
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 (define_insn_reservation "store" 1
kono
parents:
diff changeset
91 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
92 (eq_attr "type" "store"))
kono
parents:
diff changeset
93 "issue,int")
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 ;; Branch
kono
parents:
diff changeset
96 ;; Latency when taken: 3
kono
parents:
diff changeset
97 ;; Issue Rate: 1
kono
parents:
diff changeset
98 ;; The latency is 1 when the branch is not taken.
kono
parents:
diff changeset
99 ;; We can't really do much with the latency, even if we could express it,
kono
parents:
diff changeset
100 ;; but the pairing restrictions are useful to take into account.
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 (define_insn_reservation "branch" 1
kono
parents:
diff changeset
103 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
104 (eq_attr "type" "branch,uncond_branch"))
kono
parents:
diff changeset
105 "d_lock")
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 ;; calls introduce a longisch delay that is likely to flush the pipelines
kono
parents:
diff changeset
108 ;; of the caller's instructions. Both the call instruction itself and
kono
parents:
diff changeset
109 ;; the rts at the end of the call / sfunc incurs a three cycle penalty,
kono
parents:
diff changeset
110 ;; thus also isolating the scheduling of caller and callee.
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 (define_insn_reservation "call" 8
kono
parents:
diff changeset
113 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
114 (eq_attr "type" "call,sfunc,fp_sfunc"))
kono
parents:
diff changeset
115 "d_lock*8")
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 (define_insn_reservation "flow" 1
kono
parents:
diff changeset
118 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
119 (eq_attr "type" "flow"))
kono
parents:
diff changeset
120 "d_lock")
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 (define_insn_reservation "fp_arith" 5
kono
parents:
diff changeset
123 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
124 (eq_attr "type" "fp,fp_int"))
kono
parents:
diff changeset
125 "issue,F0")
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 (define_bypass 4 "fp_arith" "store")
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 ; There are two main consumers for v2fp:
kono
parents:
diff changeset
130 ; - other v2fp operation - in that case, the latencies can dovetail to
kono
parents:
diff changeset
131 ; save one cycle of latency.
kono
parents:
diff changeset
132 ; - 64 bit store operations - we need both registers, but OTOH the latency is
kono
parents:
diff changeset
133 ; one lower to start with.
kono
parents:
diff changeset
134 ; of the bypass saving one cyles then.
kono
parents:
diff changeset
135 (define_insn_reservation "v2fp_arith" 5
kono
parents:
diff changeset
136 (and (eq_attr "pipe_model" "epiphany")
kono
parents:
diff changeset
137 (eq_attr "type" "v2fp"))
kono
parents:
diff changeset
138 "issue,issue+F0,F0")
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 ; A boolean attribute for use by peephole2 patterns that try to figure out
kono
parents:
diff changeset
141 ; if we overcommitted the FPU.
kono
parents:
diff changeset
142 ; This is notionally a numeric attribute to avoid dependency problems.
kono
parents:
diff changeset
143 (define_attr "sched_use_fpu" ""
kono
parents:
diff changeset
144 (cond [(eq_attr "type" "fp,fp_int,v2fp") (const_int 1)]
kono
parents:
diff changeset
145 (const_int 0)))