annotate gcc/config/rs6000/htm.md @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ;; Hardware Transactional Memory (HTM) patterns.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 ;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 ;; Contributed by Peter Bergner <bergner@vnet.ibm.com>.
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 it
kono
parents:
diff changeset
8 ;; under the terms of the GNU General Public License as published
kono
parents:
diff changeset
9 ;; by the Free Software Foundation; either version 3, or (at your
kono
parents:
diff changeset
10 ;; option) any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
kono
parents:
diff changeset
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
kono
parents:
diff changeset
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
kono
parents:
diff changeset
15 ;; 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 (define_constants
kono
parents:
diff changeset
22 [(TFHAR_SPR 128)
kono
parents:
diff changeset
23 (TFIAR_SPR 129)
kono
parents:
diff changeset
24 (TEXASR_SPR 130)
kono
parents:
diff changeset
25 (TEXASRU_SPR 131)
kono
parents:
diff changeset
26 (MAX_HTM_OPERANDS 4)
kono
parents:
diff changeset
27 ])
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 ;;
kono
parents:
diff changeset
30 ;; UNSPEC usage
kono
parents:
diff changeset
31 ;;
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 (define_c_enum "unspec"
kono
parents:
diff changeset
34 [UNSPEC_HTM_FENCE
kono
parents:
diff changeset
35 ])
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 ;;
kono
parents:
diff changeset
38 ;; UNSPEC_VOLATILE usage
kono
parents:
diff changeset
39 ;;
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 (define_c_enum "unspecv"
kono
parents:
diff changeset
42 [UNSPECV_HTM_TABORT
kono
parents:
diff changeset
43 UNSPECV_HTM_TABORTXC
kono
parents:
diff changeset
44 UNSPECV_HTM_TABORTXCI
kono
parents:
diff changeset
45 UNSPECV_HTM_TBEGIN
kono
parents:
diff changeset
46 UNSPECV_HTM_TCHECK
kono
parents:
diff changeset
47 UNSPECV_HTM_TEND
kono
parents:
diff changeset
48 UNSPECV_HTM_TRECHKPT
kono
parents:
diff changeset
49 UNSPECV_HTM_TRECLAIM
kono
parents:
diff changeset
50 UNSPECV_HTM_TSR
kono
parents:
diff changeset
51 UNSPECV_HTM_TTEST
kono
parents:
diff changeset
52 UNSPECV_HTM_MFSPR
kono
parents:
diff changeset
53 UNSPECV_HTM_MTSPR
kono
parents:
diff changeset
54 ])
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 (define_expand "tabort"
kono
parents:
diff changeset
57 [(parallel
kono
parents:
diff changeset
58 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
59 (unspec_volatile:CC [(match_operand:SI 0 "base_reg_operand" "b")]
kono
parents:
diff changeset
60 UNSPECV_HTM_TABORT))
kono
parents:
diff changeset
61 (set (match_dup 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
62 "TARGET_HTM"
kono
parents:
diff changeset
63 {
kono
parents:
diff changeset
64 operands[2] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
65 MEM_VOLATILE_P (operands[2]) = 1;
kono
parents:
diff changeset
66 })
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 (define_insn "*tabort"
kono
parents:
diff changeset
69 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
70 (unspec_volatile:CC [(match_operand:SI 0 "base_reg_operand" "b")]
kono
parents:
diff changeset
71 UNSPECV_HTM_TABORT))
kono
parents:
diff changeset
72 (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
73 "TARGET_HTM"
kono
parents:
diff changeset
74 "tabort. %0"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
75 [(set_attr "type" "htmsimple")])
111
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 (define_expand "tabort<wd>c"
kono
parents:
diff changeset
78 [(parallel
kono
parents:
diff changeset
79 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
kono
parents:
diff changeset
80 (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
kono
parents:
diff changeset
81 (match_operand:GPR 1 "gpc_reg_operand" "r")
kono
parents:
diff changeset
82 (match_operand:GPR 2 "gpc_reg_operand" "r")]
kono
parents:
diff changeset
83 UNSPECV_HTM_TABORTXC))
kono
parents:
diff changeset
84 (set (match_dup 4) (unspec:BLK [(match_dup 4)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
85 "TARGET_HTM"
kono
parents:
diff changeset
86 {
kono
parents:
diff changeset
87 operands[4] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
88 MEM_VOLATILE_P (operands[4]) = 1;
kono
parents:
diff changeset
89 })
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 (define_insn "*tabort<wd>c"
kono
parents:
diff changeset
92 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
kono
parents:
diff changeset
93 (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
kono
parents:
diff changeset
94 (match_operand:GPR 1 "gpc_reg_operand" "r")
kono
parents:
diff changeset
95 (match_operand:GPR 2 "gpc_reg_operand" "r")]
kono
parents:
diff changeset
96 UNSPECV_HTM_TABORTXC))
kono
parents:
diff changeset
97 (set (match_operand:BLK 4) (unspec:BLK [(match_dup 4)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
98 "TARGET_HTM"
kono
parents:
diff changeset
99 "tabort<wd>c. %0,%1,%2"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
100 [(set_attr "type" "htmsimple")])
111
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 (define_expand "tabort<wd>ci"
kono
parents:
diff changeset
103 [(parallel
kono
parents:
diff changeset
104 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
kono
parents:
diff changeset
105 (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
kono
parents:
diff changeset
106 (match_operand:GPR 1 "gpc_reg_operand" "r")
kono
parents:
diff changeset
107 (match_operand 2 "s5bit_cint_operand" "n")]
kono
parents:
diff changeset
108 UNSPECV_HTM_TABORTXCI))
kono
parents:
diff changeset
109 (set (match_dup 4) (unspec:BLK [(match_dup 4)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
110 "TARGET_HTM"
kono
parents:
diff changeset
111 {
kono
parents:
diff changeset
112 operands[4] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
113 MEM_VOLATILE_P (operands[4]) = 1;
kono
parents:
diff changeset
114 })
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 (define_insn "*tabort<wd>ci"
kono
parents:
diff changeset
117 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
kono
parents:
diff changeset
118 (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
kono
parents:
diff changeset
119 (match_operand:GPR 1 "gpc_reg_operand" "r")
kono
parents:
diff changeset
120 (match_operand 2 "s5bit_cint_operand" "n")]
kono
parents:
diff changeset
121 UNSPECV_HTM_TABORTXCI))
kono
parents:
diff changeset
122 (set (match_operand:BLK 4) (unspec:BLK [(match_dup 4)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
123 "TARGET_HTM"
kono
parents:
diff changeset
124 "tabort<wd>ci. %0,%1,%2"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
125 [(set_attr "type" "htmsimple")])
111
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 (define_expand "tbegin"
kono
parents:
diff changeset
128 [(parallel
kono
parents:
diff changeset
129 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
130 (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
kono
parents:
diff changeset
131 UNSPECV_HTM_TBEGIN))
kono
parents:
diff changeset
132 (set (match_dup 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
133 "TARGET_HTM"
kono
parents:
diff changeset
134 {
kono
parents:
diff changeset
135 operands[2] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
136 MEM_VOLATILE_P (operands[2]) = 1;
kono
parents:
diff changeset
137 })
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 (define_insn "*tbegin"
kono
parents:
diff changeset
140 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
141 (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
kono
parents:
diff changeset
142 UNSPECV_HTM_TBEGIN))
kono
parents:
diff changeset
143 (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
144 "TARGET_HTM"
kono
parents:
diff changeset
145 "tbegin. %0"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
146 [(set_attr "type" "htm")])
111
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 (define_expand "tcheck"
kono
parents:
diff changeset
149 [(parallel
kono
parents:
diff changeset
150 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
kono
parents:
diff changeset
151 (unspec_volatile:CC [(const_int 0)] UNSPECV_HTM_TCHECK))
kono
parents:
diff changeset
152 (set (match_dup 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
153 "TARGET_HTM"
kono
parents:
diff changeset
154 {
kono
parents:
diff changeset
155 operands[1] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
156 MEM_VOLATILE_P (operands[1]) = 1;
kono
parents:
diff changeset
157 })
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 (define_insn "*tcheck"
kono
parents:
diff changeset
160 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
kono
parents:
diff changeset
161 (unspec_volatile:CC [(const_int 0)] UNSPECV_HTM_TCHECK))
kono
parents:
diff changeset
162 (set (match_operand:BLK 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
163 "TARGET_HTM"
kono
parents:
diff changeset
164 "tcheck %0"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
165 [(set_attr "type" "htm")])
111
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 (define_expand "tend"
kono
parents:
diff changeset
168 [(parallel
kono
parents:
diff changeset
169 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
170 (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
kono
parents:
diff changeset
171 UNSPECV_HTM_TEND))
kono
parents:
diff changeset
172 (set (match_dup 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
173 "TARGET_HTM"
kono
parents:
diff changeset
174 {
kono
parents:
diff changeset
175 operands[2] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
176 MEM_VOLATILE_P (operands[2]) = 1;
kono
parents:
diff changeset
177 })
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 (define_insn "*tend"
kono
parents:
diff changeset
180 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
181 (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
kono
parents:
diff changeset
182 UNSPECV_HTM_TEND))
kono
parents:
diff changeset
183 (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
184 "TARGET_HTM"
kono
parents:
diff changeset
185 "tend. %0"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
186 [(set_attr "type" "htm")])
111
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 (define_expand "trechkpt"
kono
parents:
diff changeset
189 [(parallel
kono
parents:
diff changeset
190 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
kono
parents:
diff changeset
191 (unspec_volatile:CC [(const_int 0)] UNSPECV_HTM_TRECHKPT))
kono
parents:
diff changeset
192 (set (match_dup 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
193 "TARGET_HTM"
kono
parents:
diff changeset
194 {
kono
parents:
diff changeset
195 operands[1] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
196 MEM_VOLATILE_P (operands[1]) = 1;
kono
parents:
diff changeset
197 })
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 (define_insn "*trechkpt"
kono
parents:
diff changeset
200 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
kono
parents:
diff changeset
201 (unspec_volatile:CC [(const_int 0)] UNSPECV_HTM_TRECHKPT))
kono
parents:
diff changeset
202 (set (match_operand:BLK 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
203 "TARGET_HTM"
kono
parents:
diff changeset
204 "trechkpt."
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
205 [(set_attr "type" "htmsimple")])
111
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 (define_expand "treclaim"
kono
parents:
diff changeset
208 [(parallel
kono
parents:
diff changeset
209 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
210 (unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")]
kono
parents:
diff changeset
211 UNSPECV_HTM_TRECLAIM))
kono
parents:
diff changeset
212 (set (match_dup 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
213 "TARGET_HTM"
kono
parents:
diff changeset
214 {
kono
parents:
diff changeset
215 operands[2] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
216 MEM_VOLATILE_P (operands[2]) = 1;
kono
parents:
diff changeset
217 })
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 (define_insn "*treclaim"
kono
parents:
diff changeset
220 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
221 (unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")]
kono
parents:
diff changeset
222 UNSPECV_HTM_TRECLAIM))
kono
parents:
diff changeset
223 (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
224 "TARGET_HTM"
kono
parents:
diff changeset
225 "treclaim. %0"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
226 [(set_attr "type" "htmsimple")])
111
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 (define_expand "tsr"
kono
parents:
diff changeset
229 [(parallel
kono
parents:
diff changeset
230 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
231 (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
kono
parents:
diff changeset
232 UNSPECV_HTM_TSR))
kono
parents:
diff changeset
233 (set (match_dup 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
234 "TARGET_HTM"
kono
parents:
diff changeset
235 {
kono
parents:
diff changeset
236 operands[2] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
237 MEM_VOLATILE_P (operands[2]) = 1;
kono
parents:
diff changeset
238 })
kono
parents:
diff changeset
239
kono
parents:
diff changeset
240 (define_insn "*tsr"
kono
parents:
diff changeset
241 [(set (match_operand:CC 1 "cc_reg_operand" "=x")
kono
parents:
diff changeset
242 (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
kono
parents:
diff changeset
243 UNSPECV_HTM_TSR))
kono
parents:
diff changeset
244 (set (match_operand:BLK 2) (unspec:BLK [(match_dup 2)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
245 "TARGET_HTM"
kono
parents:
diff changeset
246 "tsr. %0"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
247 [(set_attr "type" "htmsimple")])
111
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 (define_expand "ttest"
kono
parents:
diff changeset
250 [(parallel
kono
parents:
diff changeset
251 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
kono
parents:
diff changeset
252 (unspec_volatile:CC [(const_int 0)] UNSPECV_HTM_TTEST))
kono
parents:
diff changeset
253 (set (match_dup 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))])]
kono
parents:
diff changeset
254 "TARGET_HTM"
kono
parents:
diff changeset
255 {
kono
parents:
diff changeset
256 operands[1] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
kono
parents:
diff changeset
257 MEM_VOLATILE_P (operands[1]) = 1;
kono
parents:
diff changeset
258 })
kono
parents:
diff changeset
259
kono
parents:
diff changeset
260 (define_insn "*ttest"
kono
parents:
diff changeset
261 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
kono
parents:
diff changeset
262 (unspec_volatile:CC [(const_int 0)] UNSPECV_HTM_TTEST))
kono
parents:
diff changeset
263 (set (match_operand:BLK 1) (unspec:BLK [(match_dup 1)] UNSPEC_HTM_FENCE))]
kono
parents:
diff changeset
264 "TARGET_HTM"
kono
parents:
diff changeset
265 "tabortwci. 0,1,0"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
266 [(set_attr "type" "htmsimple")])
111
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 (define_insn "htm_mfspr_<mode>"
kono
parents:
diff changeset
269 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
kono
parents:
diff changeset
270 (unspec_volatile:GPR [(match_operand 1 "u10bit_cint_operand" "n")
kono
parents:
diff changeset
271 (match_operand:GPR 2 "htm_spr_reg_operand" "")]
kono
parents:
diff changeset
272 UNSPECV_HTM_MFSPR))]
kono
parents:
diff changeset
273 "TARGET_HTM"
kono
parents:
diff changeset
274 "mfspr %0,%1";
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
275 [(set_attr "type" "htm")])
111
kono
parents:
diff changeset
276
kono
parents:
diff changeset
277 (define_insn "htm_mtspr_<mode>"
kono
parents:
diff changeset
278 [(set (match_operand:GPR 2 "htm_spr_reg_operand" "")
kono
parents:
diff changeset
279 (unspec_volatile:GPR [(match_operand:GPR 0 "gpc_reg_operand" "r")
kono
parents:
diff changeset
280 (match_operand 1 "u10bit_cint_operand" "n")]
kono
parents:
diff changeset
281 UNSPECV_HTM_MTSPR))]
kono
parents:
diff changeset
282 "TARGET_HTM"
kono
parents:
diff changeset
283 "mtspr %1,%0";
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
284 [(set_attr "type" "htm")])