1;; Marvell WMMX2 pipeline description
2;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
3;; Written by Marvell, Inc.
4
5;; This file is part of GCC.
6
7;; GCC is free software; you can redistribute it and/or modify it
8;; under the terms of the GNU General Public License as published
9;; by the Free Software Foundation; either version 3, or (at your
10;; option) any later version.
11
12;; GCC is distributed in the hope that it will be useful, but WITHOUT
13;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15;; License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GCC; see the file COPYING3.  If not see
19;; <http://www.gnu.org/licenses/>.
20
21
22(define_automaton "marvell_f_iwmmxt")
23
24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25;; Pipelines
26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27
28;; This is a 7-stage pipelines:
29;;
30;;    MD | MI | ME1 | ME2 | ME3 | ME4 | MW
31;;
32;; There are various bypasses modelled to a greater or lesser extent.
33;;
34;; Latencies in this file correspond to the number of cycles after
35;; the issue stage that it takes for the result of the instruction to
36;; be computed, or for its side-effects to occur.
37
38(define_cpu_unit "mf_iwmmxt_MD" "marvell_f_iwmmxt")
39(define_cpu_unit "mf_iwmmxt_MI" "marvell_f_iwmmxt")
40(define_cpu_unit "mf_iwmmxt_ME1" "marvell_f_iwmmxt")
41(define_cpu_unit "mf_iwmmxt_ME2" "marvell_f_iwmmxt")
42(define_cpu_unit "mf_iwmmxt_ME3" "marvell_f_iwmmxt")
43(define_cpu_unit "mf_iwmmxt_ME4" "marvell_f_iwmmxt")
44(define_cpu_unit "mf_iwmmxt_MW" "marvell_f_iwmmxt")
45
46(define_reservation "mf_iwmmxt_ME"
47      "mf_iwmmxt_ME1,mf_iwmmxt_ME2,mf_iwmmxt_ME3,mf_iwmmxt_ME4"
48)
49
50(define_reservation "mf_iwmmxt_pipeline"
51      "mf_iwmmxt_MD, mf_iwmmxt_MI, mf_iwmmxt_ME, mf_iwmmxt_MW"
52)
53
54;; An attribute to indicate whether our reservations are applicable.
55(define_attr "marvell_f_iwmmxt" "yes,no"
56  (const (if_then_else (symbol_ref "arm_arch_iwmmxt")
57                       (const_string "yes") (const_string "no"))))
58
59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
60;; instruction classes
61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62
63;; An attribute appended to instructions for classification
64
65(define_attr "wmmxt_shift" "yes,no"
66  (if_then_else (eq_attr "wtype" "wror, wsll, wsra, wsrl")
67		(const_string "yes") (const_string "no"))
68)
69
70(define_attr "wmmxt_pack" "yes,no"
71  (if_then_else (eq_attr "wtype" "waligni, walignr, wmerge, wpack, wshufh, wunpckeh, wunpckih, wunpckel, wunpckil")
72		(const_string "yes") (const_string "no"))
73)
74
75(define_attr "wmmxt_mult_c1" "yes,no"
76  (if_then_else (eq_attr "wtype" "wmac, wmadd, wmiaxy, wmiawxy, wmulw, wqmiaxy, wqmulwm")
77		(const_string "yes") (const_string "no"))
78)
79
80(define_attr "wmmxt_mult_c2" "yes,no"
81  (if_then_else (eq_attr "wtype" "wmul, wqmulm")
82		(const_string "yes") (const_string "no"))
83)
84
85(define_attr "wmmxt_alu_c1" "yes,no"
86  (if_then_else (eq_attr "wtype" "wabs, wabsdiff, wand, wandn, wmov, wor, wxor")
87	        (const_string "yes") (const_string "no"))
88)
89
90(define_attr "wmmxt_alu_c2" "yes,no"
91  (if_then_else (eq_attr "wtype" "wacc, wadd, waddsubhx, wavg2, wavg4, wcmpeq, wcmpgt, wmax, wmin, wsub, waddbhus, wsubaddhx")
92		(const_string "yes") (const_string "no"))
93)
94
95(define_attr "wmmxt_alu_c3" "yes,no"
96  (if_then_else (eq_attr "wtype" "wsad")
97	        (const_string "yes") (const_string "no"))
98)
99
100(define_attr "wmmxt_transfer_c1" "yes,no"
101  (if_then_else (eq_attr "wtype" "tbcst, tinsr, tmcr, tmcrr")
102                (const_string "yes") (const_string "no"))
103)
104
105(define_attr "wmmxt_transfer_c2" "yes,no"
106  (if_then_else (eq_attr "wtype" "textrm, tmovmsk, tmrc, tmrrc")
107	        (const_string "yes") (const_string "no"))
108)
109
110(define_attr "wmmxt_transfer_c3" "yes,no"
111  (if_then_else (eq_attr "wtype" "tmia, tmiaph, tmiaxy")
112	        (const_string "yes") (const_string "no"))
113)
114
115;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
116;; Main description
117;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
118
119(define_insn_reservation "marvell_f_iwmmxt_alu_c1" 1
120  (and (eq_attr "marvell_f_iwmmxt" "yes")
121       (eq_attr "wmmxt_alu_c1" "yes"))
122  "mf_iwmmxt_pipeline")
123
124(define_insn_reservation "marvell_f_iwmmxt_pack" 1
125  (and (eq_attr "marvell_f_iwmmxt" "yes")
126       (eq_attr "wmmxt_pack" "yes"))
127  "mf_iwmmxt_pipeline")
128
129(define_insn_reservation "marvell_f_iwmmxt_shift" 1
130  (and (eq_attr "marvell_f_iwmmxt" "yes")
131       (eq_attr "wmmxt_shift" "yes"))
132  "mf_iwmmxt_pipeline")
133
134(define_insn_reservation "marvell_f_iwmmxt_transfer_c1" 1
135  (and (eq_attr "marvell_f_iwmmxt" "yes")
136       (eq_attr "wmmxt_transfer_c1" "yes"))
137  "mf_iwmmxt_pipeline")
138
139(define_insn_reservation "marvell_f_iwmmxt_transfer_c2" 5
140  (and (eq_attr "marvell_f_iwmmxt" "yes")
141       (eq_attr "wmmxt_transfer_c2" "yes"))
142  "mf_iwmmxt_pipeline")
143
144(define_insn_reservation "marvell_f_iwmmxt_alu_c2" 2
145  (and (eq_attr "marvell_f_iwmmxt" "yes")
146       (eq_attr "wmmxt_alu_c2" "yes"))
147  "mf_iwmmxt_pipeline")
148
149(define_insn_reservation "marvell_f_iwmmxt_alu_c3" 3
150  (and (eq_attr "marvell_f_iwmmxt" "yes")
151       (eq_attr "wmmxt_alu_c3" "yes"))
152  "mf_iwmmxt_pipeline")
153
154(define_insn_reservation "marvell_f_iwmmxt_transfer_c3" 4
155  (and (eq_attr "marvell_f_iwmmxt" "yes")
156       (eq_attr "wmmxt_transfer_c3" "yes"))
157  "mf_iwmmxt_pipeline")
158
159(define_insn_reservation "marvell_f_iwmmxt_mult_c1" 4
160  (and (eq_attr "marvell_f_iwmmxt" "yes")
161       (eq_attr "wmmxt_mult_c1" "yes"))
162  "mf_iwmmxt_pipeline")
163
164;There is a forwarding path from ME3 stage
165(define_insn_reservation "marvell_f_iwmmxt_mult_c2" 3
166  (and (eq_attr "marvell_f_iwmmxt" "yes")
167       (eq_attr "wmmxt_mult_c2" "yes"))
168  "mf_iwmmxt_pipeline")
169
170(define_insn_reservation "marvell_f_iwmmxt_wstr" 0
171  (and (eq_attr "marvell_f_iwmmxt" "yes")
172       (eq_attr "wtype" "wstr"))
173  "mf_iwmmxt_pipeline")
174
175;There is a forwarding path from MW stage
176(define_insn_reservation "marvell_f_iwmmxt_wldr" 5
177  (and (eq_attr "marvell_f_iwmmxt" "yes")
178       (eq_attr "wtype" "wldr"))
179  "mf_iwmmxt_pipeline")
180