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