1 ;;- Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@nyu.edu)
5 ;; This file is part of GNU CC.
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)
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.
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.
21 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
23 ;; Define an insn type attribute. This is used in function unit delay
25 (define_attr "type" "load,integer,fp,compare,delayed_compare,fpcompare,mtlr"
26 (const_string "integer"))
28 ;; Memory delivers its result in two cycles.
29 (define_function_unit "memory" 1 0 (eq_attr "type" "load") 2 0)
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)
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)
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)
41 ;; Floating-point comparisons take eight cycles.
42 (define_function_unit "compare" 1 0 (eq_attr "type" "fpcompare") 8 0)
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)
47 ;; Start with fixed-point load and store insns. Here we put only the more
48 ;; complex forms. Basic data transfer is done later.
50 (define_expand "zero_extendqisi2"
51 [(set (match_operand:SI 0 "gpc_reg_operand" "")
52 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
57 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
58 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
63 [(set_attr "type" "load,*")])
66 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
67 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
69 (clobber (match_scratch:SI 2 "=r"))]
72 [(set_attr "type" "compare")])
75 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
76 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
78 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
79 (zero_extend:SI (match_dup 1)))]
82 [(set_attr "type" "compare")])
84 (define_expand "zero_extendqihi2"
85 [(set (match_operand:HI 0 "gpc_reg_operand" "")
86 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
91 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
92 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
97 [(set_attr "type" "load,*")])
99 (define_expand "zero_extendhisi2"
100 [(set (match_operand:SI 0 "gpc_reg_operand" "")
101 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
106 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
107 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
112 [(set_attr "type" "load,*")])
115 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
116 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
118 (clobber (match_scratch:SI 2 "=r"))]
121 [(set_attr "type" "compare")])
124 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
125 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
127 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
128 (zero_extend:SI (match_dup 1)))]
131 [(set_attr "type" "compare")])
133 (define_expand "extendhisi2"
134 [(set (match_operand:SI 0 "gpc_reg_operand" "")
135 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
140 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
141 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
146 [(set_attr "type" "load,*")])
149 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
150 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
152 (clobber (match_scratch:SI 2 "=r"))]
155 [(set_attr "type" "compare")])
158 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
159 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
161 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
162 (sign_extend:SI (match_dup 1)))]
165 [(set_attr "type" "compare")])
167 ;; Fixed-point arithmetic insns.
168 (define_insn "addsi3"
169 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
170 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b")
171 (match_operand:SI 2 "add_operand" "rI,J")))]
178 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
179 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
180 (match_operand:SI 2 "reg_or_short_operand" "rI"))
182 (clobber (match_scratch:SI 3 "=r"))]
185 [(set_attr "type" "compare")])
188 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
189 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
190 (match_operand:SI 2 "reg_or_short_operand" "rI"))
192 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
193 (plus:SI (match_dup 1) (match_dup 2)))]
196 [(set_attr "type" "compare")])
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.
203 [(set (match_operand:SI 0 "gpc_reg_operand" "")
204 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
205 (match_operand:SI 2 "non_add_cint_operand" "")))]
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)))]
211 int low = INTVAL (operands[2]) & 0xffff;
212 int high = (unsigned) INTVAL (operands[2]) >> 16;
215 high++, low |= 0xffff0000;
217 operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16);
218 operands[4] = gen_rtx (CONST_INT, VOIDmode, low);
221 (define_insn "one_cmplsi2"
222 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
223 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
228 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
229 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
230 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
237 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
238 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
239 (match_operand:SI 2 "gpc_reg_operand" "r"))
241 (clobber (match_scratch:SI 3 "=r"))]
244 [(set_attr "type" "compare")])
247 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
248 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
249 (match_operand:SI 2 "gpc_reg_operand" "r"))
251 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
252 (minus:SI (match_dup 1) (match_dup 2)))]
255 [(set_attr "type" "compare")])
257 (define_expand "subsi3"
258 [(set (match_operand:SI 0 "gpc_reg_operand" "")
259 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
260 (match_operand:SI 2 "reg_or_cint_operand" "")))]
264 if (GET_CODE (operands[2]) == CONST_INT)
266 emit_insn (gen_addsi3 (operands[0], operands[1],
267 negate_rtx (SImode, operands[2])));
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] and the define_splits to make them if made by
277 (define_expand "sminsi3"
279 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
280 (match_operand:SI 2 "reg_or_short_operand" ""))
282 (minus:SI (match_dup 2) (match_dup 1))))
283 (set (match_operand:SI 0 "gpc_reg_operand" "")
284 (minus:SI (match_dup 2) (match_dup 3)))]
287 { operands[3] = gen_reg_rtx (SImode); }")
290 [(set (match_operand:SI 0 "gpc_reg_operand" "")
291 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
292 (match_operand:SI 2 "reg_or_short_operand" "")))
293 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
296 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
298 (minus:SI (match_dup 2) (match_dup 1))))
299 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
302 (define_expand "smaxsi3"
304 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
305 (match_operand:SI 2 "reg_or_short_operand" ""))
307 (minus:SI (match_dup 2) (match_dup 1))))
308 (set (match_operand:SI 0 "gpc_reg_operand" "")
309 (plus:SI (match_dup 3) (match_dup 1)))]
312 { operands[3] = gen_reg_rtx (SImode); }")
315 [(set (match_operand:SI 0 "gpc_reg_operand" "")
316 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
317 (match_operand:SI 2 "reg_or_short_operand" "")))
318 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
321 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
323 (minus:SI (match_dup 2) (match_dup 1))))
324 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
327 (define_expand "uminsi3"
328 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
329 (const_int -2147483648)))
330 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
331 (const_int -2147483648)))
332 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
334 (minus:SI (match_dup 4) (match_dup 3))))
335 (set (match_operand:SI 0 "gpc_reg_operand" "")
336 (minus:SI (match_dup 2) (match_dup 3)))]
339 { operands[3] = gen_reg_rtx (SImode); operands[4] = gen_reg_rtx (SImode); }")
341 (define_expand "umaxsi3"
342 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
343 (const_int -2147483648)))
344 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
345 (const_int -2147483648)))
346 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
348 (minus:SI (match_dup 4) (match_dup 3))))
349 (set (match_operand:SI 0 "gpc_reg_operand" "")
350 (plus:SI (match_dup 3) (match_dup 1)))]
353 { operands[3] = gen_reg_rtx (SImode); operands[4] = gen_reg_rtx (SImode); }")
356 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
357 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
358 (match_operand:SI 2 "reg_or_short_operand" "rI"))
360 (minus:SI (match_dup 2) (match_dup 1))))]
365 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
367 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
368 (match_operand:SI 2 "reg_or_short_operand" "rI"))
370 (minus:SI (match_dup 2) (match_dup 1)))
372 (clobber (match_scratch:SI 3 "=r"))]
375 [(set_attr "type" "delayed_compare")])
378 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
380 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
381 (match_operand:SI 2 "reg_or_short_operand" "rI"))
383 (minus:SI (match_dup 2) (match_dup 1)))
385 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
386 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
388 (minus:SI (match_dup 2) (match_dup 1))))]
391 [(set_attr "type" "delayed_compare")])
393 ;; We don't need abs with condition code because such comparisons should
395 (define_insn "abssi2"
396 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
397 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
402 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
403 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
407 (define_insn "negsi2"
408 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
409 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
414 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
415 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
417 (clobber (match_scratch:SI 2 "=r"))]
420 [(set_attr "type" "compare")])
423 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
424 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
426 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
427 (neg:SI (match_dup 1)))]
430 [(set_attr "type" "compare")])
432 (define_insn "ffssi2"
433 [(set (match_operand:SI 0 "register_operand" "=&r")
434 (ffs:SI (match_operand:SI 1 "register_operand" "r")))]
436 "neg %0,%1\;and %0,%0,%1\;cntlz %0,%0\;sfi %0,%0,32")
438 (define_insn "mulsi3"
439 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
440 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
441 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
442 (clobber (match_scratch:SI 3 "=q,q"))]
449 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
450 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
451 (match_operand:SI 2 "gpc_reg_operand" "r"))
453 (clobber (match_scratch:SI 3 "=r"))
454 (clobber (match_scratch:SI 4 "=q"))]
457 [(set_attr "type" "delayed_compare")])
460 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
461 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
462 (match_operand:SI 2 "gpc_reg_operand" "r"))
464 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
465 (mult:SI (match_dup 1) (match_dup 2)))
466 (clobber (match_scratch:SI 4 "=q"))]
469 [(set_attr "type" "delayed_compare")])
471 ;; Operand 1 is divided by operand 2; quotient goes to operand
472 ;; 0 and remainder to operand 3.
473 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
475 (define_insn "divmodsi4"
476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
477 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
478 (match_operand:SI 2 "gpc_reg_operand" "r")))
479 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
480 (mod:SI (match_dup 1) (match_dup 2)))]
484 ;; For powers of two we can do srai/aze for divide and then adjust for
485 ;; modulus. If it isn't a power of two, FAIL so divmodsi4 will be used.
486 (define_expand "divsi3"
487 [(set (match_operand:SI 0 "gpc_reg_operand" "")
488 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
489 (match_operand:SI 2 "reg_or_cint_operand" "")))]
493 if (GET_CODE (operands[2]) != CONST_INT
494 || exact_log2 (INTVAL (operands[2])) < 0)
498 (define_expand "modsi3"
500 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
501 (match_operand:SI 2 "reg_or_cint_operand" "")))
502 (parallel [(set (match_dup 4) (ashift:SI (match_dup 3) (match_dup 5)))
503 (clobber (scratch:SI))])
504 (set (match_operand:SI 0 "gpc_reg_operand" "")
505 (minus:SI (match_dup 1) (match_dup 4)))]
509 int i = exact_log2 (INTVAL (operands[2]));
511 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
514 operands[3] = gen_reg_rtx (SImode);
515 operands[4] = gen_reg_rtx (SImode);
516 operands[5] = gen_rtx (CONST_INT, VOIDmode, i);
520 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
521 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
522 (match_operand:SI 2 "const_int_operand" "N")))]
523 "exact_log2 (INTVAL (operands[2])) >= 0"
524 "srai %0,%1,%p2\;aze %0,%0")
527 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
528 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
529 (match_operand:SI 2 "const_int_operand" "N")))
530 (clobber (match_scratch:SI 3 "=r"))]
531 "exact_log2 (INTVAL (operands[2])) >= 0"
532 "srai %3,%1,%p2\;aze. %3,%3"
533 [(set_attr "type" "compare")])
536 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
537 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
538 (match_operand:SI 2 "const_int_operand" "N")))
539 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
540 (div:SI (match_dup 1) (match_dup 2)))]
541 "exact_log2 (INTVAL (operands[2])) >= 0"
542 "srai %0,%1,%p2\;aze. %0,%0"
543 [(set_attr "type" "compare")])
546 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
549 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
551 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
552 (match_operand:SI 3 "gpc_reg_operand" "r")))
553 (set (match_operand:SI 2 "register_operand" "=*q")
556 (zero_extend:DI (match_dup 1)) (const_int 32))
557 (zero_extend:DI (match_dup 4)))
563 ;; To do unsigned divide we handle the cases of the divisor looking like a
564 ;; negative number. If it is a constant that is less than 2**31, we don't
565 ;; have to worry about the branches. So make a few subroutines here.
567 ;; First comes the normal case.
568 (define_expand "udivmodsi4_normal"
569 [(set (match_dup 4) (const_int 0))
570 (parallel [(set (match_operand:SI 0 "" "")
571 (udiv:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4))
573 (zero_extend:DI (match_operand:SI 1 "" "")))
574 (match_operand:SI 2 "" "")))
575 (set (match_operand:SI 3 "" "")
576 (umod:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4))
578 (zero_extend:DI (match_dup 1)))
582 { operands[4] = gen_reg_rtx (SImode); }")
584 ;; This handles the branches.
585 (define_expand "udivmodsi4_tests"
586 [(set (match_operand:SI 0 "" "") (const_int 0))
587 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
588 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
589 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
590 (label_ref (match_operand:SI 4 "" "")) (pc)))
591 (set (match_dup 0) (const_int 1))
592 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
593 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
594 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
595 (label_ref (match_dup 4)) (pc)))]
598 { operands[5] = gen_reg_rtx (CCUNSmode);
599 operands[6] = gen_reg_rtx (CCmode);
602 (define_expand "udivmodsi4"
603 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
604 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
605 (match_operand:SI 2 "reg_or_cint_operand" "")))
606 (set (match_operand:SI 3 "gpc_reg_operand" "")
607 (umod:SI (match_dup 1) (match_dup 2)))])]
613 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
615 operands[2] = force_reg (SImode, operands[2]);
616 label = gen_label_rtx ();
617 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
618 operands[3], label));
621 operands[2] = force_reg (SImode, operands[2]);
623 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
631 (define_insn "andsi3"
632 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
633 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
634 (match_operand:SI 2 "and_operand" "?r,L,K,J")))
635 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
639 rlinm %0,%1,0,%m2,%M2
644 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
645 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
646 (match_operand:SI 2 "and_operand" "r,K,J,L"))
648 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
654 rlinm. %3,%1,0,%m2,%M2"
655 [(set_attr "type" "compare,compare,compare,delayed_compare")])
658 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
659 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
660 (match_operand:SI 2 "and_operand" "r,K,J,L"))
662 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
663 (and:SI (match_dup 1) (match_dup 2)))]
669 rlinm. %0,%1,0,%m2,%M2"
670 [(set_attr "type" "compare,compare,compare,delayed_compare")])
672 ;; Take a AND with a constant that cannot be done in a single insn and try to
673 ;; split it into two insns. This does not verify that the insns are valid
674 ;; since this need not be done as combine will do it.
677 [(set (match_operand:SI 0 "gpc_reg_operand" "")
678 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
679 (match_operand:SI 2 "non_and_cint_operand" "")))]
681 [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 3)))
682 (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
685 int maskval = INTVAL (operands[2]);
686 int i, transitions, last_bit_value;
687 int orig = maskval, first_c = maskval, second_c;
689 /* We know that MASKVAL must have more than 2 bit-transitions. Start at
690 the low-order bit and count for the third transition. When we get there,
691 make a first mask that has everything to the left of that position
692 a one. Then make the second mask to turn off whatever else is needed. */
694 for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
696 if (((maskval >>= 1) & 1) != last_bit_value)
697 last_bit_value ^= 1, transitions++;
701 first_c |= (~0) << i;
706 second_c = orig | ~ first_c;
708 operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
709 operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
712 (define_insn "iorsi3"
713 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
714 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
715 (match_operand:SI 2 "logical_operand" "r,K,J")))]
723 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
724 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r")
725 (match_operand:SI 2 "gpc_reg_operand" "r"))
727 (clobber (match_scratch:SI 3 "=r"))]
730 [(set_attr "type" "compare")])
733 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
734 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r")
735 (match_operand:SI 2 "gpc_reg_operand" "r"))
737 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
738 (ior:SI (match_dup 1) (match_dup 2)))]
741 [(set_attr "type" "compare")])
743 ;; Split an IOR that we can't do in one insn into two insns, each of which
744 ;; does one 16-bit part. This is used by combine.
747 [(set (match_operand:SI 0 "gpc_reg_operand" "")
748 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
749 (match_operand:SI 2 "non_logical_cint_operand" "")))]
751 [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
752 (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
755 operands[3] = gen_rtx (CONST_INT, VOIDmode,
756 INTVAL (operands[2]) & 0xffff0000);
757 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
760 (define_insn "xorsi3"
761 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
762 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
763 (match_operand:SI 2 "logical_operand" "r,K,J")))]
771 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
772 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r")
773 (match_operand:SI 2 "gpc_reg_operand" "r"))
775 (clobber (match_scratch:SI 3 "=r"))]
778 [(set_attr "type" "compare")])
781 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
782 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r")
783 (match_operand:SI 2 "gpc_reg_operand" "r"))
785 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
786 (xor:SI (match_dup 1) (match_dup 2)))]
789 [(set_attr "type" "compare")])
791 ;; Split an XOR that we can't do in one insn into two insns, each of which
792 ;; does one 16-bit part. This is used by combine.
795 [(set (match_operand:SI 0 "gpc_reg_operand" "")
796 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
797 (match_operand:SI 2 "non_logical_cint_operand" "")))]
799 [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
800 (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
803 operands[3] = gen_rtx (CONST_INT, VOIDmode,
804 INTVAL (operands[2]) & 0xffff0000);
805 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
809 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
810 (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
811 (match_operand:SI 2 "gpc_reg_operand" "r"))))]
816 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
817 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
818 (match_operand:SI 2 "gpc_reg_operand" "r")))
820 (clobber (match_scratch:SI 3 "=r"))]
823 [(set_attr "type" "compare")])
826 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
827 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
828 (match_operand:SI 2 "gpc_reg_operand" "r")))
830 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
831 (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
834 [(set_attr "type" "compare")])
837 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
838 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
839 (match_operand:SI 2 "gpc_reg_operand" "r")))]
844 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
845 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
846 (match_operand:SI 2 "gpc_reg_operand" "r"))
848 (clobber (match_scratch:SI 3 "=r"))]
851 [(set_attr "type" "compare")])
854 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
855 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
856 (match_operand:SI 2 "gpc_reg_operand" "r"))
858 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
859 (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
862 [(set_attr "type" "compare")])
865 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
866 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
867 (match_operand:SI 2 "gpc_reg_operand" "r")))]
872 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
873 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
874 (match_operand:SI 2 "gpc_reg_operand" "r"))
876 (clobber (match_scratch:SI 3 "=r"))]
879 [(set_attr "type" "compare")])
882 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
883 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
884 (match_operand:SI 2 "gpc_reg_operand" "r"))
886 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
887 (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
890 [(set_attr "type" "compare")])
893 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
894 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
895 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
900 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
901 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
902 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
904 (clobber (match_scratch:SI 3 "=r"))]
907 [(set_attr "type" "compare")])
910 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
911 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
912 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
914 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
915 (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
918 [(set_attr "type" "compare")])
921 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
922 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
923 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
928 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
929 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
930 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
932 (clobber (match_scratch:SI 3 "=r"))]
935 [(set_attr "type" "compare")])
938 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
939 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
940 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
942 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
943 (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
946 [(set_attr "type" "compare")])
948 ;; maskir insn. We need four forms because things might be in arbitrary
949 ;; orders. Don't define forms that only set CR fields because these
950 ;; would modify an input register.
953 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
954 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
955 (match_operand:SI 1 "gpc_reg_operand" "0"))
956 (and:SI (match_dup 2)
957 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
962 [(set (match_operand:SI 0 "register_operand" "=r")
963 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
964 (match_operand:SI 1 "gpc_reg_operand" "0"))
965 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
971 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
972 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
973 (match_operand:SI 3 "gpc_reg_operand" "r"))
974 (and:SI (not:SI (match_dup 2))
975 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
980 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
981 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
982 (match_operand:SI 2 "gpc_reg_operand" "r"))
983 (and:SI (not:SI (match_dup 2))
984 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
989 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
991 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
992 (match_operand:SI 1 "gpc_reg_operand" "0"))
993 (and:SI (match_dup 2)
994 (match_operand:SI 3 "gpc_reg_operand" "r")))
996 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
997 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
998 (and:SI (match_dup 2) (match_dup 3))))]
1001 [(set_attr "type" "compare")])
1004 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1006 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1007 (match_operand:SI 1 "gpc_reg_operand" "0"))
1008 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1011 (set (match_operand:SI 0 "register_operand" "=r")
1012 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
1013 (and:SI (match_dup 3) (match_dup 2))))]
1016 [(set_attr "type" "compare")])
1019 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1021 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1022 (match_operand:SI 3 "gpc_reg_operand" "r"))
1023 (and:SI (not:SI (match_dup 2))
1024 (match_operand:SI 1 "gpc_reg_operand" "0")))
1026 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1027 (ior:SI (and:SI (match_dup 2) (match_dup 3))
1028 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
1031 [(set_attr "type" "compare")])
1034 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1036 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1037 (match_operand:SI 2 "gpc_reg_operand" "r"))
1038 (and:SI (not:SI (match_dup 2))
1039 (match_operand:SI 1 "gpc_reg_operand" "0")))
1041 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1042 (ior:SI (and:SI (match_dup 3) (match_dup 2))
1043 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
1046 [(set_attr "type" "compare")])
1048 ;; Rotate and shift insns, in all their variants. These support shifts,
1049 ;; field inserts and extracts, and various combinations thereof.
1051 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1052 (match_operand:SI 1 "const_int_operand" "i")
1053 (match_operand:SI 2 "const_int_operand" "i"))
1054 (match_operand:SI 3 "gpc_reg_operand" "r"))]
1058 int start = INTVAL (operands[2]) & 31;
1059 int size = INTVAL (operands[1]) & 31;
1061 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
1062 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
1063 return \"rlimi %0,%3,%4,%h2,%h1\";
1066 (define_insn "extzv"
1067 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1068 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1069 (match_operand:SI 2 "const_int_operand" "i")
1070 (match_operand:SI 3 "const_int_operand" "i")))]
1074 int start = INTVAL (operands[3]) & 31;
1075 int size = INTVAL (operands[2]) & 31;
1077 if (start + size >= 32)
1078 operands[3] = const0_rtx;
1080 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
1081 return \"rlinm %0,%1,%3,%s2,31\";
1085 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1086 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1087 (match_operand:SI 2 "const_int_operand" "i")
1088 (match_operand:SI 3 "const_int_operand" "i"))
1090 (clobber (match_scratch:SI 4 "=r"))]
1094 int start = INTVAL (operands[3]) & 31;
1095 int size = INTVAL (operands[2]) & 31;
1097 /* If the bitfield being tested fits in the upper or lower half of a
1098 word, it is possible to use andiu. or andil. to test it. This is
1099 useful because the condition register set-use delay is smaller for
1100 andi[ul]. than for rlinm. This doesn't work when the starting bit
1101 position is 0 because the LT and GT bits may be set wrong. */
1103 if ((start > 0 && start + size <= 16) || start >= 16)
1105 operands[3] = gen_rtx (CONST_INT, VOIDmode,
1106 ((1 << (16 - (start & 15)))
1107 - (1 << (16 - (start & 15) - size))));
1109 return \"andiu. %4,%1,%3\";
1111 return \"andil. %4,%1,%3\";
1114 if (start + size >= 32)
1115 operands[3] = const0_rtx;
1117 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
1118 return \"rlinm. %4,%1,%3,%s2,31\";
1120 [(set_attr "type" "compare")])
1123 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1124 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1125 (match_operand:SI 2 "const_int_operand" "i")
1126 (match_operand:SI 3 "const_int_operand" "i"))
1128 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1129 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
1133 int start = INTVAL (operands[3]) & 31;
1134 int size = INTVAL (operands[2]) & 31;
1136 if (start >= 16 && start + size == 32)
1138 operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
1139 return \"andil. %0,%1,%3\";
1142 if (start + size >= 32)
1143 operands[3] = const0_rtx;
1145 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
1146 return \"rlinm. %0,%1,%3,%s2,31\";
1148 [(set_attr "type" "delayed_compare")])
1150 (define_insn "rotlsi3"
1151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1152 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1153 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
1155 "rl%I2nm %0,%1,%h2,0,31")
1158 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1159 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1160 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1162 (clobber (match_scratch:SI 3 "=r"))]
1164 "rl%I2nm. %3,%1,%h2,0,31"
1165 [(set_attr "type" "delayed_compare")])
1168 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1169 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1170 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1172 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1173 (rotate:SI (match_dup 1) (match_dup 2)))]
1175 "rl%I2nm. %0,%1,%h2,0,31"
1176 [(set_attr "type" "delayed_compare")])
1179 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1180 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1181 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1182 (match_operand:SI 3 "mask_operand" "L")))]
1184 "rl%I2nm %0,%1,%h2,%m3,%M3")
1187 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1189 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1190 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1191 (match_operand:SI 3 "mask_operand" "L"))
1193 (clobber (match_scratch:SI 4 "=r"))]
1195 "rl%I2nm. %4,%1,%h2,%m3,%M3"
1196 [(set_attr "type" "delayed_compare")])
1199 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1201 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1202 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1203 (match_operand:SI 3 "mask_operand" "L"))
1205 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1206 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
1208 "rl%I2nm. %0,%1,%h2,%m3,%M3"
1209 [(set_attr "type" "delayed_compare")])
1212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1215 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1216 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
1218 "rl%I2nm %0,%1,%h2,24,31")
1221 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1222 (compare:CC (zero_extend:SI
1224 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1225 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
1227 (clobber (match_scratch:SI 3 "=r"))]
1229 "rl%I2nm. %3,%1,%h2,24,31"
1230 [(set_attr "type" "delayed_compare")])
1233 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1234 (compare:CC (zero_extend:SI
1236 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1237 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
1239 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1240 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
1242 "rl%I2nm. %0,%1,%h2,24,31"
1243 [(set_attr "type" "delayed_compare")])
1246 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1249 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1250 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
1252 "rl%I2nm %0,%1,%h2,16,31")
1255 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1256 (compare:CC (zero_extend:SI
1258 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1259 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
1261 (clobber (match_scratch:SI 3 "=r"))]
1263 "rl%I2nm. %3,%1,%h2,16,31"
1264 [(set_attr "type" "delayed_compare")])
1267 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1268 (compare:CC (zero_extend:SI
1270 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1271 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
1273 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1274 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
1276 "rl%I2nm. %0,%1,%h2,16,31"
1277 [(set_attr "type" "delayed_compare")])
1279 ;; Note that we use "sle." instead of "sl." so that we can set
1280 ;; SHIFT_COUNT_TRUNCATED.
1282 (define_insn "ashlsi3"
1283 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1284 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1285 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
1286 (clobber (match_scratch:SI 3 "=q,X"))]
1293 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
1294 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1295 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1297 (clobber (match_scratch:SI 3 "=r,r"))
1298 (clobber (match_scratch:SI 4 "=q,X"))]
1303 [(set_attr "type" "delayed_compare")])
1306 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
1307 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1308 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1310 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1311 (ashift:SI (match_dup 1) (match_dup 2)))
1312 (clobber (match_scratch:SI 4 "=q,X"))]
1317 [(set_attr "type" "delayed_compare")])
1320 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1321 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1322 (match_operand:SI 2 "const_int_operand" "i"))
1323 (match_operand:SI 3 "mask_operand" "L")))]
1324 "includes_lshift_p (operands[2], operands[3])"
1325 "rlinm %0,%h1,%h2,%m3,%M3")
1328 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1330 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1331 (match_operand:SI 2 "const_int_operand" "i"))
1332 (match_operand:SI 3 "mask_operand" "L"))
1334 (clobber (match_scratch:SI 4 "=r"))]
1335 "includes_lshift_p (operands[2], operands[3])"
1336 "rlinm. %4,%h1,%h2,%m3,%M3"
1337 [(set_attr "type" "delayed_compare")])
1340 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1342 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1343 (match_operand:SI 2 "const_int_operand" "i"))
1344 (match_operand:SI 3 "mask_operand" "L"))
1346 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1347 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
1348 "includes_lshift_p (operands[2], operands[3])"
1349 "rlinm. %0,%h1,%h2,%m3,%M3"
1350 [(set_attr "type" "delayed_compare")])
1352 ;; The RS/6000 assembler mis-handles "sri x,x,0", so write that case as
1354 (define_insn "lshrsi3"
1355 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1356 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1357 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
1358 (clobber (match_scratch:SI 3 "=q,X"))]
1365 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
1366 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1367 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1369 (clobber (match_scratch:SI 3 "=r,r"))
1370 (clobber (match_scratch:SI 4 "=q,X"))]
1375 [(set_attr "type" "delayed_compare")])
1378 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
1379 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1380 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1382 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1383 (lshiftrt:SI (match_dup 1) (match_dup 2)))
1384 (clobber (match_scratch:SI 4 "=q,X"))]
1389 [(set_attr "type" "delayed_compare")])
1392 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1393 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1394 (match_operand:SI 2 "const_int_operand" "i"))
1395 (match_operand:SI 3 "mask_operand" "L")))]
1396 "includes_rshift_p (operands[2], operands[3])"
1397 "rlinm %0,%1,%s2,%m3,%M3")
1400 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1402 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1403 (match_operand:SI 2 "const_int_operand" "i"))
1404 (match_operand:SI 3 "mask_operand" "L"))
1406 (clobber (match_scratch:SI 4 "=r"))]
1407 "includes_rshift_p (operands[2], operands[3])"
1408 "rlinm. %4,%1,%s2,%m3,%M3"
1409 [(set_attr "type" "delayed_compare")])
1412 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1414 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1415 (match_operand:SI 2 "const_int_operand" "i"))
1416 (match_operand:SI 3 "mask_operand" "L"))
1418 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1419 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
1420 "includes_rshift_p (operands[2], operands[3])"
1421 "rlinm. %0,%1,%s2,%m3,%M3"
1422 [(set_attr "type" "delayed_compare")])
1425 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1428 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1429 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
1430 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
1431 "rlinm %0,%1,%s2,24,31")
1434 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1438 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1439 (match_operand:SI 2 "const_int_operand" "i")) 0))
1441 (clobber (match_scratch:SI 3 "=r"))]
1442 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
1443 "rlinm. %3,%1,%s2,24,31"
1444 [(set_attr "type" "delayed_compare")])
1447 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1451 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1452 (match_operand:SI 2 "const_int_operand" "i")) 0))
1454 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1455 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
1456 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
1457 "rlinm. %0,%1,%s2,24,31"
1458 [(set_attr "type" "delayed_compare")])
1461 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1464 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1465 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
1466 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
1467 "rlinm %0,%1,%s2,16,31")
1470 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1474 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1475 (match_operand:SI 2 "const_int_operand" "i")) 0))
1477 (clobber (match_scratch:SI 3 "=r"))]
1478 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
1479 "rlinm. %3,%1,%s2,16,31"
1480 [(set_attr "type" "delayed_compare")])
1483 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1487 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1488 (match_operand:SI 2 "const_int_operand" "i")) 0))
1490 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1491 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
1492 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
1493 "rlinm. %0,%1,%s2,16,31"
1494 [(set_attr "type" "delayed_compare")])
1497 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1499 (match_operand:SI 1 "gpc_reg_operand" "r"))
1500 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1506 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1508 (match_operand:SI 1 "gpc_reg_operand" "r"))
1509 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1515 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1517 (match_operand:SI 1 "gpc_reg_operand" "r"))
1518 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1524 (define_insn "ashrsi3"
1525 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1526 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1527 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
1528 (clobber (match_scratch:SI 3 "=q,X"))]
1535 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
1536 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1537 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1539 (clobber (match_scratch:SI 3 "=r,r"))
1540 (clobber (match_scratch:SI 4 "=q,X"))]
1545 [(set_attr "type" "delayed_compare")])
1548 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
1549 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1550 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1552 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1553 (ashiftrt:SI (match_dup 1) (match_dup 2)))
1554 (clobber (match_scratch:SI 4 "=q,X"))]
1559 [(set_attr "type" "delayed_compare")])
1561 (define_expand "extendqisi2"
1562 [(parallel [(set (match_dup 2)
1563 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1565 (clobber (scratch:SI))])
1566 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1567 (ashiftrt:SI (match_dup 2)
1569 (clobber (scratch:SI))])]
1572 { operands[1] = gen_lowpart (SImode, operands[1]);
1573 operands[2] = gen_reg_rtx (SImode); }")
1575 (define_expand "extendqihi2"
1576 [(parallel [(set (match_dup 2)
1577 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1579 (clobber (scratch:SI))])
1580 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
1581 (ashiftrt:SI (match_dup 2)
1583 (clobber (scratch:SI))])]
1586 { operands[0] = gen_lowpart (SImode, operands[0]);
1587 operands[1] = gen_lowpart (SImode, operands[1]);
1588 operands[2] = gen_reg_rtx (SImode); }")
1590 ;; Floating-point insns, excluding normal data motion.
1592 ;; We pretend that we have both SFmode and DFmode insns, while, in fact,
1593 ;; all fp insns are actually done in double. The only conversions we will
1594 ;; do will be when storing to memory. In that case, we will use the "frsp"
1595 ;; instruction before storing.
1597 ;; Note that when we store into a single-precision memory location, we need to
1598 ;; use the frsp insn first. If the register being stored isn't dead, we
1599 ;; need a scratch register for the frsp. But this is difficult when the store
1600 ;; is done by reload. It is not incorrect to do the frsp on the register in
1601 ;; this case, we just lose precision that we would have otherwise gotten but
1602 ;; is not guaranteed. Perhaps this should be tightened up at some point.
1604 (define_insn "extendsfdf2"
1605 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1606 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
1610 if (REGNO (operands[0]) == REGNO (operands[1]))
1613 return \"fmr %0,%1\";
1615 [(set_attr "type" "fp")])
1617 (define_insn "truncdfsf2"
1618 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1619 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
1623 if (REGNO (operands[0]) == REGNO (operands[1]))
1626 return \"fmr %0,%1\";
1628 [(set_attr "type" "fp")])
1630 (define_insn "negsf2"
1631 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1632 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
1635 [(set_attr "type" "fp")])
1637 (define_insn "abssf2"
1638 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1639 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
1642 [(set_attr "type" "fp")])
1645 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1646 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
1649 [(set_attr "type" "fp")])
1651 (define_insn "addsf3"
1652 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1653 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1654 (match_operand:SF 2 "gpc_reg_operand" "f")))]
1657 [(set_attr "type" "fp")])
1659 (define_insn "subsf3"
1660 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1661 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
1662 (match_operand:SF 2 "gpc_reg_operand" "f")))]
1665 [(set_attr "type" "fp")])
1667 (define_insn "mulsf3"
1668 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1669 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1670 (match_operand:SF 2 "gpc_reg_operand" "f")))]
1673 [(set_attr "type" "fp")])
1675 (define_insn "divsf3"
1676 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1677 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
1678 (match_operand:SF 2 "gpc_reg_operand" "f")))]
1681 [(set_attr "type" "fp")])
1684 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1685 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1686 (match_operand:SF 2 "gpc_reg_operand" "f"))
1687 (match_operand:SF 3 "gpc_reg_operand" "f")))]
1690 [(set_attr "type" "fp")])
1693 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1694 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1695 (match_operand:SF 2 "gpc_reg_operand" "f"))
1696 (match_operand:SF 3 "gpc_reg_operand" "f")))]
1699 [(set_attr "type" "fp")])
1702 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1703 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1704 (match_operand:SF 2 "gpc_reg_operand" "f"))
1705 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
1708 [(set_attr "type" "fp")])
1711 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1712 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1713 (match_operand:SF 2 "gpc_reg_operand" "f"))
1714 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
1717 [(set_attr "type" "fp")])
1719 (define_insn "negdf2"
1720 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1721 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
1724 [(set_attr "type" "fp")])
1726 (define_insn "absdf2"
1727 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1728 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
1731 [(set_attr "type" "fp")])
1734 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1735 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
1738 [(set_attr "type" "fp")])
1740 (define_insn "adddf3"
1741 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1742 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1743 (match_operand:DF 2 "gpc_reg_operand" "f")))]
1746 [(set_attr "type" "fp")])
1748 (define_insn "subdf3"
1749 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1750 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
1751 (match_operand:DF 2 "gpc_reg_operand" "f")))]
1754 [(set_attr "type" "fp")])
1756 (define_insn "muldf3"
1757 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1758 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1759 (match_operand:DF 2 "gpc_reg_operand" "f")))]
1762 [(set_attr "type" "fp")])
1764 (define_insn "divdf3"
1765 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1766 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
1767 (match_operand:DF 2 "gpc_reg_operand" "f")))]
1770 [(set_attr "type" "fp")])
1773 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1774 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1775 (match_operand:DF 2 "gpc_reg_operand" "f"))
1776 (match_operand:DF 3 "gpc_reg_operand" "f")))]
1779 [(set_attr "type" "fp")])
1782 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1783 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1784 (match_operand:DF 2 "gpc_reg_operand" "f"))
1785 (match_operand:DF 3 "gpc_reg_operand" "f")))]
1788 [(set_attr "type" "fp")])
1791 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1792 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1793 (match_operand:DF 2 "gpc_reg_operand" "f"))
1794 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
1797 [(set_attr "type" "fp")])
1800 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1801 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1802 (match_operand:DF 2 "gpc_reg_operand" "f"))
1803 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
1806 [(set_attr "type" "fp")])
1808 ;; Conversions to and from floating-point.
1809 (define_expand "floatsidf2"
1811 (plus:DI (zero_extend:DI
1812 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1815 (set (match_operand:DF 0 "gpc_reg_operand" "")
1816 (minus:DF (subreg:DF (match_dup 2) 0)
1821 #if HOST_BITS_PER_INT != BITS_PER_WORD
1822 /* Maybe someone can figure out how to do this in that case. I don't
1823 want to right now. */
1827 operands[2] = gen_reg_rtx (DImode);
1828 operands[3] = gen_rtx (CONST_INT, VOIDmode, 0x80000000);
1829 operands[4] = immed_double_const (0, 0x43300000, DImode);
1830 operands[5] = force_reg (DFmode, immed_double_const (0x43300000,
1831 0x80000000, DFmode));
1834 (define_expand "floatunssidf2"
1836 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1838 (set (match_operand:DF 0 "gpc_reg_operand" "")
1839 (minus:DF (subreg:DF (match_dup 2) 0)
1844 #if HOST_BITS_PER_INT != BITS_PER_WORD
1845 /* Maybe someone can figure out how to do this in that case. I don't
1846 want to right now. */
1850 operands[2] = gen_reg_rtx (DImode);
1851 operands[3] = immed_double_const (0, 0x43300000, DImode);
1852 operands[4] = force_reg (DFmode, immed_double_const (0x43300000, 0, DFmode));
1855 ;; For the above two cases, we always split.
1857 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1858 (plus:DI (zero_extend:DI
1859 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1860 (match_operand:SI 2 "logical_operand" "")))
1861 (match_operand:DI 3 "immediate_operand" "")))]
1862 "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD
1863 && GET_CODE (operands[3]) == CONST_DOUBLE
1864 && CONST_DOUBLE_LOW (operands[3]) == 0"
1865 [(set (match_dup 6) (xor:SI (match_dup 1) (match_dup 2)))
1866 (set (match_dup 4) (match_dup 5))]
1868 { operands[4] = operand_subword (operands[0], 0, 0, DImode);
1869 operands[5] = operand_subword (operands[3], 0, 0, DImode);
1870 operands[6] = operand_subword (operands[0], 1, 0, DImode);
1874 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
1875 (plus:DI (zero_extend:DI
1876 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1877 (match_operand:SI 2 "logical_operand" "rKJ")))
1878 (match_operand:DI 3 "immediate_operand" "n")))]
1879 "HOST_BITS_PER_INT == BITS_PER_WORD
1880 && GET_CODE (operands[3]) == CONST_DOUBLE
1881 && CONST_DOUBLE_LOW (operands[3]) == 0"
1885 [(set (match_operand:DI 0 "gpc_reg_operand" "=")
1886 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1887 (match_operand:DI 2 "immediate_operand" "")))]
1888 "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD
1889 && GET_CODE (operands[2]) == CONST_DOUBLE
1890 && CONST_DOUBLE_LOW (operands[2]) == 0"
1891 [(set (match_dup 3) (match_dup 4))
1892 (set (match_dup 5) (match_dup 1))]
1894 { operands[3] = operand_subword (operands[0], 0, 0, DImode);
1895 operands[4] = operand_subword (operands[2], 0, 0, DImode);
1896 operands[5] = operand_subword (operands[0], 1, 0, DImode);
1898 if (rtx_equal_p (operands[1], operands[5]))
1900 emit_move_insn (operands[3], operands[4]);
1904 if (rtx_equal_p (operands[1], operands[3]))
1908 temp = operands[3]; operands[3] = operands[5]; operands[5] = temp;
1909 temp = operands[4]; operands[4] = operands[1]; operands[1] = temp;
1914 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
1915 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
1916 (match_operand:DI 2 "immediate_operand" "n")))]
1917 "HOST_BITS_PER_INT == BITS_PER_WORD
1918 && GET_CODE (operands[2]) == CONST_DOUBLE
1919 && CONST_DOUBLE_LOW (operands[2]) == 0"
1922 (define_expand "fix_truncdfsi2"
1923 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1924 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
1928 emit_insn (gen_trunc_call (operands[0], operands[1],
1929 gen_rtx (SYMBOL_REF, Pmode, \"itrunc\")));
1933 (define_expand "fixuns_truncdfsi2"
1934 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1935 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
1939 emit_insn (gen_trunc_call (operands[0], operands[1],
1940 gen_rtx (SYMBOL_REF, Pmode, \"uitrunc\")));
1945 (define_expand "trunc_call"
1946 [(parallel [(set (match_operand:SI 0 "" "")
1947 (fix:SI (match_operand:DF 1 "" "")))
1948 (use (match_operand:SI 2 "" ""))])]
1952 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
1953 rtx first = XVECEXP (insns, 0, 0);
1954 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
1956 REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
1958 REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
1964 (define_expand "trunc_call_rtl"
1965 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
1967 (parallel [(set (reg:SI 3)
1968 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
1969 (clobber (scratch:SI))])
1970 (set (match_operand:SI 0 "gpc_reg_operand" "")
1975 rs6000_trunc_used = 1;
1978 ;; Define the DImode operations that can be done in a small number
1980 (define_insn "adddi3"
1981 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1982 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
1983 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
1986 a %L0,%L1,%L2\;ae %0,%1,%2
1987 ai %L0,%L1,%2\;a%G2e %0,%1")
1989 (define_insn "subdi3"
1990 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
1991 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
1992 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
1995 sf %L0,%L2,%L1\;sfe %0,%2,%1
1996 sfi %L0,%L2,%1\;sf%G1e %0,%2")
1998 (define_insn "negdi2"
1999 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2000 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
2002 "sfi %L0,%L1,0\;sfze %0,%1")
2004 (define_insn "mulsidi3"
2005 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2006 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2007 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
2008 (clobber (match_scratch:SI 3 "=q"))]
2010 "mul %0,%1,%2\;mfmq %L0")
2012 ;; If operands 0 and 2 are in the same register, we have a problem. But
2013 ;; operands 0 and 1 (the usual case) can be in the same register. That's
2014 ;; why we have the strange constraints below.
2015 (define_insn "ashldi3"
2016 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
2017 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
2018 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
2019 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
2022 sli %0,%L1,%h2\;cal %L0,0(0)
2023 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
2024 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
2025 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2")
2027 (define_insn "lshrdi3"
2028 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
2029 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
2030 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
2031 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
2034 cal %0,0(0)\;s%A2i %L0,%1,%h2
2035 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
2036 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
2037 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2")
2039 ;; Shift by a variable amount is too complex to be worth open-coding. We
2040 ;; just handle shifts by constants.
2042 (define_expand "ashrdi3"
2043 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=")
2044 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
2045 (match_operand:SI 2 "general_operand" "")))
2046 (clobber (match_scratch:SI 3 ""))])]
2049 { if (GET_CODE (operands[2]) != CONST_INT)
2054 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
2055 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
2056 (match_operand:SI 2 "const_int_operand" "M,i")))
2057 (clobber (match_scratch:SI 3 "=X,q"))]
2060 srai %0,%1,31\;srai %L0,%1,%h2
2061 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2")
2063 ;; Now define ways of moving data around.
2065 ;; For SI, we special-case integers that can't be loaded in one insn. We
2066 ;; do the load 16-bits at a time. We could do this by loading from memory,
2067 ;; and this is even supposed to be faster, but it is simpler not to get
2068 ;; integers in the TOC.
2069 (define_expand "movsi"
2070 [(set (match_operand:SI 0 "general_operand" "")
2071 (match_operand:SI 1 "any_operand" ""))]
2075 if (GET_CODE (operands[0]) != REG)
2076 operands[1] = force_reg (SImode, operands[1]);
2078 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
2080 operands[1] = force_const_mem (SImode, operands[1]);
2081 if (! memory_address_p (SImode, XEXP (operands[1], 0))
2082 && ! reload_in_progress)
2083 operands[1] = change_address (operands[1], SImode,
2084 XEXP (operands[1], 0));
2087 if (GET_CODE (operands[1]) == CONST_INT
2088 && (unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
2089 && (INTVAL (operands[1]) & 0xffff) != 0)
2091 emit_move_insn (operands[0],
2092 gen_rtx (CONST_INT, VOIDmode,
2093 INTVAL (operands[1]) & 0xffff0000));
2094 emit_insn (gen_iorsi3 (operands[0], operands[0],
2095 gen_rtx (CONST_INT, VOIDmode,
2096 INTVAL (operands[1]) & 0xffff)));
2102 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m,r,r,r,*c*q,*l,*h")
2103 (match_operand:SI 1 "input_operand" "r,m,r,I,J,*h,r,r,0"))]
2104 "gpc_reg_operand (operands[0], SImode)
2105 || gpc_reg_operand (operands[1], SImode)"
2116 [(set_attr "type" "*,load,*,*,*,*,*,mtlr,*")])
2118 ;; Split a load of a large constant into the appropriate two-insn
2122 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2123 (match_operand:SI 1 "const_int_operand" ""))]
2124 "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
2125 && (INTVAL (operands[1]) & 0xffff) != 0"
2129 (ior:SI (match_dup 0)
2133 operands[2] = gen_rtx (CONST_INT, VOIDmode,
2134 INTVAL (operands[1]) & 0xffff0000);
2135 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
2139 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
2140 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
2142 (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
2145 [(set_attr "type" "compare")])
2147 (define_expand "movhi"
2148 [(set (match_operand:HI 0 "general_operand" "")
2149 (match_operand:HI 1 "any_operand" ""))]
2153 if (GET_CODE (operands[0]) != REG)
2154 operands[1] = force_reg (HImode, operands[1]);
2156 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
2158 operands[1] = force_const_mem (HImode, operands[1]);
2159 if (! memory_address_p (HImode, XEXP (operands[1], 0))
2160 && ! reload_in_progress)
2161 operands[1] = change_address (operands[1], HImode,
2162 XEXP (operands[1], 0));
2167 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*h,*h")
2168 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,0"))]
2169 "gpc_reg_operand (operands[0], HImode)
2170 || gpc_reg_operand (operands[1], HImode)"
2179 [(set_attr "type" "*,load,*,*,*,*,*")])
2181 (define_expand "movqi"
2182 [(set (match_operand:QI 0 "general_operand" "")
2183 (match_operand:QI 1 "any_operand" ""))]
2187 if (GET_CODE (operands[0]) != REG)
2188 operands[1] = force_reg (QImode, operands[1]);
2190 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
2192 operands[1] = force_const_mem (QImode, operands[1]);
2193 if (! memory_address_p (QImode, XEXP (operands[1], 0))
2194 && ! reload_in_progress)
2195 operands[1] = change_address (operands[1], QImode,
2196 XEXP (operands[1], 0));
2201 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*h,*h")
2202 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,0"))]
2203 "gpc_reg_operand (operands[0], QImode)
2204 || gpc_reg_operand (operands[1], QImode)"
2213 [(set_attr "type" "*,load,*,*,*,*,*")])
2215 ;; Here is how to move condition codes around. When we store CC data in
2216 ;; an integer register or memory, we store just the high-order 4 bits.
2217 ;; This lets us not shift in the most common case of CR0.
2218 (define_expand "movcc"
2219 [(set (match_operand:CC 0 "nonimmediate_operand" "")
2220 (match_operand:CC 1 "nonimmediate_operand" ""))]
2225 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
2226 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
2227 "register_operand (operands[0], CCmode)
2228 || register_operand (operands[1], CCmode)"
2232 rlinm %1,%1,%F0,0,31\;mtcrf %R0,%1\;rlinm %1,%1,%f0,0,31
2234 mfcr %0\;rlinm %0,%0,%f1,0,3
2238 [(set_attr "type" "*,*,*,compare,*,*,load,*")])
2240 ;; For floating-point, we normally deal with the floating-point registers.
2241 ;; The sole exception is that parameter passing can produce floating-point
2242 ;; values in fixed-point registers. Unless the value is a simple constant
2243 ;; or already in memory, we deal with this by allocating memory and copying
2244 ;; the value explicitly via that memory location.
2245 (define_expand "movsf"
2246 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2247 (match_operand:SF 1 "any_operand" ""))]
2251 /* If we are called from reload, we might be getting a SUBREG of a hard
2252 reg. So expand it. */
2253 if (GET_CODE (operands[0]) == SUBREG
2254 && GET_CODE (SUBREG_REG (operands[0])) == REG
2255 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
2256 operands[0] = alter_subreg (operands[0]);
2257 if (GET_CODE (operands[1]) == SUBREG
2258 && GET_CODE (SUBREG_REG (operands[1])) == REG
2259 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
2260 operands[1] = alter_subreg (operands[1]);
2262 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
2266 /* If this is a store to memory or another integer register do the
2267 move directly. Otherwise store to a temporary stack slot and
2268 load from there into a floating point register. */
2270 if (GET_CODE (operands[0]) == MEM
2271 || (GET_CODE (operands[0]) == REG
2272 && (REGNO (operands[0]) < 32
2273 || (reload_in_progress
2274 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
2276 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
2277 operand_subword (operands[1], 0, 0, SFmode));
2281 stack_slot = gen_rtx (MEM, SFmode, plus_constant (stack_pointer_rtx, 4));
2282 emit_move_insn (stack_slot, operands[1]);
2283 emit_move_insn (operands[0], stack_slot);
2287 if (GET_CODE (operands[0]) == MEM)
2288 operands[1] = force_reg (SFmode, operands[1]);
2290 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
2294 if (GET_CODE (operands[1]) == MEM
2295 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
2296 || GET_CODE (operands[1]) == CONST_DOUBLE
2298 || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
2299 || (reload_in_progress && GET_CODE (operands[1]) == REG
2300 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
2302 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
2303 operand_subword (operands[1], 0, 0, SFmode));
2307 if (reload_in_progress)
2308 stack_slot = gen_rtx (MEM, SFmode,
2309 plus_constant (stack_pointer_rtx, 4));
2311 stack_slot = assign_stack_temp (SFmode, 4, 0);
2312 emit_move_insn (stack_slot, operands[1]);
2313 emit_move_insn (operands[0], stack_slot);
2317 if (CONSTANT_P (operands[1]))
2319 operands[1] = force_const_mem (SFmode, operands[1]);
2320 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
2321 && ! reload_in_progress)
2322 operands[1] = change_address (operands[1], SFmode,
2323 XEXP (operands[1], 0));
2328 [(set (match_operand:SF 0 "gpc_reg_operand" "=r,r")
2329 (match_operand:SF 1 "mem_or_easy_const_operand" "G,m"))]
2330 "REGNO (operands[0]) <= 31"
2334 [(set_attr "type" "*,load")])
2337 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2338 (match_operand:SF 1 "easy_fp_constant" ""))]
2339 "reload_completed && REGNO (operands[0]) <= 31"
2340 [(set (match_dup 2) (match_dup 3))]
2342 { operands[2] = operand_subword (operands[0], 0, 0, SFmode);
2343 operands[3] = operand_subword (operands[1], 0, 0, SFmode); }")
2346 [(set (match_operand:SF 0 "fp_reg_or_mem_operand" "=f,f,m")
2347 (match_operand:SF 1 "input_operand" "f,m,f"))]
2348 "gpc_reg_operand (operands[0], SFmode)
2349 || gpc_reg_operand (operands[1], SFmode)"
2353 frsp %1,%1\;stfs%U0%X0 %1,%0"
2354 [(set_attr "type" "fp,load,*")])
2356 (define_expand "movdf"
2357 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2358 (match_operand:DF 1 "any_operand" ""))]
2362 /* If we are called from reload, we might be getting a SUBREG of a hard
2363 reg. So expand it. */
2364 if (GET_CODE (operands[0]) == SUBREG
2365 && GET_CODE (SUBREG_REG (operands[0])) == REG
2366 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
2367 operands[0] = alter_subreg (operands[0]);
2368 if (GET_CODE (operands[1]) == SUBREG
2369 && GET_CODE (SUBREG_REG (operands[1])) == REG
2370 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
2371 operands[1] = alter_subreg (operands[1]);
2373 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
2377 /* If this is a store to memory or another integer register do the
2378 move directly. Otherwise store to a temporary stack slot and
2379 load from there into a floating point register. */
2381 if (GET_CODE (operands[0]) == MEM
2382 || (GET_CODE (operands[0]) == REG
2383 && (REGNO (operands[0]) < 32
2384 || (reload_in_progress
2385 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
2387 emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
2388 operand_subword (operands[1], 0, 0, DFmode));
2389 emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
2390 operand_subword (operands[1], 1, 0, DFmode));
2394 stack_slot = gen_rtx (MEM, DFmode, plus_constant (stack_pointer_rtx, 8));
2395 emit_move_insn (stack_slot, operands[1]);
2396 emit_move_insn (operands[0], stack_slot);
2400 if (GET_CODE (operands[0]) == MEM)
2402 if (GET_CODE (operands[1]) == MEM)
2404 emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
2405 operand_subword (operands[1], 0, 0, DFmode));
2406 emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
2407 operand_subword (operands[1], 1, 0, DFmode));
2411 operands[1] = force_reg (DFmode, operands[1]);
2414 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
2418 if (GET_CODE (operands[1]) == MEM
2419 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
2420 || GET_CODE (operands[1]) == CONST_DOUBLE
2422 || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
2423 || (reload_in_progress && GET_CODE (operands[1]) == REG
2424 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
2426 emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
2427 operand_subword (operands[1], 0, 0, DFmode));
2428 emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
2429 operand_subword (operands[1], 1, 0, DFmode));
2433 if (reload_in_progress)
2434 stack_slot = gen_rtx (MEM, DFmode,
2435 plus_constant (stack_pointer_rtx, 8));
2437 stack_slot = assign_stack_temp (DFmode, 8, 0);
2438 emit_move_insn (stack_slot, operands[1]);
2439 emit_move_insn (operands[0], stack_slot);
2443 if (CONSTANT_P (operands[1]))
2445 operands[1] = force_const_mem (DFmode, operands[1]);
2446 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
2447 && ! reload_in_progress)
2448 operands[1] = change_address (operands[1], DFmode,
2449 XEXP (operands[1], 0));
2454 [(set (match_operand:DF 0 "gpc_reg_operand" "=r,r")
2455 (match_operand:DF 1 "mem_or_easy_const_operand" "G,m"))]
2456 "REGNO (operands[0]) <= 31"
2460 [(set_attr "type" "*,load")])
2463 [(set (match_operand:DF 0 "gpc_reg_operand" "")
2464 (match_operand:DF 1 "easy_fp_constant" ""))]
2465 "reload_completed && REGNO (operands[0]) <= 31"
2466 [(set (match_dup 2) (match_dup 3))
2467 (set (match_dup 4) (match_dup 5))]
2469 { operands[2] = operand_subword (operands[0], 0, 0, DFmode);
2470 operands[3] = operand_subword (operands[1], 0, 0, DFmode);
2471 operands[4] = operand_subword (operands[0], 1, 0, DFmode);
2472 operands[5] = operand_subword (operands[1], 1, 0, DFmode); }")
2475 [(set (match_operand:DF 0 "fp_reg_or_mem_operand" "=f,f,m")
2476 (match_operand:DF 1 "fp_reg_or_mem_operand" "f,m,f"))]
2477 "gpc_reg_operand (operands[0], DFmode)
2478 || gpc_reg_operand (operands[1], DFmode)"
2483 [(set_attr "type" "fp,load,*")])
2485 ;; Next come the multi-word integer load and store and the load and store
2487 (define_expand "movdi"
2488 [(set (match_operand:DI 0 "general_operand" "")
2489 (match_operand:DI 1 "general_operand" ""))]
2493 if (GET_CODE (operands[1]) == CONST_DOUBLE
2494 || GET_CODE (operands[1]) == CONST_INT)
2496 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
2497 operand_subword (operands[1], 0, 0, DImode));
2498 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
2499 operand_subword (operands[1], 1, 0, DImode));
2503 if (GET_CODE (operands[0]) == MEM)
2504 operands[1] = force_reg (DImode, operands[1]);
2508 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m")
2509 (match_operand:DI 1 "input_operand" "r,m,r"))]
2510 "gpc_reg_operand (operands[0], DImode)
2511 || gpc_reg_operand (operands[1], DImode)"
2514 switch (which_alternative)
2517 /* We normally copy the low-numbered register first. However, if
2518 the first register operand 0 is the same as the second register of
2519 operand 1, we must copy in the opposite order. */
2520 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
2521 return \"oril %L0,%L1,0\;oril %0,%1,0\";
2523 return \"oril %0,%1,0\;oril %L0,%L1,0\";
2525 /* If the low-address word is used in the address, we must load it
2526 last. Otherwise, load it first. Note that we cannot have
2527 auto-increment in that case since the address register is known to be
2529 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
2531 return \"l %L0,%L1\;l %0,%1\";
2533 return \"l%U1 %0,%1\;l %L0,%L1\";
2535 return \"st%U0 %1,%0\;st %L1,%L0\";
2538 [(set_attr "type" "*,load,*")])
2540 ;; TImode is similar, except that we usually want to compute the address into
2541 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
2542 ;; clobbered in stsi, so we need a SCRATCH for it.
2543 (define_expand "movti"
2544 [(parallel [(set (match_operand:TI 0 "general_operand" "")
2545 (match_operand:TI 1 "general_operand" ""))
2546 (clobber (scratch:SI))])]
2550 if (GET_CODE (operands[0]) == MEM)
2551 operands[1] = force_reg (TImode, operands[1]);
2553 if (GET_CODE (operands[0]) == MEM
2554 && GET_CODE (XEXP (operands[0], 0)) != REG
2555 && ! reload_in_progress)
2556 operands[0] = change_address (operands[0], TImode,
2557 copy_addr_to_reg (XEXP (operands[0], 0)));
2559 if (GET_CODE (operands[1]) == MEM
2560 && GET_CODE (XEXP (operands[1], 0)) != REG
2561 && ! reload_in_progress)
2562 operands[1] = change_address (operands[1], TImode,
2563 copy_addr_to_reg (XEXP (operands[1], 0)));
2566 ;; We say that MQ is clobbered in the last alternative because the first
2567 ;; alternative would never get used otherwise since it would need a reload
2568 ;; while the 2nd alternative would not. We put memory cases first so they
2569 ;; are preferred. Otherwise, we'd try to reload the output instead of
2570 ;; giving the SCRATCH mq.
2572 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,r,r,r")
2573 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
2574 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
2575 "gpc_reg_operand (operands[0], TImode)
2576 || gpc_reg_operand (operands[1], TImode)"
2579 switch (which_alternative)
2582 return \"stsi %1,%P0,16\";
2585 return \"st%U0 %1,%0\;st %L1,%L0\;st %Y1,%Y0\;st %Z1,%Z0\";
2588 /* Normally copy registers with lowest numbered register copied first.
2589 But copy in the other order if the first register of the output
2590 is the second, third, or fourth register in the input. */
2591 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
2592 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
2593 return \"oril %Z0,%Z1,0\;oril %Y0,%Y1,0\;oril %L0,%L1,0\;oril %0,%1,0\";
2595 return \"oril %0,%1,0\;oril %L0,%L1,0\;oril %Y0,%Y1,0\;oril %Z0,%Z1,0\";
2597 /* If the address is not used in the output, we can use lsi. Otherwise,
2598 fall through to generating four loads. */
2599 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
2600 return \"lsi %0,%P1,16\";
2601 /* ... fall through ... */
2603 /* If the address register is the same as the register for the lowest-
2604 addressed word, load it last. Similarly for the next two words.
2605 Otherwise load lowest address to highest. */
2606 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
2608 return \"l %L0,%L1\;l %Y0,%Y1\;l %Z0,%Z1\;l %0,%1\";
2609 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
2610 REGNO (operands[0]) + 2, operands[1], 0))
2611 return \"l %0,%1\;l %Y0,%Y1\;l %Z0,%Z1\;l %L0,%L1\";
2612 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
2613 REGNO (operands[0]) + 3, operands[1], 0))
2614 return \"l %0,%1\;l %L0,%L1\;l %Z0,%Z1\;l %Y0,%Y1\";
2616 return \"l%U1 %0,%1\;l %L0,%L1\;l %Y0,%Y1\;l %Z0,%Z1\";
2619 [(set_attr "type" "*,load,load,*,*")])
2621 (define_expand "load_multiple"
2622 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
2623 (match_operand:SI 1 "" ""))
2624 (use (match_operand:SI 2 "" ""))])]
2633 /* Support only loading a constant number of fixed-point registers from
2634 memory and only bother with this if more than two; the machine
2635 doesn't support more than eight. */
2636 if (GET_CODE (operands[2]) != CONST_INT
2637 || INTVAL (operands[2]) <= 2
2638 || INTVAL (operands[2]) > 8
2639 || GET_CODE (operands[1]) != MEM
2640 || GET_CODE (operands[0]) != REG
2641 || REGNO (operands[0]) >= 32)
2644 count = INTVAL (operands[2]);
2645 regno = REGNO (operands[0]);
2647 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
2648 from = force_reg (SImode, XEXP (operands[1], 0));
2650 for (i = 0; i < count; i++)
2651 XVECEXP (operands[3], 0, i)
2652 = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
2653 gen_rtx (MEM, SImode, plus_constant (from, i * 4)));
2657 [(match_parallel 0 "load_multiple_operation"
2658 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
2659 (match_operand:SI 2 "indirect_operand" "Q"))])]
2663 /* We have to handle the case where the pseudo used to contain the address
2664 is assigned to one of the output registers. In that case, do the
2665 lsi, but then load the correct value. This is a bit of a mess, but is
2666 the best we can do. */
2667 static char result[100];
2671 strcpy (result, \"lsi %1,%P2,%N0\");
2672 for (i = 0; i < XVECLEN (operands[0], 0); i++)
2673 if (refers_to_regno_p (REGNO (operands[1]) + i,
2674 REGNO (operands[1]) + i + 1, operands[2], 0))
2676 sprintf (newload, \"\;l %d,%d(%d)\",
2677 REGNO (operands[1]) + i,
2678 i * 4, REGNO (XEXP (operands[2], 0)));
2679 strcat (result, newload);
2684 [(set_attr "type" "load")])
2686 (define_expand "store_multiple"
2687 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
2688 (match_operand:SI 1 "" ""))
2689 (clobber (scratch:SI))
2690 (use (match_operand:SI 2 "" ""))])]
2699 /* Support only storing a constant number of fixed-point registers to
2700 memory and only bother with this if more than two; the machine
2701 doesn't support more than eight. */
2702 if (GET_CODE (operands[2]) != CONST_INT
2703 || INTVAL (operands[2]) <= 2
2704 || INTVAL (operands[2]) > 8
2705 || GET_CODE (operands[0]) != MEM
2706 || GET_CODE (operands[1]) != REG
2707 || REGNO (operands[1]) >= 32)
2710 count = INTVAL (operands[2]);
2711 regno = REGNO (operands[1]);
2713 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
2714 to = force_reg (SImode, XEXP (operands[0], 0));
2716 XVECEXP (operands[3], 0, 0)
2717 = gen_rtx (SET, VOIDmode, gen_rtx (MEM, SImode, to), operands[1]);
2718 XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
2719 gen_rtx (SCRATCH, SImode));
2721 for (i = 1; i < count; i++)
2722 XVECEXP (operands[3], 0, i + 1)
2723 = gen_rtx (SET, VOIDmode,
2724 gen_rtx (MEM, SImode, plus_constant (to, i * 4)),
2725 gen_rtx (REG, SImode, regno + i));
2729 [(match_parallel 0 "store_multiple_operation"
2730 [(set (match_operand:SI 1 "indirect_operand" "=Q")
2731 (match_operand:SI 2 "gpc_reg_operand" "r"))
2732 (clobber (match_scratch:SI 3 "=q"))])]
2736 ;; Define insns that do load or store with update. Some of these we can
2737 ;; get by using pre-decrement or pre-increment, but the hardware can also
2738 ;; do cases where the increment is not the size of the object.
2740 ;; In all these cases, we use operands 0 and 1 for the register being
2741 ;; incremented because those are the operands that local-alloc will
2742 ;; tie and these are the pair most likely to be tieable (and the ones
2743 ;; that will benefit the most).
2746 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
2747 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2748 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2749 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2750 (plus:SI (match_dup 1) (match_dup 2)))]
2755 [(set_attr "type" "load,load")])
2758 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2759 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2760 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2761 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2762 (plus:SI (match_dup 1) (match_dup 2)))]
2769 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
2770 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2771 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2772 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2773 (plus:SI (match_dup 1) (match_dup 2)))]
2778 [(set_attr "type" "load,load")])
2781 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
2783 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2784 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
2785 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2786 (plus:SI (match_dup 1) (match_dup 2)))]
2791 [(set_attr "type" "load,load")])
2794 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
2796 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2797 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
2798 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2799 (plus:SI (match_dup 1) (match_dup 2)))]
2804 [(set_attr "type" "load,load")])
2807 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2808 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2809 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
2810 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2811 (plus:SI (match_dup 1) (match_dup 2)))]
2816 [(set_attr "type" "load,load")])
2819 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
2820 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2821 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2822 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2823 (plus:SI (match_dup 1) (match_dup 2)))]
2828 [(set_attr "type" "load,load")])
2831 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
2833 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2834 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
2835 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2836 (plus:SI (match_dup 1) (match_dup 2)))]
2841 [(set_attr "type" "load,load")])
2844 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2845 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2846 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
2847 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2848 (plus:SI (match_dup 1) (match_dup 2)))]
2855 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
2856 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2857 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2858 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2859 (plus:SI (match_dup 1) (match_dup 2)))]
2864 [(set_attr "type" "load,load")])
2867 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2868 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2869 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
2870 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2871 (plus:SI (match_dup 1) (match_dup 2)))]
2874 frsp %3,%3\;stfsux %3,%0,%2
2875 frsp %3,%3\;stfsu %3,%2(%0)")
2878 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
2879 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2880 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2881 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2882 (plus:SI (match_dup 1) (match_dup 2)))]
2887 [(set_attr "type" "load,load")])
2890 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2891 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2892 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
2893 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2894 (plus:SI (match_dup 1) (match_dup 2)))]
2900 ;; Next come insns related to the calling sequence.
2902 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
2903 ;; We move the back-chain and decrement the stack pointer.
2905 (define_expand "allocate_stack"
2907 (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
2910 { rtx chain = gen_reg_rtx (SImode);
2911 rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
2913 emit_move_insn (chain, stack_bot);
2914 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, operands[0]));
2915 emit_move_insn (stack_bot, chain);
2919 ;; These patterns say how to save and restore the stack pointer. We need not
2920 ;; save the stack pointer at function level since we are careful to
2921 ;; preserve the backchain. At block level, we have to restore the backchain
2922 ;; when we restore the stack pointer.
2924 ;; For nonlocal gotos, we must save both the stack pointer and its
2925 ;; backchain and restore both. Note that in the nonlocal case, the
2926 ;; save area is a memory location.
2928 (define_expand "save_stack_function"
2929 [(use (const_int 0))]
2933 (define_expand "restore_stack_function"
2934 [(use (const_int 0))]
2938 (define_expand "restore_stack_block"
2939 [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
2940 (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
2941 (set (mem:SI (match_dup 0)) (match_dup 2))]
2944 { operands[2] = gen_reg_rtx (SImode); }")
2946 (define_expand "save_stack_nonlocal"
2947 [(match_operand:DI 0 "memory_operand" "")
2948 (match_operand:SI 1 "register_operand" "")]
2952 rtx temp = gen_reg_rtx (SImode);
2954 /* Copy the backchain to the first word, sp to the second. */
2955 emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
2956 emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
2957 emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
2961 (define_expand "restore_stack_nonlocal"
2962 [(match_operand:SI 0 "register_operand" "")
2963 (match_operand:DI 1 "memory_operand" "")]
2967 rtx temp = gen_reg_rtx (SImode);
2969 /* Restore the backchain from the first word, sp from the second. */
2970 emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
2971 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
2972 emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
2976 ;; A function pointer is a pointer to a data area whose first word contains
2977 ;; the actual address of the function, whose second word contains a pointer
2978 ;; to its TOC, and whose third word contains a value to place in the static
2979 ;; chain register (r11). Note that if we load the static chain, our
2980 ;; "trampoline" need not have any executable code.
2982 ;; operands[0] is an SImode pseudo in which we place the address of the
2984 ;; operands[1] is the address of data area of the function to call
2986 (define_expand "call_via_ptr"
2987 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2988 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
2989 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
2992 (mem:SI (plus:SI (match_dup 1)
2995 (mem:SI (plus:SI (match_dup 1)
3002 (define_expand "call"
3003 [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
3004 (match_operand 1 "" ""))
3005 (clobber (scratch:SI))])]
3009 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
3012 operands[0] = XEXP (operands[0], 0);
3013 if (GET_CODE (operands[0]) != SYMBOL_REF)
3015 rtx temp = gen_reg_rtx (SImode);
3017 emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[0])));
3022 (define_expand "call_value"
3023 [(parallel [(set (match_operand 0 "" "")
3024 (call (mem:SI (match_operand:SI 1 "address_operand" ""))
3025 (match_operand 2 "" "")))
3026 (clobber (scratch:SI))])]
3030 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
3033 operands[1] = XEXP (operands[1], 0);
3034 if (GET_CODE (operands[1]) != SYMBOL_REF)
3036 rtx temp = gen_reg_rtx (SImode);
3038 emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[1])));
3044 [(call (mem:SI (match_operand:SI 0 "call_operand" "l,s"))
3045 (match_operand 1 "" "fg,fg"))
3046 (clobber (match_scratch:SI 2 "=l,l"))]
3050 bl %z0\;cror %.,%.,%.")
3053 [(set (match_operand 0 "" "=fg,fg")
3054 (call (mem:SI (match_operand:SI 1 "call_operand" "l,s"))
3055 (match_operand 2 "" "fg,fg")))
3056 (clobber (match_scratch:SI 3 "=l,l"))]
3060 bl %z1\;cror %.,%.,%.")
3062 ;; Call subroutine returning any type.
3064 (define_expand "untyped_call"
3065 [(parallel [(call (match_operand 0 "" "")
3067 (match_operand 1 "" "")
3068 (match_operand 2 "" "")])]
3074 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
3076 for (i = 0; i < XVECLEN (operands[2], 0); i++)
3078 rtx set = XVECEXP (operands[2], 0, i);
3079 emit_move_insn (SET_DEST (set), SET_SRC (set));
3082 /* The optimizer does not know that the call sets the function value
3083 registers we stored in the result block. We avoid problems by
3084 claiming that all hard registers are used and clobbered at this
3086 emit_insn (gen_blockage ());
3091 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3092 ;; all of memory. This blocks insns from being moved across this point.
3094 (define_insn "blockage"
3095 [(unspec_volatile [(const_int 0)] 0)]
3099 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
3100 ;; signed & unsigned, and one type of branch.
3102 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
3103 ;; insns, and branches. We store the operands of compares until we see
3105 (define_expand "cmpsi"
3107 (compare (match_operand:SI 0 "gpc_reg_operand" "")
3108 (match_operand:SI 1 "reg_or_short_operand" "")))]
3112 /* Take care of the possibility that operands[1] might be negative but
3113 this might be a logical operation. That insn doesn't exist. */
3114 if (GET_CODE (operands[1]) == CONST_INT
3115 && INTVAL (operands[1]) < 0)
3116 operands[1] = force_reg (SImode, operands[1]);
3118 rs6000_compare_op0 = operands[0];
3119 rs6000_compare_op1 = operands[1];
3120 rs6000_compare_fp_p = 0;
3124 (define_expand "cmpsf"
3125 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
3126 (match_operand:SF 1 "gpc_reg_operand" "")))]
3130 rs6000_compare_op0 = operands[0];
3131 rs6000_compare_op1 = operands[1];
3132 rs6000_compare_fp_p = 1;
3136 (define_expand "cmpdf"
3137 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
3138 (match_operand:DF 1 "gpc_reg_operand" "")))]
3142 rs6000_compare_op0 = operands[0];
3143 rs6000_compare_op1 = operands[1];
3144 rs6000_compare_fp_p = 1;
3148 (define_expand "beq"
3149 [(set (match_dup 2) (match_dup 1))
3151 (if_then_else (eq (match_dup 2)
3153 (label_ref (match_operand 0 "" ""))
3157 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3158 operands[1] = gen_rtx (COMPARE, mode,
3159 rs6000_compare_op0, rs6000_compare_op1);
3160 operands[2] = gen_reg_rtx (mode);
3163 (define_expand "bne"
3164 [(set (match_dup 2) (match_dup 1))
3166 (if_then_else (ne (match_dup 2)
3168 (label_ref (match_operand 0 "" ""))
3172 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3173 operands[1] = gen_rtx (COMPARE, mode,
3174 rs6000_compare_op0, rs6000_compare_op1);
3175 operands[2] = gen_reg_rtx (mode);
3178 (define_expand "blt"
3179 [(set (match_dup 2) (match_dup 1))
3181 (if_then_else (lt (match_dup 2)
3183 (label_ref (match_operand 0 "" ""))
3187 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3188 operands[1] = gen_rtx (COMPARE, mode,
3189 rs6000_compare_op0, rs6000_compare_op1);
3190 operands[2] = gen_reg_rtx (mode);
3193 (define_expand "bgt"
3194 [(set (match_dup 2) (match_dup 1))
3196 (if_then_else (gt (match_dup 2)
3198 (label_ref (match_operand 0 "" ""))
3202 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3203 operands[1] = gen_rtx (COMPARE, mode,
3204 rs6000_compare_op0, rs6000_compare_op1);
3205 operands[2] = gen_reg_rtx (mode);
3208 (define_expand "ble"
3209 [(set (match_dup 2) (match_dup 1))
3211 (if_then_else (le (match_dup 2)
3213 (label_ref (match_operand 0 "" ""))
3217 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3218 operands[1] = gen_rtx (COMPARE, mode,
3219 rs6000_compare_op0, rs6000_compare_op1);
3220 operands[2] = gen_reg_rtx (mode);
3223 (define_expand "bge"
3224 [(set (match_dup 2) (match_dup 1))
3226 (if_then_else (ge (match_dup 2)
3228 (label_ref (match_operand 0 "" ""))
3232 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3233 operands[1] = gen_rtx (COMPARE, mode,
3234 rs6000_compare_op0, rs6000_compare_op1);
3235 operands[2] = gen_reg_rtx (mode);
3238 (define_expand "bgtu"
3239 [(set (match_dup 2) (match_dup 1))
3241 (if_then_else (gtu (match_dup 2)
3243 (label_ref (match_operand 0 "" ""))
3247 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3248 rs6000_compare_op0, rs6000_compare_op1);
3249 operands[2] = gen_reg_rtx (CCUNSmode);
3252 (define_expand "bltu"
3253 [(set (match_dup 2) (match_dup 1))
3255 (if_then_else (ltu (match_dup 2)
3257 (label_ref (match_operand 0 "" ""))
3261 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3262 rs6000_compare_op0, rs6000_compare_op1);
3263 operands[2] = gen_reg_rtx (CCUNSmode);
3266 (define_expand "bgeu"
3267 [(set (match_dup 2) (match_dup 1))
3269 (if_then_else (geu (match_dup 2)
3271 (label_ref (match_operand 0 "" ""))
3275 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3276 rs6000_compare_op0, rs6000_compare_op1);
3277 operands[2] = gen_reg_rtx (CCUNSmode);
3280 (define_expand "bleu"
3281 [(set (match_dup 2) (match_dup 1))
3283 (if_then_else (leu (match_dup 2)
3285 (label_ref (match_operand 0 "" ""))
3289 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3290 rs6000_compare_op0, rs6000_compare_op1);
3291 operands[2] = gen_reg_rtx (CCUNSmode);
3294 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
3295 ;; For SEQ, likewise, except that comparisons with zero should be done
3296 ;; with an scc insns. However, due to the order that combine see the
3297 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
3298 ;; the cases we don't want to handle.
3299 (define_expand "seq"
3300 [(set (match_dup 2) (match_dup 1))
3301 (set (match_operand:SI 0 "gpc_reg_operand" "")
3302 (eq:SI (match_dup 2) (const_int 0)))]
3305 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3306 operands[1] = gen_rtx (COMPARE, mode,
3307 rs6000_compare_op0, rs6000_compare_op1);
3308 operands[2] = gen_reg_rtx (mode);
3311 (define_expand "sne"
3312 [(set (match_dup 2) (match_dup 1))
3313 (set (match_operand:SI 0 "gpc_reg_operand" "")
3314 (ne:SI (match_dup 2) (const_int 0)))]
3317 { if (! rs6000_compare_fp_p)
3320 operands[1] = gen_rtx (COMPARE, CCFPmode,
3321 rs6000_compare_op0, rs6000_compare_op1);
3322 operands[2] = gen_reg_rtx (CCFPmode);
3325 ;; A > 0 is best done using the portable sequence, so fail in that case.
3326 (define_expand "sgt"
3327 [(set (match_dup 2) (match_dup 1))
3328 (set (match_operand:SI 0 "gpc_reg_operand" "")
3329 (gt:SI (match_dup 2) (const_int 0)))]
3332 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3334 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
3337 operands[1] = gen_rtx (COMPARE, mode,
3338 rs6000_compare_op0, rs6000_compare_op1);
3339 operands[2] = gen_reg_rtx (mode);
3342 ;; A < 0 is best done in the portable way for A an integer.
3343 (define_expand "slt"
3344 [(set (match_dup 2) (match_dup 1))
3345 (set (match_operand:SI 0 "gpc_reg_operand" "")
3346 (lt:SI (match_dup 2) (const_int 0)))]
3349 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3351 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
3354 operands[1] = gen_rtx (COMPARE, mode,
3355 rs6000_compare_op0, rs6000_compare_op1);
3356 operands[2] = gen_reg_rtx (mode);
3359 (define_expand "sge"
3360 [(set (match_dup 2) (match_dup 1))
3361 (set (match_operand:SI 0 "gpc_reg_operand" "")
3362 (ge:SI (match_dup 2) (const_int 0)))]
3365 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3366 operands[1] = gen_rtx (COMPARE, mode,
3367 rs6000_compare_op0, rs6000_compare_op1);
3368 operands[2] = gen_reg_rtx (mode);
3371 ;; A <= 0 is best done the portable way for A an integer.
3372 (define_expand "sle"
3373 [(set (match_dup 2) (match_dup 1))
3374 (set (match_operand:SI 0 "gpc_reg_operand" "")
3375 (le:SI (match_dup 2) (const_int 0)))]
3378 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3380 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
3383 operands[1] = gen_rtx (COMPARE, mode,
3384 rs6000_compare_op0, rs6000_compare_op1);
3385 operands[2] = gen_reg_rtx (mode);
3388 (define_expand "sgtu"
3389 [(set (match_dup 2) (match_dup 1))
3390 (set (match_operand:SI 0 "gpc_reg_operand" "")
3391 (gtu:SI (match_dup 2) (const_int 0)))]
3394 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3395 rs6000_compare_op0, rs6000_compare_op1);
3396 operands[2] = gen_reg_rtx (CCUNSmode);
3399 (define_expand "sltu"
3400 [(set (match_dup 2) (match_dup 1))
3401 (set (match_operand:SI 0 "gpc_reg_operand" "")
3402 (ltu:SI (match_dup 2) (const_int 0)))]
3405 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3406 rs6000_compare_op0, rs6000_compare_op1);
3407 operands[2] = gen_reg_rtx (CCUNSmode);
3410 (define_expand "sgeu"
3411 [(set (match_dup 2) (match_dup 1))
3412 (set (match_operand:SI 0 "gpc_reg_operand" "")
3413 (geu:SI (match_dup 2) (const_int 0)))]
3416 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3417 rs6000_compare_op0, rs6000_compare_op1);
3418 operands[2] = gen_reg_rtx (CCUNSmode);
3421 (define_expand "sleu"
3422 [(set (match_dup 2) (match_dup 1))
3423 (set (match_operand:SI 0 "gpc_reg_operand" "")
3424 (leu:SI (match_dup 2) (const_int 0)))]
3427 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3428 rs6000_compare_op0, rs6000_compare_op1);
3429 operands[2] = gen_reg_rtx (CCUNSmode);
3432 ;; Here are the actual compare insns.
3434 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
3435 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
3436 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
3439 [(set_attr "type" "compare")])
3441 ;; If we are comparing a register for equality with a large constant,
3442 ;; we can do this with an XOR followed by a compare. But we need a scratch
3443 ;; register for the result of the XOR.
3446 [(set (match_operand:CC 0 "cc_reg_operand" "")
3447 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
3448 (match_operand:SI 2 "non_short_cint_operand" "")))
3449 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
3450 "find_single_use (operands[0], insn, 0)
3451 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
3452 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
3453 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
3454 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
3457 /* Get the constant we are comparing against, C, and see what it looks like
3458 sign-extended to 16 bits. Then see what constant could be XOR'ed
3459 with C to get the sign-extended value. */
3461 int c = INTVAL (operands[2]);
3462 int sextc = (c << 16) >> 16;
3463 int xorv = c ^ sextc;
3465 operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
3466 operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
3470 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
3471 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
3472 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
3475 [(set_attr "type" "compare")])
3477 ;; The following two insns don't exist as single insns, but if we provide
3478 ;; them, we can swap an add and compare, which will enable us to overlap more
3479 ;; of the required delay between a compare and branch. We generate code for
3480 ;; them by splitting.
3483 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
3484 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
3485 (match_operand:SI 2 "short_cint_operand" "i")))
3486 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3487 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
3492 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
3493 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
3494 (match_operand:SI 2 "u_short_cint_operand" "i")))
3495 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3496 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
3501 [(set (match_operand:CC 3 "cc_reg_operand" "")
3502 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
3503 (match_operand:SI 2 "short_cint_operand" "")))
3504 (set (match_operand:SI 0 "gpc_reg_operand" "")
3505 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
3507 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
3508 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
3511 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
3512 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
3513 (match_operand:SI 2 "u_short_cint_operand" "")))
3514 (set (match_operand:SI 0 "gpc_reg_operand" "")
3515 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
3517 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
3518 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
3521 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
3522 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
3523 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3526 [(set_attr "type" "fpcompare")])
3529 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
3530 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
3531 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3534 [(set_attr "type" "fpcompare")])
3536 ;; Now we have the scc insns. We can do some combinations because of the
3537 ;; way the machine works.
3539 ;; Note that this is probably faster if we can put an insn between the
3540 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
3541 ;; cases the insns below which don't use an intermediate CR field will
3544 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3545 (match_operator:SI 1 "scc_comparison_operator"
3546 [(match_operand 2 "cc_reg_operand" "y")
3549 "%D1mfcr %0\;rlinm %0,%0,%J1,31,31")
3552 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3553 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
3554 [(match_operand 2 "cc_reg_operand" "y")
3557 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
3558 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
3560 "%D1mfcr %3\;rlinm. %3,%3,%J1,30,31"
3561 [(set_attr "type" "delayed_compare")])
3564 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3565 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
3566 [(match_operand 2 "cc_reg_operand" "y")
3568 (match_operand:SI 3 "const_int_operand" "n")))]
3572 int is_bit = ccr_bit (operands[1], 1);
3573 int put_bit = 31 - (INTVAL (operands[3]) & 31);
3576 if (is_bit >= put_bit)
3577 count = is_bit - put_bit;
3579 count = 32 - (put_bit - is_bit);
3581 operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
3582 operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
3584 return \"%D1mfcr %0\;rlinm %0,%0,%4,%5,%5\";
3588 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3590 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
3591 [(match_operand 2 "cc_reg_operand" "y")
3593 (match_operand:SI 3 "const_int_operand" "n"))
3595 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
3596 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
3601 int is_bit = ccr_bit (operands[1], 1);
3602 int put_bit = 31 - (INTVAL (operands[3]) & 31);
3605 if (is_bit >= put_bit)
3606 count = is_bit - put_bit;
3608 count = 32 - (put_bit - is_bit);
3610 operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
3611 operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
3613 return \"%D1mfcr %4\;rlinm. %4,%4,%5,%6,%6\";
3615 [(set_attr "type" "delayed_compare")])
3617 ;; If we are comparing the result of two comparisons, this can be done
3618 ;; using creqv or crxor.
3621 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
3622 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
3623 [(match_operand 2 "cc_reg_operand" "y")
3625 (match_operator 3 "scc_comparison_operator"
3626 [(match_operand 4 "cc_reg_operand" "y")
3628 "REGNO (operands[2]) != REGNO (operands[4])"
3631 enum rtx_code code1, code2;
3633 code1 = GET_CODE (operands[1]);
3634 code2 = GET_CODE (operands[3]);
3636 if ((code1 == EQ || code1 == LT || code1 == GT
3637 || code1 == LTU || code1 == GTU
3638 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
3640 (code2 == EQ || code2 == LT || code2 == GT
3641 || code2 == LTU || code2 == GTU
3642 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
3643 return \"%C1%C3crxor %E0,%j1,%j3\";
3645 return \"%C1%C3creqv %E0,%j1,%j3\";
3648 ;; There is a 3 cycle delay between consecutive mfcr instructions
3649 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
3652 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3653 (match_operator:SI 1 "scc_comparison_operator"
3654 [(match_operand 2 "cc_reg_operand" "y")
3656 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
3657 (match_operator:SI 4 "scc_comparison_operator"
3658 [(match_operand 5 "cc_reg_operand" "y")
3660 "REGNO (operands[2]) != REGNO (operands[5])"
3661 "%D1%D4mfcr %3\;rlinm %0,%3,%J1,31,31\;rlinm %3,%3,%J4,31,31")
3663 ;; There are some scc insns that can be done directly, without a compare.
3664 ;; These are faster because they don't involve the communications between
3665 ;; the FXU and branch units. In fact, we will be replacing all of the
3666 ;; integer scc insns here or in the portable methods in emit_store_flag.
3668 ;; Also support (neg (scc ..)) since that construct is used to replace
3669 ;; branches, (plus (scc ..) ..) since that construct is common and
3670 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
3671 ;; cases where it is no more expensive than (neg (scc ..)).
3673 ;; Have reload force a constant into a register for the simple insns that
3674 ;; otherwise won't accept constants. We do this because it is faster than
3675 ;; the cmp/mfcr sequence we would otherwise generate.
3678 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3679 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3680 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
3681 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
3684 xor %0,%1,%2\;sfi %3,%0,0\;ae %0,%3,%0
3685 sfi %3,%1,0\;ae %0,%3,%1
3686 xoril %0,%1,%b2\;sfi %3,%0,0\;ae %0,%3,%0
3687 xoriu %0,%1,%u2\;sfi %3,%0,0\;ae %0,%3,%0
3688 sfi %0,%1,%2\;sfi %3,%0,0\;ae %0,%3,%0")
3691 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
3693 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3694 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
3696 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3697 (eq:SI (match_dup 1) (match_dup 2)))
3698 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
3701 xor %0,%1,%2\;sfi %3,%0,0\;ae. %0,%3,%0
3702 sfi %3,%1,0\;ae. %0,%3,%1
3703 xoril %0,%1,%b2\;sfi %3,%0,0\;ae. %0,%3,%0
3704 xoriu %0,%1,%u2\;sfi %3,%0,0\;ae. %0,%3,%0
3705 sfi %0,%1,%2\;sfi %3,%0,0\;ae. %0,%3,%0"
3706 [(set_attr "type" "compare")])
3709 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3710 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3711 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
3712 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
3713 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
3716 xor %4,%1,%2\;sfi %4,%4,0\;aze %0,%3
3717 sfi %4,%1,0\;aze %0,%3
3718 xoril %4,%1,%b2\;sfi %4,%4,0\;aze %0,%3
3719 xoriu %4,%1,%u2\;sfi %4,%4,0\;aze %0,%3
3720 sfi %4,%1,%2\;sfi %4,%4,0\;aze %0,%3")
3723 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
3726 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3727 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
3728 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
3730 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
3733 xor %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3
3734 sfi %4,%1,0\;aze. %0,%3
3735 xoril %4,%1,%b2\;sfi %4,%4,0\;aze. %4,%3
3736 xoriu %4,%1,%u2\;sfi %4,%4,0\;aze. %4,%3
3737 sfi %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3"
3738 [(set_attr "type" "compare")])
3741 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
3744 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3745 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
3746 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
3748 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3749 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3750 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
3753 xor %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3
3754 sfi %4,%1,0\;aze. %4,%3
3755 xoril %4,%1,%b2\;sfi %4,%4,0\;aze. %0,%3
3756 xoriu %4,%1,%u2\;sfi %4,%4,0\;aze. %0,%3
3757 sfi %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3"
3758 [(set_attr "type" "compare")])
3761 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3762 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r")
3763 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
3766 xor %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0
3767 ai %0,%1,-1\;sfe %0,%0,%0
3768 xoril %0,%1,%b2\;ai %0,%0,-1\;sfe %0,%0,%0
3769 xoriu %0,%1,%u2\;ai %0,%0,-1\;sfe %0,%0,%0
3770 sfi %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0")
3772 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
3774 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3775 (plus:SI (lshiftrt:SI
3776 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
3778 (match_operand:SI 2 "gpc_reg_operand" "r")))
3779 (clobber (match_scratch:SI 3 "=&r"))]
3781 "ai %3,%1,-1\;aze %0,%2")
3784 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3786 (plus:SI (lshiftrt:SI
3787 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
3789 (match_operand:SI 2 "gpc_reg_operand" "r"))
3791 (clobber (match_scratch:SI 3 "=&r"))]
3793 "ai %3,%1,-1\;aze. %3,%2"
3794 [(set_attr "type" "compare")])
3797 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
3799 (plus:SI (lshiftrt:SI
3800 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
3802 (match_operand:SI 2 "gpc_reg_operand" "r"))
3804 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3805 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
3807 (clobber (match_scratch:SI 3 "=&r"))]
3809 "ai %3,%1,-1\;aze. %0,%2"
3810 [(set_attr "type" "compare")])
3813 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3814 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3815 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
3816 (clobber (match_scratch:SI 3 "=r,X"))]
3819 doz %3,%2,%1\;sfi %0,%3,0\;ae %0,%0,%3
3820 ai %0,%1,-1\;aze %0,%0\;sri %0,%0,31")
3823 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
3825 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3826 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
3828 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3829 (le:SI (match_dup 1) (match_dup 2)))
3830 (clobber (match_scratch:SI 3 "=r,X"))]
3833 doz %3,%2,%1\;sfi %0,%3,0\;ae. %0,%0,%3
3834 ai %0,%1,-1\;aze %0,%0\;sri. %0,%0,31"
3835 [(set_attr "type" "delayed_compare,compare")])
3838 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3839 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3840 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
3841 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3842 (clobber (match_scratch:SI 4 "=&r,&r"))]
3845 doz %4,%2,%1\;sfi %4,%4,0\;aze %0,%3
3846 srai %4,%1,31\;sf %4,%1,%4\;aze %0,%3")
3849 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
3851 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3852 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
3853 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3855 (clobber (match_scratch:SI 4 "=&r,&r"))]
3858 doz %4,%2,%1\;sfi %4,%4,0\;aze. %4,%3
3859 srai %4,%1,31\;sf %4,%1,%4\;aze. %4,%3"
3860 [(set_attr "type" "compare")])
3863 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
3865 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3866 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
3867 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3869 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3870 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3871 (clobber (match_scratch:SI 4 "=&r,&r"))]
3874 doz %4,%2,%1\;sfi %4,%4,0\;aze. %0,%3
3875 srai %4,%1,31\;sf %4,%1,%4\;aze. %0,%3"
3876 [(set_attr "type" "compare")])
3879 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3880 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3881 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
3884 doz %0,%2,%1\;ai %0,%0,-1\;sfe %0,%0,%0
3885 ai %0,%1,-1\;aze %0,%0\;srai %0,%0,31")
3888 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3889 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3890 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
3892 "sf%I2 %0,%1,%2\;cal %0,0(0)\;ae %0,%0,%0")
3895 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
3897 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3898 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3900 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3901 (leu:SI (match_dup 1) (match_dup 2)))]
3903 "sf%I2 %0,%1,%2\;cal %0,0(0)\;ae. %0,%0,%0"
3904 [(set_attr "type" "compare")])
3907 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3908 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3909 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3910 (match_operand:SI 3 "gpc_reg_operand" "r")))
3911 (clobber (match_scratch:SI 4 "=&r"))]
3913 "sf%I2 %4,%1,%2\;aze %0,%3")
3916 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3918 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3919 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3920 (match_operand:SI 3 "gpc_reg_operand" "r"))
3922 (clobber (match_scratch:SI 4 "=&r"))]
3924 "sf%I2 %4,%1,%2\;aze. %4,%3"
3925 [(set_attr "type" "compare")])
3928 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
3930 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3931 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3932 (match_operand:SI 3 "gpc_reg_operand" "r"))
3934 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3935 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3936 (clobber (match_scratch:SI 4 "=&r"))]
3938 "sf%I2 %4,%1,%2\;aze. %0,%3"
3939 [(set_attr "type" "compare")])
3942 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3943 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3944 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
3946 "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;nand %0,%0,%0")
3949 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3951 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3952 (match_operand:SI 2 "reg_or_short_operand" "rI")))
3953 (match_operand:SI 3 "gpc_reg_operand" "r")))
3954 (clobber (match_scratch:SI 4 "=&r"))]
3956 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc %0,%3,%4")
3959 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3962 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3963 (match_operand:SI 2 "reg_or_short_operand" "rI")))
3964 (match_operand:SI 3 "gpc_reg_operand" "r"))
3966 (clobber (match_scratch:SI 4 "=&r"))]
3968 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc. %4,%3,%4"
3969 [(set_attr "type" "compare")])
3972 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
3975 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3976 (match_operand:SI 2 "reg_or_short_operand" "rI")))
3977 (match_operand:SI 3 "gpc_reg_operand" "r"))
3979 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3980 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
3981 (clobber (match_scratch:SI 4 "=&r"))]
3983 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc. %0,%3,%4"
3984 [(set_attr "type" "compare")])
3987 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3988 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3989 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
3991 "doz%I2 %0,%1,%2\;nabs %0,%0\;sri %0,%0,31")
3994 [(set (match_operand:SI 3 "cc_reg_operand" "=x")
3996 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3997 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3999 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4000 (lt:SI (match_dup 1) (match_dup 2)))]
4002 "doz%I2 %0,%1,%2\;nabs %0,%0\;sri. %0,%0,31"
4003 [(set_attr "type" "delayed_compare")])
4006 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4007 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4008 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4009 (match_operand:SI 3 "gpc_reg_operand" "r")))
4010 (clobber (match_scratch:SI 4 "=&r"))]
4012 "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze %0,%3")
4015 [(set (match_operand:SI 0 "cc_reg_operand" "=x")
4017 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4018 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4019 (match_operand:SI 3 "gpc_reg_operand" "r"))
4021 (clobber (match_scratch:SI 4 "=&r"))]
4023 "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze. %4,%3"
4024 [(set_attr "type" "compare")])
4027 [(set (match_operand:SI 5 "cc_reg_operand" "=x")
4029 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4030 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4031 (match_operand:SI 3 "gpc_reg_operand" "r"))
4033 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4034 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4035 (clobber (match_scratch:SI 4 "=&r"))]
4037 "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze. %0,%3"
4038 [(set_attr "type" "compare")])
4041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4042 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4043 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
4045 "doz%I2 %0,%1,%2\;nabs %0,%0\;srai %0,%0,31")
4048 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4049 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4050 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
4053 sf %0,%2,%1\;sfe %0,%0,%0\;neg %0,%0
4054 ai %0,%1,%n2\;sfe %0,%0,%0\;neg %0,%0")
4057 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
4059 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4060 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4062 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4063 (ltu:SI (match_dup 1) (match_dup 2)))]
4066 sf %0,%2,%1\;sfe %0,%0,%0\;neg. %0,%0
4067 ai %0,%1,%n2\;sfe %0,%0,%0\;neg. %0,%0"
4068 [(set_attr "type" "compare")])
4071 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4072 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4073 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
4074 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
4075 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
4078 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
4079 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
4080 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
4081 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3")
4084 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
4086 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4087 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
4088 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I"))
4090 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
4093 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
4094 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
4095 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
4096 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3"
4097 [(set_attr "type" "compare")])
4100 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x")
4102 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4103 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
4104 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I"))
4106 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4107 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4108 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
4111 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
4112 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
4113 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
4114 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3"
4115 [(set_attr "type" "compare")])
4118 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4119 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4120 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
4123 sf %0,%2,%1\;sfe %0,%0,%0
4124 ai %0,%1,%n2\;sfe %0,%0,%0")
4127 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4128 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4129 (match_operand:SI 2 "reg_or_short_operand" "rI")))
4130 (clobber (match_scratch:SI 3 "=r"))]
4132 "doz%I2 %3,%1,%2\;sfi %0,%3,0\;ae %0,%0,%3")
4135 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
4137 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4138 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4140 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4141 (ge:SI (match_dup 1) (match_dup 2)))
4142 (clobber (match_scratch:SI 3 "=r"))]
4144 "doz%I2 %3,%1,%2\;sfi %0,%3,0\;ae. %0,%0,%3"
4145 [(set_attr "type" "compare")])
4148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4149 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4150 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4151 (match_operand:SI 3 "gpc_reg_operand" "r")))
4152 (clobber (match_scratch:SI 4 "=&r"))]
4154 "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze %0,%3")
4157 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4159 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4160 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4161 (match_operand:SI 3 "gpc_reg_operand" "r"))
4163 (clobber (match_scratch:SI 4 "=&r"))]
4165 "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3"
4166 [(set_attr "type" "compare")])
4169 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
4171 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4172 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4173 (match_operand:SI 3 "gpc_reg_operand" "r"))
4175 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4176 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4177 (clobber (match_scratch:SI 4 "=&r"))]
4179 "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3"
4180 [(set_attr "type" "compare")])
4183 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4184 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4185 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
4187 "doz%I2 %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0")
4189 ;; This is (and (neg (ge X (const_int 0))) Y).
4191 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4194 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
4196 (match_operand:SI 2 "gpc_reg_operand" "r")))
4197 (clobber (match_scratch:SI 3 "=&r"))]
4199 "srai %3,%1,31\;andc %0,%2,%3")
4202 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4206 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
4208 (match_operand:SI 2 "gpc_reg_operand" "r"))
4210 (clobber (match_scratch:SI 3 "=&r"))]
4212 "srai %3,%1,31\;andc. %3,%2,%3"
4213 [(set_attr "type" "compare")])
4216 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
4220 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
4222 (match_operand:SI 2 "gpc_reg_operand" "r"))
4224 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4225 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
4228 (clobber (match_scratch:SI 3 "=&r"))]
4230 "srai %3,%1,31\;andc. %0,%2,%3"
4231 [(set_attr "type" "compare")])
4234 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4235 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4236 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
4239 sf %0,%2,%1\;cal %0,0(0)\;ae %0,%0,%0
4240 ai %0,%1,%n2\;cal %0,0(0)\;ae %0,%0,%0")
4243 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
4245 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4246 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4248 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4249 (geu:SI (match_dup 1) (match_dup 2)))]
4252 sf %0,%2,%1\;cal %0,0(0)\;ae. %0,%0,%0
4253 ai %0,%1,%n2\;cal %0,0(0)\;ae. %0,%0,%0"
4254 [(set_attr "type" "compare")])
4257 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4258 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4259 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4260 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
4261 (clobber (match_scratch:SI 4 "=&r,&r"))]
4264 sf %4,%2,%1\;aze %0,%3
4265 ai %4,%1,%n2\;aze %0,%3")
4268 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
4270 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4271 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4272 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4274 (clobber (match_scratch:SI 4 "=&r,&r"))]
4277 sf %4,%2,%1\;aze. %4,%3
4278 ai %4,%1,%n2\;aze. %4,%3"
4279 [(set_attr "type" "compare")])
4282 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
4284 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4285 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4286 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4288 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4289 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4290 (clobber (match_scratch:SI 4 "=&r,&r"))]
4293 sf %4,%2,%1\;aze. %0,%3
4294 ai %4,%1,%n2\;aze. %4,%3"
4295 [(set_attr "type" "compare")])
4298 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4299 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4300 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
4303 sf %0,%2,%1\;sfe %0,%0,%0\;nand %0,%0,%0
4304 sfi %0,%1,-1\;a%I2 %0,%0,%2\;sfe %0,%0,%0")
4307 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4309 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4310 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
4311 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
4312 (clobber (match_scratch:SI 4 "=&r,&r"))]
4315 sf %4,%2,%1\;sfe %4,%4,%4\;andc %0,%3,%4
4316 ai %4,%1,%n2\;sfe %4,%4,%4\;andc %0,%3,%4")
4319 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
4322 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4323 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
4324 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4326 (clobber (match_scratch:SI 4 "=&r,&r"))]
4329 sf %4,%2,%1\;sfe %4,%4,%4\;andc. %4,%3,%4
4330 ai %4,%1,%n2\;sfe %4,%4,%4\;andc. %4,%3,%4"
4331 [(set_attr "type" "compare")])
4334 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
4337 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4338 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
4339 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4341 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4342 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
4343 (clobber (match_scratch:SI 4 "=&r,&r"))]
4346 sf %4,%2,%1\;sfe %4,%4,%4\;andc. %0,%3,%4
4347 ai %4,%1,%n2\;sfe %4,%4,%4\;andc. %0,%3,%4"
4348 [(set_attr "type" "compare")])
4351 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4352 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4355 "sfi %0,%1,0\;ame %0,%0\;sri %0,%0,31")
4358 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4360 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4363 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4364 (gt:SI (match_dup 1) (const_int 0)))]
4366 "sfi %0,%1,0\;ame %0,%0\;sri. %0,%0,31"
4367 [(set_attr "type" "delayed_compare")])
4370 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4371 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4372 (match_operand:SI 2 "reg_or_short_operand" "r")))]
4374 "doz %0,%2,%1\;nabs %0,%0\;sri %0,%0,31")
4377 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4379 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4380 (match_operand:SI 2 "reg_or_short_operand" "r"))
4382 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4383 (gt:SI (match_dup 1) (match_dup 2)))]
4385 "doz %0,%2,%1\;nabs %0,%0\;sri. %0,%0,31"
4386 [(set_attr "type" "delayed_compare")])
4389 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4390 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4392 (match_operand:SI 2 "gpc_reg_operand" "r")))
4393 (clobber (match_scratch:SI 3 "=&r"))]
4395 "a %3,%1,%1\;sfe %3,%1,%3\;aze %0,%2")
4398 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4400 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4402 (match_operand:SI 2 "gpc_reg_operand" "r"))
4404 (clobber (match_scratch:SI 3 "=&r"))]
4406 "a %3,%1,%1\;sfe %3,%1,%3\;aze. %0,%2"
4407 [(set_attr "type" "compare")])
4410 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
4412 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4414 (match_operand:SI 2 "gpc_reg_operand" "r"))
4416 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4417 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
4418 (clobber (match_scratch:SI 3 "=&r"))]
4420 "a %3,%1,%1\;sfe %3,%1,%3\;aze. %3,%2"
4421 [(set_attr "type" "compare")])
4424 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4425 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4426 (match_operand:SI 2 "reg_or_short_operand" "r"))
4427 (match_operand:SI 3 "gpc_reg_operand" "r")))
4428 (clobber (match_scratch:SI 4 "=&r"))]
4430 "doz %4,%2,%1\;ai %4,%4,-1\;aze %0,%3")
4433 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4435 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4436 (match_operand:SI 2 "reg_or_short_operand" "r"))
4437 (match_operand:SI 3 "gpc_reg_operand" "r"))
4439 (clobber (match_scratch:SI 4 "=&r"))]
4441 "doz %4,%2,%1\;ai %4,%4,-1\;aze. %4,%3"
4442 [(set_attr "type" "compare")])
4445 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
4447 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4448 (match_operand:SI 2 "reg_or_short_operand" "r"))
4449 (match_operand:SI 3 "gpc_reg_operand" "r"))
4451 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4452 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4453 (clobber (match_scratch:SI 4 "=&r"))]
4455 "doz %4,%2,%1\;ai %4,%4,-1\;aze. %0,%3"
4456 [(set_attr "type" "compare")])
4459 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4460 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4463 "sfi %0,%1,0\;ame %0,%0\;srai %0,%0,31")
4466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4467 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4468 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
4470 "doz %0,%2,%1\;nabs %0,%0\;srai %0,%0,31")
4473 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4474 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4475 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
4477 "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;neg %0,%0")
4480 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4482 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4483 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4485 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4486 (gtu:SI (match_dup 1) (match_dup 2)))]
4488 "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;neg. %0,%0"
4489 [(set_attr "type" "compare")])
4492 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4493 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4494 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
4495 (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
4496 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
4499 ai %4,%1,%k2\;aze %0,%3
4500 sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
4501 sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3")
4504 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x")
4506 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4507 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
4508 (match_operand:SI 3 "reg_or_short_operand" "r,r,I"))
4510 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
4513 ai %4,%1,%k2\;aze. %0,%3
4514 sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
4515 sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3"
4516 [(set_attr "type" "compare")])
4519 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x")
4521 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
4522 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
4523 (match_operand:SI 3 "reg_or_short_operand" "r,r,I"))
4525 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
4526 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4527 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
4530 ai %4,%1,%k2\;aze. %0,%3
4531 sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
4532 sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3"
4533 [(set_attr "type" "compare")])
4536 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4537 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4538 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
4540 "sf%I2 %0,%1,%2\;sfe %0,%0,%0")
4542 ;; Define both directions of branch and return. If we need a reload
4543 ;; register, we'd rather use CR0 since it is much easier to copy a
4544 ;; register CC value to there.
4548 (if_then_else (match_operator 1 "branch_comparison_operator"
4550 "cc_reg_operand" "x,?y")
4552 (label_ref (match_operand 0 "" ""))
4559 (if_then_else (match_operator 0 "branch_comparison_operator"
4561 "cc_reg_operand" "x,?y")
4570 (if_then_else (match_operator 1 "branch_comparison_operator"
4572 "cc_reg_operand" "x,?y")
4575 (label_ref (match_operand 0 "" ""))))]
4581 (if_then_else (match_operator 0 "branch_comparison_operator"
4583 "cc_reg_operand" "x,?y")
4590 ;; Unconditional branch and return.
4594 (label_ref (match_operand 0 "" "")))]
4598 (define_insn "return"
4603 (define_insn "indirect_jump"
4604 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
4610 ;; Table jump for switch statements:
4611 (define_expand "tablejump"
4613 (plus:SI (match_operand:SI 0 "" "")
4615 (parallel [(set (pc) (match_dup 3))
4616 (use (label_ref (match_operand 1 "" "")))])]
4619 { operands[0] = force_reg (SImode, operands[0]);
4620 operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
4621 operands[3] = gen_reg_rtx (SImode);
4626 (match_operand:SI 0 "register_operand" "c,l"))
4627 (use (label_ref (match_operand 1 "" "")))]
4638 ;; Define the subtract-one-and-jump insns, starting with the template
4639 ;; so loop.c knows what to generate.
4641 (define_expand "decrement_and_branchsi"
4642 [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "c")
4644 (label_ref (match_operand 1 "" ""))
4646 (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))])]
4650 ;; We need to be able to do this for any operand, including MEM, or we
4651 ;; will cause reload to blow up since we don't allow output reloads on
4655 (if_then_else (ne (match_operand:SI 1 "register_operand" "0,*r,*r")
4657 (label_ref (match_operand 2 "" ""))
4659 (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
4660 (plus:SI (match_dup 1) (const_int -1)))
4661 (clobber (match_scratch:CC 3 "=X,&x,&x"))
4662 (clobber (match_scratch:SI 4 "=X,X,r"))]
4669 ;; Similar, but we can use GE since we have a REG_NONNEG.
4672 (if_then_else (ge (match_operand:SI 1 "register_operand" "0,*r,*r")
4674 (label_ref (match_operand 2 "" ""))
4676 (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
4677 (plus:SI (match_dup 1) (const_int -1)))
4678 (clobber (match_scratch:CC 3 "=X,&x,&X"))
4679 (clobber (match_scratch:SI 4 "=X,X,r"))]
4680 "find_reg_note (insn, REG_NONNEG, 0)"
4688 (if_then_else (eq (match_operand:SI 1 "register_operand" "0,*r,*r")
4690 (label_ref (match_operand 2 "" ""))
4692 (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
4693 (plus:SI (match_dup 1) (const_int -1)))
4694 (clobber (match_scratch:CC 3 "=X,&x,&x"))
4695 (clobber (match_scratch:SI 4 "=X,X,r"))]
4704 (if_then_else (match_operator 2 "comparison_operator"
4705 [(match_operand:SI 1 "gpc_reg_operand" "")
4707 (match_operand 5 "" "")
4708 (match_operand 6 "" "")))
4709 (set (match_operand:SI 0 "gpc_reg_operand" "")
4710 (plus:SI (match_dup 1) (const_int -1)))
4711 (clobber (match_scratch:CC 3 ""))
4712 (clobber (match_scratch:SI 4 ""))]
4714 [(parallel [(set (match_dup 3)
4715 (compare:CC (plus:SI (match_dup 1) (const_int -1))
4717 (set (match_dup 0) (plus:SI (match_dup 1) (const_int -1)))])
4718 (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
4720 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
4725 (if_then_else (match_operator 2 "comparison_operator"
4726 [(match_operand:SI 1 "gpc_reg_operand" "")
4728 (match_operand 5 "" "")
4729 (match_operand 6 "" "")))
4730 (set (match_operand:SI 0 "general_operand" "")
4731 (plus:SI (match_dup 1) (const_int -1)))
4732 (clobber (match_scratch:CC 3 ""))
4733 (clobber (match_scratch:SI 4 ""))]
4734 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
4735 [(parallel [(set (match_dup 3)
4736 (compare:CC (plus:SI (match_dup 1) (const_int -1))
4738 (set (match_dup 4) (plus:SI (match_dup 1) (const_int -1)))])
4739 (set (match_dup 0) (match_dup 4))
4740 (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
4742 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],