1 ;;- Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@nyu.edu)
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 ;; There is no need for (set (condition) (compare (ffs) 0)) because that
439 ;; can be simplified to an ordinary comparison. A parallel set and compare
440 ;; might be used, so include it.
443 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
444 (compare:CC (ffs:SI (match_operand:SI 1 "register_operand" "r"))
446 (set (match_operand:SI 0 "register_operand" "=&r")
447 (ffs:SI (match_dup 1)))]
449 "neg %0,%1\;and %0,%0,%1\;cntlz %0,%0\;sfi. %0,%0,32"
450 [(set_attr "type" "compare")])
452 (define_insn "mulsi3"
453 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
454 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
455 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
456 (clobber (match_scratch:SI 3 "=q,q"))]
463 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
464 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
465 (match_operand:SI 2 "gpc_reg_operand" "r"))
467 (clobber (match_scratch:SI 3 "=r"))
468 (clobber (match_scratch:SI 4 "=q"))]
471 [(set_attr "type" "delayed_compare")])
474 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
475 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "r")
476 (match_operand:SI 2 "gpc_reg_operand" "r"))
478 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
479 (mult:SI (match_dup 1) (match_dup 2)))
480 (clobber (match_scratch:SI 4 "=q"))]
483 [(set_attr "type" "delayed_compare")])
485 ;; Operand 1 is divided by operand 2; quotient goes to operand
486 ;; 0 and remainder to operand 3.
487 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
489 (define_insn "divmodsi4"
490 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
491 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
492 (match_operand:SI 2 "gpc_reg_operand" "r")))
493 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
494 (mod:SI (match_dup 1) (match_dup 2)))]
498 ;; For powers of two we can do srai/aze for divide and then adjust for
499 ;; modulus. If it isn't a power of two, FAIL so divmodsi4 will be used.
500 (define_expand "divsi3"
501 [(set (match_operand:SI 0 "gpc_reg_operand" "")
502 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
503 (match_operand:SI 2 "reg_or_cint_operand" "")))]
507 if (GET_CODE (operands[2]) != CONST_INT
508 || exact_log2 (INTVAL (operands[2])) < 0)
512 (define_expand "modsi3"
514 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
515 (match_operand:SI 2 "reg_or_cint_operand" "")))
516 (parallel [(set (match_dup 4) (ashift:SI (match_dup 3) (match_dup 5)))
517 (clobber (scratch:SI))])
518 (set (match_operand:SI 0 "gpc_reg_operand" "")
519 (minus:SI (match_dup 1) (match_dup 4)))]
523 int i = exact_log2 (INTVAL (operands[2]));
525 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
528 operands[3] = gen_reg_rtx (SImode);
529 operands[4] = gen_reg_rtx (SImode);
530 operands[5] = gen_rtx (CONST_INT, VOIDmode, i);
534 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
535 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
536 (match_operand:SI 2 "const_int_operand" "N")))]
537 "exact_log2 (INTVAL (operands[2])) >= 0"
538 "srai %0,%1,%p2\;aze %0,%0")
541 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
542 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
543 (match_operand:SI 2 "const_int_operand" "N")))
544 (clobber (match_scratch:SI 3 "=r"))]
545 "exact_log2 (INTVAL (operands[2])) >= 0"
546 "srai %3,%1,%p2\;aze. %3,%3"
547 [(set_attr "type" "compare")])
550 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
551 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
552 (match_operand:SI 2 "const_int_operand" "N")))
553 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
554 (div:SI (match_dup 1) (match_dup 2)))]
555 "exact_log2 (INTVAL (operands[2])) >= 0"
556 "srai %0,%1,%p2\;aze. %0,%0"
557 [(set_attr "type" "compare")])
560 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
563 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
565 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
566 (match_operand:SI 3 "gpc_reg_operand" "r")))
567 (set (match_operand:SI 2 "register_operand" "=*q")
570 (zero_extend:DI (match_dup 1)) (const_int 32))
571 (zero_extend:DI (match_dup 4)))
577 ;; To do unsigned divide we handle the cases of the divisor looking like a
578 ;; negative number. If it is a constant that is less than 2**31, we don't
579 ;; have to worry about the branches. So make a few subroutines here.
581 ;; First comes the normal case.
582 (define_expand "udivmodsi4_normal"
583 [(set (match_dup 4) (const_int 0))
584 (parallel [(set (match_operand:SI 0 "" "")
585 (udiv:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4))
587 (zero_extend:DI (match_operand:SI 1 "" "")))
588 (match_operand:SI 2 "" "")))
589 (set (match_operand:SI 3 "" "")
590 (umod:SI (plus:DI (lshift:DI (zero_extend:DI (match_dup 4))
592 (zero_extend:DI (match_dup 1)))
596 { operands[4] = gen_reg_rtx (SImode); }")
598 ;; This handles the branches.
599 (define_expand "udivmodsi4_tests"
600 [(set (match_operand:SI 0 "" "") (const_int 0))
601 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
602 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
603 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
604 (label_ref (match_operand:SI 4 "" "")) (pc)))
605 (set (match_dup 0) (const_int 1))
606 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
607 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
608 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
609 (label_ref (match_dup 4)) (pc)))]
612 { operands[5] = gen_reg_rtx (CCUNSmode);
613 operands[6] = gen_reg_rtx (CCmode);
616 (define_expand "udivmodsi4"
617 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
618 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
619 (match_operand:SI 2 "reg_or_cint_operand" "")))
620 (set (match_operand:SI 3 "gpc_reg_operand" "")
621 (umod:SI (match_dup 1) (match_dup 2)))])]
627 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
629 operands[2] = force_reg (SImode, operands[2]);
630 label = gen_label_rtx ();
631 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
632 operands[3], label));
635 operands[2] = force_reg (SImode, operands[2]);
637 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
645 (define_insn "andsi3"
646 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
647 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
648 (match_operand:SI 2 "and_operand" "?r,L,K,J")))
649 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
653 rlinm %0,%1,0,%m2,%M2
658 [(set (match_operand:CC 0 "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 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
668 rlinm. %3,%1,0,%m2,%M2"
669 [(set_attr "type" "compare,compare,compare,delayed_compare")])
672 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
673 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
674 (match_operand:SI 2 "and_operand" "r,K,J,L"))
676 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
677 (and:SI (match_dup 1) (match_dup 2)))]
683 rlinm. %0,%1,0,%m2,%M2"
684 [(set_attr "type" "compare,compare,compare,delayed_compare")])
686 ;; Take a AND with a constant that cannot be done in a single insn and try to
687 ;; split it into two insns. This does not verify that the insns are valid
688 ;; since this need not be done as combine will do it.
691 [(set (match_operand:SI 0 "gpc_reg_operand" "")
692 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
693 (match_operand:SI 2 "non_and_cint_operand" "")))]
695 [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 3)))
696 (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
699 int maskval = INTVAL (operands[2]);
700 int i, transitions, last_bit_value;
701 int orig = maskval, first_c = maskval, second_c;
703 /* We know that MASKVAL must have more than 2 bit-transitions. Start at
704 the low-order bit and count for the third transition. When we get there,
705 make a first mask that has everything to the left of that position
706 a one. Then make the second mask to turn off whatever else is needed. */
708 for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
710 if (((maskval >>= 1) & 1) != last_bit_value)
711 last_bit_value ^= 1, transitions++;
715 first_c |= (~0) << i;
720 second_c = orig | ~ first_c;
722 operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
723 operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
726 (define_insn "iorsi3"
727 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
728 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
729 (match_operand:SI 2 "logical_operand" "r,K,J")))]
737 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
738 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r")
739 (match_operand:SI 2 "gpc_reg_operand" "r"))
741 (clobber (match_scratch:SI 3 "=r"))]
744 [(set_attr "type" "compare")])
747 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
748 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "r")
749 (match_operand:SI 2 "gpc_reg_operand" "r"))
751 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
752 (ior:SI (match_dup 1) (match_dup 2)))]
755 [(set_attr "type" "compare")])
757 ;; Split an IOR that we can't do in one insn into two insns, each of which
758 ;; does one 16-bit part. This is used by combine.
761 [(set (match_operand:SI 0 "gpc_reg_operand" "")
762 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
763 (match_operand:SI 2 "non_logical_cint_operand" "")))]
765 [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
766 (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
769 operands[3] = gen_rtx (CONST_INT, VOIDmode,
770 INTVAL (operands[2]) & 0xffff0000);
771 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
774 (define_insn "xorsi3"
775 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
776 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
777 (match_operand:SI 2 "logical_operand" "r,K,J")))]
785 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
786 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r")
787 (match_operand:SI 2 "gpc_reg_operand" "r"))
789 (clobber (match_scratch:SI 3 "=r"))]
792 [(set_attr "type" "compare")])
795 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
796 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "r")
797 (match_operand:SI 2 "gpc_reg_operand" "r"))
799 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
800 (xor:SI (match_dup 1) (match_dup 2)))]
803 [(set_attr "type" "compare")])
805 ;; Split an XOR that we can't do in one insn into two insns, each of which
806 ;; does one 16-bit part. This is used by combine.
809 [(set (match_operand:SI 0 "gpc_reg_operand" "")
810 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
811 (match_operand:SI 2 "non_logical_cint_operand" "")))]
813 [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
814 (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
817 operands[3] = gen_rtx (CONST_INT, VOIDmode,
818 INTVAL (operands[2]) & 0xffff0000);
819 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
823 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
824 (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
825 (match_operand:SI 2 "gpc_reg_operand" "r"))))]
830 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
831 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
832 (match_operand:SI 2 "gpc_reg_operand" "r")))
834 (clobber (match_scratch:SI 3 "=r"))]
837 [(set_attr "type" "compare")])
840 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
841 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
842 (match_operand:SI 2 "gpc_reg_operand" "r")))
844 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
845 (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
848 [(set_attr "type" "compare")])
851 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
852 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
853 (match_operand:SI 2 "gpc_reg_operand" "r")))]
858 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
859 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
860 (match_operand:SI 2 "gpc_reg_operand" "r"))
862 (clobber (match_scratch:SI 3 "=r"))]
865 [(set_attr "type" "compare")])
868 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
869 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
870 (match_operand:SI 2 "gpc_reg_operand" "r"))
872 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
873 (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
876 [(set_attr "type" "compare")])
879 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
880 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
881 (match_operand:SI 2 "gpc_reg_operand" "r")))]
886 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
887 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
888 (match_operand:SI 2 "gpc_reg_operand" "r"))
890 (clobber (match_scratch:SI 3 "=r"))]
893 [(set_attr "type" "compare")])
896 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
897 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
898 (match_operand:SI 2 "gpc_reg_operand" "r"))
900 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
901 (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
904 [(set_attr "type" "compare")])
907 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
908 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
909 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
914 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
915 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
916 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
918 (clobber (match_scratch:SI 3 "=r"))]
921 [(set_attr "type" "compare")])
924 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
925 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
926 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
928 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
929 (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
932 [(set_attr "type" "compare")])
935 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
936 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
937 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
942 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
943 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
944 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
946 (clobber (match_scratch:SI 3 "=r"))]
949 [(set_attr "type" "compare")])
952 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
953 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
954 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
956 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
957 (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
960 [(set_attr "type" "compare")])
962 ;; maskir insn. We need four forms because things might be in arbitrary
963 ;; orders. Don't define forms that only set CR fields because these
964 ;; would modify an input register.
967 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
968 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
969 (match_operand:SI 1 "gpc_reg_operand" "0"))
970 (and:SI (match_dup 2)
971 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
976 [(set (match_operand:SI 0 "register_operand" "=r")
977 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
978 (match_operand:SI 1 "gpc_reg_operand" "0"))
979 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
985 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
986 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
987 (match_operand:SI 3 "gpc_reg_operand" "r"))
988 (and:SI (not:SI (match_dup 2))
989 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
994 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
995 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
996 (match_operand:SI 2 "gpc_reg_operand" "r"))
997 (and:SI (not:SI (match_dup 2))
998 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
1003 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1005 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1006 (match_operand:SI 1 "gpc_reg_operand" "0"))
1007 (and:SI (match_dup 2)
1008 (match_operand:SI 3 "gpc_reg_operand" "r")))
1010 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1011 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
1012 (and:SI (match_dup 2) (match_dup 3))))]
1015 [(set_attr "type" "compare")])
1018 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1020 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1021 (match_operand:SI 1 "gpc_reg_operand" "0"))
1022 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1025 (set (match_operand:SI 0 "register_operand" "=r")
1026 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
1027 (and:SI (match_dup 3) (match_dup 2))))]
1030 [(set_attr "type" "compare")])
1033 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1035 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1036 (match_operand:SI 3 "gpc_reg_operand" "r"))
1037 (and:SI (not:SI (match_dup 2))
1038 (match_operand:SI 1 "gpc_reg_operand" "0")))
1040 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1041 (ior:SI (and:SI (match_dup 2) (match_dup 3))
1042 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
1045 [(set_attr "type" "compare")])
1048 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1050 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1051 (match_operand:SI 2 "gpc_reg_operand" "r"))
1052 (and:SI (not:SI (match_dup 2))
1053 (match_operand:SI 1 "gpc_reg_operand" "0")))
1055 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1056 (ior:SI (and:SI (match_dup 3) (match_dup 2))
1057 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
1060 [(set_attr "type" "compare")])
1062 ;; Rotate and shift insns, in all their variants. These support shifts,
1063 ;; field inserts and extracts, and various combinations thereof.
1065 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1066 (match_operand:SI 1 "const_int_operand" "i")
1067 (match_operand:SI 2 "const_int_operand" "i"))
1068 (match_operand:SI 3 "gpc_reg_operand" "r"))]
1072 int start = INTVAL (operands[2]) & 31;
1073 int size = INTVAL (operands[1]) & 31;
1075 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
1076 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
1077 return \"rlimi %0,%3,%4,%h2,%h1\";
1080 (define_insn "extzv"
1081 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1082 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1083 (match_operand:SI 2 "const_int_operand" "i")
1084 (match_operand:SI 3 "const_int_operand" "i")))]
1088 int start = INTVAL (operands[3]) & 31;
1089 int size = INTVAL (operands[2]) & 31;
1091 if (start + size >= 32)
1092 operands[3] = const0_rtx;
1094 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
1095 return \"rlinm %0,%1,%3,%s2,31\";
1099 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1100 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1101 (match_operand:SI 2 "const_int_operand" "i")
1102 (match_operand:SI 3 "const_int_operand" "i"))
1104 (clobber (match_scratch:SI 4 "=r"))]
1108 int start = INTVAL (operands[3]) & 31;
1109 int size = INTVAL (operands[2]) & 31;
1111 /* If the bitfield being tested fits in the upper or lower half of a
1112 word, it is possible to use andiu. or andil. to test it. This is
1113 useful because the condition register set-use delay is smaller for
1114 andi[ul]. than for rlinm. This doesn't work when the starting bit
1115 position is 0 because the LT and GT bits may be set wrong. */
1117 if ((start > 0 && start + size <= 16) || start >= 16)
1119 operands[3] = gen_rtx (CONST_INT, VOIDmode,
1120 ((1 << (16 - (start & 15)))
1121 - (1 << (16 - (start & 15) - size))));
1123 return \"andiu. %4,%1,%3\";
1125 return \"andil. %4,%1,%3\";
1128 if (start + size >= 32)
1129 operands[3] = const0_rtx;
1131 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
1132 return \"rlinm. %4,%1,%3,%s2,31\";
1134 [(set_attr "type" "compare")])
1137 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1138 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1139 (match_operand:SI 2 "const_int_operand" "i")
1140 (match_operand:SI 3 "const_int_operand" "i"))
1142 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1143 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
1147 int start = INTVAL (operands[3]) & 31;
1148 int size = INTVAL (operands[2]) & 31;
1150 if (start >= 16 && start + size == 32)
1152 operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
1153 return \"andil. %0,%1,%3\";
1156 if (start + size >= 32)
1157 operands[3] = const0_rtx;
1159 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
1160 return \"rlinm. %0,%1,%3,%s2,31\";
1162 [(set_attr "type" "delayed_compare")])
1164 (define_insn "rotlsi3"
1165 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1166 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1167 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
1169 "rl%I2nm %0,%1,%h2,0,31")
1172 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1173 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1174 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1176 (clobber (match_scratch:SI 3 "=r"))]
1178 "rl%I2nm. %3,%1,%h2,0,31"
1179 [(set_attr "type" "delayed_compare")])
1182 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1183 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1184 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1186 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1187 (rotate:SI (match_dup 1) (match_dup 2)))]
1189 "rl%I2nm. %0,%1,%h2,0,31"
1190 [(set_attr "type" "delayed_compare")])
1193 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1194 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1195 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1196 (match_operand:SI 3 "mask_operand" "L")))]
1198 "rl%I2nm %0,%1,%h2,%m3,%M3")
1201 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1203 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1204 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1205 (match_operand:SI 3 "mask_operand" "L"))
1207 (clobber (match_scratch:SI 4 "=r"))]
1209 "rl%I2nm. %4,%1,%h2,%m3,%M3"
1210 [(set_attr "type" "delayed_compare")])
1213 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1215 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1216 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
1217 (match_operand:SI 3 "mask_operand" "L"))
1219 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1220 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
1222 "rl%I2nm. %0,%1,%h2,%m3,%M3"
1223 [(set_attr "type" "delayed_compare")])
1226 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1229 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1230 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
1232 "rl%I2nm %0,%1,%h2,24,31")
1235 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1236 (compare:CC (zero_extend:SI
1238 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1239 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
1241 (clobber (match_scratch:SI 3 "=r"))]
1243 "rl%I2nm. %3,%1,%h2,24,31"
1244 [(set_attr "type" "delayed_compare")])
1247 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1248 (compare:CC (zero_extend:SI
1250 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1251 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
1253 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1254 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
1256 "rl%I2nm. %0,%1,%h2,24,31"
1257 [(set_attr "type" "delayed_compare")])
1260 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1263 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1264 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
1266 "rl%I2nm %0,%1,%h2,16,31")
1269 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1270 (compare:CC (zero_extend:SI
1272 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1273 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
1275 (clobber (match_scratch:SI 3 "=r"))]
1277 "rl%I2nm. %3,%1,%h2,16,31"
1278 [(set_attr "type" "delayed_compare")])
1281 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1282 (compare:CC (zero_extend:SI
1284 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1285 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
1287 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1288 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
1290 "rl%I2nm. %0,%1,%h2,16,31"
1291 [(set_attr "type" "delayed_compare")])
1293 ;; Note that we use "sle." instead of "sl." so that we can set
1294 ;; SHIFT_COUNT_TRUNCATED.
1296 (define_insn "ashlsi3"
1297 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1298 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1299 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
1300 (clobber (match_scratch:SI 3 "=q,X"))]
1307 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
1308 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1309 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1311 (clobber (match_scratch:SI 3 "=r,r"))
1312 (clobber (match_scratch:SI 4 "=q,X"))]
1317 [(set_attr "type" "delayed_compare")])
1320 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
1321 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1322 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1324 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1325 (ashift:SI (match_dup 1) (match_dup 2)))
1326 (clobber (match_scratch:SI 4 "=q,X"))]
1331 [(set_attr "type" "delayed_compare")])
1334 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1335 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1336 (match_operand:SI 2 "const_int_operand" "i"))
1337 (match_operand:SI 3 "mask_operand" "L")))]
1338 "includes_lshift_p (operands[2], operands[3])"
1339 "rlinm %0,%h1,%h2,%m3,%M3")
1342 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1344 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1345 (match_operand:SI 2 "const_int_operand" "i"))
1346 (match_operand:SI 3 "mask_operand" "L"))
1348 (clobber (match_scratch:SI 4 "=r"))]
1349 "includes_lshift_p (operands[2], operands[3])"
1350 "rlinm. %4,%h1,%h2,%m3,%M3"
1351 [(set_attr "type" "delayed_compare")])
1354 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1356 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1357 (match_operand:SI 2 "const_int_operand" "i"))
1358 (match_operand:SI 3 "mask_operand" "L"))
1360 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1361 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
1362 "includes_lshift_p (operands[2], operands[3])"
1363 "rlinm. %0,%h1,%h2,%m3,%M3"
1364 [(set_attr "type" "delayed_compare")])
1366 ;; The RS/6000 assembler mis-handles "sri x,x,0", so write that case as
1368 (define_insn "lshrsi3"
1369 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1370 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1371 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
1372 (clobber (match_scratch:SI 3 "=q,X"))]
1379 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
1380 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1381 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1383 (clobber (match_scratch:SI 3 "=r,r"))
1384 (clobber (match_scratch:SI 4 "=q,X"))]
1389 [(set_attr "type" "delayed_compare")])
1392 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
1393 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1394 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1396 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1397 (lshiftrt:SI (match_dup 1) (match_dup 2)))
1398 (clobber (match_scratch:SI 4 "=q,X"))]
1403 [(set_attr "type" "delayed_compare")])
1406 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1407 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1408 (match_operand:SI 2 "const_int_operand" "i"))
1409 (match_operand:SI 3 "mask_operand" "L")))]
1410 "includes_rshift_p (operands[2], operands[3])"
1411 "rlinm %0,%1,%s2,%m3,%M3")
1414 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1416 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1417 (match_operand:SI 2 "const_int_operand" "i"))
1418 (match_operand:SI 3 "mask_operand" "L"))
1420 (clobber (match_scratch:SI 4 "=r"))]
1421 "includes_rshift_p (operands[2], operands[3])"
1422 "rlinm. %4,%1,%s2,%m3,%M3"
1423 [(set_attr "type" "delayed_compare")])
1426 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1428 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1429 (match_operand:SI 2 "const_int_operand" "i"))
1430 (match_operand:SI 3 "mask_operand" "L"))
1432 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1433 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
1434 "includes_rshift_p (operands[2], operands[3])"
1435 "rlinm. %0,%1,%s2,%m3,%M3"
1436 [(set_attr "type" "delayed_compare")])
1439 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1442 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1443 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
1444 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
1445 "rlinm %0,%1,%s2,24,31")
1448 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1452 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1453 (match_operand:SI 2 "const_int_operand" "i")) 0))
1455 (clobber (match_scratch:SI 3 "=r"))]
1456 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
1457 "rlinm. %3,%1,%s2,24,31"
1458 [(set_attr "type" "delayed_compare")])
1461 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1465 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1466 (match_operand:SI 2 "const_int_operand" "i")) 0))
1468 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1469 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
1470 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
1471 "rlinm. %0,%1,%s2,24,31"
1472 [(set_attr "type" "delayed_compare")])
1475 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1478 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1479 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
1480 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
1481 "rlinm %0,%1,%s2,16,31")
1484 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1488 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1489 (match_operand:SI 2 "const_int_operand" "i")) 0))
1491 (clobber (match_scratch:SI 3 "=r"))]
1492 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
1493 "rlinm. %3,%1,%s2,16,31"
1494 [(set_attr "type" "delayed_compare")])
1497 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1501 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1502 (match_operand:SI 2 "const_int_operand" "i")) 0))
1504 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1505 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
1506 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
1507 "rlinm. %0,%1,%s2,16,31"
1508 [(set_attr "type" "delayed_compare")])
1511 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1513 (match_operand:SI 1 "gpc_reg_operand" "r"))
1514 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1520 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1522 (match_operand:SI 1 "gpc_reg_operand" "r"))
1523 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1529 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1531 (match_operand:SI 1 "gpc_reg_operand" "r"))
1532 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1538 (define_insn "ashrsi3"
1539 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1540 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1541 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
1542 (clobber (match_scratch:SI 3 "=q,X"))]
1549 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
1550 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1551 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1553 (clobber (match_scratch:SI 3 "=r,r"))
1554 (clobber (match_scratch:SI 4 "=q,X"))]
1559 [(set_attr "type" "delayed_compare")])
1562 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
1563 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1564 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
1566 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1567 (ashiftrt:SI (match_dup 1) (match_dup 2)))
1568 (clobber (match_scratch:SI 4 "=q,X"))]
1573 [(set_attr "type" "delayed_compare")])
1575 (define_expand "extendqisi2"
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:SI 0 "gpc_reg_operand" "")
1581 (ashiftrt:SI (match_dup 2)
1583 (clobber (scratch:SI))])]
1586 { operands[1] = gen_lowpart (SImode, operands[1]);
1587 operands[2] = gen_reg_rtx (SImode); }")
1589 (define_expand "extendqihi2"
1590 [(parallel [(set (match_dup 2)
1591 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
1593 (clobber (scratch:SI))])
1594 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
1595 (ashiftrt:SI (match_dup 2)
1597 (clobber (scratch:SI))])]
1600 { operands[0] = gen_lowpart (SImode, operands[0]);
1601 operands[1] = gen_lowpart (SImode, operands[1]);
1602 operands[2] = gen_reg_rtx (SImode); }")
1604 ;; Floating-point insns, excluding normal data motion.
1606 ;; We pretend that we have both SFmode and DFmode insns, while, in fact,
1607 ;; all fp insns are actually done in double. The only conversions we will
1608 ;; do will be when storing to memory. In that case, we will use the "frsp"
1609 ;; instruction before storing.
1611 ;; Note that when we store into a single-precision memory location, we need to
1612 ;; use the frsp insn first. If the register being stored isn't dead, we
1613 ;; need a scratch register for the frsp. But this is difficult when the store
1614 ;; is done by reload. It is not incorrect to do the frsp on the register in
1615 ;; this case, we just lose precision that we would have otherwise gotten but
1616 ;; is not guaranteed. Perhaps this should be tightened up at some point.
1618 (define_insn "extendsfdf2"
1619 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1620 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
1624 if (REGNO (operands[0]) == REGNO (operands[1]))
1627 return \"fmr %0,%1\";
1629 [(set_attr "type" "fp")])
1631 (define_insn "truncdfsf2"
1632 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1633 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
1637 if (REGNO (operands[0]) == REGNO (operands[1]))
1640 return \"fmr %0,%1\";
1642 [(set_attr "type" "fp")])
1644 (define_insn "negsf2"
1645 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1646 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
1649 [(set_attr "type" "fp")])
1651 (define_insn "abssf2"
1652 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1653 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
1656 [(set_attr "type" "fp")])
1659 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1660 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
1663 [(set_attr "type" "fp")])
1665 (define_insn "addsf3"
1666 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1667 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1668 (match_operand:SF 2 "gpc_reg_operand" "f")))]
1671 [(set_attr "type" "fp")])
1673 (define_insn "subsf3"
1674 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1675 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
1676 (match_operand:SF 2 "gpc_reg_operand" "f")))]
1679 [(set_attr "type" "fp")])
1681 (define_insn "mulsf3"
1682 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1683 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1684 (match_operand:SF 2 "gpc_reg_operand" "f")))]
1687 [(set_attr "type" "fp")])
1689 (define_insn "divsf3"
1690 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1691 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
1692 (match_operand:SF 2 "gpc_reg_operand" "f")))]
1695 [(set_attr "type" "fp")])
1698 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1699 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1700 (match_operand:SF 2 "gpc_reg_operand" "f"))
1701 (match_operand:SF 3 "gpc_reg_operand" "f")))]
1704 [(set_attr "type" "fp")])
1707 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1708 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1709 (match_operand:SF 2 "gpc_reg_operand" "f"))
1710 (match_operand:SF 3 "gpc_reg_operand" "f")))]
1713 [(set_attr "type" "fp")])
1716 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1717 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1718 (match_operand:SF 2 "gpc_reg_operand" "f"))
1719 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
1722 [(set_attr "type" "fp")])
1725 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
1726 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
1727 (match_operand:SF 2 "gpc_reg_operand" "f"))
1728 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
1731 [(set_attr "type" "fp")])
1733 (define_insn "negdf2"
1734 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1735 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
1738 [(set_attr "type" "fp")])
1740 (define_insn "absdf2"
1741 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1742 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
1745 [(set_attr "type" "fp")])
1748 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1749 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
1752 [(set_attr "type" "fp")])
1754 (define_insn "adddf3"
1755 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1756 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1757 (match_operand:DF 2 "gpc_reg_operand" "f")))]
1760 [(set_attr "type" "fp")])
1762 (define_insn "subdf3"
1763 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1764 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
1765 (match_operand:DF 2 "gpc_reg_operand" "f")))]
1768 [(set_attr "type" "fp")])
1770 (define_insn "muldf3"
1771 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1772 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1773 (match_operand:DF 2 "gpc_reg_operand" "f")))]
1776 [(set_attr "type" "fp")])
1778 (define_insn "divdf3"
1779 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1780 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
1781 (match_operand:DF 2 "gpc_reg_operand" "f")))]
1784 [(set_attr "type" "fp")])
1787 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1788 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1789 (match_operand:DF 2 "gpc_reg_operand" "f"))
1790 (match_operand:DF 3 "gpc_reg_operand" "f")))]
1793 [(set_attr "type" "fp")])
1796 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1797 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1798 (match_operand:DF 2 "gpc_reg_operand" "f"))
1799 (match_operand:DF 3 "gpc_reg_operand" "f")))]
1802 [(set_attr "type" "fp")])
1805 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1806 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1807 (match_operand:DF 2 "gpc_reg_operand" "f"))
1808 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
1811 [(set_attr "type" "fp")])
1814 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
1815 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
1816 (match_operand:DF 2 "gpc_reg_operand" "f"))
1817 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
1820 [(set_attr "type" "fp")])
1822 ;; Conversions to and from floating-point.
1823 (define_expand "floatsidf2"
1825 (plus:DI (zero_extend:DI
1826 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1829 (set (match_operand:DF 0 "gpc_reg_operand" "")
1830 (minus:DF (subreg:DF (match_dup 2) 0)
1835 #if HOST_BITS_PER_INT != BITS_PER_WORD
1836 /* Maybe someone can figure out how to do this in that case. I don't
1837 want to right now. */
1841 operands[2] = gen_reg_rtx (DImode);
1842 operands[3] = gen_rtx (CONST_INT, VOIDmode, 0x80000000);
1843 operands[4] = immed_double_const (0, 0x43300000, DImode);
1844 operands[5] = force_reg (DFmode, immed_double_const (0x43300000,
1845 0x80000000, DFmode));
1848 (define_expand "floatunssidf2"
1850 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1852 (set (match_operand:DF 0 "gpc_reg_operand" "")
1853 (minus:DF (subreg:DF (match_dup 2) 0)
1858 #if HOST_BITS_PER_INT != BITS_PER_WORD
1859 /* Maybe someone can figure out how to do this in that case. I don't
1860 want to right now. */
1864 operands[2] = gen_reg_rtx (DImode);
1865 operands[3] = immed_double_const (0, 0x43300000, DImode);
1866 operands[4] = force_reg (DFmode, immed_double_const (0x43300000, 0, DFmode));
1869 ;; For the above two cases, we always split.
1871 [(set (match_operand:DI 0 "gpc_reg_operand" "")
1872 (plus:DI (zero_extend:DI
1873 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1874 (match_operand:SI 2 "logical_operand" "")))
1875 (match_operand:DI 3 "immediate_operand" "")))]
1876 "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD
1877 && GET_CODE (operands[3]) == CONST_DOUBLE
1878 && CONST_DOUBLE_LOW (operands[3]) == 0"
1879 [(set (match_dup 6) (xor:SI (match_dup 1) (match_dup 2)))
1880 (set (match_dup 4) (match_dup 5))]
1882 { operands[4] = operand_subword (operands[0], 0, 0, DImode);
1883 operands[5] = operand_subword (operands[3], 0, 0, DImode);
1884 operands[6] = operand_subword (operands[0], 1, 0, DImode);
1888 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
1889 (plus:DI (zero_extend:DI
1890 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1891 (match_operand:SI 2 "logical_operand" "rKJ")))
1892 (match_operand:DI 3 "immediate_operand" "n")))]
1893 "HOST_BITS_PER_INT == BITS_PER_WORD
1894 && GET_CODE (operands[3]) == CONST_DOUBLE
1895 && CONST_DOUBLE_LOW (operands[3]) == 0"
1899 [(set (match_operand:DI 0 "gpc_reg_operand" "=")
1900 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
1901 (match_operand:DI 2 "immediate_operand" "")))]
1902 "reload_completed && HOST_BITS_PER_INT == BITS_PER_WORD
1903 && GET_CODE (operands[2]) == CONST_DOUBLE
1904 && CONST_DOUBLE_LOW (operands[2]) == 0"
1905 [(set (match_dup 3) (match_dup 4))
1906 (set (match_dup 5) (match_dup 1))]
1908 { operands[3] = operand_subword (operands[0], 0, 0, DImode);
1909 operands[4] = operand_subword (operands[2], 0, 0, DImode);
1910 operands[5] = operand_subword (operands[0], 1, 0, DImode);
1912 if (rtx_equal_p (operands[1], operands[5]))
1914 emit_move_insn (operands[3], operands[4]);
1918 if (rtx_equal_p (operands[1], operands[3]))
1922 temp = operands[3]; operands[3] = operands[5]; operands[5] = temp;
1923 temp = operands[4]; operands[4] = operands[1]; operands[1] = temp;
1928 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
1929 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
1930 (match_operand:DI 2 "immediate_operand" "n")))]
1931 "HOST_BITS_PER_INT == BITS_PER_WORD
1932 && GET_CODE (operands[2]) == CONST_DOUBLE
1933 && CONST_DOUBLE_LOW (operands[2]) == 0"
1936 (define_expand "fix_truncdfsi2"
1937 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1938 (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
1942 emit_insn (gen_trunc_call (operands[0], operands[1],
1943 gen_rtx (SYMBOL_REF, Pmode, \"itrunc\")));
1947 (define_expand "fixuns_truncdfsi2"
1948 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1949 (unsigned_fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
1953 emit_insn (gen_trunc_call (operands[0], operands[1],
1954 gen_rtx (SYMBOL_REF, Pmode, \"uitrunc\")));
1959 (define_expand "trunc_call"
1960 [(parallel [(set (match_operand:SI 0 "" "")
1961 (fix:DF (match_operand:DF 1 "" "")))
1962 (use (match_operand:SI 2 "" ""))])]
1966 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
1967 rtx first = XVECEXP (insns, 0, 0);
1968 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
1970 REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
1972 REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
1978 (define_expand "trunc_call_rtl"
1979 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
1981 (parallel [(set (reg:SI 3)
1982 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
1983 (clobber (scratch:SI))])
1984 (set (match_operand:SI 0 "gpc_reg_operand" "")
1989 rs6000_trunc_used = 1;
1992 ;; Define the DImode operations that can be done in a small number
1994 (define_insn "adddi3"
1995 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
1996 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
1997 (match_operand:DI 2 "gpc_reg_operand" "r")))]
1999 "a %L0,%L1,%L2\;ae %0,%1,%2")
2001 (define_insn "subdi3"
2002 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2003 (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
2004 (match_operand:DI 2 "gpc_reg_operand" "r")))]
2006 "sf %L0,%L2,%L1\;sfe %0,%2,%1")
2008 (define_insn "negdi2"
2009 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2010 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
2012 "sfi %L0,%L1,0\;sfze %0,%1")
2014 (define_insn "mulsidi3"
2015 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
2016 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2017 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
2018 (clobber (match_scratch:SI 3 "=q"))]
2020 "mul %0,%1,%2\;mfmq %L0")
2022 ;; If operands 0 and 2 are in the same register, we have a problem. But
2023 ;; operands 0 and 1 (the usual case) can be in the same register. That's
2024 ;; why we have the strange constraints below.
2025 (define_insn "ashldi3"
2026 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
2027 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
2028 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
2029 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
2032 sli %0,%L1,%h2\;cal %L0,0(0)
2033 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
2034 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
2035 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2")
2037 (define_insn "lshrdi3"
2038 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
2039 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
2040 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
2041 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
2044 cal %0,0(0)\;s%A2i %L0,%1,%h2
2045 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
2046 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
2047 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2")
2049 ;; Shift by a variable amount is too complex to be worth open-coding. We
2050 ;; just handle shifts by constants.
2052 (define_expand "ashrdi3"
2053 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=")
2054 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
2055 (match_operand:SI 2 "general_operand" "")))
2056 (clobber (match_scratch:SI 3 ""))])]
2059 { if (GET_CODE (operands[2]) != CONST_INT)
2064 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
2065 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
2066 (match_operand:SI 2 "const_int_operand" "M,i")))
2067 (clobber (match_scratch:SI 3 "=X,q"))]
2070 srai %0,%1,31\;srai %L0,%1,%h2
2071 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2")
2073 ;; Now define ways of moving data around.
2075 ;; For SI, we special-case integers that can't be loaded in one insn. We
2076 ;; do the load 16-bits at a time. We could do this by loading from memory,
2077 ;; and this is even supposed to be faster, but it is simpler not to get
2078 ;; integers in the TOC.
2079 (define_expand "movsi"
2080 [(set (match_operand:SI 0 "general_operand" "")
2081 (match_operand:SI 1 "any_operand" ""))]
2085 if (GET_CODE (operands[0]) != REG)
2086 operands[1] = force_reg (SImode, operands[1]);
2088 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
2089 operands[1] = force_const_mem (SImode, operands[1]);
2091 if (GET_CODE (operands[1]) == CONST_INT
2092 && (unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
2093 && (INTVAL (operands[1]) & 0xffff) != 0)
2095 emit_move_insn (operands[0],
2096 gen_rtx (CONST_INT, VOIDmode,
2097 INTVAL (operands[1]) & 0xffff0000));
2098 emit_insn (gen_iorsi3 (operands[0], operands[0],
2099 gen_rtx (CONST_INT, VOIDmode,
2100 INTVAL (operands[1]) & 0xffff)));
2106 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m,r,r,r,*c*q,*l")
2107 (match_operand:SI 1 "input_operand" "r,m,r,I,J,*h,r,r"))]
2108 "gpc_reg_operand (operands[0], SImode)
2109 || gpc_reg_operand (operands[1], SImode)"
2119 [(set_attr "type" "*,load,*,*,*,*,*,mtlr")])
2121 ;; Split a load of a large constant into the appropriate two-insn
2125 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2126 (match_operand:SI 1 "const_int_operand" ""))]
2127 "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
2128 && (INTVAL (operands[1]) & 0xffff) != 0"
2132 (ior:SI (match_dup 0)
2136 operands[2] = gen_rtx (CONST_INT, VOIDmode,
2137 INTVAL (operands[1]) & 0xffff0000);
2138 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
2142 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
2143 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
2145 (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
2148 [(set_attr "type" "compare")])
2150 (define_expand "movhi"
2151 [(set (match_operand:HI 0 "general_operand" "")
2152 (match_operand:HI 1 "any_operand" ""))]
2156 if (GET_CODE (operands[0]) != REG)
2157 operands[1] = force_reg (HImode, operands[1]);
2159 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
2160 operands[1] = force_const_mem (HImode, operands[1]);
2164 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*h")
2165 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r"))]
2166 "gpc_reg_operand (operands[0], HImode)
2167 || gpc_reg_operand (operands[1], HImode)"
2175 [(set_attr "type" "*,load,*,*,*,*")])
2177 (define_expand "movqi"
2178 [(set (match_operand:QI 0 "general_operand" "")
2179 (match_operand:QI 1 "any_operand" ""))]
2183 if (GET_CODE (operands[0]) != REG)
2184 operands[1] = force_reg (QImode, operands[1]);
2186 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
2187 operands[1] = force_const_mem (QImode, operands[1]);
2191 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*h")
2192 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r"))]
2193 "gpc_reg_operand (operands[0], QImode)
2194 || gpc_reg_operand (operands[1], QImode)"
2202 [(set_attr "type" "*,load,*,*,*,*")])
2204 ;; Here is how to move condition codes around. When we store CC data in
2205 ;; an integer register or memory, we store just the high-order 4 bits.
2206 ;; This lets us not shift in the most common case of CR0.
2207 (define_expand "movcc"
2208 [(set (match_operand:CC 0 "nonimmediate_operand" "")
2209 (match_operand:CC 1 "nonimmediate_operand" ""))]
2214 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
2215 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
2216 "register_operand (operands[0], CCmode)
2217 || register_operand (operands[1], CCmode)"
2221 rlinm %1,%1,%F0,0,31\;mtcrf %R0,%1\;rlinm %1,%1,%f0,0,31
2223 mfcr %0\;rlinm %0,%0,%f1,0,3
2227 [(set_attr "type" "*,*,*,compare,*,*,load,*")])
2229 ;; For floating-point, we normally deal with the floating-point registers.
2230 ;; The sole exception is that parameter passing can produce floating-point
2231 ;; values in fixed-point registers. Unless the value is a simple constant
2232 ;; or already in memory, we deal with this by allocating memory and copying
2233 ;; the value explicitly via that memory location.
2234 (define_expand "movsf"
2235 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2236 (match_operand:SF 1 "any_operand" ""))]
2240 /* If we are called from reload, we might be getting a SUBREG of a hard
2241 reg. So expand it. */
2242 if (GET_CODE (operands[0]) == SUBREG
2243 && GET_CODE (SUBREG_REG (operands[0])) == REG
2244 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
2245 operands[0] = alter_subreg (operands[0]);
2246 if (GET_CODE (operands[1]) == SUBREG
2247 && GET_CODE (SUBREG_REG (operands[1])) == REG
2248 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
2249 operands[1] = alter_subreg (operands[1]);
2251 /* If we are being called from reload, it is possible that operands[1]
2252 is a hard non-fp register. So handle those cases. */
2253 if (reload_in_progress && GET_CODE (operands[1]) == REG
2254 && REGNO (operands[1]) < 32)
2258 /* Remember that we only see a pseudo here if it didn't get a hard
2259 register, so it is memory. */
2260 if (GET_CODE (operands[0]) == MEM
2261 || (GET_CODE (operands[0]) == REG
2262 && (REGNO (operands[0]) < 32
2263 || REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
2264 || (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32))
2266 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
2267 operand_subword (operands[1], 0, 0, SFmode));
2271 stack_slot = gen_rtx (MEM, SFmode, plus_constant (stack_pointer_rtx, 4));
2272 emit_move_insn (stack_slot, operands[1]);
2273 emit_move_insn (operands[0], stack_slot);
2277 if (GET_CODE (operands[0]) == MEM)
2278 operands[1] = force_reg (SFmode, operands[1]);
2280 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
2284 if (GET_CODE (operands[1]) == MEM
2285 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
2286 || GET_CODE (operands[1]) == CONST_DOUBLE
2288 || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
2289 || (reload_in_progress && GET_CODE (operands[1]) == REG
2290 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
2292 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
2293 operand_subword (operands[1], 0, 0, SFmode));
2297 if (reload_in_progress)
2298 stack_slot = gen_rtx (MEM, SFmode,
2299 plus_constant (stack_pointer_rtx, 4));
2301 stack_slot = assign_stack_temp (SFmode, 4, 0);
2302 emit_move_insn (stack_slot, operands[1]);
2303 emit_move_insn (operands[0], stack_slot);
2307 if (CONSTANT_P (operands[1]))
2309 operands[1] = force_const_mem (SFmode, operands[1]);
2310 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
2311 && ! reload_in_progress)
2312 operands[1] = change_address (operands[1], SFmode,
2313 XEXP (operands[1], 0));
2318 [(set (match_operand:SF 0 "gpc_reg_operand" "=r,r")
2319 (match_operand:SF 1 "mem_or_easy_const_operand" "G,m"))]
2320 "REGNO (operands[0]) <= 31"
2324 [(set_attr "type" "*,load")])
2327 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2328 (match_operand:SF 1 "easy_fp_constant" ""))]
2329 "reload_completed && REGNO (operands[0]) <= 31"
2330 [(set (match_dup 2) (match_dup 3))]
2332 { operands[2] = operand_subword (operands[0], 0, 0, SFmode);
2333 operands[3] = operand_subword (operands[1], 0, 0, SFmode); }")
2336 [(set (match_operand:SF 0 "fp_reg_or_mem_operand" "=f,f,m")
2337 (match_operand:SF 1 "input_operand" "f,m,f"))]
2338 "gpc_reg_operand (operands[0], SFmode)
2339 || gpc_reg_operand (operands[1], SFmode)"
2343 frsp %1,%1\;stfs%U0%X0 %1,%0"
2344 [(set_attr "type" "fp,load,*")])
2346 (define_expand "movdf"
2347 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2348 (match_operand:DF 1 "any_operand" ""))]
2352 /* If we are called from reload, we might be getting a SUBREG of a hard
2353 reg. So expand it. */
2354 if (GET_CODE (operands[0]) == SUBREG
2355 && GET_CODE (SUBREG_REG (operands[0])) == REG
2356 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
2357 operands[0] = alter_subreg (operands[0]);
2358 if (GET_CODE (operands[1]) == SUBREG
2359 && GET_CODE (SUBREG_REG (operands[1])) == REG
2360 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
2361 operands[1] = alter_subreg (operands[1]);
2363 /* If we are being called from reload, it is possible that operands[1]
2364 is a hard non-fp register. So handle those cases. */
2365 if (reload_in_progress && GET_CODE (operands[1]) == REG
2366 && REGNO (operands[1]) < 32)
2370 /* Remember that we only see a pseudo here if it didn't get a hard
2371 register, so it is memory. */
2372 if (GET_CODE (operands[0]) == MEM
2373 || (GET_CODE (operands[0]) == REG
2374 && (REGNO (operands[0]) < 32
2375 || REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)))
2377 emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
2378 operand_subword (operands[1], 0, 0, DFmode));
2379 emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
2380 operand_subword (operands[1], 1, 0, DFmode));
2384 stack_slot = gen_rtx (MEM, DFmode, plus_constant (stack_pointer_rtx, 8));
2385 emit_move_insn (stack_slot, operands[1]);
2386 emit_move_insn (operands[0], stack_slot);
2390 if (GET_CODE (operands[0]) == MEM)
2392 if (GET_CODE (operands[1]) == MEM)
2394 emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
2395 operand_subword (operands[1], 0, 0, DFmode));
2396 emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
2397 operand_subword (operands[1], 1, 0, DFmode));
2401 operands[1] = force_reg (DFmode, operands[1]);
2404 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
2408 if (GET_CODE (operands[1]) == MEM
2409 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
2410 || GET_CODE (operands[1]) == CONST_DOUBLE
2412 || (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
2413 || (reload_in_progress && GET_CODE (operands[1]) == REG
2414 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))
2416 emit_move_insn (operand_subword (operands[0], 0, 0, DFmode),
2417 operand_subword (operands[1], 0, 0, DFmode));
2418 emit_move_insn (operand_subword (operands[0], 1, 0, DFmode),
2419 operand_subword (operands[1], 1, 0, DFmode));
2423 if (reload_in_progress)
2424 stack_slot = gen_rtx (MEM, DFmode,
2425 plus_constant (stack_pointer_rtx, 8));
2427 stack_slot = assign_stack_temp (DFmode, 8, 0);
2428 emit_move_insn (stack_slot, operands[1]);
2429 emit_move_insn (operands[0], stack_slot);
2433 if (CONSTANT_P (operands[1]))
2435 operands[1] = force_const_mem (DFmode, operands[1]);
2436 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
2437 && ! reload_in_progress)
2438 operands[1] = change_address (operands[1], DFmode,
2439 XEXP (operands[1], 0));
2444 [(set (match_operand:DF 0 "gpc_reg_operand" "=r,r")
2445 (match_operand:DF 1 "mem_or_easy_const_operand" "G,m"))]
2446 "REGNO (operands[0]) <= 31"
2450 [(set_attr "type" "*,load")])
2453 [(set (match_operand:DF 0 "gpc_reg_operand" "")
2454 (match_operand:DF 1 "easy_fp_constant" ""))]
2455 "reload_completed && REGNO (operands[0]) <= 31"
2456 [(set (match_dup 2) (match_dup 3))
2457 (set (match_dup 4) (match_dup 5))]
2459 { operands[2] = operand_subword (operands[0], 0, 0, DFmode);
2460 operands[3] = operand_subword (operands[1], 0, 0, DFmode);
2461 operands[4] = operand_subword (operands[0], 1, 0, DFmode);
2462 operands[5] = operand_subword (operands[1], 1, 0, DFmode); }")
2465 [(set (match_operand:DF 0 "fp_reg_or_mem_operand" "=f,f,m")
2466 (match_operand:DF 1 "fp_reg_or_mem_operand" "f,m,f"))]
2467 "gpc_reg_operand (operands[0], DFmode)
2468 || gpc_reg_operand (operands[1], DFmode)"
2473 [(set_attr "type" "fp,load,*")])
2475 ;; Next come the multi-word integer load and store and the load and store
2477 (define_expand "movdi"
2478 [(set (match_operand:DI 0 "general_operand" "")
2479 (match_operand:DI 1 "general_operand" ""))]
2483 if (GET_CODE (operands[1]) == CONST_DOUBLE
2484 || GET_CODE (operands[1]) == CONST_INT)
2486 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
2487 operand_subword (operands[1], 0, 0, DImode));
2488 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
2489 operand_subword (operands[1], 1, 0, DImode));
2493 if (GET_CODE (operands[0]) == MEM)
2494 operands[1] = force_reg (DImode, operands[1]);
2498 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m")
2499 (match_operand:DI 1 "input_operand" "r,m,r"))]
2500 "gpc_reg_operand (operands[0], DImode)
2501 || gpc_reg_operand (operands[1], DImode)"
2504 switch (which_alternative)
2507 /* We normally copy the low-numbered register first. However, if
2508 the first register operand 0 is the same as the second register of
2509 operand 1, we must copy in the opposite order. */
2510 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
2511 return \"oril %L0,%L1,0\;oril %0,%1,0\";
2513 return \"oril %0,%1,0\;oril %L0,%L1,0\";
2515 /* If the low-address word is used in the address, we must load it
2516 last. Otherwise, load it first. Note that we cannot have
2517 auto-increment in that case since the address register is known to be
2519 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
2521 return \"l %L0,%L1\;l %0,%1\";
2523 return \"l%U1 %0,%1\;l %L0,%L1\";
2525 return \"st%U0 %1,%0\;st %L1,%L0\";
2528 [(set_attr "type" "*,load,*")])
2530 ;; TImode is similar, except that we usually want to compute the address into
2531 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
2532 ;; clobbered in stsi, so we need a SCRATCH for it.
2533 (define_expand "movti"
2534 [(parallel [(set (match_operand:TI 0 "general_operand" "")
2535 (match_operand:TI 1 "general_operand" ""))
2536 (clobber (scratch:SI))])]
2540 if (GET_CODE (operands[0]) == MEM)
2541 operands[1] = force_reg (TImode, operands[1]);
2543 if (GET_CODE (operands[0]) == MEM
2544 && GET_CODE (XEXP (operands[0], 0)) != REG
2545 && ! reload_in_progress)
2546 operands[0] = change_address (operands[0], TImode,
2547 copy_addr_to_reg (XEXP (operands[0], 0)));
2549 if (GET_CODE (operands[1]) == MEM
2550 && GET_CODE (XEXP (operands[1], 0)) != REG
2551 && ! reload_in_progress)
2552 operands[1] = change_address (operands[1], TImode,
2553 copy_addr_to_reg (XEXP (operands[1], 0)));
2556 ;; We say that MQ is clobbered in the last alternative because the first
2557 ;; alternative would never get used otherwise since it would need a reload
2558 ;; while the 2nd alternative would not. We put memory cases first so they
2559 ;; are preferred. Otherwise, we'd try to reload the output instead of
2560 ;; giving the SCRATCH mq.
2562 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,r,r,r")
2563 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
2564 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
2565 "gpc_reg_operand (operands[0], TImode)
2566 || gpc_reg_operand (operands[1], TImode)"
2569 switch (which_alternative)
2572 return \"stsi %1,%P0,16\";
2575 return \"st%U0 %1,%0\;st %L1,%L0\;st %Y1,%Y0\;st %Z1,%Z0\";
2578 /* Normally copy registers with lowest numbered register copied first.
2579 But copy in the other order if the first register of the output
2580 is the second, third, or fourth register in the input. */
2581 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
2582 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
2583 return \"oril %Z0,%Z1,0\;oril %Y0,%Y1,0\;oril %L0,%L1,0\;oril %0,%1,0\";
2585 return \"oril %0,%1,0\;oril %L0,%L1,0\;oril %Y0,%Y1,0\;oril %Z0,%Z1,0\";
2587 /* If the address is not used in the output, we can use lsi. Otherwise,
2588 fall through to generating four loads. */
2589 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
2590 return \"lsi %0,%P1,16\";
2591 /* ... fall through ... */
2593 /* If the address register is the same as the register for the lowest-
2594 addressed word, load it last. Similarly for the next two words.
2595 Otherwise load lowest address to highest. */
2596 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
2598 return \"l %L0,%L1\;l %Y0,%Y1\;l %Z0,%Z1\;l %0,%1\";
2599 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
2600 REGNO (operands[0]) + 2, operands[1], 0))
2601 return \"l %0,%1\;l %Y0,%Y1\;l %Z0,%Z1\;l %L0,%L1\";
2602 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
2603 REGNO (operands[0]) + 3, operands[1], 0))
2604 return \"l %0,%1\;l %L0,%L1\;l %Z0,%Z1\;l %Y0,%Y1\";
2606 return \"l%U1 %0,%1\;l %L0,%L1\;l %Y0,%Y1\;l %Z0,%Z1\";
2609 [(set_attr "type" "*,load,load,*,*")])
2611 (define_expand "load_multiple"
2612 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
2613 (match_operand:SI 1 "" ""))
2614 (use (match_operand:SI 2 "" ""))])]
2623 /* Support only loading a constant number of fixed-point registers from
2624 memory and only bother with this if more than two; the machine
2625 doesn't support more than eight. */
2626 if (GET_CODE (operands[2]) != CONST_INT
2627 || INTVAL (operands[2]) <= 2
2628 || INTVAL (operands[2]) > 8
2629 || GET_CODE (operands[1]) != MEM
2630 || GET_CODE (operands[0]) != REG
2631 || REGNO (operands[0]) >= 32)
2634 count = INTVAL (operands[2]);
2635 regno = REGNO (operands[0]);
2637 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
2638 from = force_reg (SImode, XEXP (operands[1], 0));
2640 for (i = 0; i < count; i++)
2641 XVECEXP (operands[3], 0, i)
2642 = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
2643 gen_rtx (MEM, SImode, plus_constant (from, i * 4)));
2647 [(match_parallel 0 "load_multiple_operation"
2648 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
2649 (match_operand:SI 2 "indirect_operand" "Q"))])]
2653 /* We have to handle the case where the pseudo used to contain the address
2654 is assigned to one of the output registers. In that case, do the
2655 lsi, but then load the correct value. This is a bit of a mess, but is
2656 the best we can do. */
2657 static char result[100];
2661 strcpy (result, \"lsi %1,%P2,%N0\");
2662 for (i = 0; i < XVECLEN (operands[0], 0); i++)
2663 if (refers_to_regno_p (REGNO (operands[1]) + i,
2664 REGNO (operands[1]) + i + 1, operands[2], 0))
2666 sprintf (newload, \"\;l %d,%d(%d)\",
2667 REGNO (operands[1]) + i,
2668 i * 4, REGNO (XEXP (operands[2], 0)));
2669 strcat (result, newload);
2674 [(set_attr "type" "load")])
2676 (define_expand "store_multiple"
2677 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
2678 (match_operand:SI 1 "" ""))
2679 (clobber (scratch:SI))
2680 (use (match_operand:SI 2 "" ""))])]
2689 /* Support only storing a constant number of fixed-point registers to
2690 memory and only bother with this if more than two; the machine
2691 doesn't support more than eight. */
2692 if (GET_CODE (operands[2]) != CONST_INT
2693 || INTVAL (operands[2]) <= 2
2694 || INTVAL (operands[2]) > 8
2695 || GET_CODE (operands[0]) != MEM
2696 || GET_CODE (operands[1]) != REG
2697 || REGNO (operands[1]) >= 32)
2700 count = INTVAL (operands[2]);
2701 regno = REGNO (operands[1]);
2703 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
2704 to = force_reg (SImode, XEXP (operands[0], 0));
2706 XVECEXP (operands[3], 0, 0)
2707 = gen_rtx (SET, VOIDmode, gen_rtx (MEM, SImode, to), operands[1]);
2708 XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
2709 gen_rtx (SCRATCH, SImode));
2711 for (i = 1; i < count; i++)
2712 XVECEXP (operands[3], 0, i + 1)
2713 = gen_rtx (SET, VOIDmode,
2714 gen_rtx (MEM, SImode, plus_constant (to, i * 4)),
2715 gen_rtx (REG, SImode, regno + i));
2719 [(match_parallel 0 "store_multiple_operation"
2720 [(set (match_operand:SI 1 "indirect_operand" "=Q")
2721 (match_operand:SI 2 "gpc_reg_operand" "r"))
2722 (clobber (match_scratch:SI 3 "=q"))])]
2726 ;; Define insns that do load or store with update. Some of these we can
2727 ;; get by using pre-decrement or pre-increment, but the hardware can also
2728 ;; do cases where the increment is not the size of the object.
2730 ;; In all these cases, we use operands 0 and 1 for the register being
2731 ;; incremented because those are the operands that local-alloc will
2732 ;; tie and these are the pair most likely to be tieable (and the ones
2733 ;; that will benefit the most).
2736 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
2737 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2738 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2739 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2740 (plus:SI (match_dup 1) (match_dup 2)))]
2745 [(set_attr "type" "load,load")])
2748 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2749 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2750 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2751 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2752 (plus:SI (match_dup 1) (match_dup 2)))]
2759 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
2760 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2761 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2762 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2763 (plus:SI (match_dup 1) (match_dup 2)))]
2768 [(set_attr "type" "load,load")])
2771 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
2773 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2774 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
2775 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2776 (plus:SI (match_dup 1) (match_dup 2)))]
2781 [(set_attr "type" "load,load")])
2784 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
2786 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2787 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
2788 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2789 (plus:SI (match_dup 1) (match_dup 2)))]
2794 [(set_attr "type" "load,load")])
2797 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2798 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2799 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
2800 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2801 (plus:SI (match_dup 1) (match_dup 2)))]
2806 [(set_attr "type" "load,load")])
2809 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
2810 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2811 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2812 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2813 (plus:SI (match_dup 1) (match_dup 2)))]
2818 [(set_attr "type" "load,load")])
2821 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
2823 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2824 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
2825 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2826 (plus:SI (match_dup 1) (match_dup 2)))]
2831 [(set_attr "type" "load,load")])
2834 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2835 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2836 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
2837 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2838 (plus:SI (match_dup 1) (match_dup 2)))]
2845 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
2846 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2847 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2848 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2849 (plus:SI (match_dup 1) (match_dup 2)))]
2854 [(set_attr "type" "load,load")])
2857 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2858 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2859 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
2860 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2861 (plus:SI (match_dup 1) (match_dup 2)))]
2864 frsp %3,%3\;stfsux %3,%0,%2
2865 frsp %3,%3\;stfsu %3,%2(%0)")
2868 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
2869 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2870 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
2871 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2872 (plus:SI (match_dup 1) (match_dup 2)))]
2877 [(set_attr "type" "load,load")])
2880 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
2881 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
2882 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
2883 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
2884 (plus:SI (match_dup 1) (match_dup 2)))]
2890 ;; Next come insns related to the calling sequence.
2892 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
2893 ;; We move the back-chain and decrement the stack pointer.
2895 (define_expand "allocate_stack"
2897 (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
2900 { rtx chain = gen_reg_rtx (SImode);
2901 rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
2903 emit_move_insn (chain, stack_bot);
2904 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, operands[0]));
2905 emit_move_insn (stack_bot, chain);
2909 ;; These patterns say how to save and restore the stack pointer. We need not
2910 ;; save the stack pointer at function level since we are careful to
2911 ;; preserve the backchain. At block level, we have to restore the backchain
2912 ;; when we restore the stack pointer.
2914 ;; For nonlocal gotos, we must save both the stack pointer and its
2915 ;; backchain and restore both. Note that in the nonlocal case, the
2916 ;; save area is a memory location.
2918 (define_expand "save_stack_function"
2919 [(use (const_int 0))]
2923 (define_expand "restore_stack_function"
2924 [(use (const_int 0))]
2928 (define_expand "restore_stack_block"
2929 [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
2930 (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
2931 (set (mem:SI (match_dup 0)) (match_dup 2))]
2934 { operands[2] = gen_reg_rtx (SImode); }")
2936 (define_expand "save_stack_nonlocal"
2937 [(match_operand:DI 0 "memory_operand" "")
2938 (match_operand:SI 1 "register_operand" "")]
2942 rtx temp = gen_reg_rtx (SImode);
2944 /* Copy the backchain to the first word, sp to the second. */
2945 emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
2946 emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
2947 emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
2951 (define_expand "restore_stack_nonlocal"
2952 [(match_operand:SI 0 "register_operand" "")
2953 (match_operand:DI 1 "memory_operand" "")]
2957 rtx temp = gen_reg_rtx (SImode);
2959 /* Restore the backchain from the first word, sp from the second. */
2960 emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
2961 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
2962 emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
2966 ;; A function pointer is a pointer to a data area whose first word contains
2967 ;; the actual address of the function, whose second word contains a pointer
2968 ;; to its TOC, and whose third word contains a value to place in the static
2969 ;; chain register (r11). Note that if we load the static chain, our
2970 ;; "trampoline" need not have any executable code.
2972 ;; operands[0] is an SImode pseudo in which we place the address of the
2974 ;; operands[1] is the address of data area of the function to call
2976 (define_expand "call_via_ptr"
2977 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2978 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
2979 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
2982 (mem:SI (plus:SI (match_dup 1)
2985 (mem:SI (plus:SI (match_dup 1)
2992 (define_expand "call"
2993 [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
2994 (match_operand 1 "" ""))
2995 (clobber (scratch:SI))])]
2999 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
3002 operands[0] = XEXP (operands[0], 0);
3003 if (GET_CODE (operands[0]) != SYMBOL_REF)
3005 rtx temp = gen_reg_rtx (SImode);
3007 emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[0])));
3012 (define_expand "call_value"
3013 [(parallel [(set (match_operand 0 "" "")
3014 (call (mem:SI (match_operand:SI 1 "address_operand" ""))
3015 (match_operand 2 "" "")))
3016 (clobber (scratch:SI))])]
3020 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
3023 operands[1] = XEXP (operands[1], 0);
3024 if (GET_CODE (operands[1]) != SYMBOL_REF)
3026 rtx temp = gen_reg_rtx (SImode);
3028 emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[1])));
3034 [(call (mem:SI (match_operand:SI 0 "call_operand" "l,s"))
3035 (match_operand 1 "" "fg,fg"))
3036 (clobber (match_scratch:SI 2 "=l,l"))]
3040 bl %z0\;cror 15,15,15")
3043 [(set (match_operand 0 "" "=fg,fg")
3044 (call (mem:SI (match_operand:SI 1 "call_operand" "l,s"))
3045 (match_operand 2 "" "fg,fg")))
3046 (clobber (match_scratch:SI 3 "=l,l"))]
3050 bl %z1\;cror 15,15,15")
3052 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
3053 ;; signed & unsigned, and one type of branch.
3055 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
3056 ;; insns, and branches. We store the operands of compares until we see
3058 (define_expand "cmpsi"
3060 (compare (match_operand:SI 0 "gpc_reg_operand" "")
3061 (match_operand:SI 1 "reg_or_short_operand" "")))]
3065 /* Take care of the possibility that operands[1] might be negative but
3066 this might be a logical operation. That insn doesn't exist. */
3067 if (GET_CODE (operands[1]) == CONST_INT
3068 && INTVAL (operands[1]) < 0)
3069 operands[1] = force_reg (SImode, operands[1]);
3071 rs6000_compare_op0 = operands[0];
3072 rs6000_compare_op1 = operands[1];
3073 rs6000_compare_fp_p = 0;
3077 (define_expand "cmpsf"
3078 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
3079 (match_operand:SF 1 "gpc_reg_operand" "")))]
3083 rs6000_compare_op0 = operands[0];
3084 rs6000_compare_op1 = operands[1];
3085 rs6000_compare_fp_p = 1;
3089 (define_expand "cmpdf"
3090 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
3091 (match_operand:DF 1 "gpc_reg_operand" "")))]
3095 rs6000_compare_op0 = operands[0];
3096 rs6000_compare_op1 = operands[1];
3097 rs6000_compare_fp_p = 1;
3101 (define_expand "beq"
3102 [(set (match_dup 2) (match_dup 1))
3104 (if_then_else (eq (match_dup 2)
3106 (label_ref (match_operand 0 "" ""))
3110 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3111 operands[1] = gen_rtx (COMPARE, mode,
3112 rs6000_compare_op0, rs6000_compare_op1);
3113 operands[2] = gen_reg_rtx (mode);
3116 (define_expand "bne"
3117 [(set (match_dup 2) (match_dup 1))
3119 (if_then_else (ne (match_dup 2)
3121 (label_ref (match_operand 0 "" ""))
3125 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3126 operands[1] = gen_rtx (COMPARE, mode,
3127 rs6000_compare_op0, rs6000_compare_op1);
3128 operands[2] = gen_reg_rtx (mode);
3131 (define_expand "blt"
3132 [(set (match_dup 2) (match_dup 1))
3134 (if_then_else (lt (match_dup 2)
3136 (label_ref (match_operand 0 "" ""))
3140 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3141 operands[1] = gen_rtx (COMPARE, mode,
3142 rs6000_compare_op0, rs6000_compare_op1);
3143 operands[2] = gen_reg_rtx (mode);
3146 (define_expand "bgt"
3147 [(set (match_dup 2) (match_dup 1))
3149 (if_then_else (gt (match_dup 2)
3151 (label_ref (match_operand 0 "" ""))
3155 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3156 operands[1] = gen_rtx (COMPARE, mode,
3157 rs6000_compare_op0, rs6000_compare_op1);
3158 operands[2] = gen_reg_rtx (mode);
3161 (define_expand "ble"
3162 [(set (match_dup 2) (match_dup 1))
3164 (if_then_else (le (match_dup 2)
3166 (label_ref (match_operand 0 "" ""))
3170 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3171 operands[1] = gen_rtx (COMPARE, mode,
3172 rs6000_compare_op0, rs6000_compare_op1);
3173 operands[2] = gen_reg_rtx (mode);
3176 (define_expand "bge"
3177 [(set (match_dup 2) (match_dup 1))
3179 (if_then_else (ge (match_dup 2)
3181 (label_ref (match_operand 0 "" ""))
3185 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3186 operands[1] = gen_rtx (COMPARE, mode,
3187 rs6000_compare_op0, rs6000_compare_op1);
3188 operands[2] = gen_reg_rtx (mode);
3191 (define_expand "bgtu"
3192 [(set (match_dup 2) (match_dup 1))
3194 (if_then_else (gtu (match_dup 2)
3196 (label_ref (match_operand 0 "" ""))
3200 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3201 rs6000_compare_op0, rs6000_compare_op1);
3202 operands[2] = gen_reg_rtx (CCUNSmode);
3205 (define_expand "bltu"
3206 [(set (match_dup 2) (match_dup 1))
3208 (if_then_else (ltu (match_dup 2)
3210 (label_ref (match_operand 0 "" ""))
3214 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3215 rs6000_compare_op0, rs6000_compare_op1);
3216 operands[2] = gen_reg_rtx (CCUNSmode);
3219 (define_expand "bgeu"
3220 [(set (match_dup 2) (match_dup 1))
3222 (if_then_else (geu (match_dup 2)
3224 (label_ref (match_operand 0 "" ""))
3228 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3229 rs6000_compare_op0, rs6000_compare_op1);
3230 operands[2] = gen_reg_rtx (CCUNSmode);
3233 (define_expand "bleu"
3234 [(set (match_dup 2) (match_dup 1))
3236 (if_then_else (leu (match_dup 2)
3238 (label_ref (match_operand 0 "" ""))
3242 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3243 rs6000_compare_op0, rs6000_compare_op1);
3244 operands[2] = gen_reg_rtx (CCUNSmode);
3247 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
3248 ;; For SEQ, likewise, except that comparisons with zero should be done
3249 ;; with an scc insns. However, due to the order that combine see the
3250 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
3251 ;; the cases we don't want to handle.
3252 (define_expand "seq"
3253 [(set (match_dup 2) (match_dup 1))
3254 (set (match_operand:SI 0 "gpc_reg_operand" "")
3255 (eq:SI (match_dup 2) (const_int 0)))]
3258 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3259 operands[1] = gen_rtx (COMPARE, mode,
3260 rs6000_compare_op0, rs6000_compare_op1);
3261 operands[2] = gen_reg_rtx (mode);
3264 (define_expand "sne"
3265 [(set (match_dup 2) (match_dup 1))
3266 (set (match_operand:SI 0 "gpc_reg_operand" "")
3267 (ne:SI (match_dup 2) (const_int 0)))]
3270 { if (! rs6000_compare_fp_p)
3273 operands[1] = gen_rtx (COMPARE, CCFPmode,
3274 rs6000_compare_op0, rs6000_compare_op1);
3275 operands[2] = gen_reg_rtx (CCFPmode);
3278 ;; A > 0 is best done using the portable sequence, so fail in that case.
3279 (define_expand "sgt"
3280 [(set (match_dup 2) (match_dup 1))
3281 (set (match_operand:SI 0 "gpc_reg_operand" "")
3282 (gt:SI (match_dup 2) (const_int 0)))]
3285 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3287 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
3290 operands[1] = gen_rtx (COMPARE, mode,
3291 rs6000_compare_op0, rs6000_compare_op1);
3292 operands[2] = gen_reg_rtx (mode);
3295 ;; A < 0 is best done in the portable way for A an integer.
3296 (define_expand "slt"
3297 [(set (match_dup 2) (match_dup 1))
3298 (set (match_operand:SI 0 "gpc_reg_operand" "")
3299 (lt:SI (match_dup 2) (const_int 0)))]
3302 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3304 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
3307 operands[1] = gen_rtx (COMPARE, mode,
3308 rs6000_compare_op0, rs6000_compare_op1);
3309 operands[2] = gen_reg_rtx (mode);
3312 (define_expand "sge"
3313 [(set (match_dup 2) (match_dup 1))
3314 (set (match_operand:SI 0 "gpc_reg_operand" "")
3315 (ge:SI (match_dup 2) (const_int 0)))]
3318 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3319 operands[1] = gen_rtx (COMPARE, mode,
3320 rs6000_compare_op0, rs6000_compare_op1);
3321 operands[2] = gen_reg_rtx (mode);
3324 ;; A <= 0 is best done the portable way for A an integer.
3325 (define_expand "sle"
3326 [(set (match_dup 2) (match_dup 1))
3327 (set (match_operand:SI 0 "gpc_reg_operand" "")
3328 (le:SI (match_dup 2) (const_int 0)))]
3331 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
3333 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
3336 operands[1] = gen_rtx (COMPARE, mode,
3337 rs6000_compare_op0, rs6000_compare_op1);
3338 operands[2] = gen_reg_rtx (mode);
3341 (define_expand "sgtu"
3342 [(set (match_dup 2) (match_dup 1))
3343 (set (match_operand:SI 0 "gpc_reg_operand" "")
3344 (gtu:SI (match_dup 2) (const_int 0)))]
3347 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3348 rs6000_compare_op0, rs6000_compare_op1);
3349 operands[2] = gen_reg_rtx (CCUNSmode);
3352 (define_expand "sltu"
3353 [(set (match_dup 2) (match_dup 1))
3354 (set (match_operand:SI 0 "gpc_reg_operand" "")
3355 (ltu:SI (match_dup 2) (const_int 0)))]
3358 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3359 rs6000_compare_op0, rs6000_compare_op1);
3360 operands[2] = gen_reg_rtx (CCUNSmode);
3363 (define_expand "sgeu"
3364 [(set (match_dup 2) (match_dup 1))
3365 (set (match_operand:SI 0 "gpc_reg_operand" "")
3366 (geu:SI (match_dup 2) (const_int 0)))]
3369 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3370 rs6000_compare_op0, rs6000_compare_op1);
3371 operands[2] = gen_reg_rtx (CCUNSmode);
3374 (define_expand "sleu"
3375 [(set (match_dup 2) (match_dup 1))
3376 (set (match_operand:SI 0 "gpc_reg_operand" "")
3377 (leu:SI (match_dup 2) (const_int 0)))]
3380 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
3381 rs6000_compare_op0, rs6000_compare_op1);
3382 operands[2] = gen_reg_rtx (CCUNSmode);
3385 ;; Here are the actual compare insns.
3387 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
3388 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
3389 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
3392 [(set_attr "type" "compare")])
3394 ;; If we are comparing a register for equality with a large constant,
3395 ;; we can do this with an XOR followed by a compare. But we need a scratch
3396 ;; register for the result of the XOR.
3399 [(set (match_operand:CC 0 "cc_reg_operand" "")
3400 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
3401 (match_operand:SI 2 "non_short_cint_operand" "")))
3402 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
3403 "find_single_use (operands[0], insn, 0)
3404 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
3405 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
3406 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
3407 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
3410 /* Get the constant we are comparing against, C, and see what it looks like
3411 sign-extended to 16 bits. Then see what constant could be XOR'ed
3412 with C to get the sign-extended value. */
3414 int c = INTVAL (operands[2]);
3415 int sextc = (c << 16) >> 16;
3416 int xorv = c ^ sextc;
3418 operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
3419 operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
3423 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
3424 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
3425 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
3428 [(set_attr "type" "compare")])
3430 ;; The following two insns don't exist as single insns, but if we provide
3431 ;; them, we can swap an add and compare, which will enable us to overlap more
3432 ;; of the required delay between a compare and branch. We generate code for
3433 ;; them by splitting.
3436 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
3437 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
3438 (match_operand:SI 2 "short_cint_operand" "i")))
3439 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3440 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
3445 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
3446 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
3447 (match_operand:SI 2 "u_short_cint_operand" "i")))
3448 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3449 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
3454 [(set (match_operand:CC 3 "cc_reg_operand" "")
3455 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
3456 (match_operand:SI 2 "short_cint_operand" "")))
3457 (set (match_operand:SI 0 "gpc_reg_operand" "")
3458 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
3460 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
3461 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
3464 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
3465 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
3466 (match_operand:SI 2 "u_short_cint_operand" "")))
3467 (set (match_operand:SI 0 "gpc_reg_operand" "")
3468 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
3470 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
3471 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
3474 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
3475 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
3476 (match_operand:SF 2 "gpc_reg_operand" "f")))]
3479 [(set_attr "type" "fpcompare")])
3482 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
3483 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
3484 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3487 [(set_attr "type" "fpcompare")])
3489 ;; Now we have the scc insns. We can do some combinations because of the
3490 ;; way the machine works.
3492 ;; Note that this is probably faster if we can put an insn between the
3493 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
3494 ;; cases the insns below which don't use an intermediate CR field will
3497 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3498 (match_operator:SI 1 "scc_comparison_operator"
3499 [(match_operand 2 "cc_reg_operand" "y")
3502 "%D1mfcr %0\;rlinm %0,%0,%J1,31,31")
3505 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3506 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
3507 [(match_operand 2 "cc_reg_operand" "y")
3510 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
3511 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
3513 "%D1mfcr %3\;rlinm. %3,%3,%J1,30,31"
3514 [(set_attr "type" "delayed_compare")])
3517 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3518 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
3519 [(match_operand 2 "cc_reg_operand" "y")
3521 (match_operand:SI 3 "const_int_operand" "n")))]
3525 int is_bit = ccr_bit (operands[1], 1);
3526 int put_bit = 31 - (INTVAL (operands[3]) & 31);
3529 if (is_bit >= put_bit)
3530 count = is_bit - put_bit;
3532 count = 32 - (put_bit - is_bit);
3534 operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
3535 operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
3537 return \"%D1mfcr %0\;rlinm %0,%0,%4,%5,%5\";
3541 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3543 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
3544 [(match_operand 2 "cc_reg_operand" "y")
3546 (match_operand:SI 3 "const_int_operand" "n"))
3548 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
3549 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
3554 int is_bit = ccr_bit (operands[1], 1);
3555 int put_bit = 31 - (INTVAL (operands[3]) & 31);
3558 if (is_bit >= put_bit)
3559 count = is_bit - put_bit;
3561 count = 32 - (put_bit - is_bit);
3563 operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
3564 operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
3566 return \"%D1mfcr %4\;rlinm. %4,%4,%5,%6,%6\";
3568 [(set_attr "type" "delayed_compare")])
3570 ;; If we are comparing the result of two comparisons, this can be done
3571 ;; using creqv or crxor.
3574 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
3575 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
3576 [(match_operand 2 "cc_reg_operand" "y")
3578 (match_operator 3 "scc_comparison_operator"
3579 [(match_operand 4 "cc_reg_operand" "y")
3581 "REGNO (operands[2]) != REGNO (operands[4])"
3584 enum rtx_code code1, code2;
3586 code1 = GET_CODE (operands[1]);
3587 code2 = GET_CODE (operands[3]);
3589 if ((code1 == EQ || code1 == LT || code1 == GT
3590 || code1 == LTU || code1 == GTU
3591 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
3593 (code2 == EQ || code2 == LT || code2 == GT
3594 || code2 == LTU || code2 == GTU
3595 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
3596 return \"%C1%C3crxor %E0,%j1,%j3\";
3598 return \"%C1%C3creqv %E0,%j1,%j3\";
3601 ;; There is a 3 cycle delay between consecutive mfcr instructions
3602 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
3605 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3606 (match_operator:SI 1 "scc_comparison_operator"
3607 [(match_operand 2 "cc_reg_operand" "y")
3609 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
3610 (match_operator:SI 4 "scc_comparison_operator"
3611 [(match_operand 5 "cc_reg_operand" "y")
3613 "REGNO (operands[2]) != REGNO (operands[5])"
3614 "%D1%D4mfcr %3\;rlinm %0,%3,%J1,31,31\;rlinm %3,%3,%J4,31,31")
3616 ;; There are some scc insns that can be done directly, without a compare.
3617 ;; These are faster because they don't involve the communications between
3618 ;; the FXU and branch units. In fact, we will be replacing all of the
3619 ;; integer scc insns here or in the portable methods in emit_store_flag.
3621 ;; Also support (neg (scc ..)) since that construct is used to replace
3622 ;; branches, (plus (scc ..) ..) since that construct is common and
3623 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
3624 ;; cases where it is no more expensive than (neg (scc ..)).
3626 ;; Have reload force a constant into a register for the simple insns that
3627 ;; otherwise won't accept constants. We do this because it is faster than
3628 ;; the cmp/mfcr sequence we would otherwise generate.
3631 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3632 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3633 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
3634 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
3637 xor %0,%1,%2\;sfi %3,%0,0\;ae %0,%3,%0
3638 sfi %3,%1,0\;ae %0,%3,%1
3639 xoril %0,%1,%b2\;sfi %3,%0,0\;ae %0,%3,%0
3640 xoriu %0,%1,%u2\;sfi %3,%0,0\;ae %0,%3,%0
3641 sfi %0,%1,%2\;sfi %3,%0,0\;ae %0,%3,%0")
3644 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
3646 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3647 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
3649 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3650 (eq:SI (match_dup 1) (match_dup 2)))
3651 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
3654 xor %0,%1,%2\;sfi %3,%0,0\;ae. %0,%3,%0
3655 sfi %3,%1,0\;ae. %0,%3,%1
3656 xoril %0,%1,%b2\;sfi %3,%0,0\;ae. %0,%3,%0
3657 xoriu %0,%1,%u2\;sfi %3,%0,0\;ae. %0,%3,%0
3658 sfi %0,%1,%2\;sfi %3,%0,0\;ae. %0,%3,%0"
3659 [(set_attr "type" "compare")])
3662 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3663 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3664 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
3665 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
3666 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
3669 xor %4,%1,%2\;sfi %4,%4,0\;aze %0,%3
3670 sfi %4,%1,0\;aze %0,%3
3671 xoril %4,%1,%b2\;sfi %4,%4,0\;aze %0,%3
3672 xoriu %4,%1,%u2\;sfi %4,%4,0\;aze %0,%3
3673 sfi %4,%1,%2\;sfi %4,%4,0\;aze %0,%3")
3676 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
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 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
3683 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
3686 xor %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3
3687 sfi %4,%1,0\;aze. %0,%3
3688 xoril %4,%1,%b2\;sfi %4,%4,0\;aze. %4,%3
3689 xoriu %4,%1,%u2\;sfi %4,%4,0\;aze. %4,%3
3690 sfi %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3"
3691 [(set_attr "type" "compare")])
3694 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
3697 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
3698 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
3699 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
3701 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3702 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3703 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
3706 xor %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3
3707 sfi %4,%1,0\;aze. %4,%3
3708 xoril %4,%1,%b2\;sfi %4,%4,0\;aze. %0,%3
3709 xoriu %4,%1,%u2\;sfi %4,%4,0\;aze. %0,%3
3710 sfi %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3"
3711 [(set_attr "type" "compare")])
3714 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
3715 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r")
3716 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
3719 xor %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0
3720 ai %0,%1,-1\;sfe %0,%0,%0
3721 xoril %0,%1,%b2\;ai %0,%0,-1\;sfe %0,%0,%0
3722 xoriu %0,%1,%u2\;ai %0,%0,-1\;sfe %0,%0,%0
3723 sfi %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0")
3725 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
3727 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3728 (plus:SI (lshiftrt:SI
3729 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
3731 (match_operand:SI 2 "gpc_reg_operand" "r")))
3732 (clobber (match_scratch:SI 3 "=&r"))]
3734 "ai %3,%1,-1\;aze %0,%2")
3737 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3739 (plus:SI (lshiftrt:SI
3740 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
3742 (match_operand:SI 2 "gpc_reg_operand" "r"))
3744 (clobber (match_scratch:SI 3 "=&r"))]
3746 "ai %3,%1,-1\;aze. %3,%2"
3747 [(set_attr "type" "compare")])
3750 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
3752 (plus:SI (lshiftrt:SI
3753 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
3755 (match_operand:SI 2 "gpc_reg_operand" "r"))
3757 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3758 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
3760 (clobber (match_scratch:SI 3 "=&r"))]
3762 "ai %3,%1,-1\;aze. %0,%2"
3763 [(set_attr "type" "compare")])
3766 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3767 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3768 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
3769 (clobber (match_scratch:SI 3 "=r,X"))]
3772 doz %3,%2,%1\;sfi %0,%3,0\;ae %0,%0,%3
3773 ai %0,%1,-1\;aze %0,%0\;sri %0,%0,31")
3776 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
3778 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3779 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
3781 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3782 (le:SI (match_dup 1) (match_dup 2)))
3783 (clobber (match_scratch:SI 3 "=r,X"))]
3786 doz %3,%2,%1\;sfi %0,%3,0\;ae. %0,%0,%3
3787 ai %0,%1,-1\;aze %0,%0\;sri. %0,%0,31"
3788 [(set_attr "type" "delayed_compare,compare")])
3791 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3792 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3793 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
3794 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
3795 (clobber (match_scratch:SI 4 "=&r,&r"))]
3798 doz %4,%2,%1\;sfi %4,%4,0\;aze %0,%3
3799 srai %4,%1,31\;sf %4,%1,%4\;aze %0,%3")
3802 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
3804 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3805 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
3806 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3808 (clobber (match_scratch:SI 4 "=&r,&r"))]
3811 doz %4,%2,%1\;sfi %4,%4,0\;aze. %4,%3
3812 srai %4,%1,31\;sf %4,%1,%4\;aze. %4,%3"
3813 [(set_attr "type" "compare")])
3816 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
3818 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3819 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
3820 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
3822 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3823 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3824 (clobber (match_scratch:SI 4 "=&r,&r"))]
3827 doz %4,%2,%1\;sfi %4,%4,0\;aze. %0,%3
3828 srai %4,%1,31\;sf %4,%1,%4\;aze. %0,%3"
3829 [(set_attr "type" "compare")])
3832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3833 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3834 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
3837 doz %0,%2,%1\;ai %0,%0,-1\;sfe %0,%0,%0
3838 ai %0,%1,-1\;aze %0,%0\;srai %0,%0,31")
3841 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3842 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3843 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
3845 "sf%I2 %0,%1,%2\;cal %0,0(0)\;ae %0,%0,%0")
3848 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
3850 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3851 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3853 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3854 (leu:SI (match_dup 1) (match_dup 2)))]
3856 "sf%I2 %0,%1,%2\;cal %0,0(0)\;ae. %0,%0,%0"
3857 [(set_attr "type" "compare")])
3860 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3861 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3862 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3863 (match_operand:SI 3 "gpc_reg_operand" "r")))
3864 (clobber (match_scratch:SI 4 "=&r"))]
3866 "sf%I2 %4,%1,%2\;aze %0,%3")
3869 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3871 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3872 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3873 (match_operand:SI 3 "gpc_reg_operand" "r"))
3875 (clobber (match_scratch:SI 4 "=&r"))]
3877 "sf%I2 %4,%1,%2\;aze. %4,%3"
3878 [(set_attr "type" "compare")])
3881 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
3883 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3884 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3885 (match_operand:SI 3 "gpc_reg_operand" "r"))
3887 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3888 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3889 (clobber (match_scratch:SI 4 "=&r"))]
3891 "sf%I2 %4,%1,%2\;aze. %0,%3"
3892 [(set_attr "type" "compare")])
3895 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3896 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3897 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
3899 "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;nand %0,%0,%0")
3902 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3904 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3905 (match_operand:SI 2 "reg_or_short_operand" "rI")))
3906 (match_operand:SI 3 "gpc_reg_operand" "r")))
3907 (clobber (match_scratch:SI 4 "=&r"))]
3909 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc %0,%3,%4")
3912 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3915 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3916 (match_operand:SI 2 "reg_or_short_operand" "rI")))
3917 (match_operand:SI 3 "gpc_reg_operand" "r"))
3919 (clobber (match_scratch:SI 4 "=&r"))]
3921 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc. %4,%3,%4"
3922 [(set_attr "type" "compare")])
3925 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
3928 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3929 (match_operand:SI 2 "reg_or_short_operand" "rI")))
3930 (match_operand:SI 3 "gpc_reg_operand" "r"))
3932 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3933 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
3934 (clobber (match_scratch:SI 4 "=&r"))]
3936 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;andc. %0,%3,%4"
3937 [(set_attr "type" "compare")])
3940 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3941 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3942 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
3944 "doz%I2 %0,%1,%2\;nabs %0,%0\;sri %0,%0,31")
3947 [(set (match_operand:SI 3 "cc_reg_operand" "=x")
3949 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3950 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3952 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3953 (lt:SI (match_dup 1) (match_dup 2)))]
3955 "doz%I2 %0,%1,%2\;nabs %0,%0\;sri. %0,%0,31"
3956 [(set_attr "type" "delayed_compare")])
3959 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3960 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3961 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3962 (match_operand:SI 3 "gpc_reg_operand" "r")))
3963 (clobber (match_scratch:SI 4 "=&r"))]
3965 "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze %0,%3")
3968 [(set (match_operand:SI 0 "cc_reg_operand" "=x")
3970 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3971 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3972 (match_operand:SI 3 "gpc_reg_operand" "r"))
3974 (clobber (match_scratch:SI 4 "=&r"))]
3976 "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze. %4,%3"
3977 [(set_attr "type" "compare")])
3980 [(set (match_operand:SI 5 "cc_reg_operand" "=x")
3982 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3983 (match_operand:SI 2 "reg_or_short_operand" "rI"))
3984 (match_operand:SI 3 "gpc_reg_operand" "r"))
3986 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
3987 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3988 (clobber (match_scratch:SI 4 "=&r"))]
3990 "doz%I2 %4,%1,%2\;ai %4,%4,-1\;aze. %0,%3"
3991 [(set_attr "type" "compare")])
3994 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3995 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3996 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
3998 "doz%I2 %0,%1,%2\;nabs %0,%0\;srai %0,%0,31")
4001 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4002 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4003 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
4006 sf %0,%2,%1\;sfe %0,%0,%0\;neg %0,%0
4007 ai %0,%1,%n2\;sfe %0,%0,%0\;neg %0,%0")
4010 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
4012 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4013 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4015 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4016 (ltu:SI (match_dup 1) (match_dup 2)))]
4019 sf %0,%2,%1\;sfe %0,%0,%0\;neg. %0,%0
4020 ai %0,%1,%n2\;sfe %0,%0,%0\;neg. %0,%0"
4021 [(set_attr "type" "compare")])
4024 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4025 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4026 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
4027 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
4028 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
4031 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
4032 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
4033 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3
4034 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3")
4037 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
4039 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4040 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
4041 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I"))
4043 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
4046 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
4047 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
4048 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3
4049 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3"
4050 [(set_attr "type" "compare")])
4053 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x")
4055 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4056 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
4057 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I"))
4059 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4060 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4061 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
4064 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
4065 sf %4,%2,%1\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
4066 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3
4067 ai %4,%1,%n2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3"
4068 [(set_attr "type" "compare")])
4071 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4072 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4073 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
4076 sf %0,%2,%1\;sfe %0,%0,%0
4077 ai %0,%1,%n2\;sfe %0,%0,%0")
4080 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4081 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4082 (match_operand:SI 2 "reg_or_short_operand" "rI")))
4083 (clobber (match_scratch:SI 3 "=r"))]
4085 "doz%I2 %3,%1,%2\;sfi %0,%3,0\;ae %0,%0,%3")
4088 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
4090 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4091 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4093 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4094 (ge:SI (match_dup 1) (match_dup 2)))
4095 (clobber (match_scratch:SI 3 "=r"))]
4097 "doz%I2 %3,%1,%2\;sfi %0,%3,0\;ae. %0,%0,%3"
4098 [(set_attr "type" "compare")])
4101 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4102 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4103 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4104 (match_operand:SI 3 "gpc_reg_operand" "r")))
4105 (clobber (match_scratch:SI 4 "=&r"))]
4107 "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze %0,%3")
4110 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4112 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4113 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4114 (match_operand:SI 3 "gpc_reg_operand" "r"))
4116 (clobber (match_scratch:SI 4 "=&r"))]
4118 "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze. %4,%3"
4119 [(set_attr "type" "compare")])
4122 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
4124 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4125 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4126 (match_operand:SI 3 "gpc_reg_operand" "r"))
4128 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4129 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4130 (clobber (match_scratch:SI 4 "=&r"))]
4132 "doz%I2 %4,%1,%2\;sfi %4,%4,0\;aze. %0,%3"
4133 [(set_attr "type" "compare")])
4136 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4137 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4138 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
4140 "doz%I2 %0,%1,%2\;ai %0,%0,-1\;sfe %0,%0,%0")
4142 ;; This is (and (neg (ge X (const_int 0))) Y).
4144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4147 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
4149 (match_operand:SI 2 "gpc_reg_operand" "r")))
4150 (clobber (match_scratch:SI 3 "=&r"))]
4152 "srai %3,%1,31\;andc %0,%2,%3")
4155 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4159 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
4161 (match_operand:SI 2 "gpc_reg_operand" "r"))
4163 (clobber (match_scratch:SI 3 "=&r"))]
4165 "srai %3,%1,31\;andc. %3,%2,%3"
4166 [(set_attr "type" "compare")])
4169 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
4173 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
4175 (match_operand:SI 2 "gpc_reg_operand" "r"))
4177 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4178 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
4181 (clobber (match_scratch:SI 3 "=&r"))]
4183 "srai %3,%1,31\;andc. %0,%2,%3"
4184 [(set_attr "type" "compare")])
4187 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4188 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4189 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
4192 sf %0,%2,%1\;cal %0,0(0)\;ae %0,%0,%0
4193 ai %0,%1,%n2\;cal %0,0(0)\;ae %0,%0,%0")
4196 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
4198 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4199 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4201 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4202 (geu:SI (match_dup 1) (match_dup 2)))]
4205 sf %0,%2,%1\;cal %0,0(0)\;ae. %0,%0,%0
4206 ai %0,%1,%n2\;cal %0,0(0)\;ae. %0,%0,%0"
4207 [(set_attr "type" "compare")])
4210 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4211 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4212 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4213 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
4214 (clobber (match_scratch:SI 4 "=&r,&r"))]
4217 sf %4,%2,%1\;aze %0,%3
4218 ai %4,%1,%n2\;aze %0,%3")
4221 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
4223 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4224 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4225 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4227 (clobber (match_scratch:SI 4 "=&r,&r"))]
4230 sf %4,%2,%1\;aze. %4,%3
4231 ai %4,%1,%n2\;aze. %4,%3"
4232 [(set_attr "type" "compare")])
4235 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
4237 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4238 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
4239 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4241 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4242 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4243 (clobber (match_scratch:SI 4 "=&r,&r"))]
4246 sf %4,%2,%1\;aze. %0,%3
4247 ai %4,%1,%n2\;aze. %4,%3"
4248 [(set_attr "type" "compare")])
4251 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4252 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4253 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
4256 sf %0,%2,%1\;sfe %0,%0,%0\;nand %0,%0,%0
4257 sfi %0,%1,-1\;a%I2 %0,%0,%2\;sfe %0,%0,%0")
4260 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4262 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4263 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
4264 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
4265 (clobber (match_scratch:SI 4 "=&r,&r"))]
4268 sf %4,%2,%1\;sfe %4,%4,%4\;andc %0,%3,%4
4269 ai %4,%1,%n2\;sfe %4,%4,%4\;andc %0,%3,%4")
4272 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
4275 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4276 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
4277 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4279 (clobber (match_scratch:SI 4 "=&r,&r"))]
4282 sf %4,%2,%1\;sfe %4,%4,%4\;andc. %4,%3,%4
4283 ai %4,%1,%n2\;sfe %4,%4,%4\;andc. %4,%3,%4"
4284 [(set_attr "type" "compare")])
4287 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
4290 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4291 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
4292 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
4294 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4295 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
4296 (clobber (match_scratch:SI 4 "=&r,&r"))]
4299 sf %4,%2,%1\;sfe %4,%4,%4\;andc. %0,%3,%4
4300 ai %4,%1,%n2\;sfe %4,%4,%4\;andc. %0,%3,%4"
4301 [(set_attr "type" "compare")])
4304 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4305 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4308 "sfi %0,%1,0\;ame %0,%0\;sri %0,%0,31")
4311 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
4313 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4316 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4317 (gt:SI (match_dup 1) (const_int 0)))]
4319 "sfi %0,%1,0\;ame %0,%0\;sri. %0,%0,31"
4320 [(set_attr "type" "delayed_compare")])
4323 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4324 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4325 (match_operand:SI 2 "reg_or_short_operand" "r")))]
4327 "doz %0,%2,%1\;nabs %0,%0\;sri %0,%0,31")
4330 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4332 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4333 (match_operand:SI 2 "reg_or_short_operand" "r"))
4335 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4336 (gt:SI (match_dup 1) (match_dup 2)))]
4338 "doz %0,%2,%1\;nabs %0,%0\;sri. %0,%0,31"
4339 [(set_attr "type" "delayed_compare")])
4342 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4343 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4345 (match_operand:SI 2 "gpc_reg_operand" "r")))
4346 (clobber (match_scratch:SI 3 "=&r"))]
4348 "a %3,%1,%1\;sfe %3,%1,%3\;aze %0,%2")
4351 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4353 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4355 (match_operand:SI 2 "gpc_reg_operand" "r"))
4357 (clobber (match_scratch:SI 3 "=&r"))]
4359 "a %3,%1,%1\;sfe %3,%1,%3\;aze. %0,%2"
4360 [(set_attr "type" "compare")])
4363 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
4365 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4367 (match_operand:SI 2 "gpc_reg_operand" "r"))
4369 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4370 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
4371 (clobber (match_scratch:SI 3 "=&r"))]
4373 "a %3,%1,%1\;sfe %3,%1,%3\;aze. %3,%2"
4374 [(set_attr "type" "compare")])
4377 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4378 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4379 (match_operand:SI 2 "reg_or_short_operand" "r"))
4380 (match_operand:SI 3 "gpc_reg_operand" "r")))
4381 (clobber (match_scratch:SI 4 "=&r"))]
4383 "doz %4,%2,%1\;ai %4,%4,-1\;aze %0,%3")
4386 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
4388 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4389 (match_operand:SI 2 "reg_or_short_operand" "r"))
4390 (match_operand:SI 3 "gpc_reg_operand" "r"))
4392 (clobber (match_scratch:SI 4 "=&r"))]
4394 "doz %4,%2,%1\;ai %4,%4,-1\;aze. %4,%3"
4395 [(set_attr "type" "compare")])
4398 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
4400 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4401 (match_operand:SI 2 "reg_or_short_operand" "r"))
4402 (match_operand:SI 3 "gpc_reg_operand" "r"))
4404 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4405 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4406 (clobber (match_scratch:SI 4 "=&r"))]
4408 "doz %4,%2,%1\;ai %4,%4,-1\;aze. %0,%3"
4409 [(set_attr "type" "compare")])
4412 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4413 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4416 "sfi %0,%1,0\;ame %0,%0\;srai %0,%0,31")
4419 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4420 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4421 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
4423 "doz %0,%2,%1\;nabs %0,%0\;srai %0,%0,31")
4426 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4427 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4428 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
4430 "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;neg %0,%0")
4433 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
4435 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4436 (match_operand:SI 2 "reg_or_short_operand" "rI"))
4438 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
4439 (gtu:SI (match_dup 1) (match_dup 2)))]
4441 "sf%I2 %0,%1,%2\;sfe %0,%0,%0\;neg. %0,%0"
4442 [(set_attr "type" "compare")])
4445 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4446 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4447 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
4448 (match_operand:SI 3 "reg_or_short_operand" "r,I")))
4449 (clobber (match_scratch:SI 4 "=&r,&r"))]
4451 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3 %0,%4,%3")
4454 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
4456 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4457 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
4458 (match_operand:SI 3 "reg_or_short_operand" "r,I"))
4460 (clobber (match_scratch:SI 4 "=&r,&r"))]
4462 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %4,%4,%3"
4463 [(set_attr "type" "compare")])
4466 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
4468 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4469 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
4470 (match_operand:SI 3 "reg_or_short_operand" "r,I"))
4472 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4473 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4474 (clobber (match_scratch:SI 4 "=&r,&r"))]
4476 "sf%I2 %4,%1,%2\;sfe %4,%4,%4\;sf%I3. %0,%4,%3"
4477 [(set_attr "type" "compare")])
4480 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4481 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4482 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
4484 "sf%I2 %0,%1,%2\;sfe %0,%0,%0")
4486 ;; Define both directions of branch and return. If we need a reload
4487 ;; register, we'd rather use CR0 since it is much easier to copy a
4488 ;; register CC value to there.
4492 (if_then_else (match_operator 1 "branch_comparison_operator"
4494 "cc_reg_operand" "x,?y")
4496 (label_ref (match_operand 0 "" ""))
4503 (if_then_else (match_operator 0 "branch_comparison_operator"
4505 "cc_reg_operand" "x,?y")
4514 (if_then_else (match_operator 1 "branch_comparison_operator"
4516 "cc_reg_operand" "x,?y")
4519 (label_ref (match_operand 0 "" ""))))]
4525 (if_then_else (match_operator 0 "branch_comparison_operator"
4527 "cc_reg_operand" "x,?y")
4534 ;; Unconditional branch and return.
4538 (label_ref (match_operand 0 "" "")))]
4542 (define_insn "return"
4547 (define_insn "indirect_jump"
4548 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
4554 ;; Table jump for switch statements:
4555 (define_expand "tablejump"
4557 (plus:SI (match_operand:SI 0 "" "")
4559 (parallel [(set (pc) (match_dup 3))
4560 (use (label_ref (match_operand 1 "" "")))])]
4563 { operands[0] = force_reg (SImode, operands[0]);
4564 operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
4565 operands[3] = gen_reg_rtx (SImode);
4570 (match_operand:SI 0 "register_operand" "c,l"))
4571 (use (label_ref (match_operand 1 "" "")))]
4582 ;; Define the subtract-one-and-jump insns.
4583 ;; We need to be able to do this for any operand, including MEM, or we
4584 ;; will cause reload to blow up since we don't allow output reloads on
4588 (if_then_else (ne (match_operand:SI 1 "register_operand" "0,*r,*r")
4590 (label_ref (match_operand 2 "" ""))
4592 (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
4593 (plus:SI (match_dup 1) (const_int -1)))
4594 (clobber (match_scratch:CC 3 "=X,&x,&x"))
4595 (clobber (match_scratch:SI 4 "=X,X,r"))]
4602 ;; Similar, but we can use GE since we have a REG_NOTES.
4605 (if_then_else (ge (match_operand:SI 1 "register_operand" "0,*r,*r")
4607 (label_ref (match_operand 2 "" ""))
4609 (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
4610 (plus:SI (match_dup 1) (const_int -1)))
4611 (clobber (match_scratch:CC 3 "=X,&x,&X"))
4612 (clobber (match_scratch:SI 4 "=X,X,r"))]
4613 "find_reg_note (insn, REG_NONNEG, 0)"
4621 (if_then_else (eq (match_operand:SI 1 "register_operand" "0,*r,*r")
4623 (label_ref (match_operand 2 "" ""))
4625 (set (match_operand:SI 0 "register_operand" "=c,*r,m*q*c*l")
4626 (plus:SI (match_dup 1) (const_int -1)))
4627 (clobber (match_scratch:CC 3 "=X,&x,&x"))
4628 (clobber (match_scratch:SI 4 "=X,X,r"))]
4637 (if_then_else (match_operator 2 "comparison_operator"
4638 [(match_operand:SI 1 "gpc_reg_operand" "")
4640 (match_operand 5 "" "")
4641 (match_operand 6 "" "")))
4642 (set (match_operand:SI 0 "gpc_reg_operand" "")
4643 (plus:SI (match_dup 1) (const_int -1)))
4644 (clobber (match_scratch:CC 3 ""))
4645 (clobber (match_scratch:SI 4 ""))]
4647 [(parallel [(set (match_dup 3)
4648 (compare:CC (plus:SI (match_dup 1) (const_int -1))
4650 (set (match_dup 0) (plus:SI (match_dup 1) (const_int -1)))])
4651 (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
4653 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
4658 (if_then_else (match_operator 2 "comparison_operator"
4659 [(match_operand:SI 1 "gpc_reg_operand" "")
4661 (match_operand 5 "" "")
4662 (match_operand 6 "" "")))
4663 (set (match_operand:SI 0 "general_operand" "")
4664 (plus:SI (match_dup 1) (const_int -1)))
4665 (clobber (match_scratch:CC 3 ""))
4666 (clobber (match_scratch:SI 4 ""))]
4667 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
4668 [(parallel [(set (match_dup 3)
4669 (compare:CC (plus:SI (match_dup 1) (const_int -1))
4671 (set (match_dup 4) (plus:SI (match_dup 1) (const_int -1)))])
4672 (set (match_dup 0) (match_dup 4))
4673 (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
4675 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
4678 ;;- Local variables:
4680 ;;- comment-start: ";;- "
4681 ;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
4682 ;;- eval: (modify-syntax-entry ?[ "(]")
4683 ;;- eval: (modify-syntax-entry ?] ")[")
4684 ;;- eval: (modify-syntax-entry ?{ "(}")
4685 ;;- eval: (modify-syntax-entry ?} "){")