1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.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" "integer,load,fpload,imul,idiv,branch,compare,delayed_compare,fpcompare,mtjmpr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg"
26 (const_string "integer"))
29 (define_attr "length" ""
30 (if_then_else (eq_attr "type" "branch")
31 (if_then_else (and (ge (minus (pc) (match_dup 0))
33 (lt (minus (pc) (match_dup 0))
39 ;; Processor type -- this attribute must exactly match the processor_type
40 ;; enumeration in rs6000.h.
42 (define_attr "cpu" "rios1,rios2,ppc403,ppc601,ppc603,ppc604,ppc620"
43 (const (symbol_ref "rs6000_cpu_attr")))
45 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
46 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
48 ; Load/Store Unit -- POWER/2 and pure PowerPC only
49 ; (POWER and 601 use Integer Unit)
50 (define_function_unit "lsu" 1 0
51 (and (eq_attr "type" "load")
52 (eq_attr "cpu" "rios2,ppc603,ppc604,ppc620"))
55 (define_function_unit "lsu" 1 0
56 (and (eq_attr "type" "fpload")
57 (eq_attr "cpu" "rios2,ppc603,ppc604,ppc620"))
60 (define_function_unit "iu" 1 0
61 (and (eq_attr "type" "load")
62 (eq_attr "cpu" "rios1,ppc403,ppc601"))
65 (define_function_unit "iu" 1 0
66 (and (eq_attr "type" "fpload")
67 (eq_attr "cpu" "rios1,ppc601"))
70 ; Integer Unit (RIOS1, PPC601, PPC603)
71 ; Trivial operations take one cycle which need not be listed here.
72 (define_function_unit "iu" 1 0
73 (and (eq_attr "type" "imul")
74 (eq_attr "cpu" "rios1"))
77 (define_function_unit "iu" 1 0
78 (and (eq_attr "type" "imul")
79 (eq_attr "cpu" "ppc403"))
82 (define_function_unit "iu" 1 0
83 (and (eq_attr "type" "imul")
84 (eq_attr "cpu" "ppc601,ppc603"))
87 (define_function_unit "iu" 1 0
88 (and (eq_attr "type" "idiv")
89 (eq_attr "cpu" "rios1"))
92 (define_function_unit "iu" 1 0
93 (and (eq_attr "type" "idiv")
94 (eq_attr "cpu" "ppc403"))
97 (define_function_unit "iu" 1 0
98 (and (eq_attr "type" "idiv")
99 (eq_attr "cpu" "ppc601"))
102 (define_function_unit "iu" 1 0
103 (and (eq_attr "type" "idiv")
104 (eq_attr "cpu" "ppc603"))
107 ; RIOS2 has two integer units: a primary one which can perform all
108 ; operations and a secondary one which is fed in lock step with the first
109 ; and can perform "simple" integer operations.
110 (define_function_unit "iu2" 2 0
111 (and (eq_attr "type" "integer")
112 (eq_attr "cpu" "rios2"))
114 [(eq_attr "type" "imul,idiv")])
116 (define_function_unit "imuldiv" 1 0
117 (and (eq_attr "type" "imul")
118 (eq_attr "cpu" "rios2"))
120 [(eq_attr "type" "integer")])
122 (define_function_unit "imuldiv" 1 0
123 (and (eq_attr "type" "idiv")
124 (eq_attr "cpu" "rios2"))
126 [(eq_attr "type" "integer")])
128 ; PPC604 has three integer units: one primary and two secondary.
129 (define_function_unit "iu3" 3 0
130 (and (eq_attr "type" "integer")
131 (eq_attr "cpu" "ppc604,ppc620"))
133 [(eq_attr "type" "imul,idiv")])
135 (define_function_unit "imuldiv" 1 0
136 (and (eq_attr "type" "imul")
137 (eq_attr "cpu" "ppc604,ppc620"))
139 [(eq_attr "type" "integer")])
141 (define_function_unit "imuldiv" 1 0
142 (and (eq_attr "type" "idiv")
143 (eq_attr "cpu" "ppc604,ppc620"))
145 [(eq_attr "type" "integer")])
147 ; Branch Processing Unit
148 (define_function_unit "bpu" 1 0
149 (eq_attr "type" "compare")
152 (define_function_unit "bpu" 1 0
153 (eq_attr "type" "delayed_compare")
156 (define_function_unit "bpu" 1 0
157 (and (eq_attr "type" "fpcompare")
158 (eq_attr "cpu" "rios1,rios2"))
161 (define_function_unit "bpu" 1 0
162 (and (eq_attr "type" "fpcompare")
163 (eq_attr "cpu" "ppc601,ppc603,ppc604,ppc620"))
166 (define_function_unit "bpu" 1 0
167 (and (eq_attr "type" "mtjmpr")
168 (eq_attr "cpu" "rios1,rios2"))
171 (define_function_unit "bpu" 1 0
172 (and (eq_attr "type" "mtjmpr")
173 (eq_attr "cpu" "ppc403,ppc601,ppc603,ppc604,ppc620"))
176 ; Floating Point Unit (RIOS1, PPC601, PPC603, PPC604).
177 (define_function_unit "fpu" 1 0
178 (and (eq_attr "type" "fp,dmul")
179 (eq_attr "cpu" "rios1"))
182 (define_function_unit "fpu" 1 0
183 (and (eq_attr "type" "fp")
184 (eq_attr "cpu" "ppc601"))
187 (define_function_unit "fpu" 1 0
188 (and (eq_attr "type" "fp")
189 (eq_attr "cpu" "ppc603,ppc604,ppc620"))
192 (define_function_unit "fpu" 1 0
193 (and (eq_attr "type" "dmul")
194 (eq_attr "cpu" "ppc601"))
197 (define_function_unit "fpu" 1 0
198 (and (eq_attr "type" "dmul")
199 (eq_attr "cpu" "ppc603"))
202 (define_function_unit "fpu" 1 0
203 (and (eq_attr "type" "dmul")
204 (eq_attr "cpu" "ppc604,ppc620"))
207 (define_function_unit "fpu" 1 0
208 (and (eq_attr "type" "sdiv,ddiv")
209 (eq_attr "cpu" "rios1"))
212 (define_function_unit "fpu" 1 0
213 (and (eq_attr "type" "sdiv")
214 (eq_attr "cpu" "ppc601"))
217 (define_function_unit "fpu" 1 0
218 (and (eq_attr "type" "sdiv")
219 (eq_attr "cpu" "ppc603,ppc604,ppc620"))
222 (define_function_unit "fpu" 1 0
223 (and (eq_attr "type" "ddiv")
224 (eq_attr "cpu" "ppc601,ppc604,ppc620"))
227 (define_function_unit "fpu" 1 0
228 (and (eq_attr "type" "ddiv")
229 (eq_attr "cpu" "ppc603"))
232 (define_function_unit "fpu" 1 0
233 (and (eq_attr "type" "ssqrt")
234 (eq_attr "cpu" "ppc620"))
237 (define_function_unit "fpu" 1 0
238 (and (eq_attr "type" "dsqrt")
239 (eq_attr "cpu" "ppc620"))
242 ; RIOS2 has two symmetric FPUs.
243 (define_function_unit "fpu2" 2 0
244 (and (eq_attr "type" "fp")
245 (eq_attr "cpu" "rios2"))
248 (define_function_unit "fpu2" 2 0
249 (and (eq_attr "type" "dmul")
250 (eq_attr "cpu" "rios2"))
253 (define_function_unit "fpu2" 2 0
254 (and (eq_attr "type" "sdiv,ddiv")
255 (eq_attr "cpu" "rios2"))
258 (define_function_unit "fpu2" 2 0
259 (and (eq_attr "type" "ssqrt,dsqrt")
260 (eq_attr "cpu" "rios2"))
263 ;; Start with fixed-point load and store insns. Here we put only the more
264 ;; complex forms. Basic data transfer is done later.
266 (define_expand "zero_extendqidi2"
267 [(set (match_operand:DI 0 "gpc_reg_operand" "")
268 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
273 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
274 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
279 [(set_attr "type" "load,*")])
282 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
283 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
285 (clobber (match_scratch:DI 2 "=r"))]
288 [(set_attr "type" "compare")])
291 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
292 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
294 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
295 (zero_extend:DI (match_dup 1)))]
298 [(set_attr "type" "compare")])
300 (define_insn "extendqidi2"
301 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
302 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
307 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
308 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
310 (clobber (match_scratch:DI 2 "=r"))]
313 [(set_attr "type" "compare")])
316 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
317 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r"))
319 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
320 (sign_extend:DI (match_dup 1)))]
323 [(set_attr "type" "compare")])
325 (define_expand "zero_extendhidi2"
326 [(set (match_operand:DI 0 "gpc_reg_operand" "")
327 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
332 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
333 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
338 [(set_attr "type" "load,*")])
341 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
342 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
344 (clobber (match_scratch:DI 2 "=r"))]
347 [(set_attr "type" "compare")])
350 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
351 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
353 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
354 (zero_extend:DI (match_dup 1)))]
357 [(set_attr "type" "compare")])
359 (define_expand "extendhidi2"
360 [(set (match_operand:DI 0 "gpc_reg_operand" "")
361 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
366 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
367 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
372 [(set_attr "type" "load,*")])
375 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
376 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
378 (clobber (match_scratch:DI 2 "=r"))]
381 [(set_attr "type" "compare")])
384 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
385 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r"))
387 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
388 (sign_extend:DI (match_dup 1)))]
391 [(set_attr "type" "compare")])
393 (define_expand "zero_extendsidi2"
394 [(set (match_operand:DI 0 "gpc_reg_operand" "")
395 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
400 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
401 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
406 [(set_attr "type" "load,*")])
409 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
410 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
412 (clobber (match_scratch:DI 2 "=r"))]
415 [(set_attr "type" "compare")])
418 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
419 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
421 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
422 (zero_extend:DI (match_dup 1)))]
425 [(set_attr "type" "compare")])
427 (define_expand "extendsidi2"
428 [(set (match_operand:DI 0 "gpc_reg_operand" "")
429 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
434 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
435 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
440 [(set_attr "type" "load,*")])
443 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
444 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
446 (clobber (match_scratch:DI 2 "=r"))]
449 [(set_attr "type" "compare")])
452 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
453 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
455 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
456 (sign_extend:DI (match_dup 1)))]
459 [(set_attr "type" "compare")])
461 (define_expand "zero_extendqisi2"
462 [(set (match_operand:SI 0 "gpc_reg_operand" "")
463 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
468 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
469 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
473 {rlinm|rlwinm} %0,%1,0,0xff"
474 [(set_attr "type" "load,*")])
477 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
478 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
480 (clobber (match_scratch:SI 2 "=r"))]
482 "{andil.|andi.} %2,%1,0xff"
483 [(set_attr "type" "compare")])
486 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
487 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
489 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
490 (zero_extend:SI (match_dup 1)))]
492 "{andil.|andi.} %0,%1,0xff"
493 [(set_attr "type" "compare")])
495 (define_expand "extendqisi2"
496 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
497 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
502 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
503 else if (TARGET_POWER)
504 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
506 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
510 (define_insn "extendqisi2_ppc"
511 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
512 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
517 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
518 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
520 (clobber (match_scratch:SI 2 "=r"))]
523 [(set_attr "type" "compare")])
526 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
527 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r"))
529 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
530 (sign_extend:SI (match_dup 1)))]
533 [(set_attr "type" "compare")])
535 (define_expand "extendqisi2_power"
536 [(parallel [(set (match_dup 2)
537 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
539 (clobber (scratch:SI))])
540 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
541 (ashiftrt:SI (match_dup 2)
543 (clobber (scratch:SI))])]
546 { operands[1] = gen_lowpart (SImode, operands[1]);
547 operands[2] = gen_reg_rtx (SImode); }")
549 (define_expand "extendqisi2_no_power"
551 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
553 (set (match_operand:SI 0 "gpc_reg_operand" "")
554 (ashiftrt:SI (match_dup 2)
556 "! TARGET_POWER && ! TARGET_POWERPC"
558 { operands[1] = gen_lowpart (SImode, operands[1]);
559 operands[2] = gen_reg_rtx (SImode); }")
561 (define_expand "zero_extendqihi2"
562 [(set (match_operand:HI 0 "gpc_reg_operand" "")
563 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
568 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
569 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
573 {rlinm|rlwinm} %0,%1,0,0xff"
574 [(set_attr "type" "load,*")])
577 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
578 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
580 (clobber (match_scratch:HI 2 "=r"))]
582 "{andil.|andi.} %2,%1,0xff"
583 [(set_attr "type" "compare")])
586 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
587 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
589 (set (match_operand:HI 0 "gpc_reg_operand" "=r")
590 (zero_extend:HI (match_dup 1)))]
592 "{andil.|andi.} %0,%1,0xff"
593 [(set_attr "type" "compare")])
595 (define_expand "extendqihi2"
596 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
597 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
602 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
603 else if (TARGET_POWER)
604 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
606 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
610 (define_insn "extendqihi2_ppc"
611 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
612 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
617 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
618 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
620 (clobber (match_scratch:HI 2 "=r"))]
623 [(set_attr "type" "compare")])
626 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
627 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r"))
629 (set (match_operand:HI 0 "gpc_reg_operand" "=r")
630 (sign_extend:HI (match_dup 1)))]
633 [(set_attr "type" "compare")])
635 (define_expand "extendqihi2_power"
636 [(parallel [(set (match_dup 2)
637 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
639 (clobber (scratch:SI))])
640 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
641 (ashiftrt:SI (match_dup 2)
643 (clobber (scratch:SI))])]
646 { operands[0] = gen_lowpart (SImode, operands[0]);
647 operands[1] = gen_lowpart (SImode, operands[1]);
648 operands[2] = gen_reg_rtx (SImode); }")
650 (define_expand "extendqihi2_no_power"
652 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
654 (set (match_operand:HI 0 "gpc_reg_operand" "")
655 (ashiftrt:SI (match_dup 2)
657 "! TARGET_POWER && ! TARGET_POWERPC"
659 { operands[0] = gen_lowpart (SImode, operands[0]);
660 operands[1] = gen_lowpart (SImode, operands[1]);
661 operands[2] = gen_reg_rtx (SImode); }")
663 (define_expand "zero_extendhisi2"
664 [(set (match_operand:SI 0 "gpc_reg_operand" "")
665 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
670 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
671 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
675 {rlinm|rlwinm} %0,%1,0,0xffff"
676 [(set_attr "type" "load,*")])
679 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
680 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
682 (clobber (match_scratch:SI 2 "=r"))]
684 "{andil.|andi.} %2,%1,0xffff"
685 [(set_attr "type" "compare")])
688 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
689 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
691 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
692 (zero_extend:SI (match_dup 1)))]
694 "{andil.|andi.} %0,%1,0xffff"
695 [(set_attr "type" "compare")])
697 (define_expand "extendhisi2"
698 [(set (match_operand:SI 0 "gpc_reg_operand" "")
699 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
704 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
705 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
710 [(set_attr "type" "load,*")])
713 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
714 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
716 (clobber (match_scratch:SI 2 "=r"))]
718 "{exts.|extsh.} %2,%1"
719 [(set_attr "type" "compare")])
722 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
723 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r"))
725 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
726 (sign_extend:SI (match_dup 1)))]
728 "{exts.|extsh.} %0,%1"
729 [(set_attr "type" "compare")])
731 ;; Fixed-point arithmetic insns.
733 ;; Discourage ai/addic because of carry but provide it in an alternative
734 ;; allowing register zero as source.
735 (define_insn "addsi3"
736 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
737 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
738 (match_operand:SI 2 "add_operand" "r,I,I,J")))]
742 {cal %0,%2(%1)|addi %0,%1,%2}
744 {cau|addis} %0,%1,%u2")
747 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
748 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
749 (match_operand:SI 2 "reg_or_short_operand" "r,I"))
751 (clobber (match_scratch:SI 3 "=r,r"))]
755 {ai.|addic.} %3,%1,%2"
756 [(set_attr "type" "compare")])
759 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
760 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
761 (match_operand:SI 2 "reg_or_short_operand" "r,I"))
763 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
764 (plus:SI (match_dup 1) (match_dup 2)))]
768 {ai.|addic.} %0,%1,%2"
769 [(set_attr "type" "compare")])
771 ;; Split an add that we can't do in one insn into two insns, each of which
772 ;; does one 16-bit part. This is used by combine. Note that the low-order
773 ;; add should be last in case the result gets used in an address.
776 [(set (match_operand:SI 0 "gpc_reg_operand" "")
777 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
778 (match_operand:SI 2 "non_add_cint_operand" "")))]
780 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
781 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
784 int low = INTVAL (operands[2]) & 0xffff;
785 int high = (unsigned) INTVAL (operands[2]) >> 16;
788 high++, low |= 0xffff0000;
790 operands[3] = gen_rtx (CONST_INT, VOIDmode, high << 16);
791 operands[4] = gen_rtx (CONST_INT, VOIDmode, low);
794 (define_insn "one_cmplsi2"
795 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
796 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
801 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
802 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
804 (clobber (match_scratch:SI 2 "=r"))]
807 [(set_attr "type" "compare")])
810 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
811 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
813 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
814 (not:SI (match_dup 1)))]
817 [(set_attr "type" "compare")])
820 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
821 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
822 (match_operand:SI 2 "gpc_reg_operand" "r")))]
824 "{sf%I1|subf%I1c} %0,%2,%1")
827 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
828 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
829 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
836 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
837 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
838 (match_operand:SI 2 "gpc_reg_operand" "r"))
840 (clobber (match_scratch:SI 3 "=r"))]
842 "{sf.|subfc.} %3,%2,%1"
843 [(set_attr "type" "compare")])
846 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
847 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
848 (match_operand:SI 2 "gpc_reg_operand" "r"))
850 (clobber (match_scratch:SI 3 "=r"))]
853 [(set_attr "type" "compare")])
856 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
857 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
858 (match_operand:SI 2 "gpc_reg_operand" "r"))
860 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
861 (minus:SI (match_dup 1) (match_dup 2)))]
863 "{sf.|subfc.} %0,%2,%1"
864 [(set_attr "type" "compare")])
867 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
868 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
869 (match_operand:SI 2 "gpc_reg_operand" "r"))
871 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
872 (minus:SI (match_dup 1) (match_dup 2)))]
875 [(set_attr "type" "compare")])
877 (define_expand "subsi3"
878 [(set (match_operand:SI 0 "gpc_reg_operand" "")
879 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
880 (match_operand:SI 2 "reg_or_cint_operand" "")))]
884 if (GET_CODE (operands[2]) == CONST_INT)
886 emit_insn (gen_addsi3 (operands[0], operands[1],
887 negate_rtx (SImode, operands[2])));
892 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
893 ;; instruction and some auxiliary computations. Then we just have a single
894 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
897 (define_expand "sminsi3"
899 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
900 (match_operand:SI 2 "reg_or_short_operand" ""))
902 (minus:SI (match_dup 2) (match_dup 1))))
903 (set (match_operand:SI 0 "gpc_reg_operand" "")
904 (minus:SI (match_dup 2) (match_dup 3)))]
907 { operands[3] = gen_reg_rtx (SImode); }")
910 [(set (match_operand:SI 0 "gpc_reg_operand" "")
911 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
912 (match_operand:SI 2 "reg_or_short_operand" "")))
913 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
916 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
918 (minus:SI (match_dup 2) (match_dup 1))))
919 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
922 (define_expand "smaxsi3"
924 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
925 (match_operand:SI 2 "reg_or_short_operand" ""))
927 (minus:SI (match_dup 2) (match_dup 1))))
928 (set (match_operand:SI 0 "gpc_reg_operand" "")
929 (plus:SI (match_dup 3) (match_dup 1)))]
932 { operands[3] = gen_reg_rtx (SImode); }")
935 [(set (match_operand:SI 0 "gpc_reg_operand" "")
936 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
937 (match_operand:SI 2 "reg_or_short_operand" "")))
938 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
941 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
943 (minus:SI (match_dup 2) (match_dup 1))))
944 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
947 (define_expand "uminsi3"
948 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
950 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
952 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
954 (minus:SI (match_dup 4) (match_dup 3))))
955 (set (match_operand:SI 0 "gpc_reg_operand" "")
956 (minus:SI (match_dup 2) (match_dup 3)))]
960 operands[3] = gen_reg_rtx (SImode);
961 operands[4] = gen_reg_rtx (SImode);
962 operands[5] = GEN_INT (-2147483647 - 1);
965 (define_expand "umaxsi3"
966 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
968 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
970 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
972 (minus:SI (match_dup 4) (match_dup 3))))
973 (set (match_operand:SI 0 "gpc_reg_operand" "")
974 (plus:SI (match_dup 3) (match_dup 1)))]
978 operands[3] = gen_reg_rtx (SImode);
979 operands[4] = gen_reg_rtx (SImode);
980 operands[5] = GEN_INT (-2147483647 - 1);
984 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
985 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
986 (match_operand:SI 2 "reg_or_short_operand" "rI"))
988 (minus:SI (match_dup 2) (match_dup 1))))]
993 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
995 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
996 (match_operand:SI 2 "reg_or_short_operand" "rI"))
998 (minus:SI (match_dup 2) (match_dup 1)))
1000 (clobber (match_scratch:SI 3 "=r"))]
1003 [(set_attr "type" "delayed_compare")])
1006 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1008 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1009 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1011 (minus:SI (match_dup 2) (match_dup 1)))
1013 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1014 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1016 (minus:SI (match_dup 2) (match_dup 1))))]
1019 [(set_attr "type" "delayed_compare")])
1021 ;; We don't need abs with condition code because such comparisons should
1023 (define_expand "abssi2"
1024 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1025 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1031 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1036 (define_insn "abssi2_power"
1037 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1038 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1042 (define_insn "abssi2_nopower"
1043 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1044 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1045 (clobber (match_scratch:SI 2 "=&r,&r"))]
1049 return (TARGET_POWERPC)
1050 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%2,%0\"
1051 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%2,%0\";
1053 [(set_attr "length" "12")])
1056 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1057 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1058 (clobber (match_scratch:SI 2 "=&r,&r"))]
1059 "!TARGET_POWER && reload_completed"
1060 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1061 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1062 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1066 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1067 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1072 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1073 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1074 (clobber (match_scratch:SI 2 "=&r,&r"))]
1078 return (TARGET_POWERPC)
1079 ? \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;subf %0,%0,%2\"
1080 : \"{srai|srawi} %2,%1,31\;xor %0,%2,%1\;{sf|subfc} %0,%0,%2\";
1082 [(set_attr "length" "12")])
1085 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1086 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1087 (clobber (match_scratch:SI 2 "=&r,&r"))]
1088 "!TARGET_POWER && reload_completed"
1089 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1090 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1091 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1094 (define_insn "negsi2"
1095 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1096 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1101 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1102 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1104 (clobber (match_scratch:SI 2 "=r"))]
1107 [(set_attr "type" "compare")])
1110 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
1111 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1113 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1114 (neg:SI (match_dup 1)))]
1117 [(set_attr "type" "compare")])
1119 (define_insn "ffssi2"
1120 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
1121 (ffs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1123 "neg %0,%1\;and %0,%0,%1\;{cntlz|cntlzw} %0,%0\;{sfi|subfic} %0,%0,32"
1124 [(set_attr "length" "16")])
1126 (define_expand "mulsi3"
1127 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1128 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1129 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1134 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1136 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1140 (define_insn "mulsi3_mq"
1141 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1142 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1143 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1144 (clobber (match_scratch:SI 3 "=q,q"))]
1147 {muls|mullw} %0,%1,%2
1148 {muli|mulli} %0,%1,%2"
1149 [(set_attr "type" "imul")])
1151 (define_insn "mulsi3_no_mq"
1152 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1153 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1154 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1159 [(set_attr "type" "imul")])
1162 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1163 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1164 (match_operand:SI 2 "gpc_reg_operand" "r"))
1166 (clobber (match_scratch:SI 3 "=r"))
1167 (clobber (match_scratch:SI 4 "=q"))]
1169 "{muls.|mullw.} %3,%1,%2"
1170 [(set_attr "type" "delayed_compare")])
1173 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1174 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1175 (match_operand:SI 2 "gpc_reg_operand" "r"))
1177 (clobber (match_scratch:SI 3 "=r"))]
1180 [(set_attr "type" "delayed_compare")])
1183 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1184 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1185 (match_operand:SI 2 "gpc_reg_operand" "r"))
1187 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1188 (mult:SI (match_dup 1) (match_dup 2)))
1189 (clobber (match_scratch:SI 4 "=q"))]
1191 "{muls.|mullw.} %0,%1,%2"
1192 [(set_attr "type" "delayed_compare")])
1195 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1196 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1197 (match_operand:SI 2 "gpc_reg_operand" "r"))
1199 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1200 (mult:SI (match_dup 1) (match_dup 2)))]
1203 [(set_attr "type" "delayed_compare")])
1205 ;; Operand 1 is divided by operand 2; quotient goes to operand
1206 ;; 0 and remainder to operand 3.
1207 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1209 (define_expand "divmodsi4"
1210 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1211 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1212 (match_operand:SI 2 "gpc_reg_operand" "")))
1213 (set (match_operand:SI 3 "gpc_reg_operand" "")
1214 (mod:SI (match_dup 1) (match_dup 2)))])]
1215 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1218 if (! TARGET_POWER && ! TARGET_POWERPC)
1220 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1221 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1222 emit_insn (gen_divss_call ());
1223 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1224 emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
1230 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1231 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1232 (match_operand:SI 2 "gpc_reg_operand" "r")))
1233 (set (match_operand:SI 3 "gpc_reg_operand" "=q")
1234 (mod:SI (match_dup 1) (match_dup 2)))]
1237 [(set_attr "type" "idiv")])
1240 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1241 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1242 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1245 [(set_attr "type" "idiv")])
1247 (define_expand "udivsi3"
1248 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1249 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1250 (match_operand:SI 2 "gpc_reg_operand" "")))]
1251 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1254 if (! TARGET_POWER && ! TARGET_POWERPC)
1256 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1257 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1258 emit_insn (gen_quous_call ());
1259 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1265 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1266 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1267 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1270 [(set_attr "type" "idiv")])
1272 ;; For powers of two we can do srai/aze for divide and then adjust for
1273 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1274 ;; used; for PowerPC, force operands into register and do a normal divide;
1275 ;; for AIX common-mode, use quoss call on register operands.
1276 (define_expand "divsi3"
1277 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1278 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1279 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1283 if (GET_CODE (operands[2]) == CONST_INT
1284 && exact_log2 (INTVAL (operands[2])) >= 0)
1286 else if (TARGET_POWER && ! TARGET_POWERPC)
1289 operands[2] = force_reg (SImode, operands[2]);
1291 if (! TARGET_POWER && ! TARGET_POWERPC)
1293 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1294 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1295 emit_insn (gen_quoss_call ());
1296 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1301 (define_expand "modsi3"
1302 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1303 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1304 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1308 int i = exact_log2 (INTVAL (operands[2]));
1312 if (GET_CODE (operands[2]) != CONST_INT || i < 0)
1315 temp1 = gen_reg_rtx (SImode);
1316 temp2 = gen_reg_rtx (SImode);
1318 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1319 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1320 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1325 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1326 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1327 (match_operand:SI 2 "const_int_operand" "N")))]
1328 "exact_log2 (INTVAL (operands[2])) >= 0"
1329 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1330 [(set_attr "length" "8")])
1333 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1334 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1335 (match_operand:SI 2 "const_int_operand" "N"))
1337 (clobber (match_scratch:SI 3 "=r"))]
1338 "exact_log2 (INTVAL (operands[2])) >= 0"
1339 "{srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3"
1340 [(set_attr "type" "compare")
1341 (set_attr "length" "8")])
1344 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1345 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1346 (match_operand:SI 2 "const_int_operand" "N"))
1348 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1349 (div:SI (match_dup 1) (match_dup 2)))]
1350 "exact_log2 (INTVAL (operands[2])) >= 0"
1351 "{srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0"
1352 [(set_attr "type" "compare")
1353 (set_attr "length" "8")])
1356 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1359 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
1361 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
1362 (match_operand:SI 3 "gpc_reg_operand" "r")))
1363 (set (match_operand:SI 2 "register_operand" "=*q")
1366 (zero_extend:DI (match_dup 1)) (const_int 32))
1367 (zero_extend:DI (match_dup 4)))
1371 [(set_attr "type" "idiv")])
1373 ;; To do unsigned divide we handle the cases of the divisor looking like a
1374 ;; negative number. If it is a constant that is less than 2**31, we don't
1375 ;; have to worry about the branches. So make a few subroutines here.
1377 ;; First comes the normal case.
1378 (define_expand "udivmodsi4_normal"
1379 [(set (match_dup 4) (const_int 0))
1380 (parallel [(set (match_operand:SI 0 "" "")
1381 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1383 (zero_extend:DI (match_operand:SI 1 "" "")))
1384 (match_operand:SI 2 "" "")))
1385 (set (match_operand:SI 3 "" "")
1386 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
1388 (zero_extend:DI (match_dup 1)))
1392 { operands[4] = gen_reg_rtx (SImode); }")
1394 ;; This handles the branches.
1395 (define_expand "udivmodsi4_tests"
1396 [(set (match_operand:SI 0 "" "") (const_int 0))
1397 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
1398 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
1399 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
1400 (label_ref (match_operand:SI 4 "" "")) (pc)))
1401 (set (match_dup 0) (const_int 1))
1402 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
1403 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
1404 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
1405 (label_ref (match_dup 4)) (pc)))]
1408 { operands[5] = gen_reg_rtx (CCUNSmode);
1409 operands[6] = gen_reg_rtx (CCmode);
1412 (define_expand "udivmodsi4"
1413 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1414 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1415 (match_operand:SI 2 "reg_or_cint_operand" "")))
1416 (set (match_operand:SI 3 "gpc_reg_operand" "")
1417 (umod:SI (match_dup 1) (match_dup 2)))])]
1424 if (! TARGET_POWERPC)
1426 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
1427 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
1428 emit_insn (gen_divus_call ());
1429 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
1430 emit_move_insn (operands[3], gen_rtx (REG, SImode, 4));
1436 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
1438 operands[2] = force_reg (SImode, operands[2]);
1439 label = gen_label_rtx ();
1440 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
1441 operands[3], label));
1444 operands[2] = force_reg (SImode, operands[2]);
1446 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
1454 ;; AIX architecture-independent common-mode multiply (DImode),
1455 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
1456 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
1457 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
1458 ;; assumed unused if generating common-mode, so ignore.
1459 (define_insn "mulh_call"
1462 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
1463 (sign_extend:DI (reg:SI 4)))
1465 (clobber (match_scratch:SI 0 "=l"))]
1466 "! TARGET_POWER && ! TARGET_POWERPC"
1469 (define_insn "mull_call"
1471 (mult:DI (sign_extend:DI (reg:SI 3))
1472 (sign_extend:DI (reg:SI 4))))
1473 (clobber (match_scratch:SI 0 "=l"))
1474 (clobber (reg:SI 0))]
1475 "! TARGET_POWER && ! TARGET_POWERPC"
1478 (define_insn "divss_call"
1480 (div:SI (reg:SI 3) (reg:SI 4)))
1482 (mod:SI (reg:SI 3) (reg:SI 4)))
1483 (clobber (match_scratch:SI 0 "=l"))
1484 (clobber (reg:SI 0))]
1485 "! TARGET_POWER && ! TARGET_POWERPC"
1488 (define_insn "divus_call"
1490 (udiv:SI (reg:SI 3) (reg:SI 4)))
1492 (umod:SI (reg:SI 3) (reg:SI 4)))
1493 (clobber (match_scratch:SI 0 "=l"))
1494 (clobber (reg:SI 0))]
1495 "! TARGET_POWER && ! TARGET_POWERPC"
1498 (define_insn "quoss_call"
1500 (div:SI (reg:SI 3) (reg:SI 4)))
1501 (clobber (match_scratch:SI 0 "=l"))]
1502 "! TARGET_POWER && ! TARGET_POWERPC"
1505 (define_insn "quous_call"
1507 (udiv:SI (reg:SI 3) (reg:SI 4)))
1508 (clobber (match_scratch:SI 0 "=l"))
1509 (clobber (reg:SI 0))]
1510 "! TARGET_POWER && ! TARGET_POWERPC"
1513 (define_insn "andsi3"
1514 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1515 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1516 (match_operand:SI 2 "and_operand" "?r,L,K,J")))
1517 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
1521 {rlinm|rlwinm} %0,%1,0,%m2,%M2
1522 {andil.|andi.} %0,%1,%b2
1523 {andiu.|andis.} %0,%1,%u2")
1526 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x")
1527 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1528 (match_operand:SI 2 "and_operand" "r,K,J,L"))
1530 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1534 {andil.|andi.} %3,%1,%b2
1535 {andiu.|andis.} %3,%1,%u2
1536 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2"
1537 [(set_attr "type" "compare,compare,compare,delayed_compare")])
1540 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x")
1541 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1542 (match_operand:SI 2 "and_operand" "r,K,J,L"))
1544 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1545 (and:SI (match_dup 1) (match_dup 2)))]
1549 {andil.|andi.} %0,%1,%b2
1550 {andiu.|andis.} %0,%1,%u2
1551 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2"
1552 [(set_attr "type" "compare,compare,compare,delayed_compare")])
1554 ;; Take a AND with a constant that cannot be done in a single insn and try to
1555 ;; split it into two insns. This does not verify that the insns are valid
1556 ;; since this need not be done as combine will do it.
1559 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1560 (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
1561 (match_operand:SI 2 "non_and_cint_operand" "")))]
1563 [(set (match_dup 0) (and:SI (match_dup 1) (match_dup 3)))
1564 (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
1567 int maskval = INTVAL (operands[2]);
1568 int i, transitions, last_bit_value;
1569 int orig = maskval, first_c = maskval, second_c;
1571 /* We know that MASKVAL must have more than 2 bit-transitions. Start at
1572 the low-order bit and count for the third transition. When we get there,
1573 make a first mask that has everything to the left of that position
1574 a one. Then make the second mask to turn off whatever else is needed. */
1576 for (i = 1, transitions = 0, last_bit_value = maskval & 1; i < 32; i++)
1578 if (((maskval >>= 1) & 1) != last_bit_value)
1579 last_bit_value ^= 1, transitions++;
1581 if (transitions > 2)
1583 first_c |= (~0) << i;
1588 second_c = orig | ~ first_c;
1590 operands[3] = gen_rtx (CONST_INT, VOIDmode, first_c);
1591 operands[4] = gen_rtx (CONST_INT, VOIDmode, second_c);
1594 (define_insn "iorsi3"
1595 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1596 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1597 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1601 {oril|ori} %0,%1,%b2
1602 {oriu|oris} %0,%1,%u2")
1605 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1606 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1607 (match_operand:SI 2 "gpc_reg_operand" "r"))
1609 (clobber (match_scratch:SI 3 "=r"))]
1612 [(set_attr "type" "compare")])
1615 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1616 (compare:CC (ior:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1617 (match_operand:SI 2 "gpc_reg_operand" "r"))
1619 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1620 (ior:SI (match_dup 1) (match_dup 2)))]
1623 [(set_attr "type" "compare")])
1625 ;; Split an IOR that we can't do in one insn into two insns, each of which
1626 ;; does one 16-bit part. This is used by combine.
1629 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1630 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
1631 (match_operand:SI 2 "non_logical_cint_operand" "")))]
1633 [(set (match_dup 0) (ior:SI (match_dup 1) (match_dup 3)))
1634 (set (match_dup 0) (ior:SI (match_dup 0) (match_dup 4)))]
1637 operands[3] = gen_rtx (CONST_INT, VOIDmode,
1638 INTVAL (operands[2]) & 0xffff0000);
1639 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
1642 (define_insn "xorsi3"
1643 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
1644 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
1645 (match_operand:SI 2 "logical_operand" "r,K,J")))]
1649 {xoril|xori} %0,%1,%b2
1650 {xoriu|xoris} %0,%1,%u2")
1653 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1654 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1655 (match_operand:SI 2 "gpc_reg_operand" "r"))
1657 (clobber (match_scratch:SI 3 "=r"))]
1660 [(set_attr "type" "compare")])
1663 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1664 (compare:CC (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1665 (match_operand:SI 2 "gpc_reg_operand" "r"))
1667 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1668 (xor:SI (match_dup 1) (match_dup 2)))]
1671 [(set_attr "type" "compare")])
1673 ;; Split an XOR that we can't do in one insn into two insns, each of which
1674 ;; does one 16-bit part. This is used by combine.
1677 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1678 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1679 (match_operand:SI 2 "non_logical_cint_operand" "")))]
1681 [(set (match_dup 0) (xor:SI (match_dup 1) (match_dup 3)))
1682 (set (match_dup 0) (xor:SI (match_dup 0) (match_dup 4)))]
1685 operands[3] = gen_rtx (CONST_INT, VOIDmode,
1686 INTVAL (operands[2]) & 0xffff0000);
1687 operands[4] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0xffff);
1691 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1692 (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1693 (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1698 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1699 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1700 (match_operand:SI 2 "gpc_reg_operand" "r")))
1702 (clobber (match_scratch:SI 3 "=r"))]
1705 [(set_attr "type" "compare")])
1708 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1709 (compare:CC (not:SI (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
1710 (match_operand:SI 2 "gpc_reg_operand" "r")))
1712 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1713 (not:SI (xor:SI (match_dup 1) (match_dup 2))))]
1716 [(set_attr "type" "compare")])
1719 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1720 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1721 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1726 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1727 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1728 (match_operand:SI 2 "gpc_reg_operand" "r"))
1730 (clobber (match_scratch:SI 3 "=r"))]
1733 [(set_attr "type" "compare")])
1736 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1737 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1738 (match_operand:SI 2 "gpc_reg_operand" "r"))
1740 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1741 (and:SI (not:SI (match_dup 1)) (match_dup 2)))]
1744 [(set_attr "type" "compare")])
1747 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1748 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1749 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1754 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1755 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1756 (match_operand:SI 2 "gpc_reg_operand" "r"))
1758 (clobber (match_scratch:SI 3 "=r"))]
1761 [(set_attr "type" "compare")])
1764 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1765 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
1766 (match_operand:SI 2 "gpc_reg_operand" "r"))
1768 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1769 (ior:SI (not:SI (match_dup 1)) (match_dup 2)))]
1772 [(set_attr "type" "compare")])
1775 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1776 (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1777 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1782 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1783 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1784 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1786 (clobber (match_scratch:SI 3 "=r"))]
1789 [(set_attr "type" "compare")])
1792 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1793 (compare:CC (ior:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1794 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1796 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1797 (ior:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
1800 [(set_attr "type" "compare")])
1803 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1804 (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1805 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
1810 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
1811 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1812 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1814 (clobber (match_scratch:SI 3 "=r"))]
1817 [(set_attr "type" "compare")])
1820 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
1821 (compare:CC (and:SI (not:SI (match_operand:SI 1 "gpc_reg_operand" "%r"))
1822 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r")))
1824 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1825 (and:SI (not:SI (match_dup 1)) (not:SI (match_dup 2))))]
1828 [(set_attr "type" "compare")])
1830 ;; maskir insn. We need four forms because things might be in arbitrary
1831 ;; orders. Don't define forms that only set CR fields because these
1832 ;; would modify an input register.
1835 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1836 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1837 (match_operand:SI 1 "gpc_reg_operand" "0"))
1838 (and:SI (match_dup 2)
1839 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
1844 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1845 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1846 (match_operand:SI 1 "gpc_reg_operand" "0"))
1847 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1853 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1854 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1855 (match_operand:SI 3 "gpc_reg_operand" "r"))
1856 (and:SI (not:SI (match_dup 2))
1857 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
1862 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1863 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1864 (match_operand:SI 2 "gpc_reg_operand" "r"))
1865 (and:SI (not:SI (match_dup 2))
1866 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
1871 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1873 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1874 (match_operand:SI 1 "gpc_reg_operand" "0"))
1875 (and:SI (match_dup 2)
1876 (match_operand:SI 3 "gpc_reg_operand" "r")))
1878 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1879 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
1880 (and:SI (match_dup 2) (match_dup 3))))]
1883 [(set_attr "type" "compare")])
1886 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1888 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
1889 (match_operand:SI 1 "gpc_reg_operand" "0"))
1890 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1893 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1894 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
1895 (and:SI (match_dup 3) (match_dup 2))))]
1898 [(set_attr "type" "compare")])
1901 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1903 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
1904 (match_operand:SI 3 "gpc_reg_operand" "r"))
1905 (and:SI (not:SI (match_dup 2))
1906 (match_operand:SI 1 "gpc_reg_operand" "0")))
1908 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1909 (ior:SI (and:SI (match_dup 2) (match_dup 3))
1910 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
1913 [(set_attr "type" "compare")])
1916 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
1918 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1919 (match_operand:SI 2 "gpc_reg_operand" "r"))
1920 (and:SI (not:SI (match_dup 2))
1921 (match_operand:SI 1 "gpc_reg_operand" "0")))
1923 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1924 (ior:SI (and:SI (match_dup 3) (match_dup 2))
1925 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
1928 [(set_attr "type" "compare")])
1930 ;; Rotate and shift insns, in all their variants. These support shifts,
1931 ;; field inserts and extracts, and various combinations thereof.
1932 (define_expand "insv"
1933 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1934 (match_operand:SI 1 "const_int_operand" "i")
1935 (match_operand:SI 2 "const_int_operand" "i"))
1936 (match_operand:SI 3 "gpc_reg_operand" "r"))]
1940 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
1941 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
1942 compiler if the address of the structure is taken later. */
1943 if (GET_CODE (operands[0]) == SUBREG
1944 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
1949 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1950 (match_operand:SI 1 "const_int_operand" "i")
1951 (match_operand:SI 2 "const_int_operand" "i"))
1952 (match_operand:SI 3 "gpc_reg_operand" "r"))]
1956 int start = INTVAL (operands[2]) & 31;
1957 int size = INTVAL (operands[1]) & 31;
1959 operands[4] = gen_rtx (CONST_INT, VOIDmode, 32 - start - size);
1960 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
1961 return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
1965 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1966 (match_operand:SI 1 "const_int_operand" "i")
1967 (match_operand:SI 2 "const_int_operand" "i"))
1968 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1969 (match_operand:SI 4 "const_int_operand" "i")))]
1973 int shift = INTVAL (operands[4]) & 31;
1974 int start = INTVAL (operands[2]) & 31;
1975 int size = INTVAL (operands[1]) & 31;
1977 operands[4] = gen_rtx (CONST_INT, VOIDmode, (shift - start - size) & 31);
1978 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
1979 return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
1983 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
1984 (match_operand:SI 1 "const_int_operand" "i")
1985 (match_operand:SI 2 "const_int_operand" "i"))
1986 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
1987 (match_operand:SI 4 "const_int_operand" "i")))]
1991 int shift = INTVAL (operands[4]) & 31;
1992 int start = INTVAL (operands[2]) & 31;
1993 int size = INTVAL (operands[1]) & 31;
1995 operands[4] = gen_rtx (CONST_INT, VOIDmode, (32 - shift - start - size) & 31);
1996 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
1997 return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
2001 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2002 (match_operand:SI 1 "const_int_operand" "i")
2003 (match_operand:SI 2 "const_int_operand" "i"))
2004 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2005 (match_operand:SI 4 "const_int_operand" "i")))]
2009 int shift = INTVAL (operands[4]) & 31;
2010 int start = INTVAL (operands[2]) & 31;
2011 int size = INTVAL (operands[1]) & 31;
2013 operands[4] = gen_rtx (CONST_INT, VOIDmode, (32 - shift - start - size) & 31);
2014 operands[1] = gen_rtx (CONST_INT, VOIDmode, start + size - 1);
2015 return \"{rlimi|rlwimi} %0,%3,%4,%h2,%h1\";
2019 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2020 (match_operand:SI 1 "const_int_operand" "i")
2021 (match_operand:SI 2 "const_int_operand" "i"))
2022 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2023 (match_operand:SI 4 "const_int_operand" "i")
2024 (match_operand:SI 5 "const_int_operand" "i")))]
2025 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2028 int extract_start = INTVAL (operands[5]) & 31;
2029 int extract_size = INTVAL (operands[4]) & 31;
2030 int insert_start = INTVAL (operands[2]) & 31;
2031 int insert_size = INTVAL (operands[1]) & 31;
2033 /* Align extract field with insert field */
2034 operands[5] = gen_rtx (CONST_INT, VOIDmode,
2035 (extract_start + extract_size - insert_start - insert_size) & 31);
2036 operands[1] = gen_rtx (CONST_INT, VOIDmode, insert_start + insert_size - 1);
2037 return \"{rlimi|rlwimi} %0,%3,%5,%h2,%h1\";
2040 (define_expand "extzv"
2041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2042 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2043 (match_operand:SI 2 "const_int_operand" "i")
2044 (match_operand:SI 3 "const_int_operand" "i")))]
2048 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2049 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2050 compiler if the address of the structure is taken later. */
2051 if (GET_CODE (operands[0]) == SUBREG
2052 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2057 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2058 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2059 (match_operand:SI 2 "const_int_operand" "i")
2060 (match_operand:SI 3 "const_int_operand" "i")))]
2064 int start = INTVAL (operands[3]) & 31;
2065 int size = INTVAL (operands[2]) & 31;
2067 if (start + size >= 32)
2068 operands[3] = const0_rtx;
2070 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2071 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
2075 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2076 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2077 (match_operand:SI 2 "const_int_operand" "i")
2078 (match_operand:SI 3 "const_int_operand" "i"))
2080 (clobber (match_scratch:SI 4 "=r"))]
2084 int start = INTVAL (operands[3]) & 31;
2085 int size = INTVAL (operands[2]) & 31;
2087 /* If the bitfield being tested fits in the upper or lower half of a
2088 word, it is possible to use andiu. or andil. to test it. This is
2089 useful because the condition register set-use delay is smaller for
2090 andi[ul]. than for rlinm. This doesn't work when the starting bit
2091 position is 0 because the LT and GT bits may be set wrong. */
2093 if ((start > 0 && start + size <= 16) || start >= 16)
2095 operands[3] = gen_rtx (CONST_INT, VOIDmode,
2096 ((1 << (16 - (start & 15)))
2097 - (1 << (16 - (start & 15) - size))));
2099 return \"{andiu.|andis.} %4,%1,%3\";
2101 return \"{andil.|andi.} %4,%1,%3\";
2104 if (start + size >= 32)
2105 operands[3] = const0_rtx;
2107 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2108 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
2110 [(set_attr "type" "compare")])
2113 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2114 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2115 (match_operand:SI 2 "const_int_operand" "i")
2116 (match_operand:SI 3 "const_int_operand" "i"))
2118 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2119 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
2123 int start = INTVAL (operands[3]) & 31;
2124 int size = INTVAL (operands[2]) & 31;
2126 if (start >= 16 && start + size == 32)
2128 operands[3] = gen_rtx (CONST_INT, VOIDmode, (1 << (32 - start)) - 1);
2129 return \"{andil.|andi.} %0,%1,%3\";
2132 if (start + size >= 32)
2133 operands[3] = const0_rtx;
2135 operands[3] = gen_rtx (CONST_INT, VOIDmode, start + size);
2136 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
2138 [(set_attr "type" "delayed_compare")])
2140 (define_insn "rotlsi3"
2141 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2142 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2143 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2145 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
2148 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2149 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2150 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2152 (clobber (match_scratch:SI 3 "=r"))]
2154 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff"
2155 [(set_attr "type" "delayed_compare")])
2158 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2159 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2160 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2162 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2163 (rotate:SI (match_dup 1) (match_dup 2)))]
2165 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff"
2166 [(set_attr "type" "delayed_compare")])
2169 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2170 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2171 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2172 (match_operand:SI 3 "mask_operand" "L")))]
2174 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
2177 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2179 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2180 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2181 (match_operand:SI 3 "mask_operand" "L"))
2183 (clobber (match_scratch:SI 4 "=r"))]
2185 "{rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3"
2186 [(set_attr "type" "delayed_compare")])
2189 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2191 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2192 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2193 (match_operand:SI 3 "mask_operand" "L"))
2195 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2196 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2198 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3"
2199 [(set_attr "type" "delayed_compare")])
2202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2205 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2206 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2208 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
2211 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2212 (compare:CC (zero_extend:SI
2214 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2215 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2217 (clobber (match_scratch:SI 3 "=r"))]
2219 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff"
2220 [(set_attr "type" "delayed_compare")])
2223 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2224 (compare:CC (zero_extend:SI
2226 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2227 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2229 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2230 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2232 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff"
2233 [(set_attr "type" "delayed_compare")])
2236 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2239 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2240 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
2242 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
2245 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2246 (compare:CC (zero_extend:SI
2248 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2249 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2251 (clobber (match_scratch:SI 3 "=r"))]
2253 "{rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff"
2254 [(set_attr "type" "delayed_compare")])
2257 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2258 (compare:CC (zero_extend:SI
2260 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2261 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0))
2263 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2264 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
2266 "{rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff"
2267 [(set_attr "type" "delayed_compare")])
2269 ;; Note that we use "sle." instead of "sl." so that we can set
2270 ;; SHIFT_COUNT_TRUNCATED.
2272 (define_expand "ashlsi3"
2273 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2274 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2275 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2280 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
2282 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
2286 (define_insn "ashlsi3_power"
2287 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2288 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2289 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2290 (clobber (match_scratch:SI 3 "=q,X"))]
2294 {sli|slwi} %0,%1,%h2"
2295 [(set_attr "length" "8")])
2297 (define_insn "ashlsi3_no_power"
2298 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2299 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2300 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2303 [(set_attr "length" "8")])
2306 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2307 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2308 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2310 (clobber (match_scratch:SI 3 "=r,r"))
2311 (clobber (match_scratch:SI 4 "=q,X"))]
2315 {sli.|slwi.} %3,%1,%h2"
2316 [(set_attr "type" "delayed_compare")])
2319 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2320 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2321 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2323 (clobber (match_scratch:SI 3 "=r"))]
2326 [(set_attr "type" "delayed_compare")])
2329 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2330 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2331 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2333 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2334 (ashift:SI (match_dup 1) (match_dup 2)))
2335 (clobber (match_scratch:SI 4 "=q,X"))]
2339 {sli.|slwi.} %0,%1,%h2"
2340 [(set_attr "type" "delayed_compare")])
2343 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2344 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2345 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2347 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2348 (ashift:SI (match_dup 1) (match_dup 2)))]
2351 [(set_attr "type" "delayed_compare")])
2354 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2355 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2356 (match_operand:SI 2 "const_int_operand" "i"))
2357 (match_operand:SI 3 "mask_operand" "L")))]
2358 "includes_lshift_p (operands[2], operands[3])"
2359 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
2362 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2364 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2365 (match_operand:SI 2 "const_int_operand" "i"))
2366 (match_operand:SI 3 "mask_operand" "L"))
2368 (clobber (match_scratch:SI 4 "=r"))]
2369 "includes_lshift_p (operands[2], operands[3])"
2370 "{rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3"
2371 [(set_attr "type" "delayed_compare")])
2374 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2376 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2377 (match_operand:SI 2 "const_int_operand" "i"))
2378 (match_operand:SI 3 "mask_operand" "L"))
2380 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2381 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2382 "includes_lshift_p (operands[2], operands[3])"
2383 "{rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3"
2384 [(set_attr "type" "delayed_compare")])
2386 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
2388 (define_expand "lshrsi3"
2389 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
2390 (use (match_operand:SI 1 "gpc_reg_operand" ""))
2391 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
2396 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
2398 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
2402 (define_insn "lshrsi3_power"
2403 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2404 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2405 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2406 (clobber (match_scratch:SI 3 "=q,X"))]
2410 {s%A2i|s%A2wi} %0,%1,%h2")
2412 (define_insn "lshrsi3_no_power"
2413 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2414 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2415 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2420 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2421 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2422 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2424 (clobber (match_scratch:SI 3 "=r,r"))
2425 (clobber (match_scratch:SI 4 "=q,X"))]
2429 {s%A2i.|s%A2wi.} %3,%1,%h2"
2430 [(set_attr "type" "delayed_compare")])
2433 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2434 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2435 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2437 (clobber (match_scratch:SI 3 "=r"))]
2440 [(set_attr "type" "delayed_compare")])
2443 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2444 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2445 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2447 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2448 (lshiftrt:SI (match_dup 1) (match_dup 2)))
2449 (clobber (match_scratch:SI 4 "=q,X"))]
2453 {s%A2i.|s%A2wi.} %0,%1,%h2"
2454 [(set_attr "type" "delayed_compare")])
2457 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2458 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2459 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2461 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2462 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
2465 [(set_attr "type" "delayed_compare")])
2468 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2469 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2470 (match_operand:SI 2 "const_int_operand" "i"))
2471 (match_operand:SI 3 "mask_operand" "L")))]
2472 "includes_rshift_p (operands[2], operands[3])"
2473 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
2476 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2478 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2479 (match_operand:SI 2 "const_int_operand" "i"))
2480 (match_operand:SI 3 "mask_operand" "L"))
2482 (clobber (match_scratch:SI 4 "=r"))]
2483 "includes_rshift_p (operands[2], operands[3])"
2484 "{rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3"
2485 [(set_attr "type" "delayed_compare")])
2488 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
2490 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2491 (match_operand:SI 2 "const_int_operand" "i"))
2492 (match_operand:SI 3 "mask_operand" "L"))
2494 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2495 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
2496 "includes_rshift_p (operands[2], operands[3])"
2497 "{rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3"
2498 [(set_attr "type" "delayed_compare")])
2501 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2504 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2505 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
2506 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2507 "{rlinm|rlwinm} %0,%1,%s2,0xff")
2510 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2514 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2515 (match_operand:SI 2 "const_int_operand" "i")) 0))
2517 (clobber (match_scratch:SI 3 "=r"))]
2518 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2519 "{rlinm.|rlwinm.} %3,%1,%s2,0xff"
2520 [(set_attr "type" "delayed_compare")])
2523 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2527 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2528 (match_operand:SI 2 "const_int_operand" "i")) 0))
2530 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2531 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
2532 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 255))"
2533 "{rlinm.|rlwinm.} %0,%1,%s2,0xff"
2534 [(set_attr "type" "delayed_compare")])
2537 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2540 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2541 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
2542 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2543 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
2546 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2550 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2551 (match_operand:SI 2 "const_int_operand" "i")) 0))
2553 (clobber (match_scratch:SI 3 "=r"))]
2554 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2555 "{rlinm.|rlwinm.} %3,%1,%s2,0xffff"
2556 [(set_attr "type" "delayed_compare")])
2559 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2563 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2564 (match_operand:SI 2 "const_int_operand" "i")) 0))
2566 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2567 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
2568 "includes_rshift_p (operands[2], gen_rtx (CONST_INT, VOIDmode, 65535))"
2569 "{rlinm.|rlwinm.} %0,%1,%s2,0xffff"
2570 [(set_attr "type" "delayed_compare")])
2573 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2575 (match_operand:SI 1 "gpc_reg_operand" "r"))
2576 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2582 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2584 (match_operand:SI 1 "gpc_reg_operand" "r"))
2585 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2591 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2593 (match_operand:SI 1 "gpc_reg_operand" "r"))
2594 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2600 (define_expand "ashrsi3"
2601 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2602 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
2603 (match_operand:SI 2 "reg_or_cint_operand" "")))]
2608 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
2610 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
2614 (define_insn "ashrsi3_power"
2615 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2616 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2617 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
2618 (clobber (match_scratch:SI 3 "=q,X"))]
2622 {srai|srawi} %0,%1,%h2")
2624 (define_insn "ashrsi3_no_power"
2625 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2626 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2627 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
2629 "sraw%I2 %0,%1,%h2")
2632 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
2633 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2634 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2636 (clobber (match_scratch:SI 3 "=r,r"))
2637 (clobber (match_scratch:SI 4 "=q,X"))]
2641 {srai.|srawi.} %3,%1,%h2"
2642 [(set_attr "type" "delayed_compare")])
2645 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
2646 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2647 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2649 (clobber (match_scratch:SI 3 "=r"))]
2651 "sraw%I2. %3,%1,%h2"
2652 [(set_attr "type" "delayed_compare")])
2655 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
2656 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2657 (match_operand:SI 2 "reg_or_cint_operand" "r,i"))
2659 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2660 (ashiftrt:SI (match_dup 1) (match_dup 2)))
2661 (clobber (match_scratch:SI 4 "=q,X"))]
2665 {srai.|srawi.} %0,%1,%h2"
2666 [(set_attr "type" "delayed_compare")])
2669 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
2670 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2671 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
2673 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
2674 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
2676 "sraw%I2. %0,%1,%h2"
2677 [(set_attr "type" "delayed_compare")])
2679 ;; Floating-point insns, excluding normal data motion.
2681 ;; PowerPC has a full set of single-precision floating point instructions.
2683 ;; For the POWER architecture, we pretend that we have both SFmode and
2684 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
2685 ;; The only conversions we will do will be when storing to memory. In that
2686 ;; case, we will use the "frsp" instruction before storing.
2688 ;; Note that when we store into a single-precision memory location, we need to
2689 ;; use the frsp insn first. If the register being stored isn't dead, we
2690 ;; need a scratch register for the frsp. But this is difficult when the store
2691 ;; is done by reload. It is not incorrect to do the frsp on the register in
2692 ;; this case, we just lose precision that we would have otherwise gotten but
2693 ;; is not guaranteed. Perhaps this should be tightened up at some point.
2695 (define_insn "extendsfdf2"
2696 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
2697 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2701 if (REGNO (operands[0]) == REGNO (operands[1]))
2704 return \"fmr %0,%1\";
2706 [(set_attr "type" "fp")])
2708 (define_insn "truncdfsf2"
2709 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2710 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
2713 [(set_attr "type" "fp")])
2715 (define_insn "aux_truncdfsf2"
2716 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2717 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
2718 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2720 [(set_attr "type" "fp")])
2722 (define_insn "negsf2"
2723 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2724 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2727 [(set_attr "type" "fp")])
2729 (define_insn "abssf2"
2730 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2731 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2734 [(set_attr "type" "fp")])
2737 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2738 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
2741 [(set_attr "type" "fp")])
2743 (define_expand "addsf3"
2744 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2745 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
2746 (match_operand:SF 2 "gpc_reg_operand" "")))]
2751 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2752 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2753 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2754 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2756 [(set_attr "type" "fp")])
2759 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2760 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2761 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2762 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2763 "{fa|fadd} %0,%1,%2"
2764 [(set_attr "type" "fp")])
2766 (define_expand "subsf3"
2767 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2768 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
2769 (match_operand:SF 2 "gpc_reg_operand" "")))]
2774 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2775 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2776 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2777 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2779 [(set_attr "type" "fp")])
2782 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2783 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2784 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2785 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2786 "{fs|fsub} %0,%1,%2"
2787 [(set_attr "type" "fp")])
2789 (define_expand "mulsf3"
2790 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2791 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
2792 (match_operand:SF 2 "gpc_reg_operand" "")))]
2797 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2798 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2799 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2800 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2802 [(set_attr "type" "fp")])
2805 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2806 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2807 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2808 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2809 "{fm|fmul} %0,%1,%2"
2810 [(set_attr "type" "fp")])
2812 (define_expand "divsf3"
2813 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2814 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
2815 (match_operand:SF 2 "gpc_reg_operand" "")))]
2820 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2821 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2822 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2823 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2825 [(set_attr "type" "sdiv")])
2828 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2829 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
2830 (match_operand:SF 2 "gpc_reg_operand" "f")))]
2831 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2832 "{fd|fdiv} %0,%1,%2"
2833 [(set_attr "type" "sdiv")])
2836 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2837 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2838 (match_operand:SF 2 "gpc_reg_operand" "f"))
2839 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2840 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2841 "fmadds %0,%1,%2,%3"
2842 [(set_attr "type" "fp")])
2845 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2846 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2847 (match_operand:SF 2 "gpc_reg_operand" "f"))
2848 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2849 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2850 "{fma|fmadd} %0,%1,%2,%3"
2851 [(set_attr "type" "fp")])
2854 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2855 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2856 (match_operand:SF 2 "gpc_reg_operand" "f"))
2857 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2858 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2859 "fmsubs %0,%1,%2,%3"
2860 [(set_attr "type" "fp")])
2863 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2864 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2865 (match_operand:SF 2 "gpc_reg_operand" "f"))
2866 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2867 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2868 "{fms|fmsub} %0,%1,%2,%3"
2869 [(set_attr "type" "fp")])
2872 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2873 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2874 (match_operand:SF 2 "gpc_reg_operand" "f"))
2875 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
2876 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2877 "fnmadds %0,%1,%2,%3"
2878 [(set_attr "type" "fp")])
2881 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2882 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2883 (match_operand:SF 2 "gpc_reg_operand" "f"))
2884 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
2885 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2886 "{fnma|fnmadd} %0,%1,%2,%3"
2887 [(set_attr "type" "fp")])
2890 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2891 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2892 (match_operand:SF 2 "gpc_reg_operand" "f"))
2893 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
2894 "TARGET_POWERPC && TARGET_HARD_FLOAT"
2895 "fnmsubs %0,%1,%2,%3"
2896 [(set_attr "type" "fp")])
2899 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2900 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
2901 (match_operand:SF 2 "gpc_reg_operand" "f"))
2902 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
2903 "! TARGET_POWERPC && TARGET_HARD_FLOAT"
2904 "{fnms|fnmsub} %0,%1,%2,%3"
2905 [(set_attr "type" "fp")])
2907 (define_expand "sqrtsf2"
2908 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2909 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
2910 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
2914 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2915 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2916 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT"
2918 [(set_attr "type" "ssqrt")])
2921 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2922 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
2923 "TARGET_POWER2 && TARGET_HARD_FLOAT"
2925 [(set_attr "type" "dsqrt")])
2927 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
2928 ;; fsel instruction and some auxiliary computations. Then we just have a
2929 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
2931 (define_expand "maxsf3"
2933 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
2934 (match_operand:SF 2 "gpc_reg_operand" "")))
2935 (set (match_operand:SF 0 "gpc_reg_operand" "")
2936 (if_then_else:SF (ge (match_dup 3)
2940 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
2942 { operands[3] = gen_reg_rtx (SFmode); }")
2945 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2946 (smax:SF (match_operand:SF 1 "gpc_reg_operand" "")
2947 (match_operand:SF 2 "gpc_reg_operand" "")))
2948 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
2949 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
2951 (minus:SF (match_dup 1) (match_dup 2)))
2953 (if_then_else:SF (ge (match_dup 3)
2959 (define_expand "minsf3"
2961 (minus:SF (match_operand:SF 2 "gpc_reg_operand" "")
2962 (match_operand:SF 1 "gpc_reg_operand" "")))
2963 (set (match_operand:SF 0 "gpc_reg_operand" "")
2964 (if_then_else:SF (ge (match_dup 3)
2968 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
2970 { operands[3] = gen_reg_rtx (SFmode); }")
2973 [(set (match_operand:SF 0 "gpc_reg_operand" "")
2974 (smin:SF (match_operand:SF 1 "gpc_reg_operand" "")
2975 (match_operand:SF 2 "gpc_reg_operand" "")))
2976 (clobber (match_operand:SF 3 "gpc_reg_operand" ""))]
2977 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
2979 (minus:SF (match_dup 2) (match_dup 1)))
2981 (if_then_else:SF (ge (match_dup 3)
2987 (define_expand "movsfcc"
2988 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
2989 (if_then_else:SF (match_operand 1 "comparison_operator" "")
2990 (match_operand:SF 2 "gpc_reg_operand" "f")
2991 (match_operand:SF 3 "gpc_reg_operand" "f")))]
2992 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
2996 enum rtx_code code = GET_CODE (operands[1]);
2997 if (! rs6000_compare_fp_p)
3001 case GE: case EQ: case NE:
3002 op0 = rs6000_compare_op0;
3003 op1 = rs6000_compare_op1;
3006 op0 = rs6000_compare_op1;
3007 op1 = rs6000_compare_op0;
3008 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3011 op0 = rs6000_compare_op1;
3012 op1 = rs6000_compare_op0;
3015 op0 = rs6000_compare_op0;
3016 op1 = rs6000_compare_op1;
3017 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3022 if (GET_MODE (rs6000_compare_op0) == DFmode)
3024 temp = gen_reg_rtx (DFmode);
3025 emit_insn (gen_subdf3 (temp, op0, op1));
3026 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[2], operands[3]));
3029 emit_insn (gen_negdf2 (temp, temp));
3030 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[0], operands[3]));
3034 emit_insn (gen_negdf2 (temp, temp));
3035 emit_insn (gen_fseldfsf4 (operands[0], temp, operands[3], operands[0]));
3040 temp = gen_reg_rtx (SFmode);
3041 emit_insn (gen_subsf3 (temp, op0, op1));
3042 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[2], operands[3]));
3045 emit_insn (gen_negsf2 (temp, temp));
3046 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[0], operands[3]));
3050 emit_insn (gen_negsf2 (temp, temp));
3051 emit_insn (gen_fselsfsf4 (operands[0], temp, operands[3], operands[0]));
3057 (define_insn "fselsfsf4"
3058 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3059 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3061 (match_operand:SF 2 "gpc_reg_operand" "f")
3062 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3063 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3065 [(set_attr "type" "fp")])
3067 (define_insn "fseldfsf4"
3068 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
3069 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3071 (match_operand:SF 2 "gpc_reg_operand" "f")
3072 (match_operand:SF 3 "gpc_reg_operand" "f")))]
3073 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3075 [(set_attr "type" "fp")])
3077 (define_insn "negdf2"
3078 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3079 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3082 [(set_attr "type" "fp")])
3084 (define_insn "absdf2"
3085 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3086 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3089 [(set_attr "type" "fp")])
3092 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3093 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3096 [(set_attr "type" "fp")])
3098 (define_insn "adddf3"
3099 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3100 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3101 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3103 "{fa|fadd} %0,%1,%2"
3104 [(set_attr "type" "fp")])
3106 (define_insn "subdf3"
3107 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3108 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3109 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3111 "{fs|fsub} %0,%1,%2"
3112 [(set_attr "type" "fp")])
3114 (define_insn "muldf3"
3115 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3116 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3117 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3119 "{fm|fmul} %0,%1,%2"
3120 [(set_attr "type" "dmul")])
3122 (define_insn "divdf3"
3123 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3124 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
3125 (match_operand:DF 2 "gpc_reg_operand" "f")))]
3127 "{fd|fdiv} %0,%1,%2"
3128 [(set_attr "type" "ddiv")])
3131 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3132 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3133 (match_operand:DF 2 "gpc_reg_operand" "f"))
3134 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3136 "{fma|fmadd} %0,%1,%2,%3"
3137 [(set_attr "type" "dmul")])
3140 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3141 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3142 (match_operand:DF 2 "gpc_reg_operand" "f"))
3143 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3145 "{fms|fmsub} %0,%1,%2,%3"
3146 [(set_attr "type" "dmul")])
3149 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3150 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3151 (match_operand:DF 2 "gpc_reg_operand" "f"))
3152 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3154 "{fnma|fnmadd} %0,%1,%2,%3"
3155 [(set_attr "type" "dmul")])
3158 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3159 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
3160 (match_operand:DF 2 "gpc_reg_operand" "f"))
3161 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
3163 "{fnms|fnmsub} %0,%1,%2,%3"
3164 [(set_attr "type" "dmul")])
3166 (define_insn "sqrtdf2"
3167 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3168 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
3169 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT"
3171 [(set_attr "type" "dsqrt")])
3173 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
3174 ;; fsel instruction and some auxiliary computations. Then we just have a
3175 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
3178 (define_expand "maxdf3"
3180 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
3181 (match_operand:DF 2 "gpc_reg_operand" "")))
3182 (set (match_operand:DF 0 "gpc_reg_operand" "")
3183 (if_then_else:DF (ge (match_dup 3)
3187 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3189 { operands[3] = gen_reg_rtx (DFmode); }")
3192 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3193 (smax:DF (match_operand:DF 1 "gpc_reg_operand" "")
3194 (match_operand:DF 2 "gpc_reg_operand" "")))
3195 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3196 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3198 (minus:DF (match_dup 1) (match_dup 2)))
3200 (if_then_else:DF (ge (match_dup 3)
3206 (define_expand "mindf3"
3208 (minus:DF (match_operand:DF 2 "gpc_reg_operand" "")
3209 (match_operand:DF 1 "gpc_reg_operand" "")))
3210 (set (match_operand:DF 0 "gpc_reg_operand" "")
3211 (if_then_else:DF (ge (match_dup 3)
3215 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3217 { operands[3] = gen_reg_rtx (DFmode); }")
3220 [(set (match_operand:DF 0 "gpc_reg_operand" "")
3221 (smin:DF (match_operand:DF 1 "gpc_reg_operand" "")
3222 (match_operand:DF 2 "gpc_reg_operand" "")))
3223 (clobber (match_operand:DF 3 "gpc_reg_operand" ""))]
3224 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3226 (minus:DF (match_dup 2) (match_dup 1)))
3228 (if_then_else:DF (ge (match_dup 3)
3234 (define_expand "movdfcc"
3235 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3236 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3237 (match_operand:DF 2 "gpc_reg_operand" "f")
3238 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3239 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3243 enum rtx_code code = GET_CODE (operands[1]);
3244 if (! rs6000_compare_fp_p)
3248 case GE: case EQ: case NE:
3249 op0 = rs6000_compare_op0;
3250 op1 = rs6000_compare_op1;
3253 op0 = rs6000_compare_op1;
3254 op1 = rs6000_compare_op0;
3255 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3258 op0 = rs6000_compare_op1;
3259 op1 = rs6000_compare_op0;
3262 op0 = rs6000_compare_op0;
3263 op1 = rs6000_compare_op1;
3264 temp = operands[2]; operands[2] = operands[3]; operands[3] = temp;
3269 if (GET_MODE (rs6000_compare_op0) == DFmode)
3271 temp = gen_reg_rtx (DFmode);
3272 emit_insn (gen_subdf3 (temp, op0, op1));
3273 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[2], operands[3]));
3276 emit_insn (gen_negdf2 (temp, temp));
3277 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[0], operands[3]));
3281 emit_insn (gen_negdf2 (temp, temp));
3282 emit_insn (gen_fseldfdf4 (operands[0], temp, operands[3], operands[0]));
3287 temp = gen_reg_rtx (SFmode);
3288 emit_insn (gen_subsf3 (temp, op0, op1));
3289 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[2], operands[3]));
3292 emit_insn (gen_negsf2 (temp, temp));
3293 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[0], operands[3]));
3297 emit_insn (gen_negsf2 (temp, temp));
3298 emit_insn (gen_fselsfdf4 (operands[0], temp, operands[3], operands[0]));
3304 (define_insn "fseldfdf4"
3305 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3306 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
3308 (match_operand:DF 2 "gpc_reg_operand" "f")
3309 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3310 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT"
3312 [(set_attr "type" "fp")])
3314 (define_insn "fselsfdf4"
3315 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3316 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
3318 (match_operand:DF 2 "gpc_reg_operand" "f")
3319 (match_operand:DF 3 "gpc_reg_operand" "f")))]
3322 [(set_attr "type" "fp")])
3324 ;; Conversions to and from floating-point.
3325 (define_expand "floatsidf2"
3327 (plus:DI (zero_extend:DI
3328 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3331 (set (match_operand:DF 0 "gpc_reg_operand" "")
3332 (minus:DF (subreg:DF (match_dup 2) 0)
3334 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3337 operands[2] = gen_reg_rtx (DImode);
3338 operands[3] = gen_rtx (CONST_INT, VOIDmode, 0x80000000);
3339 operands[4] = rs6000_immed_double_const (0, 0x43300000, DImode);
3340 operands[5] = force_reg (DFmode, rs6000_immed_double_const (0x43300000,
3345 (define_expand "floatunssidf2"
3347 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3349 (set (match_operand:DF 0 "gpc_reg_operand" "")
3350 (minus:DF (subreg:DF (match_dup 2) 0)
3352 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3355 operands[2] = gen_reg_rtx (DImode);
3356 operands[3] = rs6000_immed_double_const (0, 0x43300000, DImode);
3357 operands[4] = force_reg (DFmode, rs6000_immed_double_const (0x43300000, 0, DFmode));
3360 ;; For the above two cases, we always split.
3362 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3363 (plus:DI (zero_extend:DI
3364 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
3365 (match_operand:SI 2 "logical_operand" "")))
3366 (match_operand:DI 3 "low_32_bit_operand" "")))]
3368 [(set (match_dup 6) (xor:SI (match_dup 1) (match_dup 2)))
3369 (set (match_dup 4) (match_dup 5))]
3371 { operands[4] = operand_subword (operands[0], 0, 0, DImode);
3372 operands[5] = operand_subword (operands[3], 0, 0, DImode);
3373 operands[6] = operand_subword (operands[0], 1, 0, DImode);
3377 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3378 (plus:DI (zero_extend:DI
3379 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "%r")
3380 (match_operand:SI 2 "logical_operand" "rKJ")))
3381 (match_operand:DI 3 "low_32_bit_operand" "n")))]
3384 [(set_attr "length" "8")])
3387 [(set (match_operand:DI 0 "gpc_reg_operand" "=")
3388 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3389 (match_operand:DI 2 "low_32_bit_operand" "")))]
3391 [(set (match_dup 3) (match_dup 4))
3392 (set (match_dup 5) (match_dup 1))]
3394 { operands[3] = operand_subword (operands[0], 0, 0, DImode);
3395 operands[4] = operand_subword (operands[2], 0, 0, DImode);
3396 operands[5] = operand_subword (operands[0], 1, 0, DImode);
3398 if (rtx_equal_p (operands[1], operands[5]))
3400 emit_move_insn (operands[3], operands[4]);
3404 if (rtx_equal_p (operands[1], operands[3]))
3408 temp = operands[3]; operands[3] = operands[5]; operands[5] = temp;
3409 temp = operands[4]; operands[4] = operands[1]; operands[1] = temp;
3414 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3415 (plus:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
3416 (match_operand:DI 2 "low_32_bit_operand" "n")))]
3419 [(set_attr "length" "8")])
3421 (define_expand "fix_truncdfsi2"
3422 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3423 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
3427 if (TARGET_POWER2 || TARGET_POWERPC)
3429 rtx stack_slot = assign_stack_temp (DImode, 8, 0),
3430 temp = gen_reg_rtx (DImode);
3432 emit_insn (gen_fpcvtsi (temp, operands[1]));
3433 emit_move_insn (stack_slot, temp);
3434 emit_move_insn (operands[0],
3435 operand_subword (stack_slot, 1, 0, DImode));
3440 emit_insn (gen_trunc_call (operands[0], operands[1],
3441 gen_rtx (SYMBOL_REF, Pmode, RS6000_ITRUNC)));
3446 (define_insn "fpcvtsi"
3447 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3449 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))))]
3450 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT"
3451 "{fcirz|fctiwz} %0,%1"
3452 [(set_attr "type" "fp")])
3454 (define_expand "fixuns_truncdfsi2"
3455 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3456 (unsigned_fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))]
3457 "! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT"
3460 emit_insn (gen_trunc_call (operands[0], operands[1],
3461 gen_rtx (SYMBOL_REF, Pmode, RS6000_UITRUNC)));
3465 (define_expand "trunc_call"
3466 [(parallel [(set (match_operand:SI 0 "" "")
3467 (fix:SI (match_operand:DF 1 "" "")))
3468 (use (match_operand:SI 2 "" ""))])]
3472 rtx insns = gen_trunc_call_rtl (operands[0], operands[1], operands[2]);
3473 rtx first = XVECEXP (insns, 0, 0);
3474 rtx last = XVECEXP (insns, 0, XVECLEN (insns, 0) - 1);
3476 REG_NOTES (first) = gen_rtx (INSN_LIST, REG_LIBCALL, last,
3478 REG_NOTES (last) = gen_rtx (INSN_LIST, REG_RETVAL, first, REG_NOTES (last));
3484 (define_expand "trunc_call_rtl"
3485 [(set (reg:DF 33) (match_operand:DF 1 "gpc_reg_operand" ""))
3487 (parallel [(set (reg:SI 3)
3488 (call (mem:SI (match_operand 2 "" "")) (const_int 0)))
3489 (clobber (scratch:SI))])
3490 (set (match_operand:SI 0 "gpc_reg_operand" "")
3495 rs6000_trunc_used = 1;
3498 (define_insn "floatdidf2"
3499 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
3500 (float:DF (match_operand:DI 1 "gpc_reg_operand" "f")))]
3501 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3503 [(set_attr "type" "fp")])
3505 (define_insn "fix_truncdfdi2"
3506 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
3507 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
3508 "TARGET_POWERPC64 && TARGET_HARD_FLOAT"
3510 [(set_attr "type" "fp")])
3512 ;; Define the DImode operations that can be done in a small number
3514 (define_expand "adddi3"
3515 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3516 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
3517 (match_operand:DI 2 "reg_or_short_operand" "")))]
3521 if (! TARGET_POWER && ! TARGET_POWERPC64
3522 && short_cint_operand (operands[2], DImode))
3527 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3528 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
3529 (match_operand:DI 2 "reg_or_short_operand" "r,I")))]
3530 "TARGET_POWER && ! TARGET_POWERPC64"
3532 {a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2
3533 {ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1"
3534 [(set_attr "length" "8")])
3537 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3538 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
3539 (match_operand:DI 2 "gpc_reg_operand" "r")))]
3540 "! TARGET_POWER && ! TARGET_POWERPC64"
3541 "addc %L0,%L1,%L2\;adde %0,%1,%2"
3542 [(set_attr "length" "8")])
3544 (define_expand "subdi3"
3545 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3546 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
3547 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
3551 if (! TARGET_POWER && ! TARGET_POWERPC64
3552 && short_cint_operand (operands[1], DImode))
3557 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3558 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
3559 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
3560 "TARGET_POWER && ! TARGET_POWERPC64"
3562 {sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1
3563 {sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2"
3564 [(set_attr "length" "8")])
3567 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3568 (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3569 (match_operand:DI 2 "gpc_reg_operand" "r")))]
3570 "! TARGET_POWER && ! TARGET_POWERPC64"
3571 "subfc %L0,%L2,%L1\;subfe %0,%2,%1"
3572 [(set_attr "length" "8")])
3574 (define_expand "negdi2"
3575 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3576 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
3581 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3582 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
3583 "! TARGET_POWERPC64"
3584 "{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1"
3585 [(set_attr "length" "8")])
3587 (define_expand "mulsidi3"
3588 [(set (match_operand:DI 0 "gpc_reg_operand" "")
3589 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
3590 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
3594 if (! TARGET_POWER && ! TARGET_POWERPC)
3596 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
3597 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
3598 emit_insn (gen_mull_call ());
3599 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
3600 gen_rtx (REG, SImode, 3));
3601 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
3602 gen_rtx (REG, SImode, 4));
3605 else if (TARGET_POWER)
3607 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
3612 (define_insn "mulsidi3_mq"
3613 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3614 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
3615 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
3616 (clobber (match_scratch:SI 3 "=q"))]
3618 "mul %0,%1,%2\;mfmq %L0"
3619 [(set_attr "type" "imul")
3620 (set_attr "length" "8")])
3623 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
3624 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
3625 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
3626 "TARGET_POWERPC && ! TARGET_POWERPC64"
3627 "mulhw %0,%1,%2\;mullw %L0,%1,%2"
3628 [(set_attr "type" "imul")
3629 (set_attr "length" "8")])
3631 (define_expand "smulsi3_highpart"
3632 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3634 (lshiftrt:DI (mult:DI (sign_extend:DI
3635 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3637 (match_operand:SI 2 "gpc_reg_operand" "r")))
3642 if (! TARGET_POWER && ! TARGET_POWERPC)
3644 emit_move_insn (gen_rtx (REG, SImode, 3), operands[1]);
3645 emit_move_insn (gen_rtx (REG, SImode, 4), operands[2]);
3646 emit_insn (gen_mulh_call ());
3647 emit_move_insn (operands[0], gen_rtx (REG, SImode, 3));
3650 else if (TARGET_POWER)
3652 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
3657 (define_insn "smulsi3_highpart_mq"
3658 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3660 (lshiftrt:DI (mult:DI (sign_extend:DI
3661 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3663 (match_operand:SI 2 "gpc_reg_operand" "r")))
3665 (clobber (match_scratch:SI 3 "=q"))]
3668 [(set_attr "type" "imul")])
3671 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3673 (lshiftrt:DI (mult:DI (sign_extend:DI
3674 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3676 (match_operand:SI 2 "gpc_reg_operand" "r")))
3680 [(set_attr "type" "imul")])
3682 (define_insn "umulsi3_highpart"
3683 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3685 (lshiftrt:DI (mult:DI (zero_extend:DI
3686 (match_operand:SI 1 "gpc_reg_operand" "%r"))
3688 (match_operand:SI 2 "gpc_reg_operand" "r")))
3692 [(set_attr "type" "imul")])
3694 ;; If operands 0 and 2 are in the same register, we have a problem. But
3695 ;; operands 0 and 1 (the usual case) can be in the same register. That's
3696 ;; why we have the strange constraints below.
3697 (define_insn "ashldi3"
3698 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
3699 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
3700 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
3701 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
3704 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
3705 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
3706 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
3707 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
3708 [(set_attr "length" "8")])
3710 (define_insn "lshrdi3"
3711 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r,r,&r")
3712 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
3713 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
3714 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
3717 {cal %0,0(0)|li %0,0}\;{s%A2i|s%A2wi} %L0,%1,%h2
3718 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
3719 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
3720 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
3721 [(set_attr "length" "8")])
3723 ;; Shift by a variable amount is too complex to be worth open-coding. We
3724 ;; just handle shifts by constants.
3726 (define_expand "ashrdi3"
3727 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "")
3728 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
3729 (match_operand:SI 2 "general_operand" "")))
3730 (clobber (match_scratch:SI 3 ""))])]
3733 { if (GET_CODE (operands[2]) != CONST_INT)
3738 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
3739 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
3740 (match_operand:SI 2 "const_int_operand" "M,i")))
3741 (clobber (match_scratch:SI 3 "=X,q"))]
3744 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
3745 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
3746 [(set_attr "length" "8")])
3748 ;; PowerPC64 DImode operations.
3750 (define_insn "ffsdi2"
3751 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
3752 (ffs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
3754 "neg %0,%1\;and %0,%0,%1\;cntlzd %0,%0\;subfic %0,%0,64"
3755 [(set_attr "length" "16")])
3757 (define_insn "muldi3"
3758 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3759 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
3760 (match_operand:DI 2 "gpc_reg_operand" "r")))]
3763 [(set_attr "type" "imul")])
3765 (define_insn "smuldi3_highpart"
3766 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3768 (lshiftrt:TI (mult:TI (sign_extend:TI
3769 (match_operand:DI 1 "gpc_reg_operand" "%r"))
3771 (match_operand:DI 2 "gpc_reg_operand" "r")))
3775 [(set_attr "type" "imul")])
3777 (define_insn "umuldi3_highpart"
3778 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3780 (lshiftrt:TI (mult:TI (zero_extend:TI
3781 (match_operand:DI 1 "gpc_reg_operand" "%r"))
3783 (match_operand:DI 2 "gpc_reg_operand" "r")))
3787 [(set_attr "type" "imul")])
3789 (define_insn "divdi3"
3790 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3791 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3792 (match_operand:DI 2 "gpc_reg_operand" "r")))]
3795 [(set_attr "type" "idiv")])
3797 (define_insn "udivdi3"
3798 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3799 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3800 (match_operand:DI 2 "gpc_reg_operand" "r")))]
3803 [(set_attr "type" "idiv")])
3805 (define_insn "rotldi3"
3806 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3807 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3808 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
3810 "rld%I2cl %0,%1,%h2,0")
3813 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
3814 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3815 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
3817 (clobber (match_scratch:DI 3 "=r"))]
3819 "rld%I2cl. %3,%1,%h2,0"
3820 [(set_attr "type" "delayed_compare")])
3823 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
3824 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3825 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
3827 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3828 (rotate:DI (match_dup 1) (match_dup 2)))]
3830 "rld%I2cl. %0,%1,%h2,0"
3831 [(set_attr "type" "delayed_compare")])
3833 ;; Now define ways of moving data around.
3835 ;; For SI, we special-case integers that can't be loaded in one insn. We
3836 ;; do the load 16-bits at a time. We could do this by loading from memory,
3837 ;; and this is even supposed to be faster, but it is simpler not to get
3838 ;; integers in the TOC.
3839 (define_expand "movsi"
3840 [(set (match_operand:SI 0 "general_operand" "")
3841 (match_operand:SI 1 "any_operand" ""))]
3845 if (GET_CODE (operands[0]) != REG)
3846 operands[1] = force_reg (SImode, operands[1]);
3848 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT
3849 && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1]))
3851 /* If we are to limit the number of things we put in the TOC and
3852 this is a symbol plus a constant we can add in one insn,
3853 just put the sumbol in the TOC and add the constant. Don't do
3854 this if reload is in progress. */
3855 if (GET_CODE (operands[1]) == CONST
3856 && TARGET_NO_SUM_IN_TOC && ! reload_in_progress
3857 && GET_CODE (XEXP (operands[1], 0)) == PLUS
3858 && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode)
3859 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
3860 || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF)
3861 && ! side_effects_p (operands[0]))
3863 rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0));
3864 rtx other = XEXP (XEXP (operands[1], 0), 1);
3866 emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other));
3870 operands[1] = force_const_mem (SImode, operands[1]);
3871 if (! memory_address_p (SImode, XEXP (operands[1], 0))
3872 && ! reload_in_progress)
3873 operands[1] = change_address (operands[1], SImode,
3874 XEXP (operands[1], 0));
3877 if (GET_CODE (operands[1]) == CONST_INT
3878 && (unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
3879 && (INTVAL (operands[1]) & 0xffff) != 0)
3881 emit_move_insn (operands[0],
3882 gen_rtx (CONST_INT, VOIDmode,
3883 INTVAL (operands[1]) & 0xffff0000));
3884 emit_insn (gen_iorsi3 (operands[0], operands[0],
3885 gen_rtx (CONST_INT, VOIDmode,
3886 INTVAL (operands[1]) & 0xffff)));
3892 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*q,*c*l,*h")
3893 (match_operand:SI 1 "input_operand" "r,m,r,I,J,R,*h,r,r,0"))]
3894 "gpc_reg_operand (operands[0], SImode)
3895 || gpc_reg_operand (operands[1], SImode)"
3898 {l%U1%X1|lwz%U1%X1} %0,%1
3899 {st%U0%X0|stw%U0%X0} %1,%0
3907 [(set_attr "type" "*,load,*,*,*,*,*,*,mtjmpr,*")])
3909 ;; Split a load of a large constant into the appropriate two-insn
3913 [(set (match_operand:SI 0 "gpc_reg_operand" "")
3914 (match_operand:SI 1 "const_int_operand" ""))]
3915 "(unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000
3916 && (INTVAL (operands[1]) & 0xffff) != 0"
3920 (ior:SI (match_dup 0)
3924 operands[2] = gen_rtx (CONST_INT, VOIDmode,
3925 INTVAL (operands[1]) & 0xffff0000);
3926 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff);
3930 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
3931 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
3933 (set (match_operand:SI 0 "gpc_reg_operand" "=r") (match_dup 1))]
3936 [(set_attr "type" "compare")])
3938 (define_expand "movhi"
3939 [(set (match_operand:HI 0 "general_operand" "")
3940 (match_operand:HI 1 "any_operand" ""))]
3944 if (GET_CODE (operands[0]) != REG)
3945 operands[1] = force_reg (HImode, operands[1]);
3947 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
3949 operands[1] = force_const_mem (HImode, operands[1]);
3950 if (! memory_address_p (HImode, XEXP (operands[1], 0))
3951 && ! reload_in_progress)
3952 operands[1] = change_address (operands[1], HImode,
3953 XEXP (operands[1], 0));
3958 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
3959 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
3960 "gpc_reg_operand (operands[0], HImode)
3961 || gpc_reg_operand (operands[1], HImode)"
3971 [(set_attr "type" "*,load,*,*,*,*,mtjmpr,*")])
3973 (define_expand "movqi"
3974 [(set (match_operand:QI 0 "general_operand" "")
3975 (match_operand:QI 1 "any_operand" ""))]
3979 if (GET_CODE (operands[0]) != REG)
3980 operands[1] = force_reg (QImode, operands[1]);
3982 if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT)
3984 operands[1] = force_const_mem (QImode, operands[1]);
3985 if (! memory_address_p (QImode, XEXP (operands[1], 0))
3986 && ! reload_in_progress)
3987 operands[1] = change_address (operands[1], QImode,
3988 XEXP (operands[1], 0));
3993 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
3994 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
3995 "gpc_reg_operand (operands[0], QImode)
3996 || gpc_reg_operand (operands[1], QImode)"
4006 [(set_attr "type" "*,load,*,*,*,*,mtjmpr,*")])
4008 ;; Here is how to move condition codes around. When we store CC data in
4009 ;; an integer register or memory, we store just the high-order 4 bits.
4010 ;; This lets us not shift in the most common case of CR0.
4011 (define_expand "movcc"
4012 [(set (match_operand:CC 0 "nonimmediate_operand" "")
4013 (match_operand:CC 1 "nonimmediate_operand" ""))]
4018 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,y,r,r,r,r,m")
4019 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,m,r"))]
4020 "register_operand (operands[0], CCmode)
4021 || register_operand (operands[1], CCmode)"
4025 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
4027 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
4029 {l%U1%X1|lwz%U1%X1} %0,%1
4030 {st%U0%U1|stw%U0%U1} %1,%0"
4031 [(set_attr "type" "*,*,*,compare,*,*,load,*")
4032 (set_attr "length" "*,*,12,*,8,*,*,*")])
4034 ;; For floating-point, we normally deal with the floating-point registers
4035 ;; unless -msoft-float is used. The sole exception is that parameter passing
4036 ;; can produce floating-point values in fixed-point registers. Unless the
4037 ;; value is a simple constant or already in memory, we deal with this by
4038 ;; allocating memory and copying the value explicitly via that memory location.
4039 (define_expand "movsf"
4040 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4041 (match_operand:SF 1 "any_operand" ""))]
4045 /* If we are called from reload, we might be getting a SUBREG of a hard
4046 reg. So expand it. */
4047 if (GET_CODE (operands[0]) == SUBREG
4048 && GET_CODE (SUBREG_REG (operands[0])) == REG
4049 && REGNO (SUBREG_REG (operands[0])) < FIRST_PSEUDO_REGISTER)
4050 operands[0] = alter_subreg (operands[0]);
4051 if (GET_CODE (operands[1]) == SUBREG
4052 && GET_CODE (SUBREG_REG (operands[1])) == REG
4053 && REGNO (SUBREG_REG (operands[1])) < FIRST_PSEUDO_REGISTER)
4054 operands[1] = alter_subreg (operands[1]);
4056 if (TARGET_SOFT_FLOAT && GET_CODE (operands[0]) == MEM)
4057 operands[1] = force_reg (SFmode, operands[1]);
4059 else if (TARGET_HARD_FLOAT)
4061 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 32)
4063 /* If this is a store to memory or another integer register do the
4064 move directly. Otherwise store to a temporary stack slot and
4065 load from there into a floating point register. */
4067 if (GET_CODE (operands[0]) == MEM
4068 || (GET_CODE (operands[0]) == REG
4069 && (REGNO (operands[0]) < 32
4070 || (reload_in_progress
4071 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))))
4073 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
4074 operand_subword (operands[1], 0, 0, SFmode));
4079 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
4081 emit_move_insn (stack_slot, operands[1]);
4082 emit_move_insn (operands[0], stack_slot);
4087 if (GET_CODE (operands[0]) == MEM)
4089 /* If operands[1] is a register, it may have double-precision data
4090 in it, so truncate it to single precision. We need not do
4091 this for POWERPC. */
4092 if (! TARGET_POWERPC && TARGET_HARD_FLOAT
4093 && GET_CODE (operands[1]) == REG)
4096 = reload_in_progress ? operands[1] : gen_reg_rtx (SFmode);
4097 emit_insn (gen_aux_truncdfsf2 (newreg, operands[1]));
4098 operands[1] = newreg;
4101 operands[1] = force_reg (SFmode, operands[1]);
4104 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 32)
4106 if (GET_CODE (operands[1]) == MEM
4107 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT && ! defined(REAL_IS_NOT_DOUBLE)
4108 || GET_CODE (operands[1]) == CONST_DOUBLE
4110 || (GET_CODE (operands[1]) == REG
4111 && (REGNO (operands[1]) < 32
4112 || (reload_in_progress
4113 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER))))
4115 emit_move_insn (operand_subword (operands[0], 0, 0, SFmode),
4116 operand_subword (operands[1], 0, 0, SFmode));
4121 rtx stack_slot = assign_stack_temp (SFmode, 4, 0);
4123 emit_move_insn (stack_slot, operands[1]);
4124 emit_move_insn (operands[0], stack_slot);
4130 if (CONSTANT_P (operands[1]))
4132 operands[1] = force_const_mem (SFmode, operands[1]);
4133 if (! memory_address_p (SFmode, XEXP (operands[1], 0))
4134 && ! reload_in_progress)
4135 operands[1] = change_address (operands[1], SFmode,
4136 XEXP (operands[1], 0));
4141 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4142 (match_operand:SF 1 "easy_fp_constant" ""))]
4143 "reload_completed && REGNO (operands[0]) <= 31"
4144 [(set (match_dup 2) (match_dup 3))]
4146 { operands[2] = operand_subword (operands[0], 0, 0, SFmode);
4147 operands[3] = operand_subword (operands[1], 0, 0, SFmode); }")
4150 [(set (match_operand:SF 0 "fp_reg_or_mem_operand" "=f,f,m")
4151 (match_operand:SF 1 "input_operand" "f,m,f"))]
4152 "(gpc_reg_operand (operands[0], SFmode)
4153 || gpc_reg_operand (operands[1], SFmode)) && TARGET_HARD_FLOAT"
4158 [(set_attr "type" "fp,fpload,*")])
4161 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
4162 (match_operand:SF 1 "input_operand" "r,m,r,I,J,R"))]
4163 "(gpc_reg_operand (operands[0], SFmode)
4164 || gpc_reg_operand (operands[1], SFmode)) && TARGET_SOFT_FLOAT"
4167 {l%U1%X1|lwz%U1%X1} %0,%1
4168 {st%U0%X0|stw%U0%X0} %1,%0
4172 [(set_attr "type" "*,load,*,*,*,*")])
4175 (define_expand "movdf"
4176 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4177 (match_operand:DF 1 "any_operand" ""))]
4181 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
4183 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
4184 operand_subword_force (operands[1], 1, DFmode));
4185 emit_move_insn (operand_subword (operands[0], 0, 1, DFmode),
4186 operand_subword_force (operands[1], 0, DFmode));
4190 if (GET_CODE (operands[0]) != REG)
4191 operands[1] = force_reg (DFmode, operands[1]);
4193 if (CONSTANT_P (operands[1]) && ! easy_fp_constant (operands[1], DFmode))
4195 operands[1] = force_const_mem (DFmode, operands[1]);
4196 if (! memory_address_p (DFmode, XEXP (operands[1], 0))
4197 && ! reload_in_progress)
4198 operands[1] = change_address (operands[1], DFmode,
4199 XEXP (operands[1], 0));
4204 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4205 (match_operand:DF 1 "easy_fp_constant" ""))]
4206 "reload_completed && REGNO (operands[0]) <= 31"
4207 [(set (match_dup 2) (match_dup 3))
4208 (set (match_dup 4) (match_dup 5))]
4210 { operands[2] = operand_subword (operands[0], 0, 0, DFmode);
4211 operands[3] = operand_subword (operands[1], 0, 0, DFmode);
4212 operands[4] = operand_subword (operands[0], 1, 0, DFmode);
4213 operands[5] = operand_subword (operands[1], 1, 0, DFmode); }")
4215 ;; Don't have reload use general registers to load a constant. First,
4216 ;; it might not work if the output operand has is the equivalent of
4217 ;; a non-offsettable memref, but also it is less efficient than loading
4218 ;; the constant into an FP register, since it will probably be used there.
4219 ;; The "??" is a kludge until we can figure out a more reasonable way
4220 ;; of handling these non-offsettable values.
4222 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,f,f,m")
4223 (match_operand:DF 1 "input_operand" "r,o,r,G,f,m,f"))]
4224 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT
4225 && (register_operand (operands[0], DFmode)
4226 || register_operand (operands[1], DFmode))"
4229 switch (which_alternative)
4232 /* We normally copy the low-numbered register first. However, if
4233 the first register operand 0 is the same as the second register of
4234 operand 1, we must copy in the opposite order. */
4235 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
4236 return \"mr %L0,%L1\;mr %0,%1\";
4238 return \"mr %0,%1\;mr %L0,%L1\";
4240 /* If the low-address word is used in the address, we must load it
4241 last. Otherwise, load it first. Note that we cannot have
4242 auto-increment in that case since the address register is known to be
4244 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
4246 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
4248 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
4250 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
4254 return \"fmr %0,%1\";
4256 return \"lfd%U1%X1 %0,%1\";
4258 return \"stfd%U0%X0 %1,%0\";
4261 [(set_attr "type" "*,load,*,*,fp,fpload,*")
4262 (set_attr "length" "8,8,8,8,*,*,*")])
4265 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r")
4266 (match_operand:DF 1 "input_operand" "r,o,r,G"))]
4267 "! TARGET_POWERPC64 && TARGET_SOFT_FLOAT
4268 && (register_operand (operands[0], DFmode)
4269 || register_operand (operands[1], DFmode))"
4272 switch (which_alternative)
4275 /* We normally copy the low-numbered register first. However, if
4276 the first register operand 0 is the same as the second register of
4277 operand 1, we must copy in the opposite order. */
4278 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
4279 return \"mr %L0,%L1\;mr %0,%1\";
4281 return \"mr %0,%1\;mr %L0,%L1\";
4283 /* If the low-address word is used in the address, we must load it
4284 last. Otherwise, load it first. Note that we cannot have
4285 auto-increment in that case since the address register is known to be
4287 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
4289 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
4291 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
4293 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
4298 [(set_attr "type" "*,load,*,*")
4299 (set_attr "length" "8,8,8,8")])
4302 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,o,!r,f,f,m")
4303 (match_operand:DF 1 "input_operand" "r,o,r,G,f,m,f"))]
4304 "TARGET_POWERPC64 && TARGET_HARD_FLOAT
4305 && (register_operand (operands[0], DFmode)
4306 || register_operand (operands[1], DFmode))"
4315 [(set_attr "type" "*,load,*,*,fp,fpload,*")])
4318 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,o,r")
4319 (match_operand:DF 1 "input_operand" "r,o,r,G"))]
4320 "TARGET_POWERPC64 && TARGET_SOFT_FLOAT
4321 && (register_operand (operands[0], DFmode)
4322 || register_operand (operands[1], DFmode))"
4328 [(set_attr "type" "*,load,*,*")])
4330 ;; Next come the multi-word integer load and store and the load and store
4332 (define_expand "movdi"
4333 [(set (match_operand:DI 0 "general_operand" "")
4334 (match_operand:DI 1 "general_operand" ""))]
4338 if (GET_CODE (operands[1]) == CONST_DOUBLE
4339 || GET_CODE (operands[1]) == CONST_INT)
4341 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
4342 operand_subword (operands[1], 0, 0, DImode));
4343 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
4344 operand_subword (operands[1], 1, 0, DImode));
4348 if (GET_CODE (operands[0]) == MEM)
4349 operands[1] = force_reg (DImode, operands[1]);
4351 /* Stores between FPR and any non-FPR registers must go through a
4352 temporary stack slot. */
4354 if (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
4355 && ((FP_REGNO_P (REGNO (operands[0]))
4356 && ! FP_REGNO_P (REGNO (operands[1])))
4357 || (FP_REGNO_P (REGNO (operands[1]))
4358 && ! FP_REGNO_P (REGNO (operands[0])))))
4360 rtx stack_slot = assign_stack_temp (DImode, 8, 0);
4362 emit_move_insn (stack_slot, operands[1]);
4363 emit_move_insn (operands[0], stack_slot);
4369 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m")
4370 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f"))]
4371 "! TARGET_POWERPC64 && (gpc_reg_operand (operands[0], DImode)
4372 || gpc_reg_operand (operands[1], DImode))"
4375 switch (which_alternative)
4378 /* We normally copy the low-numbered register first. However, if
4379 the first register operand 0 is the same as the second register of
4380 operand 1, we must copy in the opposite order. */
4381 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
4382 return \"mr %L0,%L1\;mr %0,%1\";
4384 return \"mr %0,%1\;mr %L0,%L1\";
4386 /* If the low-address word is used in the address, we must load it
4387 last. Otherwise, load it first. Note that we cannot have
4388 auto-increment in that case since the address register is known to be
4390 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
4392 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
4394 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
4396 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
4398 return \"fmr %0,%1\";
4400 return \"lfd%U1%X1 %0,%1\";
4402 return \"stfd%U0%X0 %1,%0\";
4405 [(set_attr "type" "*,load,*,fp,fpload,*")
4406 (set_attr "length" "8,8,8,*,*,*")])
4409 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,f,f,m,r,*h")
4410 (match_operand:DI 1 "input_operand" "r,m,r,I,J,R,f,m,f,*h,r"))]
4411 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], DImode)
4412 || gpc_reg_operand (operands[1], DImode))"
4425 [(set_attr "type" "*,load,*,*,*,*,fp,fpload,*,*,mtjmpr")])
4427 ;; TImode is similar, except that we usually want to compute the address into
4428 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
4429 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
4430 (define_expand "movti"
4431 [(parallel [(set (match_operand:TI 0 "general_operand" "")
4432 (match_operand:TI 1 "general_operand" ""))
4433 (clobber (scratch:SI))])]
4434 "TARGET_STRING || TARGET_POWERPC64"
4437 if (GET_CODE (operands[0]) == MEM)
4438 operands[1] = force_reg (TImode, operands[1]);
4440 if (GET_CODE (operands[0]) == MEM
4441 && GET_CODE (XEXP (operands[0], 0)) != REG
4442 && ! reload_in_progress)
4443 operands[0] = change_address (operands[0], TImode,
4444 copy_addr_to_reg (XEXP (operands[0], 0)));
4446 if (GET_CODE (operands[1]) == MEM
4447 && GET_CODE (XEXP (operands[1], 0)) != REG
4448 && ! reload_in_progress)
4449 operands[1] = change_address (operands[1], TImode,
4450 copy_addr_to_reg (XEXP (operands[1], 0)));
4453 ;; We say that MQ is clobbered in the last alternative because the first
4454 ;; alternative would never get used otherwise since it would need a reload
4455 ;; while the 2nd alternative would not. We put memory cases first so they
4456 ;; are preferred. Otherwise, we'd try to reload the output instead of
4457 ;; giving the SCRATCH mq.
4459 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
4460 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
4461 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
4462 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
4463 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
4466 switch (which_alternative)
4472 return \"{stsi|stswi} %1,%P0,16\";
4475 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
4478 /* Normally copy registers with lowest numbered register copied first.
4479 But copy in the other order if the first register of the output
4480 is the second, third, or fourth register in the input. */
4481 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
4482 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
4483 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
4485 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
4487 /* If the address is not used in the output, we can use lsi. Otherwise,
4488 fall through to generating four loads. */
4489 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
4490 return \"{lsi|lswi} %0,%P1,16\";
4491 /* ... fall through ... */
4493 /* If the address register is the same as the register for the lowest-
4494 addressed word, load it last. Similarly for the next two words.
4495 Otherwise load lowest address to highest. */
4496 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
4498 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
4499 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
4500 REGNO (operands[0]) + 2, operands[1], 0))
4501 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
4502 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
4503 REGNO (operands[0]) + 3, operands[1], 0))
4504 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
4506 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
4509 [(set_attr "type" "*,load,load,*,*")
4510 (set_attr "length" "*,16,16,*,16")])
4513 [(set (match_operand:TI 0 "reg_or_mem_operand" "=m,????r,????r")
4514 (match_operand:TI 1 "reg_or_mem_operand" "r,r,m"))
4515 (clobber (match_scratch:SI 2 "=X,X,X"))]
4516 "TARGET_STRING && !TARGET_POWER && ! TARGET_POWERPC64
4517 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
4520 switch (which_alternative)
4526 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
4529 /* Normally copy registers with lowest numbered register copied first.
4530 But copy in the other order if the first register of the output
4531 is the second, third, or fourth register in the input. */
4532 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
4533 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
4534 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
4536 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
4538 /* If the address register is the same as the register for the lowest-
4539 addressed word, load it last. Similarly for the next two words.
4540 Otherwise load lowest address to highest. */
4541 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
4543 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
4544 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
4545 REGNO (operands[0]) + 2, operands[1], 0))
4546 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
4547 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
4548 REGNO (operands[0]) + 3, operands[1], 0))
4549 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
4551 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
4554 [(set_attr "type" "load,*,*")
4555 (set_attr "length" "16,16,16")])
4558 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
4559 (match_operand:TI 1 "input_operand" "r,m,r"))]
4560 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
4561 || gpc_reg_operand (operands[1], TImode))"
4564 switch (which_alternative)
4567 /* We normally copy the low-numbered register first. However, if
4568 the first register operand 0 is the same as the second register of
4569 operand 1, we must copy in the opposite order. */
4570 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
4571 return \"mr %L0,%L1\;mr %0,%1\";
4573 return \"mr %0,%1\;mr %L0,%L1\";
4575 /* If the low-address word is used in the address, we must load it
4576 last. Otherwise, load it first. Note that we cannot have
4577 auto-increment in that case since the address register is known to be
4579 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
4581 return \"ld %L0,%L1\;ld %0,%1\";
4583 return \"ld%U1 %0,%1\;ld %L0,%L1\";
4585 return \"std%U0 %1,%0\;std %L1,%L0\";
4588 [(set_attr "type" "*,load,*")
4589 (set_attr "length" "8,8,8")])
4591 (define_expand "load_multiple"
4592 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
4593 (match_operand:SI 1 "" ""))
4594 (use (match_operand:SI 2 "" ""))])]
4603 /* Support only loading a constant number of fixed-point registers from
4604 memory and only bother with this if more than two; the machine
4605 doesn't support more than eight. */
4606 if (GET_CODE (operands[2]) != CONST_INT
4607 || INTVAL (operands[2]) <= 2
4608 || INTVAL (operands[2]) > 8
4609 || GET_CODE (operands[1]) != MEM
4610 || GET_CODE (operands[0]) != REG
4611 || REGNO (operands[0]) >= 32)
4614 count = INTVAL (operands[2]);
4615 regno = REGNO (operands[0]);
4617 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count));
4618 from = force_reg (SImode, XEXP (operands[1], 0));
4620 for (i = 0; i < count; i++)
4621 XVECEXP (operands[3], 0, i)
4622 = gen_rtx (SET, VOIDmode, gen_rtx (REG, SImode, regno + i),
4623 gen_rtx (MEM, SImode, plus_constant (from, i * 4)));
4627 [(match_parallel 0 "load_multiple_operation"
4628 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
4629 (match_operand:SI 2 "indirect_operand" "Q"))])]
4633 /* We have to handle the case where the pseudo used to contain the address
4634 is assigned to one of the output registers. In that case, do the
4635 lsi, but then load the correct value. This is a bit of a mess, but is
4637 We set the length attribute to the maximum possible size (8 bytes). */
4638 static char result[100];
4642 strcpy (result, \"{lsi|lswi} %1,%P2,%N0\");
4643 for (i = 0; i < XVECLEN (operands[0], 0); i++)
4644 if (refers_to_regno_p (REGNO (operands[1]) + i,
4645 REGNO (operands[1]) + i + 1, operands[2], 0))
4647 sprintf (newload, \"\;{l|lwz} %d,%d(%d)\",
4648 REGNO (operands[1]) + i,
4649 i * 4, REGNO (XEXP (operands[2], 0)));
4650 strcat (result, newload);
4655 [(set_attr "type" "load")
4656 (set_attr "length" "8")])
4659 (define_expand "store_multiple"
4660 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
4661 (match_operand:SI 1 "" ""))
4662 (clobber (scratch:SI))
4663 (use (match_operand:SI 2 "" ""))])]
4672 /* Support only storing a constant number of fixed-point registers to
4673 memory and only bother with this if more than two; the machine
4674 doesn't support more than eight. */
4675 if (GET_CODE (operands[2]) != CONST_INT
4676 || INTVAL (operands[2]) <= 2
4677 || INTVAL (operands[2]) > 8
4678 || GET_CODE (operands[0]) != MEM
4679 || GET_CODE (operands[1]) != REG
4680 || REGNO (operands[1]) >= 32)
4683 count = INTVAL (operands[2]);
4684 regno = REGNO (operands[1]);
4686 operands[3] = gen_rtx (PARALLEL, VOIDmode, rtvec_alloc (count + 1));
4687 to = force_reg (SImode, XEXP (operands[0], 0));
4689 XVECEXP (operands[3], 0, 0)
4690 = gen_rtx (SET, VOIDmode, gen_rtx (MEM, SImode, to), operands[1]);
4691 XVECEXP (operands[3], 0, 1) = gen_rtx (CLOBBER, VOIDmode,
4692 gen_rtx (SCRATCH, SImode));
4694 for (i = 1; i < count; i++)
4695 XVECEXP (operands[3], 0, i + 1)
4696 = gen_rtx (SET, VOIDmode,
4697 gen_rtx (MEM, SImode, plus_constant (to, i * 4)),
4698 gen_rtx (REG, SImode, regno + i));
4702 [(match_parallel 0 "store_multiple_operation"
4703 [(set (match_operand:SI 1 "indirect_operand" "=Q")
4704 (match_operand:SI 2 "gpc_reg_operand" "r"))
4705 (clobber (match_scratch:SI 3 "=q"))])]
4706 "TARGET_STRING && TARGET_POWER"
4707 "{stsi|stswi} %2,%P1,%O0")
4710 [(match_parallel 0 "store_multiple_operation"
4711 [(set (match_operand:SI 1 "indirect_operand" "=Q")
4712 (match_operand:SI 2 "gpc_reg_operand" "r"))
4713 (clobber (match_scratch:SI 3 "X"))])]
4714 "TARGET_STRING && !TARGET_POWER"
4715 "{stsi|stswi} %2,%P1,%O0")
4718 ;; String/block move insn.
4719 ;; Argument 0 is the destination
4720 ;; Argument 1 is the source
4721 ;; Argument 2 is the length
4722 ;; Argument 3 is the alignment
4724 (define_expand "movstrsi"
4725 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
4726 (match_operand:BLK 1 "memory_operand" ""))
4727 (use (match_operand:SI 2 "general_operand" ""))
4728 (use (match_operand:SI 3 "immediate_operand" ""))])]
4732 if (expand_block_move (operands))
4738 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
4739 ;; register allocator doesn't have a clue about allocating 8 word registers
4740 (define_expand "movstrsi_8reg"
4741 [(parallel [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
4742 (mem:BLK (match_operand:SI 1 "register_operand" "")))
4743 (use (match_operand:SI 2 "immediate_operand" ""))
4744 (use (match_operand:SI 3 "immediate_operand" ""))
4745 (clobber (reg:SI 5))
4746 (clobber (reg:SI 6))
4747 (clobber (reg:SI 7))
4748 (clobber (reg:SI 8))
4749 (clobber (reg:SI 9))
4750 (clobber (reg:SI 10))
4751 (clobber (reg:SI 11))
4752 (clobber (reg:SI 12))
4753 (clobber (match_scratch:SI 4 ""))])]
4758 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4759 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4760 (use (match_operand:SI 2 "immediate_operand" "i"))
4761 (use (match_operand:SI 3 "immediate_operand" "i"))
4762 (clobber (match_operand:SI 4 "register_operand" "=r"))
4763 (clobber (reg:SI 6))
4764 (clobber (reg:SI 7))
4765 (clobber (reg:SI 8))
4766 (clobber (reg:SI 9))
4767 (clobber (reg:SI 10))
4768 (clobber (reg:SI 11))
4769 (clobber (reg:SI 12))
4770 (clobber (match_scratch:SI 5 "=q"))]
4771 "TARGET_STRING && TARGET_POWER
4772 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
4773 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
4774 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
4775 && REGNO (operands[4]) == 5"
4776 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4777 [(set_attr "length" "8")])
4780 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4781 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4782 (use (match_operand:SI 2 "immediate_operand" "i"))
4783 (use (match_operand:SI 3 "immediate_operand" "i"))
4784 (clobber (match_operand:SI 4 "register_operand" "=r"))
4785 (clobber (reg:SI 6))
4786 (clobber (reg:SI 7))
4787 (clobber (reg:SI 8))
4788 (clobber (reg:SI 9))
4789 (clobber (reg:SI 10))
4790 (clobber (reg:SI 11))
4791 (clobber (reg:SI 12))
4792 (clobber (match_scratch:SI 5 "X"))]
4793 "TARGET_STRING && !TARGET_POWER
4794 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32) || INTVAL (operands[2]) == 0)
4795 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
4796 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
4797 && REGNO (operands[4]) == 5"
4798 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4799 [(set_attr "length" "8")])
4801 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
4802 ;; register allocator doesn't have a clue about allocating 6 word registers
4803 (define_expand "movstrsi_6reg"
4804 [(parallel [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
4805 (mem:BLK (match_operand:SI 1 "register_operand" "")))
4806 (use (match_operand:SI 2 "immediate_operand" ""))
4807 (use (match_operand:SI 3 "immediate_operand" ""))
4808 (clobber (reg:SI 7))
4809 (clobber (reg:SI 8))
4810 (clobber (reg:SI 9))
4811 (clobber (reg:SI 10))
4812 (clobber (reg:SI 11))
4813 (clobber (reg:SI 12))
4814 (clobber (match_scratch:SI 4 ""))])]
4819 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4820 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4821 (use (match_operand:SI 2 "immediate_operand" "i"))
4822 (use (match_operand:SI 3 "immediate_operand" "i"))
4823 (clobber (match_operand:SI 4 "register_operand" "=r"))
4824 (clobber (reg:SI 8))
4825 (clobber (reg:SI 9))
4826 (clobber (reg:SI 10))
4827 (clobber (reg:SI 11))
4828 (clobber (reg:SI 12))
4829 (clobber (match_scratch:SI 5 "=q"))]
4830 "TARGET_STRING && TARGET_POWER
4831 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
4832 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
4833 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
4834 && REGNO (operands[4]) == 7"
4835 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4836 [(set_attr "length" "8")])
4839 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4840 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4841 (use (match_operand:SI 2 "immediate_operand" "i"))
4842 (use (match_operand:SI 3 "immediate_operand" "i"))
4843 (clobber (match_operand:SI 4 "register_operand" "=r"))
4844 (clobber (reg:SI 8))
4845 (clobber (reg:SI 9))
4846 (clobber (reg:SI 10))
4847 (clobber (reg:SI 11))
4848 (clobber (reg:SI 12))
4849 (clobber (match_scratch:SI 5 "X"))]
4850 "TARGET_STRING && !TARGET_POWER
4851 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
4852 && (REGNO (operands[0]) < 7 || REGNO (operands[0]) > 12)
4853 && (REGNO (operands[1]) < 7 || REGNO (operands[1]) > 12)
4854 && REGNO (operands[4]) == 7"
4855 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4856 [(set_attr "length" "8")])
4858 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill problems
4860 (define_expand "movstrsi_4reg"
4861 [(parallel [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
4862 (mem:BLK (match_operand:SI 1 "register_operand" "")))
4863 (use (match_operand:SI 2 "immediate_operand" ""))
4864 (use (match_operand:SI 3 "immediate_operand" ""))
4865 (clobber (reg:SI 9))
4866 (clobber (reg:SI 10))
4867 (clobber (reg:SI 11))
4868 (clobber (reg:SI 12))
4869 (clobber (match_scratch:SI 4 ""))])]
4874 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4875 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4876 (use (match_operand:SI 2 "immediate_operand" "i"))
4877 (use (match_operand:SI 3 "immediate_operand" "i"))
4878 (clobber (match_operand:SI 4 "register_operand" "=r"))
4879 (clobber (reg:SI 10))
4880 (clobber (reg:SI 11))
4881 (clobber (reg:SI 12))
4882 (clobber (match_scratch:SI 5 "=q"))]
4883 "TARGET_STRING && TARGET_POWER
4884 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
4885 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
4886 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
4887 && REGNO (operands[4]) == 9"
4888 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4889 [(set_attr "length" "8")])
4892 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4893 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4894 (use (match_operand:SI 2 "immediate_operand" "i"))
4895 (use (match_operand:SI 3 "immediate_operand" "i"))
4896 (clobber (match_operand:SI 4 "register_operand" "=r"))
4897 (clobber (reg:SI 10))
4898 (clobber (reg:SI 11))
4899 (clobber (reg:SI 12))
4900 (clobber (match_scratch:SI 5 "X"))]
4901 "TARGET_STRING && !TARGET_POWER
4902 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
4903 && (REGNO (operands[0]) < 9 || REGNO (operands[0]) > 12)
4904 && (REGNO (operands[1]) < 9 || REGNO (operands[1]) > 12)
4905 && REGNO (operands[4]) == 9"
4906 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4907 [(set_attr "length" "8")])
4909 ;; Move up to 8 bytes at a time.
4910 (define_expand "movstrsi_2reg"
4911 [(parallel [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
4912 (mem:BLK (match_operand:SI 1 "register_operand" "")))
4913 (use (match_operand:SI 2 "immediate_operand" ""))
4914 (use (match_operand:SI 3 "immediate_operand" ""))
4915 (clobber (match_scratch:DI 4 ""))
4916 (clobber (match_scratch:SI 5 ""))])]
4917 "TARGET_STRING && !TARGET_64BIT"
4921 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4922 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4923 (use (match_operand:SI 2 "immediate_operand" "i"))
4924 (use (match_operand:SI 3 "immediate_operand" "i"))
4925 (clobber (match_scratch:DI 4 "=&r"))
4926 (clobber (match_scratch:SI 5 "=q"))]
4927 "TARGET_STRING && TARGET_POWER && !TARGET_64BIT
4928 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
4929 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4930 [(set_attr "length" "8")])
4933 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4934 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4935 (use (match_operand:SI 2 "immediate_operand" "i"))
4936 (use (match_operand:SI 3 "immediate_operand" "i"))
4937 (clobber (match_scratch:DI 4 "=&r"))
4938 (clobber (match_scratch:SI 5 "X"))]
4939 "TARGET_STRING && !TARGET_POWER && !TARGET_64BIT
4940 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
4941 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4942 [(set_attr "length" "8")])
4944 ;; Move up to 4 bytes at a time.
4945 (define_expand "movstrsi_1reg"
4946 [(parallel [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
4947 (mem:BLK (match_operand:SI 1 "register_operand" "")))
4948 (use (match_operand:SI 2 "immediate_operand" ""))
4949 (use (match_operand:SI 3 "immediate_operand" ""))
4950 (clobber (match_scratch:SI 4 ""))
4951 (clobber (match_scratch:SI 5 ""))])]
4956 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4957 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4958 (use (match_operand:SI 2 "immediate_operand" "i"))
4959 (use (match_operand:SI 3 "immediate_operand" "i"))
4960 (clobber (match_scratch:SI 4 "=&r"))
4961 (clobber (match_scratch:SI 5 "=q"))]
4962 "TARGET_STRING && TARGET_POWER
4963 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
4964 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4965 [(set_attr "length" "8")])
4968 [(set (mem:BLK (match_operand:SI 0 "register_operand" "b"))
4969 (mem:BLK (match_operand:SI 1 "register_operand" "b")))
4970 (use (match_operand:SI 2 "immediate_operand" "i"))
4971 (use (match_operand:SI 3 "immediate_operand" "i"))
4972 (clobber (match_scratch:SI 4 "=&r"))
4973 (clobber (match_scratch:SI 5 "X"))]
4974 "TARGET_STRING && !TARGET_POWER
4975 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
4976 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
4977 [(set_attr "length" "8")])
4980 ;; Define insns that do load or store with update. Some of these we can
4981 ;; get by using pre-decrement or pre-increment, but the hardware can also
4982 ;; do cases where the increment is not the size of the object.
4984 ;; In all these cases, we use operands 0 and 1 for the register being
4985 ;; incremented because those are the operands that local-alloc will
4986 ;; tie and these are the pair most likely to be tieable (and the ones
4987 ;; that will benefit the most).
4990 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
4991 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
4992 (match_operand:DI 2 "reg_or_short_operand" "r,I"))))
4993 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
4994 (plus:DI (match_dup 1) (match_dup 2)))]
4999 [(set_attr "type" "load")])
5002 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
5004 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
5005 (match_operand:DI 2 "gpc_reg_operand" "r")))))
5006 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
5007 (plus:DI (match_dup 1) (match_dup 2)))]
5010 [(set_attr "type" "load")])
5013 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
5014 (match_operand:DI 2 "reg_or_short_operand" "r,I")))
5015 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
5016 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
5017 (plus:DI (match_dup 1) (match_dup 2)))]
5024 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
5025 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5026 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
5027 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5028 (plus:SI (match_dup 1) (match_dup 2)))]
5031 {lux|lwzux} %3,%0,%2
5032 {lu|lwzu} %3,%2(%0)"
5033 [(set_attr "type" "load")])
5036 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5037 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
5038 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
5039 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5040 (plus:SI (match_dup 1) (match_dup 2)))]
5043 {stux|stwux} %3,%0,%2
5044 {stu|stwu} %3,%2(%0)")
5047 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
5048 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5049 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
5050 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5051 (plus:SI (match_dup 1) (match_dup 2)))]
5056 [(set_attr "type" "load")])
5059 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
5061 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5062 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
5063 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5064 (plus:SI (match_dup 1) (match_dup 2)))]
5069 [(set_attr "type" "load")])
5072 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
5074 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5075 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
5076 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5077 (plus:SI (match_dup 1) (match_dup 2)))]
5082 [(set_attr "type" "load")])
5085 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5086 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
5087 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
5088 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5089 (plus:SI (match_dup 1) (match_dup 2)))]
5096 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
5097 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5098 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
5099 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5100 (plus:SI (match_dup 1) (match_dup 2)))]
5105 [(set_attr "type" "load")])
5108 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
5110 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5111 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
5112 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5113 (plus:SI (match_dup 1) (match_dup 2)))]
5118 [(set_attr "type" "load")])
5121 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5122 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
5123 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
5124 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5125 (plus:SI (match_dup 1) (match_dup 2)))]
5132 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
5133 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5134 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
5135 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5136 (plus:SI (match_dup 1) (match_dup 2)))]
5141 [(set_attr "type" "fpload")])
5144 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5145 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
5146 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
5147 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5148 (plus:SI (match_dup 1) (match_dup 2)))]
5155 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
5156 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5157 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
5158 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5159 (plus:SI (match_dup 1) (match_dup 2)))]
5164 [(set_attr "type" "fpload")])
5167 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
5168 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
5169 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
5170 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
5171 (plus:SI (match_dup 1) (match_dup 2)))]
5177 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
5180 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5181 (match_operand:DF 1 "memory_operand" ""))
5182 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
5183 (match_operand:DF 3 "memory_operand" ""))]
5185 && TARGET_HARD_FLOAT
5186 && registers_ok_for_quad_peep (operands[0], operands[2])
5187 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
5188 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
5192 [(set (match_operand:DF 0 "memory_operand" "")
5193 (match_operand:DF 1 "gpc_reg_operand" "f"))
5194 (set (match_operand:DF 2 "memory_operand" "")
5195 (match_operand:DF 3 "gpc_reg_operand" "f"))]
5197 && TARGET_HARD_FLOAT
5198 && registers_ok_for_quad_peep (operands[1], operands[3])
5199 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
5200 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
5203 ;; Next come insns related to the calling sequence.
5205 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
5206 ;; We move the back-chain and decrement the stack pointer.
5208 (define_expand "allocate_stack"
5210 (minus:SI (reg:SI 1) (match_operand:SI 0 "reg_or_short_operand" "")))]
5213 { rtx chain = gen_reg_rtx (SImode);
5214 rtx stack_bot = gen_rtx (MEM, Pmode, stack_pointer_rtx);
5216 emit_move_insn (chain, stack_bot);
5217 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, operands[0]));
5218 emit_move_insn (stack_bot, chain);
5222 ;; These patterns say how to save and restore the stack pointer. We need not
5223 ;; save the stack pointer at function level since we are careful to
5224 ;; preserve the backchain. At block level, we have to restore the backchain
5225 ;; when we restore the stack pointer.
5227 ;; For nonlocal gotos, we must save both the stack pointer and its
5228 ;; backchain and restore both. Note that in the nonlocal case, the
5229 ;; save area is a memory location.
5231 (define_expand "save_stack_function"
5232 [(use (const_int 0))]
5236 (define_expand "restore_stack_function"
5237 [(use (const_int 0))]
5241 (define_expand "restore_stack_block"
5242 [(set (match_dup 2) (mem:SI (match_operand:SI 0 "register_operand" "")))
5243 (set (match_dup 0) (match_operand:SI 1 "register_operand" ""))
5244 (set (mem:SI (match_dup 0)) (match_dup 2))]
5247 { operands[2] = gen_reg_rtx (SImode); }")
5249 (define_expand "save_stack_nonlocal"
5250 [(match_operand:DI 0 "memory_operand" "")
5251 (match_operand:SI 1 "register_operand" "")]
5255 rtx temp = gen_reg_rtx (SImode);
5257 /* Copy the backchain to the first word, sp to the second. */
5258 emit_move_insn (temp, gen_rtx (MEM, SImode, operands[1]));
5259 emit_move_insn (operand_subword (operands[0], 0, 0, DImode), temp);
5260 emit_move_insn (operand_subword (operands[0], 1, 0, DImode), operands[1]);
5264 (define_expand "restore_stack_nonlocal"
5265 [(match_operand:SI 0 "register_operand" "")
5266 (match_operand:DI 1 "memory_operand" "")]
5270 rtx temp = gen_reg_rtx (SImode);
5272 /* Restore the backchain from the first word, sp from the second. */
5273 emit_move_insn (temp, operand_subword (operands[1], 0, 0, DImode));
5274 emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, DImode));
5275 emit_move_insn (gen_rtx (MEM, SImode, operands[0]), temp);
5279 ;; A function pointer is a pointer to a data area whose first word contains
5280 ;; the actual address of the function, whose second word contains a pointer
5281 ;; to its TOC, and whose third word contains a value to place in the static
5282 ;; chain register (r11). Note that if we load the static chain, our
5283 ;; "trampoline" need not have any executable code.
5285 ;; operands[0] is an SImode pseudo in which we place the address of the
5287 ;; operands[1] is the address of data area of the function to call
5289 (define_expand "call_via_ptr"
5290 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5291 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
5292 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
5295 (mem:SI (plus:SI (match_dup 1)
5298 (mem:SI (plus:SI (match_dup 1)
5305 (define_expand "call"
5306 [(parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
5307 (match_operand 1 "" ""))
5308 (clobber (scratch:SI))])]
5312 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
5315 operands[0] = XEXP (operands[0], 0);
5316 if (GET_CODE (operands[0]) != SYMBOL_REF)
5318 #ifndef USING_SVR4_H
5319 /* AIX function pointers are really pointers to a three word area */
5320 rtx temp = gen_reg_rtx (SImode);
5322 emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[0])));
5324 #endif /* !USING_SVR4_H */
5328 (define_expand "call_value"
5329 [(parallel [(set (match_operand 0 "" "")
5330 (call (mem:SI (match_operand:SI 1 "address_operand" ""))
5331 (match_operand 2 "" "")))
5332 (clobber (scratch:SI))])]
5336 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
5339 operands[1] = XEXP (operands[1], 0);
5340 if (GET_CODE (operands[1]) != SYMBOL_REF)
5342 #ifndef USING_SVR4_H
5343 /* AIX function pointers are really pointers to a three word area */
5344 rtx temp = gen_reg_rtx (SImode);
5346 emit_insn (gen_call_via_ptr (temp, force_reg (SImode, operands[1])));
5348 #endif /* !USING_SVR4_H */
5352 ;; Call to function in current module. No TOC pointer reload needed.
5355 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s"))
5356 (match_operand 1 "" "g"))
5357 (clobber (match_scratch:SI 2 "=l"))]
5361 ;; Call to function which may be in another module. Restore the TOC
5362 ;; pointer (r2) after the call unless this is System V.
5365 [(call (mem:SI (match_operand:SI 0 "call_operand" "l,s"))
5366 (match_operand 1 "" "fg,fg"))
5367 (clobber (match_scratch:SI 2 "=l,l"))]
5371 #ifndef USING_SVR4_H
5372 if (GET_CODE (operands[0]) == REG)
5373 return \"{brl|blrl}\;{l|lwz} 2,20(1)\";
5375 return \"bl %z0\;%.\";
5378 if (GET_CODE (operands[0]) == REG)
5379 return \"{brl|blrl}\";
5384 [(set_attr "length" "8")])
5387 [(set (match_operand 0 "" "=fg")
5388 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s"))
5389 (match_operand 2 "" "g")))
5390 (clobber (match_scratch:SI 3 "=l"))]
5395 [(set (match_operand 0 "" "=fg,fg")
5396 (call (mem:SI (match_operand:SI 1 "call_operand" "l,s"))
5397 (match_operand 2 "" "fg,fg")))
5398 (clobber (match_scratch:SI 3 "=l,l"))]
5402 #ifndef USING_SVR4_H
5403 if (GET_CODE (operands[1]) == REG)
5404 return \"{brl|blrl}\;{l|lwz} 2,20(1)\";
5406 return \"bl %z1\;%.\";
5409 if (GET_CODE (operands[1]) == REG)
5410 return \"{brl|blrl}\";
5415 [(set_attr "length" "8")])
5417 ;; Call subroutine returning any type.
5419 (define_expand "untyped_call"
5420 [(parallel [(call (match_operand 0 "" "")
5422 (match_operand 1 "" "")
5423 (match_operand 2 "" "")])]
5429 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
5431 for (i = 0; i < XVECLEN (operands[2], 0); i++)
5433 rtx set = XVECEXP (operands[2], 0, i);
5434 emit_move_insn (SET_DEST (set), SET_SRC (set));
5437 /* The optimizer does not know that the call sets the function value
5438 registers we stored in the result block. We avoid problems by
5439 claiming that all hard registers are used and clobbered at this
5441 emit_insn (gen_blockage ());
5446 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
5447 ;; all of memory. This blocks insns from being moved across this point.
5449 (define_insn "blockage"
5450 [(unspec_volatile [(const_int 0)] 0)]
5454 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
5455 ;; signed & unsigned, and one type of branch.
5457 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
5458 ;; insns, and branches. We store the operands of compares until we see
5460 (define_expand "cmpsi"
5462 (compare (match_operand:SI 0 "gpc_reg_operand" "")
5463 (match_operand:SI 1 "reg_or_short_operand" "")))]
5467 /* Take care of the possibility that operands[1] might be negative but
5468 this might be a logical operation. That insn doesn't exist. */
5469 if (GET_CODE (operands[1]) == CONST_INT
5470 && INTVAL (operands[1]) < 0)
5471 operands[1] = force_reg (SImode, operands[1]);
5473 rs6000_compare_op0 = operands[0];
5474 rs6000_compare_op1 = operands[1];
5475 rs6000_compare_fp_p = 0;
5479 (define_expand "cmpsf"
5480 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
5481 (match_operand:SF 1 "gpc_reg_operand" "")))]
5485 rs6000_compare_op0 = operands[0];
5486 rs6000_compare_op1 = operands[1];
5487 rs6000_compare_fp_p = 1;
5491 (define_expand "cmpdf"
5492 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
5493 (match_operand:DF 1 "gpc_reg_operand" "")))]
5497 rs6000_compare_op0 = operands[0];
5498 rs6000_compare_op1 = operands[1];
5499 rs6000_compare_fp_p = 1;
5503 (define_expand "beq"
5504 [(set (match_dup 2) (match_dup 1))
5506 (if_then_else (eq (match_dup 2)
5508 (label_ref (match_operand 0 "" ""))
5512 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5513 operands[1] = gen_rtx (COMPARE, mode,
5514 rs6000_compare_op0, rs6000_compare_op1);
5515 operands[2] = gen_reg_rtx (mode);
5518 (define_expand "bne"
5519 [(set (match_dup 2) (match_dup 1))
5521 (if_then_else (ne (match_dup 2)
5523 (label_ref (match_operand 0 "" ""))
5527 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5528 operands[1] = gen_rtx (COMPARE, mode,
5529 rs6000_compare_op0, rs6000_compare_op1);
5530 operands[2] = gen_reg_rtx (mode);
5533 (define_expand "blt"
5534 [(set (match_dup 2) (match_dup 1))
5536 (if_then_else (lt (match_dup 2)
5538 (label_ref (match_operand 0 "" ""))
5542 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5543 operands[1] = gen_rtx (COMPARE, mode,
5544 rs6000_compare_op0, rs6000_compare_op1);
5545 operands[2] = gen_reg_rtx (mode);
5548 (define_expand "bgt"
5549 [(set (match_dup 2) (match_dup 1))
5551 (if_then_else (gt (match_dup 2)
5553 (label_ref (match_operand 0 "" ""))
5557 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5558 operands[1] = gen_rtx (COMPARE, mode,
5559 rs6000_compare_op0, rs6000_compare_op1);
5560 operands[2] = gen_reg_rtx (mode);
5563 (define_expand "ble"
5564 [(set (match_dup 2) (match_dup 1))
5566 (if_then_else (le (match_dup 2)
5568 (label_ref (match_operand 0 "" ""))
5572 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5573 operands[1] = gen_rtx (COMPARE, mode,
5574 rs6000_compare_op0, rs6000_compare_op1);
5575 operands[2] = gen_reg_rtx (mode);
5578 (define_expand "bge"
5579 [(set (match_dup 2) (match_dup 1))
5581 (if_then_else (ge (match_dup 2)
5583 (label_ref (match_operand 0 "" ""))
5587 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5588 operands[1] = gen_rtx (COMPARE, mode,
5589 rs6000_compare_op0, rs6000_compare_op1);
5590 operands[2] = gen_reg_rtx (mode);
5593 (define_expand "bgtu"
5594 [(set (match_dup 2) (match_dup 1))
5596 (if_then_else (gtu (match_dup 2)
5598 (label_ref (match_operand 0 "" ""))
5602 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
5603 rs6000_compare_op0, rs6000_compare_op1);
5604 operands[2] = gen_reg_rtx (CCUNSmode);
5607 (define_expand "bltu"
5608 [(set (match_dup 2) (match_dup 1))
5610 (if_then_else (ltu (match_dup 2)
5612 (label_ref (match_operand 0 "" ""))
5616 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
5617 rs6000_compare_op0, rs6000_compare_op1);
5618 operands[2] = gen_reg_rtx (CCUNSmode);
5621 (define_expand "bgeu"
5622 [(set (match_dup 2) (match_dup 1))
5624 (if_then_else (geu (match_dup 2)
5626 (label_ref (match_operand 0 "" ""))
5630 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
5631 rs6000_compare_op0, rs6000_compare_op1);
5632 operands[2] = gen_reg_rtx (CCUNSmode);
5635 (define_expand "bleu"
5636 [(set (match_dup 2) (match_dup 1))
5638 (if_then_else (leu (match_dup 2)
5640 (label_ref (match_operand 0 "" ""))
5644 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
5645 rs6000_compare_op0, rs6000_compare_op1);
5646 operands[2] = gen_reg_rtx (CCUNSmode);
5649 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
5650 ;; For SEQ, likewise, except that comparisons with zero should be done
5651 ;; with an scc insns. However, due to the order that combine see the
5652 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
5653 ;; the cases we don't want to handle.
5654 (define_expand "seq"
5655 [(set (match_dup 2) (match_dup 1))
5656 (set (match_operand:SI 0 "gpc_reg_operand" "")
5657 (eq:SI (match_dup 2) (const_int 0)))]
5660 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5661 operands[1] = gen_rtx (COMPARE, mode,
5662 rs6000_compare_op0, rs6000_compare_op1);
5663 operands[2] = gen_reg_rtx (mode);
5666 (define_expand "sne"
5667 [(set (match_dup 2) (match_dup 1))
5668 (set (match_operand:SI 0 "gpc_reg_operand" "")
5669 (ne:SI (match_dup 2) (const_int 0)))]
5672 { if (! rs6000_compare_fp_p)
5675 operands[1] = gen_rtx (COMPARE, CCFPmode,
5676 rs6000_compare_op0, rs6000_compare_op1);
5677 operands[2] = gen_reg_rtx (CCFPmode);
5680 ;; A > 0 is best done using the portable sequence, so fail in that case.
5681 (define_expand "sgt"
5682 [(set (match_dup 2) (match_dup 1))
5683 (set (match_operand:SI 0 "gpc_reg_operand" "")
5684 (gt:SI (match_dup 2) (const_int 0)))]
5687 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5689 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
5692 operands[1] = gen_rtx (COMPARE, mode,
5693 rs6000_compare_op0, rs6000_compare_op1);
5694 operands[2] = gen_reg_rtx (mode);
5697 ;; A < 0 is best done in the portable way for A an integer.
5698 (define_expand "slt"
5699 [(set (match_dup 2) (match_dup 1))
5700 (set (match_operand:SI 0 "gpc_reg_operand" "")
5701 (lt:SI (match_dup 2) (const_int 0)))]
5704 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5706 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
5709 operands[1] = gen_rtx (COMPARE, mode,
5710 rs6000_compare_op0, rs6000_compare_op1);
5711 operands[2] = gen_reg_rtx (mode);
5714 (define_expand "sge"
5715 [(set (match_dup 2) (match_dup 1))
5716 (set (match_operand:SI 0 "gpc_reg_operand" "")
5717 (ge:SI (match_dup 2) (const_int 0)))]
5720 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5721 operands[1] = gen_rtx (COMPARE, mode,
5722 rs6000_compare_op0, rs6000_compare_op1);
5723 operands[2] = gen_reg_rtx (mode);
5726 ;; A <= 0 is best done the portable way for A an integer.
5727 (define_expand "sle"
5728 [(set (match_dup 2) (match_dup 1))
5729 (set (match_operand:SI 0 "gpc_reg_operand" "")
5730 (le:SI (match_dup 2) (const_int 0)))]
5733 { enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
5735 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
5738 operands[1] = gen_rtx (COMPARE, mode,
5739 rs6000_compare_op0, rs6000_compare_op1);
5740 operands[2] = gen_reg_rtx (mode);
5743 (define_expand "sgtu"
5744 [(set (match_dup 2) (match_dup 1))
5745 (set (match_operand:SI 0 "gpc_reg_operand" "")
5746 (gtu:SI (match_dup 2) (const_int 0)))]
5749 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
5750 rs6000_compare_op0, rs6000_compare_op1);
5751 operands[2] = gen_reg_rtx (CCUNSmode);
5754 (define_expand "sltu"
5755 [(set (match_dup 2) (match_dup 1))
5756 (set (match_operand:SI 0 "gpc_reg_operand" "")
5757 (ltu:SI (match_dup 2) (const_int 0)))]
5760 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
5761 rs6000_compare_op0, rs6000_compare_op1);
5762 operands[2] = gen_reg_rtx (CCUNSmode);
5765 (define_expand "sgeu"
5766 [(set (match_dup 2) (match_dup 1))
5767 (set (match_operand:SI 0 "gpc_reg_operand" "")
5768 (geu:SI (match_dup 2) (const_int 0)))]
5771 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
5772 rs6000_compare_op0, rs6000_compare_op1);
5773 operands[2] = gen_reg_rtx (CCUNSmode);
5776 (define_expand "sleu"
5777 [(set (match_dup 2) (match_dup 1))
5778 (set (match_operand:SI 0 "gpc_reg_operand" "")
5779 (leu:SI (match_dup 2) (const_int 0)))]
5782 { operands[1] = gen_rtx (COMPARE, CCUNSmode,
5783 rs6000_compare_op0, rs6000_compare_op1);
5784 operands[2] = gen_reg_rtx (CCUNSmode);
5787 ;; Here are the actual compare insns.
5789 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
5790 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
5791 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
5793 "{cmp%I2|cmpw%I2} %0,%1,%2"
5794 [(set_attr "type" "compare")])
5796 ;; If we are comparing a register for equality with a large constant,
5797 ;; we can do this with an XOR followed by a compare. But we need a scratch
5798 ;; register for the result of the XOR.
5801 [(set (match_operand:CC 0 "cc_reg_operand" "")
5802 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
5803 (match_operand:SI 2 "non_short_cint_operand" "")))
5804 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
5805 "find_single_use (operands[0], insn, 0)
5806 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
5807 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
5808 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
5809 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
5812 /* Get the constant we are comparing against, C, and see what it looks like
5813 sign-extended to 16 bits. Then see what constant could be XOR'ed
5814 with C to get the sign-extended value. */
5816 int c = INTVAL (operands[2]);
5817 int sextc = (c << 16) >> 16;
5818 int xorv = c ^ sextc;
5820 operands[4] = gen_rtx (CONST_INT, VOIDmode, xorv);
5821 operands[5] = gen_rtx (CONST_INT, VOIDmode, sextc);
5825 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
5826 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
5827 (match_operand:SI 2 "reg_or_u_short_operand" "rI")))]
5829 "{cmpl%I2|cmplw%I2} %0,%1,%W2"
5830 [(set_attr "type" "compare")])
5832 ;; The following two insns don't exist as single insns, but if we provide
5833 ;; them, we can swap an add and compare, which will enable us to overlap more
5834 ;; of the required delay between a compare and branch. We generate code for
5835 ;; them by splitting.
5838 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
5839 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
5840 (match_operand:SI 2 "short_cint_operand" "i")))
5841 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
5842 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
5845 [(set_attr "length" "8")])
5848 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
5849 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
5850 (match_operand:SI 2 "u_short_cint_operand" "i")))
5851 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
5852 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
5855 [(set_attr "length" "8")])
5858 [(set (match_operand:CC 3 "cc_reg_operand" "")
5859 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
5860 (match_operand:SI 2 "short_cint_operand" "")))
5861 (set (match_operand:SI 0 "gpc_reg_operand" "")
5862 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
5864 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
5865 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
5868 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
5869 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
5870 (match_operand:SI 2 "u_short_cint_operand" "")))
5871 (set (match_operand:SI 0 "gpc_reg_operand" "")
5872 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
5874 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
5875 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
5878 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
5879 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
5880 (match_operand:SF 2 "gpc_reg_operand" "f")))]
5883 [(set_attr "type" "fpcompare")])
5886 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
5887 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
5888 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5891 [(set_attr "type" "fpcompare")])
5893 ;; Now we have the scc insns. We can do some combinations because of the
5894 ;; way the machine works.
5896 ;; Note that this is probably faster if we can put an insn between the
5897 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
5898 ;; cases the insns below which don't use an intermediate CR field will
5901 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5902 (match_operator:SI 1 "scc_comparison_operator"
5903 [(match_operand 2 "cc_reg_operand" "y")
5906 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
5907 [(set_attr "length" "12")])
5910 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5911 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
5912 [(match_operand 2 "cc_reg_operand" "y")
5915 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
5916 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
5918 "%D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1"
5919 [(set_attr "type" "delayed_compare")
5920 (set_attr "length" "12")])
5923 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5924 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
5925 [(match_operand 2 "cc_reg_operand" "y")
5927 (match_operand:SI 3 "const_int_operand" "n")))]
5931 int is_bit = ccr_bit (operands[1], 1);
5932 int put_bit = 31 - (INTVAL (operands[3]) & 31);
5935 if (is_bit >= put_bit)
5936 count = is_bit - put_bit;
5938 count = 32 - (put_bit - is_bit);
5940 operands[4] = gen_rtx (CONST_INT, VOIDmode, count);
5941 operands[5] = gen_rtx (CONST_INT, VOIDmode, put_bit);
5943 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
5945 [(set_attr "length" "12")])
5948 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
5950 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
5951 [(match_operand 2 "cc_reg_operand" "y")
5953 (match_operand:SI 3 "const_int_operand" "n"))
5955 (set (match_operand:SI 4 "gpc_reg_operand" "=r")
5956 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
5961 int is_bit = ccr_bit (operands[1], 1);
5962 int put_bit = 31 - (INTVAL (operands[3]) & 31);
5965 if (is_bit >= put_bit)
5966 count = is_bit - put_bit;
5968 count = 32 - (put_bit - is_bit);
5970 operands[5] = gen_rtx (CONST_INT, VOIDmode, count);
5971 operands[6] = gen_rtx (CONST_INT, VOIDmode, put_bit);
5973 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
5975 [(set_attr "type" "delayed_compare")
5976 (set_attr "length" "12")])
5978 ;; If we are comparing the result of two comparisons, this can be done
5979 ;; using creqv or crxor.
5982 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
5983 (compare:CCEQ (match_operator 1 "scc_comparison_operator"
5984 [(match_operand 2 "cc_reg_operand" "y")
5986 (match_operator 3 "scc_comparison_operator"
5987 [(match_operand 4 "cc_reg_operand" "y")
5989 "REGNO (operands[2]) != REGNO (operands[4])"
5992 enum rtx_code code1, code2;
5994 code1 = GET_CODE (operands[1]);
5995 code2 = GET_CODE (operands[3]);
5997 if ((code1 == EQ || code1 == LT || code1 == GT
5998 || code1 == LTU || code1 == GTU
5999 || (code1 != NE && GET_MODE (operands[2]) == CCFPmode))
6001 (code2 == EQ || code2 == LT || code2 == GT
6002 || code2 == LTU || code2 == GTU
6003 || (code2 != NE && GET_MODE (operands[4]) == CCFPmode)))
6004 return \"%C1%C3crxor %E0,%j1,%j3\";
6006 return \"%C1%C3creqv %E0,%j1,%j3\";
6008 [(set_attr "length" "12")])
6010 ;; There is a 3 cycle delay between consecutive mfcr instructions
6011 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
6014 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6015 (match_operator:SI 1 "scc_comparison_operator"
6016 [(match_operand 2 "cc_reg_operand" "y")
6018 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
6019 (match_operator:SI 4 "scc_comparison_operator"
6020 [(match_operand 5 "cc_reg_operand" "y")
6022 "REGNO (operands[2]) != REGNO (operands[5])"
6023 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
6024 [(set_attr "length" "20")])
6026 ;; There are some scc insns that can be done directly, without a compare.
6027 ;; These are faster because they don't involve the communications between
6028 ;; the FXU and branch units. In fact, we will be replacing all of the
6029 ;; integer scc insns here or in the portable methods in emit_store_flag.
6031 ;; Also support (neg (scc ..)) since that construct is used to replace
6032 ;; branches, (plus (scc ..) ..) since that construct is common and
6033 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
6034 ;; cases where it is no more expensive than (neg (scc ..)).
6036 ;; Have reload force a constant into a register for the simple insns that
6037 ;; otherwise won't accept constants. We do this because it is faster than
6038 ;; the cmp/mfcr sequence we would otherwise generate.
6041 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
6042 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
6043 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I")))
6044 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
6047 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
6048 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
6049 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
6050 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
6051 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
6052 [(set_attr "length" "12,8,12,12,12")])
6055 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x")
6057 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
6058 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
6060 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
6061 (eq:SI (match_dup 1) (match_dup 2)))
6062 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
6065 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
6066 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
6067 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
6068 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
6069 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0"
6070 [(set_attr "type" "compare")
6071 (set_attr "length" "12,8,12,12,12")])
6073 ;; We have insns of the form shown by the first define_insn below. If
6074 ;; there is something inside the comparison operation, we must split it.
6076 [(set (match_operand:SI 0 "gpc_reg_operand" "")
6077 (plus:SI (match_operator 1 "comparison_operator"
6078 [(match_operand:SI 2 "" "")
6080 "reg_or_cint_operand" "")])
6081 (match_operand:SI 4 "gpc_reg_operand" "")))
6082 (clobber (match_operand:SI 5 "register_operand" ""))]
6083 "! gpc_reg_operand (operands[2], SImode)"
6084 [(set (match_dup 5) (match_dup 2))
6085 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
6089 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
6090 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
6091 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
6092 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))
6093 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
6096 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
6097 {sfi|subfic} %4,%1,0\;{aze|addze} %0,%3
6098 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
6099 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
6100 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
6101 [(set_attr "length" "12,8,12,12,12")])
6104 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x")
6107 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
6108 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
6109 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
6111 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
6114 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
6115 {sfi|subfic} %4,%1,0\;{aze.|addze.} %0,%3
6116 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
6117 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
6118 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
6119 [(set_attr "type" "compare")
6120 (set_attr "length" "12,8,12,12,12")])
6123 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x,x,x,x")
6126 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
6127 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))
6128 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r"))
6130 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
6131 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6132 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r"))]
6135 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
6136 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
6137 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
6138 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
6139 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
6140 [(set_attr "type" "compare")
6141 (set_attr "length" "12,8,12,12,12")])
6144 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
6145 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
6146 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,J,I"))))]
6149 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
6150 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
6151 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
6152 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
6153 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
6154 [(set_attr "length" "12,8,12,12,12")])
6156 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
6157 ;; since it nabs/sr is just as fast.
6159 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6160 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
6162 (clobber (match_scratch:SI 2 "=&r"))]
6164 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
6165 [(set_attr "length" "8")])
6167 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
6169 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6170 (plus:SI (lshiftrt:SI
6171 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
6173 (match_operand:SI 2 "gpc_reg_operand" "r")))
6174 (clobber (match_scratch:SI 3 "=&r"))]
6176 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
6177 [(set_attr "length" "8")])
6180 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
6182 (plus:SI (lshiftrt:SI
6183 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
6185 (match_operand:SI 2 "gpc_reg_operand" "r"))
6187 (clobber (match_scratch:SI 3 "=&r"))]
6189 "{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2"
6190 [(set_attr "type" "compare")
6191 (set_attr "length" "8")])
6194 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
6196 (plus:SI (lshiftrt:SI
6197 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
6199 (match_operand:SI 2 "gpc_reg_operand" "r"))
6201 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6202 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
6204 (clobber (match_scratch:SI 3 "=&r"))]
6206 "{ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2"
6207 [(set_attr "type" "compare")
6208 (set_attr "length" "8")])
6211 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6212 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6213 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
6214 (clobber (match_scratch:SI 3 "=r,X"))]
6217 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
6218 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
6219 [(set_attr "length" "12")])
6222 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x")
6224 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6225 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
6227 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6228 (le:SI (match_dup 1) (match_dup 2)))
6229 (clobber (match_scratch:SI 3 "=r,X"))]
6232 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
6233 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31"
6234 [(set_attr "type" "compare,delayed_compare")
6235 (set_attr "length" "12")])
6238 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6239 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6240 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
6241 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
6242 (clobber (match_scratch:SI 4 "=&r,&r"))]
6245 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3
6246 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze|addze} %0,%3"
6247 [(set_attr "length" "12")])
6250 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
6252 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6253 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
6254 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6256 (clobber (match_scratch:SI 4 "=&r,&r"))]
6259 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
6260 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3"
6261 [(set_attr "type" "compare")
6262 (set_attr "length" "12")])
6265 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
6267 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6268 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
6269 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6271 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6272 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6273 (clobber (match_scratch:SI 4 "=&r,&r"))]
6276 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3
6277 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %0,%3"
6278 [(set_attr "type" "compare")
6279 (set_attr "length" "12")])
6282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6283 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6284 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
6287 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
6288 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
6289 [(set_attr "length" "12")])
6292 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6293 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6294 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
6296 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
6297 [(set_attr "length" "12")])
6300 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
6302 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6303 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6305 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6306 (leu:SI (match_dup 1) (match_dup 2)))]
6308 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
6309 [(set_attr "type" "compare")
6310 (set_attr "length" "12")])
6313 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6314 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6315 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6316 (match_operand:SI 3 "gpc_reg_operand" "r")))
6317 (clobber (match_scratch:SI 4 "=&r"))]
6319 "{sf%I2|subf%I2c} %4,%1,%2\;{aze|addze} %0,%3"
6320 [(set_attr "length" "8")])
6323 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
6325 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6326 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6327 (match_operand:SI 3 "gpc_reg_operand" "r"))
6329 (clobber (match_scratch:SI 4 "=&r"))]
6331 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3"
6332 [(set_attr "type" "compare")
6333 (set_attr "length" "8")])
6336 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
6338 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6339 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6340 (match_operand:SI 3 "gpc_reg_operand" "r"))
6342 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6343 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6344 (clobber (match_scratch:SI 4 "=&r"))]
6346 "{sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %0,%3"
6347 [(set_attr "type" "compare")
6348 (set_attr "length" "8")])
6351 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6352 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6353 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
6355 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
6356 [(set_attr "length" "12")])
6359 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6361 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6362 (match_operand:SI 2 "reg_or_short_operand" "rI")))
6363 (match_operand:SI 3 "gpc_reg_operand" "r")))
6364 (clobber (match_scratch:SI 4 "=&r"))]
6366 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
6367 [(set_attr "length" "12")])
6370 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
6373 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6374 (match_operand:SI 2 "reg_or_short_operand" "rI")))
6375 (match_operand:SI 3 "gpc_reg_operand" "r"))
6377 (clobber (match_scratch:SI 4 "=&r"))]
6379 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
6380 [(set_attr "type" "compare")
6381 (set_attr "length" "12")])
6384 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
6387 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6388 (match_operand:SI 2 "reg_or_short_operand" "rI")))
6389 (match_operand:SI 3 "gpc_reg_operand" "r"))
6391 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6392 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
6393 (clobber (match_scratch:SI 4 "=&r"))]
6395 "{sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
6396 [(set_attr "type" "compare")
6397 (set_attr "length" "12")])
6400 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6401 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6402 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
6404 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
6405 [(set_attr "length" "12")])
6408 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
6410 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6411 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6413 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6414 (lt:SI (match_dup 1) (match_dup 2)))]
6416 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
6417 [(set_attr "type" "delayed_compare")
6418 (set_attr "length" "12")])
6421 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6422 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6423 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6424 (match_operand:SI 3 "gpc_reg_operand" "r")))
6425 (clobber (match_scratch:SI 4 "=&r"))]
6427 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
6428 [(set_attr "length" "12")])
6431 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
6433 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6434 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6435 (match_operand:SI 3 "gpc_reg_operand" "r"))
6437 (clobber (match_scratch:SI 4 "=&r"))]
6439 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
6440 [(set_attr "type" "compare")
6441 (set_attr "length" "12")])
6444 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
6446 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6447 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6448 (match_operand:SI 3 "gpc_reg_operand" "r"))
6450 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6451 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6452 (clobber (match_scratch:SI 4 "=&r"))]
6454 "doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
6455 [(set_attr "type" "compare")
6456 (set_attr "length" "12")])
6459 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6460 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6461 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
6463 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
6464 [(set_attr "length" "12")])
6467 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6468 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6469 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
6472 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
6473 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
6474 [(set_attr "length" "12")])
6477 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
6479 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6480 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
6482 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6483 (ltu:SI (match_dup 1) (match_dup 2)))]
6486 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
6487 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
6488 [(set_attr "type" "compare")
6489 (set_attr "length" "12")])
6492 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
6493 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
6494 (match_operand:SI 2 "reg_or_neg_short_operand" "r,r,P,P"))
6495 (match_operand:SI 3 "reg_or_short_operand" "r,I,r,I")))
6496 (clobber (match_scratch:SI 4 "=&r,r,&r,r"))]
6499 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
6500 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
6501 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
6502 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
6503 [(set_attr "length" "12")])
6506 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
6508 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6509 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
6510 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6512 (clobber (match_scratch:SI 4 "=&r,&r"))]
6515 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
6516 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3"
6517 [(set_attr "type" "compare")
6518 (set_attr "length" "12")])
6521 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
6523 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6524 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
6525 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6527 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6528 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6529 (clobber (match_scratch:SI 4 "=&r,&r"))]
6532 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3
6533 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
6534 [(set_attr "type" "compare")
6535 (set_attr "length" "12")])
6538 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6539 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6540 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
6543 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
6544 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
6545 [(set_attr "length" "8")])
6548 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6549 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6550 (match_operand:SI 2 "reg_or_short_operand" "rI")))
6551 (clobber (match_scratch:SI 3 "=r"))]
6553 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
6554 [(set_attr "length" "12")])
6557 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
6559 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6560 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6562 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6563 (ge:SI (match_dup 1) (match_dup 2)))
6564 (clobber (match_scratch:SI 3 "=r"))]
6566 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3"
6567 [(set_attr "type" "compare")
6568 (set_attr "length" "12")])
6571 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6572 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6573 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6574 (match_operand:SI 3 "gpc_reg_operand" "r")))
6575 (clobber (match_scratch:SI 4 "=&r"))]
6577 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze|addze} %0,%3"
6578 [(set_attr "length" "12")])
6581 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
6583 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6584 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6585 (match_operand:SI 3 "gpc_reg_operand" "r"))
6587 (clobber (match_scratch:SI 4 "=&r"))]
6589 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3"
6590 [(set_attr "type" "compare")
6591 (set_attr "length" "12")])
6594 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
6596 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6597 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6598 (match_operand:SI 3 "gpc_reg_operand" "r"))
6600 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6601 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6602 (clobber (match_scratch:SI 4 "=&r"))]
6604 "doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %0,%3"
6605 [(set_attr "type" "compare")
6606 (set_attr "length" "12")])
6609 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6610 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6611 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
6613 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
6614 [(set_attr "length" "12")])
6616 ;; This is (and (neg (ge X (const_int 0))) Y).
6618 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6621 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
6623 (match_operand:SI 2 "gpc_reg_operand" "r")))
6624 (clobber (match_scratch:SI 3 "=&r"))]
6626 "{srai|srawi} %3,%1,31\;andc %0,%2,%3"
6627 [(set_attr "length" "8")])
6630 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
6634 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
6636 (match_operand:SI 2 "gpc_reg_operand" "r"))
6638 (clobber (match_scratch:SI 3 "=&r"))]
6640 "{srai|srawi} %3,%1,31\;andc. %3,%2,%3"
6641 [(set_attr "type" "compare")
6642 (set_attr "length" "8")])
6645 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
6649 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
6651 (match_operand:SI 2 "gpc_reg_operand" "r"))
6653 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6654 (and:SI (neg:SI (lshiftrt:SI (not:SI (match_dup 1))
6657 (clobber (match_scratch:SI 3 "=&r"))]
6659 "{srai|srawi} %3,%1,31\;andc. %0,%2,%3"
6660 [(set_attr "type" "compare")
6661 (set_attr "length" "8")])
6664 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6665 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6666 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
6669 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
6670 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
6671 [(set_attr "length" "12")])
6674 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x")
6676 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6677 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
6679 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6680 (geu:SI (match_dup 1) (match_dup 2)))]
6683 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
6684 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0"
6685 [(set_attr "type" "compare")
6686 (set_attr "length" "12")])
6689 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6690 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6691 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
6692 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
6693 (clobber (match_scratch:SI 4 "=&r,&r"))]
6696 {sf|subfc} %4,%2,%1\;{aze|addze} %0,%3
6697 {ai|addic} %4,%1,%n2\;{aze|addze} %0,%3"
6698 [(set_attr "length" "8")])
6701 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
6703 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6704 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
6705 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6707 (clobber (match_scratch:SI 4 "=&r,&r"))]
6710 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
6711 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
6712 [(set_attr "type" "compare")
6713 (set_attr "length" "8")])
6716 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
6718 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6719 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
6720 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6722 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6723 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6724 (clobber (match_scratch:SI 4 "=&r,&r"))]
6727 {sf|subfc} %4,%2,%1\;{aze.|addze.} %0,%3
6728 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3"
6729 [(set_attr "type" "compare")
6730 (set_attr "length" "8")])
6733 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6734 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6735 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
6738 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
6739 {sfi|subfic} %0,%1,-1\;a%I2 %0,%0,%2\;{sfe|subfe} %0,%0,%0"
6740 [(set_attr "length" "12")])
6743 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6745 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6746 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
6747 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
6748 (clobber (match_scratch:SI 4 "=&r,&r"))]
6751 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4
6752 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc %0,%3,%4"
6753 [(set_attr "length" "12")])
6756 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
6759 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6760 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
6761 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6763 (clobber (match_scratch:SI 4 "=&r,&r"))]
6766 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
6767 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4"
6768 [(set_attr "type" "compare")
6769 (set_attr "length" "12")])
6772 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
6775 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6776 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
6777 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6779 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6780 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
6781 (clobber (match_scratch:SI 4 "=&r,&r"))]
6784 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4
6785 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %0,%3,%4"
6786 [(set_attr "type" "compare")
6787 (set_attr "length" "12")])
6790 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6791 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6794 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
6795 [(set_attr "length" "12")])
6798 [(set (match_operand:CC 2 "cc_reg_operand" "=x")
6800 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6803 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6804 (gt:SI (match_dup 1) (const_int 0)))]
6806 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31"
6807 [(set_attr "type" "delayed_compare")
6808 (set_attr "length" "12")])
6811 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6812 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6813 (match_operand:SI 2 "reg_or_short_operand" "r")))]
6815 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
6816 [(set_attr "length" "12")])
6819 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
6821 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6822 (match_operand:SI 2 "reg_or_short_operand" "r"))
6824 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6825 (gt:SI (match_dup 1) (match_dup 2)))]
6827 "doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31"
6828 [(set_attr "type" "delayed_compare")
6829 (set_attr "length" "12")])
6832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6833 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6835 (match_operand:SI 2 "gpc_reg_operand" "r")))
6836 (clobber (match_scratch:SI 3 "=&r"))]
6838 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze|addze} %0,%2"
6839 [(set_attr "length" "12")])
6842 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
6844 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6846 (match_operand:SI 2 "gpc_reg_operand" "r"))
6848 (clobber (match_scratch:SI 3 "=&r"))]
6850 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %0,%2"
6851 [(set_attr "type" "compare")
6852 (set_attr "length" "12")])
6855 [(set (match_operand:CC 4 "cc_reg_operand" "=x")
6857 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6859 (match_operand:SI 2 "gpc_reg_operand" "r"))
6861 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6862 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
6863 (clobber (match_scratch:SI 3 "=&r"))]
6865 "{a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2"
6866 [(set_attr "type" "compare")
6867 (set_attr "length" "12")])
6870 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6871 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6872 (match_operand:SI 2 "reg_or_short_operand" "r"))
6873 (match_operand:SI 3 "gpc_reg_operand" "r")))
6874 (clobber (match_scratch:SI 4 "=&r"))]
6876 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze|addze} %0,%3"
6877 [(set_attr "length" "12")])
6880 [(set (match_operand:CC 0 "cc_reg_operand" "=x")
6882 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6883 (match_operand:SI 2 "reg_or_short_operand" "r"))
6884 (match_operand:SI 3 "gpc_reg_operand" "r"))
6886 (clobber (match_scratch:SI 4 "=&r"))]
6888 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3"
6889 [(set_attr "type" "compare")
6890 (set_attr "length" "12")])
6893 [(set (match_operand:CC 5 "cc_reg_operand" "=x")
6895 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6896 (match_operand:SI 2 "reg_or_short_operand" "r"))
6897 (match_operand:SI 3 "gpc_reg_operand" "r"))
6899 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6900 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6901 (clobber (match_scratch:SI 4 "=&r"))]
6903 "doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %0,%3"
6904 [(set_attr "type" "compare")
6905 (set_attr "length" "12")])
6908 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6909 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6912 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
6913 [(set_attr "length" "12")])
6916 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6917 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6918 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
6920 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
6921 [(set_attr "length" "12")])
6924 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6925 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6926 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
6928 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
6929 [(set_attr "length" "12")])
6932 [(set (match_operand:CC 3 "cc_reg_operand" "=x")
6934 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6935 (match_operand:SI 2 "reg_or_short_operand" "rI"))
6937 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
6938 (gtu:SI (match_dup 1) (match_dup 2)))]
6940 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0"
6941 [(set_attr "type" "compare")
6942 (set_attr "length" "12")])
6945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
6946 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
6947 (match_operand:SI 2 "reg_or_short_operand" "I,r,rI"))
6948 (match_operand:SI 3 "reg_or_short_operand" "r,r,I")))
6949 (clobber (match_scratch:SI 4 "=&r,&r,&r"))]
6952 {ai|addic} %4,%1,%k2\;{aze|addze} %0,%3
6953 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3
6954 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf%I3|subf%I3c} %0,%4,%3"
6955 [(set_attr "length" "8,12,12")])
6958 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x")
6960 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6961 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
6962 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6964 (clobber (match_scratch:SI 4 "=&r,&r"))]
6967 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
6968 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
6969 [(set_attr "type" "compare")
6970 (set_attr "length" "8,12")])
6973 [(set (match_operand:CC 5 "cc_reg_operand" "=x,x")
6975 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
6976 (match_operand:SI 2 "reg_or_short_operand" "I,r"))
6977 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
6979 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
6980 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
6981 (clobber (match_scratch:SI 4 "=&r,&r"))]
6984 {ai|addic} %4,%1,%k2\;{aze.|addze.} %0,%3
6985 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %0,%4,%3"
6986 [(set_attr "type" "compare")
6987 (set_attr "length" "8,12")])
6990 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
6991 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
6992 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
6994 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
6995 [(set_attr "length" "8")])
6997 ;; Define both directions of branch and return. If we need a reload
6998 ;; register, we'd rather use CR0 since it is much easier to copy a
6999 ;; register CC value to there.
7003 (if_then_else (match_operator 1 "branch_comparison_operator"
7005 "cc_reg_operand" "x,?y")
7007 (label_ref (match_operand 0 "" ""))
7012 if (get_attr_length (insn) == 8)
7013 return \"%C1bc %t1,%j1,%l0\";
7015 return \"%C1bc %T1,%j1,$+8\;b %l0\";
7017 [(set_attr "type" "branch")])
7021 (if_then_else (match_operator 0 "branch_comparison_operator"
7023 "cc_reg_operand" "x,?y")
7028 "{%C0bcr|%C0bclr} %t0,%j0"
7029 [(set_attr "length" "8")])
7033 (if_then_else (match_operator 1 "branch_comparison_operator"
7035 "cc_reg_operand" "x,?y")
7038 (label_ref (match_operand 0 "" ""))))]
7042 if (get_attr_length (insn) == 8)
7043 return \"%C1bc %T1,%j1,%l0\";
7045 return \"%C1bc %t1,%j1,$+8\;b %l0\";
7047 [(set_attr "type" "branch")])
7051 (if_then_else (match_operator 0 "branch_comparison_operator"
7053 "cc_reg_operand" "x,?y")
7058 "{%C0bcr|%C0bclr} %T0,%j0"
7059 [(set_attr "length" "8")])
7061 ;; Unconditional branch and return.
7065 (label_ref (match_operand 0 "" "")))]
7069 (define_insn "return"
7073 [(set_attr "type" "jmpreg")])
7075 (define_insn "indirect_jump"
7076 [(set (pc) (match_operand:SI 0 "register_operand" "c,l"))]
7081 [(set_attr "type" "jmpreg")])
7083 ;; Table jump for switch statements:
7084 (define_expand "tablejump"
7086 (plus:SI (match_operand:SI 0 "" "")
7088 (parallel [(set (pc) (match_dup 3))
7089 (use (label_ref (match_operand 1 "" "")))])]
7092 { operands[0] = force_reg (SImode, operands[0]);
7093 operands[2] = force_reg (SImode, gen_rtx (LABEL_REF, VOIDmode, operands[1]));
7094 operands[3] = gen_reg_rtx (SImode);
7099 (match_operand:SI 0 "register_operand" "c,l"))
7100 (use (label_ref (match_operand 1 "" "")))]
7105 [(set_attr "type" "jmpreg")])
7112 ;; Define the subtract-one-and-jump insns, starting with the template
7113 ;; so loop.c knows what to generate.
7115 (define_expand "decrement_and_branchsi"
7116 [(parallel [(set (pc) (if_then_else (ne (match_operand:SI 0 "register_operand" "c")
7118 (label_ref (match_operand 1 "" ""))
7120 (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))])]
7124 ;; We need to be able to do this for any operand, including MEM, or we
7125 ;; will cause reload to blow up since we don't allow output reloads on
7129 (if_then_else (ne (match_operand:SI 1 "register_operand" "2,*r,*r")
7131 (label_ref (match_operand 0 "" ""))
7133 (set (match_operand:SI 2 "register_operand" "=c,*r,m*q*c*l")
7134 (plus:SI (match_dup 1) (const_int -1)))
7135 (clobber (match_scratch:CC 3 "=X,&x,&x"))
7136 (clobber (match_scratch:SI 4 "=X,X,r"))]
7140 if (which_alternative != 0)
7142 else if (get_attr_length (insn) == 8)
7143 return \"{bdn|bdnz} %l0\";
7145 return \"bdz $+8\;b %l0\";
7147 [(set_attr "type" "branch")
7148 (set_attr "length" "*,12,16")])
7150 ;; Similar, but we can use GE since we have a REG_NONNEG.
7153 (if_then_else (ge (match_operand:SI 1 "register_operand" "2,*r,*r")
7155 (label_ref (match_operand 0 "" ""))
7157 (set (match_operand:SI 2 "register_operand" "=c,*r,m*q*c*l")
7158 (plus:SI (match_dup 1) (const_int -1)))
7159 (clobber (match_scratch:CC 3 "=X,&x,&X"))
7160 (clobber (match_scratch:SI 4 "=X,X,r"))]
7161 "find_reg_note (insn, REG_NONNEG, 0)"
7164 if (which_alternative != 0)
7166 else if (get_attr_length (insn) == 8)
7167 return \"{bdn|bdnz} %l0\";
7169 return \"bdz $+8\;b %l0\";
7171 [(set_attr "type" "branch")
7172 (set_attr "length" "*,12,16")])
7176 (if_then_else (eq (match_operand:SI 1 "register_operand" "2,*r,*r")
7178 (label_ref (match_operand 0 "" ""))
7180 (set (match_operand:SI 2 "register_operand" "=c,*r,m*q*c*l")
7181 (plus:SI (match_dup 1) (const_int -1)))
7182 (clobber (match_scratch:CC 3 "=X,&x,&x"))
7183 (clobber (match_scratch:SI 4 "=X,X,r"))]
7187 if (which_alternative != 0)
7189 else if (get_attr_length (insn) == 8)
7192 return \"{bdn|bdnz} $+8\;b %l0\";
7194 [(set_attr "type" "branch")
7195 (set_attr "length" "*,12,16")])
7199 (if_then_else (match_operator 2 "comparison_operator"
7200 [(match_operand:SI 1 "gpc_reg_operand" "")
7202 (match_operand 5 "" "")
7203 (match_operand 6 "" "")))
7204 (set (match_operand:SI 0 "gpc_reg_operand" "")
7205 (plus:SI (match_dup 1) (const_int -1)))
7206 (clobber (match_scratch:CC 3 ""))
7207 (clobber (match_scratch:SI 4 ""))]
7209 [(parallel [(set (match_dup 3)
7210 (compare:CC (plus:SI (match_dup 1) (const_int -1))
7212 (set (match_dup 0) (plus:SI (match_dup 1) (const_int -1)))])
7213 (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
7215 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
7220 (if_then_else (match_operator 2 "comparison_operator"
7221 [(match_operand:SI 1 "gpc_reg_operand" "")
7223 (match_operand 5 "" "")
7224 (match_operand 6 "" "")))
7225 (set (match_operand:SI 0 "general_operand" "")
7226 (plus:SI (match_dup 1) (const_int -1)))
7227 (clobber (match_scratch:CC 3 ""))
7228 (clobber (match_scratch:SI 4 ""))]
7229 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
7230 [(parallel [(set (match_dup 3)
7231 (compare:CC (plus:SI (match_dup 1) (const_int -1))
7233 (set (match_dup 4) (plus:SI (match_dup 1) (const_int -1)))])
7234 (set (match_dup 0) (match_dup 4))
7235 (set (pc) (if_then_else (match_dup 7) (match_dup 5) (match_dup 6)))]
7237 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],