]>
Commit | Line | Data |
---|---|---|
1fd4e8c1 RK |
1 | ;;- Machine description for IBM RISC System 6000 (POWER) for GNU C compiler |
2 | ;; Copyright (C) 1990, 1991 Free Software Foundation, Inc. | |
3 | ;; Contributed by Richard Kenner (kenner@nyu.edu) | |
4 | ||
5 | ;; This file is part of GNU CC. | |
6 | ||
7 | ;; GNU CC is free software; you can redistribute it and/or modify | |
8 | ;; it under the terms of the GNU General Public License as published by | |
9 | ;; the Free Software Foundation; either version 2, or (at your option) | |
10 | ;; any later version. | |
11 | ||
12 | ;; GNU CC is distributed in the hope that it will be useful, | |
13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;; GNU General Public License for more details. | |
16 | ||
17 | ;; You should have received a copy of the GNU General Public License | |
18 | ;; along with GNU CC; see the file COPYING. If not, write to | |
19 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | ||
21 | ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al. | |
22 | \f | |
23 | ;; Define an insn type attribute. This is used in function unit delay | |
24 | ;; computations. | |
5c23c401 | 25 | (define_attr "type" "load,integer,fp,compare,delayed_compare,fpcompare,mtlr" |
1fd4e8c1 RK |
26 | (const_string "integer")) |
27 | ||
28 | ;; Memory delivers its result in two cycles. | |
29 | (define_function_unit "memory" 1 0 (eq_attr "type" "load") 2 0) | |
30 | ||
31 | ;; We consider floating-point insns to deliver their result in two cycles | |
32 | ;; to try to intersperse integer and FP operations. | |
33 | (define_function_unit "fp" 1 0 (eq_attr "type" "fp,fpcompare") 2 0) | |
34 | ||
35 | ;; Most integer comparisons are ready in four cycles (a stall of three). | |
36 | (define_function_unit "compare" 1 0 (eq_attr "type" "compare") 4 0) | |
37 | ||
38 | ;; Some integer comparisons aren't ready for five cycles (a stall of four). | |
39 | (define_function_unit "compare" 1 0 (eq_attr "type" "delayed_compare") 5 0) | |
40 | ||
41 | ;; Floating-point comparisons take eight cycles. | |
42 | (define_function_unit "compare" 1 0 (eq_attr "type" "fpcompare") 8 0) | |
5c23c401 RK |
43 | |
44 | ;; Branches on LR cannot be done until five cycles after LR is set. | |
45 | (define_function_unit "branch" 1 0 (eq_attr "type" "mtlr") 5 0) | |
1fd4e8c1 RK |
46 | \f |
47 | ;; Start with fixed-point load and store insns. Here we put only the more | |
48 | ;; complex forms. Basic data transfer is done later. | |
49 | ||
50 | (define_expand "zero_extendqisi2" | |
cd2b37d9 RK |
51 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
52 | (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))] | |
1fd4e8c1 RK |
53 | "" |
54 | "") | |
55 | ||
56 | (define_insn "" | |
cd2b37d9 | 57 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
58 | (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))] |
59 | "" | |
60 | "@ | |
61 | lbz%U1%X1 %0,%1 | |
62 | rlinm %0,%1,0,24,31" | |
63 | [(set_attr "type" "load,*")]) | |
64 | ||
65 | (define_insn "" | |
66 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 | 67 | (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
68 | (const_int 0))) |
69 | (clobber (match_scratch:SI 2 "=r"))] | |
70 | "" | |
71 | "andil. %2,%1,255" | |
72 | [(set_attr "type" "compare")]) | |
73 | ||
74 | (define_insn "" | |
75 | [(set (match_operand:CC 2 "cc_reg_operand" "=x") | |
cd2b37d9 | 76 | (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 | 77 | (const_int 0))) |
cd2b37d9 | 78 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
79 | (zero_extend:SI (match_dup 1)))] |
80 | "" | |
81 | "andil. %0,%1,255" | |
82 | [(set_attr "type" "compare")]) | |
83 | ||
84 | (define_expand "zero_extendqihi2" | |
cd2b37d9 RK |
85 | [(set (match_operand:HI 0 "gpc_reg_operand" "") |
86 | (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))] | |
1fd4e8c1 RK |
87 | "" |
88 | "") | |
89 | ||
90 | (define_insn "" | |
cd2b37d9 | 91 | [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
92 | (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))] |
93 | "" | |
94 | "@ | |
95 | lbz%U1%X1 %0,%1 | |
96 | rlinm %0,%1,0,24,31" | |
97 | [(set_attr "type" "load,*")]) | |
98 | ||
99 | (define_expand "zero_extendhisi2" | |
5f243543 | 100 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
cd2b37d9 | 101 | (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))] |
1fd4e8c1 RK |
102 | "" |
103 | "") | |
104 | ||
105 | (define_insn "" | |
cd2b37d9 | 106 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
107 | (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))] |
108 | "" | |
109 | "@ | |
110 | lhz%U1%X1 %0,%1 | |
111 | rlinm %0,%1,0,16,31" | |
112 | [(set_attr "type" "load,*")]) | |
113 | ||
114 | (define_insn "" | |
115 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 | 116 | (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
117 | (const_int 0))) |
118 | (clobber (match_scratch:SI 2 "=r"))] | |
119 | "" | |
120 | "andil. %2,%1,65535" | |
121 | [(set_attr "type" "compare")]) | |
122 | ||
123 | (define_insn "" | |
124 | [(set (match_operand:CC 2 "cc_reg_operand" "=x") | |
cd2b37d9 | 125 | (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 | 126 | (const_int 0))) |
cd2b37d9 | 127 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
128 | (zero_extend:SI (match_dup 1)))] |
129 | "" | |
130 | "andil. %0,%1,65535" | |
131 | [(set_attr "type" "compare")]) | |
132 | ||
133 | (define_expand "extendhisi2" | |
cd2b37d9 RK |
134 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
135 | (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))] | |
1fd4e8c1 RK |
136 | "" |
137 | "") | |
138 | ||
139 | (define_insn "" | |
cd2b37d9 | 140 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
141 | (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))] |
142 | "" | |
143 | "@ | |
144 | lha%U1%X1 %0,%1 | |
145 | exts %0,%1" | |
146 | [(set_attr "type" "load,*")]) | |
147 | ||
148 | (define_insn "" | |
149 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 | 150 | (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
151 | (const_int 0))) |
152 | (clobber (match_scratch:SI 2 "=r"))] | |
153 | "" | |
154 | "exts. %2,%1" | |
155 | [(set_attr "type" "compare")]) | |
156 | ||
157 | (define_insn "" | |
158 | [(set (match_operand:CC 2 "cc_reg_operand" "=x") | |
cd2b37d9 | 159 | (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 | 160 | (const_int 0))) |
cd2b37d9 | 161 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
162 | (sign_extend:SI (match_dup 1)))] |
163 | "" | |
164 | "exts. %0,%1" | |
165 | [(set_attr "type" "compare")]) | |
166 | \f | |
167 | ;; Fixed-point arithmetic insns. | |
f357808b | 168 | (define_insn "addsi3" |
cd2b37d9 RK |
169 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
170 | (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b") | |
1fd4e8c1 RK |
171 | (match_operand:SI 2 "add_operand" "rI,J")))] |
172 | "" | |
173 | "@ | |
174 | a%I2 %0,%1,%2 | |
175 | cau %0,%1,%u2") | |
176 | ||
177 | (define_insn "" | |
178 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 | 179 | (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
180 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
181 | (const_int 0))) | |
182 | (clobber (match_scratch:SI 3 "=r"))] | |
183 | "" | |
184 | "a%I2. %3,%1,%2" | |
185 | [(set_attr "type" "compare")]) | |
186 | ||
187 | (define_insn "" | |
188 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 | 189 | (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
190 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
191 | (const_int 0))) | |
cd2b37d9 | 192 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
193 | (plus:SI (match_dup 1) (match_dup 2)))] |
194 | "" | |
195 | "a%I2. %0,%1,%2" | |
196 | [(set_attr "type" "compare")]) | |
197 | ||
f357808b RK |
198 | ;; Split an add that we can't do in one insn into two insns, each of which |
199 | ;; does one 16-bit part. This is used by combine. Note that the low-order | |
200 | ;; add should be last in case the result gets used in an address. | |
201 | ||
202 | (define_split | |
cd2b37d9 RK |
203 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
204 | (plus:SI (match_operand:SI 1 "gpc_reg_operand" "") | |
f357808b | 205 | (match_operand:SI 2 "non_add_cint_operand" "")))] |
1fd4e8c1 | 206 | "" |
f357808b RK |
207 | [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3))) |
208 | (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))] | |
209 | " | |
1fd4e8c1 | 210 | { |
f357808b RK |
211 | int low = INTVAL (operands[2]) & 0xffff; |
212 | int high = (unsigned) INTVAL (operands[2]) >> 16; | |
1fd4e8c1 | 213 | |
f357808b RK |
214 | if (low & 0x8000) |
215 | high++, low |= 0xffff0000; | |
1fd4e8c1 | 216 | |
f357808b RK |
217 | operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16); |
218 | operands[4] = gen_rtx (CONST_INT, VOIDmode, low); | |
1fd4e8c1 RK |
219 | }") |
220 | ||
221 | (define_insn "one_cmplsi2" | |
cd2b37d9 RK |
222 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
223 | (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))] | |
1fd4e8c1 RK |
224 | "" |
225 | "sfi %0,%1,-1") | |
226 | ||
227 | (define_insn "" | |
cd2b37d9 | 228 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 | 229 | (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I") |
cd2b37d9 | 230 | (match_operand:SI 2 "gpc_reg_operand" "r,r")))] |
1fd4e8c1 RK |
231 | "" |
232 | "@ | |
233 | sf %0,%2,%1 | |
234 | sfi %0,%2,%1") | |
235 | ||
236 | (define_insn "" | |
237 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
238 | (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
239 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 RK |
240 | (const_int 0))) |
241 | (clobber (match_scratch:SI 3 "=r"))] | |
242 | "" | |
243 | "sf. %3,%2,%1" | |
244 | [(set_attr "type" "compare")]) | |
245 | ||
246 | (define_insn "" | |
247 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
248 | (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
249 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 | 250 | (const_int 0))) |
cd2b37d9 | 251 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
252 | (minus:SI (match_dup 1) (match_dup 2)))] |
253 | "" | |
254 | "sf. %0,%2,%1" | |
255 | [(set_attr "type" "compare")]) | |
256 | ||
257 | (define_expand "subsi3" | |
cd2b37d9 | 258 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
259 | (minus:SI (match_operand:SI 1 "reg_or_short_operand" "") |
260 | (match_operand:SI 2 "reg_or_cint_operand" "")))] | |
261 | "" | |
a0044fb1 RK |
262 | " |
263 | { | |
264 | if (GET_CODE (operands[2]) == CONST_INT) | |
265 | { | |
266 | emit_insn (gen_addsi3 (operands[0], operands[1], | |
267 | negate_rtx (SImode, operands[2]))); | |
268 | DONE; | |
269 | } | |
270 | }") | |
1fd4e8c1 RK |
271 | |
272 | ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i] | |
273 | ;; instruction and some auxiliary computations. Then we just have a single | |
95ac8e67 RK |
274 | ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by |
275 | ;; combine. | |
1fd4e8c1 RK |
276 | |
277 | (define_expand "sminsi3" | |
278 | [(set (match_dup 3) | |
cd2b37d9 | 279 | (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
280 | (match_operand:SI 2 "reg_or_short_operand" "")) |
281 | (const_int 0) | |
282 | (minus:SI (match_dup 2) (match_dup 1)))) | |
cd2b37d9 | 283 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
284 | (minus:SI (match_dup 2) (match_dup 3)))] |
285 | "" | |
286 | " | |
287 | { operands[3] = gen_reg_rtx (SImode); }") | |
288 | ||
95ac8e67 RK |
289 | (define_split |
290 | [(set (match_operand:SI 0 "gpc_reg_operand" "") | |
291 | (smin:SI (match_operand:SI 1 "gpc_reg_operand" "") | |
292 | (match_operand:SI 2 "reg_or_short_operand" ""))) | |
293 | (clobber (match_operand:SI 3 "gpc_reg_operand" ""))] | |
294 | "" | |
295 | [(set (match_dup 3) | |
296 | (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2)) | |
297 | (const_int 0) | |
298 | (minus:SI (match_dup 2) (match_dup 1)))) | |
299 | (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))] | |
300 | "") | |
301 | ||
1fd4e8c1 RK |
302 | (define_expand "smaxsi3" |
303 | [(set (match_dup 3) | |
cd2b37d9 | 304 | (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
305 | (match_operand:SI 2 "reg_or_short_operand" "")) |
306 | (const_int 0) | |
307 | (minus:SI (match_dup 2) (match_dup 1)))) | |
cd2b37d9 | 308 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
309 | (plus:SI (match_dup 3) (match_dup 1)))] |
310 | "" | |
311 | " | |
312 | { operands[3] = gen_reg_rtx (SImode); }") | |
313 | ||
95ac8e67 RK |
314 | (define_split |
315 | [(set (match_operand:SI 0 "gpc_reg_operand" "") | |
316 | (smax:SI (match_operand:SI 1 "gpc_reg_operand" "") | |
317 | (match_operand:SI 2 "reg_or_short_operand" ""))) | |
318 | (clobber (match_operand:SI 3 "gpc_reg_operand" ""))] | |
319 | "" | |
320 | [(set (match_dup 3) | |
321 | (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2)) | |
322 | (const_int 0) | |
323 | (minus:SI (match_dup 2) (match_dup 1)))) | |
324 | (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))] | |
325 | "") | |
326 | ||
1fd4e8c1 | 327 | (define_expand "uminsi3" |
cd2b37d9 | 328 | [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 | 329 | (const_int -2147483648))) |
cd2b37d9 | 330 | (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "") |
1fd4e8c1 RK |
331 | (const_int -2147483648))) |
332 | (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4)) | |
333 | (const_int 0) | |
334 | (minus:SI (match_dup 4) (match_dup 3)))) | |
cd2b37d9 | 335 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
336 | (minus:SI (match_dup 2) (match_dup 3)))] |
337 | "" | |
338 | " | |
339 | { operands[3] = gen_reg_rtx (SImode); operands[4] = gen_reg_rtx (SImode); }") | |
340 | ||
341 | (define_expand "umaxsi3" | |
cd2b37d9 | 342 | [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 | 343 | (const_int -2147483648))) |
cd2b37d9 | 344 | (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "") |
1fd4e8c1 RK |
345 | (const_int -2147483648))) |
346 | (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4)) | |
347 | (const_int 0) | |
348 | (minus:SI (match_dup 4) (match_dup 3)))) | |
cd2b37d9 | 349 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
350 | (plus:SI (match_dup 3) (match_dup 1)))] |
351 | "" | |
352 | " | |
353 | { operands[3] = gen_reg_rtx (SImode); operands[4] = gen_reg_rtx (SImode); }") | |
354 | ||
355 | (define_insn "" | |
cd2b37d9 RK |
356 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
357 | (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r") | |
5c23c401 | 358 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
1fd4e8c1 RK |
359 | (const_int 0) |
360 | (minus:SI (match_dup 2) (match_dup 1))))] | |
361 | "" | |
362 | "doz%I2 %0,%1,%2") | |
363 | ||
364 | (define_insn "" | |
365 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
366 | (compare:CC | |
cd2b37d9 | 367 | (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r") |
5c23c401 | 368 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
1fd4e8c1 RK |
369 | (const_int 0) |
370 | (minus:SI (match_dup 2) (match_dup 1))) | |
371 | (const_int 0))) | |
372 | (clobber (match_scratch:SI 3 "=r"))] | |
373 | "" | |
374 | "doz%I2. %3,%1,%2" | |
375 | [(set_attr "type" "delayed_compare")]) | |
376 | ||
377 | (define_insn "" | |
378 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
379 | (compare:CC | |
cd2b37d9 | 380 | (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r") |
5c23c401 | 381 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
1fd4e8c1 RK |
382 | (const_int 0) |
383 | (minus:SI (match_dup 2) (match_dup 1))) | |
384 | (const_int 0))) | |
cd2b37d9 | 385 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
386 | (if_then_else:SI (gt (match_dup 1) (match_dup 2)) |
387 | (const_int 0) | |
388 | (minus:SI (match_dup 2) (match_dup 1))))] | |
389 | "" | |
390 | "doz%I2. %0,%1,%2" | |
391 | [(set_attr "type" "delayed_compare")]) | |
392 | ||
393 | ;; We don't need abs with condition code because such comparisons should | |
394 | ;; never be done. | |
395 | (define_insn "abssi2" | |
cd2b37d9 RK |
396 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
397 | (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))] | |
1fd4e8c1 RK |
398 | "" |
399 | "abs %0,%1") | |
400 | ||
401 | (define_insn "" | |
cd2b37d9 RK |
402 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
403 | (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))] | |
1fd4e8c1 RK |
404 | "" |
405 | "nabs %0,%1") | |
406 | ||
407 | (define_insn "negsi2" | |
cd2b37d9 RK |
408 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
409 | (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))] | |
1fd4e8c1 RK |
410 | "" |
411 | "neg %0,%1") | |
412 | ||
413 | (define_insn "" | |
414 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 | 415 | (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
416 | (const_int 0))) |
417 | (clobber (match_scratch:SI 2 "=r"))] | |
418 | "" | |
419 | "neg. %2,%1" | |
420 | [(set_attr "type" "compare")]) | |
421 | ||
422 | (define_insn "" | |
423 | [(set (match_operand:CC 2 "cc_reg_operand" "=x") | |
cd2b37d9 | 424 | (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 | 425 | (const_int 0))) |
cd2b37d9 | 426 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
427 | (neg:SI (match_dup 1)))] |
428 | "" | |
429 | "neg. %0,%1" | |
430 | [(set_attr "type" "compare")]) | |
431 | ||
432 | (define_insn "ffssi2" | |
433 | [(set (match_operand:SI 0 "register_operand" "=&r") | |
434 | (ffs:SI (match_operand:SI 1 "register_operand" "r")))] | |
435 | "" | |
436 | "neg %0,%1\;and %0,%0,%1\;cntlz %0,%0\;sfi %0,%0,32") | |
437 | ||
438 | ;; There is no need for (set (condition) (compare (ffs) 0)) because that | |
439 | ;; can be simplified to an ordinary comparison. A parallel set and compare | |
440 | ;; might be used, so include it. | |
441 | ||
442 | (define_insn "" | |
443 | [(set (match_operand:CC 2 "cc_reg_operand" "=x") | |
444 | (compare:CC (ffs:SI (match_operand:SI 1 "register_operand" "r")) | |
445 | (const_int 0))) | |
446 | (set (match_operand:SI 0 "register_operand" "=&r") | |
447 | (ffs:SI (match_dup 1)))] | |
448 | "" | |
449 | "neg %0,%1\;and %0,%0,%1\;cntlz %0,%0\;sfi. %0,%0,32" | |
450 | [(set_attr "type" "compare")]) | |
451 | ||
452 | (define_insn "mulsi3" | |
cd2b37d9 RK |
453 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
454 | (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r") | |
1fd4e8c1 RK |
455 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))) |
456 | (clobber (match_scratch:SI 3 "=q,q"))] | |
457 | "" | |
458 | "@ | |
459 | muls %0,%1,%2 | |
460 | muli %0,%1,%2") | |
461 | ||
462 | (define_insn "" | |
463 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
464 | (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
465 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 RK |
466 | (const_int 0))) |
467 | (clobber (match_scratch:SI 3 "=r")) | |
468 | (clobber (match_scratch:SI 4 "=q"))] | |
469 | "" | |
470 | "muls. %3,%1,%2" | |
471 | [(set_attr "type" "delayed_compare")]) | |
472 | ||
473 | (define_insn "" | |
474 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
475 | (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
476 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 | 477 | (const_int 0))) |
cd2b37d9 | 478 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
479 | (mult:SI (match_dup 1) (match_dup 2))) |
480 | (clobber (match_scratch:SI 4 "=q"))] | |
481 | "" | |
482 | "muls. %0,%1,%2" | |
483 | [(set_attr "type" "delayed_compare")]) | |
484 | ||
485 | ;; Operand 1 is divided by operand 2; quotient goes to operand | |
486 | ;; 0 and remainder to operand 3. | |
487 | ;; ??? At some point, see what, if anything, we can do about if (x % y == 0). | |
488 | ||
489 | (define_insn "divmodsi4" | |
cd2b37d9 RK |
490 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
491 | (div:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
492 | (match_operand:SI 2 "gpc_reg_operand" "r"))) | |
493 | (set (match_operand:SI 3 "gpc_reg_operand" "=q") | |
1fd4e8c1 RK |
494 | (mod:SI (match_dup 1) (match_dup 2)))] |
495 | "" | |
496 | "divs %0,%1,%2") | |
497 | ||
498 | ;; For powers of two we can do srai/aze for divide and then adjust for | |
499 | ;; modulus. If it isn't a power of two, FAIL so divmodsi4 will be used. | |
500 | (define_expand "divsi3" | |
cd2b37d9 RK |
501 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
502 | (div:SI (match_operand:SI 1 "gpc_reg_operand" "") | |
1fd4e8c1 RK |
503 | (match_operand:SI 2 "reg_or_cint_operand" "")))] |
504 | "" | |
505 | " | |
506 | { | |
507 | if (GET_CODE (operands[2]) != CONST_INT | |
508 | || exact_log2 (INTVAL (operands[2])) < 0) | |
509 | FAIL; | |
510 | }") | |
511 | ||
512 | (define_expand "modsi3" | |
513 | [(set (match_dup 3) | |
cd2b37d9 | 514 | (div:SI (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
515 | (match_operand:SI 2 "reg_or_cint_operand" ""))) |
516 | (parallel [(set (match_dup 4) (ashift:SI (match_dup 3) (match_dup 5))) | |
517 | (clobber (scratch:SI))]) | |
cd2b37d9 | 518 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
519 | (minus:SI (match_dup 1) (match_dup 4)))] |
520 | "" | |
521 | " | |
522 | { | |
523 | int i = exact_log2 (INTVAL (operands[2])); | |
524 | ||
525 | if (GET_CODE (operands[2]) != CONST_INT || i < 0) | |
526 | FAIL; | |
527 | ||
528 | operands[3] = gen_reg_rtx (SImode); | |
529 | operands[4] = gen_reg_rtx (SImode); | |
530 | operands[5] = gen_rtx (CONST_INT, VOIDmode, i); | |
531 | }") | |
532 | ||
533 | (define_insn "" | |
cd2b37d9 RK |
534 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
535 | (div:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
536 | (match_operand:SI 2 "const_int_operand" "N")))] |
537 | "exact_log2 (INTVAL (operands[2])) >= 0" | |
538 | "srai %0,%1,%p2\;aze %0,%0") | |
539 | ||
540 | (define_insn "" | |
541 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 | 542 | (div:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
543 | (match_operand:SI 2 "const_int_operand" "N"))) |
544 | (clobber (match_scratch:SI 3 "=r"))] | |
545 | "exact_log2 (INTVAL (operands[2])) >= 0" | |
546 | "srai %3,%1,%p2\;aze. %3,%3" | |
547 | [(set_attr "type" "compare")]) | |
548 | ||
549 | (define_insn "" | |
550 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 | 551 | (div:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 552 | (match_operand:SI 2 "const_int_operand" "N"))) |
cd2b37d9 | 553 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
554 | (div:SI (match_dup 1) (match_dup 2)))] |
555 | "exact_log2 (INTVAL (operands[2])) >= 0" | |
556 | "srai %0,%1,%p2\;aze. %0,%0" | |
557 | [(set_attr "type" "compare")]) | |
558 | ||
559 | (define_insn "" | |
cd2b37d9 | 560 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
561 | (udiv:SI |
562 | (plus:DI (lshift:DI | |
cd2b37d9 | 563 | (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 | 564 | (const_int 32)) |
23a900dc | 565 | (zero_extend:DI (match_operand:SI 4 "register_operand" "2"))) |
cd2b37d9 | 566 | (match_operand:SI 3 "gpc_reg_operand" "r"))) |
740ab4a2 | 567 | (set (match_operand:SI 2 "register_operand" "=*q") |
1fd4e8c1 RK |
568 | (umod:SI |
569 | (plus:DI (lshift:DI | |
570 | (zero_extend:DI (match_dup 1)) (const_int 32)) | |
740ab4a2 | 571 | (zero_extend:DI (match_dup 4))) |
1fd4e8c1 RK |
572 | (match_dup 3)))] |
573 | ||
574 | "" | |
575 | "div %0,%1,%3") | |
576 | ||
577 | ;; To do unsigned divide we handle the cases of the divisor looking like a | |
578 | ;; negative number. If it is a constant that is less than 2**31, we don't | |
579 | ;; have to worry about the branches. So make a few subroutines here. | |
580 | ;; | |
581 | ;; First comes the normal case. | |
582 | (define_expand "udivmodsi4_normal" | |
583 | [(set (match_dup 4) (const_int 0)) | |
584 | (parallel [(set (match_operand:SI 0 "" "") | |
585 | (udiv:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4)) | |
586 | (const_int 32)) | |
587 | (zero_extend:DI (match_operand:SI 1 "" ""))) | |
588 | (match_operand:SI 2 "" ""))) | |
589 | (set (match_operand:SI 3 "" "") | |
590 | (umod:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4)) | |
591 | (const_int 32)) | |
592 | (zero_extend:DI (match_dup 1))) | |
593 | (match_dup 2)))])] | |
594 | "" | |
595 | " | |
596 | { operands[4] = gen_reg_rtx (SImode); }") | |
597 | ||
598 | ;; This handles the branches. | |
599 | (define_expand "udivmodsi4_tests" | |
600 | [(set (match_operand:SI 0 "" "") (const_int 0)) | |
601 | (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" "")) | |
602 | (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" ""))) | |
603 | (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0)) | |
604 | (label_ref (match_operand:SI 4 "" "")) (pc))) | |
605 | (set (match_dup 0) (const_int 1)) | |
606 | (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2))) | |
607 | (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0))) | |
608 | (set (pc) (if_then_else (lt (match_dup 6) (const_int 0)) | |
609 | (label_ref (match_dup 4)) (pc)))] | |
610 | "" | |
611 | " | |
612 | { operands[5] = gen_reg_rtx (CCUNSmode); | |
613 | operands[6] = gen_reg_rtx (CCmode); | |
614 | }") | |
615 | ||
616 | (define_expand "udivmodsi4" | |
cd2b37d9 RK |
617 | [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "") |
618 | (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "") | |
1fd4e8c1 | 619 | (match_operand:SI 2 "reg_or_cint_operand" ""))) |
cd2b37d9 | 620 | (set (match_operand:SI 3 "gpc_reg_operand" "") |
1fd4e8c1 RK |
621 | (umod:SI (match_dup 1) (match_dup 2)))])] |
622 | "" | |
623 | " | |
624 | { | |
625 | rtx label = 0; | |
626 | ||
627 | if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0) | |
628 | { | |
629 | operands[2] = force_reg (SImode, operands[2]); | |
630 | label = gen_label_rtx (); | |
631 | emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2], | |
632 | operands[3], label)); | |
633 | } | |
634 | else | |
635 | operands[2] = force_reg (SImode, operands[2]); | |
636 | ||
637 | emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2], | |
638 | operands[3])); | |
639 | if (label) | |
640 | emit_label (label); | |
641 | ||
642 | DONE; | |
643 | }") | |
644 | ||
645 | (define_insn "andsi3" | |
cd2b37d9 RK |
646 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r") |
647 | (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r") | |
1fd4e8c1 RK |
648 | (match_operand:SI 2 "and_operand" "?r,L,K,J"))) |
649 | (clobber (match_scratch:CC 3 "=X,X,x,x"))] | |
650 | "" | |
651 | "@ | |
652 | and %0,%1,%2 | |
653 | rlinm %0,%1,0,%m2,%M2 | |
654 | andil. %0,%1,%b2 | |
655 | andiu. %0,%1,%u2") | |
656 | ||
657 | (define_insn "" | |
658 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x") | |
cd2b37d9 | 659 | (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r") |
1fd4e8c1 RK |
660 | (match_operand:SI 2 "and_operand" "r,K,J,L")) |
661 | (const_int 0))) | |
662 | (clobber (match_scratch:SI 3 "=r,r,r,r"))] | |
663 | "" | |
664 | "@ | |
665 | and. %3,%1,%2 | |
666 | andil. %3,%1,%b2 | |
667 | andiu. %3,%1,%u2 | |
668 | rlinm. %3,%1,0,%m2,%M2" | |
669 | [(set_attr "type" "compare,compare,compare,delayed_compare")]) | |
670 | ||
671 | (define_insn "" | |
672 | [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x") | |
cd2b37d9 | 673 | (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r") |
1fd4e8c1 RK |
674 | (match_operand:SI 2 "and_operand" "r,K,J,L")) |
675 | (const_int 0))) | |
cd2b37d9 | 676 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r") |
1fd4e8c1 RK |
677 | (and:SI (match_dup 1) (match_dup 2)))] |
678 | "" | |
679 | "@ | |
680 | and. %0,%1,%2 | |
681 | andil. %0,%1,%b2 | |
682 | andiu. %0,%1,%u2 | |
683 | rlinm. %0,%1,0,%m2,%M2" | |
684 | [(set_attr "type" "compare,compare,compare,delayed_compare")]) | |
685 | ||
f357808b RK |
686 | ;; Take a AND with a constant that cannot be done in a single insn and try to |
687 | ;; split it into two insns. This does not verify that the insns are valid | |
688 | ;; since this need not be done as combine will do it. | |
689 | ||
690 | (define_split | |
cd2b37d9 RK |
691 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
692 | (and:SI (match_operand:SI 1 "gpc_reg_operand" "") | |
f357808b RK |
693 | (match_operand:SI 2 "non_and_cint_operand" "")))] |
694 | "" | |
695 | [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 3))) | |
696 | (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))] | |
697 | " | |
698 | { | |
699 | int maskval = INTVAL (operands[2]); | |
700 | int i, transitions, last_bit_value; | |
701 | int orig = maskval, first_c = maskval, second_c; | |
702 | ||
703 | /* We know that MASKVAL must have more than 2 bit-transitions. Start at | |
704 | the low-order bit and count for the third transition. When we get there, | |
705 | make a first mask that has everything to the left of that position | |
706 | a one. Then make the second mask to turn off whatever else is needed. */ | |
707 | ||
708 | for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++) | |
709 | { | |
710 | if (((maskval >>= 1) & 1) != last_bit_value) | |
711 | last_bit_value ^= 1, transitions++; | |
712 | ||
713 | if (transitions > 2) | |
714 | { | |
715 | first_c |= (~0) << i; | |
716 | break; | |
717 | } | |
718 | } | |
719 | ||
720 | second_c = orig | ~ first_c; | |
721 | ||
722 | operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c); | |
723 | operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c); | |
724 | }") | |
725 | ||
726 | (define_insn "iorsi3" | |
cd2b37d9 RK |
727 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") |
728 | (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r") | |
1fd4e8c1 RK |
729 | (match_operand:SI 2 "logical_operand" "r,K,J")))] |
730 | "" | |
731 | "@ | |
732 | or %0,%1,%2 | |
733 | oril %0,%1,%b2 | |
734 | oriu %0,%1,%u2") | |
735 | ||
736 | (define_insn "" | |
737 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
738 | (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
739 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 RK |
740 | (const_int 0))) |
741 | (clobber (match_scratch:SI 3 "=r"))] | |
742 | "" | |
743 | "or. %3,%1,%2" | |
744 | [(set_attr "type" "compare")]) | |
745 | ||
746 | (define_insn "" | |
747 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
748 | (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
749 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 | 750 | (const_int 0))) |
cd2b37d9 | 751 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
752 | (ior:SI (match_dup 1) (match_dup 2)))] |
753 | "" | |
754 | "or. %0,%1,%2" | |
755 | [(set_attr "type" "compare")]) | |
756 | ||
f357808b RK |
757 | ;; Split an IOR that we can't do in one insn into two insns, each of which |
758 | ;; does one 16-bit part. This is used by combine. | |
759 | ||
760 | (define_split | |
cd2b37d9 RK |
761 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
762 | (ior:SI (match_operand:SI 1 "gpc_reg_operand" "") | |
f357808b | 763 | (match_operand:SI 2 "non_logical_cint_operand" "")))] |
1fd4e8c1 | 764 | "" |
f357808b RK |
765 | [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3))) |
766 | (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))] | |
767 | " | |
1fd4e8c1 | 768 | { |
f357808b RK |
769 | operands[3] = gen_rtx (CONST_INT, VOIDmode, |
770 | INTVAL (operands[2]) & 0xffff0000); | |
771 | operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff); | |
1fd4e8c1 RK |
772 | }") |
773 | ||
f357808b | 774 | (define_insn "xorsi3" |
cd2b37d9 RK |
775 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") |
776 | (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r") | |
1fd4e8c1 RK |
777 | (match_operand:SI 2 "logical_operand" "r,K,J")))] |
778 | "" | |
779 | "@ | |
780 | xor %0,%1,%2 | |
781 | xoril %0,%1,%b2 | |
782 | xoriu %0,%1,%u2") | |
783 | ||
784 | (define_insn "" | |
785 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
786 | (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
787 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 RK |
788 | (const_int 0))) |
789 | (clobber (match_scratch:SI 3 "=r"))] | |
790 | "" | |
791 | "xor. %3,%1,%2" | |
792 | [(set_attr "type" "compare")]) | |
793 | ||
794 | (define_insn "" | |
795 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
796 | (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
797 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 | 798 | (const_int 0))) |
cd2b37d9 | 799 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
800 | (xor:SI (match_dup 1) (match_dup 2)))] |
801 | "" | |
802 | "xor. %0,%1,%2" | |
803 | [(set_attr "type" "compare")]) | |
804 | ||
f357808b RK |
805 | ;; Split an XOR that we can't do in one insn into two insns, each of which |
806 | ;; does one 16-bit part. This is used by combine. | |
807 | ||
808 | (define_split | |
cd2b37d9 RK |
809 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
810 | (xor:SI (match_operand:SI 1 "gpc_reg_operand" "") | |
f357808b | 811 | (match_operand:SI 2 "non_logical_cint_operand" "")))] |
1fd4e8c1 | 812 | "" |
f357808b RK |
813 | [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3))) |
814 | (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))] | |
815 | " | |
1fd4e8c1 | 816 | { |
f357808b RK |
817 | operands[3] = gen_rtx (CONST_INT, VOIDmode, |
818 | INTVAL (operands[2]) & 0xffff0000); | |
819 | operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff); | |
1fd4e8c1 RK |
820 | }") |
821 | ||
822 | (define_insn "" | |
cd2b37d9 RK |
823 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
824 | (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r") | |
825 | (match_operand:SI 2 "gpc_reg_operand" "r"))))] | |
1fd4e8c1 RK |
826 | "" |
827 | "eqv %0,%1,%2") | |
828 | ||
829 | (define_insn "" | |
830 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
831 | (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r") |
832 | (match_operand:SI 2 "gpc_reg_operand" "r"))) | |
1fd4e8c1 RK |
833 | (const_int 0))) |
834 | (clobber (match_scratch:SI 3 "=r"))] | |
835 | "" | |
836 | "eqv. %3,%1,%2" | |
837 | [(set_attr "type" "compare")]) | |
838 | ||
839 | (define_insn "" | |
840 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
841 | (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r") |
842 | (match_operand:SI 2 "gpc_reg_operand" "r"))) | |
1fd4e8c1 | 843 | (const_int 0))) |
cd2b37d9 | 844 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
845 | (not:SI (xor:SI (match_dup 1) (match_dup 2))))] |
846 | "" | |
847 | "eqv. %0,%1,%2" | |
848 | [(set_attr "type" "compare")]) | |
849 | ||
850 | (define_insn "" | |
cd2b37d9 RK |
851 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
852 | (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) | |
853 | (match_operand:SI 2 "gpc_reg_operand" "r")))] | |
1fd4e8c1 RK |
854 | "" |
855 | "andc %0,%2,%1") | |
856 | ||
857 | (define_insn "" | |
858 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
859 | (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
860 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 RK |
861 | (const_int 0))) |
862 | (clobber (match_scratch:SI 3 "=r"))] | |
863 | "" | |
864 | "andc. %3,%2,%1" | |
865 | [(set_attr "type" "compare")]) | |
866 | ||
867 | (define_insn "" | |
868 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
869 | (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
870 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 | 871 | (const_int 0))) |
cd2b37d9 | 872 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
873 | (and:SI (not:SI (match_dup 1)) (match_dup 2)))] |
874 | "" | |
875 | "andc. %0,%2,%1" | |
876 | [(set_attr "type" "compare")]) | |
877 | ||
878 | (define_insn "" | |
cd2b37d9 RK |
879 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
880 | (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) | |
881 | (match_operand:SI 2 "gpc_reg_operand" "r")))] | |
1fd4e8c1 RK |
882 | "" |
883 | "orc %0,%2,%1") | |
884 | ||
885 | (define_insn "" | |
886 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
887 | (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
888 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 RK |
889 | (const_int 0))) |
890 | (clobber (match_scratch:SI 3 "=r"))] | |
891 | "" | |
892 | "orc. %3,%2,%1" | |
893 | [(set_attr "type" "compare")]) | |
894 | ||
895 | (define_insn "" | |
896 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
897 | (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
898 | (match_operand:SI 2 "gpc_reg_operand" "r")) | |
1fd4e8c1 | 899 | (const_int 0))) |
cd2b37d9 | 900 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
901 | (ior:SI (not:SI (match_dup 1)) (match_dup 2)))] |
902 | "" | |
903 | "orc. %0,%2,%1" | |
904 | [(set_attr "type" "compare")]) | |
905 | ||
906 | (define_insn "" | |
cd2b37d9 RK |
907 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
908 | (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) | |
909 | (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))] | |
1fd4e8c1 RK |
910 | "" |
911 | "nand %0,%1,%2") | |
912 | ||
913 | (define_insn "" | |
914 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
915 | (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
916 | (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))) | |
1fd4e8c1 RK |
917 | (const_int 0))) |
918 | (clobber (match_scratch:SI 3 "=r"))] | |
919 | "" | |
920 | "nand. %3,%1,%2" | |
921 | [(set_attr "type" "compare")]) | |
922 | ||
923 | (define_insn "" | |
924 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
925 | (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
926 | (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))) | |
1fd4e8c1 | 927 | (const_int 0))) |
cd2b37d9 | 928 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
929 | (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))] |
930 | "" | |
931 | "nand. %0,%1,%2" | |
932 | [(set_attr "type" "compare")]) | |
933 | ||
934 | (define_insn "" | |
cd2b37d9 RK |
935 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
936 | (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) | |
937 | (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))] | |
1fd4e8c1 RK |
938 | "" |
939 | "nor %0,%1,%2") | |
940 | ||
941 | (define_insn "" | |
942 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
943 | (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
944 | (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))) | |
1fd4e8c1 RK |
945 | (const_int 0))) |
946 | (clobber (match_scratch:SI 3 "=r"))] | |
947 | "" | |
948 | "nor. %3,%1,%2" | |
949 | [(set_attr "type" "compare")]) | |
950 | ||
951 | (define_insn "" | |
952 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 RK |
953 | (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
954 | (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))) | |
1fd4e8c1 | 955 | (const_int 0))) |
cd2b37d9 | 956 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
957 | (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))] |
958 | "" | |
959 | "nor. %0,%1,%2" | |
960 | [(set_attr "type" "compare")]) | |
961 | ||
962 | ;; maskir insn. We need four forms because things might be in arbitrary | |
963 | ;; orders. Don't define forms that only set CR fields because these | |
964 | ;; would modify an input register. | |
965 | ||
966 | (define_insn "" | |
cd2b37d9 | 967 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
01def764 RK |
968 | (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")) |
969 | (match_operand:SI 1 "gpc_reg_operand" "0")) | |
970 | (and:SI (match_dup 2) | |
cd2b37d9 | 971 | (match_operand:SI 3 "gpc_reg_operand" "r"))))] |
1fd4e8c1 | 972 | "" |
01def764 | 973 | "maskir %0,%3,%2") |
1fd4e8c1 RK |
974 | |
975 | (define_insn "" | |
976 | [(set (match_operand:SI 0 "register_operand" "=r") | |
01def764 RK |
977 | (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")) |
978 | (match_operand:SI 1 "gpc_reg_operand" "0")) | |
cd2b37d9 | 979 | (and:SI (match_operand:SI 3 "gpc_reg_operand" "r") |
01def764 | 980 | (match_dup 2))))] |
1fd4e8c1 | 981 | "" |
01def764 | 982 | "maskir %0,%3,%2") |
1fd4e8c1 RK |
983 | |
984 | (define_insn "" | |
cd2b37d9 | 985 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
01def764 | 986 | (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r") |
cd2b37d9 | 987 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
01def764 RK |
988 | (and:SI (not:SI (match_dup 2)) |
989 | (match_operand:SI 1 "gpc_reg_operand" "0"))))] | |
1fd4e8c1 | 990 | "" |
01def764 | 991 | "maskir %0,%3,%2") |
1fd4e8c1 RK |
992 | |
993 | (define_insn "" | |
cd2b37d9 RK |
994 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
995 | (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r") | |
01def764 RK |
996 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
997 | (and:SI (not:SI (match_dup 2)) | |
998 | (match_operand:SI 1 "gpc_reg_operand" "0"))))] | |
1fd4e8c1 | 999 | "" |
01def764 | 1000 | "maskir %0,%3,%2") |
1fd4e8c1 RK |
1001 | |
1002 | (define_insn "" | |
1003 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
1004 | (compare:CC | |
01def764 RK |
1005 | (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")) |
1006 | (match_operand:SI 1 "gpc_reg_operand" "0")) | |
1007 | (and:SI (match_dup 2) | |
cd2b37d9 | 1008 | (match_operand:SI 3 "gpc_reg_operand" "r"))) |
1fd4e8c1 | 1009 | (const_int 0))) |
cd2b37d9 | 1010 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
01def764 RK |
1011 | (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1)) |
1012 | (and:SI (match_dup 2) (match_dup 3))))] | |
1fd4e8c1 | 1013 | "" |
01def764 | 1014 | "maskir. %0,%3,%2" |
1fd4e8c1 RK |
1015 | [(set_attr "type" "compare")]) |
1016 | ||
1017 | (define_insn "" | |
1018 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
1019 | (compare:CC | |
01def764 RK |
1020 | (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")) |
1021 | (match_operand:SI 1 "gpc_reg_operand" "0")) | |
cd2b37d9 | 1022 | (and:SI (match_operand:SI 3 "gpc_reg_operand" "r") |
01def764 | 1023 | (match_dup 2))) |
1fd4e8c1 RK |
1024 | (const_int 0))) |
1025 | (set (match_operand:SI 0 "register_operand" "=r") | |
01def764 RK |
1026 | (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1)) |
1027 | (and:SI (match_dup 3) (match_dup 2))))] | |
1fd4e8c1 | 1028 | "" |
01def764 | 1029 | "maskir. %0,%3,%2" |
1fd4e8c1 RK |
1030 | [(set_attr "type" "compare")]) |
1031 | ||
1032 | (define_insn "" | |
1033 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
1034 | (compare:CC | |
01def764 | 1035 | (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r") |
cd2b37d9 | 1036 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
01def764 RK |
1037 | (and:SI (not:SI (match_dup 2)) |
1038 | (match_operand:SI 1 "gpc_reg_operand" "0"))) | |
1fd4e8c1 | 1039 | (const_int 0))) |
cd2b37d9 | 1040 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
01def764 RK |
1041 | (ior:SI (and:SI (match_dup 2) (match_dup 3)) |
1042 | (and:SI (not:SI (match_dup 2)) (match_dup 1))))] | |
1fd4e8c1 | 1043 | "" |
01def764 | 1044 | "maskir. %0,%3,%2" |
1fd4e8c1 RK |
1045 | [(set_attr "type" "compare")]) |
1046 | ||
1047 | (define_insn "" | |
1048 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
1049 | (compare:CC | |
cd2b37d9 | 1050 | (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r") |
01def764 RK |
1051 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
1052 | (and:SI (not:SI (match_dup 2)) | |
1053 | (match_operand:SI 1 "gpc_reg_operand" "0"))) | |
1fd4e8c1 | 1054 | (const_int 0))) |
cd2b37d9 | 1055 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
01def764 RK |
1056 | (ior:SI (and:SI (match_dup 3) (match_dup 2)) |
1057 | (and:SI (not:SI (match_dup 2)) (match_dup 1))))] | |
1fd4e8c1 | 1058 | "" |
01def764 | 1059 | "maskir. %0,%3,%2" |
1fd4e8c1 RK |
1060 | [(set_attr "type" "compare")]) |
1061 | \f | |
1062 | ;; Rotate and shift insns, in all their variants. These support shifts, | |
1063 | ;; field inserts and extracts, and various combinations thereof. | |
1064 | (define_insn "insv" | |
cd2b37d9 | 1065 | [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r") |
1fd4e8c1 RK |
1066 | (match_operand:SI 1 "const_int_operand" "i") |
1067 | (match_operand:SI 2 "const_int_operand" "i")) | |
cd2b37d9 | 1068 | (match_operand:SI 3 "gpc_reg_operand" "r"))] |
1fd4e8c1 RK |
1069 | "" |
1070 | "* | |
1071 | { | |
1072 | int start = INTVAL (operands[2]) & 31; | |
1073 | int size = INTVAL (operands[1]) & 31; | |
1074 | ||
1075 | operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size); | |
1076 | operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1); | |
1077 | return \"rlimi %0,%3,%4,%h2,%h1\"; | |
1078 | }") | |
1079 | ||
1080 | (define_insn "extzv" | |
cd2b37d9 RK |
1081 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1082 | (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
1083 | (match_operand:SI 2 "const_int_operand" "i") |
1084 | (match_operand:SI 3 "const_int_operand" "i")))] | |
1085 | "" | |
1086 | "* | |
1087 | { | |
1088 | int start = INTVAL (operands[3]) & 31; | |
1089 | int size = INTVAL (operands[2]) & 31; | |
1090 | ||
1091 | if (start + size >= 32) | |
1092 | operands[3] = const0_rtx; | |
1093 | else | |
1094 | operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size); | |
1095 | return \"rlinm %0,%1,%3,%s2,31\"; | |
1096 | }") | |
1097 | ||
1098 | (define_insn "" | |
1099 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 | 1100 | (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1101 | (match_operand:SI 2 "const_int_operand" "i") |
1102 | (match_operand:SI 3 "const_int_operand" "i")) | |
1103 | (const_int 0))) | |
1104 | (clobber (match_scratch:SI 4 "=r"))] | |
1105 | "" | |
1106 | "* | |
1107 | { | |
1108 | int start = INTVAL (operands[3]) & 31; | |
1109 | int size = INTVAL (operands[2]) & 31; | |
1110 | ||
a7a975e1 RK |
1111 | /* If the bitfield being tested fits in the upper or lower half of a |
1112 | word, it is possible to use andiu. or andil. to test it. This is | |
1113 | useful because the condition register set-use delay is smaller for | |
1114 | andi[ul]. than for rlinm. This doesn't work when the starting bit | |
1115 | position is 0 because the LT and GT bits may be set wrong. */ | |
1116 | ||
1117 | if ((start > 0 && start + size <= 16) || start >= 16) | |
df031c43 RK |
1118 | { |
1119 | operands[3] = gen_rtx (CONST_INT, VOIDmode, | |
1120 | ((1 << (16 - (start & 15))) | |
1121 | - (1 << (16 - (start & 15) - size)))); | |
1122 | if (start < 16) | |
1123 | return \"andiu. %4,%1,%3\"; | |
1124 | else | |
1125 | return \"andil. %4,%1,%3\"; | |
1126 | } | |
1127 | ||
1fd4e8c1 RK |
1128 | if (start + size >= 32) |
1129 | operands[3] = const0_rtx; | |
1130 | else | |
1131 | operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size); | |
1132 | return \"rlinm. %4,%1,%3,%s2,31\"; | |
1133 | }" | |
1134 | [(set_attr "type" "compare")]) | |
1135 | ||
1136 | (define_insn "" | |
1137 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
cd2b37d9 | 1138 | (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1139 | (match_operand:SI 2 "const_int_operand" "i") |
1140 | (match_operand:SI 3 "const_int_operand" "i")) | |
1141 | (const_int 0))) | |
cd2b37d9 | 1142 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1143 | (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))] |
1144 | "" | |
1145 | "* | |
1146 | { | |
1147 | int start = INTVAL (operands[3]) & 31; | |
1148 | int size = INTVAL (operands[2]) & 31; | |
1149 | ||
a7a975e1 | 1150 | if (start >= 16 && start + size == 32) |
df031c43 | 1151 | { |
a7a975e1 RK |
1152 | operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1); |
1153 | return \"andil. %0,%1,%3\"; | |
df031c43 RK |
1154 | } |
1155 | ||
1fd4e8c1 RK |
1156 | if (start + size >= 32) |
1157 | operands[3] = const0_rtx; | |
1158 | else | |
1159 | operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size); | |
1160 | return \"rlinm. %0,%1,%3,%s2,31\"; | |
1161 | }" | |
1162 | [(set_attr "type" "delayed_compare")]) | |
1163 | ||
1164 | (define_insn "rotlsi3" | |
cd2b37d9 RK |
1165 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1166 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
1167 | (match_operand:SI 2 "reg_or_cint_operand" "ri")))] |
1168 | "" | |
1169 | "rl%I2nm %0,%1,%h2,0,31") | |
1170 | ||
1171 | (define_insn "" | |
1172 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
cd2b37d9 | 1173 | (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1174 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) |
1175 | (const_int 0))) | |
1176 | (clobber (match_scratch:SI 3 "=r"))] | |
1177 | "" | |
1178 | "rl%I2nm. %3,%1,%h2,0,31" | |
1179 | [(set_attr "type" "delayed_compare")]) | |
1180 | ||
1181 | (define_insn "" | |
1182 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
cd2b37d9 | 1183 | (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1184 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) |
1185 | (const_int 0))) | |
cd2b37d9 | 1186 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1187 | (rotate:SI (match_dup 1) (match_dup 2)))] |
1188 | "" | |
1189 | "rl%I2nm. %0,%1,%h2,0,31" | |
1190 | [(set_attr "type" "delayed_compare")]) | |
1191 | ||
1192 | (define_insn "" | |
cd2b37d9 RK |
1193 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1194 | (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
1195 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) |
1196 | (match_operand:SI 3 "mask_operand" "L")))] | |
1197 | "" | |
1198 | "rl%I2nm %0,%1,%h2,%m3,%M3") | |
1199 | ||
1200 | (define_insn "" | |
1201 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
1202 | (compare:CC (and:SI | |
cd2b37d9 | 1203 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1204 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) |
1205 | (match_operand:SI 3 "mask_operand" "L")) | |
1206 | (const_int 0))) | |
1207 | (clobber (match_scratch:SI 4 "=r"))] | |
1208 | "" | |
1209 | "rl%I2nm. %4,%1,%h2,%m3,%M3" | |
1210 | [(set_attr "type" "delayed_compare")]) | |
1211 | ||
1212 | (define_insn "" | |
1213 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
1214 | (compare:CC (and:SI | |
cd2b37d9 | 1215 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1216 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) |
1217 | (match_operand:SI 3 "mask_operand" "L")) | |
1218 | (const_int 0))) | |
cd2b37d9 | 1219 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1220 | (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))] |
1221 | "" | |
1222 | "rl%I2nm. %0,%1,%h2,%m3,%M3" | |
1223 | [(set_attr "type" "delayed_compare")]) | |
1224 | ||
1225 | (define_insn "" | |
cd2b37d9 | 1226 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1227 | (zero_extend:SI |
1228 | (subreg:QI | |
cd2b37d9 | 1229 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1230 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))] |
1231 | "" | |
1232 | "rl%I2nm %0,%1,%h2,24,31") | |
1233 | ||
1234 | (define_insn "" | |
1235 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
1236 | (compare:CC (zero_extend:SI | |
1237 | (subreg:QI | |
cd2b37d9 | 1238 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1239 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)) |
1240 | (const_int 0))) | |
1241 | (clobber (match_scratch:SI 3 "=r"))] | |
1242 | "" | |
1243 | "rl%I2nm. %3,%1,%h2,24,31" | |
1244 | [(set_attr "type" "delayed_compare")]) | |
1245 | ||
1246 | (define_insn "" | |
1247 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
1248 | (compare:CC (zero_extend:SI | |
1249 | (subreg:QI | |
cd2b37d9 | 1250 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1251 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)) |
1252 | (const_int 0))) | |
cd2b37d9 | 1253 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1254 | (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))] |
1255 | "" | |
1256 | "rl%I2nm. %0,%1,%h2,24,31" | |
1257 | [(set_attr "type" "delayed_compare")]) | |
1258 | ||
1259 | (define_insn "" | |
cd2b37d9 | 1260 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1261 | (zero_extend:SI |
1262 | (subreg:HI | |
cd2b37d9 | 1263 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1264 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))] |
1265 | "" | |
1266 | "rl%I2nm %0,%1,%h2,16,31") | |
1267 | ||
1268 | (define_insn "" | |
1269 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
1270 | (compare:CC (zero_extend:SI | |
1271 | (subreg:HI | |
cd2b37d9 | 1272 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1273 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)) |
1274 | (const_int 0))) | |
1275 | (clobber (match_scratch:SI 3 "=r"))] | |
1276 | "" | |
1277 | "rl%I2nm. %3,%1,%h2,16,31" | |
1278 | [(set_attr "type" "delayed_compare")]) | |
1279 | ||
1280 | (define_insn "" | |
1281 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
1282 | (compare:CC (zero_extend:SI | |
1283 | (subreg:HI | |
cd2b37d9 | 1284 | (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1285 | (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)) |
1286 | (const_int 0))) | |
cd2b37d9 | 1287 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1288 | (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))] |
1289 | "" | |
1290 | "rl%I2nm. %0,%1,%h2,16,31" | |
1291 | [(set_attr "type" "delayed_compare")]) | |
1292 | ||
1293 | ;; Note that we use "sle." instead of "sl." so that we can set | |
1294 | ;; SHIFT_COUNT_TRUNCATED. | |
1295 | ||
1296 | (define_insn "ashlsi3" | |
cd2b37d9 RK |
1297 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1298 | (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
1299 | (match_operand:SI 2 "reg_or_cint_operand" "r,i"))) |
1300 | (clobber (match_scratch:SI 3 "=q,X"))] | |
1301 | "" | |
1302 | "@ | |
1303 | sle %0,%1,%2 | |
1304 | sli %0,%1,%h2") | |
1305 | ||
1306 | (define_insn "" | |
1307 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x") | |
cd2b37d9 | 1308 | (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
1309 | (match_operand:SI 2 "reg_or_cint_operand" "r,i")) |
1310 | (const_int 0))) | |
1311 | (clobber (match_scratch:SI 3 "=r,r")) | |
1312 | (clobber (match_scratch:SI 4 "=q,X"))] | |
1313 | "" | |
1314 | "@ | |
1315 | sle. %3,%1,%2 | |
1316 | sli. %3,%1,%h2" | |
1317 | [(set_attr "type" "delayed_compare")]) | |
1318 | ||
1319 | (define_insn "" | |
1320 | [(set (match_operand:CC 3 "cc_reg_operand" "=x,x") | |
cd2b37d9 | 1321 | (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
1322 | (match_operand:SI 2 "reg_or_cint_operand" "r,i")) |
1323 | (const_int 0))) | |
cd2b37d9 | 1324 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
1325 | (ashift:SI (match_dup 1) (match_dup 2))) |
1326 | (clobber (match_scratch:SI 4 "=q,X"))] | |
1327 | "" | |
1328 | "@ | |
1329 | sle. %0,%1,%2 | |
1330 | sli. %0,%1,%h2" | |
1331 | [(set_attr "type" "delayed_compare")]) | |
1332 | ||
1333 | (define_insn "" | |
cd2b37d9 RK |
1334 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1335 | (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
1336 | (match_operand:SI 2 "const_int_operand" "i")) |
1337 | (match_operand:SI 3 "mask_operand" "L")))] | |
1338 | "includes_lshift_p (operands[2], operands[3])" | |
1339 | "rlinm %0,%h1,%h2,%m3,%M3") | |
1340 | ||
1341 | (define_insn "" | |
1342 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
1343 | (compare:CC | |
cd2b37d9 | 1344 | (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1345 | (match_operand:SI 2 "const_int_operand" "i")) |
1346 | (match_operand:SI 3 "mask_operand" "L")) | |
1347 | (const_int 0))) | |
1348 | (clobber (match_scratch:SI 4 "=r"))] | |
1349 | "includes_lshift_p (operands[2], operands[3])" | |
1350 | "rlinm. %4,%h1,%h2,%m3,%M3" | |
1351 | [(set_attr "type" "delayed_compare")]) | |
1352 | ||
1353 | (define_insn "" | |
1354 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
1355 | (compare:CC | |
cd2b37d9 | 1356 | (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1357 | (match_operand:SI 2 "const_int_operand" "i")) |
1358 | (match_operand:SI 3 "mask_operand" "L")) | |
1359 | (const_int 0))) | |
cd2b37d9 | 1360 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1361 | (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))] |
1362 | "includes_lshift_p (operands[2], operands[3])" | |
1363 | "rlinm. %0,%h1,%h2,%m3,%M3" | |
1364 | [(set_attr "type" "delayed_compare")]) | |
1365 | ||
5c23c401 RK |
1366 | ;; The RS/6000 assembler mis-handles "sri x,x,0", so write that case as |
1367 | ;; "sli x,x,0". | |
1fd4e8c1 | 1368 | (define_insn "lshrsi3" |
cd2b37d9 RK |
1369 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1370 | (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
1371 | (match_operand:SI 2 "reg_or_cint_operand" "r,i"))) |
1372 | (clobber (match_scratch:SI 3 "=q,X"))] | |
1373 | "" | |
1374 | "@ | |
1375 | sre %0,%1,%2 | |
5c23c401 | 1376 | s%A2i %0,%1,%h2") |
1fd4e8c1 RK |
1377 | |
1378 | (define_insn "" | |
1379 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x") | |
cd2b37d9 | 1380 | (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
1381 | (match_operand:SI 2 "reg_or_cint_operand" "r,i")) |
1382 | (const_int 0))) | |
1383 | (clobber (match_scratch:SI 3 "=r,r")) | |
1384 | (clobber (match_scratch:SI 4 "=q,X"))] | |
1385 | "" | |
1386 | "@ | |
1387 | sre. %3,%1,%2 | |
5c23c401 | 1388 | s%A2i. %3,%1,%h2" |
1fd4e8c1 RK |
1389 | [(set_attr "type" "delayed_compare")]) |
1390 | ||
1391 | (define_insn "" | |
1392 | [(set (match_operand:CC 3 "cc_reg_operand" "=x,x") | |
cd2b37d9 | 1393 | (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
1394 | (match_operand:SI 2 "reg_or_cint_operand" "r,i")) |
1395 | (const_int 0))) | |
cd2b37d9 | 1396 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
1397 | (lshiftrt:SI (match_dup 1) (match_dup 2))) |
1398 | (clobber (match_scratch:SI 4 "=q,X"))] | |
1399 | "" | |
1400 | "@ | |
1401 | sre. %0,%1,%2 | |
5c23c401 | 1402 | s%A2i. %0,%1,%h2" |
1fd4e8c1 RK |
1403 | [(set_attr "type" "delayed_compare")]) |
1404 | ||
1405 | (define_insn "" | |
cd2b37d9 RK |
1406 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1407 | (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
1408 | (match_operand:SI 2 "const_int_operand" "i")) |
1409 | (match_operand:SI 3 "mask_operand" "L")))] | |
1410 | "includes_rshift_p (operands[2], operands[3])" | |
1411 | "rlinm %0,%1,%s2,%m3,%M3") | |
1412 | ||
1413 | (define_insn "" | |
1414 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
1415 | (compare:CC | |
cd2b37d9 | 1416 | (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1417 | (match_operand:SI 2 "const_int_operand" "i")) |
1418 | (match_operand:SI 3 "mask_operand" "L")) | |
1419 | (const_int 0))) | |
1420 | (clobber (match_scratch:SI 4 "=r"))] | |
1421 | "includes_rshift_p (operands[2], operands[3])" | |
1422 | "rlinm. %4,%1,%s2,%m3,%M3" | |
1423 | [(set_attr "type" "delayed_compare")]) | |
1424 | ||
1425 | (define_insn "" | |
1426 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
1427 | (compare:CC | |
cd2b37d9 | 1428 | (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1429 | (match_operand:SI 2 "const_int_operand" "i")) |
1430 | (match_operand:SI 3 "mask_operand" "L")) | |
1431 | (const_int 0))) | |
cd2b37d9 | 1432 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1433 | (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))] |
1434 | "includes_rshift_p (operands[2], operands[3])" | |
1435 | "rlinm. %0,%1,%s2,%m3,%M3" | |
1436 | [(set_attr "type" "delayed_compare")]) | |
1437 | ||
1438 | (define_insn "" | |
cd2b37d9 | 1439 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1440 | (zero_extend:SI |
1441 | (subreg:QI | |
cd2b37d9 | 1442 | (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1443 | (match_operand:SI 2 "const_int_operand" "i")) 0)))] |
1444 | "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))" | |
1445 | "rlinm %0,%1,%s2,24,31") | |
1446 | ||
1447 | (define_insn "" | |
1448 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
1449 | (compare:CC | |
1450 | (zero_extend:SI | |
1451 | (subreg:QI | |
cd2b37d9 | 1452 | (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1453 | (match_operand:SI 2 "const_int_operand" "i")) 0)) |
1454 | (const_int 0))) | |
1455 | (clobber (match_scratch:SI 3 "=r"))] | |
1456 | "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))" | |
1457 | "rlinm. %3,%1,%s2,24,31" | |
1458 | [(set_attr "type" "delayed_compare")]) | |
1459 | ||
1460 | (define_insn "" | |
1461 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
1462 | (compare:CC | |
1463 | (zero_extend:SI | |
1464 | (subreg:QI | |
cd2b37d9 | 1465 | (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1466 | (match_operand:SI 2 "const_int_operand" "i")) 0)) |
1467 | (const_int 0))) | |
cd2b37d9 | 1468 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1469 | (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))] |
1470 | "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))" | |
1471 | "rlinm. %0,%1,%s2,24,31" | |
1472 | [(set_attr "type" "delayed_compare")]) | |
1473 | ||
1474 | (define_insn "" | |
cd2b37d9 | 1475 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1476 | (zero_extend:SI |
1477 | (subreg:HI | |
cd2b37d9 | 1478 | (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1479 | (match_operand:SI 2 "const_int_operand" "i")) 0)))] |
1480 | "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))" | |
1481 | "rlinm %0,%1,%s2,16,31") | |
1482 | ||
1483 | (define_insn "" | |
1484 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
1485 | (compare:CC | |
1486 | (zero_extend:SI | |
1487 | (subreg:HI | |
cd2b37d9 | 1488 | (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1489 | (match_operand:SI 2 "const_int_operand" "i")) 0)) |
1490 | (const_int 0))) | |
1491 | (clobber (match_scratch:SI 3 "=r"))] | |
1492 | "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))" | |
1493 | "rlinm. %3,%1,%s2,16,31" | |
1494 | [(set_attr "type" "delayed_compare")]) | |
1495 | ||
1496 | (define_insn "" | |
1497 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
1498 | (compare:CC | |
1499 | (zero_extend:SI | |
1500 | (subreg:HI | |
cd2b37d9 | 1501 | (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
1502 | (match_operand:SI 2 "const_int_operand" "i")) 0)) |
1503 | (const_int 0))) | |
cd2b37d9 | 1504 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
1505 | (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))] |
1506 | "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))" | |
1507 | "rlinm. %0,%1,%s2,16,31" | |
1508 | [(set_attr "type" "delayed_compare")]) | |
1509 | ||
1510 | (define_insn "" | |
cd2b37d9 | 1511 | [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r") |
1fd4e8c1 | 1512 | (const_int 1) |
cd2b37d9 RK |
1513 | (match_operand:SI 1 "gpc_reg_operand" "r")) |
1514 | (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
1515 | (const_int 31)))] |
1516 | "" | |
1517 | "rrib %0,%1,%2") | |
1518 | ||
1519 | (define_insn "" | |
cd2b37d9 | 1520 | [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r") |
1fd4e8c1 | 1521 | (const_int 1) |
cd2b37d9 RK |
1522 | (match_operand:SI 1 "gpc_reg_operand" "r")) |
1523 | (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
1524 | (const_int 31)))] |
1525 | "" | |
1526 | "rrib %0,%1,%2") | |
1527 | ||
1528 | (define_insn "" | |
cd2b37d9 | 1529 | [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r") |
1fd4e8c1 | 1530 | (const_int 1) |
cd2b37d9 RK |
1531 | (match_operand:SI 1 "gpc_reg_operand" "r")) |
1532 | (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
1533 | (const_int 1) |
1534 | (const_int 0)))] | |
1535 | "" | |
1536 | "rrib %0,%1,%2") | |
1537 | ||
1538 | (define_insn "ashrsi3" | |
cd2b37d9 RK |
1539 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1540 | (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
1541 | (match_operand:SI 2 "reg_or_cint_operand" "r,i"))) |
1542 | (clobber (match_scratch:SI 3 "=q,X"))] | |
1543 | "" | |
1544 | "@ | |
1545 | srea %0,%1,%2 | |
1546 | srai %0,%1,%h2") | |
1547 | ||
1548 | (define_insn "" | |
1549 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x") | |
cd2b37d9 | 1550 | (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
1551 | (match_operand:SI 2 "reg_or_cint_operand" "r,i")) |
1552 | (const_int 0))) | |
1553 | (clobber (match_scratch:SI 3 "=r,r")) | |
1554 | (clobber (match_scratch:SI 4 "=q,X"))] | |
1555 | "" | |
1556 | "@ | |
1557 | srea. %3,%1,%2 | |
1558 | srai. %3,%1,%h2" | |
1559 | [(set_attr "type" "delayed_compare")]) | |
1560 | ||
1561 | (define_insn "" | |
1562 | [(set (match_operand:CC 3 "cc_reg_operand" "=x,x") | |
cd2b37d9 | 1563 | (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
1564 | (match_operand:SI 2 "reg_or_cint_operand" "r,i")) |
1565 | (const_int 0))) | |
cd2b37d9 | 1566 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
1567 | (ashiftrt:SI (match_dup 1) (match_dup 2))) |
1568 | (clobber (match_scratch:SI 4 "=q,X"))] | |
1569 | "" | |
1570 | "@ | |
1571 | srea. %0,%1,%2 | |
1572 | srai. %0,%1,%h2" | |
1573 | [(set_attr "type" "delayed_compare")]) | |
1574 | ||
1575 | (define_expand "extendqisi2" | |
1576 | [(parallel [(set (match_dup 2) | |
cd2b37d9 | 1577 | (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1578 | (const_int 24))) |
1579 | (clobber (scratch:SI))]) | |
cd2b37d9 | 1580 | (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1581 | (ashiftrt:SI (match_dup 2) |
1582 | (const_int 24))) | |
1583 | (clobber (scratch:SI))])] | |
1584 | "" | |
1585 | " | |
1586 | { operands[1] = gen_lowpart (SImode, operands[1]); | |
1587 | operands[2] = gen_reg_rtx (SImode); }") | |
1588 | ||
1589 | (define_expand "extendqihi2" | |
1590 | [(parallel [(set (match_dup 2) | |
cd2b37d9 | 1591 | (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1592 | (const_int 24))) |
1593 | (clobber (scratch:SI))]) | |
cd2b37d9 | 1594 | (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1595 | (ashiftrt:SI (match_dup 2) |
1596 | (const_int 24))) | |
1597 | (clobber (scratch:SI))])] | |
1598 | "" | |
1599 | " | |
1600 | { operands[0] = gen_lowpart (SImode, operands[0]); | |
1601 | operands[1] = gen_lowpart (SImode, operands[1]); | |
1602 | operands[2] = gen_reg_rtx (SImode); }") | |
1603 | \f | |
1604 | ;; Floating-point insns, excluding normal data motion. | |
1605 | ;; | |
1606 | ;; We pretend that we have both SFmode and DFmode insns, while, in fact, | |
1607 | ;; all fp insns are actually done in double. The only conversions we will | |
1608 | ;; do will be when storing to memory. In that case, we will use the "frsp" | |
1609 | ;; instruction before storing. | |
1610 | ;; | |
1611 | ;; Note that when we store into a single-precision memory location, we need to | |
1612 | ;; use the frsp insn first. If the register being stored isn't dead, we | |
1613 | ;; need a scratch register for the frsp. But this is difficult when the store | |
1614 | ;; is done by reload. It is not incorrect to do the frsp on the register in | |
1615 | ;; this case, we just lose precision that we would have otherwise gotten but | |
1616 | ;; is not guaranteed. Perhaps this should be tightened up at some point. | |
1617 | ||
1618 | (define_insn "extendsfdf2" | |
cd2b37d9 RK |
1619 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1620 | (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1621 | "" |
1622 | "* | |
1623 | { | |
1624 | if (REGNO (operands[0]) == REGNO (operands[1])) | |
1625 | return \"\"; | |
1626 | else | |
1627 | return \"fmr %0,%1\"; | |
1628 | }" | |
1629 | [(set_attr "type" "fp")]) | |
1630 | ||
1631 | (define_insn "truncdfsf2" | |
cd2b37d9 RK |
1632 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1633 | (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1634 | "" |
1635 | "* | |
1636 | { | |
1637 | if (REGNO (operands[0]) == REGNO (operands[1])) | |
1638 | return \"\"; | |
1639 | else | |
1640 | return \"fmr %0,%1\"; | |
1641 | }" | |
1642 | [(set_attr "type" "fp")]) | |
1643 | ||
1644 | (define_insn "negsf2" | |
cd2b37d9 RK |
1645 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1646 | (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1647 | "" |
1648 | "fneg %0,%1" | |
1649 | [(set_attr "type" "fp")]) | |
1650 | ||
1651 | (define_insn "abssf2" | |
cd2b37d9 RK |
1652 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1653 | (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1654 | "" |
1655 | "fabs %0,%1" | |
1656 | [(set_attr "type" "fp")]) | |
1657 | ||
1658 | (define_insn "" | |
cd2b37d9 RK |
1659 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1660 | (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))] | |
1fd4e8c1 RK |
1661 | "" |
1662 | "fnabs %0,%1" | |
1663 | [(set_attr "type" "fp")]) | |
1664 | ||
1665 | (define_insn "addsf3" | |
cd2b37d9 RK |
1666 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1667 | (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f") | |
1668 | (match_operand:SF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1669 | "" |
1670 | "fa %0,%1,%2" | |
1671 | [(set_attr "type" "fp")]) | |
1672 | ||
1673 | (define_insn "subsf3" | |
cd2b37d9 RK |
1674 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1675 | (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f") | |
1676 | (match_operand:SF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1677 | "" |
1678 | "fs %0,%1,%2" | |
1679 | [(set_attr "type" "fp")]) | |
1680 | ||
1681 | (define_insn "mulsf3" | |
cd2b37d9 RK |
1682 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1683 | (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f") | |
1684 | (match_operand:SF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1685 | "" |
1686 | "fm %0,%1,%2" | |
1687 | [(set_attr "type" "fp")]) | |
1688 | ||
1689 | (define_insn "divsf3" | |
cd2b37d9 RK |
1690 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1691 | (div:SF (match_operand:SF 1 "gpc_reg_operand" "f") | |
1692 | (match_operand:SF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1693 | "" |
1694 | "fd %0,%1,%2" | |
1695 | [(set_attr "type" "fp")]) | |
1696 | ||
1697 | (define_insn "" | |
cd2b37d9 RK |
1698 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1699 | (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f") | |
1700 | (match_operand:SF 2 "gpc_reg_operand" "f")) | |
1701 | (match_operand:SF 3 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1702 | "" |
1703 | "fma %0,%1,%2,%3" | |
1704 | [(set_attr "type" "fp")]) | |
1705 | ||
1706 | (define_insn "" | |
cd2b37d9 RK |
1707 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1708 | (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f") | |
1709 | (match_operand:SF 2 "gpc_reg_operand" "f")) | |
1710 | (match_operand:SF 3 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1711 | "" |
1712 | "fms %0,%1,%2,%3" | |
1713 | [(set_attr "type" "fp")]) | |
1714 | ||
1715 | (define_insn "" | |
cd2b37d9 RK |
1716 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1717 | (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f") | |
1718 | (match_operand:SF 2 "gpc_reg_operand" "f")) | |
1719 | (match_operand:SF 3 "gpc_reg_operand" "f"))))] | |
1fd4e8c1 RK |
1720 | "" |
1721 | "fnma %0,%1,%2,%3" | |
1722 | [(set_attr "type" "fp")]) | |
1723 | ||
1724 | (define_insn "" | |
cd2b37d9 RK |
1725 | [(set (match_operand:SF 0 "gpc_reg_operand" "=f") |
1726 | (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f") | |
1727 | (match_operand:SF 2 "gpc_reg_operand" "f")) | |
1728 | (match_operand:SF 3 "gpc_reg_operand" "f"))))] | |
1fd4e8c1 RK |
1729 | "" |
1730 | "fnms %0,%1,%2,%3" | |
1731 | [(set_attr "type" "fp")]) | |
1732 | ||
1733 | (define_insn "negdf2" | |
cd2b37d9 RK |
1734 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1735 | (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1736 | "" |
1737 | "fneg %0,%1" | |
1738 | [(set_attr "type" "fp")]) | |
1739 | ||
1740 | (define_insn "absdf2" | |
cd2b37d9 RK |
1741 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1742 | (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1743 | "" |
1744 | "fabs %0,%1" | |
1745 | [(set_attr "type" "fp")]) | |
1746 | ||
1747 | (define_insn "" | |
cd2b37d9 RK |
1748 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1749 | (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))] | |
1fd4e8c1 RK |
1750 | "" |
1751 | "fnabs %0,%1" | |
1752 | [(set_attr "type" "fp")]) | |
1753 | ||
1754 | (define_insn "adddf3" | |
cd2b37d9 RK |
1755 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1756 | (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f") | |
1757 | (match_operand:DF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1758 | "" |
1759 | "fa %0,%1,%2" | |
1760 | [(set_attr "type" "fp")]) | |
1761 | ||
1762 | (define_insn "subdf3" | |
cd2b37d9 RK |
1763 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1764 | (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f") | |
1765 | (match_operand:DF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1766 | "" |
1767 | "fs %0,%1,%2" | |
1768 | [(set_attr "type" "fp")]) | |
1769 | ||
1770 | (define_insn "muldf3" | |
cd2b37d9 RK |
1771 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1772 | (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f") | |
1773 | (match_operand:DF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1774 | "" |
1775 | "fm %0,%1,%2" | |
1776 | [(set_attr "type" "fp")]) | |
1777 | ||
1778 | (define_insn "divdf3" | |
cd2b37d9 RK |
1779 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1780 | (div:DF (match_operand:DF 1 "gpc_reg_operand" "f") | |
1781 | (match_operand:DF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1782 | "" |
1783 | "fd %0,%1,%2" | |
1784 | [(set_attr "type" "fp")]) | |
1785 | ||
1786 | (define_insn "" | |
cd2b37d9 RK |
1787 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1788 | (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f") | |
1789 | (match_operand:DF 2 "gpc_reg_operand" "f")) | |
1790 | (match_operand:DF 3 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1791 | "" |
1792 | "fma %0,%1,%2,%3" | |
1793 | [(set_attr "type" "fp")]) | |
1794 | ||
1795 | (define_insn "" | |
cd2b37d9 RK |
1796 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1797 | (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f") | |
1798 | (match_operand:DF 2 "gpc_reg_operand" "f")) | |
1799 | (match_operand:DF 3 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
1800 | "" |
1801 | "fms %0,%1,%2,%3" | |
1802 | [(set_attr "type" "fp")]) | |
1803 | ||
1804 | (define_insn "" | |
cd2b37d9 RK |
1805 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1806 | (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f") | |
1807 | (match_operand:DF 2 "gpc_reg_operand" "f")) | |
1808 | (match_operand:DF 3 "gpc_reg_operand" "f"))))] | |
1fd4e8c1 RK |
1809 | "" |
1810 | "fnma %0,%1,%2,%3" | |
1811 | [(set_attr "type" "fp")]) | |
1812 | ||
1813 | (define_insn "" | |
cd2b37d9 RK |
1814 | [(set (match_operand:DF 0 "gpc_reg_operand" "=f") |
1815 | (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f") | |
1816 | (match_operand:DF 2 "gpc_reg_operand" "f")) | |
1817 | (match_operand:DF 3 "gpc_reg_operand" "f"))))] | |
1fd4e8c1 RK |
1818 | "" |
1819 | "fnms %0,%1,%2,%3" | |
1820 | [(set_attr "type" "fp")]) | |
1821 | \f | |
1822 | ;; Conversions to and from floating-point. | |
1823 | (define_expand "floatsidf2" | |
1824 | [(set (match_dup 2) | |
1825 | (plus:DI (zero_extend:DI | |
cd2b37d9 | 1826 | (xor:SI (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1827 | (match_dup 3))) |
1828 | (match_dup 4))) | |
cd2b37d9 | 1829 | (set (match_operand:DF 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1830 | (minus:DF (subreg:DF (match_dup 2) 0) |
1831 | (match_dup 5)))] | |
1832 | "" | |
1833 | " | |
1834 | { | |
1835 | #if HOST_BITS_PER_INT != BITS_PER_WORD | |
1836 | /* Maybe someone can figure out how to do this in that case. I don't | |
1837 | want to right now. */ | |
1838 | abort (); | |
1839 | #endif | |
1840 | ||
1841 | operands[2] = gen_reg_rtx (DImode); | |
1842 | operands[3] = gen_rtx (CONST_INT, VOIDmode, 0x80000000); | |
1843 | operands[4] = immed_double_const (0, 0x43300000, DImode); | |
1844 | operands[5] = force_reg (DFmode, immed_double_const (0x43300000, | |
1845 | 0x80000000, DFmode)); | |
1846 | }") | |
1847 | ||
1848 | (define_expand "floatunssidf2" | |
1849 | [(set (match_dup 2) | |
cd2b37d9 | 1850 | (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")) |
1fd4e8c1 | 1851 | (match_dup 3))) |
cd2b37d9 | 1852 | (set (match_operand:DF 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1853 | (minus:DF (subreg:DF (match_dup 2) 0) |
1854 | (match_dup 4)))] | |
1855 | "" | |
1856 | " | |
1857 | { | |
1858 | #if HOST_BITS_PER_INT != BITS_PER_WORD | |
1859 | /* Maybe someone can figure out how to do this in that case. I don't | |
1860 | want to right now. */ | |
1861 | abort (); | |
1862 | #endif | |
1863 | ||
1864 | operands[2] = gen_reg_rtx (DImode); | |
1865 | operands[3] = immed_double_const (0, 0x43300000, DImode); | |
1866 | operands[4] = force_reg (DFmode, immed_double_const (0x43300000, 0, DFmode)); | |
1867 | }") | |
1868 | ||
1869 | ;; For the above two cases, we always split. | |
1870 | (define_split | |
cd2b37d9 | 1871 | [(set (match_operand:DI 0 "gpc_reg_operand" "") |
1fd4e8c1 | 1872 | (plus:DI (zero_extend:DI |
cd2b37d9 | 1873 | (xor:SI (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1874 | (match_operand:SI 2 "logical_operand" ""))) |
1875 | (match_operand:DI 3 "immediate_operand" "")))] | |
1876 | "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD | |
1877 | && GET_CODE (operands[3]) == CONST_DOUBLE | |
1878 | && CONST_DOUBLE_LOW (operands[3]) == 0" | |
1879 | [(set (match_dup 6) (xor:SI (match_dup 1) (match_dup 2))) | |
1880 | (set (match_dup 4) (match_dup 5))] | |
1881 | " | |
1882 | { operands[4] = operand_subword (operands[0], 0, 0, DImode); | |
1883 | operands[5] = operand_subword (operands[3], 0, 0, DImode); | |
1884 | operands[6] = operand_subword (operands[0], 1, 0, DImode); | |
1885 | }") | |
1886 | ||
1887 | (define_insn "" | |
cd2b37d9 | 1888 | [(set (match_operand:DI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 | 1889 | (plus:DI (zero_extend:DI |
cd2b37d9 | 1890 | (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r") |
1fd4e8c1 RK |
1891 | (match_operand:SI 2 "logical_operand" "rKJ"))) |
1892 | (match_operand:DI 3 "immediate_operand" "n")))] | |
1893 | "HOST_BITS_PER_INT == BITS_PER_WORD | |
1894 | && GET_CODE (operands[3]) == CONST_DOUBLE | |
1895 | && CONST_DOUBLE_LOW (operands[3]) == 0" | |
1896 | "#") | |
1897 | ||
1898 | (define_split | |
cd2b37d9 RK |
1899 | [(set (match_operand:DI 0 "gpc_reg_operand" "=") |
1900 | (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")) | |
1fd4e8c1 RK |
1901 | (match_operand:DI 2 "immediate_operand" "")))] |
1902 | "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD | |
1903 | && GET_CODE (operands[2]) == CONST_DOUBLE | |
1904 | && CONST_DOUBLE_LOW (operands[2]) == 0" | |
1905 | [(set (match_dup 3) (match_dup 4)) | |
1906 | (set (match_dup 5) (match_dup 1))] | |
1907 | " | |
1908 | { operands[3] = operand_subword (operands[0], 0, 0, DImode); | |
1909 | operands[4] = operand_subword (operands[2], 0, 0, DImode); | |
1910 | operands[5] = operand_subword (operands[0], 1, 0, DImode); | |
1911 | ||
1912 | if (rtx_equal_p (operands[1], operands[5])) | |
1913 | { | |
1914 | emit_move_insn (operands[3], operands[4]); | |
1915 | DONE; | |
1916 | } | |
c283c989 RK |
1917 | |
1918 | if (rtx_equal_p (operands[1], operands[3])) | |
1919 | { | |
1920 | rtx temp; | |
1921 | ||
1922 | temp = operands[3]; operands[3] = operands[5]; operands[5] = temp; | |
1923 | temp = operands[4]; operands[4] = operands[1]; operands[1] = temp; | |
1924 | } | |
1fd4e8c1 RK |
1925 | }") |
1926 | ||
1927 | (define_insn "" | |
cd2b37d9 RK |
1928 | [(set (match_operand:DI 0 "gpc_reg_operand" "=r") |
1929 | (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")) | |
1fd4e8c1 RK |
1930 | (match_operand:DI 2 "immediate_operand" "n")))] |
1931 | "HOST_BITS_PER_INT == BITS_PER_WORD | |
1932 | && GET_CODE (operands[2]) == CONST_DOUBLE | |
1933 | && CONST_DOUBLE_LOW (operands[2]) == 0" | |
1934 | "#") | |
1935 | ||
1936 | (define_expand "fix_truncdfsi2" | |
cd2b37d9 RK |
1937 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
1938 | (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))] | |
1fd4e8c1 RK |
1939 | "" |
1940 | " | |
1941 | { | |
1942 | emit_insn (gen_trunc_call (operands[0], operands[1], | |
1943 | gen_rtx (SYMBOL_REF, Pmode, \"itrunc\"))); | |
1944 | DONE; | |
1945 | }") | |
1946 | ||
1947 | (define_expand "fixuns_truncdfsi2" | |
cd2b37d9 RK |
1948 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
1949 | (unsigned_fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))] | |
1fd4e8c1 RK |
1950 | "" |
1951 | " | |
1952 | { | |
1953 | emit_insn (gen_trunc_call (operands[0], operands[1], | |
1954 | gen_rtx (SYMBOL_REF, Pmode, \"uitrunc\"))); | |
1955 | DONE; | |
1956 | }") | |
1957 | ||
1958 | ||
1959 | (define_expand "trunc_call" | |
1960 | [(parallel [(set (match_operand:SI 0 "" "") | |
1961 | (fix:DF (match_operand:DF 1 "" ""))) | |
1962 | (use (match_operand:SI 2 "" ""))])] | |
1963 | "" | |
1964 | " | |
1965 | { | |
1966 | rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]); | |
1967 | rtx first = XVECEXP (insns, 0, 0); | |
1968 | rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1); | |
1969 | ||
1970 | REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last, | |
1971 | REG_NOTES (first)); | |
1972 | REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last)); | |
1973 | ||
1974 | emit_insn (insns); | |
1975 | DONE; | |
1976 | }") | |
1977 | ||
1978 | (define_expand "trunc_call_rtl" | |
cd2b37d9 | 1979 | [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" "")) |
1fd4e8c1 RK |
1980 | (use (reg:DF 33)) |
1981 | (parallel [(set (reg:SI 3) | |
1982 | (call (mem:SI (match_operand 2 "" "")) (const_int 0))) | |
1983 | (clobber (scratch:SI))]) | |
cd2b37d9 | 1984 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
1985 | (reg:SI 3))] |
1986 | "" | |
1987 | " | |
1988 | { | |
1989 | rs6000_trunc_used = 1; | |
1990 | }") | |
1991 | \f | |
1992 | ;; Define the DImode operations that can be done in a small number | |
1993 | ;; of instructions. | |
1994 | (define_insn "adddi3" | |
fa5679bb RK |
1995 | [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") |
1996 | (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r") | |
1997 | (match_operand:DI 2 "reg_or_short_operand" "r,I")))] | |
1fd4e8c1 | 1998 | "" |
fa5679bb RK |
1999 | "@ |
2000 | a %L0,%L1,%L2\;ae %0,%1,%2 | |
2001 | ai %L0,%L1,%2\;a%G2e %0,%1") | |
1fd4e8c1 RK |
2002 | |
2003 | (define_insn "subdi3" | |
fa5679bb RK |
2004 | [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") |
2005 | (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I") | |
2006 | (match_operand:DI 2 "gpc_reg_operand" "r,r")))] | |
1fd4e8c1 | 2007 | "" |
fa5679bb RK |
2008 | "@ |
2009 | sf %L0,%L2,%L1\;sfe %0,%2,%1 | |
2010 | sfi %L0,%L2,%1\;sf%G1e %0,%2") | |
1fd4e8c1 | 2011 | |
a8ddbf69 | 2012 | (define_insn "negdi2" |
cd2b37d9 RK |
2013 | [(set (match_operand:DI 0 "gpc_reg_operand" "=r") |
2014 | (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))] | |
1fd4e8c1 RK |
2015 | "" |
2016 | "sfi %L0,%L1,0\;sfze %0,%1") | |
2017 | ||
2018 | (define_insn "mulsidi3" | |
cd2b37d9 RK |
2019 | [(set (match_operand:DI 0 "gpc_reg_operand" "=r") |
2020 | (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")) | |
2021 | (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r")))) | |
1fd4e8c1 RK |
2022 | (clobber (match_scratch:SI 3 "=q"))] |
2023 | "" | |
2024 | "mul %0,%1,%2\;mfmq %L0") | |
2025 | ||
2026 | ;; If operands 0 and 2 are in the same register, we have a problem. But | |
2027 | ;; operands 0 and 1 (the usual case) can be in the same register. That's | |
2028 | ;; why we have the strange constraints below. | |
2029 | (define_insn "ashldi3" | |
cd2b37d9 RK |
2030 | [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r") |
2031 | (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r") | |
1fd4e8c1 RK |
2032 | (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r"))) |
2033 | (clobber (match_scratch:SI 3 "=X,q,q,q"))] | |
2034 | "" | |
2035 | "@ | |
2036 | sli %0,%L1,%h2\;cal %L0,0(0) | |
2037 | sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2 | |
2038 | sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2 | |
5c23c401 | 2039 | sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2") |
1fd4e8c1 RK |
2040 | |
2041 | (define_insn "lshrdi3" | |
cd2b37d9 RK |
2042 | [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r") |
2043 | (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r") | |
1fd4e8c1 RK |
2044 | (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r"))) |
2045 | (clobber (match_scratch:SI 3 "=X,q,q,q"))] | |
2046 | "" | |
2047 | "@ | |
5c23c401 | 2048 | cal %0,0(0)\;s%A2i %L0,%1,%h2 |
46a48c7f RK |
2049 | sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2 |
2050 | sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2 | |
2051 | sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2") | |
1fd4e8c1 RK |
2052 | |
2053 | ;; Shift by a variable amount is too complex to be worth open-coding. We | |
2054 | ;; just handle shifts by constants. | |
2055 | ||
2056 | (define_expand "ashrdi3" | |
cd2b37d9 RK |
2057 | [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=") |
2058 | (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "") | |
1fd4e8c1 RK |
2059 | (match_operand:SI 2 "general_operand" ""))) |
2060 | (clobber (match_scratch:SI 3 ""))])] | |
2061 | "" | |
2062 | " | |
2063 | { if (GET_CODE (operands[2]) != CONST_INT) | |
2064 | FAIL; | |
2065 | }") | |
2066 | ||
2067 | (define_insn "" | |
cd2b37d9 RK |
2068 | [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") |
2069 | (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
2070 | (match_operand:SI 2 "const_int_operand" "M,i"))) |
2071 | (clobber (match_scratch:SI 3 "=X,q"))] | |
2072 | "" | |
2073 | "@ | |
2074 | srai %0,%1,31\;srai %L0,%1,%h2 | |
46a48c7f | 2075 | sraiq %0,%1,%h2\;srliq %L0,%L1,%h2") |
1fd4e8c1 RK |
2076 | \f |
2077 | ;; Now define ways of moving data around. | |
2078 | ;; | |
2079 | ;; For SI, we special-case integers that can't be loaded in one insn. We | |
2080 | ;; do the load 16-bits at a time. We could do this by loading from memory, | |
2081 | ;; and this is even supposed to be faster, but it is simpler not to get | |
2082 | ;; integers in the TOC. | |
2083 | (define_expand "movsi" | |
2084 | [(set (match_operand:SI 0 "general_operand" "") | |
2085 | (match_operand:SI 1 "any_operand" ""))] | |
2086 | "" | |
2087 | " | |
2088 | { | |
2089 | if (GET_CODE (operands[0]) != REG) | |
2090 | operands[1] = force_reg (SImode, operands[1]); | |
2091 | ||
2092 | if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT) | |
2093 | operands[1] = force_const_mem (SImode, operands[1]); | |
2094 | ||
2095 | if (GET_CODE (operands[1]) == CONST_INT | |
2096 | && (unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000 | |
2097 | && (INTVAL (operands[1]) & 0xffff) != 0) | |
2098 | { | |
2099 | emit_move_insn (operands[0], | |
2100 | gen_rtx (CONST_INT, VOIDmode, | |
2101 | INTVAL (operands[1]) & 0xffff0000)); | |
2102 | emit_insn (gen_iorsi3 (operands[0], operands[0], | |
2103 | gen_rtx (CONST_INT, VOIDmode, | |
2104 | INTVAL (operands[1]) & 0xffff))); | |
2105 | DONE; | |
2106 | } | |
2107 | }") | |
2108 | ||
2109 | (define_insn "" | |
e76e75bb RK |
2110 | [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m,r,r,r,*c*q,*l,*h") |
2111 | (match_operand:SI 1 "input_operand" "r,m,r,I,J,*h,r,r,0"))] | |
cd2b37d9 RK |
2112 | "gpc_reg_operand (operands[0], SImode) |
2113 | || gpc_reg_operand (operands[1], SImode)" | |
1fd4e8c1 RK |
2114 | "@ |
2115 | ai %0,%1,0 | |
2116 | l%U1%X1 %0,%1 | |
2117 | st%U0%X0 %1,%0 | |
2118 | cal %0,%1(0) | |
2119 | cau %0,0,%u1 | |
2120 | mf%1 %0 | |
5c23c401 | 2121 | mt%0 %1 |
e76e75bb RK |
2122 | mt%0 %1 |
2123 | cror 0,0,0" | |
2124 | [(set_attr "type" "*,load,*,*,*,*,*,mtlr,*")]) | |
1fd4e8c1 | 2125 | |
77fa0940 RK |
2126 | ;; Split a load of a large constant into the appropriate two-insn |
2127 | ;; sequence. | |
2128 | ||
2129 | (define_split | |
2130 | [(set (match_operand:SI 0 "gpc_reg_operand" "") | |
2131 | (match_operand:SI 1 "const_int_operand" ""))] | |
2132 | "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000 | |
2133 | && (INTVAL (operands[1]) & 0xffff) != 0" | |
2134 | [(set (match_dup 0) | |
2135 | (match_dup 2)) | |
2136 | (set (match_dup 0) | |
2137 | (ior:SI (match_dup 0) | |
2138 | (match_dup 3)))] | |
2139 | " | |
2140 | { | |
2141 | operands[2] = gen_rtx (CONST_INT, VOIDmode, | |
2142 | INTVAL (operands[1]) & 0xffff0000); | |
2143 | operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff); | |
2144 | }") | |
2145 | ||
1fd4e8c1 RK |
2146 | (define_insn "" |
2147 | [(set (match_operand:CC 2 "cc_reg_operand" "=x") | |
cd2b37d9 | 2148 | (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 2149 | (const_int 0))) |
cd2b37d9 | 2150 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))] |
1fd4e8c1 RK |
2151 | "" |
2152 | "ai. %0,%1,0" | |
2153 | [(set_attr "type" "compare")]) | |
2154 | \f | |
2155 | (define_expand "movhi" | |
2156 | [(set (match_operand:HI 0 "general_operand" "") | |
2157 | (match_operand:HI 1 "any_operand" ""))] | |
2158 | "" | |
2159 | " | |
2160 | { | |
2161 | if (GET_CODE (operands[0]) != REG) | |
2162 | operands[1] = force_reg (HImode, operands[1]); | |
2163 | ||
2164 | if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT) | |
2165 | operands[1] = force_const_mem (HImode, operands[1]); | |
2166 | }") | |
2167 | ||
2168 | (define_insn "" | |
e76e75bb RK |
2169 | [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*h,*h") |
2170 | (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))] | |
cd2b37d9 RK |
2171 | "gpc_reg_operand (operands[0], HImode) |
2172 | || gpc_reg_operand (operands[1], HImode)" | |
1fd4e8c1 RK |
2173 | "@ |
2174 | oril %0,%1,0 | |
2175 | lhz%U1%X1 %0,%1 | |
2176 | sth%U0%X0 %1,%0 | |
2177 | cal %0,%w1(0) | |
2178 | mf%1 %0 | |
e76e75bb RK |
2179 | mt%0 %1 |
2180 | cror 0,0,0" | |
2181 | [(set_attr "type" "*,load,*,*,*,*,*")]) | |
1fd4e8c1 RK |
2182 | |
2183 | (define_expand "movqi" | |
2184 | [(set (match_operand:QI 0 "general_operand" "") | |
2185 | (match_operand:QI 1 "any_operand" ""))] | |
2186 | "" | |
2187 | " | |
2188 | { | |
2189 | if (GET_CODE (operands[0]) != REG) | |
2190 | operands[1] = force_reg (QImode, operands[1]); | |
2191 | ||
2192 | if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT) | |
2193 | operands[1] = force_const_mem (QImode, operands[1]); | |
2194 | }") | |
2195 | ||
2196 | (define_insn "" | |
e76e75bb RK |
2197 | [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*h,*h") |
2198 | (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))] | |
cd2b37d9 RK |
2199 | "gpc_reg_operand (operands[0], QImode) |
2200 | || gpc_reg_operand (operands[1], QImode)" | |
1fd4e8c1 RK |
2201 | "@ |
2202 | oril %0,%1,0 | |
2203 | lbz%U1%X1 %0,%1 | |
2204 | stb%U0%X0 %1,%0 | |
2205 | cal %0,%1(0) | |
2206 | mf%1 %0 | |
e76e75bb RK |
2207 | mt%0 %1 |
2208 | cror 0,0,0" | |
2209 | [(set_attr "type" "*,load,*,*,*,*,*")]) | |
1fd4e8c1 RK |
2210 | \f |
2211 | ;; Here is how to move condition codes around. When we store CC data in | |
2212 | ;; an integer register or memory, we store just the high-order 4 bits. | |
2213 | ;; This lets us not shift in the most common case of CR0. | |
2214 | (define_expand "movcc" | |
2215 | [(set (match_operand:CC 0 "nonimmediate_operand" "") | |
2216 | (match_operand:CC 1 "nonimmediate_operand" ""))] | |
2217 | "" | |
2218 | "") | |
2219 | ||
2220 | (define_insn "" | |
2221 | [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m") | |
2222 | (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))] | |
2223 | "register_operand (operands[0], CCmode) | |
2224 | || register_operand (operands[1], CCmode)" | |
2225 | "@ | |
2226 | mcrf %0,%1 | |
2227 | mtcrf 128,%1 | |
2228 | rlinm %1,%1,%F0,0,31\;mtcrf %R0,%1\;rlinm %1,%1,%f0,0,31 | |
2229 | mfcr %0 | |
2230 | mfcr %0\;rlinm %0,%0,%f1,0,3 | |
2231 | ai %0,%1,0 | |
2232 | l%U1%X1 %0,%1 | |
2233 | st%U0%U1 %1,%0" | |
2234 | [(set_attr "type" "*,*,*,compare,*,*,load,*")]) | |
2235 | \f | |
2236 | ;; For floating-point, we normally deal with the floating-point registers. | |
2237 | ;; The sole exception is that parameter passing can produce floating-point | |
2238 | ;; values in fixed-point registers. Unless the value is a simple constant | |
2239 | ;; or already in memory, we deal with this by allocating memory and copying | |
2240 | ;; the value explicitly via that memory location. | |
2241 | (define_expand "movsf" | |
2242 | [(set (match_operand:SF 0 "nonimmediate_operand" "") | |
2243 | (match_operand:SF 1 "any_operand" ""))] | |
2244 | "" | |
2245 | " | |
2246 | { | |
2247 | /* If we are called from reload, we might be getting a SUBREG of a hard | |
2248 | reg. So expand it. */ | |
2249 | if (GET_CODE (operands[0]) == SUBREG | |
2250 | && GET_CODE (SUBREG_REG (operands[0])) == REG | |
2251 | && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER) | |
2252 | operands[0] = alter_subreg (operands[0]); | |
2253 | if (GET_CODE (operands[1]) == SUBREG | |
2254 | && GET_CODE (SUBREG_REG (operands[1])) == REG | |
2255 | && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER) | |
2256 | operands[1] = alter_subreg (operands[1]); | |
2257 | ||
2258 | /* If we are being called from reload, it is possible that operands[1] | |
2259 | is a hard non-fp register. So handle those cases. */ | |
2260 | if (reload_in_progress && GET_CODE (operands[1]) == REG | |
2261 | && REGNO (operands[1]) < 32) | |
2262 | { | |
2263 | rtx stack_slot; | |
2264 | ||
2265 | /* Remember that we only see a pseudo here if it didn't get a hard | |
2266 | register, so it is memory. */ | |
2267 | if (GET_CODE (operands[0]) == MEM | |
2268 | || (GET_CODE (operands[0]) == REG | |
2269 | && (REGNO (operands[0]) < 32 | |
2270 | || REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)) | |
2271 | || (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)) | |
2272 | { | |
2273 | emit_move_insn (operand_subword (operands[0], 0, 0, SFmode), | |
2274 | operand_subword (operands[1], 0, 0, SFmode)); | |
2275 | DONE; | |
2276 | } | |
2277 | ||
2278 | stack_slot = gen_rtx (MEM, SFmode, plus_constant (stack_pointer_rtx, 4)); | |
2279 | emit_move_insn (stack_slot, operands[1]); | |
2280 | emit_move_insn (operands[0], stack_slot); | |
2281 | DONE; | |
2282 | } | |
2283 | ||
2284 | if (GET_CODE (operands[0]) == MEM) | |
2285 | operands[1] = force_reg (SFmode, operands[1]); | |
2286 | ||
2287 | if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32) | |
2288 | { | |
2289 | rtx stack_slot; | |
2290 | ||
2291 | if (GET_CODE (operands[1]) == MEM | |
2292 | #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE) | |
2293 | || GET_CODE (operands[1]) == CONST_DOUBLE | |
2294 | #endif | |
2295 | || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32) | |
2296 | || (reload_in_progress && GET_CODE (operands[1]) == REG | |
2297 | && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)) | |
2298 | { | |
2299 | emit_move_insn (operand_subword (operands[0], 0, 0, SFmode), | |
2300 | operand_subword (operands[1], 0, 0, SFmode)); | |
2301 | DONE; | |
2302 | } | |
2303 | ||
2304 | if (reload_in_progress) | |
2305 | stack_slot = gen_rtx (MEM, SFmode, | |
2306 | plus_constant (stack_pointer_rtx, 4)); | |
2307 | else | |
2308 | stack_slot = assign_stack_temp (SFmode, 4, 0); | |
2309 | emit_move_insn (stack_slot, operands[1]); | |
2310 | emit_move_insn (operands[0], stack_slot); | |
2311 | DONE; | |
2312 | } | |
2313 | ||
2314 | if (CONSTANT_P (operands[1])) | |
2315 | { | |
2316 | operands[1] = force_const_mem (SFmode, operands[1]); | |
2317 | if (! memory_address_p (SFmode, XEXP (operands[1], 0)) | |
2318 | && ! reload_in_progress) | |
2319 | operands[1] = change_address (operands[1], SFmode, | |
2320 | XEXP (operands[1], 0)); | |
2321 | } | |
2322 | }") | |
2323 | ||
2324 | (define_insn "" | |
cd2b37d9 | 2325 | [(set (match_operand:SF 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
2326 | (match_operand:SF 1 "mem_or_easy_const_operand" "G,m"))] |
2327 | "REGNO (operands[0]) <= 31" | |
2328 | "@ | |
2329 | # | |
2330 | l%U1%X1 %0,%1" | |
2331 | [(set_attr "type" "*,load")]) | |
2332 | ||
2333 | (define_split | |
cd2b37d9 | 2334 | [(set (match_operand:SF 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
2335 | (match_operand:SF 1 "easy_fp_constant" ""))] |
2336 | "reload_completed && REGNO (operands[0]) <= 31" | |
2337 | [(set (match_dup 2) (match_dup 3))] | |
2338 | " | |
2339 | { operands[2] = operand_subword (operands[0], 0, 0, SFmode); | |
2340 | operands[3] = operand_subword (operands[1], 0, 0, SFmode); }") | |
2341 | ||
2342 | (define_insn "" | |
2343 | [(set (match_operand:SF 0 "fp_reg_or_mem_operand" "=f,f,m") | |
2344 | (match_operand:SF 1 "input_operand" "f,m,f"))] | |
cd2b37d9 RK |
2345 | "gpc_reg_operand (operands[0], SFmode) |
2346 | || gpc_reg_operand (operands[1], SFmode)" | |
1fd4e8c1 RK |
2347 | "@ |
2348 | fmr %0,%1 | |
2349 | lfs%U1%X1 %0,%1 | |
2350 | frsp %1,%1\;stfs%U0%X0 %1,%0" | |
2351 | [(set_attr "type" "fp,load,*")]) | |
2352 | \f | |
2353 | (define_expand "movdf" | |
2354 | [(set (match_operand:DF 0 "nonimmediate_operand" "") | |
2355 | (match_operand:DF 1 "any_operand" ""))] | |
2356 | "" | |
2357 | " | |
2358 | { | |
2359 | /* If we are called from reload, we might be getting a SUBREG of a hard | |
2360 | reg. So expand it. */ | |
2361 | if (GET_CODE (operands[0]) == SUBREG | |
2362 | && GET_CODE (SUBREG_REG (operands[0])) == REG | |
2363 | && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER) | |
2364 | operands[0] = alter_subreg (operands[0]); | |
2365 | if (GET_CODE (operands[1]) == SUBREG | |
2366 | && GET_CODE (SUBREG_REG (operands[1])) == REG | |
2367 | && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER) | |
2368 | operands[1] = alter_subreg (operands[1]); | |
2369 | ||
2370 | /* If we are being called from reload, it is possible that operands[1] | |
2371 | is a hard non-fp register. So handle those cases. */ | |
2372 | if (reload_in_progress && GET_CODE (operands[1]) == REG | |
2373 | && REGNO (operands[1]) < 32) | |
2374 | { | |
2375 | rtx stack_slot; | |
2376 | ||
2377 | /* Remember that we only see a pseudo here if it didn't get a hard | |
2378 | register, so it is memory. */ | |
2379 | if (GET_CODE (operands[0]) == MEM | |
2380 | || (GET_CODE (operands[0]) == REG | |
2381 | && (REGNO (operands[0]) < 32 | |
2382 | || REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))) | |
2383 | { | |
2384 | emit_move_insn (operand_subword (operands[0], 0, 0, DFmode), | |
2385 | operand_subword (operands[1], 0, 0, DFmode)); | |
2386 | emit_move_insn (operand_subword (operands[0], 1, 0, DFmode), | |
2387 | operand_subword (operands[1], 1, 0, DFmode)); | |
2388 | DONE; | |
2389 | } | |
2390 | ||
2391 | stack_slot = gen_rtx (MEM, DFmode, plus_constant (stack_pointer_rtx, 8)); | |
2392 | emit_move_insn (stack_slot, operands[1]); | |
2393 | emit_move_insn (operands[0], stack_slot); | |
2394 | DONE; | |
2395 | } | |
2396 | ||
2397 | if (GET_CODE (operands[0]) == MEM) | |
2398 | { | |
2399 | if (GET_CODE (operands[1]) == MEM) | |
2400 | { | |
2401 | emit_move_insn (operand_subword (operands[0], 0, 0, DFmode), | |
2402 | operand_subword (operands[1], 0, 0, DFmode)); | |
2403 | emit_move_insn (operand_subword (operands[0], 1, 0, DFmode), | |
2404 | operand_subword (operands[1], 1, 0, DFmode)); | |
2405 | DONE; | |
2406 | } | |
2407 | ||
2408 | operands[1] = force_reg (DFmode, operands[1]); | |
2409 | } | |
2410 | ||
2411 | if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32) | |
2412 | { | |
2413 | rtx stack_slot; | |
2414 | ||
2415 | if (GET_CODE (operands[1]) == MEM | |
2416 | #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE) | |
2417 | || GET_CODE (operands[1]) == CONST_DOUBLE | |
2418 | #endif | |
2419 | || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32) | |
2420 | || (reload_in_progress && GET_CODE (operands[1]) == REG | |
2421 | && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)) | |
2422 | { | |
2423 | emit_move_insn (operand_subword (operands[0], 0, 0, DFmode), | |
2424 | operand_subword (operands[1], 0, 0, DFmode)); | |
2425 | emit_move_insn (operand_subword (operands[0], 1, 0, DFmode), | |
2426 | operand_subword (operands[1], 1, 0, DFmode)); | |
2427 | DONE; | |
2428 | } | |
2429 | ||
2430 | if (reload_in_progress) | |
2431 | stack_slot = gen_rtx (MEM, DFmode, | |
2432 | plus_constant (stack_pointer_rtx, 8)); | |
2433 | else | |
2434 | stack_slot = assign_stack_temp (DFmode, 8, 0); | |
2435 | emit_move_insn (stack_slot, operands[1]); | |
2436 | emit_move_insn (operands[0], stack_slot); | |
2437 | DONE; | |
2438 | } | |
2439 | ||
2440 | if (CONSTANT_P (operands[1])) | |
2441 | { | |
2442 | operands[1] = force_const_mem (DFmode, operands[1]); | |
2443 | if (! memory_address_p (DFmode, XEXP (operands[1], 0)) | |
2444 | && ! reload_in_progress) | |
2445 | operands[1] = change_address (operands[1], DFmode, | |
2446 | XEXP (operands[1], 0)); | |
2447 | } | |
2448 | }") | |
2449 | ||
2450 | (define_insn "" | |
cd2b37d9 | 2451 | [(set (match_operand:DF 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
2452 | (match_operand:DF 1 "mem_or_easy_const_operand" "G,m"))] |
2453 | "REGNO (operands[0]) <= 31" | |
2454 | "@ | |
2455 | # | |
2456 | l %0,%1\;l %L0,%L1" | |
2457 | [(set_attr "type" "*,load")]) | |
2458 | ||
2459 | (define_split | |
cd2b37d9 | 2460 | [(set (match_operand:DF 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
2461 | (match_operand:DF 1 "easy_fp_constant" ""))] |
2462 | "reload_completed && REGNO (operands[0]) <= 31" | |
2463 | [(set (match_dup 2) (match_dup 3)) | |
2464 | (set (match_dup 4) (match_dup 5))] | |
2465 | " | |
2466 | { operands[2] = operand_subword (operands[0], 0, 0, DFmode); | |
2467 | operands[3] = operand_subword (operands[1], 0, 0, DFmode); | |
2468 | operands[4] = operand_subword (operands[0], 1, 0, DFmode); | |
2469 | operands[5] = operand_subword (operands[1], 1, 0, DFmode); }") | |
2470 | ||
2471 | (define_insn "" | |
2472 | [(set (match_operand:DF 0 "fp_reg_or_mem_operand" "=f,f,m") | |
2473 | (match_operand:DF 1 "fp_reg_or_mem_operand" "f,m,f"))] | |
cd2b37d9 RK |
2474 | "gpc_reg_operand (operands[0], DFmode) |
2475 | || gpc_reg_operand (operands[1], DFmode)" | |
1fd4e8c1 RK |
2476 | "@ |
2477 | fmr %0,%1 | |
2478 | lfd%U1%X1 %0,%1 | |
2479 | stfd%U0%X0 %1,%0" | |
2480 | [(set_attr "type" "fp,load,*")]) | |
2481 | \f | |
2482 | ;; Next come the multi-word integer load and store and the load and store | |
2483 | ;; multiple insns. | |
2484 | (define_expand "movdi" | |
2485 | [(set (match_operand:DI 0 "general_operand" "") | |
2486 | (match_operand:DI 1 "general_operand" ""))] | |
2487 | "" | |
2488 | " | |
2489 | { | |
062284d8 RK |
2490 | if (GET_CODE (operands[1]) == CONST_DOUBLE |
2491 | || GET_CODE (operands[1]) == CONST_INT) | |
1fd4e8c1 RK |
2492 | { |
2493 | emit_move_insn (operand_subword (operands[0], 0, 0, DImode), | |
2494 | operand_subword (operands[1], 0, 0, DImode)); | |
2495 | emit_move_insn (operand_subword (operands[0], 1, 0, DImode), | |
2496 | operand_subword (operands[1], 1, 0, DImode)); | |
2497 | DONE; | |
2498 | } | |
062284d8 RK |
2499 | |
2500 | if (GET_CODE (operands[0]) == MEM) | |
2501 | operands[1] = force_reg (DImode, operands[1]); | |
1fd4e8c1 RK |
2502 | }") |
2503 | ||
2504 | (define_insn "" | |
2505 | [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m") | |
2506 | (match_operand:DI 1 "input_operand" "r,m,r"))] | |
cd2b37d9 RK |
2507 | "gpc_reg_operand (operands[0], DImode) |
2508 | || gpc_reg_operand (operands[1], DImode)" | |
1fd4e8c1 RK |
2509 | "* |
2510 | { | |
2511 | switch (which_alternative) | |
2512 | { | |
2513 | case 0: | |
2514 | /* We normally copy the low-numbered register first. However, if | |
2515 | the first register operand 0 is the same as the second register of | |
2516 | operand 1, we must copy in the opposite order. */ | |
2517 | if (REGNO (operands[0]) == REGNO (operands[1]) + 1) | |
2518 | return \"oril %L0,%L1,0\;oril %0,%1,0\"; | |
2519 | else | |
2520 | return \"oril %0,%1,0\;oril %L0,%L1,0\"; | |
2521 | case 1: | |
2522 | /* If the low-address word is used in the address, we must load it | |
2523 | last. Otherwise, load it first. Note that we cannot have | |
2524 | auto-increment in that case since the address register is known to be | |
2525 | dead. */ | |
2526 | if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1, | |
2527 | operands [1], 0)) | |
2528 | return \"l %L0,%L1\;l %0,%1\"; | |
2529 | else | |
2530 | return \"l%U1 %0,%1\;l %L0,%L1\"; | |
2531 | case 2: | |
2532 | return \"st%U0 %1,%0\;st %L1,%L0\"; | |
2533 | } | |
2534 | }" | |
2535 | [(set_attr "type" "*,load,*")]) | |
2536 | \f | |
2537 | ;; TImode is similar, except that we usually want to compute the address into | |
2538 | ;; a register and use lsi/stsi (the exception is during reload). MQ is also | |
2539 | ;; clobbered in stsi, so we need a SCRATCH for it. | |
2540 | (define_expand "movti" | |
2541 | [(parallel [(set (match_operand:TI 0 "general_operand" "") | |
2542 | (match_operand:TI 1 "general_operand" "")) | |
2543 | (clobber (scratch:SI))])] | |
2544 | "" | |
2545 | " | |
2546 | { | |
2547 | if (GET_CODE (operands[0]) == MEM) | |
2548 | operands[1] = force_reg (TImode, operands[1]); | |
2549 | ||
2550 | if (GET_CODE (operands[0]) == MEM | |
2551 | && GET_CODE (XEXP (operands[0], 0)) != REG | |
2552 | && ! reload_in_progress) | |
2553 | operands[0] = change_address (operands[0], TImode, | |
2554 | copy_addr_to_reg (XEXP (operands[0], 0))); | |
2555 | ||
2556 | if (GET_CODE (operands[1]) == MEM | |
2557 | && GET_CODE (XEXP (operands[1], 0)) != REG | |
2558 | && ! reload_in_progress) | |
2559 | operands[1] = change_address (operands[1], TImode, | |
2560 | copy_addr_to_reg (XEXP (operands[1], 0))); | |
2561 | }") | |
2562 | ||
2563 | ;; We say that MQ is clobbered in the last alternative because the first | |
2564 | ;; alternative would never get used otherwise since it would need a reload | |
2565 | ;; while the 2nd alternative would not. We put memory cases first so they | |
2566 | ;; are preferred. Otherwise, we'd try to reload the output instead of | |
2567 | ;; giving the SCRATCH mq. | |
2568 | (define_insn "" | |
2569 | [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,r,r,r") | |
2570 | (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m")) | |
2571 | (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))] | |
cd2b37d9 RK |
2572 | "gpc_reg_operand (operands[0], TImode) |
2573 | || gpc_reg_operand (operands[1], TImode)" | |
1fd4e8c1 RK |
2574 | "* |
2575 | { | |
2576 | switch (which_alternative) | |
2577 | { | |
2578 | case 0: | |
2579 | return \"stsi %1,%P0,16\"; | |
2580 | ||
2581 | case 1: | |
2582 | return \"st%U0 %1,%0\;st %L1,%L0\;st %Y1,%Y0\;st %Z1,%Z0\"; | |
2583 | ||
2584 | case 2: | |
2585 | /* Normally copy registers with lowest numbered register copied first. | |
2586 | But copy in the other order if the first register of the output | |
2587 | is the second, third, or fourth register in the input. */ | |
2588 | if (REGNO (operands[0]) >= REGNO (operands[1]) + 1 | |
2589 | && REGNO (operands[0]) <= REGNO (operands[1]) + 3) | |
2590 | return \"oril %Z0,%Z1,0\;oril %Y0,%Y1,0\;oril %L0,%L1,0\;oril %0,%1,0\"; | |
2591 | else | |
2592 | return \"oril %0,%1,0\;oril %L0,%L1,0\;oril %Y0,%Y1,0\;oril %Z0,%Z1,0\"; | |
2593 | case 3: | |
2594 | /* If the address is not used in the output, we can use lsi. Otherwise, | |
2595 | fall through to generating four loads. */ | |
2596 | if (! reg_overlap_mentioned_p (operands[0], operands[1])) | |
2597 | return \"lsi %0,%P1,16\"; | |
2598 | /* ... fall through ... */ | |
2599 | case 4: | |
2600 | /* If the address register is the same as the register for the lowest- | |
2601 | addressed word, load it last. Similarly for the next two words. | |
2602 | Otherwise load lowest address to highest. */ | |
2603 | if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1, | |
2604 | operands[1], 0)) | |
2605 | return \"l %L0,%L1\;l %Y0,%Y1\;l %Z0,%Z1\;l %0,%1\"; | |
2606 | else if (refers_to_regno_p (REGNO (operands[0]) + 1, | |
2607 | REGNO (operands[0]) + 2, operands[1], 0)) | |
2608 | return \"l %0,%1\;l %Y0,%Y1\;l %Z0,%Z1\;l %L0,%L1\"; | |
2609 | else if (refers_to_regno_p (REGNO (operands[0]) + 2, | |
2610 | REGNO (operands[0]) + 3, operands[1], 0)) | |
2611 | return \"l %0,%1\;l %L0,%L1\;l %Z0,%Z1\;l %Y0,%Y1\"; | |
2612 | else | |
2613 | return \"l%U1 %0,%1\;l %L0,%L1\;l %Y0,%Y1\;l %Z0,%Z1\"; | |
2614 | } | |
2615 | }" | |
2616 | [(set_attr "type" "*,load,load,*,*")]) | |
2617 | \f | |
2618 | (define_expand "load_multiple" | |
2f622005 RK |
2619 | [(match_par_dup 3 [(set (match_operand:SI 0 "" "") |
2620 | (match_operand:SI 1 "" "")) | |
2621 | (use (match_operand:SI 2 "" ""))])] | |
1fd4e8c1 RK |
2622 | "" |
2623 | " | |
2624 | { | |
2625 | int regno; | |
2626 | int count; | |
2627 | rtx from; | |
2628 | int i; | |
2629 | ||
2630 | /* Support only loading a constant number of fixed-point registers from | |
2631 | memory and only bother with this if more than two; the machine | |
2632 | doesn't support more than eight. */ | |
2633 | if (GET_CODE (operands[2]) != CONST_INT | |
2634 | || INTVAL (operands[2]) <= 2 | |
2635 | || INTVAL (operands[2]) > 8 | |
2636 | || GET_CODE (operands[1]) != MEM | |
2637 | || GET_CODE (operands[0]) != REG | |
2638 | || REGNO (operands[0]) >= 32) | |
2639 | FAIL; | |
2640 | ||
2641 | count = INTVAL (operands[2]); | |
2642 | regno = REGNO (operands[0]); | |
2643 | ||
2644 | operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count)); | |
2645 | from = force_reg (SImode, XEXP (operands[1], 0)); | |
2646 | ||
2647 | for (i = 0; i < count; i++) | |
2648 | XVECEXP (operands[3], 0, i) | |
2649 | = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i), | |
2650 | gen_rtx (MEM, SImode, plus_constant (from, i * 4))); | |
2651 | }") | |
2652 | ||
2653 | (define_insn "" | |
2654 | [(match_parallel 0 "load_multiple_operation" | |
cd2b37d9 | 2655 | [(set (match_operand:SI 1 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
2656 | (match_operand:SI 2 "indirect_operand" "Q"))])] |
2657 | "" | |
2658 | "* | |
2659 | { | |
2660 | /* We have to handle the case where the pseudo used to contain the address | |
2661 | is assigned to one of the output registers. In that case, do the | |
2662 | lsi, but then load the correct value. This is a bit of a mess, but is | |
2663 | the best we can do. */ | |
2664 | static char result[100]; | |
2665 | char newload[40]; | |
2666 | int i; | |
2667 | ||
2668 | strcpy (result, \"lsi %1,%P2,%N0\"); | |
2669 | for (i = 0; i < XVECLEN (operands[0], 0); i++) | |
2670 | if (refers_to_regno_p (REGNO (operands[1]) + i, | |
2671 | REGNO (operands[1]) + i + 1, operands[2], 0)) | |
2672 | { | |
2673 | sprintf (newload, \"\;l %d,%d(%d)\", | |
2674 | REGNO (operands[1]) + i, | |
2675 | i * 4, REGNO (XEXP (operands[2], 0))); | |
2676 | strcat (result, newload); | |
2677 | } | |
2678 | ||
2679 | return result; | |
2680 | }" | |
2681 | [(set_attr "type" "load")]) | |
2682 | \f | |
2683 | (define_expand "store_multiple" | |
2f622005 RK |
2684 | [(match_par_dup 3 [(set (match_operand:SI 0 "" "") |
2685 | (match_operand:SI 1 "" "")) | |
2686 | (clobber (scratch:SI)) | |
2687 | (use (match_operand:SI 2 "" ""))])] | |
1fd4e8c1 RK |
2688 | "" |
2689 | " | |
2690 | { | |
2691 | int regno; | |
2692 | int count; | |
2693 | rtx to; | |
2694 | int i; | |
2695 | ||
2696 | /* Support only storing a constant number of fixed-point registers to | |
2697 | memory and only bother with this if more than two; the machine | |
2698 | doesn't support more than eight. */ | |
2699 | if (GET_CODE (operands[2]) != CONST_INT | |
2700 | || INTVAL (operands[2]) <= 2 | |
2701 | || INTVAL (operands[2]) > 8 | |
2702 | || GET_CODE (operands[0]) != MEM | |
2703 | || GET_CODE (operands[1]) != REG | |
2704 | || REGNO (operands[1]) >= 32) | |
2705 | FAIL; | |
2706 | ||
2707 | count = INTVAL (operands[2]); | |
2708 | regno = REGNO (operands[1]); | |
2709 | ||
2710 | operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1)); | |
2711 | to = force_reg (SImode, XEXP (operands[0], 0)); | |
2712 | ||
2713 | XVECEXP (operands[3], 0, 0) | |
2714 | = gen_rtx (SET, VOIDmode, gen_rtx (MEM, SImode, to), operands[1]); | |
2715 | XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode, | |
2716 | gen_rtx (SCRATCH, SImode)); | |
2717 | ||
2718 | for (i = 1; i < count; i++) | |
2719 | XVECEXP (operands[3], 0, i + 1) | |
2720 | = gen_rtx (SET, VOIDmode, | |
2721 | gen_rtx (MEM, SImode, plus_constant (to, i * 4)), | |
2722 | gen_rtx (REG, SImode, regno + i)); | |
2723 | }") | |
2724 | ||
2725 | (define_insn "" | |
2726 | [(match_parallel 0 "store_multiple_operation" | |
2727 | [(set (match_operand:SI 1 "indirect_operand" "=Q") | |
cd2b37d9 | 2728 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
2729 | (clobber (match_scratch:SI 3 "=q"))])] |
2730 | "" | |
2731 | "stsi %2,%P1,%O0") | |
2732 | \f | |
2733 | ;; Define insns that do load or store with update. Some of these we can | |
2734 | ;; get by using pre-decrement or pre-increment, but the hardware can also | |
2735 | ;; do cases where the increment is not the size of the object. | |
2736 | ;; | |
2737 | ;; In all these cases, we use operands 0 and 1 for the register being | |
2738 | ;; incremented because those are the operands that local-alloc will | |
2739 | ;; tie and these are the pair most likely to be tieable (and the ones | |
2740 | ;; that will benefit the most). | |
2741 | ||
2742 | (define_insn "" | |
cd2b37d9 RK |
2743 | [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r") |
2744 | (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") | |
1fd4e8c1 | 2745 | (match_operand:SI 2 "reg_or_short_operand" "r,I")))) |
cd2b37d9 | 2746 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") |
1fd4e8c1 RK |
2747 | (plus:SI (match_dup 1) (match_dup 2)))] |
2748 | "" | |
2749 | "@ | |
5f243543 RK |
2750 | lux %3,%0,%2 |
2751 | lu %3,%2(%0)" | |
1fd4e8c1 RK |
2752 | [(set_attr "type" "load,load")]) |
2753 | ||
2754 | (define_insn "" | |
cd2b37d9 | 2755 | [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") |
1fd4e8c1 | 2756 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))) |
cd2b37d9 RK |
2757 | (match_operand:SI 3 "gpc_reg_operand" "r,r")) |
2758 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") | |
1fd4e8c1 RK |
2759 | (plus:SI (match_dup 1) (match_dup 2)))] |
2760 | "" | |
2761 | "@ | |
5f243543 RK |
2762 | stux %3,%0,%2 |
2763 | stu %3,%2(%0)") | |
1fd4e8c1 RK |
2764 | |
2765 | (define_insn "" | |
cd2b37d9 RK |
2766 | [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r") |
2767 | (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") | |
1fd4e8c1 | 2768 | (match_operand:SI 2 "reg_or_short_operand" "r,I")))) |
cd2b37d9 | 2769 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") |
1fd4e8c1 RK |
2770 | (plus:SI (match_dup 1) (match_dup 2)))] |
2771 | "" | |
2772 | "@ | |
5f243543 RK |
2773 | lhzux %3,%0,%2 |
2774 | lhzu %3,%2(%0)" | |
1fd4e8c1 RK |
2775 | [(set_attr "type" "load,load")]) |
2776 | ||
2777 | (define_insn "" | |
cd2b37d9 | 2778 | [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r") |
1fd4e8c1 | 2779 | (zero_extend:SI |
cd2b37d9 | 2780 | (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") |
1fd4e8c1 | 2781 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))))) |
cd2b37d9 | 2782 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") |
1fd4e8c1 RK |
2783 | (plus:SI (match_dup 1) (match_dup 2)))] |
2784 | "" | |
2785 | "@ | |
5f243543 RK |
2786 | lhzux %3,%0,%2 |
2787 | lhzu %3,%2(%0)" | |
1fd4e8c1 RK |
2788 | [(set_attr "type" "load,load")]) |
2789 | ||
2790 | (define_insn "" | |
cd2b37d9 | 2791 | [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r") |
1fd4e8c1 | 2792 | (sign_extend:SI |
cd2b37d9 | 2793 | (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") |
1fd4e8c1 | 2794 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))))) |
cd2b37d9 | 2795 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") |
1fd4e8c1 RK |
2796 | (plus:SI (match_dup 1) (match_dup 2)))] |
2797 | "" | |
2798 | "@ | |
5f243543 RK |
2799 | lhaux %3,%0,%2 |
2800 | lhau %3,%2(%0)" | |
1fd4e8c1 RK |
2801 | [(set_attr "type" "load,load")]) |
2802 | ||
2803 | (define_insn "" | |
cd2b37d9 | 2804 | [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") |
1fd4e8c1 | 2805 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))) |
cd2b37d9 RK |
2806 | (match_operand:HI 3 "gpc_reg_operand" "r,r")) |
2807 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") | |
1fd4e8c1 RK |
2808 | (plus:SI (match_dup 1) (match_dup 2)))] |
2809 | "" | |
2810 | "@ | |
5f243543 RK |
2811 | sthux %3,%0,%2 |
2812 | sthu %3,%2(%0)" | |
1fd4e8c1 RK |
2813 | [(set_attr "type" "load,load")]) |
2814 | ||
2815 | (define_insn "" | |
cd2b37d9 RK |
2816 | [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r") |
2817 | (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") | |
1fd4e8c1 | 2818 | (match_operand:SI 2 "reg_or_short_operand" "r,I")))) |
cd2b37d9 | 2819 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") |
1fd4e8c1 RK |
2820 | (plus:SI (match_dup 1) (match_dup 2)))] |
2821 | "" | |
2822 | "@ | |
5f243543 RK |
2823 | lbzux %3,%0,%2 |
2824 | lbzu %3,%2(%0)" | |
1fd4e8c1 RK |
2825 | [(set_attr "type" "load,load")]) |
2826 | ||
2827 | (define_insn "" | |
cd2b37d9 | 2828 | [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r") |
1fd4e8c1 | 2829 | (zero_extend:SI |
cd2b37d9 | 2830 | (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") |
1fd4e8c1 | 2831 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))))) |
cd2b37d9 | 2832 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") |
1fd4e8c1 RK |
2833 | (plus:SI (match_dup 1) (match_dup 2)))] |
2834 | "" | |
2835 | "@ | |
5f243543 RK |
2836 | lbzux %3,%0,%2 |
2837 | lbzu %3,%2(%0)" | |
1fd4e8c1 RK |
2838 | [(set_attr "type" "load,load")]) |
2839 | ||
2840 | (define_insn "" | |
cd2b37d9 | 2841 | [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") |
1fd4e8c1 | 2842 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))) |
cd2b37d9 RK |
2843 | (match_operand:QI 3 "gpc_reg_operand" "r,r")) |
2844 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") | |
1fd4e8c1 RK |
2845 | (plus:SI (match_dup 1) (match_dup 2)))] |
2846 | "" | |
2847 | "@ | |
5f243543 RK |
2848 | stbux %3,%0,%2 |
2849 | stbu %3,%2(%0)") | |
1fd4e8c1 RK |
2850 | |
2851 | (define_insn "" | |
cd2b37d9 RK |
2852 | [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f") |
2853 | (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") | |
1fd4e8c1 | 2854 | (match_operand:SI 2 "reg_or_short_operand" "r,I")))) |
cd2b37d9 | 2855 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") |
1fd4e8c1 RK |
2856 | (plus:SI (match_dup 1) (match_dup 2)))] |
2857 | "" | |
2858 | "@ | |
5f243543 RK |
2859 | lfsux %3,%0,%2 |
2860 | lfsu %3,%2(%0)" | |
1fd4e8c1 RK |
2861 | [(set_attr "type" "load,load")]) |
2862 | ||
2863 | (define_insn "" | |
cd2b37d9 | 2864 | [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") |
1fd4e8c1 | 2865 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))) |
cd2b37d9 RK |
2866 | (match_operand:SF 3 "gpc_reg_operand" "f,f")) |
2867 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") | |
1fd4e8c1 RK |
2868 | (plus:SI (match_dup 1) (match_dup 2)))] |
2869 | "" | |
2870 | "@ | |
5f243543 RK |
2871 | frsp %3,%3\;stfsux %3,%0,%2 |
2872 | frsp %3,%3\;stfsu %3,%2(%0)") | |
1fd4e8c1 RK |
2873 | |
2874 | (define_insn "" | |
cd2b37d9 RK |
2875 | [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f") |
2876 | (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") | |
1fd4e8c1 | 2877 | (match_operand:SI 2 "reg_or_short_operand" "r,I")))) |
cd2b37d9 | 2878 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") |
1fd4e8c1 RK |
2879 | (plus:SI (match_dup 1) (match_dup 2)))] |
2880 | "" | |
2881 | "@ | |
5f243543 RK |
2882 | lfdux %3,%0,%2 |
2883 | lfdu %3,%2(%0)" | |
1fd4e8c1 RK |
2884 | [(set_attr "type" "load,load")]) |
2885 | ||
2886 | (define_insn "" | |
cd2b37d9 | 2887 | [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0") |
1fd4e8c1 | 2888 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))) |
cd2b37d9 RK |
2889 | (match_operand:DF 3 "gpc_reg_operand" "f,f")) |
2890 | (set (match_operand:SI 0 "gpc_reg_operand" "=b,b") | |
1fd4e8c1 RK |
2891 | (plus:SI (match_dup 1) (match_dup 2)))] |
2892 | "" | |
2893 | "@ | |
5f243543 RK |
2894 | stfdux %3,%0,%2 |
2895 | stfdu %3,%2(%0)") | |
1fd4e8c1 RK |
2896 | \f |
2897 | ;; Next come insns related to the calling sequence. | |
2898 | ;; | |
2899 | ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca). | |
59257ff7 | 2900 | ;; We move the back-chain and decrement the stack pointer. |
1fd4e8c1 RK |
2901 | |
2902 | (define_expand "allocate_stack" | |
2903 | [(set (reg:SI 1) | |
01def764 | 2904 | (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))] |
1fd4e8c1 RK |
2905 | "" |
2906 | " | |
2907 | { rtx chain = gen_reg_rtx (SImode); | |
2908 | rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx); | |
2909 | ||
2910 | emit_move_insn (chain, stack_bot); | |
a0044fb1 | 2911 | emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, operands[0])); |
1fd4e8c1 RK |
2912 | emit_move_insn (stack_bot, chain); |
2913 | DONE; | |
2914 | }") | |
59257ff7 RK |
2915 | |
2916 | ;; These patterns say how to save and restore the stack pointer. We need not | |
2917 | ;; save the stack pointer at function level since we are careful to | |
2918 | ;; preserve the backchain. At block level, we have to restore the backchain | |
2919 | ;; when we restore the stack pointer. | |
2920 | ;; | |
2921 | ;; For nonlocal gotos, we must save both the stack pointer and its | |
2922 | ;; backchain and restore both. Note that in the nonlocal case, the | |
2923 | ;; save area is a memory location. | |
2924 | ||
2925 | (define_expand "save_stack_function" | |
2926 | [(use (const_int 0))] | |
2927 | "" | |
2928 | "") | |
2929 | ||
2930 | (define_expand "restore_stack_function" | |
2931 | [(use (const_int 0))] | |
2932 | "" | |
2933 | "") | |
2934 | ||
2935 | (define_expand "restore_stack_block" | |
2936 | [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" ""))) | |
2937 | (set (match_dup 0) (match_operand:SI 1 "register_operand" "")) | |
2938 | (set (mem:SI (match_dup 0)) (match_dup 2))] | |
2939 | "" | |
2940 | " | |
2941 | { operands[2] = gen_reg_rtx (SImode); }") | |
2942 | ||
2943 | (define_expand "save_stack_nonlocal" | |
2944 | [(match_operand:DI 0 "memory_operand" "") | |
2945 | (match_operand:SI 1 "register_operand" "")] | |
2946 | "" | |
2947 | " | |
2948 | { | |
2949 | rtx temp = gen_reg_rtx (SImode); | |
2950 | ||
2951 | /* Copy the backchain to the first word, sp to the second. */ | |
2952 | emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1])); | |
2953 | emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp); | |
2954 | emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]); | |
2955 | DONE; | |
2956 | }") | |
2957 | ||
2958 | (define_expand "restore_stack_nonlocal" | |
2959 | [(match_operand:SI 0 "register_operand" "") | |
2960 | (match_operand:DI 1 "memory_operand" "")] | |
2961 | "" | |
2962 | " | |
2963 | { | |
2964 | rtx temp = gen_reg_rtx (SImode); | |
2965 | ||
2966 | /* Restore the backchain from the first word, sp from the second. */ | |
2967 | emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode)); | |
2968 | emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode)); | |
2969 | emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp); | |
2970 | DONE; | |
2971 | }") | |
1fd4e8c1 RK |
2972 | \f |
2973 | ;; A function pointer is a pointer to a data area whose first word contains | |
2974 | ;; the actual address of the function, whose second word contains a pointer | |
2975 | ;; to its TOC, and whose third word contains a value to place in the static | |
2976 | ;; chain register (r11). Note that if we load the static chain, our | |
2977 | ;; "trampoline" need not have any executable code. | |
2978 | ;; | |
2979 | ;; operands[0] is an SImode pseudo in which we place the address of the | |
2980 | ;; function. | |
2981 | ;; operands[1] is the address of data area of the function to call | |
2982 | ||
2983 | (define_expand "call_via_ptr" | |
cd2b37d9 RK |
2984 | [(set (match_operand:SI 0 "gpc_reg_operand" "") |
2985 | (mem:SI (match_operand:SI 1 "gpc_reg_operand" ""))) | |
1fd4e8c1 RK |
2986 | (set (mem:SI (plus:SI (reg:SI 1) (const_int 20))) |
2987 | (reg:SI 2)) | |
2988 | (set (reg:SI 2) | |
2989 | (mem:SI (plus:SI (match_dup 1) | |
2990 | (const_int 4)))) | |
2991 | (set (reg:SI 11) | |
2992 | (mem:SI (plus:SI (match_dup 1) | |
2993 | (const_int 8)))) | |
2994 | (use (reg:SI 2)) | |
2995 | (use (reg:SI 11))] | |
2996 | "" | |
2997 | "") | |
2998 | ||
2999 | (define_expand "call" | |
3000 | [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" "")) | |
3001 | (match_operand 1 "" "")) | |
3002 | (clobber (scratch:SI))])] | |
3003 | "" | |
3004 | " | |
3005 | { | |
3006 | if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT) | |
3007 | abort (); | |
3008 | ||
3009 | operands[0] = XEXP (operands[0], 0); | |
3010 | if (GET_CODE (operands[0]) != SYMBOL_REF) | |
3011 | { | |
3012 | rtx temp = gen_reg_rtx (SImode); | |
3013 | ||
3014 | emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[0]))); | |
3015 | operands[0] = temp; | |
3016 | } | |
3017 | }") | |
3018 | ||
3019 | (define_expand "call_value" | |
3020 | [(parallel [(set (match_operand 0 "" "") | |
3021 | (call (mem:SI (match_operand:SI 1 "address_operand" "")) | |
3022 | (match_operand 2 "" ""))) | |
3023 | (clobber (scratch:SI))])] | |
3024 | "" | |
3025 | " | |
3026 | { | |
3027 | if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT) | |
3028 | abort (); | |
3029 | ||
3030 | operands[1] = XEXP (operands[1], 0); | |
3031 | if (GET_CODE (operands[1]) != SYMBOL_REF) | |
3032 | { | |
3033 | rtx temp = gen_reg_rtx (SImode); | |
3034 | ||
3035 | emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[1]))); | |
3036 | operands[1] = temp; | |
3037 | } | |
3038 | }") | |
3039 | ||
3040 | (define_insn "" | |
3041 | [(call (mem:SI (match_operand:SI 0 "call_operand" "l,s")) | |
3042 | (match_operand 1 "" "fg,fg")) | |
9482d6de | 3043 | (clobber (match_scratch:SI 2 "=l,l"))] |
1fd4e8c1 RK |
3044 | "" |
3045 | "@ | |
3046 | brl\;l 2,20(1) | |
3047 | bl %z0\;cror 15,15,15") | |
3048 | ||
3049 | (define_insn "" | |
5f243543 | 3050 | [(set (match_operand 0 "" "=fg,fg") |
1fd4e8c1 RK |
3051 | (call (mem:SI (match_operand:SI 1 "call_operand" "l,s")) |
3052 | (match_operand 2 "" "fg,fg"))) | |
3053 | (clobber (match_scratch:SI 3 "=l,l"))] | |
3054 | "" | |
3055 | "@ | |
3056 | brl\;l 2,20(1) | |
3057 | bl %z1\;cror 15,15,15") | |
3058 | \f | |
3059 | ;; Compare insns are next. Note that the RS/6000 has two types of compares, | |
3060 | ;; signed & unsigned, and one type of branch. | |
3061 | ;; | |
3062 | ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc | |
3063 | ;; insns, and branches. We store the operands of compares until we see | |
3064 | ;; how it is used. | |
3065 | (define_expand "cmpsi" | |
3066 | [(set (cc0) | |
cd2b37d9 | 3067 | (compare (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3068 | (match_operand:SI 1 "reg_or_short_operand" "")))] |
3069 | "" | |
3070 | " | |
3071 | { | |
3072 | /* Take care of the possibility that operands[1] might be negative but | |
3073 | this might be a logical operation. That insn doesn't exist. */ | |
3074 | if (GET_CODE (operands[1]) == CONST_INT | |
3075 | && INTVAL (operands[1]) < 0) | |
3076 | operands[1] = force_reg (SImode, operands[1]); | |
3077 | ||
3078 | rs6000_compare_op0 = operands[0]; | |
3079 | rs6000_compare_op1 = operands[1]; | |
3080 | rs6000_compare_fp_p = 0; | |
3081 | DONE; | |
3082 | }") | |
3083 | ||
3084 | (define_expand "cmpsf" | |
cd2b37d9 RK |
3085 | [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "") |
3086 | (match_operand:SF 1 "gpc_reg_operand" "")))] | |
1fd4e8c1 RK |
3087 | "" |
3088 | " | |
3089 | { | |
3090 | rs6000_compare_op0 = operands[0]; | |
3091 | rs6000_compare_op1 = operands[1]; | |
3092 | rs6000_compare_fp_p = 1; | |
3093 | DONE; | |
3094 | }") | |
3095 | ||
3096 | (define_expand "cmpdf" | |
cd2b37d9 RK |
3097 | [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "") |
3098 | (match_operand:DF 1 "gpc_reg_operand" "")))] | |
1fd4e8c1 RK |
3099 | "" |
3100 | " | |
3101 | { | |
3102 | rs6000_compare_op0 = operands[0]; | |
3103 | rs6000_compare_op1 = operands[1]; | |
3104 | rs6000_compare_fp_p = 1; | |
3105 | DONE; | |
3106 | }") | |
3107 | ||
3108 | (define_expand "beq" | |
3109 | [(set (match_dup 2) (match_dup 1)) | |
3110 | (set (pc) | |
3111 | (if_then_else (eq (match_dup 2) | |
3112 | (const_int 0)) | |
3113 | (label_ref (match_operand 0 "" "")) | |
3114 | (pc)))] | |
3115 | "" | |
3116 | " | |
3117 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3118 | operands[1] = gen_rtx (COMPARE, mode, | |
3119 | rs6000_compare_op0, rs6000_compare_op1); | |
3120 | operands[2] = gen_reg_rtx (mode); | |
3121 | }") | |
3122 | ||
3123 | (define_expand "bne" | |
3124 | [(set (match_dup 2) (match_dup 1)) | |
3125 | (set (pc) | |
3126 | (if_then_else (ne (match_dup 2) | |
3127 | (const_int 0)) | |
3128 | (label_ref (match_operand 0 "" "")) | |
3129 | (pc)))] | |
3130 | "" | |
3131 | " | |
3132 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3133 | operands[1] = gen_rtx (COMPARE, mode, | |
3134 | rs6000_compare_op0, rs6000_compare_op1); | |
3135 | operands[2] = gen_reg_rtx (mode); | |
3136 | }") | |
3137 | ||
3138 | (define_expand "blt" | |
3139 | [(set (match_dup 2) (match_dup 1)) | |
3140 | (set (pc) | |
3141 | (if_then_else (lt (match_dup 2) | |
3142 | (const_int 0)) | |
3143 | (label_ref (match_operand 0 "" "")) | |
3144 | (pc)))] | |
3145 | "" | |
3146 | " | |
3147 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3148 | operands[1] = gen_rtx (COMPARE, mode, | |
3149 | rs6000_compare_op0, rs6000_compare_op1); | |
3150 | operands[2] = gen_reg_rtx (mode); | |
3151 | }") | |
3152 | ||
3153 | (define_expand "bgt" | |
3154 | [(set (match_dup 2) (match_dup 1)) | |
3155 | (set (pc) | |
3156 | (if_then_else (gt (match_dup 2) | |
3157 | (const_int 0)) | |
3158 | (label_ref (match_operand 0 "" "")) | |
3159 | (pc)))] | |
3160 | "" | |
3161 | " | |
3162 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3163 | operands[1] = gen_rtx (COMPARE, mode, | |
3164 | rs6000_compare_op0, rs6000_compare_op1); | |
3165 | operands[2] = gen_reg_rtx (mode); | |
3166 | }") | |
3167 | ||
3168 | (define_expand "ble" | |
3169 | [(set (match_dup 2) (match_dup 1)) | |
3170 | (set (pc) | |
3171 | (if_then_else (le (match_dup 2) | |
3172 | (const_int 0)) | |
3173 | (label_ref (match_operand 0 "" "")) | |
3174 | (pc)))] | |
3175 | "" | |
3176 | " | |
3177 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3178 | operands[1] = gen_rtx (COMPARE, mode, | |
3179 | rs6000_compare_op0, rs6000_compare_op1); | |
3180 | operands[2] = gen_reg_rtx (mode); | |
3181 | }") | |
3182 | ||
3183 | (define_expand "bge" | |
3184 | [(set (match_dup 2) (match_dup 1)) | |
3185 | (set (pc) | |
3186 | (if_then_else (ge (match_dup 2) | |
3187 | (const_int 0)) | |
3188 | (label_ref (match_operand 0 "" "")) | |
3189 | (pc)))] | |
3190 | "" | |
3191 | " | |
3192 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3193 | operands[1] = gen_rtx (COMPARE, mode, | |
3194 | rs6000_compare_op0, rs6000_compare_op1); | |
3195 | operands[2] = gen_reg_rtx (mode); | |
3196 | }") | |
3197 | ||
3198 | (define_expand "bgtu" | |
3199 | [(set (match_dup 2) (match_dup 1)) | |
3200 | (set (pc) | |
3201 | (if_then_else (gtu (match_dup 2) | |
3202 | (const_int 0)) | |
3203 | (label_ref (match_operand 0 "" "")) | |
3204 | (pc)))] | |
3205 | "" | |
3206 | " | |
3207 | { operands[1] = gen_rtx (COMPARE, CCUNSmode, | |
3208 | rs6000_compare_op0, rs6000_compare_op1); | |
3209 | operands[2] = gen_reg_rtx (CCUNSmode); | |
3210 | }") | |
3211 | ||
3212 | (define_expand "bltu" | |
3213 | [(set (match_dup 2) (match_dup 1)) | |
3214 | (set (pc) | |
3215 | (if_then_else (ltu (match_dup 2) | |
3216 | (const_int 0)) | |
3217 | (label_ref (match_operand 0 "" "")) | |
3218 | (pc)))] | |
3219 | "" | |
3220 | " | |
3221 | { operands[1] = gen_rtx (COMPARE, CCUNSmode, | |
3222 | rs6000_compare_op0, rs6000_compare_op1); | |
3223 | operands[2] = gen_reg_rtx (CCUNSmode); | |
3224 | }") | |
3225 | ||
3226 | (define_expand "bgeu" | |
3227 | [(set (match_dup 2) (match_dup 1)) | |
3228 | (set (pc) | |
3229 | (if_then_else (geu (match_dup 2) | |
3230 | (const_int 0)) | |
3231 | (label_ref (match_operand 0 "" "")) | |
3232 | (pc)))] | |
3233 | "" | |
3234 | " | |
3235 | { operands[1] = gen_rtx (COMPARE, CCUNSmode, | |
3236 | rs6000_compare_op0, rs6000_compare_op1); | |
3237 | operands[2] = gen_reg_rtx (CCUNSmode); | |
3238 | }") | |
3239 | ||
3240 | (define_expand "bleu" | |
3241 | [(set (match_dup 2) (match_dup 1)) | |
3242 | (set (pc) | |
3243 | (if_then_else (leu (match_dup 2) | |
3244 | (const_int 0)) | |
3245 | (label_ref (match_operand 0 "" "")) | |
3246 | (pc)))] | |
3247 | "" | |
3248 | " | |
3249 | { operands[1] = gen_rtx (COMPARE, CCUNSmode, | |
3250 | rs6000_compare_op0, rs6000_compare_op1); | |
3251 | operands[2] = gen_reg_rtx (CCUNSmode); | |
3252 | }") | |
3253 | ||
3254 | ;; For SNE, we would prefer that the xor/abs sequence be used for integers. | |
3255 | ;; For SEQ, likewise, except that comparisons with zero should be done | |
3256 | ;; with an scc insns. However, due to the order that combine see the | |
3257 | ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in | |
3258 | ;; the cases we don't want to handle. | |
3259 | (define_expand "seq" | |
3260 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3261 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3262 | (eq:SI (match_dup 2) (const_int 0)))] |
3263 | "" | |
3264 | " | |
3265 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3266 | operands[1] = gen_rtx (COMPARE, mode, | |
3267 | rs6000_compare_op0, rs6000_compare_op1); | |
3268 | operands[2] = gen_reg_rtx (mode); | |
3269 | }") | |
3270 | ||
3271 | (define_expand "sne" | |
3272 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3273 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3274 | (ne:SI (match_dup 2) (const_int 0)))] |
3275 | "" | |
3276 | " | |
3277 | { if (! rs6000_compare_fp_p) | |
3278 | FAIL; | |
3279 | ||
3280 | operands[1] = gen_rtx (COMPARE, CCFPmode, | |
3281 | rs6000_compare_op0, rs6000_compare_op1); | |
3282 | operands[2] = gen_reg_rtx (CCFPmode); | |
3283 | }") | |
3284 | ||
3285 | ;; A > 0 is best done using the portable sequence, so fail in that case. | |
3286 | (define_expand "sgt" | |
3287 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3288 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3289 | (gt:SI (match_dup 2) (const_int 0)))] |
3290 | "" | |
3291 | " | |
3292 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3293 | ||
3294 | if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx) | |
3295 | FAIL; | |
3296 | ||
3297 | operands[1] = gen_rtx (COMPARE, mode, | |
3298 | rs6000_compare_op0, rs6000_compare_op1); | |
3299 | operands[2] = gen_reg_rtx (mode); | |
3300 | }") | |
3301 | ||
3302 | ;; A < 0 is best done in the portable way for A an integer. | |
3303 | (define_expand "slt" | |
3304 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3305 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3306 | (lt:SI (match_dup 2) (const_int 0)))] |
3307 | "" | |
3308 | " | |
3309 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3310 | ||
3311 | if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx) | |
3312 | FAIL; | |
3313 | ||
3314 | operands[1] = gen_rtx (COMPARE, mode, | |
3315 | rs6000_compare_op0, rs6000_compare_op1); | |
3316 | operands[2] = gen_reg_rtx (mode); | |
3317 | }") | |
3318 | ||
3319 | (define_expand "sge" | |
3320 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3321 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3322 | (ge:SI (match_dup 2) (const_int 0)))] |
3323 | "" | |
3324 | " | |
3325 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3326 | operands[1] = gen_rtx (COMPARE, mode, | |
3327 | rs6000_compare_op0, rs6000_compare_op1); | |
3328 | operands[2] = gen_reg_rtx (mode); | |
3329 | }") | |
3330 | ||
3331 | ;; A <= 0 is best done the portable way for A an integer. | |
3332 | (define_expand "sle" | |
3333 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3334 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3335 | (le:SI (match_dup 2) (const_int 0)))] |
3336 | "" | |
3337 | " | |
3338 | { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode; | |
3339 | ||
3340 | if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx) | |
3341 | FAIL; | |
3342 | ||
3343 | operands[1] = gen_rtx (COMPARE, mode, | |
3344 | rs6000_compare_op0, rs6000_compare_op1); | |
3345 | operands[2] = gen_reg_rtx (mode); | |
3346 | }") | |
3347 | ||
3348 | (define_expand "sgtu" | |
3349 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3350 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3351 | (gtu:SI (match_dup 2) (const_int 0)))] |
3352 | "" | |
3353 | " | |
3354 | { operands[1] = gen_rtx (COMPARE, CCUNSmode, | |
3355 | rs6000_compare_op0, rs6000_compare_op1); | |
3356 | operands[2] = gen_reg_rtx (CCUNSmode); | |
3357 | }") | |
3358 | ||
3359 | (define_expand "sltu" | |
3360 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3361 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3362 | (ltu:SI (match_dup 2) (const_int 0)))] |
3363 | "" | |
3364 | " | |
3365 | { operands[1] = gen_rtx (COMPARE, CCUNSmode, | |
3366 | rs6000_compare_op0, rs6000_compare_op1); | |
3367 | operands[2] = gen_reg_rtx (CCUNSmode); | |
3368 | }") | |
3369 | ||
3370 | (define_expand "sgeu" | |
3371 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3372 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3373 | (geu:SI (match_dup 2) (const_int 0)))] |
3374 | "" | |
3375 | " | |
3376 | { operands[1] = gen_rtx (COMPARE, CCUNSmode, | |
3377 | rs6000_compare_op0, rs6000_compare_op1); | |
3378 | operands[2] = gen_reg_rtx (CCUNSmode); | |
3379 | }") | |
3380 | ||
3381 | (define_expand "sleu" | |
3382 | [(set (match_dup 2) (match_dup 1)) | |
cd2b37d9 | 3383 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3384 | (leu:SI (match_dup 2) (const_int 0)))] |
3385 | "" | |
3386 | " | |
3387 | { operands[1] = gen_rtx (COMPARE, CCUNSmode, | |
3388 | rs6000_compare_op0, rs6000_compare_op1); | |
3389 | operands[2] = gen_reg_rtx (CCUNSmode); | |
3390 | }") | |
3391 | \f | |
3392 | ;; Here are the actual compare insns. | |
3393 | (define_insn "" | |
3394 | [(set (match_operand:CC 0 "cc_reg_operand" "=y") | |
cd2b37d9 | 3395 | (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
3396 | (match_operand:SI 2 "reg_or_short_operand" "rI")))] |
3397 | "" | |
3398 | "cmp%I2 %0,%1,%2" | |
3399 | [(set_attr "type" "compare")]) | |
3400 | ||
f357808b RK |
3401 | ;; If we are comparing a register for equality with a large constant, |
3402 | ;; we can do this with an XOR followed by a compare. But we need a scratch | |
3403 | ;; register for the result of the XOR. | |
3404 | ||
3405 | (define_split | |
3406 | [(set (match_operand:CC 0 "cc_reg_operand" "") | |
cd2b37d9 | 3407 | (compare:CC (match_operand:SI 1 "gpc_reg_operand" "") |
f357808b | 3408 | (match_operand:SI 2 "non_short_cint_operand" ""))) |
cd2b37d9 | 3409 | (clobber (match_operand:SI 3 "gpc_reg_operand" ""))] |
f357808b RK |
3410 | "find_single_use (operands[0], insn, 0) |
3411 | && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ | |
3412 | || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)" | |
3413 | [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4))) | |
3414 | (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))] | |
3415 | " | |
3416 | { | |
3417 | /* Get the constant we are comparing against, C, and see what it looks like | |
3418 | sign-extended to 16 bits. Then see what constant could be XOR'ed | |
3419 | with C to get the sign-extended value. */ | |
3420 | ||
3421 | int c = INTVAL (operands[2]); | |
3422 | int sextc = (c << 16) >> 16; | |
3423 | int xorv = c ^ sextc; | |
3424 | ||
3425 | operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv); | |
3426 | operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc); | |
3427 | }") | |
3428 | ||
1fd4e8c1 RK |
3429 | (define_insn "" |
3430 | [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y") | |
cd2b37d9 | 3431 | (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
3432 | (match_operand:SI 2 "reg_or_u_short_operand" "rI")))] |
3433 | "" | |
3434 | "cmpl%I2 %0,%1,%W2" | |
3435 | [(set_attr "type" "compare")]) | |
3436 | ||
3437 | ;; The following two insns don't exist as single insns, but if we provide | |
3438 | ;; them, we can swap an add and compare, which will enable us to overlap more | |
3439 | ;; of the required delay between a compare and branch. We generate code for | |
3440 | ;; them by splitting. | |
3441 | ||
3442 | (define_insn "" | |
3443 | [(set (match_operand:CC 3 "cc_reg_operand" "=y") | |
cd2b37d9 | 3444 | (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3445 | (match_operand:SI 2 "short_cint_operand" "i"))) |
cd2b37d9 | 3446 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3447 | (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))] |
3448 | "" | |
3449 | "#") | |
3450 | ||
3451 | (define_insn "" | |
3452 | [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y") | |
cd2b37d9 | 3453 | (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3454 | (match_operand:SI 2 "u_short_cint_operand" "i"))) |
cd2b37d9 | 3455 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3456 | (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))] |
3457 | "" | |
3458 | "#") | |
3459 | ||
3460 | (define_split | |
3461 | [(set (match_operand:CC 3 "cc_reg_operand" "") | |
cd2b37d9 | 3462 | (compare:CC (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 | 3463 | (match_operand:SI 2 "short_cint_operand" ""))) |
cd2b37d9 | 3464 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3465 | (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))] |
3466 | "" | |
3467 | [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2))) | |
3468 | (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))]) | |
3469 | ||
3470 | (define_split | |
3471 | [(set (match_operand:CCUNS 3 "cc_reg_operand" "") | |
cd2b37d9 | 3472 | (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 | 3473 | (match_operand:SI 2 "u_short_cint_operand" ""))) |
cd2b37d9 | 3474 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
3475 | (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))] |
3476 | "" | |
3477 | [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2))) | |
3478 | (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))]) | |
3479 | ||
3480 | (define_insn "" | |
3481 | [(set (match_operand:CCFP 0 "cc_reg_operand" "=y") | |
cd2b37d9 RK |
3482 | (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f") |
3483 | (match_operand:SF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
3484 | "" |
3485 | "fcmpu %0,%1,%2" | |
3486 | [(set_attr "type" "fpcompare")]) | |
3487 | ||
3488 | (define_insn "" | |
3489 | [(set (match_operand:CCFP 0 "cc_reg_operand" "=y") | |
cd2b37d9 RK |
3490 | (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f") |
3491 | (match_operand:DF 2 "gpc_reg_operand" "f")))] | |
1fd4e8c1 RK |
3492 | "" |
3493 | "fcmpu %0,%1,%2" | |
3494 | [(set_attr "type" "fpcompare")]) | |
3495 | \f | |
3496 | ;; Now we have the scc insns. We can do some combinations because of the | |
3497 | ;; way the machine works. | |
3498 | ;; | |
3499 | ;; Note that this is probably faster if we can put an insn between the | |
c5defebb RK |
3500 | ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most |
3501 | ;; cases the insns below which don't use an intermediate CR field will | |
3502 | ;; be used instead. | |
1fd4e8c1 | 3503 | (define_insn "" |
cd2b37d9 | 3504 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3505 | (match_operator:SI 1 "scc_comparison_operator" |
3506 | [(match_operand 2 "cc_reg_operand" "y") | |
3507 | (const_int 0)]))] | |
3508 | "" | |
3509 | "%D1mfcr %0\;rlinm %0,%0,%J1,31,31") | |
3510 | ||
3511 | (define_insn "" | |
3512 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
3513 | (compare:CC (match_operator:SI 1 "scc_comparison_operator" | |
3514 | [(match_operand 2 "cc_reg_operand" "y") | |
3515 | (const_int 0)]) | |
3516 | (const_int 0))) | |
cd2b37d9 | 3517 | (set (match_operand:SI 3 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3518 | (match_op_dup 1 [(match_dup 2) (const_int 0)]))] |
3519 | "" | |
3520 | "%D1mfcr %3\;rlinm. %3,%3,%J1,30,31" | |
3521 | [(set_attr "type" "delayed_compare")]) | |
3522 | ||
3523 | (define_insn "" | |
cd2b37d9 | 3524 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3525 | (ashift:SI (match_operator:SI 1 "scc_comparison_operator" |
3526 | [(match_operand 2 "cc_reg_operand" "y") | |
3527 | (const_int 0)]) | |
3528 | (match_operand:SI 3 "const_int_operand" "n")))] | |
3529 | "" | |
3530 | "* | |
3531 | { | |
3532 | int is_bit = ccr_bit (operands[1], 1); | |
3533 | int put_bit = 31 - (INTVAL (operands[3]) & 31); | |
3534 | int count; | |
3535 | ||
3536 | if (is_bit >= put_bit) | |
3537 | count = is_bit - put_bit; | |
3538 | else | |
3539 | count = 32 - (put_bit - is_bit); | |
3540 | ||
3541 | operands[4] = gen_rtx (CONST_INT, VOIDmode, count); | |
3542 | operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit); | |
3543 | ||
3544 | return \"%D1mfcr %0\;rlinm %0,%0,%4,%5,%5\"; | |
3545 | }") | |
3546 | ||
3547 | (define_insn "" | |
3548 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
3549 | (compare:CC | |
3550 | (ashift:SI (match_operator:SI 1 "scc_comparison_operator" | |
3551 | [(match_operand 2 "cc_reg_operand" "y") | |
3552 | (const_int 0)]) | |
3553 | (match_operand:SI 3 "const_int_operand" "n")) | |
3554 | (const_int 0))) | |
cd2b37d9 | 3555 | (set (match_operand:SI 4 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3556 | (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)]) |
3557 | (match_dup 3)))] | |
3558 | "" | |
3559 | "* | |
3560 | { | |
3561 | int is_bit = ccr_bit (operands[1], 1); | |
3562 | int put_bit = 31 - (INTVAL (operands[3]) & 31); | |
3563 | int count; | |
3564 | ||
3565 | if (is_bit >= put_bit) | |
3566 | count = is_bit - put_bit; | |
3567 | else | |
3568 | count = 32 - (put_bit - is_bit); | |
3569 | ||
3570 | operands[5] = gen_rtx (CONST_INT, VOIDmode, count); | |
3571 | operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit); | |
3572 | ||
3573 | return \"%D1mfcr %4\;rlinm. %4,%4,%5,%6,%6\"; | |
3574 | }" | |
3575 | [(set_attr "type" "delayed_compare")]) | |
3576 | ||
c5defebb RK |
3577 | ;; If we are comparing the result of two comparisons, this can be done |
3578 | ;; using creqv or crxor. | |
3579 | ||
3580 | (define_insn "" | |
3581 | [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y") | |
3582 | (compare:CCEQ (match_operator 1 "scc_comparison_operator" | |
3583 | [(match_operand 2 "cc_reg_operand" "y") | |
3584 | (const_int 0)]) | |
3585 | (match_operator 3 "scc_comparison_operator" | |
3586 | [(match_operand 4 "cc_reg_operand" "y") | |
3587 | (const_int 0)])))] | |
3588 | "REGNO (operands[2]) != REGNO (operands[4])" | |
3589 | "* | |
3590 | { | |
3591 | enum rtx_code code1, code2; | |
3592 | ||
3593 | code1 = GET_CODE (operands[1]); | |
3594 | code2 = GET_CODE (operands[3]); | |
3595 | ||
3596 | if ((code1 == EQ || code1 == LT || code1 == GT | |
3597 | || code1 == LTU || code1 == GTU | |
3598 | || (code1 != NE && GET_MODE (operands[2]) == CCFPmode)) | |
3599 | != | |
3600 | (code2 == EQ || code2 == LT || code2 == GT | |
3601 | || code2 == LTU || code2 == GTU | |
3602 | || (code2 != NE && GET_MODE (operands[4]) == CCFPmode))) | |
3603 | return \"%C1%C3crxor %E0,%j1,%j3\"; | |
3604 | else | |
3605 | return \"%C1%C3creqv %E0,%j1,%j3\"; | |
3606 | }") | |
3607 | ||
3608 | ;; There is a 3 cycle delay between consecutive mfcr instructions | |
3609 | ;; so it is useful to combine 2 scc instructions to use only one mfcr. | |
3610 | ||
3611 | (define_peephole | |
cd2b37d9 | 3612 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
c5defebb RK |
3613 | (match_operator:SI 1 "scc_comparison_operator" |
3614 | [(match_operand 2 "cc_reg_operand" "y") | |
3615 | (const_int 0)])) | |
cd2b37d9 | 3616 | (set (match_operand:SI 3 "gpc_reg_operand" "=r") |
c5defebb RK |
3617 | (match_operator:SI 4 "scc_comparison_operator" |
3618 | [(match_operand 5 "cc_reg_operand" "y") | |
3619 | (const_int 0)]))] | |
3620 | "REGNO (operands[2]) != REGNO (operands[5])" | |
3621 | "%D1%D4mfcr %3\;rlinm %0,%3,%J1,31,31\;rlinm %3,%3,%J4,31,31") | |
3622 | ||
1fd4e8c1 RK |
3623 | ;; There are some scc insns that can be done directly, without a compare. |
3624 | ;; These are faster because they don't involve the communications between | |
3625 | ;; the FXU and branch units. In fact, we will be replacing all of the | |
3626 | ;; integer scc insns here or in the portable methods in emit_store_flag. | |
3627 | ;; | |
3628 | ;; Also support (neg (scc ..)) since that construct is used to replace | |
3629 | ;; branches, (plus (scc ..) ..) since that construct is common and | |
3630 | ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the | |
3631 | ;; cases where it is no more expensive than (neg (scc ..)). | |
3632 | ||
3633 | ;; Have reload force a constant into a register for the simple insns that | |
3634 | ;; otherwise won't accept constants. We do this because it is faster than | |
3635 | ;; the cmp/mfcr sequence we would otherwise generate. | |
3636 | ||
3637 | (define_insn "" | |
cd2b37d9 RK |
3638 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r") |
3639 | (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r") | |
1fd4e8c1 RK |
3640 | (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))) |
3641 | (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))] | |
3642 | "" | |
3643 | "@ | |
3644 | xor %0,%1,%2\;sfi %3,%0,0\;ae %0,%3,%0 | |
3645 | sfi %3,%1,0\;ae %0,%3,%1 | |
3646 | xoril %0,%1,%b2\;sfi %3,%0,0\;ae %0,%3,%0 | |
3647 | xoriu %0,%1,%u2\;sfi %3,%0,0\;ae %0,%3,%0 | |
3648 | sfi %0,%1,%2\;sfi %3,%0,0\;ae %0,%3,%0") | |
3649 | ||
3650 | (define_insn "" | |
3651 | [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x") | |
3652 | (compare:CC | |
cd2b37d9 | 3653 | (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r") |
1fd4e8c1 RK |
3654 | (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")) |
3655 | (const_int 0))) | |
cd2b37d9 | 3656 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r") |
1fd4e8c1 RK |
3657 | (eq:SI (match_dup 1) (match_dup 2))) |
3658 | (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))] | |
3659 | "" | |
3660 | "@ | |
3661 | xor %0,%1,%2\;sfi %3,%0,0\;ae. %0,%3,%0 | |
3662 | sfi %3,%1,0\;ae. %0,%3,%1 | |
3663 | xoril %0,%1,%b2\;sfi %3,%0,0\;ae. %0,%3,%0 | |
3664 | xoriu %0,%1,%u2\;sfi %3,%0,0\;ae. %0,%3,%0 | |
3665 | sfi %0,%1,%2\;sfi %3,%0,0\;ae. %0,%3,%0" | |
3666 | [(set_attr "type" "compare")]) | |
3667 | ||
3668 | (define_insn "" | |
cd2b37d9 RK |
3669 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r") |
3670 | (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r") | |
1fd4e8c1 | 3671 | (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")) |
cd2b37d9 | 3672 | (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))) |
1fd4e8c1 RK |
3673 | (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))] |
3674 | "" | |
3675 | "@ | |
3676 | xor %4,%1,%2\;sfi %4,%4,0\;aze %0,%3 | |
3677 | sfi %4,%1,0\;aze %0,%3 | |
3678 | xoril %4,%1,%b2\;sfi %4,%4,0\;aze %0,%3 | |
3679 | xoriu %4,%1,%u2\;sfi %4,%4,0\;aze %0,%3 | |
3680 | sfi %4,%1,%2\;sfi %4,%4,0\;aze %0,%3") | |
3681 | ||
3682 | (define_insn "" | |
3683 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x") | |
3684 | (compare:CC | |
3685 | (plus:SI | |
cd2b37d9 | 3686 | (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r") |
1fd4e8c1 | 3687 | (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")) |
cd2b37d9 | 3688 | (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")) |
1fd4e8c1 RK |
3689 | (const_int 0))) |
3690 | (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))] | |
3691 | "" | |
3692 | "@ | |
3693 | xor %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3 | |
3694 | sfi %4,%1,0\;aze. %0,%3 | |
3695 | xoril %4,%1,%b2\;sfi %4,%4,0\;aze. %4,%3 | |
3696 | xoriu %4,%1,%u2\;sfi %4,%4,0\;aze. %4,%3 | |
3697 | sfi %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3" | |
3698 | [(set_attr "type" "compare")]) | |
3699 | ||
3700 | (define_insn "" | |
3701 | [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x") | |
3702 | (compare:CC | |
3703 | (plus:SI | |
cd2b37d9 | 3704 | (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r") |
1fd4e8c1 | 3705 | (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")) |
cd2b37d9 | 3706 | (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")) |
1fd4e8c1 | 3707 | (const_int 0))) |
cd2b37d9 | 3708 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r") |
1fd4e8c1 RK |
3709 | (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
3710 | (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))] | |
3711 | "" | |
3712 | "@ | |
3713 | xor %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3 | |
3714 | sfi %4,%1,0\;aze. %4,%3 | |
3715 | xoril %4,%1,%b2\;sfi %4,%4,0\;aze. %0,%3 | |
3716 | xoriu %4,%1,%u2\;sfi %4,%4,0\;aze. %0,%3 | |
3717 | sfi %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3" | |
3718 | [(set_attr "type" "compare")]) | |
3719 | ||
3720 | (define_insn "" | |
cd2b37d9 RK |
3721 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r") |
3722 | (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r") | |
1fd4e8c1 RK |
3723 | (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))] |
3724 | "" | |
3725 | "@ | |
3726 | xor %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0 | |
3727 | ai %0,%1,-1\;sfe %0,%0,%0 | |
3728 | xoril %0,%1,%b2\;ai %0,%0,-1\;sfe %0,%0,%0 | |
3729 | xoriu %0,%1,%u2\;ai %0,%0,-1\;sfe %0,%0,%0 | |
3730 | sfi %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0") | |
3731 | ||
3732 | ;; This is what (plus (ne X (const_int 0)) Y) looks like. | |
3733 | (define_insn "" | |
cd2b37d9 | 3734 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 | 3735 | (plus:SI (lshiftrt:SI |
cd2b37d9 | 3736 | (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))) |
1fd4e8c1 | 3737 | (const_int 31)) |
cd2b37d9 | 3738 | (match_operand:SI 2 "gpc_reg_operand" "r"))) |
1fd4e8c1 RK |
3739 | (clobber (match_scratch:SI 3 "=&r"))] |
3740 | "" | |
3741 | "ai %3,%1,-1\;aze %0,%2") | |
3742 | ||
3743 | (define_insn "" | |
3744 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
3745 | (compare:CC | |
3746 | (plus:SI (lshiftrt:SI | |
cd2b37d9 | 3747 | (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))) |
1fd4e8c1 | 3748 | (const_int 31)) |
cd2b37d9 | 3749 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
3750 | (const_int 0))) |
3751 | (clobber (match_scratch:SI 3 "=&r"))] | |
3752 | "" | |
3753 | "ai %3,%1,-1\;aze. %3,%2" | |
3754 | [(set_attr "type" "compare")]) | |
3755 | ||
3756 | (define_insn "" | |
3757 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
3758 | (compare:CC | |
3759 | (plus:SI (lshiftrt:SI | |
cd2b37d9 | 3760 | (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))) |
1fd4e8c1 | 3761 | (const_int 31)) |
cd2b37d9 | 3762 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
1fd4e8c1 | 3763 | (const_int 0))) |
cd2b37d9 | 3764 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3765 | (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31)) |
3766 | (match_dup 2))) | |
3767 | (clobber (match_scratch:SI 3 "=&r"))] | |
3768 | "" | |
3769 | "ai %3,%1,-1\;aze. %0,%2" | |
3770 | [(set_attr "type" "compare")]) | |
3771 | ||
3772 | (define_insn "" | |
cd2b37d9 RK |
3773 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
3774 | (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
3775 | (match_operand:SI 2 "reg_or_short_operand" "r,O"))) |
3776 | (clobber (match_scratch:SI 3 "=r,X"))] | |
3777 | "" | |
3778 | "@ | |
3779 | doz %3,%2,%1\;sfi %0,%3,0\;ae %0,%0,%3 | |
3780 | ai %0,%1,-1\;aze %0,%0\;sri %0,%0,31") | |
3781 | ||
3782 | (define_insn "" | |
3783 | [(set (match_operand:CC 4 "cc_reg_operand" "=x,x") | |
3784 | (compare:CC | |
cd2b37d9 | 3785 | (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
3786 | (match_operand:SI 2 "reg_or_short_operand" "r,O")) |
3787 | (const_int 0))) | |
cd2b37d9 | 3788 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
3789 | (le:SI (match_dup 1) (match_dup 2))) |
3790 | (clobber (match_scratch:SI 3 "=r,X"))] | |
3791 | "" | |
3792 | "@ | |
3793 | doz %3,%2,%1\;sfi %0,%3,0\;ae. %0,%0,%3 | |
3794 | ai %0,%1,-1\;aze %0,%0\;sri. %0,%0,31" | |
3795 | [(set_attr "type" "delayed_compare,compare")]) | |
3796 | ||
3797 | (define_insn "" | |
cd2b37d9 RK |
3798 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
3799 | (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 | 3800 | (match_operand:SI 2 "reg_or_short_operand" "r,O")) |
cd2b37d9 | 3801 | (match_operand:SI 3 "gpc_reg_operand" "r,r"))) |
1fd4e8c1 RK |
3802 | (clobber (match_scratch:SI 4 "=&r,&r"))] |
3803 | "" | |
3804 | "@ | |
3805 | doz %4,%2,%1\;sfi %4,%4,0\;aze %0,%3 | |
3806 | srai %4,%1,31\;sf %4,%1,%4\;aze %0,%3") | |
3807 | ||
3808 | (define_insn "" | |
3809 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x") | |
3810 | (compare:CC | |
cd2b37d9 | 3811 | (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 | 3812 | (match_operand:SI 2 "reg_or_short_operand" "r,O")) |
cd2b37d9 | 3813 | (match_operand:SI 3 "gpc_reg_operand" "r,r")) |
1fd4e8c1 RK |
3814 | (const_int 0))) |
3815 | (clobber (match_scratch:SI 4 "=&r,&r"))] | |
3816 | "" | |
3817 | "@ | |
3818 | doz %4,%2,%1\;sfi %4,%4,0\;aze. %4,%3 | |
3819 | srai %4,%1,31\;sf %4,%1,%4\;aze. %4,%3" | |
3820 | [(set_attr "type" "compare")]) | |
3821 | ||
3822 | (define_insn "" | |
3823 | [(set (match_operand:CC 5 "cc_reg_operand" "=x,x") | |
3824 | (compare:CC | |
cd2b37d9 | 3825 | (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 | 3826 | (match_operand:SI 2 "reg_or_short_operand" "r,O")) |
cd2b37d9 | 3827 | (match_operand:SI 3 "gpc_reg_operand" "r,r")) |
1fd4e8c1 | 3828 | (const_int 0))) |
cd2b37d9 | 3829 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
3830 | (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
3831 | (clobber (match_scratch:SI 4 "=&r,&r"))] | |
3832 | "" | |
3833 | "@ | |
3834 | doz %4,%2,%1\;sfi %4,%4,0\;aze. %0,%3 | |
3835 | srai %4,%1,31\;sf %4,%1,%4\;aze. %0,%3" | |
3836 | [(set_attr "type" "compare")]) | |
3837 | ||
3838 | (define_insn "" | |
cd2b37d9 RK |
3839 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
3840 | (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
3841 | (match_operand:SI 2 "reg_or_short_operand" "r,O"))))] |
3842 | "" | |
3843 | "@ | |
3844 | doz %0,%2,%1\;ai %0,%0,-1\;sfe %0,%0,%0 | |
3845 | ai %0,%1,-1\;aze %0,%0\;srai %0,%0,31") | |
3846 | ||
3847 | (define_insn "" | |
cd2b37d9 RK |
3848 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
3849 | (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
3850 | (match_operand:SI 2 "reg_or_short_operand" "rI")))] |
3851 | "" | |
3852 | "sf%I2 %0,%1,%2\;cal %0,0(0)\;ae %0,%0,%0") | |
3853 | ||
3854 | (define_insn "" | |
3855 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
3856 | (compare:CC | |
cd2b37d9 | 3857 | (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
3858 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
3859 | (const_int 0))) | |
cd2b37d9 | 3860 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3861 | (leu:SI (match_dup 1) (match_dup 2)))] |
3862 | "" | |
3863 | "sf%I2 %0,%1,%2\;cal %0,0(0)\;ae. %0,%0,%0" | |
3864 | [(set_attr "type" "compare")]) | |
3865 | ||
3866 | (define_insn "" | |
cd2b37d9 RK |
3867 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
3868 | (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 | 3869 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 3870 | (match_operand:SI 3 "gpc_reg_operand" "r"))) |
1fd4e8c1 RK |
3871 | (clobber (match_scratch:SI 4 "=&r"))] |
3872 | "" | |
3873 | "sf%I2 %4,%1,%2\;aze %0,%3") | |
3874 | ||
3875 | (define_insn "" | |
3876 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
3877 | (compare:CC | |
cd2b37d9 | 3878 | (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3879 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 3880 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
3881 | (const_int 0))) |
3882 | (clobber (match_scratch:SI 4 "=&r"))] | |
3883 | "" | |
3884 | "sf%I2 %4,%1,%2\;aze. %4,%3" | |
3885 | [(set_attr "type" "compare")]) | |
3886 | ||
3887 | (define_insn "" | |
3888 | [(set (match_operand:CC 5 "cc_reg_operand" "=x") | |
3889 | (compare:CC | |
cd2b37d9 | 3890 | (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3891 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 3892 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 | 3893 | (const_int 0))) |
cd2b37d9 | 3894 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3895 | (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
3896 | (clobber (match_scratch:SI 4 "=&r"))] | |
3897 | "" | |
3898 | "sf%I2 %4,%1,%2\;aze. %0,%3" | |
3899 | [(set_attr "type" "compare")]) | |
3900 | ||
3901 | (define_insn "" | |
cd2b37d9 RK |
3902 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
3903 | (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
3904 | (match_operand:SI 2 "reg_or_short_operand" "rI"))))] |
3905 | "" | |
3906 | "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;nand %0,%0,%0") | |
3907 | ||
3908 | (define_insn "" | |
cd2b37d9 | 3909 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 | 3910 | (and:SI (neg:SI |
cd2b37d9 | 3911 | (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3912 | (match_operand:SI 2 "reg_or_short_operand" "rI"))) |
cd2b37d9 | 3913 | (match_operand:SI 3 "gpc_reg_operand" "r"))) |
1fd4e8c1 RK |
3914 | (clobber (match_scratch:SI 4 "=&r"))] |
3915 | "" | |
3916 | "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc %0,%3,%4") | |
3917 | ||
3918 | (define_insn "" | |
3919 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
3920 | (compare:CC | |
3921 | (and:SI (neg:SI | |
cd2b37d9 | 3922 | (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3923 | (match_operand:SI 2 "reg_or_short_operand" "rI"))) |
cd2b37d9 | 3924 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
3925 | (const_int 0))) |
3926 | (clobber (match_scratch:SI 4 "=&r"))] | |
3927 | "" | |
3928 | "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc. %4,%3,%4" | |
3929 | [(set_attr "type" "compare")]) | |
3930 | ||
3931 | (define_insn "" | |
3932 | [(set (match_operand:CC 5 "cc_reg_operand" "=x") | |
3933 | (compare:CC | |
3934 | (and:SI (neg:SI | |
cd2b37d9 | 3935 | (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3936 | (match_operand:SI 2 "reg_or_short_operand" "rI"))) |
cd2b37d9 | 3937 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 | 3938 | (const_int 0))) |
cd2b37d9 | 3939 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3940 | (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3))) |
3941 | (clobber (match_scratch:SI 4 "=&r"))] | |
3942 | "" | |
3943 | "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc. %0,%3,%4" | |
3944 | [(set_attr "type" "compare")]) | |
3945 | ||
3946 | (define_insn "" | |
cd2b37d9 RK |
3947 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
3948 | (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
3949 | (match_operand:SI 2 "reg_or_short_operand" "rI")))] |
3950 | "" | |
3951 | "doz%I2 %0,%1,%2\;nabs %0,%0\;sri %0,%0,31") | |
3952 | ||
3953 | (define_insn "" | |
3954 | [(set (match_operand:SI 3 "cc_reg_operand" "=x") | |
3955 | (compare:CC | |
cd2b37d9 | 3956 | (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
3957 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
3958 | (const_int 0))) | |
cd2b37d9 | 3959 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3960 | (lt:SI (match_dup 1) (match_dup 2)))] |
3961 | "" | |
3962 | "doz%I2 %0,%1,%2\;nabs %0,%0\;sri. %0,%0,31" | |
3963 | [(set_attr "type" "delayed_compare")]) | |
3964 | ||
3965 | (define_insn "" | |
cd2b37d9 RK |
3966 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
3967 | (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 | 3968 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 3969 | (match_operand:SI 3 "gpc_reg_operand" "r"))) |
1fd4e8c1 RK |
3970 | (clobber (match_scratch:SI 4 "=&r"))] |
3971 | "" | |
3972 | "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze %0,%3") | |
3973 | ||
3974 | (define_insn "" | |
3975 | [(set (match_operand:SI 0 "cc_reg_operand" "=x") | |
3976 | (compare:CC | |
cd2b37d9 | 3977 | (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3978 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 3979 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
3980 | (const_int 0))) |
3981 | (clobber (match_scratch:SI 4 "=&r"))] | |
3982 | "" | |
3983 | "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze. %4,%3" | |
3984 | [(set_attr "type" "compare")]) | |
3985 | ||
3986 | (define_insn "" | |
3987 | [(set (match_operand:SI 5 "cc_reg_operand" "=x") | |
3988 | (compare:CC | |
cd2b37d9 | 3989 | (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 3990 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 3991 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 | 3992 | (const_int 0))) |
cd2b37d9 | 3993 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
3994 | (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
3995 | (clobber (match_scratch:SI 4 "=&r"))] | |
3996 | "" | |
3997 | "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze. %0,%3" | |
3998 | [(set_attr "type" "compare")]) | |
3999 | ||
4000 | (define_insn "" | |
cd2b37d9 RK |
4001 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4002 | (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4003 | (match_operand:SI 2 "reg_or_short_operand" "rI"))))] |
4004 | "" | |
4005 | "doz%I2 %0,%1,%2\;nabs %0,%0\;srai %0,%0,31") | |
4006 | ||
4007 | (define_insn "" | |
cd2b37d9 RK |
4008 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
4009 | (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
4010 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))] |
4011 | "" | |
4012 | "@ | |
4013 | sf %0,%2,%1\;sfe %0,%0,%0\;neg %0,%0 | |
4014 | ai %0,%1,%n2\;sfe %0,%0,%0\;neg %0,%0") | |
4015 | ||
4016 | (define_insn "" | |
4017 | [(set (match_operand:CC 3 "cc_reg_operand" "=x,x") | |
4018 | (compare:CC | |
cd2b37d9 | 4019 | (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
4020 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")) |
4021 | (const_int 0))) | |
cd2b37d9 | 4022 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
4023 | (ltu:SI (match_dup 1) (match_dup 2)))] |
4024 | "" | |
4025 | "@ | |
4026 | sf %0,%2,%1\;sfe %0,%0,%0\;neg. %0,%0 | |
4027 | ai %0,%1,%n2\;sfe %0,%0,%0\;neg. %0,%0" | |
4028 | [(set_attr "type" "compare")]) | |
4029 | ||
4030 | (define_insn "" | |
cd2b37d9 RK |
4031 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r") |
4032 | (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r") | |
1fd4e8c1 RK |
4033 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P")) |
4034 | (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I"))) | |
4035 | (clobber (match_scratch:SI 4 "=&r,r,&r,r"))] | |
4036 | "" | |
4037 | "@ | |
4038 | sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3 %0,%4,%3 | |
4039 | sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3 %0,%4,%3 | |
4040 | ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3 | |
4041 | ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3") | |
4042 | ||
4043 | (define_insn "" | |
4044 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x") | |
4045 | (compare:CC | |
cd2b37d9 | 4046 | (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r") |
1fd4e8c1 RK |
4047 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P")) |
4048 | (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")) | |
4049 | (const_int 0))) | |
4050 | (clobber (match_scratch:SI 4 "=&r,r,&r,r"))] | |
4051 | "" | |
4052 | "@ | |
4053 | sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %4,%4,%3 | |
4054 | sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %4,%4,%3 | |
4055 | ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3 | |
4056 | ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3" | |
4057 | [(set_attr "type" "compare")]) | |
4058 | ||
4059 | (define_insn "" | |
4060 | [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x") | |
4061 | (compare:CC | |
cd2b37d9 | 4062 | (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r") |
1fd4e8c1 RK |
4063 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P")) |
4064 | (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")) | |
4065 | (const_int 0))) | |
cd2b37d9 | 4066 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r") |
1fd4e8c1 RK |
4067 | (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
4068 | (clobber (match_scratch:SI 4 "=&r,r,&r,r"))] | |
4069 | "" | |
4070 | "@ | |
4071 | sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %0,%4,%3 | |
4072 | sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %0,%4,%3 | |
4073 | ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3 | |
4074 | ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3" | |
4075 | [(set_attr "type" "compare")]) | |
4076 | ||
4077 | (define_insn "" | |
cd2b37d9 RK |
4078 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
4079 | (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
4080 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))] |
4081 | "" | |
4082 | "@ | |
4083 | sf %0,%2,%1\;sfe %0,%0,%0 | |
4084 | ai %0,%1,%n2\;sfe %0,%0,%0") | |
4085 | ||
4086 | (define_insn "" | |
cd2b37d9 RK |
4087 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4088 | (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4089 | (match_operand:SI 2 "reg_or_short_operand" "rI"))) |
4090 | (clobber (match_scratch:SI 3 "=r"))] | |
4091 | "" | |
4092 | "doz%I2 %3,%1,%2\;sfi %0,%3,0\;ae %0,%0,%3") | |
4093 | ||
4094 | (define_insn "" | |
4095 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
4096 | (compare:CC | |
cd2b37d9 | 4097 | (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
4098 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
4099 | (const_int 0))) | |
cd2b37d9 | 4100 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4101 | (ge:SI (match_dup 1) (match_dup 2))) |
4102 | (clobber (match_scratch:SI 3 "=r"))] | |
4103 | "" | |
4104 | "doz%I2 %3,%1,%2\;sfi %0,%3,0\;ae. %0,%0,%3" | |
4105 | [(set_attr "type" "compare")]) | |
4106 | ||
4107 | (define_insn "" | |
cd2b37d9 RK |
4108 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4109 | (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 | 4110 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 4111 | (match_operand:SI 3 "gpc_reg_operand" "r"))) |
1fd4e8c1 RK |
4112 | (clobber (match_scratch:SI 4 "=&r"))] |
4113 | "" | |
4114 | "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze %0,%3") | |
4115 | ||
4116 | (define_insn "" | |
4117 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
4118 | (compare:CC | |
cd2b37d9 | 4119 | (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 4120 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 4121 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
4122 | (const_int 0))) |
4123 | (clobber (match_scratch:SI 4 "=&r"))] | |
4124 | "" | |
4125 | "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3" | |
4126 | [(set_attr "type" "compare")]) | |
4127 | ||
4128 | (define_insn "" | |
4129 | [(set (match_operand:CC 5 "cc_reg_operand" "=x") | |
4130 | (compare:CC | |
cd2b37d9 | 4131 | (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 4132 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
cd2b37d9 | 4133 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 | 4134 | (const_int 0))) |
cd2b37d9 | 4135 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4136 | (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
4137 | (clobber (match_scratch:SI 4 "=&r"))] | |
4138 | "" | |
4139 | "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3" | |
4140 | [(set_attr "type" "compare")]) | |
4141 | ||
4142 | (define_insn "" | |
cd2b37d9 RK |
4143 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4144 | (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4145 | (match_operand:SI 2 "reg_or_short_operand" "rI"))))] |
4146 | "" | |
4147 | "doz%I2 %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0") | |
4148 | ||
4149 | ;; This is (and (neg (ge X (const_int 0))) Y). | |
4150 | (define_insn "" | |
cd2b37d9 | 4151 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4152 | (and:SI (neg:SI |
4153 | (lshiftrt:SI | |
cd2b37d9 | 4154 | (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 | 4155 | (const_int 31))) |
cd2b37d9 | 4156 | (match_operand:SI 2 "gpc_reg_operand" "r"))) |
1fd4e8c1 RK |
4157 | (clobber (match_scratch:SI 3 "=&r"))] |
4158 | "" | |
4159 | "srai %3,%1,31\;andc %0,%2,%3") | |
4160 | ||
4161 | (define_insn "" | |
4162 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
4163 | (compare:CC | |
4164 | (and:SI (neg:SI | |
4165 | (lshiftrt:SI | |
cd2b37d9 | 4166 | (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 | 4167 | (const_int 31))) |
cd2b37d9 | 4168 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
4169 | (const_int 0))) |
4170 | (clobber (match_scratch:SI 3 "=&r"))] | |
4171 | "" | |
4172 | "srai %3,%1,31\;andc. %3,%2,%3" | |
4173 | [(set_attr "type" "compare")]) | |
4174 | ||
4175 | (define_insn "" | |
4176 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
4177 | (compare:CC | |
4178 | (and:SI (neg:SI | |
4179 | (lshiftrt:SI | |
cd2b37d9 | 4180 | (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")) |
1fd4e8c1 | 4181 | (const_int 31))) |
cd2b37d9 | 4182 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
1fd4e8c1 | 4183 | (const_int 0))) |
cd2b37d9 | 4184 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4185 | (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1)) |
4186 | (const_int 31))) | |
4187 | (match_dup 2))) | |
4188 | (clobber (match_scratch:SI 3 "=&r"))] | |
4189 | "" | |
4190 | "srai %3,%1,31\;andc. %0,%2,%3" | |
4191 | [(set_attr "type" "compare")]) | |
4192 | ||
4193 | (define_insn "" | |
cd2b37d9 RK |
4194 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
4195 | (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
4196 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))] |
4197 | "" | |
4198 | "@ | |
4199 | sf %0,%2,%1\;cal %0,0(0)\;ae %0,%0,%0 | |
4200 | ai %0,%1,%n2\;cal %0,0(0)\;ae %0,%0,%0") | |
4201 | ||
4202 | (define_insn "" | |
4203 | [(set (match_operand:CC 3 "cc_reg_operand" "=x,x") | |
4204 | (compare:CC | |
cd2b37d9 | 4205 | (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 RK |
4206 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")) |
4207 | (const_int 0))) | |
cd2b37d9 | 4208 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
4209 | (geu:SI (match_dup 1) (match_dup 2)))] |
4210 | "" | |
4211 | "@ | |
4212 | sf %0,%2,%1\;cal %0,0(0)\;ae. %0,%0,%0 | |
4213 | ai %0,%1,%n2\;cal %0,0(0)\;ae. %0,%0,%0" | |
4214 | [(set_attr "type" "compare")]) | |
4215 | ||
4216 | (define_insn "" | |
cd2b37d9 RK |
4217 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
4218 | (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 | 4219 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")) |
cd2b37d9 | 4220 | (match_operand:SI 3 "gpc_reg_operand" "r,r"))) |
1fd4e8c1 RK |
4221 | (clobber (match_scratch:SI 4 "=&r,&r"))] |
4222 | "" | |
4223 | "@ | |
4224 | sf %4,%2,%1\;aze %0,%3 | |
4225 | ai %4,%1,%n2\;aze %0,%3") | |
4226 | ||
4227 | (define_insn "" | |
4228 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x") | |
4229 | (compare:CC | |
cd2b37d9 | 4230 | (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 | 4231 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")) |
cd2b37d9 | 4232 | (match_operand:SI 3 "gpc_reg_operand" "r,r")) |
1fd4e8c1 RK |
4233 | (const_int 0))) |
4234 | (clobber (match_scratch:SI 4 "=&r,&r"))] | |
4235 | "" | |
4236 | "@ | |
4237 | sf %4,%2,%1\;aze. %4,%3 | |
4238 | ai %4,%1,%n2\;aze. %4,%3" | |
4239 | [(set_attr "type" "compare")]) | |
4240 | ||
4241 | (define_insn "" | |
4242 | [(set (match_operand:CC 5 "cc_reg_operand" "=x,x") | |
4243 | (compare:CC | |
cd2b37d9 | 4244 | (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 | 4245 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")) |
cd2b37d9 | 4246 | (match_operand:SI 3 "gpc_reg_operand" "r,r")) |
1fd4e8c1 | 4247 | (const_int 0))) |
cd2b37d9 | 4248 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
4249 | (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
4250 | (clobber (match_scratch:SI 4 "=&r,&r"))] | |
4251 | "" | |
4252 | "@ | |
4253 | sf %4,%2,%1\;aze. %0,%3 | |
4254 | ai %4,%1,%n2\;aze. %4,%3" | |
4255 | [(set_attr "type" "compare")]) | |
4256 | ||
4257 | (define_insn "" | |
cd2b37d9 RK |
4258 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
4259 | (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") | |
1fd4e8c1 RK |
4260 | (match_operand:SI 2 "reg_or_short_operand" "r,I"))))] |
4261 | "" | |
4262 | "@ | |
4263 | sf %0,%2,%1\;sfe %0,%0,%0\;nand %0,%0,%0 | |
4264 | sfi %0,%1,-1\;a%I2 %0,%0,%2\;sfe %0,%0,%0") | |
4265 | ||
4266 | (define_insn "" | |
cd2b37d9 | 4267 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 | 4268 | (and:SI (neg:SI |
cd2b37d9 | 4269 | (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 | 4270 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))) |
cd2b37d9 | 4271 | (match_operand:SI 3 "gpc_reg_operand" "r,r"))) |
1fd4e8c1 RK |
4272 | (clobber (match_scratch:SI 4 "=&r,&r"))] |
4273 | "" | |
4274 | "@ | |
4275 | sf %4,%2,%1\;sfe %4,%4,%4\;andc %0,%3,%4 | |
4276 | ai %4,%1,%n2\;sfe %4,%4,%4\;andc %0,%3,%4") | |
4277 | ||
4278 | (define_insn "" | |
4279 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x") | |
4280 | (compare:CC | |
4281 | (and:SI (neg:SI | |
cd2b37d9 | 4282 | (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 | 4283 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))) |
cd2b37d9 | 4284 | (match_operand:SI 3 "gpc_reg_operand" "r,r")) |
1fd4e8c1 RK |
4285 | (const_int 0))) |
4286 | (clobber (match_scratch:SI 4 "=&r,&r"))] | |
4287 | "" | |
4288 | "@ | |
4289 | sf %4,%2,%1\;sfe %4,%4,%4\;andc. %4,%3,%4 | |
4290 | ai %4,%1,%n2\;sfe %4,%4,%4\;andc. %4,%3,%4" | |
4291 | [(set_attr "type" "compare")]) | |
4292 | ||
4293 | (define_insn "" | |
4294 | [(set (match_operand:CC 5 "cc_reg_operand" "=x,x") | |
4295 | (compare:CC | |
4296 | (and:SI (neg:SI | |
cd2b37d9 | 4297 | (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r") |
1fd4e8c1 | 4298 | (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))) |
cd2b37d9 | 4299 | (match_operand:SI 3 "gpc_reg_operand" "r,r")) |
1fd4e8c1 | 4300 | (const_int 0))) |
cd2b37d9 | 4301 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") |
1fd4e8c1 RK |
4302 | (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3))) |
4303 | (clobber (match_scratch:SI 4 "=&r,&r"))] | |
4304 | "" | |
4305 | "@ | |
4306 | sf %4,%2,%1\;sfe %4,%4,%4\;andc. %0,%3,%4 | |
4307 | ai %4,%1,%n2\;sfe %4,%4,%4\;andc. %0,%3,%4" | |
4308 | [(set_attr "type" "compare")]) | |
4309 | ||
4310 | (define_insn "" | |
cd2b37d9 RK |
4311 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4312 | (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4313 | (const_int 0)))] |
4314 | "" | |
4315 | "sfi %0,%1,0\;ame %0,%0\;sri %0,%0,31") | |
4316 | ||
4317 | (define_insn "" | |
4318 | [(set (match_operand:CC 2 "cc_reg_operand" "=x") | |
4319 | (compare:CC | |
cd2b37d9 | 4320 | (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
4321 | (const_int 0)) |
4322 | (const_int 0))) | |
cd2b37d9 | 4323 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4324 | (gt:SI (match_dup 1) (const_int 0)))] |
4325 | "" | |
4326 | "sfi %0,%1,0\;ame %0,%0\;sri. %0,%0,31" | |
4327 | [(set_attr "type" "delayed_compare")]) | |
4328 | ||
4329 | (define_insn "" | |
cd2b37d9 RK |
4330 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4331 | (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4332 | (match_operand:SI 2 "reg_or_short_operand" "r")))] |
4333 | "" | |
4334 | "doz %0,%2,%1\;nabs %0,%0\;sri %0,%0,31") | |
4335 | ||
4336 | (define_insn "" | |
4337 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
4338 | (compare:CC | |
cd2b37d9 | 4339 | (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
4340 | (match_operand:SI 2 "reg_or_short_operand" "r")) |
4341 | (const_int 0))) | |
cd2b37d9 | 4342 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4343 | (gt:SI (match_dup 1) (match_dup 2)))] |
4344 | "" | |
4345 | "doz %0,%2,%1\;nabs %0,%0\;sri. %0,%0,31" | |
4346 | [(set_attr "type" "delayed_compare")]) | |
4347 | ||
4348 | (define_insn "" | |
cd2b37d9 RK |
4349 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4350 | (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 | 4351 | (const_int 0)) |
cd2b37d9 | 4352 | (match_operand:SI 2 "gpc_reg_operand" "r"))) |
1fd4e8c1 RK |
4353 | (clobber (match_scratch:SI 3 "=&r"))] |
4354 | "" | |
4355 | "a %3,%1,%1\;sfe %3,%1,%3\;aze %0,%2") | |
4356 | ||
4357 | (define_insn "" | |
4358 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
4359 | (compare:CC | |
cd2b37d9 | 4360 | (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 4361 | (const_int 0)) |
cd2b37d9 | 4362 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
4363 | (const_int 0))) |
4364 | (clobber (match_scratch:SI 3 "=&r"))] | |
4365 | "" | |
4366 | "a %3,%1,%1\;sfe %3,%1,%3\;aze. %0,%2" | |
4367 | [(set_attr "type" "compare")]) | |
4368 | ||
4369 | (define_insn "" | |
4370 | [(set (match_operand:CC 4 "cc_reg_operand" "=x") | |
4371 | (compare:CC | |
cd2b37d9 | 4372 | (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 4373 | (const_int 0)) |
cd2b37d9 | 4374 | (match_operand:SI 2 "gpc_reg_operand" "r")) |
1fd4e8c1 | 4375 | (const_int 0))) |
cd2b37d9 | 4376 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4377 | (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2))) |
4378 | (clobber (match_scratch:SI 3 "=&r"))] | |
4379 | "" | |
4380 | "a %3,%1,%1\;sfe %3,%1,%3\;aze. %3,%2" | |
4381 | [(set_attr "type" "compare")]) | |
4382 | ||
4383 | (define_insn "" | |
cd2b37d9 RK |
4384 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4385 | (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 | 4386 | (match_operand:SI 2 "reg_or_short_operand" "r")) |
cd2b37d9 | 4387 | (match_operand:SI 3 "gpc_reg_operand" "r"))) |
1fd4e8c1 RK |
4388 | (clobber (match_scratch:SI 4 "=&r"))] |
4389 | "" | |
4390 | "doz %4,%2,%1\;ai %4,%4,-1\;aze %0,%3") | |
4391 | ||
4392 | (define_insn "" | |
4393 | [(set (match_operand:CC 0 "cc_reg_operand" "=x") | |
4394 | (compare:CC | |
cd2b37d9 | 4395 | (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 4396 | (match_operand:SI 2 "reg_or_short_operand" "r")) |
cd2b37d9 | 4397 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 RK |
4398 | (const_int 0))) |
4399 | (clobber (match_scratch:SI 4 "=&r"))] | |
4400 | "" | |
4401 | "doz %4,%2,%1\;ai %4,%4,-1\;aze. %4,%3" | |
4402 | [(set_attr "type" "compare")]) | |
4403 | ||
4404 | (define_insn "" | |
4405 | [(set (match_operand:CC 5 "cc_reg_operand" "=x") | |
4406 | (compare:CC | |
cd2b37d9 | 4407 | (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 | 4408 | (match_operand:SI 2 "reg_or_short_operand" "r")) |
cd2b37d9 | 4409 | (match_operand:SI 3 "gpc_reg_operand" "r")) |
1fd4e8c1 | 4410 | (const_int 0))) |
cd2b37d9 | 4411 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4412 | (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
4413 | (clobber (match_scratch:SI 4 "=&r"))] | |
4414 | "" | |
4415 | "doz %4,%2,%1\;ai %4,%4,-1\;aze. %0,%3" | |
4416 | [(set_attr "type" "compare")]) | |
4417 | ||
4418 | (define_insn "" | |
cd2b37d9 RK |
4419 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4420 | (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4421 | (const_int 0))))] |
4422 | "" | |
4423 | "sfi %0,%1,0\;ame %0,%0\;srai %0,%0,31") | |
4424 | ||
4425 | (define_insn "" | |
cd2b37d9 RK |
4426 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4427 | (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4428 | (match_operand:SI 2 "reg_or_short_operand" "r"))))] |
4429 | "" | |
4430 | "doz %0,%2,%1\;nabs %0,%0\;srai %0,%0,31") | |
4431 | ||
4432 | (define_insn "" | |
cd2b37d9 RK |
4433 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4434 | (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4435 | (match_operand:SI 2 "reg_or_short_operand" "rI")))] |
4436 | "" | |
4437 | "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;neg %0,%0") | |
4438 | ||
4439 | (define_insn "" | |
4440 | [(set (match_operand:CC 3 "cc_reg_operand" "=x") | |
4441 | (compare:CC | |
cd2b37d9 | 4442 | (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r") |
1fd4e8c1 RK |
4443 | (match_operand:SI 2 "reg_or_short_operand" "rI")) |
4444 | (const_int 0))) | |
cd2b37d9 | 4445 | (set (match_operand:SI 0 "gpc_reg_operand" "=r") |
1fd4e8c1 RK |
4446 | (gtu:SI (match_dup 1) (match_dup 2)))] |
4447 | "" | |
4448 | "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;neg. %0,%0" | |
4449 | [(set_attr "type" "compare")]) | |
4450 | ||
4451 | (define_insn "" | |
00751805 RK |
4452 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") |
4453 | (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r") | |
4454 | (match_operand:SI 2 "reg_or_short_operand" "I,r,rI")) | |
4455 | (match_operand:SI 3 "reg_or_short_operand" "r,r,I"))) | |
4456 | (clobber (match_scratch:SI 4 "=&r,&r,&r"))] | |
1fd4e8c1 | 4457 | "" |
00751805 RK |
4458 | "@ |
4459 | ai %4,%1,%k2\;aze %0,%3 | |
4460 | sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3 | |
4461 | sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3") | |
1fd4e8c1 RK |
4462 | |
4463 | (define_insn "" | |
00751805 | 4464 | [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x") |
1fd4e8c1 | 4465 | (compare:CC |
00751805 RK |
4466 | (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r") |
4467 | (match_operand:SI 2 "reg_or_short_operand" "I,r,rI")) | |
4468 | (match_operand:SI 3 "reg_or_short_operand" "r,r,I")) | |
1fd4e8c1 | 4469 | (const_int 0))) |
00751805 | 4470 | (clobber (match_scratch:SI 4 "=&r,&r,&r"))] |
1fd4e8c1 | 4471 | "" |
00751805 RK |
4472 | "@ |
4473 | ai %4,%1,%k2\;aze. %0,%3 | |
4474 | sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3 | |
4475 | sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3" | |
1fd4e8c1 RK |
4476 | [(set_attr "type" "compare")]) |
4477 | ||
4478 | (define_insn "" | |
00751805 | 4479 | [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x") |
1fd4e8c1 | 4480 | (compare:CC |
00751805 RK |
4481 | (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r") |
4482 | (match_operand:SI 2 "reg_or_short_operand" "I,r,rI")) | |
4483 | (match_operand:SI 3 "reg_or_short_operand" "r,r,I")) | |
1fd4e8c1 | 4484 | (const_int 0))) |
00751805 | 4485 | (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r") |
1fd4e8c1 | 4486 | (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3))) |
00751805 | 4487 | (clobber (match_scratch:SI 4 "=&r,&r,&r"))] |
1fd4e8c1 | 4488 | "" |
00751805 RK |
4489 | "@ |
4490 | ai %4,%1,%k2\;aze. %0,%3 | |
4491 | sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3 | |
4492 | sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3" | |
1fd4e8c1 RK |
4493 | [(set_attr "type" "compare")]) |
4494 | ||
4495 | (define_insn "" | |
cd2b37d9 RK |
4496 | [(set (match_operand:SI 0 "gpc_reg_operand" "=r") |
4497 | (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r") | |
1fd4e8c1 RK |
4498 | (match_operand:SI 2 "reg_or_short_operand" "rI"))))] |
4499 | "" | |
4500 | "sf%I2 %0,%1,%2\;sfe %0,%0,%0") | |
4501 | \f | |
4502 | ;; Define both directions of branch and return. If we need a reload | |
4503 | ;; register, we'd rather use CR0 since it is much easier to copy a | |
4504 | ;; register CC value to there. | |
4505 | ||
4506 | (define_insn "" | |
4507 | [(set (pc) | |
4508 | (if_then_else (match_operator 1 "branch_comparison_operator" | |
4509 | [(match_operand 2 | |
4510 | "cc_reg_operand" "x,?y") | |
4511 | (const_int 0)]) | |
4512 | (label_ref (match_operand 0 "" "")) | |
4513 | (pc)))] | |
4514 | "" | |
4515 | "%C1bc %t1,%j1,%0") | |
4516 | ||
4517 | (define_insn "" | |
4518 | [(set (pc) | |
4519 | (if_then_else (match_operator 0 "branch_comparison_operator" | |
4520 | [(match_operand 1 | |
4521 | "cc_reg_operand" "x,?y") | |
4522 | (const_int 0)]) | |
4523 | (return) | |
4524 | (pc)))] | |
4525 | "direct_return ()" | |
4526 | "%C0bcr %t0,%j0") | |
4527 | ||
4528 | (define_insn "" | |
4529 | [(set (pc) | |
4530 | (if_then_else (match_operator 1 "branch_comparison_operator" | |
4531 | [(match_operand 2 | |
4532 | "cc_reg_operand" "x,?y") | |
4533 | (const_int 0)]) | |
4534 | (pc) | |
4535 | (label_ref (match_operand 0 "" ""))))] | |
4536 | "" | |
4537 | "%C1bc %T1,%j1,%0") | |
4538 | ||
4539 | (define_insn "" | |
4540 | [(set (pc) | |
4541 | (if_then_else (match_operator 0 "branch_comparison_operator" | |
4542 | [(match_operand 1 | |
4543 | "cc_reg_operand" "x,?y") | |
4544 | (const_int 0)]) | |
4545 | (pc) | |
4546 | (return)))] | |
4547 | "direct_return ()" | |
4548 | "%C0bcr %T0,%j0") | |
4549 | ||
4550 | ;; Unconditional branch and return. | |
4551 | ||
4552 | (define_insn "jump" | |
4553 | [(set (pc) | |
4554 | (label_ref (match_operand 0 "" "")))] | |
4555 | "" | |
4556 | "b %l0") | |
4557 | ||
4558 | (define_insn "return" | |
4559 | [(return)] | |
4560 | "direct_return ()" | |
4561 | "br") | |
4562 | ||
4563 | (define_insn "indirect_jump" | |
4564 | [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))] | |
4565 | "" | |
4566 | "@ | |
4567 | bctr | |
4568 | br") | |
4569 | ||
4570 | ;; Table jump for switch statements: | |
4571 | (define_expand "tablejump" | |
4572 | [(set (match_dup 3) | |
4573 | (plus:SI (match_operand:SI 0 "" "") | |
4574 | (match_dup 2))) | |
4575 | (parallel [(set (pc) (match_dup 3)) | |
4576 | (use (label_ref (match_operand 1 "" "")))])] | |
4577 | "" | |
4578 | " | |
4579 | { operands[0] = force_reg (SImode, operands[0]); | |
4580 | operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1])); | |
4581 | operands[3] = gen_reg_rtx (SImode); | |
4582 | }") | |
4583 | ||
4584 | (define_insn "" | |
4585 | [(set (pc) | |
740ab4a2 | 4586 | (match_operand:SI 0 "register_operand" "c,l")) |
1fd4e8c1 RK |
4587 | (use (label_ref (match_operand 1 "" "")))] |
4588 | "" | |
4589 | "@ | |
4590 | bctr | |
4591 | br") | |
4592 | ||
4593 | (define_insn "nop" | |
4594 | [(const_int 0)] | |
4595 | "" | |
4596 | "cror 0,0,0") | |
4597 | \f | |
789bc282 | 4598 | ;; Define the subtract-one-and-jump insns. |
1fd4e8c1 RK |
4599 | ;; We need to be able to do this for any operand, including MEM, or we |
4600 | ;; will cause reload to blow up since we don't allow output reloads on | |
4601 | ;; JUMP_INSNs. | |
4602 | (define_insn "" | |
4603 | [(set (pc) | |
4604 | (if_then_else (ne (match_operand:SI 1 "register_operand" "0,*r,*r") | |
4605 | (const_int 1)) | |
4606 | (label_ref (match_operand 2 "" "")) | |
4607 | (pc))) | |
4608 | (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l") | |
4609 | (plus:SI (match_dup 1) (const_int -1))) | |
4610 | (clobber (match_scratch:CC 3 "=X,&x,&x")) | |
4611 | (clobber (match_scratch:SI 4 "=X,X,r"))] | |
4612 | "" | |
4613 | "@ | |
4614 | bdn %l2 | |
4615 | # | |
4616 | #") | |
4617 | ||
789bc282 | 4618 | ;; Similar, but we can use GE since we have a REG_NOTES. |
1fd4e8c1 RK |
4619 | (define_insn "" |
4620 | [(set (pc) | |
4621 | (if_then_else (ge (match_operand:SI 1 "register_operand" "0,*r,*r") | |
4622 | (const_int 0)) | |
4623 | (label_ref (match_operand 2 "" "")) | |
4624 | (pc))) | |
4625 | (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l") | |
4626 | (plus:SI (match_dup 1) (const_int -1))) | |
4627 | (clobber (match_scratch:CC 3 "=X,&x,&X")) | |
4628 | (clobber (match_scratch:SI 4 "=X,X,r"))] | |
4629 | "find_reg_note (insn, REG_NONNEG, 0)" | |
4630 | "@ | |
4631 | bdn %l2 | |
4632 | # | |
4633 | #") | |
4634 | ||
4635 | (define_insn "" | |
4636 | [(set (pc) | |
4637 | (if_then_else (eq (match_operand:SI 1 "register_operand" "0,*r,*r") | |
4638 | (const_int 1)) | |
4639 | (label_ref (match_operand 2 "" "")) | |
4640 | (pc))) | |
4641 | (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l") | |
4642 | (plus:SI (match_dup 1) (const_int -1))) | |
4643 | (clobber (match_scratch:CC 3 "=X,&x,&x")) | |
4644 | (clobber (match_scratch:SI 4 "=X,X,r"))] | |
4645 | "" | |
4646 | "@ | |
4647 | bdz %l2 | |
4648 | # | |
4649 | #") | |
4650 | ||
4651 | (define_split | |
4652 | [(set (pc) | |
4653 | (if_then_else (match_operator 2 "comparison_operator" | |
cd2b37d9 | 4654 | [(match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
4655 | (const_int 1)]) |
4656 | (match_operand 5 "" "") | |
4657 | (match_operand 6 "" ""))) | |
cd2b37d9 | 4658 | (set (match_operand:SI 0 "gpc_reg_operand" "") |
1fd4e8c1 RK |
4659 | (plus:SI (match_dup 1) (const_int -1))) |
4660 | (clobber (match_scratch:CC 3 "")) | |
4661 | (clobber (match_scratch:SI 4 ""))] | |
4662 | "reload_completed" | |
4663 | [(parallel [(set (match_dup 3) | |
4664 | (compare:CC (plus:SI (match_dup 1) (const_int -1)) | |
4665 | (const_int 0))) | |
4666 | (set (match_dup 0) (plus:SI (match_dup 1) (const_int -1)))]) | |
4667 | (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))] | |
4668 | " | |
4669 | { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3], | |
4670 | const0_rtx); }") | |
4671 | ||
4672 | (define_split | |
4673 | [(set (pc) | |
4674 | (if_then_else (match_operator 2 "comparison_operator" | |
cd2b37d9 | 4675 | [(match_operand:SI 1 "gpc_reg_operand" "") |
1fd4e8c1 RK |
4676 | (const_int 1)]) |
4677 | (match_operand 5 "" "") | |
4678 | (match_operand 6 "" ""))) | |
4679 | (set (match_operand:SI 0 "general_operand" "") | |
4680 | (plus:SI (match_dup 1) (const_int -1))) | |
4681 | (clobber (match_scratch:CC 3 "")) | |
4682 | (clobber (match_scratch:SI 4 ""))] | |
cd2b37d9 | 4683 | "reload_completed && ! gpc_reg_operand (operands[0], SImode)" |
1fd4e8c1 RK |
4684 | [(parallel [(set (match_dup 3) |
4685 | (compare:CC (plus:SI (match_dup 1) (const_int -1)) | |
4686 | (const_int 0))) | |
4687 | (set (match_dup 4) (plus:SI (match_dup 1) (const_int -1)))]) | |
4688 | (set (match_dup 0) (match_dup 4)) | |
4689 | (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))] | |
4690 | " | |
4691 | { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3], | |
4692 | const0_rtx); }") |