1 ;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GNU CC.
8 ;; GNU CC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GNU CC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU CC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; `unspec' values used in rs6000.md:
27 ;; 0 frsp for POWER machines
29 ;; 5 used to tie the stack contents and the stack pointer
30 ;; 6 address of a word pointing to the TOC
31 ;; 7 address of the TOC (more-or-less)
35 ;; 15 load_macho_picbase
36 ;; 16 macho_correct_pic
40 ;; Define an insn type attribute. This is used in function unit delay
42 (define_attr "type" "integer,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,branch,cmp,fast_compare,compare,delayed_compare,fpcompare,cr_logical,delayed_cr,mfcr,mtcr,mtjmpr,fp,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,vecsimple,veccomplex,veccmp,vecperm,vecfloat"
43 (const_string "integer"))
46 ; '(pc)' in the following doesn't include the instruction itself; it is
47 ; calculated as if the instruction had zero size.
48 (define_attr "length" ""
49 (if_then_else (eq_attr "type" "branch")
50 (if_then_else (and (ge (minus (match_dup 0) (pc))
52 (lt (minus (match_dup 0) (pc))
58 ;; Processor type -- this attribute must exactly match the processor_type
59 ;; enumeration in rs6000.h.
61 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4"
62 (const (symbol_ref "rs6000_cpu_attr")))
64 (automata_option "ndfa")
78 ;; Start with fixed-point load and store insns. Here we put only the more
79 ;; complex forms. Basic data transfer is done later.
81 (define_expand "zero_extendqidi2"
82 [(set (match_operand:DI 0 "gpc_reg_operand" "")
83 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
88 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
89 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
94 [(set_attr "type" "load,*")])
97 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
98 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
100 (clobber (match_scratch:DI 2 "=r,r"))]
105 [(set_attr "type" "compare")
106 (set_attr "length" "4,8")])
109 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
110 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
112 (clobber (match_scratch:DI 2 ""))]
113 "TARGET_POWERPC64 && reload_completed"
115 (zero_extend:DI (match_dup 1)))
117 (compare:CC (match_dup 2)
122 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
123 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
125 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
126 (zero_extend:DI (match_dup 1)))]
131 [(set_attr "type" "compare")
132 (set_attr "length" "4,8")])
135 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
136 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
138 (set (match_operand:DI 0 "gpc_reg_operand" "")
139 (zero_extend:DI (match_dup 1)))]
140 "TARGET_POWERPC64 && reload_completed"
142 (zero_extend:DI (match_dup 1)))
144 (compare:CC (match_dup 0)
148 (define_insn "extendqidi2"
149 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
150 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
155 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
156 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
158 (clobber (match_scratch:DI 2 "=r,r"))]
163 [(set_attr "type" "compare")
164 (set_attr "length" "4,8")])
167 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
168 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
170 (clobber (match_scratch:DI 2 ""))]
171 "TARGET_POWERPC64 && reload_completed"
173 (sign_extend:DI (match_dup 1)))
175 (compare:CC (match_dup 2)
180 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
181 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
183 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
184 (sign_extend:DI (match_dup 1)))]
189 [(set_attr "type" "compare")
190 (set_attr "length" "4,8")])
193 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
194 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
196 (set (match_operand:DI 0 "gpc_reg_operand" "")
197 (sign_extend:DI (match_dup 1)))]
198 "TARGET_POWERPC64 && reload_completed"
200 (sign_extend:DI (match_dup 1)))
202 (compare:CC (match_dup 0)
206 (define_expand "zero_extendhidi2"
207 [(set (match_operand:DI 0 "gpc_reg_operand" "")
208 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
213 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
214 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
219 [(set_attr "type" "load,*")])
222 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
223 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
225 (clobber (match_scratch:DI 2 "=r,r"))]
230 [(set_attr "type" "compare")
231 (set_attr "length" "4,8")])
234 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
235 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
237 (clobber (match_scratch:DI 2 ""))]
238 "TARGET_POWERPC64 && reload_completed"
240 (zero_extend:DI (match_dup 1)))
242 (compare:CC (match_dup 2)
247 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
248 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
250 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
251 (zero_extend:DI (match_dup 1)))]
256 [(set_attr "type" "compare")
257 (set_attr "length" "4,8")])
260 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
261 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
263 (set (match_operand:DI 0 "gpc_reg_operand" "")
264 (zero_extend:DI (match_dup 1)))]
265 "TARGET_POWERPC64 && reload_completed"
267 (zero_extend:DI (match_dup 1)))
269 (compare:CC (match_dup 0)
273 (define_expand "extendhidi2"
274 [(set (match_operand:DI 0 "gpc_reg_operand" "")
275 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
280 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
281 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
286 [(set_attr "type" "load_ext,*")])
289 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
290 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
292 (clobber (match_scratch:DI 2 "=r,r"))]
297 [(set_attr "type" "compare")
298 (set_attr "length" "4,8")])
301 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
302 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
304 (clobber (match_scratch:DI 2 ""))]
305 "TARGET_POWERPC64 && reload_completed"
307 (sign_extend:DI (match_dup 1)))
309 (compare:CC (match_dup 2)
314 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
315 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
317 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
318 (sign_extend:DI (match_dup 1)))]
323 [(set_attr "type" "compare")
324 (set_attr "length" "4,8")])
327 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
328 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
330 (set (match_operand:DI 0 "gpc_reg_operand" "")
331 (sign_extend:DI (match_dup 1)))]
332 "TARGET_POWERPC64 && reload_completed"
334 (sign_extend:DI (match_dup 1)))
336 (compare:CC (match_dup 0)
340 (define_expand "zero_extendsidi2"
341 [(set (match_operand:DI 0 "gpc_reg_operand" "")
342 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
347 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
348 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
353 [(set_attr "type" "load,*")])
356 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
357 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
359 (clobber (match_scratch:DI 2 "=r,r"))]
364 [(set_attr "type" "compare")
365 (set_attr "length" "4,8")])
368 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
369 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
371 (clobber (match_scratch:DI 2 ""))]
372 "TARGET_POWERPC64 && reload_completed"
374 (zero_extend:DI (match_dup 1)))
376 (compare:CC (match_dup 2)
381 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
382 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
384 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
385 (zero_extend:DI (match_dup 1)))]
390 [(set_attr "type" "compare")
391 (set_attr "length" "4,8")])
394 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
395 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
397 (set (match_operand:DI 0 "gpc_reg_operand" "")
398 (zero_extend:DI (match_dup 1)))]
399 "TARGET_POWERPC64 && reload_completed"
401 (zero_extend:DI (match_dup 1)))
403 (compare:CC (match_dup 0)
407 (define_expand "extendsidi2"
408 [(set (match_operand:DI 0 "gpc_reg_operand" "")
409 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
414 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
415 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
420 [(set_attr "type" "load_ext,*")])
423 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
424 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
426 (clobber (match_scratch:DI 2 "=r,r"))]
431 [(set_attr "type" "compare")
432 (set_attr "length" "4,8")])
435 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
436 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
438 (clobber (match_scratch:DI 2 ""))]
439 "TARGET_POWERPC64 && reload_completed"
441 (sign_extend:DI (match_dup 1)))
443 (compare:CC (match_dup 2)
448 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
449 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
451 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
452 (sign_extend:DI (match_dup 1)))]
457 [(set_attr "type" "compare")
458 (set_attr "length" "4,8")])
461 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
462 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
464 (set (match_operand:DI 0 "gpc_reg_operand" "")
465 (sign_extend:DI (match_dup 1)))]
466 "TARGET_POWERPC64 && reload_completed"
468 (sign_extend:DI (match_dup 1)))
470 (compare:CC (match_dup 0)
474 (define_expand "zero_extendqisi2"
475 [(set (match_operand:SI 0 "gpc_reg_operand" "")
476 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
481 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
482 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
486 {rlinm|rlwinm} %0,%1,0,0xff"
487 [(set_attr "type" "load,*")])
490 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
491 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
493 (clobber (match_scratch:SI 2 "=r,r"))]
496 {andil.|andi.} %2,%1,0xff
498 [(set_attr "type" "compare")
499 (set_attr "length" "4,8")])
502 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
503 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
505 (clobber (match_scratch:SI 2 ""))]
508 (zero_extend:SI (match_dup 1)))
510 (compare:CC (match_dup 2)
515 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
516 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
518 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
519 (zero_extend:SI (match_dup 1)))]
522 {andil.|andi.} %0,%1,0xff
524 [(set_attr "type" "compare")
525 (set_attr "length" "4,8")])
528 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
529 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
531 (set (match_operand:SI 0 "gpc_reg_operand" "")
532 (zero_extend:SI (match_dup 1)))]
535 (zero_extend:SI (match_dup 1)))
537 (compare:CC (match_dup 0)
541 (define_expand "extendqisi2"
542 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
543 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
548 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
549 else if (TARGET_POWER)
550 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
552 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
556 (define_insn "extendqisi2_ppc"
557 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
558 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
563 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
564 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
566 (clobber (match_scratch:SI 2 "=r,r"))]
571 [(set_attr "type" "compare")
572 (set_attr "length" "4,8")])
575 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
576 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
578 (clobber (match_scratch:SI 2 ""))]
579 "TARGET_POWERPC && reload_completed"
581 (sign_extend:SI (match_dup 1)))
583 (compare:CC (match_dup 2)
588 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
589 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
591 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
592 (sign_extend:SI (match_dup 1)))]
597 [(set_attr "type" "compare")
598 (set_attr "length" "4,8")])
601 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
602 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
604 (set (match_operand:SI 0 "gpc_reg_operand" "")
605 (sign_extend:SI (match_dup 1)))]
606 "TARGET_POWERPC && reload_completed"
608 (sign_extend:SI (match_dup 1)))
610 (compare:CC (match_dup 0)
614 (define_expand "extendqisi2_power"
615 [(parallel [(set (match_dup 2)
616 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
618 (clobber (scratch:SI))])
619 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
620 (ashiftrt:SI (match_dup 2)
622 (clobber (scratch:SI))])]
625 { operands[1] = gen_lowpart (SImode, operands[1]);
626 operands[2] = gen_reg_rtx (SImode); }")
628 (define_expand "extendqisi2_no_power"
630 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
632 (set (match_operand:SI 0 "gpc_reg_operand" "")
633 (ashiftrt:SI (match_dup 2)
635 "! TARGET_POWER && ! TARGET_POWERPC"
637 { operands[1] = gen_lowpart (SImode, operands[1]);
638 operands[2] = gen_reg_rtx (SImode); }")
640 (define_expand "zero_extendqihi2"
641 [(set (match_operand:HI 0 "gpc_reg_operand" "")
642 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
647 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
648 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
652 {rlinm|rlwinm} %0,%1,0,0xff"
653 [(set_attr "type" "load,*")])
656 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
657 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
659 (clobber (match_scratch:HI 2 "=r,r"))]
662 {andil.|andi.} %2,%1,0xff
664 [(set_attr "type" "compare")
665 (set_attr "length" "4,8")])
668 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
669 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
671 (clobber (match_scratch:HI 2 ""))]
674 (zero_extend:HI (match_dup 1)))
676 (compare:CC (match_dup 2)
681 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
682 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
684 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
685 (zero_extend:HI (match_dup 1)))]
688 {andil.|andi.} %0,%1,0xff
690 [(set_attr "type" "compare")
691 (set_attr "length" "4,8")])
694 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
695 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
697 (set (match_operand:HI 0 "gpc_reg_operand" "")
698 (zero_extend:HI (match_dup 1)))]
701 (zero_extend:HI (match_dup 1)))
703 (compare:CC (match_dup 0)
707 (define_expand "extendqihi2"
708 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
709 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
714 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
715 else if (TARGET_POWER)
716 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
718 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
722 (define_insn "extendqihi2_ppc"
723 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
724 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
729 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
730 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
732 (clobber (match_scratch:HI 2 "=r,r"))]
737 [(set_attr "type" "compare")
738 (set_attr "length" "4,8")])
741 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
742 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
744 (clobber (match_scratch:HI 2 ""))]
745 "TARGET_POWERPC && reload_completed"
747 (sign_extend:HI (match_dup 1)))
749 (compare:CC (match_dup 2)
754 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
755 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
757 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
758 (sign_extend:HI (match_dup 1)))]
763 [(set_attr "type" "compare")
764 (set_attr "length" "4,8")])
767 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
768 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
770 (set (match_operand:HI 0 "gpc_reg_operand" "")
771 (sign_extend:HI (match_dup 1)))]
772 "TARGET_POWERPC && reload_completed"
774 (sign_extend:HI (match_dup 1)))
776 (compare:CC (match_dup 0)
780 (define_expand "extendqihi2_power"
781 [(parallel [(set (match_dup 2)
782 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
784 (clobber (scratch:SI))])
785 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
786 (ashiftrt:SI (match_dup 2)
788 (clobber (scratch:SI))])]
791 { operands[0] = gen_lowpart (SImode, operands[0]);
792 operands[1] = gen_lowpart (SImode, operands[1]);
793 operands[2] = gen_reg_rtx (SImode); }")
795 (define_expand "extendqihi2_no_power"
797 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
799 (set (match_operand:HI 0 "gpc_reg_operand" "")
800 (ashiftrt:SI (match_dup 2)
802 "! TARGET_POWER && ! TARGET_POWERPC"
804 { operands[0] = gen_lowpart (SImode, operands[0]);
805 operands[1] = gen_lowpart (SImode, operands[1]);
806 operands[2] = gen_reg_rtx (SImode); }")
808 (define_expand "zero_extendhisi2"
809 [(set (match_operand:SI 0 "gpc_reg_operand" "")
810 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
815 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
816 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
820 {rlinm|rlwinm} %0,%1,0,0xffff"
821 [(set_attr "type" "load,*")])
824 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
825 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
827 (clobber (match_scratch:SI 2 "=r,r"))]
830 {andil.|andi.} %2,%1,0xffff
832 [(set_attr "type" "compare")
833 (set_attr "length" "4,8")])
836 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
837 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
839 (clobber (match_scratch:SI 2 ""))]
842 (zero_extend:SI (match_dup 1)))
844 (compare:CC (match_dup 2)
849 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
850 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
852 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
853 (zero_extend:SI (match_dup 1)))]
856 {andil.|andi.} %0,%1,0xffff
858 [(set_attr "type" "compare")
859 (set_attr "length" "4,8")])
862 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
863 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
865 (set (match_operand:SI 0 "gpc_reg_operand" "")
866 (zero_extend:SI (match_dup 1)))]
869 (zero_extend:SI (match_dup 1)))
871 (compare:CC (match_dup 0)
875 (define_expand "extendhisi2"
876 [(set (match_operand:SI 0 "gpc_reg_operand" "")
877 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
882 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
883 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
888 [(set_attr "type" "load_ext,*")])
891 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
892 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
894 (clobber (match_scratch:SI 2 "=r,r"))]
899 [(set_attr "type" "compare")
900 (set_attr "length" "4,8")])
903 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
904 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
906 (clobber (match_scratch:SI 2 ""))]
909 (sign_extend:SI (match_dup 1)))
911 (compare:CC (match_dup 2)
916 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
917 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
919 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
920 (sign_extend:SI (match_dup 1)))]
925 [(set_attr "type" "compare")
926 (set_attr "length" "4,8")])
929 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
930 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
932 (set (match_operand:SI 0 "gpc_reg_operand" "")
933 (sign_extend:SI (match_dup 1)))]
936 (sign_extend:SI (match_dup 1)))
938 (compare:CC (match_dup 0)
942 ;; Fixed-point arithmetic insns.
944 ;; Discourage ai/addic because of carry but provide it in an alternative
945 ;; allowing register zero as source.
946 (define_expand "addsi3"
947 [(set (match_operand:SI 0 "gpc_reg_operand" "")
948 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
949 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
953 if (GET_CODE (operands[2]) == CONST_INT
954 && ! add_operand (operands[2], SImode))
956 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
957 ? operands[0] : gen_reg_rtx (SImode));
959 HOST_WIDE_INT val = INTVAL (operands[2]);
960 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
961 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
963 /* The ordering here is important for the prolog expander.
964 When space is allocated from the stack, adding 'low' first may
965 produce a temporary deallocation (which would be bad). */
966 emit_insn (gen_addsi3 (tmp, operands[1], GEN_INT (rest)));
967 emit_insn (gen_addsi3 (operands[0], tmp, GEN_INT (low)));
972 (define_insn "*addsi3_internal1"
973 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,?r,r")
974 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,b,r,b")
975 (match_operand:SI 2 "add_operand" "r,I,I,L")))]
979 {cal %0,%2(%1)|addi %0,%1,%2}
981 {cau|addis} %0,%1,%v2"
982 [(set_attr "length" "4,4,4,4")])
984 (define_insn "addsi3_high"
985 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
986 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
987 (high:SI (match_operand 2 "" ""))))]
988 "TARGET_MACHO && !TARGET_64BIT"
989 "{cau|addis} %0,%1,ha16(%2)"
990 [(set_attr "length" "4")])
992 (define_insn "*addsi3_internal2"
993 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
994 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
995 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
997 (clobber (match_scratch:SI 3 "=r,r,r,r"))]
1000 {cax.|add.} %3,%1,%2
1001 {ai.|addic.} %3,%1,%2
1004 [(set_attr "type" "fast_compare,compare,compare,compare")
1005 (set_attr "length" "4,4,8,8")])
1008 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1009 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1010 (match_operand:SI 2 "reg_or_short_operand" ""))
1012 (clobber (match_scratch:SI 3 ""))]
1013 "! TARGET_POWERPC64 && reload_completed"
1015 (plus:SI (match_dup 1)
1018 (compare:CC (match_dup 3)
1022 (define_insn "*addsi3_internal3"
1023 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1024 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
1025 (match_operand:SI 2 "reg_or_short_operand" "r,I,r,I"))
1027 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
1028 (plus:SI (match_dup 1)
1030 "! TARGET_POWERPC64"
1032 {cax.|add.} %0,%1,%2
1033 {ai.|addic.} %0,%1,%2
1036 [(set_attr "type" "fast_compare,compare,compare,compare")
1037 (set_attr "length" "4,4,8,8")])
1040 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1041 (compare:CC (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1042 (match_operand:SI 2 "reg_or_short_operand" ""))
1044 (set (match_operand:SI 0 "gpc_reg_operand" "")
1045 (plus:SI (match_dup 1) (match_dup 2)))]
1046 "! TARGET_POWERPC64 && reload_completed"
1048 (plus:SI (match_dup 1)
1051 (compare:CC (match_dup 0)
1055 ;; Split an add that we can't do in one insn into two insns, each of which
1056 ;; does one 16-bit part. This is used by combine. Note that the low-order
1057 ;; add should be last in case the result gets used in an address.
1060 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1061 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1062 (match_operand:SI 2 "non_add_cint_operand" "")))]
1064 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
1065 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
1068 HOST_WIDE_INT val = INTVAL (operands[2]);
1069 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1070 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, SImode);
1072 operands[3] = GEN_INT (rest);
1073 operands[4] = GEN_INT (low);
1076 (define_insn "one_cmplsi2"
1077 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1078 (not:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1083 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1084 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1086 (clobber (match_scratch:SI 2 "=r,r"))]
1087 "! TARGET_POWERPC64"
1091 [(set_attr "type" "compare")
1092 (set_attr "length" "4,8")])
1095 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1096 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1098 (clobber (match_scratch:SI 2 ""))]
1099 "! TARGET_POWERPC64 && reload_completed"
1101 (not:SI (match_dup 1)))
1103 (compare:CC (match_dup 2)
1108 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1109 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1111 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1112 (not:SI (match_dup 1)))]
1113 "! TARGET_POWERPC64"
1117 [(set_attr "type" "compare")
1118 (set_attr "length" "4,8")])
1121 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1122 (compare:CC (not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1124 (set (match_operand:SI 0 "gpc_reg_operand" "")
1125 (not:SI (match_dup 1)))]
1126 "! TARGET_POWERPC64 && reload_completed"
1128 (not:SI (match_dup 1)))
1130 (compare:CC (match_dup 0)
1135 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1136 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1137 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1139 "{sf%I1|subf%I1c} %0,%2,%1")
1142 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1143 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "r,I")
1144 (match_operand:SI 2 "gpc_reg_operand" "r,r")))]
1151 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1152 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1153 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1155 (clobber (match_scratch:SI 3 "=r,r"))]
1158 {sf.|subfc.} %3,%2,%1
1160 [(set_attr "type" "compare")
1161 (set_attr "length" "4,8")])
1164 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1165 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1166 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1168 (clobber (match_scratch:SI 3 "=r,r"))]
1169 "TARGET_POWERPC && ! TARGET_POWERPC64"
1173 [(set_attr "type" "fast_compare")
1174 (set_attr "length" "4,8")])
1177 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1178 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1179 (match_operand:SI 2 "gpc_reg_operand" ""))
1181 (clobber (match_scratch:SI 3 ""))]
1182 "! TARGET_POWERPC64 && reload_completed"
1184 (minus:SI (match_dup 1)
1187 (compare:CC (match_dup 3)
1192 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1193 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1194 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1196 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1197 (minus:SI (match_dup 1) (match_dup 2)))]
1200 {sf.|subfc.} %0,%2,%1
1202 [(set_attr "type" "compare")
1203 (set_attr "length" "4,8")])
1206 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1207 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1208 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1210 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1211 (minus:SI (match_dup 1)
1213 "TARGET_POWERPC && ! TARGET_POWERPC64"
1217 [(set_attr "type" "fast_compare")
1218 (set_attr "length" "4,8")])
1221 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1222 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "")
1223 (match_operand:SI 2 "gpc_reg_operand" ""))
1225 (set (match_operand:SI 0 "gpc_reg_operand" "")
1226 (minus:SI (match_dup 1)
1228 "! TARGET_POWERPC64 && reload_completed"
1230 (minus:SI (match_dup 1)
1233 (compare:CC (match_dup 0)
1237 (define_expand "subsi3"
1238 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1239 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
1240 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
1244 if (GET_CODE (operands[2]) == CONST_INT)
1246 emit_insn (gen_addsi3 (operands[0], operands[1],
1247 negate_rtx (SImode, operands[2])));
1252 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1253 ;; instruction and some auxiliary computations. Then we just have a single
1254 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1257 (define_expand "sminsi3"
1259 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1260 (match_operand:SI 2 "reg_or_short_operand" ""))
1262 (minus:SI (match_dup 2) (match_dup 1))))
1263 (set (match_operand:SI 0 "gpc_reg_operand" "")
1264 (minus:SI (match_dup 2) (match_dup 3)))]
1265 "TARGET_POWER || TARGET_ISEL"
1270 operands[2] = force_reg (SImode, operands[2]);
1271 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1275 operands[3] = gen_reg_rtx (SImode);
1279 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1280 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1281 (match_operand:SI 2 "reg_or_short_operand" "")))
1282 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1285 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1287 (minus:SI (match_dup 2) (match_dup 1))))
1288 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1291 (define_expand "smaxsi3"
1293 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1294 (match_operand:SI 2 "reg_or_short_operand" ""))
1296 (minus:SI (match_dup 2) (match_dup 1))))
1297 (set (match_operand:SI 0 "gpc_reg_operand" "")
1298 (plus:SI (match_dup 3) (match_dup 1)))]
1299 "TARGET_POWER || TARGET_ISEL"
1304 operands[2] = force_reg (SImode, operands[2]);
1305 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1308 operands[3] = gen_reg_rtx (SImode);
1312 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1313 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1314 (match_operand:SI 2 "reg_or_short_operand" "")))
1315 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1318 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1320 (minus:SI (match_dup 2) (match_dup 1))))
1321 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1324 (define_expand "uminsi3"
1325 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1327 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1329 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1331 (minus:SI (match_dup 4) (match_dup 3))))
1332 (set (match_operand:SI 0 "gpc_reg_operand" "")
1333 (minus:SI (match_dup 2) (match_dup 3)))]
1334 "TARGET_POWER || TARGET_ISEL"
1339 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1342 operands[3] = gen_reg_rtx (SImode);
1343 operands[4] = gen_reg_rtx (SImode);
1344 operands[5] = GEN_INT (-2147483647 - 1);
1347 (define_expand "umaxsi3"
1348 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1350 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1352 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1354 (minus:SI (match_dup 4) (match_dup 3))))
1355 (set (match_operand:SI 0 "gpc_reg_operand" "")
1356 (plus:SI (match_dup 3) (match_dup 1)))]
1357 "TARGET_POWER || TARGET_ISEL"
1362 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1365 operands[3] = gen_reg_rtx (SImode);
1366 operands[4] = gen_reg_rtx (SImode);
1367 operands[5] = GEN_INT (-2147483647 - 1);
1371 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1372 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1373 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1375 (minus:SI (match_dup 2) (match_dup 1))))]
1380 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1382 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1383 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1385 (minus:SI (match_dup 2) (match_dup 1)))
1387 (clobber (match_scratch:SI 3 "=r,r"))]
1392 [(set_attr "type" "delayed_compare")
1393 (set_attr "length" "4,8")])
1396 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1398 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1399 (match_operand:SI 2 "reg_or_short_operand" ""))
1401 (minus:SI (match_dup 2) (match_dup 1)))
1403 (clobber (match_scratch:SI 3 ""))]
1404 "TARGET_POWER && reload_completed"
1406 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1408 (minus:SI (match_dup 2) (match_dup 1))))
1410 (compare:CC (match_dup 3)
1415 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1417 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1418 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1420 (minus:SI (match_dup 2) (match_dup 1)))
1422 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1423 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1425 (minus:SI (match_dup 2) (match_dup 1))))]
1430 [(set_attr "type" "delayed_compare")
1431 (set_attr "length" "4,8")])
1434 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1436 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1437 (match_operand:SI 2 "reg_or_short_operand" ""))
1439 (minus:SI (match_dup 2) (match_dup 1)))
1441 (set (match_operand:SI 0 "gpc_reg_operand" "")
1442 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1444 (minus:SI (match_dup 2) (match_dup 1))))]
1445 "TARGET_POWER && reload_completed"
1447 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1449 (minus:SI (match_dup 2) (match_dup 1))))
1451 (compare:CC (match_dup 0)
1455 ;; We don't need abs with condition code because such comparisons should
1457 (define_expand "abssi2"
1458 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1459 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1465 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1468 else if (! TARGET_POWER)
1470 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1475 (define_insn "*abssi2_power"
1476 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1477 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1481 (define_insn_and_split "abssi2_isel"
1482 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1483 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1484 (clobber (match_scratch:SI 2 "=b"))
1485 (clobber (match_scratch:CC 3 "=y"))]
1488 "&& reload_completed"
1489 [(set (match_dup 2) (neg:SI (match_dup 1)))
1491 (compare:CC (match_dup 1)
1494 (if_then_else:SI (ge (match_dup 3)
1500 (define_insn_and_split "abssi2_nopower"
1501 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1502 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1503 (clobber (match_scratch:SI 2 "=&r,&r"))]
1504 "! TARGET_POWER && ! TARGET_ISEL"
1506 "&& reload_completed"
1507 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1508 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1509 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1512 (define_insn "*nabs_power"
1513 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1514 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1518 (define_insn_and_split "*nabs_nopower"
1519 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1520 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1521 (clobber (match_scratch:SI 2 "=&r,&r"))]
1524 "&& reload_completed"
1525 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1526 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1527 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1530 (define_insn "negsi2"
1531 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1532 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1537 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1538 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1540 (clobber (match_scratch:SI 2 "=r,r"))]
1541 "! TARGET_POWERPC64"
1545 [(set_attr "type" "fast_compare")
1546 (set_attr "length" "4,8")])
1549 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1550 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1552 (clobber (match_scratch:SI 2 ""))]
1553 "! TARGET_POWERPC64 && reload_completed"
1555 (neg:SI (match_dup 1)))
1557 (compare:CC (match_dup 2)
1562 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1563 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
1565 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1566 (neg:SI (match_dup 1)))]
1567 "! TARGET_POWERPC64"
1571 [(set_attr "type" "fast_compare")
1572 (set_attr "length" "4,8")])
1575 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1576 (compare:CC (neg:SI (match_operand:SI 1 "gpc_reg_operand" ""))
1578 (set (match_operand:SI 0 "gpc_reg_operand" "")
1579 (neg:SI (match_dup 1)))]
1580 "! TARGET_POWERPC64 && reload_completed"
1582 (neg:SI (match_dup 1)))
1584 (compare:CC (match_dup 0)
1588 (define_insn "clzsi2"
1589 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1590 (clz:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1592 "{cntlz|cntlzw} %0,%1")
1594 (define_expand "ctzsi2"
1596 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1597 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1599 (clobber (scratch:CC))])
1600 (set (match_dup 4) (clz:SI (match_dup 3)))
1601 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1602 (minus:SI (const_int 31) (match_dup 4)))]
1605 operands[2] = gen_reg_rtx (SImode);
1606 operands[3] = gen_reg_rtx (SImode);
1607 operands[4] = gen_reg_rtx (SImode);
1610 (define_expand "ffssi2"
1612 (neg:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
1613 (parallel [(set (match_dup 3) (and:SI (match_dup 1)
1615 (clobber (scratch:CC))])
1616 (set (match_dup 4) (clz:SI (match_dup 3)))
1617 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
1618 (minus:SI (const_int 32) (match_dup 4)))]
1621 operands[2] = gen_reg_rtx (SImode);
1622 operands[3] = gen_reg_rtx (SImode);
1623 operands[4] = gen_reg_rtx (SImode);
1626 (define_expand "mulsi3"
1627 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1628 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1629 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1634 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1636 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1640 (define_insn "mulsi3_mq"
1641 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1642 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1643 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1644 (clobber (match_scratch:SI 3 "=q,q"))]
1647 {muls|mullw} %0,%1,%2
1648 {muli|mulli} %0,%1,%2"
1650 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1651 (const_string "imul3")
1652 (match_operand:SI 2 "short_cint_operand" "")
1653 (const_string "imul2")]
1654 (const_string "imul")))])
1656 (define_insn "mulsi3_no_mq"
1657 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1658 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1659 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1662 {muls|mullw} %0,%1,%2
1663 {muli|mulli} %0,%1,%2"
1665 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1666 (const_string "imul3")
1667 (match_operand:SI 2 "short_cint_operand" "")
1668 (const_string "imul2")]
1669 (const_string "imul")))])
1672 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1673 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1674 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1676 (clobber (match_scratch:SI 3 "=r,r"))
1677 (clobber (match_scratch:SI 4 "=q,q"))]
1680 {muls.|mullw.} %3,%1,%2
1682 [(set_attr "type" "delayed_compare")
1683 (set_attr "length" "4,8")])
1686 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1687 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1688 (match_operand:SI 2 "gpc_reg_operand" ""))
1690 (clobber (match_scratch:SI 3 ""))
1691 (clobber (match_scratch:SI 4 ""))]
1692 "TARGET_POWER && reload_completed"
1693 [(parallel [(set (match_dup 3)
1694 (mult:SI (match_dup 1) (match_dup 2)))
1695 (clobber (match_dup 4))])
1697 (compare:CC (match_dup 3)
1702 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1703 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1704 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1706 (clobber (match_scratch:SI 3 "=r,r"))]
1709 {muls.|mullw.} %3,%1,%2
1711 [(set_attr "type" "delayed_compare")
1712 (set_attr "length" "4,8")])
1715 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1716 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1717 (match_operand:SI 2 "gpc_reg_operand" ""))
1719 (clobber (match_scratch:SI 3 ""))]
1720 "! TARGET_POWER && reload_completed"
1722 (mult:SI (match_dup 1) (match_dup 2)))
1724 (compare:CC (match_dup 3)
1729 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1730 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1731 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1733 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1734 (mult:SI (match_dup 1) (match_dup 2)))
1735 (clobber (match_scratch:SI 4 "=q,q"))]
1738 {muls.|mullw.} %0,%1,%2
1740 [(set_attr "type" "delayed_compare")
1741 (set_attr "length" "4,8")])
1744 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1745 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1746 (match_operand:SI 2 "gpc_reg_operand" ""))
1748 (set (match_operand:SI 0 "gpc_reg_operand" "")
1749 (mult:SI (match_dup 1) (match_dup 2)))
1750 (clobber (match_scratch:SI 4 ""))]
1751 "TARGET_POWER && reload_completed"
1752 [(parallel [(set (match_dup 0)
1753 (mult:SI (match_dup 1) (match_dup 2)))
1754 (clobber (match_dup 4))])
1756 (compare:CC (match_dup 0)
1761 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1762 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1763 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1765 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1766 (mult:SI (match_dup 1) (match_dup 2)))]
1769 {muls.|mullw.} %0,%1,%2
1771 [(set_attr "type" "delayed_compare")
1772 (set_attr "length" "4,8")])
1775 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1776 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1777 (match_operand:SI 2 "gpc_reg_operand" ""))
1779 (set (match_operand:SI 0 "gpc_reg_operand" "")
1780 (mult:SI (match_dup 1) (match_dup 2)))]
1781 "! TARGET_POWER && reload_completed"
1783 (mult:SI (match_dup 1) (match_dup 2)))
1785 (compare:CC (match_dup 0)
1789 ;; Operand 1 is divided by operand 2; quotient goes to operand
1790 ;; 0 and remainder to operand 3.
1791 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1793 (define_expand "divmodsi4"
1794 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1795 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1796 (match_operand:SI 2 "gpc_reg_operand" "")))
1797 (set (match_operand:SI 3 "register_operand" "")
1798 (mod:SI (match_dup 1) (match_dup 2)))])]
1799 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1802 if (! TARGET_POWER && ! TARGET_POWERPC)
1804 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1805 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1806 emit_insn (gen_divss_call ());
1807 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1808 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1813 (define_insn "*divmodsi4_internal"
1814 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1815 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1816 (match_operand:SI 2 "gpc_reg_operand" "r")))
1817 (set (match_operand:SI 3 "register_operand" "=q")
1818 (mod:SI (match_dup 1) (match_dup 2)))]
1821 [(set_attr "type" "idiv")])
1823 (define_expand "udivsi3"
1824 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1825 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
1826 (match_operand:SI 2 "gpc_reg_operand" "")))]
1827 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1830 if (! TARGET_POWER && ! TARGET_POWERPC)
1832 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1833 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1834 emit_insn (gen_quous_call ());
1835 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1838 else if (TARGET_POWER)
1840 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1845 (define_insn "udivsi3_mq"
1846 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1847 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1848 (match_operand:SI 2 "gpc_reg_operand" "r")))
1849 (clobber (match_scratch:SI 3 "=q"))]
1850 "TARGET_POWERPC && TARGET_POWER"
1852 [(set_attr "type" "idiv")])
1854 (define_insn "*udivsi3_no_mq"
1855 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1856 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1857 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1858 "TARGET_POWERPC && ! TARGET_POWER"
1860 [(set_attr "type" "idiv")])
1862 ;; For powers of two we can do srai/aze for divide and then adjust for
1863 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1864 ;; used; for PowerPC, force operands into register and do a normal divide;
1865 ;; for AIX common-mode, use quoss call on register operands.
1866 (define_expand "divsi3"
1867 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1868 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1869 (match_operand:SI 2 "reg_or_cint_operand" "")))]
1873 if (GET_CODE (operands[2]) == CONST_INT
1874 && INTVAL (operands[2]) > 0
1875 && exact_log2 (INTVAL (operands[2])) >= 0)
1877 else if (TARGET_POWERPC)
1879 operands[2] = force_reg (SImode, operands[2]);
1882 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
1886 else if (TARGET_POWER)
1890 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1891 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1892 emit_insn (gen_quoss_call ());
1893 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1898 (define_insn "divsi3_mq"
1899 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1900 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1901 (match_operand:SI 2 "gpc_reg_operand" "r")))
1902 (clobber (match_scratch:SI 3 "=q"))]
1903 "TARGET_POWERPC && TARGET_POWER"
1905 [(set_attr "type" "idiv")])
1907 (define_insn "*divsi3_no_mq"
1908 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1909 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1910 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1911 "TARGET_POWERPC && ! TARGET_POWER"
1913 [(set_attr "type" "idiv")])
1915 (define_expand "modsi3"
1916 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1917 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1918 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
1926 if (GET_CODE (operands[2]) != CONST_INT
1927 || INTVAL (operands[2]) <= 0
1928 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
1931 temp1 = gen_reg_rtx (SImode);
1932 temp2 = gen_reg_rtx (SImode);
1934 emit_insn (gen_divsi3 (temp1, operands[1], operands[2]));
1935 emit_insn (gen_ashlsi3 (temp2, temp1, GEN_INT (i)));
1936 emit_insn (gen_subsi3 (operands[0], operands[1], temp2));
1941 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1942 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1943 (match_operand:SI 2 "exact_log2_cint_operand" "N")))]
1945 "{srai|srawi} %0,%1,%p2\;{aze|addze} %0,%0"
1946 [(set_attr "length" "8")])
1949 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1950 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1951 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1953 (clobber (match_scratch:SI 3 "=r,r"))]
1956 {srai|srawi} %3,%1,%p2\;{aze.|addze.} %3,%3
1958 [(set_attr "type" "compare")
1959 (set_attr "length" "8,12")])
1962 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1963 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1964 (match_operand:SI 2 "exact_log2_cint_operand" ""))
1966 (clobber (match_scratch:SI 3 ""))]
1969 (div:SI (match_dup 1) (match_dup 2)))
1971 (compare:CC (match_dup 3)
1976 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1977 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1978 (match_operand:SI 2 "exact_log2_cint_operand" "N,N"))
1980 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1981 (div:SI (match_dup 1) (match_dup 2)))]
1984 {srai|srawi} %0,%1,%p2\;{aze.|addze.} %0,%0
1986 [(set_attr "type" "compare")
1987 (set_attr "length" "8,12")])
1990 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1991 (compare:CC (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1992 (match_operand:SI 2 "exact_log2_cint_operand" ""))
1994 (set (match_operand:SI 0 "gpc_reg_operand" "")
1995 (div:SI (match_dup 1) (match_dup 2)))]
1998 (div:SI (match_dup 1) (match_dup 2)))
2000 (compare:CC (match_dup 0)
2005 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2008 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2010 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2011 (match_operand:SI 3 "gpc_reg_operand" "r")))
2012 (set (match_operand:SI 2 "register_operand" "=*q")
2015 (zero_extend:DI (match_dup 1)) (const_int 32))
2016 (zero_extend:DI (match_dup 4)))
2020 [(set_attr "type" "idiv")])
2022 ;; To do unsigned divide we handle the cases of the divisor looking like a
2023 ;; negative number. If it is a constant that is less than 2**31, we don't
2024 ;; have to worry about the branches. So make a few subroutines here.
2026 ;; First comes the normal case.
2027 (define_expand "udivmodsi4_normal"
2028 [(set (match_dup 4) (const_int 0))
2029 (parallel [(set (match_operand:SI 0 "" "")
2030 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2032 (zero_extend:DI (match_operand:SI 1 "" "")))
2033 (match_operand:SI 2 "" "")))
2034 (set (match_operand:SI 3 "" "")
2035 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2037 (zero_extend:DI (match_dup 1)))
2041 { operands[4] = gen_reg_rtx (SImode); }")
2043 ;; This handles the branches.
2044 (define_expand "udivmodsi4_tests"
2045 [(set (match_operand:SI 0 "" "") (const_int 0))
2046 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2047 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2048 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2049 (label_ref (match_operand:SI 4 "" "")) (pc)))
2050 (set (match_dup 0) (const_int 1))
2051 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2052 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2053 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2054 (label_ref (match_dup 4)) (pc)))]
2057 { operands[5] = gen_reg_rtx (CCUNSmode);
2058 operands[6] = gen_reg_rtx (CCmode);
2061 (define_expand "udivmodsi4"
2062 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2063 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2064 (match_operand:SI 2 "reg_or_cint_operand" "")))
2065 (set (match_operand:SI 3 "gpc_reg_operand" "")
2066 (umod:SI (match_dup 1) (match_dup 2)))])]
2074 if (! TARGET_POWERPC)
2076 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2077 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2078 emit_insn (gen_divus_call ());
2079 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2080 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2087 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2089 operands[2] = force_reg (SImode, operands[2]);
2090 label = gen_label_rtx ();
2091 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2092 operands[3], label));
2095 operands[2] = force_reg (SImode, operands[2]);
2097 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2105 ;; AIX architecture-independent common-mode multiply (DImode),
2106 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2107 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2108 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2109 ;; assumed unused if generating common-mode, so ignore.
2110 (define_insn "mulh_call"
2113 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2114 (sign_extend:DI (reg:SI 4)))
2116 (clobber (match_scratch:SI 0 "=l"))]
2117 "! TARGET_POWER && ! TARGET_POWERPC"
2119 [(set_attr "type" "imul")])
2121 (define_insn "mull_call"
2123 (mult:DI (sign_extend:DI (reg:SI 3))
2124 (sign_extend:DI (reg:SI 4))))
2125 (clobber (match_scratch:SI 0 "=l"))
2126 (clobber (reg:SI 0))]
2127 "! TARGET_POWER && ! TARGET_POWERPC"
2129 [(set_attr "type" "imul")])
2131 (define_insn "divss_call"
2133 (div:SI (reg:SI 3) (reg:SI 4)))
2135 (mod:SI (reg:SI 3) (reg:SI 4)))
2136 (clobber (match_scratch:SI 0 "=l"))
2137 (clobber (reg:SI 0))]
2138 "! TARGET_POWER && ! TARGET_POWERPC"
2140 [(set_attr "type" "idiv")])
2142 (define_insn "divus_call"
2144 (udiv:SI (reg:SI 3) (reg:SI 4)))
2146 (umod:SI (reg:SI 3) (reg:SI 4)))
2147 (clobber (match_scratch:SI 0 "=l"))
2148 (clobber (reg:SI 0))
2149 (clobber (match_scratch:CC 1 "=x"))
2150 (clobber (reg:CC 69))]
2151 "! TARGET_POWER && ! TARGET_POWERPC"
2153 [(set_attr "type" "idiv")])
2155 (define_insn "quoss_call"
2157 (div:SI (reg:SI 3) (reg:SI 4)))
2158 (clobber (match_scratch:SI 0 "=l"))]
2159 "! TARGET_POWER && ! TARGET_POWERPC"
2161 [(set_attr "type" "idiv")])
2163 (define_insn "quous_call"
2165 (udiv:SI (reg:SI 3) (reg:SI 4)))
2166 (clobber (match_scratch:SI 0 "=l"))
2167 (clobber (reg:SI 0))
2168 (clobber (match_scratch:CC 1 "=x"))
2169 (clobber (reg:CC 69))]
2170 "! TARGET_POWER && ! TARGET_POWERPC"
2172 [(set_attr "type" "idiv")])
2174 ;; Logical instructions
2175 ;; The logical instructions are mostly combined by using match_operator,
2176 ;; but the plain AND insns are somewhat different because there is no
2177 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2178 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2180 (define_insn "andsi3"
2181 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2182 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2183 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2184 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2188 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2189 {andil.|andi.} %0,%1,%b2
2190 {andiu.|andis.} %0,%1,%u2")
2192 ;; Note to set cr's other than cr0 we do the and immediate and then
2193 ;; the test again -- this avoids a mfcr which on the higher end
2194 ;; machines causes an execution serialization
2196 (define_insn "*andsi3_internal2"
2197 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2198 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2199 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2201 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2202 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2203 "! TARGET_POWERPC64"
2206 {andil.|andi.} %3,%1,%b2
2207 {andiu.|andis.} %3,%1,%u2
2208 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2213 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2214 (set_attr "length" "4,4,4,4,8,8,8,8")])
2216 (define_insn "*andsi3_internal3"
2217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2218 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2219 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2221 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2222 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2226 {andil.|andi.} %3,%1,%b2
2227 {andiu.|andis.} %3,%1,%u2
2228 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2233 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2234 (set_attr "length" "8,4,4,4,8,8,8,8")])
2237 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2238 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2239 (match_operand:SI 2 "and_operand" ""))
2241 (clobber (match_scratch:SI 3 ""))
2242 (clobber (match_scratch:CC 4 ""))]
2244 [(parallel [(set (match_dup 3)
2245 (and:SI (match_dup 1)
2247 (clobber (match_dup 4))])
2249 (compare:CC (match_dup 3)
2253 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2254 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2257 [(set (match_operand:CC 0 "cc_reg_operand" "")
2258 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2259 (match_operand:SI 2 "gpc_reg_operand" ""))
2261 (clobber (match_scratch:SI 3 ""))
2262 (clobber (match_scratch:CC 4 ""))]
2263 "TARGET_POWERPC64 && reload_completed"
2264 [(parallel [(set (match_dup 3)
2265 (and:SI (match_dup 1)
2267 (clobber (match_dup 4))])
2269 (compare:CC (match_dup 3)
2273 (define_insn "*andsi3_internal4"
2274 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2275 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2276 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2278 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2279 (and:SI (match_dup 1)
2281 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2282 "! TARGET_POWERPC64"
2285 {andil.|andi.} %0,%1,%b2
2286 {andiu.|andis.} %0,%1,%u2
2287 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2292 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2293 (set_attr "length" "4,4,4,4,8,8,8,8")])
2295 (define_insn "*andsi3_internal5"
2296 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2297 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2298 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2300 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2301 (and:SI (match_dup 1)
2303 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2307 {andil.|andi.} %0,%1,%b2
2308 {andiu.|andis.} %0,%1,%u2
2309 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2314 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2315 (set_attr "length" "8,4,4,4,8,8,8,8")])
2318 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2319 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2320 (match_operand:SI 2 "and_operand" ""))
2322 (set (match_operand:SI 0 "gpc_reg_operand" "")
2323 (and:SI (match_dup 1)
2325 (clobber (match_scratch:CC 4 ""))]
2327 [(parallel [(set (match_dup 0)
2328 (and:SI (match_dup 1)
2330 (clobber (match_dup 4))])
2332 (compare:CC (match_dup 0)
2337 [(set (match_operand:CC 3 "cc_reg_operand" "")
2338 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2339 (match_operand:SI 2 "gpc_reg_operand" ""))
2341 (set (match_operand:SI 0 "gpc_reg_operand" "")
2342 (and:SI (match_dup 1)
2344 (clobber (match_scratch:CC 4 ""))]
2345 "TARGET_POWERPC64 && reload_completed"
2346 [(parallel [(set (match_dup 0)
2347 (and:SI (match_dup 1)
2349 (clobber (match_dup 4))])
2351 (compare:CC (match_dup 0)
2355 ;; Handle the PowerPC64 rlwinm corner case
2357 (define_insn_and_split "*andsi3_internal6"
2358 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2359 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2360 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2365 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2368 (rotate:SI (match_dup 0) (match_dup 5)))]
2371 int mb = extract_MB (operands[2]);
2372 int me = extract_ME (operands[2]);
2373 operands[3] = GEN_INT (me + 1);
2374 operands[5] = GEN_INT (32 - (me + 1));
2375 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2377 [(set_attr "length" "8")])
2379 (define_insn_and_split "*andsi3_internal7"
2380 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
2381 (compare:CC (and:SI (match_operand:SI 0 "gpc_reg_operand" "r,r")
2382 (match_operand:SI 1 "mask_operand_wrap" "i,i"))
2384 (clobber (match_scratch:SI 3 "=r,r"))]
2388 [(parallel [(set (match_dup 2)
2389 (compare:CC (and:SI (rotate:SI (match_dup 0) (match_dup 4))
2392 (clobber (match_dup 3))])]
2395 int mb = extract_MB (operands[1]);
2396 int me = extract_ME (operands[1]);
2397 operands[4] = GEN_INT (me + 1);
2398 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2400 [(set_attr "type" "delayed_compare,compare")
2401 (set_attr "length" "4,8")])
2403 (define_insn_and_split "*andsi3_internal8"
2404 [(set (match_operand:CC 3 "cc_reg_operand" "=x,??y")
2405 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
2406 (match_operand:SI 2 "mask_operand_wrap" "i,i"))
2408 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2409 (and:SI (match_dup 1)
2414 [(parallel [(set (match_dup 3)
2415 (compare:CC (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2419 (and:SI (rotate:SI (match_dup 1) (match_dup 4))
2422 (rotate:SI (match_dup 0) (match_dup 6)))]
2425 int mb = extract_MB (operands[2]);
2426 int me = extract_ME (operands[2]);
2427 operands[4] = GEN_INT (me + 1);
2428 operands[6] = GEN_INT (32 - (me + 1));
2429 operands[5] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2431 [(set_attr "type" "delayed_compare,compare")
2432 (set_attr "length" "8,12")])
2434 (define_expand "iorsi3"
2435 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2436 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2437 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2441 if (GET_CODE (operands[2]) == CONST_INT
2442 && ! logical_operand (operands[2], SImode))
2444 HOST_WIDE_INT value = INTVAL (operands[2]);
2445 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2446 ? operands[0] : gen_reg_rtx (SImode));
2448 emit_insn (gen_iorsi3 (tmp, operands[1],
2449 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2450 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2455 (define_expand "xorsi3"
2456 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2457 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2458 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2462 if (GET_CODE (operands[2]) == CONST_INT
2463 && ! logical_operand (operands[2], SImode))
2465 HOST_WIDE_INT value = INTVAL (operands[2]);
2466 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2467 ? operands[0] : gen_reg_rtx (SImode));
2469 emit_insn (gen_xorsi3 (tmp, operands[1],
2470 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2471 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2476 (define_insn "*boolsi3_internal1"
2477 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2478 (match_operator:SI 3 "boolean_or_operator"
2479 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2480 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2484 {%q3il|%q3i} %0,%1,%b2
2485 {%q3iu|%q3is} %0,%1,%u2")
2487 (define_insn "*boolsi3_internal2"
2488 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2489 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2490 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2491 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2493 (clobber (match_scratch:SI 3 "=r,r"))]
2494 "! TARGET_POWERPC64"
2498 [(set_attr "type" "compare")
2499 (set_attr "length" "4,8")])
2502 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2503 (compare:CC (match_operator:SI 4 "boolean_operator"
2504 [(match_operand:SI 1 "gpc_reg_operand" "")
2505 (match_operand:SI 2 "gpc_reg_operand" "")])
2507 (clobber (match_scratch:SI 3 ""))]
2508 "! TARGET_POWERPC64 && reload_completed"
2509 [(set (match_dup 3) (match_dup 4))
2511 (compare:CC (match_dup 3)
2515 (define_insn "*boolsi3_internal3"
2516 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2517 (compare:CC (match_operator:SI 4 "boolean_operator"
2518 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2519 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2521 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2523 "! TARGET_POWERPC64"
2527 [(set_attr "type" "compare")
2528 (set_attr "length" "4,8")])
2531 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2532 (compare:CC (match_operator:SI 4 "boolean_operator"
2533 [(match_operand:SI 1 "gpc_reg_operand" "")
2534 (match_operand:SI 2 "gpc_reg_operand" "")])
2536 (set (match_operand:SI 0 "gpc_reg_operand" "")
2538 "! TARGET_POWERPC64 && reload_completed"
2539 [(set (match_dup 0) (match_dup 4))
2541 (compare:CC (match_dup 0)
2545 ;; Split a logical operation that we can't do in one insn into two insns,
2546 ;; each of which does one 16-bit part. This is used by combine.
2549 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2550 (match_operator:SI 3 "boolean_or_operator"
2551 [(match_operand:SI 1 "gpc_reg_operand" "")
2552 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2554 [(set (match_dup 0) (match_dup 4))
2555 (set (match_dup 0) (match_dup 5))]
2559 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2560 operands[4] = gen_rtx (GET_CODE (operands[3]), SImode,
2562 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2563 operands[5] = gen_rtx (GET_CODE (operands[3]), SImode,
2567 (define_insn "*boolcsi3_internal1"
2568 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2569 (match_operator:SI 3 "boolean_operator"
2570 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2571 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2575 (define_insn "*boolcsi3_internal2"
2576 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2577 (compare:CC (match_operator:SI 4 "boolean_operator"
2578 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2579 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2581 (clobber (match_scratch:SI 3 "=r,r"))]
2582 "! TARGET_POWERPC64"
2586 [(set_attr "type" "compare")
2587 (set_attr "length" "4,8")])
2590 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2591 (compare:CC (match_operator:SI 4 "boolean_operator"
2592 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2593 (match_operand:SI 2 "gpc_reg_operand" "")])
2595 (clobber (match_scratch:SI 3 ""))]
2596 "! TARGET_POWERPC64 && reload_completed"
2597 [(set (match_dup 3) (match_dup 4))
2599 (compare:CC (match_dup 3)
2603 (define_insn "*boolcsi3_internal3"
2604 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2605 (compare:CC (match_operator:SI 4 "boolean_operator"
2606 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2607 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2609 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2611 "! TARGET_POWERPC64"
2615 [(set_attr "type" "compare")
2616 (set_attr "length" "4,8")])
2619 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2620 (compare:CC (match_operator:SI 4 "boolean_operator"
2621 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2622 (match_operand:SI 2 "gpc_reg_operand" "")])
2624 (set (match_operand:SI 0 "gpc_reg_operand" "")
2626 "! TARGET_POWERPC64 && reload_completed"
2627 [(set (match_dup 0) (match_dup 4))
2629 (compare:CC (match_dup 0)
2633 (define_insn "*boolccsi3_internal1"
2634 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2635 (match_operator:SI 3 "boolean_operator"
2636 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2637 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2641 (define_insn "*boolccsi3_internal2"
2642 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2643 (compare:CC (match_operator:SI 4 "boolean_operator"
2644 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2645 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2647 (clobber (match_scratch:SI 3 "=r,r"))]
2648 "! TARGET_POWERPC64"
2652 [(set_attr "type" "compare")
2653 (set_attr "length" "4,8")])
2656 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2657 (compare:CC (match_operator:SI 4 "boolean_operator"
2658 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2659 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2661 (clobber (match_scratch:SI 3 ""))]
2662 "! TARGET_POWERPC64 && reload_completed"
2663 [(set (match_dup 3) (match_dup 4))
2665 (compare:CC (match_dup 3)
2669 (define_insn "*boolccsi3_internal3"
2670 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2671 (compare:CC (match_operator:SI 4 "boolean_operator"
2672 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2673 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2675 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2677 "! TARGET_POWERPC64"
2681 [(set_attr "type" "compare")
2682 (set_attr "length" "4,8")])
2685 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2686 (compare:CC (match_operator:SI 4 "boolean_operator"
2687 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2688 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2690 (set (match_operand:SI 0 "gpc_reg_operand" "")
2692 "! TARGET_POWERPC64 && reload_completed"
2693 [(set (match_dup 0) (match_dup 4))
2695 (compare:CC (match_dup 0)
2699 ;; maskir insn. We need four forms because things might be in arbitrary
2700 ;; orders. Don't define forms that only set CR fields because these
2701 ;; would modify an input register.
2703 (define_insn "*maskir_internal1"
2704 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2705 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2706 (match_operand:SI 1 "gpc_reg_operand" "0"))
2707 (and:SI (match_dup 2)
2708 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2712 (define_insn "*maskir_internal2"
2713 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2714 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2715 (match_operand:SI 1 "gpc_reg_operand" "0"))
2716 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2721 (define_insn "*maskir_internal3"
2722 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2723 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2724 (match_operand:SI 3 "gpc_reg_operand" "r"))
2725 (and:SI (not:SI (match_dup 2))
2726 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2730 (define_insn "*maskir_internal4"
2731 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2732 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2733 (match_operand:SI 2 "gpc_reg_operand" "r"))
2734 (and:SI (not:SI (match_dup 2))
2735 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2739 (define_insn "*maskir_internal5"
2740 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2742 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2743 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2744 (and:SI (match_dup 2)
2745 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2747 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2748 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2749 (and:SI (match_dup 2) (match_dup 3))))]
2754 [(set_attr "type" "compare")
2755 (set_attr "length" "4,8")])
2758 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2760 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2761 (match_operand:SI 1 "gpc_reg_operand" ""))
2762 (and:SI (match_dup 2)
2763 (match_operand:SI 3 "gpc_reg_operand" "")))
2765 (set (match_operand:SI 0 "gpc_reg_operand" "")
2766 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2767 (and:SI (match_dup 2) (match_dup 3))))]
2768 "TARGET_POWER && reload_completed"
2770 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2771 (and:SI (match_dup 2) (match_dup 3))))
2773 (compare:CC (match_dup 0)
2777 (define_insn "*maskir_internal6"
2778 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2780 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2781 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2782 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2785 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2786 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2787 (and:SI (match_dup 3) (match_dup 2))))]
2792 [(set_attr "type" "compare")
2793 (set_attr "length" "4,8")])
2796 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2798 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2799 (match_operand:SI 1 "gpc_reg_operand" ""))
2800 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2803 (set (match_operand:SI 0 "gpc_reg_operand" "")
2804 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2805 (and:SI (match_dup 3) (match_dup 2))))]
2806 "TARGET_POWER && reload_completed"
2808 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2809 (and:SI (match_dup 3) (match_dup 2))))
2811 (compare:CC (match_dup 0)
2815 (define_insn "*maskir_internal7"
2816 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2818 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2819 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2820 (and:SI (not:SI (match_dup 2))
2821 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2823 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2824 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2825 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2830 [(set_attr "type" "compare")
2831 (set_attr "length" "4,8")])
2834 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2836 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2837 (match_operand:SI 3 "gpc_reg_operand" ""))
2838 (and:SI (not:SI (match_dup 2))
2839 (match_operand:SI 1 "gpc_reg_operand" "")))
2841 (set (match_operand:SI 0 "gpc_reg_operand" "")
2842 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2843 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2844 "TARGET_POWER && reload_completed"
2846 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2847 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2849 (compare:CC (match_dup 0)
2853 (define_insn "*maskir_internal8"
2854 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2856 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2857 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2858 (and:SI (not:SI (match_dup 2))
2859 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2861 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2862 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2863 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2868 [(set_attr "type" "compare")
2869 (set_attr "length" "4,8")])
2872 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2874 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2875 (match_operand:SI 2 "gpc_reg_operand" ""))
2876 (and:SI (not:SI (match_dup 2))
2877 (match_operand:SI 1 "gpc_reg_operand" "")))
2879 (set (match_operand:SI 0 "gpc_reg_operand" "")
2880 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2881 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2882 "TARGET_POWER && reload_completed"
2884 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2885 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2887 (compare:CC (match_dup 0)
2891 ;; Rotate and shift insns, in all their variants. These support shifts,
2892 ;; field inserts and extracts, and various combinations thereof.
2893 (define_expand "insv"
2894 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2895 (match_operand:SI 1 "const_int_operand" "")
2896 (match_operand:SI 2 "const_int_operand" ""))
2897 (match_operand 3 "gpc_reg_operand" ""))]
2901 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2902 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2903 compiler if the address of the structure is taken later. */
2904 if (GET_CODE (operands[0]) == SUBREG
2905 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2908 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2909 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2911 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2915 (define_insn "insvsi"
2916 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2917 (match_operand:SI 1 "const_int_operand" "i")
2918 (match_operand:SI 2 "const_int_operand" "i"))
2919 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2923 int start = INTVAL (operands[2]) & 31;
2924 int size = INTVAL (operands[1]) & 31;
2926 operands[4] = GEN_INT (32 - start - size);
2927 operands[1] = GEN_INT (start + size - 1);
2928 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2931 (define_insn "*insvsi_internal1"
2932 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2933 (match_operand:SI 1 "const_int_operand" "i")
2934 (match_operand:SI 2 "const_int_operand" "i"))
2935 (ashift:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2936 (match_operand:SI 4 "const_int_operand" "i")))]
2937 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2940 int shift = INTVAL (operands[4]) & 31;
2941 int start = INTVAL (operands[2]) & 31;
2942 int size = INTVAL (operands[1]) & 31;
2944 operands[4] = GEN_INT (shift - start - size);
2945 operands[1] = GEN_INT (start + size - 1);
2946 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2949 (define_insn "*insvsi_internal2"
2950 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2951 (match_operand:SI 1 "const_int_operand" "i")
2952 (match_operand:SI 2 "const_int_operand" "i"))
2953 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2954 (match_operand:SI 4 "const_int_operand" "i")))]
2955 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2958 int shift = INTVAL (operands[4]) & 31;
2959 int start = INTVAL (operands[2]) & 31;
2960 int size = INTVAL (operands[1]) & 31;
2962 operands[4] = GEN_INT (32 - shift - start - size);
2963 operands[1] = GEN_INT (start + size - 1);
2964 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2967 (define_insn "*insvsi_internal3"
2968 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2969 (match_operand:SI 1 "const_int_operand" "i")
2970 (match_operand:SI 2 "const_int_operand" "i"))
2971 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2972 (match_operand:SI 4 "const_int_operand" "i")))]
2973 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
2976 int shift = INTVAL (operands[4]) & 31;
2977 int start = INTVAL (operands[2]) & 31;
2978 int size = INTVAL (operands[1]) & 31;
2980 operands[4] = GEN_INT (32 - shift - start - size);
2981 operands[1] = GEN_INT (start + size - 1);
2982 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
2985 (define_insn "*insvsi_internal4"
2986 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2987 (match_operand:SI 1 "const_int_operand" "i")
2988 (match_operand:SI 2 "const_int_operand" "i"))
2989 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2990 (match_operand:SI 4 "const_int_operand" "i")
2991 (match_operand:SI 5 "const_int_operand" "i")))]
2992 "INTVAL (operands[4]) >= INTVAL (operands[1])"
2995 int extract_start = INTVAL (operands[5]) & 31;
2996 int extract_size = INTVAL (operands[4]) & 31;
2997 int insert_start = INTVAL (operands[2]) & 31;
2998 int insert_size = INTVAL (operands[1]) & 31;
3000 /* Align extract field with insert field */
3001 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3002 operands[1] = GEN_INT (insert_start + insert_size - 1);
3003 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3006 (define_insn "insvdi"
3007 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3008 (match_operand:SI 1 "const_int_operand" "i")
3009 (match_operand:SI 2 "const_int_operand" "i"))
3010 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3014 int start = INTVAL (operands[2]) & 63;
3015 int size = INTVAL (operands[1]) & 63;
3017 operands[1] = GEN_INT (64 - start - size);
3018 return \"rldimi %0,%3,%H1,%H2\";
3021 (define_expand "extzv"
3022 [(set (match_operand 0 "gpc_reg_operand" "")
3023 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3024 (match_operand:SI 2 "const_int_operand" "")
3025 (match_operand:SI 3 "const_int_operand" "")))]
3029 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3030 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3031 compiler if the address of the structure is taken later. */
3032 if (GET_CODE (operands[0]) == SUBREG
3033 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3036 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3037 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3039 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3043 (define_insn "extzvsi"
3044 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3045 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3046 (match_operand:SI 2 "const_int_operand" "i")
3047 (match_operand:SI 3 "const_int_operand" "i")))]
3051 int start = INTVAL (operands[3]) & 31;
3052 int size = INTVAL (operands[2]) & 31;
3054 if (start + size >= 32)
3055 operands[3] = const0_rtx;
3057 operands[3] = GEN_INT (start + size);
3058 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3061 (define_insn "*extzvsi_internal1"
3062 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3063 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3064 (match_operand:SI 2 "const_int_operand" "i,i")
3065 (match_operand:SI 3 "const_int_operand" "i,i"))
3067 (clobber (match_scratch:SI 4 "=r,r"))]
3071 int start = INTVAL (operands[3]) & 31;
3072 int size = INTVAL (operands[2]) & 31;
3074 /* Force split for non-cc0 compare. */
3075 if (which_alternative == 1)
3078 /* If the bit-field being tested fits in the upper or lower half of a
3079 word, it is possible to use andiu. or andil. to test it. This is
3080 useful because the condition register set-use delay is smaller for
3081 andi[ul]. than for rlinm. This doesn't work when the starting bit
3082 position is 0 because the LT and GT bits may be set wrong. */
3084 if ((start > 0 && start + size <= 16) || start >= 16)
3086 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3087 - (1 << (16 - (start & 15) - size))));
3089 return \"{andiu.|andis.} %4,%1,%3\";
3091 return \"{andil.|andi.} %4,%1,%3\";
3094 if (start + size >= 32)
3095 operands[3] = const0_rtx;
3097 operands[3] = GEN_INT (start + size);
3098 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3100 [(set_attr "type" "compare")
3101 (set_attr "length" "4,8")])
3104 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3105 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3106 (match_operand:SI 2 "const_int_operand" "")
3107 (match_operand:SI 3 "const_int_operand" ""))
3109 (clobber (match_scratch:SI 4 ""))]
3112 (zero_extract:SI (match_dup 1) (match_dup 2)
3115 (compare:CC (match_dup 4)
3119 (define_insn "*extzvsi_internal2"
3120 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3121 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3122 (match_operand:SI 2 "const_int_operand" "i,i")
3123 (match_operand:SI 3 "const_int_operand" "i,i"))
3125 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3126 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3130 int start = INTVAL (operands[3]) & 31;
3131 int size = INTVAL (operands[2]) & 31;
3133 /* Force split for non-cc0 compare. */
3134 if (which_alternative == 1)
3137 /* Since we are using the output value, we can't ignore any need for
3138 a shift. The bit-field must end at the LSB. */
3139 if (start >= 16 && start + size == 32)
3141 operands[3] = GEN_INT ((1 << size) - 1);
3142 return \"{andil.|andi.} %0,%1,%3\";
3145 if (start + size >= 32)
3146 operands[3] = const0_rtx;
3148 operands[3] = GEN_INT (start + size);
3149 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3151 [(set_attr "type" "compare")
3152 (set_attr "length" "4,8")])
3155 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3156 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3157 (match_operand:SI 2 "const_int_operand" "")
3158 (match_operand:SI 3 "const_int_operand" ""))
3160 (set (match_operand:SI 0 "gpc_reg_operand" "")
3161 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3164 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3166 (compare:CC (match_dup 0)
3170 (define_insn "extzvdi"
3171 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3172 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3173 (match_operand:SI 2 "const_int_operand" "i")
3174 (match_operand:SI 3 "const_int_operand" "i")))]
3178 int start = INTVAL (operands[3]) & 63;
3179 int size = INTVAL (operands[2]) & 63;
3181 if (start + size >= 64)
3182 operands[3] = const0_rtx;
3184 operands[3] = GEN_INT (start + size);
3185 operands[2] = GEN_INT (64 - size);
3186 return \"rldicl %0,%1,%3,%2\";
3189 (define_insn "*extzvdi_internal1"
3190 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3191 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3192 (match_operand:SI 2 "const_int_operand" "i")
3193 (match_operand:SI 3 "const_int_operand" "i"))
3195 (clobber (match_scratch:DI 4 "=r"))]
3199 int start = INTVAL (operands[3]) & 63;
3200 int size = INTVAL (operands[2]) & 63;
3202 if (start + size >= 64)
3203 operands[3] = const0_rtx;
3205 operands[3] = GEN_INT (start + size);
3206 operands[2] = GEN_INT (64 - size);
3207 return \"rldicl. %4,%1,%3,%2\";
3210 (define_insn "*extzvdi_internal2"
3211 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3212 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3213 (match_operand:SI 2 "const_int_operand" "i")
3214 (match_operand:SI 3 "const_int_operand" "i"))
3216 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3217 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3221 int start = INTVAL (operands[3]) & 63;
3222 int size = INTVAL (operands[2]) & 63;
3224 if (start + size >= 64)
3225 operands[3] = const0_rtx;
3227 operands[3] = GEN_INT (start + size);
3228 operands[2] = GEN_INT (64 - size);
3229 return \"rldicl. %0,%1,%3,%2\";
3232 (define_insn "rotlsi3"
3233 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3234 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3235 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3237 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3239 (define_insn "*rotlsi3_internal2"
3240 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3241 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3242 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3244 (clobber (match_scratch:SI 3 "=r,r"))]
3247 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3249 [(set_attr "type" "delayed_compare")
3250 (set_attr "length" "4,8")])
3253 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3254 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3255 (match_operand:SI 2 "reg_or_cint_operand" ""))
3257 (clobber (match_scratch:SI 3 ""))]
3260 (rotate:SI (match_dup 1) (match_dup 2)))
3262 (compare:CC (match_dup 3)
3266 (define_insn "*rotlsi3_internal3"
3267 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3268 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3269 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3271 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3272 (rotate:SI (match_dup 1) (match_dup 2)))]
3275 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3277 [(set_attr "type" "delayed_compare")
3278 (set_attr "length" "4,8")])
3281 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3282 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3283 (match_operand:SI 2 "reg_or_cint_operand" ""))
3285 (set (match_operand:SI 0 "gpc_reg_operand" "")
3286 (rotate:SI (match_dup 1) (match_dup 2)))]
3289 (rotate:SI (match_dup 1) (match_dup 2)))
3291 (compare:CC (match_dup 0)
3295 (define_insn "*rotlsi3_internal4"
3296 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3297 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3298 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3299 (match_operand:SI 3 "mask_operand" "n")))]
3301 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3303 (define_insn "*rotlsi3_internal5"
3304 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3306 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3307 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3308 (match_operand:SI 3 "mask_operand" "n,n"))
3310 (clobber (match_scratch:SI 4 "=r,r"))]
3313 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3315 [(set_attr "type" "delayed_compare")
3316 (set_attr "length" "4,8")])
3319 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3321 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3322 (match_operand:SI 2 "reg_or_cint_operand" ""))
3323 (match_operand:SI 3 "mask_operand" ""))
3325 (clobber (match_scratch:SI 4 ""))]
3328 (and:SI (rotate:SI (match_dup 1)
3332 (compare:CC (match_dup 4)
3336 (define_insn "*rotlsi3_internal6"
3337 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3339 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3340 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3341 (match_operand:SI 3 "mask_operand" "n,n"))
3343 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3344 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3347 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3349 [(set_attr "type" "delayed_compare")
3350 (set_attr "length" "4,8")])
3353 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3355 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3356 (match_operand:SI 2 "reg_or_cint_operand" ""))
3357 (match_operand:SI 3 "mask_operand" ""))
3359 (set (match_operand:SI 0 "gpc_reg_operand" "")
3360 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3363 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3365 (compare:CC (match_dup 0)
3369 (define_insn "*rotlsi3_internal7"
3370 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3373 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3374 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3376 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3378 (define_insn "*rotlsi3_internal8"
3379 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3380 (compare:CC (zero_extend:SI
3382 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3383 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3385 (clobber (match_scratch:SI 3 "=r,r"))]
3388 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3390 [(set_attr "type" "delayed_compare")
3391 (set_attr "length" "4,8")])
3394 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3395 (compare:CC (zero_extend:SI
3397 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3398 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3400 (clobber (match_scratch:SI 3 ""))]
3403 (zero_extend:SI (subreg:QI
3404 (rotate:SI (match_dup 1)
3407 (compare:CC (match_dup 3)
3411 (define_insn "*rotlsi3_internal9"
3412 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3413 (compare:CC (zero_extend:SI
3415 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3416 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3418 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3419 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3422 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3424 [(set_attr "type" "delayed_compare")
3425 (set_attr "length" "4,8")])
3428 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3429 (compare:CC (zero_extend:SI
3431 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3432 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3434 (set (match_operand:SI 0 "gpc_reg_operand" "")
3435 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3438 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3440 (compare:CC (match_dup 0)
3444 (define_insn "*rotlsi3_internal10"
3445 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3448 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3449 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3451 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3453 (define_insn "*rotlsi3_internal11"
3454 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3455 (compare:CC (zero_extend:SI
3457 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3458 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3460 (clobber (match_scratch:SI 3 "=r,r"))]
3463 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3465 [(set_attr "type" "delayed_compare")
3466 (set_attr "length" "4,8")])
3469 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3470 (compare:CC (zero_extend:SI
3472 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3473 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3475 (clobber (match_scratch:SI 3 ""))]
3478 (zero_extend:SI (subreg:HI
3479 (rotate:SI (match_dup 1)
3482 (compare:CC (match_dup 3)
3486 (define_insn "*rotlsi3_internal12"
3487 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3488 (compare:CC (zero_extend:SI
3490 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3491 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3493 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3494 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3497 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3499 [(set_attr "type" "delayed_compare")
3500 (set_attr "length" "4,8")])
3503 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3504 (compare:CC (zero_extend:SI
3506 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3507 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3509 (set (match_operand:SI 0 "gpc_reg_operand" "")
3510 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3513 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3515 (compare:CC (match_dup 0)
3519 ;; Note that we use "sle." instead of "sl." so that we can set
3520 ;; SHIFT_COUNT_TRUNCATED.
3522 (define_expand "ashlsi3"
3523 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3524 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3525 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3530 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3532 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3536 (define_insn "ashlsi3_power"
3537 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3538 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3539 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3540 (clobber (match_scratch:SI 3 "=q,X"))]
3544 {sli|slwi} %0,%1,%h2")
3546 (define_insn "ashlsi3_no_power"
3547 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3548 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3549 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3551 "{sl|slw}%I2 %0,%1,%h2")
3554 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3555 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3556 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3558 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3559 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3563 {sli.|slwi.} %3,%1,%h2
3566 [(set_attr "type" "delayed_compare")
3567 (set_attr "length" "4,4,8,8")])
3570 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3571 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3572 (match_operand:SI 2 "reg_or_cint_operand" ""))
3574 (clobber (match_scratch:SI 3 ""))
3575 (clobber (match_scratch:SI 4 ""))]
3576 "TARGET_POWER && reload_completed"
3577 [(parallel [(set (match_dup 3)
3578 (ashift:SI (match_dup 1) (match_dup 2)))
3579 (clobber (match_dup 4))])
3581 (compare:CC (match_dup 3)
3586 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3587 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3588 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3590 (clobber (match_scratch:SI 3 "=r,r"))]
3591 "! TARGET_POWER && ! TARGET_POWERPC64"
3593 {sl|slw}%I2. %3,%1,%h2
3595 [(set_attr "type" "delayed_compare")
3596 (set_attr "length" "4,8")])
3599 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3600 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3601 (match_operand:SI 2 "reg_or_cint_operand" ""))
3603 (clobber (match_scratch:SI 3 ""))]
3604 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3606 (ashift:SI (match_dup 1) (match_dup 2)))
3608 (compare:CC (match_dup 3)
3613 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3614 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3615 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3617 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3618 (ashift:SI (match_dup 1) (match_dup 2)))
3619 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3623 {sli.|slwi.} %0,%1,%h2
3626 [(set_attr "type" "delayed_compare")
3627 (set_attr "length" "4,4,8,8")])
3630 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3631 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3632 (match_operand:SI 2 "reg_or_cint_operand" ""))
3634 (set (match_operand:SI 0 "gpc_reg_operand" "")
3635 (ashift:SI (match_dup 1) (match_dup 2)))
3636 (clobber (match_scratch:SI 4 ""))]
3637 "TARGET_POWER && reload_completed"
3638 [(parallel [(set (match_dup 0)
3639 (ashift:SI (match_dup 1) (match_dup 2)))
3640 (clobber (match_dup 4))])
3642 (compare:CC (match_dup 0)
3647 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3648 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3649 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3651 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3652 (ashift:SI (match_dup 1) (match_dup 2)))]
3653 "! TARGET_POWER && ! TARGET_POWERPC64"
3655 {sl|slw}%I2. %0,%1,%h2
3657 [(set_attr "type" "delayed_compare")
3658 (set_attr "length" "4,8")])
3661 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3662 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3663 (match_operand:SI 2 "reg_or_cint_operand" ""))
3665 (set (match_operand:SI 0 "gpc_reg_operand" "")
3666 (ashift:SI (match_dup 1) (match_dup 2)))]
3667 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3669 (ashift:SI (match_dup 1) (match_dup 2)))
3671 (compare:CC (match_dup 0)
3676 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3677 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3678 (match_operand:SI 2 "const_int_operand" "i"))
3679 (match_operand:SI 3 "mask_operand" "n")))]
3680 "includes_lshift_p (operands[2], operands[3])"
3681 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3684 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3686 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3687 (match_operand:SI 2 "const_int_operand" "i,i"))
3688 (match_operand:SI 3 "mask_operand" "n,n"))
3690 (clobber (match_scratch:SI 4 "=r,r"))]
3691 "includes_lshift_p (operands[2], operands[3])"
3693 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3695 [(set_attr "type" "delayed_compare")
3696 (set_attr "length" "4,8")])
3699 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3701 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3702 (match_operand:SI 2 "const_int_operand" ""))
3703 (match_operand:SI 3 "mask_operand" ""))
3705 (clobber (match_scratch:SI 4 ""))]
3706 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3708 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3711 (compare:CC (match_dup 4)
3716 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3718 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3719 (match_operand:SI 2 "const_int_operand" "i,i"))
3720 (match_operand:SI 3 "mask_operand" "n,n"))
3722 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3723 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3724 "includes_lshift_p (operands[2], operands[3])"
3726 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3728 [(set_attr "type" "delayed_compare")
3729 (set_attr "length" "4,8")])
3732 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3734 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3735 (match_operand:SI 2 "const_int_operand" ""))
3736 (match_operand:SI 3 "mask_operand" ""))
3738 (set (match_operand:SI 0 "gpc_reg_operand" "")
3739 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3740 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3742 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3744 (compare:CC (match_dup 0)
3748 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3750 (define_expand "lshrsi3"
3751 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3752 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3753 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3758 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3760 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3764 (define_insn "lshrsi3_power"
3765 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3766 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3767 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3768 (clobber (match_scratch:SI 3 "=q,X,X"))]
3773 {s%A2i|s%A2wi} %0,%1,%h2")
3775 (define_insn "lshrsi3_no_power"
3776 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3777 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3778 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3782 {sr|srw}%I2 %0,%1,%h2")
3785 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3786 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3787 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3789 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3790 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3795 {s%A2i.|s%A2wi.} %3,%1,%h2
3799 [(set_attr "type" "delayed_compare")
3800 (set_attr "length" "4,4,4,8,8,8")])
3803 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3804 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3805 (match_operand:SI 2 "reg_or_cint_operand" ""))
3807 (clobber (match_scratch:SI 3 ""))
3808 (clobber (match_scratch:SI 4 ""))]
3809 "TARGET_POWER && reload_completed"
3810 [(parallel [(set (match_dup 3)
3811 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3812 (clobber (match_dup 4))])
3814 (compare:CC (match_dup 3)
3819 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3820 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3821 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3823 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3824 "! TARGET_POWER && ! TARGET_POWERPC64"
3827 {sr|srw}%I2. %3,%1,%h2
3830 [(set_attr "type" "delayed_compare")
3831 (set_attr "length" "4,4,8,8")])
3834 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3835 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3836 (match_operand:SI 2 "reg_or_cint_operand" ""))
3838 (clobber (match_scratch:SI 3 ""))]
3839 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3841 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3843 (compare:CC (match_dup 3)
3848 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3849 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3850 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3852 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
3853 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3854 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3859 {s%A2i.|s%A2wi.} %0,%1,%h2
3863 [(set_attr "type" "delayed_compare")
3864 (set_attr "length" "4,4,4,8,8,8")])
3867 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3868 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3869 (match_operand:SI 2 "reg_or_cint_operand" ""))
3871 (set (match_operand:SI 0 "gpc_reg_operand" "")
3872 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3873 (clobber (match_scratch:SI 4 ""))]
3874 "TARGET_POWER && reload_completed"
3875 [(parallel [(set (match_dup 0)
3876 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3877 (clobber (match_dup 4))])
3879 (compare:CC (match_dup 0)
3884 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3885 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3886 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3888 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3889 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3890 "! TARGET_POWER && ! TARGET_POWERPC64"
3893 {sr|srw}%I2. %0,%1,%h2
3896 [(set_attr "type" "delayed_compare")
3897 (set_attr "length" "4,4,8,8")])
3900 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3901 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3902 (match_operand:SI 2 "reg_or_cint_operand" ""))
3904 (set (match_operand:SI 0 "gpc_reg_operand" "")
3905 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
3906 "! TARGET_POWER && ! TARGET_POWERPC64 && reload_completed"
3908 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3910 (compare:CC (match_dup 0)
3915 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3916 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3917 (match_operand:SI 2 "const_int_operand" "i"))
3918 (match_operand:SI 3 "mask_operand" "n")))]
3919 "includes_rshift_p (operands[2], operands[3])"
3920 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
3923 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3925 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3926 (match_operand:SI 2 "const_int_operand" "i,i"))
3927 (match_operand:SI 3 "mask_operand" "n,n"))
3929 (clobber (match_scratch:SI 4 "=r,r"))]
3930 "includes_rshift_p (operands[2], operands[3])"
3932 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
3934 [(set_attr "type" "delayed_compare")
3935 (set_attr "length" "4,8")])
3938 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3940 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3941 (match_operand:SI 2 "const_int_operand" ""))
3942 (match_operand:SI 3 "mask_operand" ""))
3944 (clobber (match_scratch:SI 4 ""))]
3945 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
3947 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
3950 (compare:CC (match_dup 4)
3955 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3957 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3958 (match_operand:SI 2 "const_int_operand" "i,i"))
3959 (match_operand:SI 3 "mask_operand" "n,n"))
3961 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3962 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3963 "includes_rshift_p (operands[2], operands[3])"
3965 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
3967 [(set_attr "type" "delayed_compare")
3968 (set_attr "length" "4,8")])
3971 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3973 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3974 (match_operand:SI 2 "const_int_operand" ""))
3975 (match_operand:SI 3 "mask_operand" ""))
3977 (set (match_operand:SI 0 "gpc_reg_operand" "")
3978 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3979 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
3981 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3983 (compare:CC (match_dup 0)
3988 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3991 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3992 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
3993 "includes_rshift_p (operands[2], GEN_INT (255))"
3994 "{rlinm|rlwinm} %0,%1,%s2,0xff")
3997 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4001 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4002 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4004 (clobber (match_scratch:SI 3 "=r,r"))]
4005 "includes_rshift_p (operands[2], GEN_INT (255))"
4007 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4009 [(set_attr "type" "delayed_compare")
4010 (set_attr "length" "4,8")])
4013 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4017 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4018 (match_operand:SI 2 "const_int_operand" "")) 0))
4020 (clobber (match_scratch:SI 3 ""))]
4021 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4023 (zero_extend:SI (subreg:QI
4024 (lshiftrt:SI (match_dup 1)
4027 (compare:CC (match_dup 3)
4032 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4036 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4037 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4039 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4040 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4041 "includes_rshift_p (operands[2], GEN_INT (255))"
4043 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4045 [(set_attr "type" "delayed_compare")
4046 (set_attr "length" "4,8")])
4049 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4053 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4054 (match_operand:SI 2 "const_int_operand" "")) 0))
4056 (set (match_operand:SI 0 "gpc_reg_operand" "")
4057 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4058 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4060 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4062 (compare:CC (match_dup 0)
4067 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4070 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4071 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4072 "includes_rshift_p (operands[2], GEN_INT (65535))"
4073 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4076 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4080 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4081 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4083 (clobber (match_scratch:SI 3 "=r,r"))]
4084 "includes_rshift_p (operands[2], GEN_INT (65535))"
4086 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4088 [(set_attr "type" "delayed_compare")
4089 (set_attr "length" "4,8")])
4092 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4096 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4097 (match_operand:SI 2 "const_int_operand" "")) 0))
4099 (clobber (match_scratch:SI 3 ""))]
4100 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4102 (zero_extend:SI (subreg:HI
4103 (lshiftrt:SI (match_dup 1)
4106 (compare:CC (match_dup 3)
4111 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4115 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4116 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4118 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4119 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4120 "includes_rshift_p (operands[2], GEN_INT (65535))"
4122 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4124 [(set_attr "type" "delayed_compare")
4125 (set_attr "length" "4,8")])
4128 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4132 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4133 (match_operand:SI 2 "const_int_operand" "")) 0))
4135 (set (match_operand:SI 0 "gpc_reg_operand" "")
4136 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4137 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4139 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4141 (compare:CC (match_dup 0)
4146 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4148 (match_operand:SI 1 "gpc_reg_operand" "r"))
4149 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4155 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4157 (match_operand:SI 1 "gpc_reg_operand" "r"))
4158 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4164 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4166 (match_operand:SI 1 "gpc_reg_operand" "r"))
4167 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4173 (define_expand "ashrsi3"
4174 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4175 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4176 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4181 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4183 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4187 (define_insn "ashrsi3_power"
4188 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4189 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4190 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4191 (clobber (match_scratch:SI 3 "=q,X"))]
4195 {srai|srawi} %0,%1,%h2")
4197 (define_insn "ashrsi3_no_power"
4198 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4199 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4200 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4202 "{sra|sraw}%I2 %0,%1,%h2")
4205 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4206 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4207 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4209 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4210 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4214 {srai.|srawi.} %3,%1,%h2
4217 [(set_attr "type" "delayed_compare")
4218 (set_attr "length" "4,4,8,8")])
4221 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4222 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4223 (match_operand:SI 2 "reg_or_cint_operand" ""))
4225 (clobber (match_scratch:SI 3 ""))
4226 (clobber (match_scratch:SI 4 ""))]
4227 "TARGET_POWER && reload_completed"
4228 [(parallel [(set (match_dup 3)
4229 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4230 (clobber (match_dup 4))])
4232 (compare:CC (match_dup 3)
4237 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4238 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4239 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4241 (clobber (match_scratch:SI 3 "=r,r"))]
4244 {sra|sraw}%I2. %3,%1,%h2
4246 [(set_attr "type" "delayed_compare")
4247 (set_attr "length" "4,8")])
4250 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4251 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4252 (match_operand:SI 2 "reg_or_cint_operand" ""))
4254 (clobber (match_scratch:SI 3 ""))]
4255 "! TARGET_POWER && reload_completed"
4257 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4259 (compare:CC (match_dup 3)
4264 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4265 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4266 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4268 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4269 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4270 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4274 {srai.|srawi.} %0,%1,%h2
4277 [(set_attr "type" "delayed_compare")
4278 (set_attr "length" "4,4,8,8")])
4281 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4282 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4283 (match_operand:SI 2 "reg_or_cint_operand" ""))
4285 (set (match_operand:SI 0 "gpc_reg_operand" "")
4286 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4287 (clobber (match_scratch:SI 4 ""))]
4288 "TARGET_POWER && reload_completed"
4289 [(parallel [(set (match_dup 0)
4290 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4291 (clobber (match_dup 4))])
4293 (compare:CC (match_dup 0)
4298 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4299 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4300 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4302 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4303 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4306 {sra|sraw}%I2. %0,%1,%h2
4308 [(set_attr "type" "delayed_compare")
4309 (set_attr "length" "4,8")])
4312 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4313 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4314 (match_operand:SI 2 "reg_or_cint_operand" ""))
4316 (set (match_operand:SI 0 "gpc_reg_operand" "")
4317 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4318 "! TARGET_POWER && reload_completed"
4320 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4322 (compare:CC (match_dup 0)
4326 ;; Floating-point insns, excluding normal data motion.
4328 ;; PowerPC has a full set of single-precision floating point instructions.
4330 ;; For the POWER architecture, we pretend that we have both SFmode and
4331 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4332 ;; The only conversions we will do will be when storing to memory. In that
4333 ;; case, we will use the "frsp" instruction before storing.
4335 ;; Note that when we store into a single-precision memory location, we need to
4336 ;; use the frsp insn first. If the register being stored isn't dead, we
4337 ;; need a scratch register for the frsp. But this is difficult when the store
4338 ;; is done by reload. It is not incorrect to do the frsp on the register in
4339 ;; this case, we just lose precision that we would have otherwise gotten but
4340 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4342 (define_insn "extendsfdf2"
4343 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4344 (float_extend:DF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4345 "TARGET_HARD_FLOAT && TARGET_FPRS"
4348 if (REGNO (operands[0]) == REGNO (operands[1]))
4351 return \"fmr %0,%1\";
4353 [(set_attr "type" "fp")])
4355 (define_insn "truncdfsf2"
4356 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4357 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4358 "TARGET_HARD_FLOAT && TARGET_FPRS"
4360 [(set_attr "type" "fp")])
4362 (define_insn "aux_truncdfsf2"
4363 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4364 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] 0))]
4365 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4367 [(set_attr "type" "fp")])
4369 (define_expand "negsf2"
4370 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4371 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4375 (define_insn "*negsf2"
4376 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4377 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4378 "TARGET_HARD_FLOAT && TARGET_FPRS"
4380 [(set_attr "type" "fp")])
4382 (define_expand "abssf2"
4383 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4384 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4388 (define_insn "*abssf2"
4389 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4390 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4391 "TARGET_HARD_FLOAT && TARGET_FPRS"
4393 [(set_attr "type" "fp")])
4396 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4397 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4398 "TARGET_HARD_FLOAT && TARGET_FPRS"
4400 [(set_attr "type" "fp")])
4402 (define_expand "addsf3"
4403 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4404 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4405 (match_operand:SF 2 "gpc_reg_operand" "")))]
4410 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4411 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4412 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4413 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4415 [(set_attr "type" "fp")])
4418 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4419 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4420 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4421 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4422 "{fa|fadd} %0,%1,%2"
4423 [(set_attr "type" "fp")])
4425 (define_expand "subsf3"
4426 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4427 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4428 (match_operand:SF 2 "gpc_reg_operand" "")))]
4433 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4434 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4435 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4436 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4438 [(set_attr "type" "fp")])
4441 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4442 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4443 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4444 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4445 "{fs|fsub} %0,%1,%2"
4446 [(set_attr "type" "fp")])
4448 (define_expand "mulsf3"
4449 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4450 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4451 (match_operand:SF 2 "gpc_reg_operand" "")))]
4456 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4457 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4458 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4459 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4461 [(set_attr "type" "fp")])
4464 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4465 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4466 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4467 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4468 "{fm|fmul} %0,%1,%2"
4469 [(set_attr "type" "dmul")])
4471 (define_expand "divsf3"
4472 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4473 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4474 (match_operand:SF 2 "gpc_reg_operand" "")))]
4479 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4480 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4481 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4482 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4484 [(set_attr "type" "sdiv")])
4487 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4488 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4489 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4490 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4491 "{fd|fdiv} %0,%1,%2"
4492 [(set_attr "type" "ddiv")])
4495 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4496 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4497 (match_operand:SF 2 "gpc_reg_operand" "f"))
4498 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4499 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4500 "fmadds %0,%1,%2,%3"
4501 [(set_attr "type" "fp")])
4504 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4505 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4506 (match_operand:SF 2 "gpc_reg_operand" "f"))
4507 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4508 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4509 "{fma|fmadd} %0,%1,%2,%3"
4510 [(set_attr "type" "dmul")])
4513 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4514 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4515 (match_operand:SF 2 "gpc_reg_operand" "f"))
4516 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4517 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4518 "fmsubs %0,%1,%2,%3"
4519 [(set_attr "type" "fp")])
4522 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4523 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4524 (match_operand:SF 2 "gpc_reg_operand" "f"))
4525 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4526 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4527 "{fms|fmsub} %0,%1,%2,%3"
4528 [(set_attr "type" "dmul")])
4531 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4532 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4533 (match_operand:SF 2 "gpc_reg_operand" "f"))
4534 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4535 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4536 && HONOR_SIGNED_ZEROS (SFmode)"
4537 "fnmadds %0,%1,%2,%3"
4538 [(set_attr "type" "fp")])
4541 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4542 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4543 (match_operand:SF 2 "gpc_reg_operand" "f"))
4544 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4545 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4546 && ! HONOR_SIGNED_ZEROS (SFmode)"
4547 "fnmadds %0,%1,%2,%3"
4548 [(set_attr "type" "fp")])
4551 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4552 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4553 (match_operand:SF 2 "gpc_reg_operand" "f"))
4554 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4555 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4556 "{fnma|fnmadd} %0,%1,%2,%3"
4557 [(set_attr "type" "dmul")])
4560 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4561 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4562 (match_operand:SF 2 "gpc_reg_operand" "f"))
4563 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4564 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4565 && ! HONOR_SIGNED_ZEROS (SFmode)"
4566 "{fnma|fnmadd} %0,%1,%2,%3"
4567 [(set_attr "type" "dmul")])
4570 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4571 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4572 (match_operand:SF 2 "gpc_reg_operand" "f"))
4573 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4574 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4575 && HONOR_SIGNED_ZEROS (SFmode)"
4576 "fnmsubs %0,%1,%2,%3"
4577 [(set_attr "type" "fp")])
4580 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4581 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4582 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4583 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4584 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4585 && ! HONOR_SIGNED_ZEROS (SFmode)"
4586 "fnmsubs %0,%1,%2,%3"
4587 [(set_attr "type" "fp")])
4590 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4591 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4592 (match_operand:SF 2 "gpc_reg_operand" "f"))
4593 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4594 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4595 "{fnms|fnmsub} %0,%1,%2,%3"
4596 [(set_attr "type" "dmul")])
4599 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4600 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4601 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4602 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4603 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4604 && ! HONOR_SIGNED_ZEROS (SFmode)"
4605 "{fnms|fnmsub} %0,%1,%2,%3"
4606 [(set_attr "type" "fp")])
4608 (define_expand "sqrtsf2"
4609 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4610 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4611 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4615 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4616 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4617 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4619 [(set_attr "type" "ssqrt")])
4622 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4623 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4624 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4626 [(set_attr "type" "dsqrt")])
4628 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4629 ;; fsel instruction and some auxiliary computations. Then we just have a
4630 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4632 (define_expand "maxsf3"
4633 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4634 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4635 (match_operand:SF 2 "gpc_reg_operand" ""))
4638 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4639 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4641 (define_expand "minsf3"
4642 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4643 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4644 (match_operand:SF 2 "gpc_reg_operand" ""))
4647 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4648 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4651 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4652 (match_operator:SF 3 "min_max_operator"
4653 [(match_operand:SF 1 "gpc_reg_operand" "")
4654 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4655 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4658 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4659 operands[1], operands[2]);
4663 (define_expand "movsicc"
4664 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4665 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4666 (match_operand:SI 2 "gpc_reg_operand" "")
4667 (match_operand:SI 3 "gpc_reg_operand" "")))]
4671 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4677 ;; We use the BASE_REGS for the isel input operands because, if rA is
4678 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4679 ;; because we may switch the operands and rB may end up being rA.
4681 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4682 ;; leave out the mode in operand 4 and use one pattern, but reload can
4683 ;; change the mode underneath our feet and then gets confused trying
4684 ;; to reload the value.
4685 (define_insn "isel_signed"
4686 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4688 (match_operator 1 "comparison_operator"
4689 [(match_operand:CC 4 "cc_reg_operand" "y")
4691 (match_operand:SI 2 "gpc_reg_operand" "b")
4692 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4695 { return output_isel (operands); }"
4696 [(set_attr "length" "4")])
4698 (define_insn "isel_unsigned"
4699 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4701 (match_operator 1 "comparison_operator"
4702 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4704 (match_operand:SI 2 "gpc_reg_operand" "b")
4705 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4708 { return output_isel (operands); }"
4709 [(set_attr "length" "4")])
4711 (define_expand "movsfcc"
4712 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4713 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4714 (match_operand:SF 2 "gpc_reg_operand" "")
4715 (match_operand:SF 3 "gpc_reg_operand" "")))]
4716 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4719 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4725 (define_insn "*fselsfsf4"
4726 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4727 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4728 (match_operand:SF 4 "zero_fp_constant" "F"))
4729 (match_operand:SF 2 "gpc_reg_operand" "f")
4730 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4731 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4733 [(set_attr "type" "fp")])
4735 (define_insn "*fseldfsf4"
4736 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4737 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4738 (match_operand:DF 4 "zero_fp_constant" "F"))
4739 (match_operand:SF 2 "gpc_reg_operand" "f")
4740 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4741 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4743 [(set_attr "type" "fp")])
4745 (define_insn "negdf2"
4746 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4747 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4748 "TARGET_HARD_FLOAT && TARGET_FPRS"
4750 [(set_attr "type" "fp")])
4752 (define_insn "absdf2"
4753 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4754 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4755 "TARGET_HARD_FLOAT && TARGET_FPRS"
4757 [(set_attr "type" "fp")])
4760 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4761 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4762 "TARGET_HARD_FLOAT && TARGET_FPRS"
4764 [(set_attr "type" "fp")])
4766 (define_insn "adddf3"
4767 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4768 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4769 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4770 "TARGET_HARD_FLOAT && TARGET_FPRS"
4771 "{fa|fadd} %0,%1,%2"
4772 [(set_attr "type" "fp")])
4774 (define_insn "subdf3"
4775 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4776 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4777 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4778 "TARGET_HARD_FLOAT && TARGET_FPRS"
4779 "{fs|fsub} %0,%1,%2"
4780 [(set_attr "type" "fp")])
4782 (define_insn "muldf3"
4783 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4784 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4785 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4786 "TARGET_HARD_FLOAT && TARGET_FPRS"
4787 "{fm|fmul} %0,%1,%2"
4788 [(set_attr "type" "dmul")])
4790 (define_insn "divdf3"
4791 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4792 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
4793 (match_operand:DF 2 "gpc_reg_operand" "f")))]
4794 "TARGET_HARD_FLOAT && TARGET_FPRS"
4795 "{fd|fdiv} %0,%1,%2"
4796 [(set_attr "type" "ddiv")])
4799 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4800 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4801 (match_operand:DF 2 "gpc_reg_operand" "f"))
4802 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4803 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4804 "{fma|fmadd} %0,%1,%2,%3"
4805 [(set_attr "type" "dmul")])
4808 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4809 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4810 (match_operand:DF 2 "gpc_reg_operand" "f"))
4811 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4812 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4813 "{fms|fmsub} %0,%1,%2,%3"
4814 [(set_attr "type" "dmul")])
4817 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4818 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4819 (match_operand:DF 2 "gpc_reg_operand" "f"))
4820 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4821 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4822 && HONOR_SIGNED_ZEROS (DFmode)"
4823 "{fnma|fnmadd} %0,%1,%2,%3"
4824 [(set_attr "type" "dmul")])
4827 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4828 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
4829 (match_operand:DF 2 "gpc_reg_operand" "f"))
4830 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4831 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4832 && ! HONOR_SIGNED_ZEROS (DFmode)"
4833 "{fnma|fnmadd} %0,%1,%2,%3"
4834 [(set_attr "type" "dmul")])
4837 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4838 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4839 (match_operand:DF 2 "gpc_reg_operand" "f"))
4840 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
4841 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4842 && HONOR_SIGNED_ZEROS (DFmode)"
4843 "{fnms|fnmsub} %0,%1,%2,%3"
4844 [(set_attr "type" "dmul")])
4847 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4848 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
4849 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
4850 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
4851 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4852 && ! HONOR_SIGNED_ZEROS (DFmode)"
4853 "{fnms|fnmsub} %0,%1,%2,%3"
4854 [(set_attr "type" "dmul")])
4856 (define_insn "sqrtdf2"
4857 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4858 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4859 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4861 [(set_attr "type" "dsqrt")])
4863 ;; The conditional move instructions allow us to perform max and min
4864 ;; operations even when
4866 (define_expand "maxdf3"
4867 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4868 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4869 (match_operand:DF 2 "gpc_reg_operand" ""))
4872 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4873 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4875 (define_expand "mindf3"
4876 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4877 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
4878 (match_operand:DF 2 "gpc_reg_operand" ""))
4881 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4882 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4885 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4886 (match_operator:DF 3 "min_max_operator"
4887 [(match_operand:DF 1 "gpc_reg_operand" "")
4888 (match_operand:DF 2 "gpc_reg_operand" "")]))]
4889 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4892 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4893 operands[1], operands[2]);
4897 (define_expand "movdfcc"
4898 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4899 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4900 (match_operand:DF 2 "gpc_reg_operand" "")
4901 (match_operand:DF 3 "gpc_reg_operand" "")))]
4902 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4905 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4911 (define_insn "*fseldfdf4"
4912 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4913 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4914 (match_operand:DF 4 "zero_fp_constant" "F"))
4915 (match_operand:DF 2 "gpc_reg_operand" "f")
4916 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4917 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4919 [(set_attr "type" "fp")])
4921 (define_insn "*fselsfdf4"
4922 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4923 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4924 (match_operand:SF 4 "zero_fp_constant" "F"))
4925 (match_operand:DF 2 "gpc_reg_operand" "f")
4926 (match_operand:DF 3 "gpc_reg_operand" "f")))]
4929 [(set_attr "type" "fp")])
4931 ;; Conversions to and from floating-point.
4933 (define_expand "fixunssfsi2"
4934 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4935 (unsigned_fix:SI (fix:SF (match_operand:SF 1 "gpc_reg_operand" ""))))]
4936 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4939 (define_expand "fix_truncsfsi2"
4940 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4941 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
4942 "TARGET_HARD_FLOAT && !TARGET_FPRS"
4945 ; For each of these conversions, there is a define_expand, a define_insn
4946 ; with a '#' template, and a define_split (with C code). The idea is
4947 ; to allow constant folding with the template of the define_insn,
4948 ; then to have the insns split later (between sched1 and final).
4950 (define_expand "floatsidf2"
4951 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
4952 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4955 (clobber (match_dup 4))
4956 (clobber (match_dup 5))
4957 (clobber (match_dup 6))])]
4958 "TARGET_HARD_FLOAT && TARGET_FPRS"
4961 if (TARGET_POWERPC64)
4963 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
4964 rtx t1 = gen_reg_rtx (DImode);
4965 rtx t2 = gen_reg_rtx (DImode);
4966 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
4970 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
4971 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
4972 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
4973 operands[5] = gen_reg_rtx (DFmode);
4974 operands[6] = gen_reg_rtx (SImode);
4977 (define_insn "*floatsidf2_internal"
4978 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
4979 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
4980 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
4981 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
4982 (clobber (match_operand:DF 4 "memory_operand" "=o"))
4983 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
4984 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
4985 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
4987 [(set_attr "length" "24")])
4990 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4991 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
4992 (use (match_operand:SI 2 "gpc_reg_operand" ""))
4993 (use (match_operand:DF 3 "gpc_reg_operand" ""))
4994 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
4995 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
4996 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
4997 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
4998 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4999 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5000 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5001 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5002 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5003 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))
5004 (clobber (match_operand:SI 6 "gpc_reg_operand" ""))]
5007 rtx lowword, highword;
5008 if (GET_CODE (operands[4]) != MEM)
5010 highword = XEXP (operands[4], 0);
5011 lowword = plus_constant (highword, 4);
5012 if (! WORDS_BIG_ENDIAN)
5015 tmp = highword; highword = lowword; lowword = tmp;
5018 emit_insn (gen_xorsi3 (operands[6], operands[1],
5019 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5020 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[6]);
5021 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5022 emit_move_insn (operands[5], operands[4]);
5023 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5027 (define_expand "floatunssisf2"
5028 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5029 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5030 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5033 (define_expand "floatunssidf2"
5034 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5035 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5038 (clobber (match_dup 4))
5039 (clobber (match_dup 5))])]
5040 "TARGET_HARD_FLOAT && TARGET_FPRS"
5043 if (TARGET_POWERPC64)
5045 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5046 rtx t1 = gen_reg_rtx (DImode);
5047 rtx t2 = gen_reg_rtx (DImode);
5048 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5053 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5054 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5055 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5056 operands[5] = gen_reg_rtx (DFmode);
5059 (define_insn "*floatunssidf2_internal"
5060 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5061 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5062 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5063 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5064 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5065 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5066 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5068 [(set_attr "length" "20")])
5071 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5072 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5073 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5074 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5075 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5076 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5077 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5078 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5079 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5080 (use (match_operand:SI 2 "gpc_reg_operand" ""))
5081 (use (match_operand:DF 3 "gpc_reg_operand" ""))
5082 (clobber (match_operand:DF 4 "offsettable_mem_operand" ""))
5083 (clobber (match_operand:DF 5 "gpc_reg_operand" ""))]
5086 rtx lowword, highword;
5087 if (GET_CODE (operands[4]) != MEM)
5089 highword = XEXP (operands[4], 0);
5090 lowword = plus_constant (highword, 4);
5091 if (! WORDS_BIG_ENDIAN)
5094 tmp = highword; highword = lowword; lowword = tmp;
5097 emit_move_insn (gen_rtx_MEM (SImode, lowword), operands[1]);
5098 emit_move_insn (gen_rtx_MEM (SImode, highword), operands[2]);
5099 emit_move_insn (operands[5], operands[4]);
5100 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5104 (define_expand "fix_truncdfsi2"
5105 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
5106 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5107 (clobber (match_dup 2))
5108 (clobber (match_dup 3))])]
5109 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5112 operands[2] = gen_reg_rtx (DImode);
5113 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5116 (define_insn "*fix_truncdfsi2_internal"
5117 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5118 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5119 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5120 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5121 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5123 [(set_attr "length" "16")])
5126 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5127 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5128 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5129 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5130 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5131 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5132 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5133 (clobber (match_operand:DI 2 "gpc_reg_operand" ""))
5134 (clobber (match_operand:DI 3 "offsettable_mem_operand" ""))]
5138 if (GET_CODE (operands[3]) != MEM)
5140 lowword = XEXP (operands[3], 0);
5141 if (WORDS_BIG_ENDIAN)
5142 lowword = plus_constant (lowword, 4);
5144 emit_insn (gen_fctiwz (operands[2], operands[1]));
5145 emit_move_insn (operands[3], operands[2]);
5146 emit_move_insn (operands[0], gen_rtx_MEM (SImode, lowword));
5150 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] 10))
5151 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5152 ; because the first makes it clear that operand 0 is not live
5153 ; before the instruction.
5154 (define_insn "fctiwz"
5155 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5156 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))] 10))]
5157 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5158 "{fcirz|fctiwz} %0,%1"
5159 [(set_attr "type" "fp")])
5161 (define_expand "floatsisf2"
5162 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5163 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5164 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5167 (define_insn "floatdidf2"
5168 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5169 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5170 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5172 [(set_attr "type" "fp")])
5174 (define_insn_and_split "floatsidf_ppc64"
5175 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5176 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5177 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5178 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5179 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5180 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5183 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5184 (set (match_dup 2) (match_dup 3))
5185 (set (match_dup 4) (match_dup 2))
5186 (set (match_dup 0) (float:DF (match_dup 4)))]
5189 (define_insn_and_split "floatunssidf_ppc64"
5190 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5191 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5192 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5193 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5194 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5195 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5198 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5199 (set (match_dup 2) (match_dup 3))
5200 (set (match_dup 4) (match_dup 2))
5201 (set (match_dup 0) (float:DF (match_dup 4)))]
5204 (define_insn "fix_truncdfdi2"
5205 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5206 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5207 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5209 [(set_attr "type" "fp")])
5211 (define_expand "floatdisf2"
5212 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5213 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5214 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5217 if (!flag_unsafe_math_optimizations)
5219 rtx label = gen_label_rtx ();
5220 emit_insn (gen_floatdisf2_internal2 (operands[1], label));
5223 emit_insn (gen_floatdisf2_internal1 (operands[0], operands[1]));
5227 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5228 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5229 ;; from double rounding.
5230 (define_insn_and_split "floatdisf2_internal1"
5231 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5232 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5233 (clobber (match_scratch:DF 2 "=f"))]
5234 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5236 "&& reload_completed"
5238 (float:DF (match_dup 1)))
5240 (float_truncate:SF (match_dup 2)))]
5243 ;; Twiddles bits to avoid double rounding.
5244 ;; Bits that might be truncated when converting to DFmode are replaced
5245 ;; by a bit that won't be lost at that stage, but is below the SFmode
5246 ;; rounding position.
5247 (define_expand "floatdisf2_internal2"
5248 [(parallel [(set (match_dup 4)
5249 (compare:CC (and:DI (match_operand:DI 0 "" "")
5252 (set (match_dup 2) (and:DI (match_dup 0) (const_int 2047)))
5253 (clobber (match_scratch:CC 7 ""))])
5254 (set (match_dup 3) (ashiftrt:DI (match_dup 0) (const_int 53)))
5255 (set (match_dup 3) (plus:DI (match_dup 3) (const_int 1)))
5256 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
5257 (label_ref (match_operand:DI 1 "" ""))
5259 (set (match_dup 5) (compare:CCUNS (match_dup 3) (const_int 2)))
5260 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
5261 (label_ref (match_dup 1))
5263 (set (match_dup 0) (xor:DI (match_dup 0) (match_dup 2)))
5264 (set (match_dup 0) (ior:DI (match_dup 0) (const_int 2048)))]
5265 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5268 operands[2] = gen_reg_rtx (DImode);
5269 operands[3] = gen_reg_rtx (DImode);
5270 operands[4] = gen_reg_rtx (CCmode);
5271 operands[5] = gen_reg_rtx (CCUNSmode);
5274 ;; Define the DImode operations that can be done in a small number
5275 ;; of instructions. The & constraints are to prevent the register
5276 ;; allocator from allocating registers that overlap with the inputs
5277 ;; (for example, having an input in 7,8 and an output in 6,7). We
5278 ;; also allow for the output being the same as one of the inputs.
5280 (define_insn "*adddi3_noppc64"
5281 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5282 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5283 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5284 "! TARGET_POWERPC64"
5287 if (WORDS_BIG_ENDIAN)
5288 return (GET_CODE (operands[2])) != CONST_INT
5289 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5290 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5292 return (GET_CODE (operands[2])) != CONST_INT
5293 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5294 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5296 [(set_attr "length" "8")])
5298 (define_insn "*subdi3_noppc64"
5299 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5300 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5301 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5302 "! TARGET_POWERPC64"
5305 if (WORDS_BIG_ENDIAN)
5306 return (GET_CODE (operands[1]) != CONST_INT)
5307 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5308 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5310 return (GET_CODE (operands[1]) != CONST_INT)
5311 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5312 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5314 [(set_attr "length" "8")])
5316 (define_insn "*negdi2_noppc64"
5317 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5318 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5319 "! TARGET_POWERPC64"
5322 return (WORDS_BIG_ENDIAN)
5323 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5324 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5326 [(set_attr "length" "8")])
5328 (define_expand "mulsidi3"
5329 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5330 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5331 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5332 "! TARGET_POWERPC64"
5335 if (! TARGET_POWER && ! TARGET_POWERPC)
5337 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5338 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5339 emit_insn (gen_mull_call ());
5340 if (WORDS_BIG_ENDIAN)
5341 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5344 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5345 gen_rtx_REG (SImode, 3));
5346 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5347 gen_rtx_REG (SImode, 4));
5351 else if (TARGET_POWER)
5353 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5358 (define_insn "mulsidi3_mq"
5359 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5360 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5361 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5362 (clobber (match_scratch:SI 3 "=q"))]
5364 "mul %0,%1,%2\;mfmq %L0"
5365 [(set_attr "type" "imul")
5366 (set_attr "length" "8")])
5368 (define_insn "*mulsidi3_no_mq"
5369 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5370 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5371 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5372 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5375 return (WORDS_BIG_ENDIAN)
5376 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5377 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5379 [(set_attr "type" "imul")
5380 (set_attr "length" "8")])
5383 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5384 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5385 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5386 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5389 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5390 (sign_extend:DI (match_dup 2)))
5393 (mult:SI (match_dup 1)
5397 int endian = (WORDS_BIG_ENDIAN == 0);
5398 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5399 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5402 (define_expand "umulsidi3"
5403 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5404 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5405 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5406 "TARGET_POWERPC && ! TARGET_POWERPC64"
5411 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5416 (define_insn "umulsidi3_mq"
5417 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5418 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5419 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5420 (clobber (match_scratch:SI 3 "=q"))]
5421 "TARGET_POWERPC && TARGET_POWER"
5424 return (WORDS_BIG_ENDIAN)
5425 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5426 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5428 [(set_attr "type" "imul")
5429 (set_attr "length" "8")])
5431 (define_insn "*umulsidi3_no_mq"
5432 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5433 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5434 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5435 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5438 return (WORDS_BIG_ENDIAN)
5439 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5440 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5442 [(set_attr "type" "imul")
5443 (set_attr "length" "8")])
5446 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5447 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5448 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5449 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5452 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5453 (zero_extend:DI (match_dup 2)))
5456 (mult:SI (match_dup 1)
5460 int endian = (WORDS_BIG_ENDIAN == 0);
5461 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5462 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5465 (define_expand "smulsi3_highpart"
5466 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5468 (lshiftrt:DI (mult:DI (sign_extend:DI
5469 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5471 (match_operand:SI 2 "gpc_reg_operand" "r")))
5476 if (! TARGET_POWER && ! TARGET_POWERPC)
5478 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5479 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5480 emit_insn (gen_mulh_call ());
5481 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5484 else if (TARGET_POWER)
5486 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5491 (define_insn "smulsi3_highpart_mq"
5492 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5494 (lshiftrt:DI (mult:DI (sign_extend:DI
5495 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5497 (match_operand:SI 2 "gpc_reg_operand" "r")))
5499 (clobber (match_scratch:SI 3 "=q"))]
5502 [(set_attr "type" "imul")])
5504 (define_insn "*smulsi3_highpart_no_mq"
5505 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5507 (lshiftrt:DI (mult:DI (sign_extend:DI
5508 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5510 (match_operand:SI 2 "gpc_reg_operand" "r")))
5512 "TARGET_POWERPC && ! TARGET_POWER"
5514 [(set_attr "type" "imul")])
5516 (define_expand "umulsi3_highpart"
5517 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5519 (lshiftrt:DI (mult:DI (zero_extend:DI
5520 (match_operand:SI 1 "gpc_reg_operand" ""))
5522 (match_operand:SI 2 "gpc_reg_operand" "")))
5529 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5534 (define_insn "umulsi3_highpart_mq"
5535 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5537 (lshiftrt:DI (mult:DI (zero_extend:DI
5538 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5540 (match_operand:SI 2 "gpc_reg_operand" "r")))
5542 (clobber (match_scratch:SI 3 "=q"))]
5543 "TARGET_POWERPC && TARGET_POWER"
5545 [(set_attr "type" "imul")])
5547 (define_insn "*umulsi3_highpart_no_mq"
5548 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5550 (lshiftrt:DI (mult:DI (zero_extend:DI
5551 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5553 (match_operand:SI 2 "gpc_reg_operand" "r")))
5555 "TARGET_POWERPC && ! TARGET_POWER"
5557 [(set_attr "type" "imul")])
5559 ;; If operands 0 and 2 are in the same register, we have a problem. But
5560 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5561 ;; why we have the strange constraints below.
5562 (define_insn "ashldi3_power"
5563 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5564 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5565 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5566 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5569 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5570 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5571 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5572 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5573 [(set_attr "length" "8")])
5575 (define_insn "lshrdi3_power"
5576 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5577 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5578 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5579 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5582 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5583 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5584 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5585 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5586 [(set_attr "length" "8")])
5588 ;; Shift by a variable amount is too complex to be worth open-coding. We
5589 ;; just handle shifts by constants.
5590 (define_insn "ashrdi3_power"
5591 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5592 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5593 (match_operand:SI 2 "const_int_operand" "M,i")))
5594 (clobber (match_scratch:SI 3 "=X,q"))]
5597 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5598 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5599 [(set_attr "length" "8")])
5601 (define_insn "ashrdi3_no_power"
5602 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5603 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5604 (match_operand:SI 2 "const_int_operand" "M,i")))]
5605 "TARGET_32BIT && !TARGET_POWER"
5607 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5608 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5609 [(set_attr "length" "8,12")])
5611 ;; PowerPC64 DImode operations.
5613 (define_expand "adddi3"
5614 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5615 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5616 (match_operand:DI 2 "reg_or_add_cint64_operand" "")))]
5620 if (! TARGET_POWERPC64)
5622 if (non_short_cint_operand (operands[2], DImode))
5626 if (GET_CODE (operands[2]) == CONST_INT
5627 && ! add_operand (operands[2], DImode))
5629 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
5630 ? operands[0] : gen_reg_rtx (DImode));
5632 HOST_WIDE_INT val = INTVAL (operands[2]);
5633 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5634 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5636 if (!CONST_OK_FOR_LETTER_P (rest, 'L'))
5639 /* The ordering here is important for the prolog expander.
5640 When space is allocated from the stack, adding 'low' first may
5641 produce a temporary deallocation (which would be bad). */
5642 emit_insn (gen_adddi3 (tmp, operands[1], GEN_INT (rest)));
5643 emit_insn (gen_adddi3 (operands[0], tmp, GEN_INT (low)));
5648 ;; Discourage ai/addic because of carry but provide it in an alternative
5649 ;; allowing register zero as source.
5651 (define_insn "*adddi3_internal1"
5652 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,?r,r")
5653 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,b,r,b")
5654 (match_operand:DI 2 "add_operand" "r,I,I,L")))]
5662 (define_insn "*adddi3_internal2"
5663 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
5664 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5665 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5667 (clobber (match_scratch:DI 3 "=r,r,r,r"))]
5674 [(set_attr "type" "fast_compare,compare,compare,compare")
5675 (set_attr "length" "4,4,8,8")])
5678 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5679 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5680 (match_operand:DI 2 "reg_or_short_operand" ""))
5682 (clobber (match_scratch:DI 3 ""))]
5683 "TARGET_POWERPC64 && reload_completed"
5685 (plus:DI (match_dup 1) (match_dup 2)))
5687 (compare:CC (match_dup 3)
5691 (define_insn "*adddi3_internal3"
5692 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
5693 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r")
5694 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I"))
5696 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
5697 (plus:DI (match_dup 1) (match_dup 2)))]
5704 [(set_attr "type" "fast_compare,compare,compare,compare")
5705 (set_attr "length" "4,4,8,8")])
5708 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5709 (compare:CC (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5710 (match_operand:DI 2 "reg_or_short_operand" ""))
5712 (set (match_operand:DI 0 "gpc_reg_operand" "")
5713 (plus:DI (match_dup 1) (match_dup 2)))]
5714 "TARGET_POWERPC64 && reload_completed"
5716 (plus:DI (match_dup 1) (match_dup 2)))
5718 (compare:CC (match_dup 0)
5722 ;; Split an add that we can't do in one insn into two insns, each of which
5723 ;; does one 16-bit part. This is used by combine. Note that the low-order
5724 ;; add should be last in case the result gets used in an address.
5727 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5728 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5729 (match_operand:DI 2 "non_add_cint_operand" "")))]
5731 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
5732 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5735 HOST_WIDE_INT val = INTVAL (operands[2]);
5736 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
5737 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, DImode);
5739 operands[4] = GEN_INT (low);
5740 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
5741 operands[3] = GEN_INT (rest);
5742 else if (! no_new_pseudos)
5744 operands[3] = gen_reg_rtx (DImode);
5745 emit_move_insn (operands[3], operands[2]);
5746 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
5753 (define_insn "one_cmpldi2"
5754 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5755 (not:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5760 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5761 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5763 (clobber (match_scratch:DI 2 "=r,r"))]
5768 [(set_attr "type" "compare")
5769 (set_attr "length" "4,8")])
5772 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5773 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5775 (clobber (match_scratch:DI 2 ""))]
5776 "TARGET_POWERPC64 && reload_completed"
5778 (not:DI (match_dup 1)))
5780 (compare:CC (match_dup 2)
5785 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5786 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5788 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5789 (not:DI (match_dup 1)))]
5794 [(set_attr "type" "compare")
5795 (set_attr "length" "4,8")])
5798 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5799 (compare:CC (not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5801 (set (match_operand:DI 0 "gpc_reg_operand" "")
5802 (not:DI (match_dup 1)))]
5803 "TARGET_POWERPC64 && reload_completed"
5805 (not:DI (match_dup 1)))
5807 (compare:CC (match_dup 0)
5812 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5813 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I")
5814 (match_operand:DI 2 "gpc_reg_operand" "r,r")))]
5821 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5822 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5823 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5825 (clobber (match_scratch:DI 3 "=r,r"))]
5830 [(set_attr "type" "fast_compare")
5831 (set_attr "length" "4,8")])
5834 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5835 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5836 (match_operand:DI 2 "gpc_reg_operand" ""))
5838 (clobber (match_scratch:DI 3 ""))]
5839 "TARGET_POWERPC64 && reload_completed"
5841 (minus:DI (match_dup 1) (match_dup 2)))
5843 (compare:CC (match_dup 3)
5848 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5849 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5850 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5852 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5853 (minus:DI (match_dup 1) (match_dup 2)))]
5858 [(set_attr "type" "fast_compare")
5859 (set_attr "length" "4,8")])
5862 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
5863 (compare:CC (minus:DI (match_operand:DI 1 "gpc_reg_operand" "")
5864 (match_operand:DI 2 "gpc_reg_operand" ""))
5866 (set (match_operand:DI 0 "gpc_reg_operand" "")
5867 (minus:DI (match_dup 1) (match_dup 2)))]
5868 "TARGET_POWERPC64 && reload_completed"
5870 (minus:DI (match_dup 1) (match_dup 2)))
5872 (compare:CC (match_dup 0)
5876 (define_expand "subdi3"
5877 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5878 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
5879 (match_operand:DI 2 "reg_or_sub_cint64_operand" "")))]
5883 if (GET_CODE (operands[2]) == CONST_INT)
5885 emit_insn (gen_adddi3 (operands[0], operands[1],
5886 negate_rtx (DImode, operands[2])));
5891 (define_insn_and_split "absdi2"
5892 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5893 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5894 (clobber (match_scratch:DI 2 "=&r,&r"))]
5897 "&& reload_completed"
5898 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5899 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5900 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5903 (define_insn_and_split "*nabsdi2"
5904 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5905 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5906 (clobber (match_scratch:DI 2 "=&r,&r"))]
5909 "&& reload_completed"
5910 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5911 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5912 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
5915 (define_expand "negdi2"
5916 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5917 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "")))]
5922 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5923 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5928 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5929 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5931 (clobber (match_scratch:DI 2 "=r,r"))]
5936 [(set_attr "type" "fast_compare")
5937 (set_attr "length" "4,8")])
5940 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5941 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5943 (clobber (match_scratch:DI 2 ""))]
5944 "TARGET_POWERPC64 && reload_completed"
5946 (neg:DI (match_dup 1)))
5948 (compare:CC (match_dup 2)
5953 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
5954 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
5956 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5957 (neg:DI (match_dup 1)))]
5962 [(set_attr "type" "fast_compare")
5963 (set_attr "length" "4,8")])
5966 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
5967 (compare:CC (neg:DI (match_operand:DI 1 "gpc_reg_operand" ""))
5969 (set (match_operand:DI 0 "gpc_reg_operand" "")
5970 (neg:DI (match_dup 1)))]
5971 "TARGET_POWERPC64 && reload_completed"
5973 (neg:DI (match_dup 1)))
5975 (compare:CC (match_dup 0)
5979 (define_insn "clzdi2"
5980 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5981 (clz:DI (match_operand:DI 1 "gpc_reg_operand" "r")))]
5985 (define_expand "ctzdi2"
5987 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
5988 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
5990 (clobber (scratch:CC))])
5991 (set (match_dup 4) (clz:DI (match_dup 3)))
5992 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
5993 (minus:DI (const_int 63) (match_dup 4)))]
5996 operands[2] = gen_reg_rtx (DImode);
5997 operands[3] = gen_reg_rtx (DImode);
5998 operands[4] = gen_reg_rtx (DImode);
6001 (define_expand "ffsdi2"
6003 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
6004 (parallel [(set (match_dup 3) (and:DI (match_dup 1)
6006 (clobber (scratch:CC))])
6007 (set (match_dup 4) (clz:DI (match_dup 3)))
6008 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
6009 (minus:DI (const_int 64) (match_dup 4)))]
6012 operands[2] = gen_reg_rtx (DImode);
6013 operands[3] = gen_reg_rtx (DImode);
6014 operands[4] = gen_reg_rtx (DImode);
6017 (define_insn "muldi3"
6018 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6019 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
6020 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6023 [(set_attr "type" "lmul")])
6025 (define_insn "smuldi3_highpart"
6026 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6028 (lshiftrt:TI (mult:TI (sign_extend:TI
6029 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6031 (match_operand:DI 2 "gpc_reg_operand" "r")))
6035 [(set_attr "type" "lmul")])
6037 (define_insn "umuldi3_highpart"
6038 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6040 (lshiftrt:TI (mult:TI (zero_extend:TI
6041 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6043 (match_operand:DI 2 "gpc_reg_operand" "r")))
6047 [(set_attr "type" "lmul")])
6049 (define_expand "divdi3"
6050 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6051 (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6052 (match_operand:DI 2 "reg_or_cint_operand" "")))]
6056 if (GET_CODE (operands[2]) == CONST_INT
6057 && INTVAL (operands[2]) > 0
6058 && exact_log2 (INTVAL (operands[2])) >= 0)
6061 operands[2] = force_reg (DImode, operands[2]);
6064 (define_expand "moddi3"
6065 [(use (match_operand:DI 0 "gpc_reg_operand" ""))
6066 (use (match_operand:DI 1 "gpc_reg_operand" ""))
6067 (use (match_operand:DI 2 "reg_or_cint_operand" ""))]
6075 if (GET_CODE (operands[2]) != CONST_INT
6076 || INTVAL (operands[2]) <= 0
6077 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
6080 temp1 = gen_reg_rtx (DImode);
6081 temp2 = gen_reg_rtx (DImode);
6083 emit_insn (gen_divdi3 (temp1, operands[1], operands[2]));
6084 emit_insn (gen_ashldi3 (temp2, temp1, GEN_INT (i)));
6085 emit_insn (gen_subdi3 (operands[0], operands[1], temp2));
6090 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6091 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6092 (match_operand:DI 2 "exact_log2_cint_operand" "N")))]
6094 "sradi %0,%1,%p2\;addze %0,%0"
6095 [(set_attr "length" "8")])
6098 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6099 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6100 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6102 (clobber (match_scratch:DI 3 "=r,r"))]
6105 sradi %3,%1,%p2\;addze. %3,%3
6107 [(set_attr "type" "compare")
6108 (set_attr "length" "8,12")])
6111 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6112 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6113 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6115 (clobber (match_scratch:DI 3 ""))]
6116 "TARGET_POWERPC64 && reload_completed"
6118 (div:DI (match_dup 1) (match_dup 2)))
6120 (compare:CC (match_dup 3)
6125 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6126 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6127 (match_operand:DI 2 "exact_log2_cint_operand" "N,N"))
6129 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6130 (div:DI (match_dup 1) (match_dup 2)))]
6133 sradi %0,%1,%p2\;addze. %0,%0
6135 [(set_attr "type" "compare")
6136 (set_attr "length" "8,12")])
6139 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6140 (compare:CC (div:DI (match_operand:DI 1 "gpc_reg_operand" "")
6141 (match_operand:DI 2 "exact_log2_cint_operand" ""))
6143 (set (match_operand:DI 0 "gpc_reg_operand" "")
6144 (div:DI (match_dup 1) (match_dup 2)))]
6145 "TARGET_POWERPC64 && reload_completed"
6147 (div:DI (match_dup 1) (match_dup 2)))
6149 (compare:CC (match_dup 0)
6154 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6155 (div:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6156 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6159 [(set_attr "type" "ldiv")])
6161 (define_insn "udivdi3"
6162 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6163 (udiv:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6164 (match_operand:DI 2 "gpc_reg_operand" "r")))]
6167 [(set_attr "type" "ldiv")])
6169 (define_insn "rotldi3"
6170 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6171 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6172 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6174 "rld%I2cl %0,%1,%H2,0")
6176 (define_insn "*rotldi3_internal2"
6177 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6178 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6179 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6181 (clobber (match_scratch:DI 3 "=r,r"))]
6184 rld%I2cl. %3,%1,%H2,0
6186 [(set_attr "type" "delayed_compare")
6187 (set_attr "length" "4,8")])
6190 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6191 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6192 (match_operand:DI 2 "reg_or_cint_operand" ""))
6194 (clobber (match_scratch:DI 3 ""))]
6195 "TARGET_POWERPC64 && reload_completed"
6197 (rotate:DI (match_dup 1) (match_dup 2)))
6199 (compare:CC (match_dup 3)
6203 (define_insn "*rotldi3_internal3"
6204 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6205 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6206 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6208 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6209 (rotate:DI (match_dup 1) (match_dup 2)))]
6212 rld%I2cl. %0,%1,%H2,0
6214 [(set_attr "type" "delayed_compare")
6215 (set_attr "length" "4,8")])
6218 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6219 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6220 (match_operand:DI 2 "reg_or_cint_operand" ""))
6222 (set (match_operand:DI 0 "gpc_reg_operand" "")
6223 (rotate:DI (match_dup 1) (match_dup 2)))]
6224 "TARGET_POWERPC64 && reload_completed"
6226 (rotate:DI (match_dup 1) (match_dup 2)))
6228 (compare:CC (match_dup 0)
6232 (define_insn "*rotldi3_internal4"
6233 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6234 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6235 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6236 (match_operand:DI 3 "mask64_operand" "n")))]
6238 "rld%I2c%B3 %0,%1,%H2,%S3")
6240 (define_insn "*rotldi3_internal5"
6241 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6243 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6244 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6245 (match_operand:DI 3 "mask64_operand" "n,n"))
6247 (clobber (match_scratch:DI 4 "=r,r"))]
6250 rld%I2c%B3. %4,%1,%H2,%S3
6252 [(set_attr "type" "delayed_compare")
6253 (set_attr "length" "4,8")])
6256 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6258 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6259 (match_operand:DI 2 "reg_or_cint_operand" ""))
6260 (match_operand:DI 3 "mask64_operand" ""))
6262 (clobber (match_scratch:DI 4 ""))]
6263 "TARGET_POWERPC64 && reload_completed"
6265 (and:DI (rotate:DI (match_dup 1)
6269 (compare:CC (match_dup 4)
6273 (define_insn "*rotldi3_internal6"
6274 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6276 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6277 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6278 (match_operand:DI 3 "mask64_operand" "n,n"))
6280 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6281 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6284 rld%I2c%B3. %0,%1,%H2,%S3
6286 [(set_attr "type" "delayed_compare")
6287 (set_attr "length" "4,8")])
6290 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6292 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6293 (match_operand:DI 2 "reg_or_cint_operand" ""))
6294 (match_operand:DI 3 "mask64_operand" ""))
6296 (set (match_operand:DI 0 "gpc_reg_operand" "")
6297 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6298 "TARGET_POWERPC64 && reload_completed"
6300 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6302 (compare:CC (match_dup 0)
6306 (define_insn "*rotldi3_internal7"
6307 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6310 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6311 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6313 "rld%I2cl %0,%1,%H2,56")
6315 (define_insn "*rotldi3_internal8"
6316 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6317 (compare:CC (zero_extend:DI
6319 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6320 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6322 (clobber (match_scratch:DI 3 "=r,r"))]
6325 rld%I2cl. %3,%1,%H2,56
6327 [(set_attr "type" "delayed_compare")
6328 (set_attr "length" "4,8")])
6331 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6332 (compare:CC (zero_extend:DI
6334 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6335 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6337 (clobber (match_scratch:DI 3 ""))]
6338 "TARGET_POWERPC64 && reload_completed"
6340 (zero_extend:DI (subreg:QI
6341 (rotate:DI (match_dup 1)
6344 (compare:CC (match_dup 3)
6348 (define_insn "*rotldi3_internal9"
6349 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6350 (compare:CC (zero_extend:DI
6352 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6353 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6355 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6356 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6359 rld%I2cl. %0,%1,%H2,56
6361 [(set_attr "type" "delayed_compare")
6362 (set_attr "length" "4,8")])
6365 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6366 (compare:CC (zero_extend:DI
6368 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6369 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6371 (set (match_operand:DI 0 "gpc_reg_operand" "")
6372 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6373 "TARGET_POWERPC64 && reload_completed"
6375 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6377 (compare:CC (match_dup 0)
6381 (define_insn "*rotldi3_internal10"
6382 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6385 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6386 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6388 "rld%I2cl %0,%1,%H2,48")
6390 (define_insn "*rotldi3_internal11"
6391 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6392 (compare:CC (zero_extend:DI
6394 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6395 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6397 (clobber (match_scratch:DI 3 "=r,r"))]
6400 rld%I2cl. %3,%1,%H2,48
6402 [(set_attr "type" "delayed_compare")
6403 (set_attr "length" "4,8")])
6406 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6407 (compare:CC (zero_extend:DI
6409 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6410 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6412 (clobber (match_scratch:DI 3 ""))]
6413 "TARGET_POWERPC64 && reload_completed"
6415 (zero_extend:DI (subreg:HI
6416 (rotate:DI (match_dup 1)
6419 (compare:CC (match_dup 3)
6423 (define_insn "*rotldi3_internal12"
6424 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6425 (compare:CC (zero_extend:DI
6427 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6428 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6430 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6431 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6434 rld%I2cl. %0,%1,%H2,48
6436 [(set_attr "type" "delayed_compare")
6437 (set_attr "length" "4,8")])
6440 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6441 (compare:CC (zero_extend:DI
6443 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6444 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6446 (set (match_operand:DI 0 "gpc_reg_operand" "")
6447 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6448 "TARGET_POWERPC64 && reload_completed"
6450 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6452 (compare:CC (match_dup 0)
6456 (define_insn "*rotldi3_internal13"
6457 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6460 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6461 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6463 "rld%I2cl %0,%1,%H2,32")
6465 (define_insn "*rotldi3_internal14"
6466 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6467 (compare:CC (zero_extend:DI
6469 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6470 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6472 (clobber (match_scratch:DI 3 "=r,r"))]
6475 rld%I2cl. %3,%1,%H2,32
6477 [(set_attr "type" "delayed_compare")
6478 (set_attr "length" "4,8")])
6481 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6482 (compare:CC (zero_extend:DI
6484 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6485 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6487 (clobber (match_scratch:DI 3 ""))]
6488 "TARGET_POWERPC64 && reload_completed"
6490 (zero_extend:DI (subreg:SI
6491 (rotate:DI (match_dup 1)
6494 (compare:CC (match_dup 3)
6498 (define_insn "*rotldi3_internal15"
6499 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6500 (compare:CC (zero_extend:DI
6502 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6503 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6505 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6506 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6509 rld%I2cl. %0,%1,%H2,32
6511 [(set_attr "type" "delayed_compare")
6512 (set_attr "length" "4,8")])
6515 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6516 (compare:CC (zero_extend:DI
6518 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6519 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6521 (set (match_operand:DI 0 "gpc_reg_operand" "")
6522 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6523 "TARGET_POWERPC64 && reload_completed"
6525 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6527 (compare:CC (match_dup 0)
6531 (define_expand "ashldi3"
6532 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6533 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6534 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6535 "TARGET_POWERPC64 || TARGET_POWER"
6538 if (TARGET_POWERPC64)
6540 else if (TARGET_POWER)
6542 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6549 (define_insn "*ashldi3_internal1"
6550 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6551 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6552 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6555 [(set_attr "length" "8")])
6557 (define_insn "*ashldi3_internal2"
6558 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6559 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6560 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6562 (clobber (match_scratch:DI 3 "=r,r"))]
6567 [(set_attr "type" "delayed_compare")
6568 (set_attr "length" "4,8")])
6571 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6572 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6573 (match_operand:SI 2 "reg_or_cint_operand" ""))
6575 (clobber (match_scratch:DI 3 ""))]
6576 "TARGET_POWERPC64 && reload_completed"
6578 (ashift:DI (match_dup 1) (match_dup 2)))
6580 (compare:CC (match_dup 3)
6584 (define_insn "*ashldi3_internal3"
6585 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6586 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6587 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6589 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6590 (ashift:DI (match_dup 1) (match_dup 2)))]
6595 [(set_attr "type" "delayed_compare")
6596 (set_attr "length" "4,8")])
6599 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6600 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6601 (match_operand:SI 2 "reg_or_cint_operand" ""))
6603 (set (match_operand:DI 0 "gpc_reg_operand" "")
6604 (ashift:DI (match_dup 1) (match_dup 2)))]
6605 "TARGET_POWERPC64 && reload_completed"
6607 (ashift:DI (match_dup 1) (match_dup 2)))
6609 (compare:CC (match_dup 0)
6613 (define_insn "*ashldi3_internal4"
6614 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6615 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6616 (match_operand:SI 2 "const_int_operand" "i"))
6617 (match_operand:DI 3 "const_int_operand" "n")))]
6618 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6619 "rldic %0,%1,%H2,%W3")
6621 (define_insn "ashldi3_internal5"
6622 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6624 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6625 (match_operand:SI 2 "const_int_operand" "i,i"))
6626 (match_operand:DI 3 "const_int_operand" "n,n"))
6628 (clobber (match_scratch:DI 4 "=r,r"))]
6629 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6631 rldic. %4,%1,%H2,%W3
6633 [(set_attr "type" "delayed_compare")
6634 (set_attr "length" "4,8")])
6637 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6639 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6640 (match_operand:SI 2 "const_int_operand" ""))
6641 (match_operand:DI 3 "const_int_operand" ""))
6643 (clobber (match_scratch:DI 4 ""))]
6644 "TARGET_POWERPC64 && reload_completed
6645 && includes_rldic_lshift_p (operands[2], operands[3])"
6647 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6650 (compare:CC (match_dup 4)
6654 (define_insn "*ashldi3_internal6"
6655 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6657 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6658 (match_operand:SI 2 "const_int_operand" "i,i"))
6659 (match_operand:DI 3 "const_int_operand" "n,n"))
6661 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6662 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6663 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6665 rldic. %0,%1,%H2,%W3
6667 [(set_attr "type" "delayed_compare")
6668 (set_attr "length" "4,8")])
6671 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6673 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6674 (match_operand:SI 2 "const_int_operand" ""))
6675 (match_operand:DI 3 "const_int_operand" ""))
6677 (set (match_operand:DI 0 "gpc_reg_operand" "")
6678 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6679 "TARGET_POWERPC64 && reload_completed
6680 && includes_rldic_lshift_p (operands[2], operands[3])"
6682 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6685 (compare:CC (match_dup 0)
6689 (define_insn "*ashldi3_internal7"
6690 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6691 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6692 (match_operand:SI 2 "const_int_operand" "i"))
6693 (match_operand:DI 3 "mask64_operand" "n")))]
6694 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6695 "rldicr %0,%1,%H2,%S3")
6697 (define_insn "ashldi3_internal8"
6698 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6700 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6701 (match_operand:SI 2 "const_int_operand" "i,i"))
6702 (match_operand:DI 3 "mask64_operand" "n,n"))
6704 (clobber (match_scratch:DI 4 "=r,r"))]
6705 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6707 rldicr. %4,%1,%H2,%S3
6709 [(set_attr "type" "delayed_compare")
6710 (set_attr "length" "4,8")])
6713 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6715 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6716 (match_operand:SI 2 "const_int_operand" ""))
6717 (match_operand:DI 3 "mask64_operand" ""))
6719 (clobber (match_scratch:DI 4 ""))]
6720 "TARGET_POWERPC64 && reload_completed
6721 && includes_rldicr_lshift_p (operands[2], operands[3])"
6723 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6726 (compare:CC (match_dup 4)
6730 (define_insn "*ashldi3_internal9"
6731 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6733 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6734 (match_operand:SI 2 "const_int_operand" "i,i"))
6735 (match_operand:DI 3 "mask64_operand" "n,n"))
6737 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6738 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6739 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6741 rldicr. %0,%1,%H2,%S3
6743 [(set_attr "type" "delayed_compare")
6744 (set_attr "length" "4,8")])
6747 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6749 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6750 (match_operand:SI 2 "const_int_operand" ""))
6751 (match_operand:DI 3 "mask64_operand" ""))
6753 (set (match_operand:DI 0 "gpc_reg_operand" "")
6754 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6755 "TARGET_POWERPC64 && reload_completed
6756 && includes_rldicr_lshift_p (operands[2], operands[3])"
6758 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6761 (compare:CC (match_dup 0)
6765 (define_expand "lshrdi3"
6766 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6767 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6768 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6769 "TARGET_POWERPC64 || TARGET_POWER"
6772 if (TARGET_POWERPC64)
6774 else if (TARGET_POWER)
6776 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6783 (define_insn "*lshrdi3_internal1"
6784 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6785 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6786 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6790 (define_insn "*lshrdi3_internal2"
6791 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6792 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6793 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6795 (clobber (match_scratch:DI 3 "=r,r"))]
6800 [(set_attr "type" "delayed_compare")
6801 (set_attr "length" "4,8")])
6804 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6805 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6806 (match_operand:SI 2 "reg_or_cint_operand" ""))
6808 (clobber (match_scratch:DI 3 ""))]
6809 "TARGET_POWERPC64 && reload_completed"
6811 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6813 (compare:CC (match_dup 3)
6817 (define_insn "*lshrdi3_internal3"
6818 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6819 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6820 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6822 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6823 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6828 [(set_attr "type" "delayed_compare")
6829 (set_attr "length" "4,8")])
6832 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6833 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6834 (match_operand:SI 2 "reg_or_cint_operand" ""))
6836 (set (match_operand:DI 0 "gpc_reg_operand" "")
6837 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6838 "TARGET_POWERPC64 && reload_completed"
6840 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6842 (compare:CC (match_dup 0)
6846 (define_expand "ashrdi3"
6847 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6848 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6849 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6853 if (TARGET_POWERPC64)
6855 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6857 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
6860 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT)
6862 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
6869 (define_insn "*ashrdi3_internal1"
6870 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6871 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6872 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6874 "srad%I2 %0,%1,%H2")
6876 (define_insn "*ashrdi3_internal2"
6877 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6878 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6879 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6881 (clobber (match_scratch:DI 3 "=r,r"))]
6886 [(set_attr "type" "delayed_compare")
6887 (set_attr "length" "4,8")])
6890 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6891 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6892 (match_operand:SI 2 "reg_or_cint_operand" ""))
6894 (clobber (match_scratch:DI 3 ""))]
6895 "TARGET_POWERPC64 && reload_completed"
6897 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6899 (compare:CC (match_dup 3)
6903 (define_insn "*ashrdi3_internal3"
6904 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6905 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6906 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6908 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6909 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6914 [(set_attr "type" "delayed_compare")
6915 (set_attr "length" "4,8")])
6918 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6919 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6920 (match_operand:SI 2 "reg_or_cint_operand" ""))
6922 (set (match_operand:DI 0 "gpc_reg_operand" "")
6923 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6924 "TARGET_POWERPC64 && reload_completed"
6926 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6928 (compare:CC (match_dup 0)
6932 (define_insn "anddi3"
6933 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
6934 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
6935 (match_operand:DI 2 "and64_2_operand" "?r,S,K,J,t")))
6936 (clobber (match_scratch:CC 3 "=X,X,x,x,X"))]
6940 rldic%B2 %0,%1,0,%S2
6944 [(set_attr "length" "4,4,4,4,8")])
6947 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6948 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6949 (match_operand:DI 2 "mask64_2_operand" "")))
6950 (clobber (match_scratch:CC 3 ""))]
6952 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6953 && !mask64_operand (operands[2], DImode)"
6955 (and:DI (rotate:DI (match_dup 1)
6959 (and:DI (rotate:DI (match_dup 0)
6964 build_mask64_2_operands (operands[2], &operands[4]);
6967 (define_insn "*anddi3_internal2"
6968 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
6969 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
6970 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
6972 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
6973 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
6977 rldic%B2. %3,%1,0,%S2
6986 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
6987 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
6990 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6991 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6992 (match_operand:DI 2 "and64_operand" ""))
6994 (clobber (match_scratch:DI 3 ""))
6995 (clobber (match_scratch:CC 4 ""))]
6996 "TARGET_POWERPC64 && reload_completed"
6997 [(parallel [(set (match_dup 3)
6998 (and:DI (match_dup 1)
7000 (clobber (match_dup 4))])
7002 (compare:CC (match_dup 3)
7007 [(set (match_operand:CC 0 "cc_reg_operand" "")
7008 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7009 (match_operand:DI 2 "mask64_2_operand" ""))
7011 (clobber (match_scratch:DI 3 ""))
7012 (clobber (match_scratch:CC 4 ""))]
7013 "TARGET_POWERPC64 && reload_completed
7014 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7015 && !mask64_operand (operands[2], DImode)"
7017 (and:DI (rotate:DI (match_dup 1)
7020 (parallel [(set (match_dup 0)
7021 (compare:CC (and:DI (rotate:DI (match_dup 3)
7025 (clobber (match_dup 3))])]
7028 build_mask64_2_operands (operands[2], &operands[5]);
7031 (define_insn "*anddi3_internal3"
7032 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
7033 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
7034 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
7036 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
7037 (and:DI (match_dup 1) (match_dup 2)))
7038 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
7042 rldic%B2. %0,%1,0,%S2
7051 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
7052 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
7055 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7056 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7057 (match_operand:DI 2 "and64_operand" ""))
7059 (set (match_operand:DI 0 "gpc_reg_operand" "")
7060 (and:DI (match_dup 1) (match_dup 2)))
7061 (clobber (match_scratch:CC 4 ""))]
7062 "TARGET_POWERPC64 && reload_completed"
7063 [(parallel [(set (match_dup 0)
7064 (and:DI (match_dup 1) (match_dup 2)))
7065 (clobber (match_dup 4))])
7067 (compare:CC (match_dup 0)
7072 [(set (match_operand:CC 3 "cc_reg_operand" "")
7073 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
7074 (match_operand:DI 2 "mask64_2_operand" ""))
7076 (set (match_operand:DI 0 "gpc_reg_operand" "")
7077 (and:DI (match_dup 1) (match_dup 2)))
7078 (clobber (match_scratch:CC 4 ""))]
7079 "TARGET_POWERPC64 && reload_completed
7080 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
7081 && !mask64_operand (operands[2], DImode)"
7083 (and:DI (rotate:DI (match_dup 1)
7086 (parallel [(set (match_dup 3)
7087 (compare:CC (and:DI (rotate:DI (match_dup 0)
7092 (and:DI (rotate:DI (match_dup 0)
7097 build_mask64_2_operands (operands[2], &operands[5]);
7100 (define_expand "iordi3"
7101 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7102 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
7103 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7107 if (non_logical_cint_operand (operands[2], DImode))
7109 HOST_WIDE_INT value;
7110 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7111 ? operands[0] : gen_reg_rtx (DImode));
7113 if (GET_CODE (operands[2]) == CONST_INT)
7115 value = INTVAL (operands[2]);
7116 emit_insn (gen_iordi3 (tmp, operands[1],
7117 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7121 value = CONST_DOUBLE_LOW (operands[2]);
7122 emit_insn (gen_iordi3 (tmp, operands[1],
7123 immed_double_const (value
7124 & (~ (HOST_WIDE_INT) 0xffff),
7128 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7133 (define_expand "xordi3"
7134 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7135 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
7136 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
7140 if (non_logical_cint_operand (operands[2], DImode))
7142 HOST_WIDE_INT value;
7143 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7144 ? operands[0] : gen_reg_rtx (DImode));
7146 if (GET_CODE (operands[2]) == CONST_INT)
7148 value = INTVAL (operands[2]);
7149 emit_insn (gen_xordi3 (tmp, operands[1],
7150 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7154 value = CONST_DOUBLE_LOW (operands[2]);
7155 emit_insn (gen_xordi3 (tmp, operands[1],
7156 immed_double_const (value
7157 & (~ (HOST_WIDE_INT) 0xffff),
7161 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7166 (define_insn "*booldi3_internal1"
7167 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7168 (match_operator:DI 3 "boolean_or_operator"
7169 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7170 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7177 (define_insn "*booldi3_internal2"
7178 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7179 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7180 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7181 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7183 (clobber (match_scratch:DI 3 "=r,r"))]
7188 [(set_attr "type" "compare")
7189 (set_attr "length" "4,8")])
7192 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7193 (compare:CC (match_operator:DI 4 "boolean_operator"
7194 [(match_operand:DI 1 "gpc_reg_operand" "")
7195 (match_operand:DI 2 "gpc_reg_operand" "")])
7197 (clobber (match_scratch:DI 3 ""))]
7198 "TARGET_POWERPC64 && reload_completed"
7199 [(set (match_dup 3) (match_dup 4))
7201 (compare:CC (match_dup 3)
7205 (define_insn "*booldi3_internal3"
7206 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7207 (compare:CC (match_operator:DI 4 "boolean_operator"
7208 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7209 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7211 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7217 [(set_attr "type" "compare")
7218 (set_attr "length" "4,8")])
7221 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7222 (compare:CC (match_operator:DI 4 "boolean_operator"
7223 [(match_operand:DI 1 "gpc_reg_operand" "")
7224 (match_operand:DI 2 "gpc_reg_operand" "")])
7226 (set (match_operand:DI 0 "gpc_reg_operand" "")
7228 "TARGET_POWERPC64 && reload_completed"
7229 [(set (match_dup 0) (match_dup 4))
7231 (compare:CC (match_dup 0)
7235 ;; Split a logical operation that we can't do in one insn into two insns,
7236 ;; each of which does one 16-bit part. This is used by combine.
7239 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7240 (match_operator:DI 3 "boolean_or_operator"
7241 [(match_operand:DI 1 "gpc_reg_operand" "")
7242 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7244 [(set (match_dup 0) (match_dup 4))
7245 (set (match_dup 0) (match_dup 5))]
7250 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7252 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7253 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7255 i4 = GEN_INT (value & 0xffff);
7259 i3 = GEN_INT (INTVAL (operands[2])
7260 & (~ (HOST_WIDE_INT) 0xffff));
7261 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7263 operands[4] = gen_rtx (GET_CODE (operands[3]), DImode,
7265 operands[5] = gen_rtx (GET_CODE (operands[3]), DImode,
7269 (define_insn "*boolcdi3_internal1"
7270 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7271 (match_operator:DI 3 "boolean_operator"
7272 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7273 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7277 (define_insn "*boolcdi3_internal2"
7278 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7279 (compare:CC (match_operator:DI 4 "boolean_operator"
7280 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7281 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7283 (clobber (match_scratch:DI 3 "=r,r"))]
7288 [(set_attr "type" "compare")
7289 (set_attr "length" "4,8")])
7292 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7293 (compare:CC (match_operator:DI 4 "boolean_operator"
7294 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7295 (match_operand:DI 2 "gpc_reg_operand" "")])
7297 (clobber (match_scratch:DI 3 ""))]
7298 "TARGET_POWERPC64 && reload_completed"
7299 [(set (match_dup 3) (match_dup 4))
7301 (compare:CC (match_dup 3)
7305 (define_insn "*boolcdi3_internal3"
7306 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7307 (compare:CC (match_operator:DI 4 "boolean_operator"
7308 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7309 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7311 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7317 [(set_attr "type" "compare")
7318 (set_attr "length" "4,8")])
7321 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7322 (compare:CC (match_operator:DI 4 "boolean_operator"
7323 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7324 (match_operand:DI 2 "gpc_reg_operand" "")])
7326 (set (match_operand:DI 0 "gpc_reg_operand" "")
7328 "TARGET_POWERPC64 && reload_completed"
7329 [(set (match_dup 0) (match_dup 4))
7331 (compare:CC (match_dup 0)
7335 (define_insn "*boolccdi3_internal1"
7336 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7337 (match_operator:DI 3 "boolean_operator"
7338 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7339 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7343 (define_insn "*boolccdi3_internal2"
7344 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7345 (compare:CC (match_operator:DI 4 "boolean_operator"
7346 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7347 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7349 (clobber (match_scratch:DI 3 "=r,r"))]
7354 [(set_attr "type" "compare")
7355 (set_attr "length" "4,8")])
7358 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7359 (compare:CC (match_operator:DI 4 "boolean_operator"
7360 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7361 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7363 (clobber (match_scratch:DI 3 ""))]
7364 "TARGET_POWERPC64 && reload_completed"
7365 [(set (match_dup 3) (match_dup 4))
7367 (compare:CC (match_dup 3)
7371 (define_insn "*boolccdi3_internal3"
7372 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7373 (compare:CC (match_operator:DI 4 "boolean_operator"
7374 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7375 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7377 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7383 [(set_attr "type" "compare")
7384 (set_attr "length" "4,8")])
7387 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7388 (compare:CC (match_operator:DI 4 "boolean_operator"
7389 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7390 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7392 (set (match_operand:DI 0 "gpc_reg_operand" "")
7394 "TARGET_POWERPC64 && reload_completed"
7395 [(set (match_dup 0) (match_dup 4))
7397 (compare:CC (match_dup 0)
7401 ;; Now define ways of moving data around.
7403 ;; Elf specific ways of loading addresses for non-PIC code.
7404 ;; The output of this could be r0, but we make a very strong
7405 ;; preference for a base register because it will usually
7407 (define_insn "elf_high"
7408 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7409 (high:SI (match_operand 1 "" "")))]
7410 "TARGET_ELF && ! TARGET_64BIT"
7411 "{liu|lis} %0,%1@ha")
7413 (define_insn "elf_low"
7414 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7415 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7416 (match_operand 2 "" "")))]
7417 "TARGET_ELF && ! TARGET_64BIT"
7419 {cal|la} %0,%2@l(%1)
7420 {ai|addic} %0,%1,%K2")
7422 ;; Mach-O PIC trickery.
7423 (define_insn "macho_high"
7424 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
7425 (high:SI (match_operand 1 "" "")))]
7426 "TARGET_MACHO && ! TARGET_64BIT"
7427 "{liu|lis} %0,ha16(%1)")
7429 (define_insn "macho_low"
7430 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
7431 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
7432 (match_operand 2 "" "")))]
7433 "TARGET_MACHO && ! TARGET_64BIT"
7435 {cal %0,%a2@l(%1)|la %0,lo16(%2)(%1)}
7436 {cal %0,%a2@l(%1)|addic %0,%1,lo16(%2)}")
7438 ;; Set up a register with a value from the GOT table
7440 (define_expand "movsi_got"
7441 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7442 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7444 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7447 if (GET_CODE (operands[1]) == CONST)
7449 rtx offset = const0_rtx;
7450 HOST_WIDE_INT value;
7452 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7453 value = INTVAL (offset);
7456 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7457 emit_insn (gen_movsi_got (tmp, operands[1]));
7458 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7463 operands[2] = rs6000_got_register (operands[1]);
7466 (define_insn "*movsi_got_internal"
7467 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7468 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7469 (match_operand:SI 2 "gpc_reg_operand" "b")] 8))]
7470 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7471 "{l|lwz} %0,%a1@got(%2)"
7472 [(set_attr "type" "load")])
7474 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7475 ;; didn't get allocated to a hard register.
7477 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7478 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7479 (match_operand:SI 2 "memory_operand" "")] 8))]
7480 "DEFAULT_ABI == ABI_V4
7482 && (reload_in_progress || reload_completed)"
7483 [(set (match_dup 0) (match_dup 2))
7484 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)] 8))]
7487 ;; For SI, we special-case integers that can't be loaded in one insn. We
7488 ;; do the load 16-bits at a time. We could do this by loading from memory,
7489 ;; and this is even supposed to be faster, but it is simpler not to get
7490 ;; integers in the TOC.
7491 (define_expand "movsi"
7492 [(set (match_operand:SI 0 "general_operand" "")
7493 (match_operand:SI 1 "any_operand" ""))]
7495 "{ rs6000_emit_move (operands[0], operands[1], SImode); DONE; }")
7497 (define_insn "movsi_low"
7498 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7499 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7500 (match_operand 2 "" ""))))]
7501 "TARGET_MACHO && ! TARGET_64BIT"
7502 "{l|lwz} %0,lo16(%2)(%1)"
7503 [(set_attr "type" "load")
7504 (set_attr "length" "4")])
7506 (define_insn "movsi_low_st"
7507 [(set (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7508 (match_operand 2 "" "")))
7509 (match_operand:SI 0 "gpc_reg_operand" "r"))]
7510 "TARGET_MACHO && ! TARGET_64BIT"
7511 "{st|stw} %0,lo16(%2)(%1)"
7512 [(set_attr "type" "store")
7513 (set_attr "length" "4")])
7515 (define_insn "movdf_low"
7516 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,!r")
7517 (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7518 (match_operand 2 "" ""))))]
7519 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7522 switch (which_alternative)
7525 return \"lfd %0,lo16(%2)(%1)\";
7529 operands2[0] = operands[0];
7530 operands2[1] = operands[1];
7531 operands2[2] = operands[2];
7532 operands2[3] = gen_rtx_REG (SImode, RS6000_PIC_OFFSET_TABLE_REGNUM);
7533 output_asm_insn (\"{l|lwz} %0,lo16(%2)(%1)\", operands);
7534 /* We cannot rely on ha16(low half)==ha16(high half), alas,
7535 although in practice it almost always is. */
7536 output_asm_insn (\"{cau|addis} %L0,%3,ha16(%2+4)\", operands2);
7537 return (\"{l|lwz} %L0,lo16(%2+4)(%L0)\");
7543 [(set_attr "type" "load")
7544 (set_attr "length" "4,12")])
7546 (define_insn "movdf_low_st"
7547 [(set (mem:DF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7548 (match_operand 2 "" "")))
7549 (match_operand:DF 0 "gpc_reg_operand" "f"))]
7550 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7551 "stfd %0,lo16(%2)(%1)"
7552 [(set_attr "type" "store")
7553 (set_attr "length" "4")])
7555 (define_insn "movsf_low"
7556 [(set (match_operand:SF 0 "gpc_reg_operand" "=f,!r")
7557 (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7558 (match_operand 2 "" ""))))]
7559 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7562 {l|lwz} %0,lo16(%2)(%1)"
7563 [(set_attr "type" "load")
7564 (set_attr "length" "4")])
7566 (define_insn "movsf_low_st"
7567 [(set (mem:SF (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,b")
7568 (match_operand 2 "" "")))
7569 (match_operand:SF 0 "gpc_reg_operand" "f,!r"))]
7570 "TARGET_MACHO && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_64BIT"
7572 stfs %0,lo16(%2)(%1)
7573 {st|stw} %0,lo16(%2)(%1)"
7574 [(set_attr "type" "store")
7575 (set_attr "length" "4")])
7577 (define_insn "*movsi_internal1"
7578 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7579 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7580 "gpc_reg_operand (operands[0], SImode)
7581 || gpc_reg_operand (operands[1], SImode)"
7585 {l%U1%X1|lwz%U1%X1} %0,%1
7586 {st%U0%X0|stw%U0%X0} %1,%0
7596 [(set_attr "type" "*,*,load,store,*,*,*,*,*,*,mtjmpr,*,*")
7597 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7599 ;; Split a load of a large constant into the appropriate two-insn
7603 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7604 (match_operand:SI 1 "const_int_operand" ""))]
7605 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7606 && (INTVAL (operands[1]) & 0xffff) != 0"
7610 (ior:SI (match_dup 0)
7613 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7615 if (tem == operands[0])
7621 (define_insn "*movsi_internal2"
7622 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
7623 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r,r")
7625 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
7626 "! TARGET_POWERPC64"
7630 [(set_attr "type" "compare")
7631 (set_attr "length" "4,8")])
7634 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7635 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
7637 (set (match_operand:SI 0 "gpc_reg_operand" "") (match_dup 1))]
7638 "! TARGET_POWERPC64 && reload_completed"
7639 [(set (match_dup 0) (match_dup 1))
7641 (compare:CC (match_dup 0)
7645 (define_expand "movhi"
7646 [(set (match_operand:HI 0 "general_operand" "")
7647 (match_operand:HI 1 "any_operand" ""))]
7649 "{ rs6000_emit_move (operands[0], operands[1], HImode); DONE; }")
7651 (define_insn "*movhi_internal"
7652 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7653 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7654 "gpc_reg_operand (operands[0], HImode)
7655 || gpc_reg_operand (operands[1], HImode)"
7665 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
7667 (define_expand "movqi"
7668 [(set (match_operand:QI 0 "general_operand" "")
7669 (match_operand:QI 1 "any_operand" ""))]
7671 "{ rs6000_emit_move (operands[0], operands[1], QImode); DONE; }")
7673 (define_insn "*movqi_internal"
7674 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7675 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7676 "gpc_reg_operand (operands[0], QImode)
7677 || gpc_reg_operand (operands[1], QImode)"
7687 [(set_attr "type" "*,load,store,*,*,*,mtjmpr,*")])
7689 ;; Here is how to move condition codes around. When we store CC data in
7690 ;; an integer register or memory, we store just the high-order 4 bits.
7691 ;; This lets us not shift in the most common case of CR0.
7692 (define_expand "movcc"
7693 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7694 (match_operand:CC 1 "nonimmediate_operand" ""))]
7698 (define_insn "*movcc_internal1"
7699 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7700 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7701 "register_operand (operands[0], CCmode)
7702 || register_operand (operands[1], CCmode)"
7706 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7708 mfcr %0\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7713 {l%U1%X1|lwz%U1%X1} %0,%1
7714 {st%U0%U1|stw%U0%U1} %1,%0"
7715 [(set_attr "type" "cr_logical,mtcr,mtcr,mfcr,mfcr,*,*,*,mtjmpr,load,store")
7716 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7718 ;; For floating-point, we normally deal with the floating-point registers
7719 ;; unless -msoft-float is used. The sole exception is that parameter passing
7720 ;; can produce floating-point values in fixed-point registers. Unless the
7721 ;; value is a simple constant or already in memory, we deal with this by
7722 ;; allocating memory and copying the value explicitly via that memory location.
7723 (define_expand "movsf"
7724 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7725 (match_operand:SF 1 "any_operand" ""))]
7727 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7730 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7731 (match_operand:SF 1 "const_double_operand" ""))]
7733 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7734 || (GET_CODE (operands[0]) == SUBREG
7735 && GET_CODE (SUBREG_REG (operands[0])) == REG
7736 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7737 [(set (match_dup 2) (match_dup 3))]
7743 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7744 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7746 if (! TARGET_POWERPC64)
7747 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7749 operands[2] = gen_lowpart (SImode, operands[0]);
7751 operands[3] = gen_int_mode (l, SImode);
7754 (define_insn "*movsf_hardfloat"
7755 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!r,!r")
7756 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,G,Fn"))]
7757 "(gpc_reg_operand (operands[0], SFmode)
7758 || gpc_reg_operand (operands[1], SFmode))
7759 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7762 {l%U1%X1|lwz%U1%X1} %0,%1
7763 {st%U0%X0|stw%U0%X0} %1,%0
7772 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*")
7773 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
7775 (define_insn "*movsf_softfloat"
7776 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r")
7777 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn"))]
7778 "(gpc_reg_operand (operands[0], SFmode)
7779 || gpc_reg_operand (operands[1], SFmode))
7780 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7786 {l%U1%X1|lwz%U1%X1} %0,%1
7787 {st%U0%X0|stw%U0%X0} %1,%0
7793 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*")
7794 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
7797 (define_expand "movdf"
7798 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7799 (match_operand:DF 1 "any_operand" ""))]
7801 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7804 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7805 (match_operand:DF 1 "const_int_operand" ""))]
7806 "! TARGET_POWERPC64 && reload_completed
7807 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7808 || (GET_CODE (operands[0]) == SUBREG
7809 && GET_CODE (SUBREG_REG (operands[0])) == REG
7810 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7811 [(set (match_dup 2) (match_dup 4))
7812 (set (match_dup 3) (match_dup 1))]
7815 int endian = (WORDS_BIG_ENDIAN == 0);
7816 HOST_WIDE_INT value = INTVAL (operands[1]);
7818 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7819 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7820 #if HOST_BITS_PER_WIDE_INT == 32
7821 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7823 operands[4] = GEN_INT (value >> 32);
7824 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7829 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7830 (match_operand:DF 1 "const_double_operand" ""))]
7831 "! TARGET_POWERPC64 && reload_completed
7832 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7833 || (GET_CODE (operands[0]) == SUBREG
7834 && GET_CODE (SUBREG_REG (operands[0])) == REG
7835 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7836 [(set (match_dup 2) (match_dup 4))
7837 (set (match_dup 3) (match_dup 5))]
7840 int endian = (WORDS_BIG_ENDIAN == 0);
7844 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7845 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7847 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7848 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7849 operands[4] = gen_int_mode (l[endian], SImode);
7850 operands[5] = gen_int_mode (l[1 - endian], SImode);
7854 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7855 (match_operand:DF 1 "easy_fp_constant" ""))]
7856 "TARGET_POWERPC64 && reload_completed
7857 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7858 || (GET_CODE (operands[0]) == SUBREG
7859 && GET_CODE (SUBREG_REG (operands[0])) == REG
7860 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7861 [(set (match_dup 2) (match_dup 3))]
7864 int endian = (WORDS_BIG_ENDIAN == 0);
7867 #if HOST_BITS_PER_WIDE_INT >= 64
7871 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7872 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7874 operands[2] = gen_lowpart (DImode, operands[0]);
7875 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
7876 #if HOST_BITS_PER_WIDE_INT >= 64
7877 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
7878 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
7880 operands[3] = gen_int_mode (val, DImode);
7882 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
7886 ;; Don't have reload use general registers to load a constant. First,
7887 ;; it might not work if the output operand is the equivalent of
7888 ;; a non-offsettable memref, but also it is less efficient than loading
7889 ;; the constant into an FP register, since it will probably be used there.
7890 ;; The "??" is a kludge until we can figure out a more reasonable way
7891 ;; of handling these non-offsettable values.
7892 (define_insn "*movdf_hardfloat32"
7893 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
7894 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
7895 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
7896 && (gpc_reg_operand (operands[0], DFmode)
7897 || gpc_reg_operand (operands[1], DFmode))"
7900 switch (which_alternative)
7905 /* We normally copy the low-numbered register first. However, if
7906 the first register operand 0 is the same as the second register
7907 of operand 1, we must copy in the opposite order. */
7908 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7909 return \"mr %L0,%L1\;mr %0,%1\";
7911 return \"mr %0,%1\;mr %L0,%L1\";
7913 if (offsettable_memref_p (operands[1])
7914 || (GET_CODE (operands[1]) == MEM
7915 && (GET_CODE (XEXP (operands[1], 0)) == LO_SUM
7916 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
7917 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)))
7919 /* If the low-address word is used in the address, we must load
7920 it last. Otherwise, load it first. Note that we cannot have
7921 auto-increment in that case since the address register is
7922 known to be dead. */
7923 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7925 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7927 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7933 addreg = find_addr_reg (XEXP (operands[1], 0));
7934 if (refers_to_regno_p (REGNO (operands[0]),
7935 REGNO (operands[0]) + 1,
7938 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7939 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7940 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7941 return \"{lx|lwzx} %0,%1\";
7945 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
7946 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7947 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7948 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7953 if (offsettable_memref_p (operands[0])
7954 || (GET_CODE (operands[0]) == MEM
7955 && (GET_CODE (XEXP (operands[0], 0)) == LO_SUM
7956 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
7957 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)))
7958 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
7963 addreg = find_addr_reg (XEXP (operands[0], 0));
7964 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
7965 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7966 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
7967 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7971 return \"fmr %0,%1\";
7973 return \"lfd%U1%X1 %0,%1\";
7975 return \"stfd%U0%X0 %1,%0\";
7982 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*")
7983 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
7985 (define_insn "*movdf_softfloat32"
7986 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
7987 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
7988 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
7989 && (gpc_reg_operand (operands[0], DFmode)
7990 || gpc_reg_operand (operands[1], DFmode))"
7993 switch (which_alternative)
7998 /* We normally copy the low-numbered register first. However, if
7999 the first register operand 0 is the same as the second register of
8000 operand 1, we must copy in the opposite order. */
8001 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8002 return \"mr %L0,%L1\;mr %0,%1\";
8004 return \"mr %0,%1\;mr %L0,%L1\";
8006 /* If the low-address word is used in the address, we must load
8007 it last. Otherwise, load it first. Note that we cannot have
8008 auto-increment in that case since the address register is
8009 known to be dead. */
8010 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8012 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8014 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8016 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8023 [(set_attr "type" "*,load,store,*,*,*")
8024 (set_attr "length" "8,8,8,8,12,16")])
8026 (define_insn "*movdf_hardfloat64"
8027 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!cl,!r,!r,!r,!r")
8028 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,r,h,G,H,F"))]
8029 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
8030 && (gpc_reg_operand (operands[0], DFmode)
8031 || gpc_reg_operand (operands[1], DFmode))"
8044 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*")
8045 (set_attr "length" "4,4,4,4,4,4,4,4,8,12,16")])
8047 (define_insn "*movdf_softfloat64"
8048 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r")
8049 (match_operand:DF 1 "input_operand" "r,r,h,m,r,G,H,F"))]
8050 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
8051 && (gpc_reg_operand (operands[0], DFmode)
8052 || gpc_reg_operand (operands[1], DFmode))"
8062 [(set_attr "type" "*,*,*,load,store,*,*,*")
8063 (set_attr "length" "4,4,4,4,4,8,12,16")])
8065 (define_expand "movtf"
8066 [(set (match_operand:TF 0 "general_operand" "")
8067 (match_operand:TF 1 "any_operand" ""))]
8068 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8069 && TARGET_LONG_DOUBLE_128"
8070 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
8072 (define_insn "*movtf_internal"
8073 [(set (match_operand:TF 0 "nonimmediate_operand" "=f,f,m,!r,!r,!r")
8074 (match_operand:TF 1 "input_operand" "f,m,f,G,H,F"))]
8075 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8076 && TARGET_LONG_DOUBLE_128
8077 && (gpc_reg_operand (operands[0], TFmode)
8078 || gpc_reg_operand (operands[1], TFmode))"
8081 switch (which_alternative)
8086 /* We normally copy the low-numbered register first. However, if
8087 the first register operand 0 is the same as the second register of
8088 operand 1, we must copy in the opposite order. */
8089 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8090 return \"fmr %L0,%L1\;fmr %0,%1\";
8092 return \"fmr %0,%1\;fmr %L0,%L1\";
8094 return \"lfd %0,%1\;lfd %L0,%Y1\";
8096 return \"stfd %1,%0\;stfd %L1,%Y0\";
8103 [(set_attr "type" "fp,fpload,fpstore,*,*,*")
8104 (set_attr "length" "8,8,8,12,16,20")])
8107 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8108 (match_operand:TF 1 "easy_fp_constant" ""))]
8109 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8110 && TARGET_HARD_FLOAT && TARGET_FPRS && ! TARGET_POWERPC64
8111 && TARGET_LONG_DOUBLE_128 && reload_completed
8112 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8113 || (GET_CODE (operands[0]) == SUBREG
8114 && GET_CODE (SUBREG_REG (operands[0])) == REG
8115 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8116 [(set (match_dup 2) (match_dup 6))
8117 (set (match_dup 3) (match_dup 7))
8118 (set (match_dup 4) (match_dup 8))
8119 (set (match_dup 5) (match_dup 9))]
8125 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8126 REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, l);
8128 operands[2] = operand_subword (operands[0], 0, 0, TFmode);
8129 operands[3] = operand_subword (operands[0], 1, 0, TFmode);
8130 operands[4] = operand_subword (operands[0], 2, 0, TFmode);
8131 operands[5] = operand_subword (operands[0], 3, 0, TFmode);
8132 operands[6] = gen_int_mode (l[0], SImode);
8133 operands[7] = gen_int_mode (l[1], SImode);
8134 operands[8] = gen_int_mode (l[2], SImode);
8135 operands[9] = gen_int_mode (l[3], SImode);
8139 [(set (match_operand:TF 0 "gpc_reg_operand" "")
8140 (match_operand:TF 1 "easy_fp_constant" ""))]
8141 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8142 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
8143 && TARGET_LONG_DOUBLE_128 && reload_completed
8144 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
8145 || (GET_CODE (operands[0]) == SUBREG
8146 && GET_CODE (SUBREG_REG (operands[0])) == REG
8147 && REGNO (SUBREG_REG (operands[0])) <= 31))"
8148 [(set (match_dup 2) (match_dup 4))
8149 (set (match_dup 3) (match_dup 5))]
8154 #if HOST_BITS_PER_WIDE_INT >= 64
8158 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
8159 REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, l);
8161 operands[2] = gen_lowpart (DImode, operands[0]);
8162 operands[3] = gen_highpart (DImode, operands[0]);
8163 #if HOST_BITS_PER_WIDE_INT >= 64
8164 val = ((HOST_WIDE_INT)(unsigned long)l[0] << 32
8165 | ((HOST_WIDE_INT)(unsigned long)l[1]));
8166 operands[4] = gen_int_mode (val, DImode);
8168 val = ((HOST_WIDE_INT)(unsigned long)l[2] << 32
8169 | ((HOST_WIDE_INT)(unsigned long)l[3]));
8170 operands[5] = gen_int_mode (val, DImode);
8172 operands[4] = immed_double_const (l[1], l[0], DImode);
8173 operands[5] = immed_double_const (l[3], l[2], DImode);
8177 (define_insn "extenddftf2"
8178 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8179 (float_extend:TF (match_operand:DF 1 "gpc_reg_operand" "f")))]
8180 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8181 && TARGET_LONG_DOUBLE_128"
8184 if (REGNO (operands[0]) == REGNO (operands[1]))
8185 return \"fsub %L0,%L0,%L0\";
8187 return \"fmr %0,%1\;fsub %L0,%L0,%L0\";
8189 [(set_attr "type" "fp")])
8191 (define_insn "extendsftf2"
8192 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8193 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "f")))]
8194 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8195 && TARGET_LONG_DOUBLE_128"
8198 if (REGNO (operands[0]) == REGNO (operands[1]))
8199 return \"fsub %L0,%L0,%L0\";
8201 return \"fmr %0,%1\;fsub %L0,%L0,%L0\";
8203 [(set_attr "type" "fp")])
8205 (define_insn "trunctfdf2"
8206 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
8207 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8208 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8209 && TARGET_LONG_DOUBLE_128"
8211 [(set_attr "type" "fp")
8212 (set_attr "length" "8")])
8214 (define_insn_and_split "trunctfsf2"
8215 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
8216 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
8217 (clobber (match_scratch:DF 2 "=f"))]
8218 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
8219 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8221 "&& reload_completed"
8223 (float_truncate:DF (match_dup 1)))
8225 (float_truncate:SF (match_dup 2)))]
8228 (define_insn_and_split "floatditf2"
8229 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8230 (float:TF (match_operand:DI 1 "gpc_reg_operand" "*f")))
8231 (clobber (match_scratch:DF 2 "=f"))]
8232 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8233 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8235 "&& reload_completed"
8237 (float:DF (match_dup 1)))
8239 (float_extend:TF (match_dup 2)))]
8242 (define_insn_and_split "floatsitf2"
8243 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8244 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))
8245 (clobber (match_scratch:DF 2 "=f"))]
8246 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8247 && TARGET_LONG_DOUBLE_128"
8249 "&& reload_completed"
8251 (float:DF (match_dup 1)))
8253 (float_extend:TF (match_dup 2)))]
8256 (define_insn_and_split "fix_trunctfdi2"
8257 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
8258 (fix:DI (match_operand:TF 1 "gpc_reg_operand" "f")))
8259 (clobber (match_scratch:DF 2 "=f"))]
8260 "DEFAULT_ABI == ABI_AIX && TARGET_POWERPC64
8261 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8263 "&& reload_completed"
8265 (float_truncate:DF (match_dup 1)))
8267 (fix:DI (match_dup 2)))]
8270 (define_insn_and_split "fix_trunctfsi2"
8271 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
8272 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
8273 (clobber (match_scratch:DF 2 "=f"))]
8274 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8275 && TARGET_LONG_DOUBLE_128"
8277 "&& reload_completed"
8279 (float_truncate:DF (match_dup 1)))
8281 (fix:SI (match_dup 2)))]
8284 (define_insn "negtf2"
8285 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8286 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8287 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8288 && TARGET_LONG_DOUBLE_128"
8291 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8292 return \"fneg %L0,%L1\;fneg %0,%1\";
8294 return \"fneg %0,%1\;fneg %L0,%L1\";
8296 [(set_attr "type" "fp")
8297 (set_attr "length" "8")])
8299 (define_insn "abstf2"
8300 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8301 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8302 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8303 && TARGET_LONG_DOUBLE_128"
8306 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8307 return \"fabs %L0,%L1\;fabs %0,%1\";
8309 return \"fabs %0,%1\;fabs %L0,%L1\";
8311 [(set_attr "type" "fp")
8312 (set_attr "length" "8")])
8315 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8316 (neg:TF (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f"))))]
8317 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
8318 && TARGET_LONG_DOUBLE_128"
8321 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8322 return \"fnabs %L0,%L1\;fnabs %0,%1\";
8324 return \"fnabs %0,%1\;fnabs %L0,%L1\";
8326 [(set_attr "type" "fp")
8327 (set_attr "length" "8")])
8329 ;; Next come the multi-word integer load and store and the load and store
8331 (define_expand "movdi"
8332 [(set (match_operand:DI 0 "general_operand" "")
8333 (match_operand:DI 1 "any_operand" ""))]
8335 "{ rs6000_emit_move (operands[0], operands[1], DImode); DONE; }")
8337 (define_insn "*movdi_internal32"
8338 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,f,f,m,r,r,r,r,r")
8339 (match_operand:DI 1 "input_operand" "r,m,r,f,m,f,IJK,n,G,H,F"))]
8341 && (gpc_reg_operand (operands[0], DImode)
8342 || gpc_reg_operand (operands[1], DImode))"
8345 switch (which_alternative)
8350 /* We normally copy the low-numbered register first. However, if
8351 the first register operand 0 is the same as the second register of
8352 operand 1, we must copy in the opposite order. */
8353 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8354 return \"mr %L0,%L1\;mr %0,%1\";
8356 return \"mr %0,%1\;mr %L0,%L1\";
8358 /* If the low-address word is used in the address, we must load it
8359 last. Otherwise, load it first. Note that we cannot have
8360 auto-increment in that case since the address register is known to be
8362 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8364 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
8366 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
8368 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
8370 return \"fmr %0,%1\";
8372 return \"lfd%U1%X1 %0,%1\";
8374 return \"stfd%U0%X0 %1,%0\";
8383 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,*,*,*,*")
8384 (set_attr "length" "8,8,8,4,4,4,8,12,8,12,16")])
8387 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8388 (match_operand:DI 1 "const_int_operand" ""))]
8389 "! TARGET_POWERPC64 && reload_completed"
8390 [(set (match_dup 2) (match_dup 4))
8391 (set (match_dup 3) (match_dup 1))]
8394 HOST_WIDE_INT value = INTVAL (operands[1]);
8395 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8397 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8399 #if HOST_BITS_PER_WIDE_INT == 32
8400 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8402 operands[4] = GEN_INT (value >> 32);
8403 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8408 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8409 (match_operand:DI 1 "const_double_operand" ""))]
8410 "HOST_BITS_PER_WIDE_INT == 32 && ! TARGET_POWERPC64 && reload_completed"
8411 [(set (match_dup 2) (match_dup 4))
8412 (set (match_dup 3) (match_dup 5))]
8415 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8417 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8419 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8420 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8423 (define_insn "*movdi_internal64"
8424 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,?f,f,m,r,*h,*h")
8425 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8427 && (gpc_reg_operand (operands[0], DImode)
8428 || gpc_reg_operand (operands[1], DImode))"
8443 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,*,mtjmpr,*")
8444 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8446 ;; immediate value valid for a single instruction hiding in a const_double
8448 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8449 (match_operand:DI 1 "const_double_operand" "F"))]
8450 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8451 && GET_CODE (operands[1]) == CONST_DOUBLE
8452 && num_insns_constant (operands[1], DImode) == 1"
8455 return ((unsigned HOST_WIDE_INT)
8456 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8457 ? \"li %0,%1\" : \"lis %0,%v1\";
8460 ;; Generate all one-bits and clear left or right.
8461 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8463 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8464 (match_operand:DI 1 "mask64_operand" ""))]
8465 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8466 [(set (match_dup 0) (const_int -1))
8468 (and:DI (rotate:DI (match_dup 0)
8473 ;; Split a load of a large constant into the appropriate five-instruction
8474 ;; sequence. Handle anything in a constant number of insns.
8475 ;; When non-easy constants can go in the TOC, this should use
8476 ;; easy_fp_constant predicate.
8478 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8479 (match_operand:DI 1 "const_int_operand" ""))]
8480 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8481 [(set (match_dup 0) (match_dup 2))
8482 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8484 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8486 if (tem == operands[0])
8493 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8494 (match_operand:DI 1 "const_double_operand" ""))]
8495 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8496 [(set (match_dup 0) (match_dup 2))
8497 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8499 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8501 if (tem == operands[0])
8507 ;; Split a load of a large constant into the appropriate five-instruction
8508 (define_insn "*movdi_internal2"
8509 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
8510 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r,r")
8512 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r") (match_dup 1))]
8517 [(set_attr "type" "compare")
8518 (set_attr "length" "4,8")])
8521 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
8522 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "")
8524 (set (match_operand:DI 0 "gpc_reg_operand" "") (match_dup 1))]
8525 "TARGET_POWERPC64 && reload_completed"
8526 [(set (match_dup 0) (match_dup 1))
8528 (compare:CC (match_dup 0)
8532 ;; TImode is similar, except that we usually want to compute the address into
8533 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8534 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8535 (define_expand "movti"
8536 [(parallel [(set (match_operand:TI 0 "general_operand" "")
8537 (match_operand:TI 1 "general_operand" ""))
8538 (clobber (scratch:SI))])]
8539 "TARGET_STRING || TARGET_POWERPC64"
8540 "{ rs6000_emit_move (operands[0], operands[1], TImode); DONE; }")
8542 ;; We say that MQ is clobbered in the last alternative because the first
8543 ;; alternative would never get used otherwise since it would need a reload
8544 ;; while the 2nd alternative would not. We put memory cases first so they
8545 ;; are preferred. Otherwise, we'd try to reload the output instead of
8546 ;; giving the SCRATCH mq.
8547 (define_insn "*movti_power"
8548 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8549 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))
8550 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X"))]
8551 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
8552 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8555 switch (which_alternative)
8561 return \"{stsi|stswi} %1,%P0,16\";
8563 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
8565 /* Normally copy registers with lowest numbered register copied first.
8566 But copy in the other order if the first register of the output
8567 is the second, third, or fourth register in the input. */
8568 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
8569 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
8570 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
8572 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
8574 /* If the address is not used in the output, we can use lsi. Otherwise,
8575 fall through to generating four loads. */
8576 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
8577 return \"{lsi|lswi} %0,%P1,16\";
8578 /* ... fall through ... */
8580 /* If the address register is the same as the register for the lowest-
8581 addressed word, load it last. Similarly for the next two words.
8582 Otherwise load lowest address to highest. */
8583 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8585 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
8586 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
8587 REGNO (operands[0]) + 2, operands[1], 0))
8588 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
8589 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
8590 REGNO (operands[0]) + 3, operands[1], 0))
8591 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
8593 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
8596 [(set_attr "type" "store,store,*,load,load")
8597 (set_attr "length" "4,16,16,4,16")])
8599 (define_insn "*movti_string"
8600 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r")
8601 (match_operand:TI 1 "reg_or_mem_operand" "r,r,r,Q,m"))]
8602 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
8603 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8606 switch (which_alternative)
8612 return \"{stsi|stswi} %1,%P0,16\";
8614 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\;{st|stw} %Y1,%Y0\;{st|stw} %Z1,%Z0\";
8616 /* Normally copy registers with lowest numbered register copied first.
8617 But copy in the other order if the first register of the output
8618 is the second, third, or fourth register in the input. */
8619 if (REGNO (operands[0]) >= REGNO (operands[1]) + 1
8620 && REGNO (operands[0]) <= REGNO (operands[1]) + 3)
8621 return \"mr %Z0,%Z1\;mr %Y0,%Y1\;mr %L0,%L1\;mr %0,%1\";
8623 return \"mr %0,%1\;mr %L0,%L1\;mr %Y0,%Y1\;mr %Z0,%Z1\";
8625 /* If the address is not used in the output, we can use lsi. Otherwise,
8626 fall through to generating four loads. */
8627 if (! reg_overlap_mentioned_p (operands[0], operands[1]))
8628 return \"{lsi|lswi} %0,%P1,16\";
8629 /* ... fall through ... */
8631 /* If the address register is the same as the register for the lowest-
8632 addressed word, load it last. Similarly for the next two words.
8633 Otherwise load lowest address to highest. */
8634 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8636 return \"{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %0,%1\";
8637 else if (refers_to_regno_p (REGNO (operands[0]) + 1,
8638 REGNO (operands[0]) + 2, operands[1], 0))
8639 return \"{l|lwz} %0,%1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\;{l|lwz} %L0,%L1\";
8640 else if (refers_to_regno_p (REGNO (operands[0]) + 2,
8641 REGNO (operands[0]) + 3, operands[1], 0))
8642 return \"{l|lwz} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Z0,%Z1\;{l|lwz} %Y0,%Y1\";
8644 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\;{l|lwz} %Y0,%Y1\;{l|lwz} %Z0,%Z1\";
8647 [(set_attr "type" "store,store,*,load,load")
8648 (set_attr "length" "4,16,16,4,16")])
8650 (define_insn "*movti_ppc64"
8651 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
8652 (match_operand:TI 1 "input_operand" "r,m,r"))]
8653 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8654 || gpc_reg_operand (operands[1], TImode))"
8657 switch (which_alternative)
8662 /* We normally copy the low-numbered register first. However, if
8663 the first register operand 0 is the same as the second register of
8664 operand 1, we must copy in the opposite order. */
8665 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8666 return \"mr %L0,%L1\;mr %0,%1\";
8668 return \"mr %0,%1\;mr %L0,%L1\";
8670 /* If the low-address word is used in the address, we must load it
8671 last. Otherwise, load it first. Note that we cannot have
8672 auto-increment in that case since the address register is known to be
8674 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
8676 return \"ld %L0,%L1\;ld %0,%1\";
8678 return \"ld%U1 %0,%1\;ld %L0,%L1\";
8680 return \"std%U0 %1,%0\;std %L1,%L0\";
8683 [(set_attr "type" "*,load,store")
8684 (set_attr "length" "8,8,8")])
8686 (define_expand "load_multiple"
8687 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8688 (match_operand:SI 1 "" ""))
8689 (use (match_operand:SI 2 "" ""))])]
8690 "TARGET_STRING && !TARGET_POWERPC64"
8698 /* Support only loading a constant number of fixed-point registers from
8699 memory and only bother with this if more than two; the machine
8700 doesn't support more than eight. */
8701 if (GET_CODE (operands[2]) != CONST_INT
8702 || INTVAL (operands[2]) <= 2
8703 || INTVAL (operands[2]) > 8
8704 || GET_CODE (operands[1]) != MEM
8705 || GET_CODE (operands[0]) != REG
8706 || REGNO (operands[0]) >= 32)
8709 count = INTVAL (operands[2]);
8710 regno = REGNO (operands[0]);
8712 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8713 op1 = replace_equiv_address (operands[1],
8714 force_reg (SImode, XEXP (operands[1], 0)));
8716 for (i = 0; i < count; i++)
8717 XVECEXP (operands[3], 0, i)
8718 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8719 adjust_address_nv (op1, SImode, i * 4));
8722 (define_insn "*ldmsi8"
8723 [(match_parallel 0 "load_multiple_operation"
8724 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8725 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8726 (set (match_operand:SI 3 "gpc_reg_operand" "")
8727 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8728 (set (match_operand:SI 4 "gpc_reg_operand" "")
8729 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8730 (set (match_operand:SI 5 "gpc_reg_operand" "")
8731 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8732 (set (match_operand:SI 6 "gpc_reg_operand" "")
8733 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8734 (set (match_operand:SI 7 "gpc_reg_operand" "")
8735 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8736 (set (match_operand:SI 8 "gpc_reg_operand" "")
8737 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8738 (set (match_operand:SI 9 "gpc_reg_operand" "")
8739 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8740 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8742 { return rs6000_output_load_multiple (operands); }"
8743 [(set_attr "type" "load")
8744 (set_attr "length" "32")])
8746 (define_insn "*ldmsi7"
8747 [(match_parallel 0 "load_multiple_operation"
8748 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8749 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8750 (set (match_operand:SI 3 "gpc_reg_operand" "")
8751 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8752 (set (match_operand:SI 4 "gpc_reg_operand" "")
8753 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8754 (set (match_operand:SI 5 "gpc_reg_operand" "")
8755 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8756 (set (match_operand:SI 6 "gpc_reg_operand" "")
8757 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8758 (set (match_operand:SI 7 "gpc_reg_operand" "")
8759 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8760 (set (match_operand:SI 8 "gpc_reg_operand" "")
8761 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8762 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8764 { return rs6000_output_load_multiple (operands); }"
8765 [(set_attr "type" "load")
8766 (set_attr "length" "32")])
8768 (define_insn "*ldmsi6"
8769 [(match_parallel 0 "load_multiple_operation"
8770 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8771 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8772 (set (match_operand:SI 3 "gpc_reg_operand" "")
8773 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8774 (set (match_operand:SI 4 "gpc_reg_operand" "")
8775 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8776 (set (match_operand:SI 5 "gpc_reg_operand" "")
8777 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8778 (set (match_operand:SI 6 "gpc_reg_operand" "")
8779 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8780 (set (match_operand:SI 7 "gpc_reg_operand" "")
8781 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8782 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8784 { return rs6000_output_load_multiple (operands); }"
8785 [(set_attr "type" "load")
8786 (set_attr "length" "32")])
8788 (define_insn "*ldmsi5"
8789 [(match_parallel 0 "load_multiple_operation"
8790 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8791 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8792 (set (match_operand:SI 3 "gpc_reg_operand" "")
8793 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8794 (set (match_operand:SI 4 "gpc_reg_operand" "")
8795 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8796 (set (match_operand:SI 5 "gpc_reg_operand" "")
8797 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8798 (set (match_operand:SI 6 "gpc_reg_operand" "")
8799 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8800 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8802 { return rs6000_output_load_multiple (operands); }"
8803 [(set_attr "type" "load")
8804 (set_attr "length" "32")])
8806 (define_insn "*ldmsi4"
8807 [(match_parallel 0 "load_multiple_operation"
8808 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8809 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8810 (set (match_operand:SI 3 "gpc_reg_operand" "")
8811 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8812 (set (match_operand:SI 4 "gpc_reg_operand" "")
8813 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8814 (set (match_operand:SI 5 "gpc_reg_operand" "")
8815 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8816 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8818 { return rs6000_output_load_multiple (operands); }"
8819 [(set_attr "type" "load")
8820 (set_attr "length" "32")])
8822 (define_insn "*ldmsi3"
8823 [(match_parallel 0 "load_multiple_operation"
8824 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8825 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8826 (set (match_operand:SI 3 "gpc_reg_operand" "")
8827 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8828 (set (match_operand:SI 4 "gpc_reg_operand" "")
8829 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8830 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8832 { return rs6000_output_load_multiple (operands); }"
8833 [(set_attr "type" "load")
8834 (set_attr "length" "32")])
8836 (define_expand "store_multiple"
8837 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8838 (match_operand:SI 1 "" ""))
8839 (clobber (scratch:SI))
8840 (use (match_operand:SI 2 "" ""))])]
8841 "TARGET_STRING && !TARGET_POWERPC64"
8850 /* Support only storing a constant number of fixed-point registers to
8851 memory and only bother with this if more than two; the machine
8852 doesn't support more than eight. */
8853 if (GET_CODE (operands[2]) != CONST_INT
8854 || INTVAL (operands[2]) <= 2
8855 || INTVAL (operands[2]) > 8
8856 || GET_CODE (operands[0]) != MEM
8857 || GET_CODE (operands[1]) != REG
8858 || REGNO (operands[1]) >= 32)
8861 count = INTVAL (operands[2]);
8862 regno = REGNO (operands[1]);
8864 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8865 to = force_reg (SImode, XEXP (operands[0], 0));
8866 op0 = replace_equiv_address (operands[0], to);
8868 XVECEXP (operands[3], 0, 0)
8869 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8870 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8871 gen_rtx_SCRATCH (SImode));
8873 for (i = 1; i < count; i++)
8874 XVECEXP (operands[3], 0, i + 1)
8875 = gen_rtx_SET (VOIDmode,
8876 adjust_address_nv (op0, SImode, i * 4),
8877 gen_rtx_REG (SImode, regno + i));
8880 (define_insn "*store_multiple_power"
8881 [(match_parallel 0 "store_multiple_operation"
8882 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8883 (match_operand:SI 2 "gpc_reg_operand" "r"))
8884 (clobber (match_scratch:SI 3 "=q"))])]
8885 "TARGET_STRING && TARGET_POWER"
8886 "{stsi|stswi} %2,%P1,%O0"
8887 [(set_attr "type" "store")])
8889 (define_insn "*stmsi8"
8890 [(match_parallel 0 "store_multiple_operation"
8891 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8892 (match_operand:SI 2 "gpc_reg_operand" "r"))
8893 (clobber (match_scratch:SI 3 "X"))
8894 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8895 (match_operand:SI 4 "gpc_reg_operand" "r"))
8896 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8897 (match_operand:SI 5 "gpc_reg_operand" "r"))
8898 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8899 (match_operand:SI 6 "gpc_reg_operand" "r"))
8900 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8901 (match_operand:SI 7 "gpc_reg_operand" "r"))
8902 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8903 (match_operand:SI 8 "gpc_reg_operand" "r"))
8904 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8905 (match_operand:SI 9 "gpc_reg_operand" "r"))
8906 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8907 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8908 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8909 "{stsi|stswi} %2,%1,%O0"
8910 [(set_attr "type" "store")])
8912 (define_insn "*stmsi7"
8913 [(match_parallel 0 "store_multiple_operation"
8914 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8915 (match_operand:SI 2 "gpc_reg_operand" "r"))
8916 (clobber (match_scratch:SI 3 "X"))
8917 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8918 (match_operand:SI 4 "gpc_reg_operand" "r"))
8919 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8920 (match_operand:SI 5 "gpc_reg_operand" "r"))
8921 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8922 (match_operand:SI 6 "gpc_reg_operand" "r"))
8923 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8924 (match_operand:SI 7 "gpc_reg_operand" "r"))
8925 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8926 (match_operand:SI 8 "gpc_reg_operand" "r"))
8927 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8928 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8929 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
8930 "{stsi|stswi} %2,%1,%O0"
8931 [(set_attr "type" "store")])
8933 (define_insn "*stmsi6"
8934 [(match_parallel 0 "store_multiple_operation"
8935 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8936 (match_operand:SI 2 "gpc_reg_operand" "r"))
8937 (clobber (match_scratch:SI 3 "X"))
8938 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8939 (match_operand:SI 4 "gpc_reg_operand" "r"))
8940 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8941 (match_operand:SI 5 "gpc_reg_operand" "r"))
8942 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8943 (match_operand:SI 6 "gpc_reg_operand" "r"))
8944 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8945 (match_operand:SI 7 "gpc_reg_operand" "r"))
8946 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8947 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
8948 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
8949 "{stsi|stswi} %2,%1,%O0"
8950 [(set_attr "type" "store")])
8952 (define_insn "*stmsi5"
8953 [(match_parallel 0 "store_multiple_operation"
8954 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8955 (match_operand:SI 2 "gpc_reg_operand" "r"))
8956 (clobber (match_scratch:SI 3 "X"))
8957 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8958 (match_operand:SI 4 "gpc_reg_operand" "r"))
8959 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8960 (match_operand:SI 5 "gpc_reg_operand" "r"))
8961 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8962 (match_operand:SI 6 "gpc_reg_operand" "r"))
8963 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8964 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
8965 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
8966 "{stsi|stswi} %2,%1,%O0"
8967 [(set_attr "type" "store")])
8969 (define_insn "*stmsi4"
8970 [(match_parallel 0 "store_multiple_operation"
8971 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8972 (match_operand:SI 2 "gpc_reg_operand" "r"))
8973 (clobber (match_scratch:SI 3 "X"))
8974 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8975 (match_operand:SI 4 "gpc_reg_operand" "r"))
8976 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8977 (match_operand:SI 5 "gpc_reg_operand" "r"))
8978 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8979 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
8980 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
8981 "{stsi|stswi} %2,%1,%O0"
8982 [(set_attr "type" "store")])
8984 (define_insn "*stmsi3"
8985 [(match_parallel 0 "store_multiple_operation"
8986 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8987 (match_operand:SI 2 "gpc_reg_operand" "r"))
8988 (clobber (match_scratch:SI 3 "X"))
8989 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8990 (match_operand:SI 4 "gpc_reg_operand" "r"))
8991 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8992 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
8993 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
8994 "{stsi|stswi} %2,%1,%O0"
8995 [(set_attr "type" "store")])
8997 ;; String/block move insn.
8998 ;; Argument 0 is the destination
8999 ;; Argument 1 is the source
9000 ;; Argument 2 is the length
9001 ;; Argument 3 is the alignment
9003 (define_expand "movstrsi"
9004 [(parallel [(set (match_operand:BLK 0 "" "")
9005 (match_operand:BLK 1 "" ""))
9006 (use (match_operand:SI 2 "" ""))
9007 (use (match_operand:SI 3 "" ""))])]
9011 if (expand_block_move (operands))
9017 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
9018 ;; register allocator doesn't have a clue about allocating 8 word registers.
9019 ;; rD/rS = r5 is preferred, efficient form.
9020 (define_expand "movstrsi_8reg"
9021 [(parallel [(set (match_operand 0 "" "")
9022 (match_operand 1 "" ""))
9023 (use (match_operand 2 "" ""))
9024 (use (match_operand 3 "" ""))
9025 (clobber (reg:SI 5))
9026 (clobber (reg:SI 6))
9027 (clobber (reg:SI 7))
9028 (clobber (reg:SI 8))
9029 (clobber (reg:SI 9))
9030 (clobber (reg:SI 10))
9031 (clobber (reg:SI 11))
9032 (clobber (reg:SI 12))
9033 (clobber (match_scratch:SI 4 ""))])]
9038 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9039 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9040 (use (match_operand:SI 2 "immediate_operand" "i"))
9041 (use (match_operand:SI 3 "immediate_operand" "i"))
9042 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9043 (clobber (reg:SI 6))
9044 (clobber (reg:SI 7))
9045 (clobber (reg:SI 8))
9046 (clobber (reg:SI 9))
9047 (clobber (reg:SI 10))
9048 (clobber (reg:SI 11))
9049 (clobber (reg:SI 12))
9050 (clobber (match_scratch:SI 5 "=q"))]
9051 "TARGET_STRING && TARGET_POWER
9052 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9053 || INTVAL (operands[2]) == 0)
9054 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9055 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9056 && REGNO (operands[4]) == 5"
9057 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9058 [(set_attr "type" "load")
9059 (set_attr "length" "8")])
9062 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9063 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9064 (use (match_operand:SI 2 "immediate_operand" "i"))
9065 (use (match_operand:SI 3 "immediate_operand" "i"))
9066 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9067 (clobber (reg:SI 6))
9068 (clobber (reg:SI 7))
9069 (clobber (reg:SI 8))
9070 (clobber (reg:SI 9))
9071 (clobber (reg:SI 10))
9072 (clobber (reg:SI 11))
9073 (clobber (reg:SI 12))
9074 (clobber (match_scratch:SI 5 "X"))]
9075 "TARGET_STRING && ! TARGET_POWER
9076 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9077 || INTVAL (operands[2]) == 0)
9078 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9079 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9080 && REGNO (operands[4]) == 5"
9081 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9082 [(set_attr "type" "load")
9083 (set_attr "length" "8")])
9086 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9087 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9088 (use (match_operand:SI 2 "immediate_operand" "i"))
9089 (use (match_operand:SI 3 "immediate_operand" "i"))
9090 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9091 (clobber (reg:SI 6))
9092 (clobber (reg:SI 7))
9093 (clobber (reg:SI 8))
9094 (clobber (reg:SI 9))
9095 (clobber (reg:SI 10))
9096 (clobber (reg:SI 11))
9097 (clobber (reg:SI 12))
9098 (clobber (match_scratch:SI 5 "X"))]
9099 "TARGET_STRING && TARGET_POWERPC64
9100 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
9101 || INTVAL (operands[2]) == 0)
9102 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
9103 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
9104 && REGNO (operands[4]) == 5"
9105 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9106 [(set_attr "type" "load")
9107 (set_attr "length" "8")])
9109 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
9110 ;; register allocator doesn't have a clue about allocating 6 word registers.
9111 ;; rD/rS = r5 is preferred, efficient form.
9112 (define_expand "movstrsi_6reg"
9113 [(parallel [(set (match_operand 0 "" "")
9114 (match_operand 1 "" ""))
9115 (use (match_operand 2 "" ""))
9116 (use (match_operand 3 "" ""))
9117 (clobber (reg:SI 5))
9118 (clobber (reg:SI 6))
9119 (clobber (reg:SI 7))
9120 (clobber (reg:SI 8))
9121 (clobber (reg:SI 9))
9122 (clobber (reg:SI 10))
9123 (clobber (match_scratch:SI 4 ""))])]
9128 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9129 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9130 (use (match_operand:SI 2 "immediate_operand" "i"))
9131 (use (match_operand:SI 3 "immediate_operand" "i"))
9132 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9133 (clobber (reg:SI 6))
9134 (clobber (reg:SI 7))
9135 (clobber (reg:SI 8))
9136 (clobber (reg:SI 9))
9137 (clobber (reg:SI 10))
9138 (clobber (match_scratch:SI 5 "=q"))]
9139 "TARGET_STRING && TARGET_POWER
9140 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
9141 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9142 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9143 && REGNO (operands[4]) == 5"
9144 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9145 [(set_attr "type" "load")
9146 (set_attr "length" "8")])
9149 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9150 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9151 (use (match_operand:SI 2 "immediate_operand" "i"))
9152 (use (match_operand:SI 3 "immediate_operand" "i"))
9153 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9154 (clobber (reg:SI 6))
9155 (clobber (reg:SI 7))
9156 (clobber (reg:SI 8))
9157 (clobber (reg:SI 9))
9158 (clobber (reg:SI 10))
9159 (clobber (match_scratch:SI 5 "X"))]
9160 "TARGET_STRING && ! TARGET_POWER
9161 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9162 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9163 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9164 && REGNO (operands[4]) == 5"
9165 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9166 [(set_attr "type" "load")
9167 (set_attr "length" "8")])
9170 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9171 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9172 (use (match_operand:SI 2 "immediate_operand" "i"))
9173 (use (match_operand:SI 3 "immediate_operand" "i"))
9174 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9175 (clobber (reg:SI 6))
9176 (clobber (reg:SI 7))
9177 (clobber (reg:SI 8))
9178 (clobber (reg:SI 9))
9179 (clobber (reg:SI 10))
9180 (clobber (match_scratch:SI 5 "X"))]
9181 "TARGET_STRING && TARGET_POWERPC64
9182 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
9183 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
9184 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
9185 && REGNO (operands[4]) == 5"
9186 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9187 [(set_attr "type" "load")
9188 (set_attr "length" "8")])
9190 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
9191 ;; problems with TImode.
9192 ;; rD/rS = r5 is preferred, efficient form.
9193 (define_expand "movstrsi_4reg"
9194 [(parallel [(set (match_operand 0 "" "")
9195 (match_operand 1 "" ""))
9196 (use (match_operand 2 "" ""))
9197 (use (match_operand 3 "" ""))
9198 (clobber (reg:SI 5))
9199 (clobber (reg:SI 6))
9200 (clobber (reg:SI 7))
9201 (clobber (reg:SI 8))
9202 (clobber (match_scratch:SI 4 ""))])]
9207 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9208 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9209 (use (match_operand:SI 2 "immediate_operand" "i"))
9210 (use (match_operand:SI 3 "immediate_operand" "i"))
9211 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9212 (clobber (reg:SI 6))
9213 (clobber (reg:SI 7))
9214 (clobber (reg:SI 8))
9215 (clobber (match_scratch:SI 5 "=q"))]
9216 "TARGET_STRING && TARGET_POWER
9217 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9218 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9219 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9220 && REGNO (operands[4]) == 5"
9221 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9222 [(set_attr "type" "load")
9223 (set_attr "length" "8")])
9226 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9227 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9228 (use (match_operand:SI 2 "immediate_operand" "i"))
9229 (use (match_operand:SI 3 "immediate_operand" "i"))
9230 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9231 (clobber (reg:SI 6))
9232 (clobber (reg:SI 7))
9233 (clobber (reg:SI 8))
9234 (clobber (match_scratch:SI 5 "X"))]
9235 "TARGET_STRING && ! TARGET_POWER
9236 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9237 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9238 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9239 && REGNO (operands[4]) == 5"
9240 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9241 [(set_attr "type" "load")
9242 (set_attr "length" "8")])
9245 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9246 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9247 (use (match_operand:SI 2 "immediate_operand" "i"))
9248 (use (match_operand:SI 3 "immediate_operand" "i"))
9249 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
9250 (clobber (reg:SI 6))
9251 (clobber (reg:SI 7))
9252 (clobber (reg:SI 8))
9253 (clobber (match_scratch:SI 5 "X"))]
9254 "TARGET_STRING && TARGET_POWERPC64
9255 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
9256 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
9257 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
9258 && REGNO (operands[4]) == 5"
9259 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9260 [(set_attr "type" "load")
9261 (set_attr "length" "8")])
9263 ;; Move up to 8 bytes at a time.
9264 (define_expand "movstrsi_2reg"
9265 [(parallel [(set (match_operand 0 "" "")
9266 (match_operand 1 "" ""))
9267 (use (match_operand 2 "" ""))
9268 (use (match_operand 3 "" ""))
9269 (clobber (match_scratch:DI 4 ""))
9270 (clobber (match_scratch:SI 5 ""))])]
9271 "TARGET_STRING && ! TARGET_POWERPC64"
9275 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9276 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9277 (use (match_operand:SI 2 "immediate_operand" "i"))
9278 (use (match_operand:SI 3 "immediate_operand" "i"))
9279 (clobber (match_scratch:DI 4 "=&r"))
9280 (clobber (match_scratch:SI 5 "=q"))]
9281 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
9282 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9283 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9284 [(set_attr "type" "load")
9285 (set_attr "length" "8")])
9288 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9289 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9290 (use (match_operand:SI 2 "immediate_operand" "i"))
9291 (use (match_operand:SI 3 "immediate_operand" "i"))
9292 (clobber (match_scratch:DI 4 "=&r"))
9293 (clobber (match_scratch:SI 5 "X"))]
9294 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
9295 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
9296 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9297 [(set_attr "type" "load")
9298 (set_attr "length" "8")])
9300 ;; Move up to 4 bytes at a time.
9301 (define_expand "movstrsi_1reg"
9302 [(parallel [(set (match_operand 0 "" "")
9303 (match_operand 1 "" ""))
9304 (use (match_operand 2 "" ""))
9305 (use (match_operand 3 "" ""))
9306 (clobber (match_scratch:SI 4 ""))
9307 (clobber (match_scratch:SI 5 ""))])]
9312 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9313 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9314 (use (match_operand:SI 2 "immediate_operand" "i"))
9315 (use (match_operand:SI 3 "immediate_operand" "i"))
9316 (clobber (match_scratch:SI 4 "=&r"))
9317 (clobber (match_scratch:SI 5 "=q"))]
9318 "TARGET_STRING && TARGET_POWER
9319 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9320 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9321 [(set_attr "type" "load")
9322 (set_attr "length" "8")])
9325 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
9326 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
9327 (use (match_operand:SI 2 "immediate_operand" "i"))
9328 (use (match_operand:SI 3 "immediate_operand" "i"))
9329 (clobber (match_scratch:SI 4 "=&r"))
9330 (clobber (match_scratch:SI 5 "X"))]
9331 "TARGET_STRING && ! TARGET_POWER
9332 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9333 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9334 [(set_attr "type" "load")
9335 (set_attr "length" "8")])
9338 [(set (mem:BLK (match_operand:DI 0 "gpc_reg_operand" "b"))
9339 (mem:BLK (match_operand:DI 1 "gpc_reg_operand" "b")))
9340 (use (match_operand:SI 2 "immediate_operand" "i"))
9341 (use (match_operand:SI 3 "immediate_operand" "i"))
9342 (clobber (match_scratch:SI 4 "=&r"))
9343 (clobber (match_scratch:SI 5 "X"))]
9344 "TARGET_STRING && TARGET_POWERPC64
9345 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
9346 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
9347 [(set_attr "type" "load")
9348 (set_attr "length" "8")])
9351 ;; Define insns that do load or store with update. Some of these we can
9352 ;; get by using pre-decrement or pre-increment, but the hardware can also
9353 ;; do cases where the increment is not the size of the object.
9355 ;; In all these cases, we use operands 0 and 1 for the register being
9356 ;; incremented because those are the operands that local-alloc will
9357 ;; tie and these are the pair most likely to be tieable (and the ones
9358 ;; that will benefit the most).
9360 (define_insn "*movdi_update1"
9361 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
9362 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9363 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
9364 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9365 (plus:DI (match_dup 1) (match_dup 2)))]
9366 "TARGET_POWERPC64 && TARGET_UPDATE"
9370 [(set_attr "type" "load_ux,load_u")])
9372 (define_insn "movdi_update"
9373 [(set (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
9374 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I")))
9375 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
9376 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
9377 (plus:DI (match_dup 1) (match_dup 2)))]
9378 "TARGET_POWERPC64 && TARGET_UPDATE"
9382 [(set_attr "type" "store_ux,store_u")])
9384 (define_insn "*movsi_update1"
9385 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9386 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9387 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9388 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9389 (plus:SI (match_dup 1) (match_dup 2)))]
9392 {lux|lwzux} %3,%0,%2
9393 {lu|lwzu} %3,%2(%0)"
9394 [(set_attr "type" "load_ux,load_u")])
9396 (define_insn "*movsi_update2"
9397 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
9399 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
9400 (match_operand:DI 2 "gpc_reg_operand" "r")))))
9401 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
9402 (plus:DI (match_dup 1) (match_dup 2)))]
9405 [(set_attr "type" "load_ext_ux")])
9407 (define_insn "movsi_update"
9408 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9409 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9410 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
9411 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9412 (plus:SI (match_dup 1) (match_dup 2)))]
9415 {stux|stwux} %3,%0,%2
9416 {stu|stwu} %3,%2(%0)"
9417 [(set_attr "type" "store_ux,store_u")])
9419 (define_insn "*movhi_update1"
9420 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
9421 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9422 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9423 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9424 (plus:SI (match_dup 1) (match_dup 2)))]
9429 [(set_attr "type" "load_ux,load_u")])
9431 (define_insn "*movhi_update2"
9432 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9434 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9435 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9436 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9437 (plus:SI (match_dup 1) (match_dup 2)))]
9442 [(set_attr "type" "load_ux,load_u")])
9444 (define_insn "*movhi_update3"
9445 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9447 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9448 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9449 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9450 (plus:SI (match_dup 1) (match_dup 2)))]
9455 [(set_attr "type" "load_ext_ux,load_ext_u")])
9457 (define_insn "*movhi_update4"
9458 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9459 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9460 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9461 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9462 (plus:SI (match_dup 1) (match_dup 2)))]
9467 [(set_attr "type" "store_ux,store_u")])
9469 (define_insn "*movqi_update1"
9470 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9471 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9472 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9473 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9474 (plus:SI (match_dup 1) (match_dup 2)))]
9479 [(set_attr "type" "load_ux,load_u")])
9481 (define_insn "*movqi_update2"
9482 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9484 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9485 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9486 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9487 (plus:SI (match_dup 1) (match_dup 2)))]
9492 [(set_attr "type" "load_ux,load_u")])
9494 (define_insn "*movqi_update3"
9495 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9496 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9497 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9498 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9499 (plus:SI (match_dup 1) (match_dup 2)))]
9504 [(set_attr "type" "store_ux,store_u")])
9506 (define_insn "*movsf_update1"
9507 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9508 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9509 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9510 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9511 (plus:SI (match_dup 1) (match_dup 2)))]
9512 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9516 [(set_attr "type" "fpload_ux,fpload_u")])
9518 (define_insn "*movsf_update2"
9519 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9520 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9521 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9522 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9523 (plus:SI (match_dup 1) (match_dup 2)))]
9524 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9528 [(set_attr "type" "fpstore_ux,fpstore_u")])
9530 (define_insn "*movsf_update3"
9531 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9532 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9533 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9534 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9535 (plus:SI (match_dup 1) (match_dup 2)))]
9536 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9538 {lux|lwzux} %3,%0,%2
9539 {lu|lwzu} %3,%2(%0)"
9540 [(set_attr "type" "load_ux,load_u")])
9542 (define_insn "*movsf_update4"
9543 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9544 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9545 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9546 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9547 (plus:SI (match_dup 1) (match_dup 2)))]
9548 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9550 {stux|stwux} %3,%0,%2
9551 {stu|stwu} %3,%2(%0)"
9552 [(set_attr "type" "store_ux,store_u")])
9554 (define_insn "*movdf_update1"
9555 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9556 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9557 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9558 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9559 (plus:SI (match_dup 1) (match_dup 2)))]
9560 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9564 [(set_attr "type" "fpload_ux,fpload_u")])
9566 (define_insn "*movdf_update2"
9567 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9568 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9569 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9570 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9571 (plus:SI (match_dup 1) (match_dup 2)))]
9572 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9576 [(set_attr "type" "fpstore_ux,fpstore_u")])
9578 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9581 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
9582 (match_operand:DF 1 "memory_operand" ""))
9583 (set (match_operand:DF 2 "gpc_reg_operand" "=f")
9584 (match_operand:DF 3 "memory_operand" ""))]
9586 && TARGET_HARD_FLOAT && TARGET_FPRS
9587 && registers_ok_for_quad_peep (operands[0], operands[2])
9588 && ! MEM_VOLATILE_P (operands[1]) && ! MEM_VOLATILE_P (operands[3])
9589 && addrs_ok_for_quad_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))"
9593 [(set (match_operand:DF 0 "memory_operand" "")
9594 (match_operand:DF 1 "gpc_reg_operand" "f"))
9595 (set (match_operand:DF 2 "memory_operand" "")
9596 (match_operand:DF 3 "gpc_reg_operand" "f"))]
9598 && TARGET_HARD_FLOAT && TARGET_FPRS
9599 && registers_ok_for_quad_peep (operands[1], operands[3])
9600 && ! MEM_VOLATILE_P (operands[0]) && ! MEM_VOLATILE_P (operands[2])
9601 && addrs_ok_for_quad_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))"
9604 ;; Next come insns related to the calling sequence.
9606 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9607 ;; We move the back-chain and decrement the stack pointer.
9609 (define_expand "allocate_stack"
9610 [(set (match_operand 0 "gpc_reg_operand" "=r")
9611 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9613 (minus (reg 1) (match_dup 1)))]
9616 { rtx chain = gen_reg_rtx (Pmode);
9617 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9620 emit_move_insn (chain, stack_bot);
9622 /* Check stack bounds if necessary. */
9623 if (current_function_limit_stack)
9626 available = expand_binop (Pmode, sub_optab,
9627 stack_pointer_rtx, stack_limit_rtx,
9628 NULL_RTX, 1, OPTAB_WIDEN);
9629 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9632 if (GET_CODE (operands[1]) != CONST_INT
9633 || INTVAL (operands[1]) < -32767
9634 || INTVAL (operands[1]) > 32768)
9636 neg_op0 = gen_reg_rtx (Pmode);
9638 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9640 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9643 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9646 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_update))
9647 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9651 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9652 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9653 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9656 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9660 ;; These patterns say how to save and restore the stack pointer. We need not
9661 ;; save the stack pointer at function level since we are careful to
9662 ;; preserve the backchain. At block level, we have to restore the backchain
9663 ;; when we restore the stack pointer.
9665 ;; For nonlocal gotos, we must save both the stack pointer and its
9666 ;; backchain and restore both. Note that in the nonlocal case, the
9667 ;; save area is a memory location.
9669 (define_expand "save_stack_function"
9670 [(match_operand 0 "any_operand" "")
9671 (match_operand 1 "any_operand" "")]
9675 (define_expand "restore_stack_function"
9676 [(match_operand 0 "any_operand" "")
9677 (match_operand 1 "any_operand" "")]
9681 (define_expand "restore_stack_block"
9682 [(use (match_operand 0 "register_operand" ""))
9683 (set (match_dup 2) (match_dup 3))
9684 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9685 (set (match_dup 3) (match_dup 2))]
9689 operands[2] = gen_reg_rtx (Pmode);
9690 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9693 (define_expand "save_stack_nonlocal"
9694 [(match_operand 0 "memory_operand" "")
9695 (match_operand 1 "register_operand" "")]
9699 rtx temp = gen_reg_rtx (Pmode);
9701 /* Copy the backchain to the first word, sp to the second. */
9702 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9703 emit_move_insn (operand_subword (operands[0], 0, 0,
9704 (TARGET_32BIT ? DImode : TImode)),
9706 emit_move_insn (operand_subword (operands[0], 1, 0, (TARGET_32BIT ? DImode : TImode)),
9711 (define_expand "restore_stack_nonlocal"
9712 [(match_operand 0 "register_operand" "")
9713 (match_operand 1 "memory_operand" "")]
9717 rtx temp = gen_reg_rtx (Pmode);
9719 /* Restore the backchain from the first word, sp from the second. */
9720 emit_move_insn (temp,
9721 operand_subword (operands[1], 0, 0, (TARGET_32BIT ? DImode : TImode)));
9722 emit_move_insn (operands[0],
9723 operand_subword (operands[1], 1, 0,
9724 (TARGET_32BIT ? DImode : TImode)));
9725 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9729 ;; TOC register handling.
9731 ;; Code to initialize the TOC register...
9733 (define_insn "load_toc_aix_si"
9734 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9735 (unspec:SI [(const_int 0)] 7))
9737 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9741 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9742 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9743 operands[2] = gen_rtx_REG (Pmode, 2);
9744 return \"{l|lwz} %0,%1(%2)\";
9746 [(set_attr "type" "load")])
9748 (define_insn "load_toc_aix_di"
9749 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9750 (unspec:DI [(const_int 0)] 7))
9752 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9756 #ifdef TARGET_RELOCATABLE
9757 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9758 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9760 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9763 strcat (buf, \"@toc\");
9764 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9765 operands[2] = gen_rtx_REG (Pmode, 2);
9766 return \"ld %0,%1(%2)\";
9768 [(set_attr "type" "load")])
9770 (define_insn "load_toc_v4_pic_si"
9771 [(set (match_operand:SI 0 "register_operand" "=l")
9772 (unspec:SI [(const_int 0)] 7))]
9773 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9774 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9775 [(set_attr "type" "branch")
9776 (set_attr "length" "4")])
9778 (define_insn "load_toc_v4_PIC_1"
9779 [(set (match_operand:SI 0 "register_operand" "=l")
9780 (match_operand:SI 1 "immediate_operand" "s"))
9781 (unspec [(match_dup 1)] 7)]
9782 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9783 "bcl 20,31,%1\\n%1:"
9784 [(set_attr "type" "branch")
9785 (set_attr "length" "4")])
9787 (define_insn "load_toc_v4_PIC_1b"
9788 [(set (match_operand:SI 0 "register_operand" "=l")
9789 (match_operand:SI 1 "immediate_operand" "s"))
9790 (unspec [(match_dup 1) (match_operand 2 "immediate_operand" "s")] 6)]
9791 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9792 "bcl 20,31,%1\\n\\t.long %2-%1+4\\n%1:"
9793 [(set_attr "type" "branch")
9794 (set_attr "length" "8")])
9796 (define_insn "load_toc_v4_PIC_2"
9797 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9798 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9799 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
9800 (match_operand:SI 3 "immediate_operand" "s")))))]
9801 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9802 "{l|lwz} %0,%2-%3(%1)"
9803 [(set_attr "type" "load")])
9805 (define_insn "load_macho_picbase"
9806 [(set (match_operand:SI 0 "register_operand" "=l")
9807 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")] 15))]
9808 "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
9809 "bcl 20,31,%1\\n%1:"
9810 [(set_attr "type" "branch")
9811 (set_attr "length" "4")])
9813 (define_insn "macho_correct_pic"
9814 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9815 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "=r")
9816 (unspec:SI [(match_operand:SI 2 "immediate_operand" "s")
9817 (match_operand:SI 3 "immediate_operand" "s")]
9819 "DEFAULT_ABI == ABI_DARWIN"
9820 "addis %0,%1,ha16(%2-%3)\n\taddi %1,%1,lo16(%2-%3)"
9821 [(set_attr "length" "8")])
9823 ;; If the TOC is shared over a translation unit, as happens with all
9824 ;; the kinds of PIC that we support, we need to restore the TOC
9825 ;; pointer only when jumping over units of translation.
9826 ;; On Darwin, we need to reload the picbase.
9828 (define_expand "builtin_setjmp_receiver"
9829 [(use (label_ref (match_operand 0 "" "")))]
9830 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
9831 || (TARGET_TOC && TARGET_MINIMAL_TOC)
9832 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
9836 if (DEFAULT_ABI == ABI_DARWIN)
9838 const char *picbase = machopic_function_base_name ();
9839 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (picbase, -1));
9840 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
9844 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
9845 CODE_LABEL_NUMBER (operands[0]));
9846 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (tmplab, -1));
9848 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
9849 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
9853 rs6000_emit_load_toc_table (FALSE);
9857 ;; A function pointer under AIX is a pointer to a data area whose first word
9858 ;; contains the actual address of the function, whose second word contains a
9859 ;; pointer to its TOC, and whose third word contains a value to place in the
9860 ;; static chain register (r11). Note that if we load the static chain, our
9861 ;; "trampoline" need not have any executable code.
9863 (define_expand "call_indirect_aix32"
9865 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
9866 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9869 (mem:SI (plus:SI (match_dup 0)
9872 (mem:SI (plus:SI (match_dup 0)
9874 (parallel [(call (mem:SI (match_dup 2))
9875 (match_operand 1 "" ""))
9879 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9880 (clobber (scratch:SI))])]
9883 { operands[2] = gen_reg_rtx (SImode); }")
9885 (define_expand "call_indirect_aix64"
9887 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
9888 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9891 (mem:DI (plus:DI (match_dup 0)
9894 (mem:DI (plus:DI (match_dup 0)
9896 (parallel [(call (mem:SI (match_dup 2))
9897 (match_operand 1 "" ""))
9901 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9902 (clobber (scratch:SI))])]
9905 { operands[2] = gen_reg_rtx (DImode); }")
9907 (define_expand "call_value_indirect_aix32"
9909 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
9910 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9913 (mem:SI (plus:SI (match_dup 1)
9916 (mem:SI (plus:SI (match_dup 1)
9918 (parallel [(set (match_operand 0 "" "")
9919 (call (mem:SI (match_dup 3))
9920 (match_operand 2 "" "")))
9924 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9925 (clobber (scratch:SI))])]
9928 { operands[3] = gen_reg_rtx (SImode); }")
9930 (define_expand "call_value_indirect_aix64"
9932 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
9933 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9936 (mem:DI (plus:DI (match_dup 1)
9939 (mem:DI (plus:DI (match_dup 1)
9941 (parallel [(set (match_operand 0 "" "")
9942 (call (mem:SI (match_dup 3))
9943 (match_operand 2 "" "")))
9947 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9948 (clobber (scratch:SI))])]
9951 { operands[3] = gen_reg_rtx (DImode); }")
9953 ;; Now the definitions for the call and call_value insns
9954 (define_expand "call"
9955 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
9956 (match_operand 1 "" ""))
9957 (use (match_operand 2 "" ""))
9958 (clobber (scratch:SI))])]
9964 operands[0] = machopic_indirect_call_target (operands[0]);
9967 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
9970 operands[0] = XEXP (operands[0], 0);
9972 if (GET_CODE (operands[0]) != SYMBOL_REF
9973 || (INTVAL (operands[2]) & CALL_LONG) != 0)
9975 if (INTVAL (operands[2]) & CALL_LONG)
9976 operands[0] = rs6000_longcall_ref (operands[0]);
9978 if (DEFAULT_ABI == ABI_V4
9979 || DEFAULT_ABI == ABI_AIX_NODESC
9980 || DEFAULT_ABI == ABI_DARWIN)
9981 operands[0] = force_reg (Pmode, operands[0]);
9983 else if (DEFAULT_ABI == ABI_AIX)
9985 /* AIX function pointers are really pointers to a three word
9987 emit_call_insn (TARGET_32BIT
9988 ? gen_call_indirect_aix32 (force_reg (SImode,
9991 : gen_call_indirect_aix64 (force_reg (DImode,
10001 (define_expand "call_value"
10002 [(parallel [(set (match_operand 0 "" "")
10003 (call (mem:SI (match_operand 1 "address_operand" ""))
10004 (match_operand 2 "" "")))
10005 (use (match_operand 3 "" ""))
10006 (clobber (scratch:SI))])]
10012 operands[1] = machopic_indirect_call_target (operands[1]);
10015 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10018 operands[1] = XEXP (operands[1], 0);
10020 if (GET_CODE (operands[1]) != SYMBOL_REF
10021 || (INTVAL (operands[3]) & CALL_LONG) != 0)
10023 if (INTVAL (operands[3]) & CALL_LONG)
10024 operands[1] = rs6000_longcall_ref (operands[1]);
10026 if (DEFAULT_ABI == ABI_V4
10027 || DEFAULT_ABI == ABI_AIX_NODESC
10028 || DEFAULT_ABI == ABI_DARWIN)
10029 operands[0] = force_reg (Pmode, operands[0]);
10031 else if (DEFAULT_ABI == ABI_AIX)
10033 /* AIX function pointers are really pointers to a three word
10035 emit_call_insn (TARGET_32BIT
10036 ? gen_call_value_indirect_aix32 (operands[0],
10040 : gen_call_value_indirect_aix64 (operands[0],
10051 ;; Call to function in current module. No TOC pointer reload needed.
10052 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10053 ;; either the function was not prototyped, or it was prototyped as a
10054 ;; variable argument function. It is > 0 if FP registers were passed
10055 ;; and < 0 if they were not.
10057 (define_insn "*call_local32"
10058 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10059 (match_operand 1 "" "g,g"))
10060 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10061 (clobber (match_scratch:SI 3 "=l,l"))]
10062 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10065 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10066 output_asm_insn (\"crxor 6,6,6\", operands);
10068 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10069 output_asm_insn (\"creqv 6,6,6\", operands);
10071 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10073 [(set_attr "type" "branch")
10074 (set_attr "length" "4,8")])
10076 (define_insn "*call_local64"
10077 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10078 (match_operand 1 "" "g,g"))
10079 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10080 (clobber (match_scratch:SI 3 "=l,l"))]
10081 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10084 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10085 output_asm_insn (\"crxor 6,6,6\", operands);
10087 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10088 output_asm_insn (\"creqv 6,6,6\", operands);
10090 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
10092 [(set_attr "type" "branch")
10093 (set_attr "length" "4,8")])
10095 (define_insn "*call_value_local32"
10096 [(set (match_operand 0 "" "")
10097 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10098 (match_operand 2 "" "g,g")))
10099 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10100 (clobber (match_scratch:SI 4 "=l,l"))]
10101 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10104 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10105 output_asm_insn (\"crxor 6,6,6\", operands);
10107 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10108 output_asm_insn (\"creqv 6,6,6\", operands);
10110 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10112 [(set_attr "type" "branch")
10113 (set_attr "length" "4,8")])
10116 (define_insn "*call_value_local64"
10117 [(set (match_operand 0 "" "")
10118 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10119 (match_operand 2 "" "g,g")))
10120 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10121 (clobber (match_scratch:SI 4 "=l,l"))]
10122 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10125 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10126 output_asm_insn (\"crxor 6,6,6\", operands);
10128 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10129 output_asm_insn (\"creqv 6,6,6\", operands);
10131 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
10133 [(set_attr "type" "branch")
10134 (set_attr "length" "4,8")])
10136 ;; Call to function which may be in another module. Restore the TOC
10137 ;; pointer (r2) after the call unless this is System V.
10138 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
10139 ;; either the function was not prototyped, or it was prototyped as a
10140 ;; variable argument function. It is > 0 if FP registers were passed
10141 ;; and < 0 if they were not.
10143 (define_insn "*call_indirect_nonlocal_aix32"
10144 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl"))
10145 (match_operand 1 "" "g"))
10149 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10150 (clobber (match_scratch:SI 2 "=l"))]
10151 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10152 "b%T0l\;{l|lwz} 2,20(1)"
10153 [(set_attr "type" "jmpreg")
10154 (set_attr "length" "8")])
10156 (define_insn "*call_nonlocal_aix32"
10157 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10158 (match_operand 1 "" "g"))
10159 (use (match_operand:SI 2 "immediate_operand" "O"))
10160 (clobber (match_scratch:SI 3 "=l"))]
10162 && DEFAULT_ABI == ABI_AIX
10163 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10165 [(set_attr "type" "branch")
10166 (set_attr "length" "8")])
10168 (define_insn "*call_indirect_nonlocal_aix64"
10169 [(call (mem:SI (match_operand:DI 0 "register_operand" "cl"))
10170 (match_operand 1 "" "g"))
10174 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10175 (clobber (match_scratch:SI 2 "=l"))]
10176 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10177 "b%T0l\;ld 2,40(1)"
10178 [(set_attr "type" "jmpreg")
10179 (set_attr "length" "8")])
10181 (define_insn "*call_nonlocal_aix64"
10182 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10183 (match_operand 1 "" "g"))
10184 (use (match_operand:SI 2 "immediate_operand" "O"))
10185 (clobber (match_scratch:SI 3 "=l"))]
10187 && DEFAULT_ABI == ABI_AIX
10188 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10190 [(set_attr "type" "branch")
10191 (set_attr "length" "8")])
10193 (define_insn "*call_value_indirect_nonlocal_aix32"
10194 [(set (match_operand 0 "" "")
10195 (call (mem:SI (match_operand:SI 1 "register_operand" "cl"))
10196 (match_operand 2 "" "g")))
10200 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10201 (clobber (match_scratch:SI 3 "=l"))]
10202 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10203 "b%T1l\;{l|lwz} 2,20(1)"
10204 [(set_attr "type" "jmpreg")
10205 (set_attr "length" "8")])
10207 (define_insn "*call_value_nonlocal_aix32"
10208 [(set (match_operand 0 "" "")
10209 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10210 (match_operand 2 "" "g")))
10211 (use (match_operand:SI 3 "immediate_operand" "O"))
10212 (clobber (match_scratch:SI 4 "=l"))]
10214 && DEFAULT_ABI == ABI_AIX
10215 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10217 [(set_attr "type" "branch")
10218 (set_attr "length" "8")])
10220 (define_insn "*call_value_indirect_nonlocal_aix64"
10221 [(set (match_operand 0 "" "")
10222 (call (mem:SI (match_operand:DI 1 "register_operand" "cl"))
10223 (match_operand 2 "" "g")))
10227 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10228 (clobber (match_scratch:SI 3 "=l"))]
10229 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10230 "b%T1l\;ld 2,40(1)"
10231 [(set_attr "type" "jmpreg")
10232 (set_attr "length" "8")])
10234 (define_insn "*call_value_nonlocal_aix64"
10235 [(set (match_operand 0 "" "")
10236 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10237 (match_operand 2 "" "g")))
10238 (use (match_operand:SI 3 "immediate_operand" "O"))
10239 (clobber (match_scratch:SI 4 "=l"))]
10241 && DEFAULT_ABI == ABI_AIX
10242 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10244 [(set_attr "type" "branch")
10245 (set_attr "length" "8")])
10247 ;; A function pointer under System V is just a normal pointer
10248 ;; operands[0] is the function pointer
10249 ;; operands[1] is the stack size to clean up
10250 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10251 ;; which indicates how to set cr1
10253 (define_insn "*call_indirect_nonlocal_sysv"
10254 [(call (mem:SI (match_operand:SI 0 "register_operand" "cl,cl"))
10255 (match_operand 1 "" "g,g"))
10256 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10257 (clobber (match_scratch:SI 3 "=l,l"))]
10258 "DEFAULT_ABI == ABI_AIX_NODESC
10259 || DEFAULT_ABI == ABI_V4
10260 || DEFAULT_ABI == ABI_DARWIN"
10262 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10263 output_asm_insn ("crxor 6,6,6", operands);
10265 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10266 output_asm_insn ("creqv 6,6,6", operands);
10270 [(set_attr "type" "jmpreg,jmpreg")
10271 (set_attr "length" "4,8")])
10273 (define_insn "*call_nonlocal_sysv"
10274 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10275 (match_operand 1 "" "g,g"))
10276 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10277 (clobber (match_scratch:SI 3 "=l,l"))]
10278 "(DEFAULT_ABI == ABI_AIX_NODESC
10279 || DEFAULT_ABI == ABI_V4
10280 || DEFAULT_ABI == ABI_DARWIN)
10281 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10283 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10284 output_asm_insn ("crxor 6,6,6", operands);
10286 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10287 output_asm_insn ("creqv 6,6,6", operands);
10289 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z0@plt" : "bl %z0";
10291 [(set_attr "type" "branch,branch")
10292 (set_attr "length" "4,8")])
10294 (define_insn "*call_value_indirect_nonlocal_sysv"
10295 [(set (match_operand 0 "" "")
10296 (call (mem:SI (match_operand:SI 1 "register_operand" "cl,cl"))
10297 (match_operand 2 "" "g,g")))
10298 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10299 (clobber (match_scratch:SI 4 "=l,l"))]
10300 "DEFAULT_ABI == ABI_AIX_NODESC
10301 || DEFAULT_ABI == ABI_V4
10302 || DEFAULT_ABI == ABI_DARWIN"
10304 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10305 output_asm_insn ("crxor 6,6,6", operands);
10307 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10308 output_asm_insn ("creqv 6,6,6", operands);
10312 [(set_attr "type" "jmpreg,jmpreg")
10313 (set_attr "length" "4,8")])
10315 (define_insn "*call_value_nonlocal_sysv"
10316 [(set (match_operand 0 "" "")
10317 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10318 (match_operand 2 "" "g,g")))
10319 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10320 (clobber (match_scratch:SI 4 "=l,l"))]
10321 "(DEFAULT_ABI == ABI_AIX_NODESC
10322 || DEFAULT_ABI == ABI_V4
10323 || DEFAULT_ABI == ABI_DARWIN)
10324 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10326 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10327 output_asm_insn ("crxor 6,6,6", operands);
10329 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10330 output_asm_insn ("creqv 6,6,6", operands);
10332 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? "bl %z1@plt" : "bl %z1";
10334 [(set_attr "type" "branch,branch")
10335 (set_attr "length" "4,8")])
10337 ;; Call subroutine returning any type.
10338 (define_expand "untyped_call"
10339 [(parallel [(call (match_operand 0 "" "")
10341 (match_operand 1 "" "")
10342 (match_operand 2 "" "")])]
10348 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10350 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10352 rtx set = XVECEXP (operands[2], 0, i);
10353 emit_move_insn (SET_DEST (set), SET_SRC (set));
10356 /* The optimizer does not know that the call sets the function value
10357 registers we stored in the result block. We avoid problems by
10358 claiming that all hard registers are used and clobbered at this
10360 emit_insn (gen_blockage ());
10365 ;; sibling call patterns
10366 (define_expand "sibcall"
10367 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10368 (match_operand 1 "" ""))
10369 (use (match_operand 2 "" ""))
10370 (use (match_operand 3 "" ""))
10377 operands[0] = machopic_indirect_call_target (operands[0]);
10380 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
10383 operands[0] = XEXP (operands[0], 0);
10384 operands[3] = gen_reg_rtx (SImode);
10388 ;; this and similar patterns must be marked as using LR, otherwise
10389 ;; dataflow will try to delete the store into it. This is true
10390 ;; even when the actual reg to jump to is in CTR, when LR was
10391 ;; saved and restored around the PIC-setting BCL.
10392 (define_insn "*sibcall_local32"
10393 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10394 (match_operand 1 "" "g,g"))
10395 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10396 (use (match_operand:SI 3 "register_operand" "l,l"))
10398 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10401 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10402 output_asm_insn (\"crxor 6,6,6\", operands);
10404 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10405 output_asm_insn (\"creqv 6,6,6\", operands);
10407 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10409 [(set_attr "type" "branch")
10410 (set_attr "length" "4,8")])
10412 (define_insn "*sibcall_local64"
10413 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10414 (match_operand 1 "" "g,g"))
10415 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10416 (use (match_operand:SI 3 "register_operand" "l,l"))
10418 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10421 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10422 output_asm_insn (\"crxor 6,6,6\", operands);
10424 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10425 output_asm_insn (\"creqv 6,6,6\", operands);
10427 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10429 [(set_attr "type" "branch")
10430 (set_attr "length" "4,8")])
10432 (define_insn "*sibcall_value_local32"
10433 [(set (match_operand 0 "" "")
10434 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10435 (match_operand 2 "" "g,g")))
10436 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10437 (use (match_operand:SI 4 "register_operand" "l,l"))
10439 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10442 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10443 output_asm_insn (\"crxor 6,6,6\", operands);
10445 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10446 output_asm_insn (\"creqv 6,6,6\", operands);
10448 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10450 [(set_attr "type" "branch")
10451 (set_attr "length" "4,8")])
10454 (define_insn "*sibcall_value_local64"
10455 [(set (match_operand 0 "" "")
10456 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10457 (match_operand 2 "" "g,g")))
10458 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10459 (use (match_operand:SI 4 "register_operand" "l,l"))
10461 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10464 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10465 output_asm_insn (\"crxor 6,6,6\", operands);
10467 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10468 output_asm_insn (\"creqv 6,6,6\", operands);
10470 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10472 [(set_attr "type" "branch")
10473 (set_attr "length" "4,8")])
10475 (define_insn "*sibcall_nonlocal_aix32"
10476 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10477 (match_operand 1 "" "g"))
10478 (use (match_operand:SI 2 "immediate_operand" "O"))
10479 (use (match_operand:SI 3 "register_operand" "l"))
10482 && DEFAULT_ABI == ABI_AIX
10483 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10485 [(set_attr "type" "branch")
10486 (set_attr "length" "4")])
10488 (define_insn "*sibcall_nonlocal_aix64"
10489 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10490 (match_operand 1 "" "g"))
10491 (use (match_operand:SI 2 "immediate_operand" "O"))
10492 (use (match_operand:SI 3 "register_operand" "l"))
10495 && DEFAULT_ABI == ABI_AIX
10496 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10498 [(set_attr "type" "branch")
10499 (set_attr "length" "4")])
10501 (define_insn "*sibcall_value_nonlocal_aix32"
10502 [(set (match_operand 0 "" "")
10503 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10504 (match_operand 2 "" "g")))
10505 (use (match_operand:SI 3 "immediate_operand" "O"))
10506 (use (match_operand:SI 4 "register_operand" "l"))
10509 && DEFAULT_ABI == ABI_AIX
10510 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10512 [(set_attr "type" "branch")
10513 (set_attr "length" "4")])
10515 (define_insn "*sibcall_value_nonlocal_aix64"
10516 [(set (match_operand 0 "" "")
10517 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10518 (match_operand 2 "" "g")))
10519 (use (match_operand:SI 3 "immediate_operand" "O"))
10520 (use (match_operand:SI 4 "register_operand" "l"))
10523 && DEFAULT_ABI == ABI_AIX
10524 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10526 [(set_attr "type" "branch")
10527 (set_attr "length" "4")])
10529 (define_insn "*sibcall_nonlocal_sysv"
10530 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10531 (match_operand 1 "" ""))
10532 (use (match_operand 2 "immediate_operand" "O,n"))
10533 (use (match_operand:SI 3 "register_operand" "l,l"))
10535 "(DEFAULT_ABI == ABI_DARWIN
10536 || DEFAULT_ABI == ABI_V4
10537 || DEFAULT_ABI == ABI_AIX_NODESC)
10538 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10541 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10542 output_asm_insn (\"crxor 6,6,6\", operands);
10544 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10545 output_asm_insn (\"creqv 6,6,6\", operands);
10547 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@plt\" : \"b %z0\";
10549 [(set_attr "type" "branch,branch")
10550 (set_attr "length" "4,8")])
10552 (define_expand "sibcall_value"
10553 [(parallel [(set (match_operand 0 "register_operand" "")
10554 (call (mem:SI (match_operand 1 "address_operand" ""))
10555 (match_operand 2 "" "")))
10556 (use (match_operand 3 "" ""))
10557 (use (match_operand 4 "" ""))
10564 operands[1] = machopic_indirect_call_target (operands[1]);
10567 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
10570 operands[1] = XEXP (operands[1], 0);
10571 operands[4] = gen_reg_rtx (SImode);
10575 (define_insn "*sibcall_value_nonlocal_sysv"
10576 [(set (match_operand 0 "" "")
10577 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10578 (match_operand 2 "" "")))
10579 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10580 (use (match_operand:SI 4 "register_operand" "l,l"))
10582 "(DEFAULT_ABI == ABI_DARWIN
10583 || DEFAULT_ABI == ABI_V4
10584 || DEFAULT_ABI == ABI_AIX_NODESC)
10585 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10588 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10589 output_asm_insn (\"crxor 6,6,6\", operands);
10591 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10592 output_asm_insn (\"creqv 6,6,6\", operands);
10594 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@plt\" : \"b %z1\";
10596 [(set_attr "type" "branch,branch")
10597 (set_attr "length" "4,8")])
10599 (define_expand "sibcall_epilogue"
10600 [(use (const_int 0))]
10601 "TARGET_SCHED_PROLOG"
10604 rs6000_emit_epilogue (TRUE);
10608 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10609 ;; all of memory. This blocks insns from being moved across this point.
10611 (define_insn "blockage"
10612 [(unspec_volatile [(const_int 0)] 0)]
10616 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10617 ;; signed & unsigned, and one type of branch.
10619 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10620 ;; insns, and branches. We store the operands of compares until we see
10622 (define_expand "cmpsi"
10624 (compare (match_operand:SI 0 "gpc_reg_operand" "")
10625 (match_operand:SI 1 "reg_or_short_operand" "")))]
10629 /* Take care of the possibility that operands[1] might be negative but
10630 this might be a logical operation. That insn doesn't exist. */
10631 if (GET_CODE (operands[1]) == CONST_INT
10632 && INTVAL (operands[1]) < 0)
10633 operands[1] = force_reg (SImode, operands[1]);
10635 rs6000_compare_op0 = operands[0];
10636 rs6000_compare_op1 = operands[1];
10637 rs6000_compare_fp_p = 0;
10641 (define_expand "cmpdi"
10643 (compare (match_operand:DI 0 "gpc_reg_operand" "")
10644 (match_operand:DI 1 "reg_or_short_operand" "")))]
10648 /* Take care of the possibility that operands[1] might be negative but
10649 this might be a logical operation. That insn doesn't exist. */
10650 if (GET_CODE (operands[1]) == CONST_INT
10651 && INTVAL (operands[1]) < 0)
10652 operands[1] = force_reg (DImode, operands[1]);
10654 rs6000_compare_op0 = operands[0];
10655 rs6000_compare_op1 = operands[1];
10656 rs6000_compare_fp_p = 0;
10660 (define_expand "cmpsf"
10661 [(set (cc0) (compare (match_operand:SF 0 "gpc_reg_operand" "")
10662 (match_operand:SF 1 "gpc_reg_operand" "")))]
10663 "TARGET_HARD_FLOAT"
10666 rs6000_compare_op0 = operands[0];
10667 rs6000_compare_op1 = operands[1];
10668 rs6000_compare_fp_p = 1;
10672 (define_expand "cmpdf"
10673 [(set (cc0) (compare (match_operand:DF 0 "gpc_reg_operand" "")
10674 (match_operand:DF 1 "gpc_reg_operand" "")))]
10675 "TARGET_HARD_FLOAT && TARGET_FPRS"
10678 rs6000_compare_op0 = operands[0];
10679 rs6000_compare_op1 = operands[1];
10680 rs6000_compare_fp_p = 1;
10684 (define_expand "cmptf"
10685 [(set (cc0) (compare (match_operand:TF 0 "gpc_reg_operand" "")
10686 (match_operand:TF 1 "gpc_reg_operand" "")))]
10687 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT
10688 && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10691 rs6000_compare_op0 = operands[0];
10692 rs6000_compare_op1 = operands[1];
10693 rs6000_compare_fp_p = 1;
10697 (define_expand "beq"
10698 [(use (match_operand 0 "" ""))]
10700 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10702 (define_expand "bne"
10703 [(use (match_operand 0 "" ""))]
10705 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10707 (define_expand "bge"
10708 [(use (match_operand 0 "" ""))]
10710 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10712 (define_expand "bgt"
10713 [(use (match_operand 0 "" ""))]
10715 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10717 (define_expand "ble"
10718 [(use (match_operand 0 "" ""))]
10720 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10722 (define_expand "blt"
10723 [(use (match_operand 0 "" ""))]
10725 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10727 (define_expand "bgeu"
10728 [(use (match_operand 0 "" ""))]
10730 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10732 (define_expand "bgtu"
10733 [(use (match_operand 0 "" ""))]
10735 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10737 (define_expand "bleu"
10738 [(use (match_operand 0 "" ""))]
10740 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10742 (define_expand "bltu"
10743 [(use (match_operand 0 "" ""))]
10745 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10747 (define_expand "bunordered"
10748 [(use (match_operand 0 "" ""))]
10750 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10752 (define_expand "bordered"
10753 [(use (match_operand 0 "" ""))]
10755 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10757 (define_expand "buneq"
10758 [(use (match_operand 0 "" ""))]
10760 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10762 (define_expand "bunge"
10763 [(use (match_operand 0 "" ""))]
10765 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10767 (define_expand "bungt"
10768 [(use (match_operand 0 "" ""))]
10770 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10772 (define_expand "bunle"
10773 [(use (match_operand 0 "" ""))]
10775 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10777 (define_expand "bunlt"
10778 [(use (match_operand 0 "" ""))]
10780 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10782 (define_expand "bltgt"
10783 [(use (match_operand 0 "" ""))]
10785 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
10787 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
10788 ;; For SEQ, likewise, except that comparisons with zero should be done
10789 ;; with an scc insns. However, due to the order that combine see the
10790 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
10791 ;; the cases we don't want to handle.
10792 (define_expand "seq"
10793 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10795 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
10797 (define_expand "sne"
10798 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10802 if (! rs6000_compare_fp_p)
10805 rs6000_emit_sCOND (NE, operands[0]);
10809 ;; A > 0 is best done using the portable sequence, so fail in that case.
10810 (define_expand "sgt"
10811 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10815 if (! rs6000_compare_fp_p
10816 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10819 rs6000_emit_sCOND (GT, operands[0]);
10823 ;; A < 0 is best done in the portable way for A an integer.
10824 (define_expand "slt"
10825 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10829 if (! rs6000_compare_fp_p
10830 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10833 rs6000_emit_sCOND (LT, operands[0]);
10837 ;; A >= 0 is best done the portable way for A an integer.
10838 (define_expand "sge"
10839 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10843 if (! rs6000_compare_fp_p
10844 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10847 rs6000_emit_sCOND (GE, operands[0]);
10851 ;; A <= 0 is best done the portable way for A an integer.
10852 (define_expand "sle"
10853 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10857 if (! rs6000_compare_fp_p
10858 && (! TARGET_POWER || rs6000_compare_op1 == const0_rtx))
10861 rs6000_emit_sCOND (LE, operands[0]);
10865 (define_expand "sgtu"
10866 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10868 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
10870 (define_expand "sltu"
10871 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10873 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
10875 (define_expand "sgeu"
10876 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10878 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
10880 (define_expand "sleu"
10881 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10883 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
10885 ;; Here are the actual compare insns.
10886 (define_insn "*cmpsi_internal1"
10887 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10888 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10889 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
10891 "{cmp%I2|cmpw%I2} %0,%1,%2"
10892 [(set_attr "type" "cmp")])
10894 (define_insn "*cmpdi_internal1"
10895 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10896 (compare:CC (match_operand:DI 1 "gpc_reg_operand" "r")
10897 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
10900 [(set_attr "type" "cmp")])
10902 ;; If we are comparing a register for equality with a large constant,
10903 ;; we can do this with an XOR followed by a compare. But we need a scratch
10904 ;; register for the result of the XOR.
10907 [(set (match_operand:CC 0 "cc_reg_operand" "")
10908 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10909 (match_operand:SI 2 "non_short_cint_operand" "")))
10910 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
10911 "find_single_use (operands[0], insn, 0)
10912 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
10913 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
10914 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
10915 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
10918 /* Get the constant we are comparing against, C, and see what it looks like
10919 sign-extended to 16 bits. Then see what constant could be XOR'ed
10920 with C to get the sign-extended value. */
10922 HOST_WIDE_INT c = INTVAL (operands[2]);
10923 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
10924 HOST_WIDE_INT xorv = c ^ sextc;
10926 operands[4] = GEN_INT (xorv);
10927 operands[5] = GEN_INT (sextc);
10930 (define_insn "*cmpsi_internal2"
10931 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10932 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10933 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
10935 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
10936 [(set_attr "type" "cmp")])
10938 (define_insn "*cmpdi_internal2"
10939 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10940 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
10941 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
10943 "cmpld%I2 %0,%1,%b2"
10944 [(set_attr "type" "cmp")])
10946 ;; The following two insns don't exist as single insns, but if we provide
10947 ;; them, we can swap an add and compare, which will enable us to overlap more
10948 ;; of the required delay between a compare and branch. We generate code for
10949 ;; them by splitting.
10952 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
10953 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10954 (match_operand:SI 2 "short_cint_operand" "i")))
10955 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10956 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10959 [(set_attr "length" "8")])
10962 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
10963 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10964 (match_operand:SI 2 "u_short_cint_operand" "i")))
10965 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10966 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10969 [(set_attr "length" "8")])
10972 [(set (match_operand:CC 3 "cc_reg_operand" "")
10973 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10974 (match_operand:SI 2 "short_cint_operand" "")))
10975 (set (match_operand:SI 0 "gpc_reg_operand" "")
10976 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10978 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
10979 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10982 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
10983 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
10984 (match_operand:SI 2 "u_short_cint_operand" "")))
10985 (set (match_operand:SI 0 "gpc_reg_operand" "")
10986 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10988 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
10989 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10991 (define_insn "*cmpsf_internal1"
10992 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10993 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
10994 (match_operand:SF 2 "gpc_reg_operand" "f")))]
10995 "TARGET_HARD_FLOAT && TARGET_FPRS"
10997 [(set_attr "type" "fpcompare")])
10999 (define_insn "*cmpdf_internal1"
11000 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11001 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
11002 (match_operand:DF 2 "gpc_reg_operand" "f")))]
11003 "TARGET_HARD_FLOAT && TARGET_FPRS"
11005 [(set_attr "type" "fpcompare")])
11007 ;; Only need to compare second words if first words equal
11008 (define_insn "*cmptf_internal1"
11009 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
11010 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
11011 (match_operand:TF 2 "gpc_reg_operand" "f")))]
11012 "DEFAULT_ABI == ABI_AIX && TARGET_HARD_FLOAT && TARGET_FPRS
11013 && TARGET_LONG_DOUBLE_128"
11014 "fcmpu %0,%1,%2\;bne %0,$+4\;fcmpu %0,%L1,%L2"
11015 [(set_attr "type" "fpcompare")
11016 (set_attr "length" "12")])
11018 ;; Now we have the scc insns. We can do some combinations because of the
11019 ;; way the machine works.
11021 ;; Note that this is probably faster if we can put an insn between the
11022 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11023 ;; cases the insns below which don't use an intermediate CR field will
11024 ;; be used instead.
11026 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11027 (match_operator:SI 1 "scc_comparison_operator"
11028 [(match_operand 2 "cc_reg_operand" "y")
11031 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11032 [(set_attr "type" "mfcr")
11033 (set_attr "length" "12")])
11035 ;; Same as above, but get the OV/ORDERED bit.
11036 (define_insn "move_from_CR_ov_bit"
11037 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11038 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] 724))]
11040 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11041 [(set_attr "type" "mfcr")
11042 (set_attr "length" "12")])
11045 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11046 (match_operator:DI 1 "scc_comparison_operator"
11047 [(match_operand 2 "cc_reg_operand" "y")
11050 "%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%J1,1"
11051 [(set_attr "type" "mfcr")
11052 (set_attr "length" "12")])
11055 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11056 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11057 [(match_operand 2 "cc_reg_operand" "y,y")
11060 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11061 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11062 "! TARGET_POWERPC64"
11064 %D1mfcr %3\;{rlinm.|rlwinm.} %3,%3,%J1,1
11066 [(set_attr "type" "delayed_compare")
11067 (set_attr "length" "12,16")])
11070 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11071 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11072 [(match_operand 2 "cc_reg_operand" "")
11075 (set (match_operand:SI 3 "gpc_reg_operand" "")
11076 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11077 "! TARGET_POWERPC64 && reload_completed"
11078 [(set (match_dup 3)
11079 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11081 (compare:CC (match_dup 3)
11086 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11087 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11088 [(match_operand 2 "cc_reg_operand" "y")
11090 (match_operand:SI 3 "const_int_operand" "n")))]
11094 int is_bit = ccr_bit (operands[1], 1);
11095 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11098 if (is_bit >= put_bit)
11099 count = is_bit - put_bit;
11101 count = 32 - (put_bit - is_bit);
11103 operands[4] = GEN_INT (count);
11104 operands[5] = GEN_INT (put_bit);
11106 return \"%D1mfcr %0\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11108 [(set_attr "type" "mfcr")
11109 (set_attr "length" "12")])
11112 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11114 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11115 [(match_operand 2 "cc_reg_operand" "y,y")
11117 (match_operand:SI 3 "const_int_operand" "n,n"))
11119 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11120 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11125 int is_bit = ccr_bit (operands[1], 1);
11126 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11129 /* Force split for non-cc0 compare. */
11130 if (which_alternative == 1)
11133 if (is_bit >= put_bit)
11134 count = is_bit - put_bit;
11136 count = 32 - (put_bit - is_bit);
11138 operands[5] = GEN_INT (count);
11139 operands[6] = GEN_INT (put_bit);
11141 return \"%D1mfcr %4\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11143 [(set_attr "type" "delayed_compare")
11144 (set_attr "length" "12,16")])
11147 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11149 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11150 [(match_operand 2 "cc_reg_operand" "")
11152 (match_operand:SI 3 "const_int_operand" ""))
11154 (set (match_operand:SI 4 "gpc_reg_operand" "")
11155 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11158 [(set (match_dup 4)
11159 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11162 (compare:CC (match_dup 4)
11166 ;; There is a 3 cycle delay between consecutive mfcr instructions
11167 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11170 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11171 (match_operator:SI 1 "scc_comparison_operator"
11172 [(match_operand 2 "cc_reg_operand" "y")
11174 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11175 (match_operator:SI 4 "scc_comparison_operator"
11176 [(match_operand 5 "cc_reg_operand" "y")
11178 "REGNO (operands[2]) != REGNO (operands[5])"
11179 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11180 [(set_attr "type" "mfcr")
11181 (set_attr "length" "20")])
11184 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11185 (match_operator:DI 1 "scc_comparison_operator"
11186 [(match_operand 2 "cc_reg_operand" "y")
11188 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11189 (match_operator:DI 4 "scc_comparison_operator"
11190 [(match_operand 5 "cc_reg_operand" "y")
11192 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11193 "%D1%D4mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11194 [(set_attr "type" "mfcr")
11195 (set_attr "length" "20")])
11197 ;; There are some scc insns that can be done directly, without a compare.
11198 ;; These are faster because they don't involve the communications between
11199 ;; the FXU and branch units. In fact, we will be replacing all of the
11200 ;; integer scc insns here or in the portable methods in emit_store_flag.
11202 ;; Also support (neg (scc ..)) since that construct is used to replace
11203 ;; branches, (plus (scc ..) ..) since that construct is common and
11204 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11205 ;; cases where it is no more expensive than (neg (scc ..)).
11207 ;; Have reload force a constant into a register for the simple insns that
11208 ;; otherwise won't accept constants. We do this because it is faster than
11209 ;; the cmp/mfcr sequence we would otherwise generate.
11212 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11213 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11214 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
11215 (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]
11216 "! TARGET_POWERPC64"
11218 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11219 {sfi|subfic} %3,%1,0\;{ae|adde} %0,%3,%1
11220 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11221 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0
11222 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae|adde} %0,%3,%0"
11223 [(set_attr "length" "12,8,12,12,12")])
11226 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r")
11227 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r")
11228 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I")))
11229 (clobber (match_scratch:DI 3 "=r,&r,r,r,r"))]
11232 xor %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0
11233 subfic %3,%1,0\;adde %0,%3,%1
11234 xori %0,%1,%b2\;subfic %3,%0,0\;adde %0,%3,%0
11235 xoris %0,%1,%u2\;subfic %3,%0,0\;adde %0,%3,%0
11236 subfic %0,%1,%2\;subfic %3,%0,0\;adde %0,%3,%0"
11237 [(set_attr "length" "12,8,12,12,12")])
11240 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11242 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11243 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11245 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11246 (eq:SI (match_dup 1) (match_dup 2)))
11247 (clobber (match_scratch:SI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11248 "! TARGET_POWERPC64"
11250 xor %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11251 {sfi|subfic} %3,%1,0\;{ae.|adde.} %0,%3,%1
11252 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11253 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11254 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %3,%0,0\;{ae.|adde.} %0,%3,%0
11260 [(set_attr "type" "compare")
11261 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11264 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11266 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11267 (match_operand:SI 2 "reg_or_cint_operand" ""))
11269 (set (match_operand:SI 0 "gpc_reg_operand" "")
11270 (eq:SI (match_dup 1) (match_dup 2)))
11271 (clobber (match_scratch:SI 3 ""))]
11272 "! TARGET_POWERPC64 && reload_completed"
11273 [(parallel [(set (match_dup 0)
11274 (eq:SI (match_dup 1) (match_dup 2)))
11275 (clobber (match_dup 3))])
11277 (compare:CC (match_dup 0)
11282 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11284 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11285 (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
11287 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
11288 (eq:DI (match_dup 1) (match_dup 2)))
11289 (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]
11292 xor %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11293 subfic %3,%1,0\;adde. %0,%3,%1
11294 xori %0,%1,%b2\;subfic %3,%0,0\;adde. %0,%3,%0
11295 xoris %0,%1,%u2\;subfic %3,%0,0\;adde. %0,%3,%0
11296 subfic %0,%1,%2\;subfic %3,%0,0\;adde. %0,%3,%0
11302 [(set_attr "type" "compare")
11303 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11306 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11308 (eq:DI (match_operand:DI 1 "gpc_reg_operand" "")
11309 (match_operand:DI 2 "reg_or_cint_operand" ""))
11311 (set (match_operand:DI 0 "gpc_reg_operand" "")
11312 (eq:DI (match_dup 1) (match_dup 2)))
11313 (clobber (match_scratch:DI 3 ""))]
11314 "TARGET_POWERPC64 && reload_completed"
11315 [(parallel [(set (match_dup 0)
11316 (eq:DI (match_dup 1) (match_dup 2)))
11317 (clobber (match_dup 3))])
11319 (compare:CC (match_dup 0)
11323 ;; We have insns of the form shown by the first define_insn below. If
11324 ;; there is something inside the comparison operation, we must split it.
11326 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11327 (plus:SI (match_operator 1 "comparison_operator"
11328 [(match_operand:SI 2 "" "")
11329 (match_operand:SI 3
11330 "reg_or_cint_operand" "")])
11331 (match_operand:SI 4 "gpc_reg_operand" "")))
11332 (clobber (match_operand:SI 5 "register_operand" ""))]
11333 "! gpc_reg_operand (operands[2], SImode)"
11334 [(set (match_dup 5) (match_dup 2))
11335 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11339 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11340 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11341 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))
11342 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11343 "! TARGET_POWERPC64"
11345 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11346 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11347 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11348 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11349 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11350 [(set_attr "length" "12,8,12,12,12")])
11353 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11356 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11357 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11358 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11360 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11361 "! TARGET_POWERPC64"
11363 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11364 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11365 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11366 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11367 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11373 [(set_attr "type" "compare")
11374 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11377 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11380 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11381 (match_operand:SI 2 "reg_or_cint_operand" ""))
11382 (match_operand:SI 3 "gpc_reg_operand" ""))
11384 (clobber (match_scratch:SI 4 ""))]
11385 "! TARGET_POWERPC64 && reload_completed"
11386 [(set (match_dup 4)
11387 (plus:SI (eq:SI (match_dup 1)
11391 (compare:CC (match_dup 4)
11396 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11399 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11400 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I,r,O,K,L,I"))
11401 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11403 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11404 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11405 "! TARGET_POWERPC64"
11407 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11408 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11409 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11410 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11411 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11417 [(set_attr "type" "compare")
11418 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11421 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11424 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11425 (match_operand:SI 2 "reg_or_cint_operand" ""))
11426 (match_operand:SI 3 "gpc_reg_operand" ""))
11428 (set (match_operand:SI 0 "gpc_reg_operand" "")
11429 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11430 "! TARGET_POWERPC64 && reload_completed"
11431 [(set (match_dup 0)
11432 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11434 (compare:CC (match_dup 0)
11439 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11440 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11441 (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I"))))]
11442 "! TARGET_POWERPC64"
11444 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11445 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11446 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11447 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11448 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11449 [(set_attr "length" "12,8,12,12,12")])
11451 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11452 ;; since it nabs/sr is just as fast.
11453 (define_insn "*ne0"
11454 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11455 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11457 (clobber (match_scratch:SI 2 "=&r"))]
11458 "! TARGET_POWER && ! TARGET_POWERPC64 && !TARGET_ISEL"
11459 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11460 [(set_attr "length" "8")])
11463 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11464 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11466 (clobber (match_scratch:DI 2 "=&r"))]
11468 "addic %2,%1,-1\;subfe %0,%2,%1"
11469 [(set_attr "length" "8")])
11471 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11473 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11474 (plus:SI (lshiftrt:SI
11475 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11477 (match_operand:SI 2 "gpc_reg_operand" "r")))
11478 (clobber (match_scratch:SI 3 "=&r"))]
11479 "! TARGET_POWERPC64"
11480 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11481 [(set_attr "length" "8")])
11484 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11485 (plus:DI (lshiftrt:DI
11486 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11488 (match_operand:DI 2 "gpc_reg_operand" "r")))
11489 (clobber (match_scratch:DI 3 "=&r"))]
11491 "addic %3,%1,-1\;addze %0,%2"
11492 [(set_attr "length" "8")])
11495 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11497 (plus:SI (lshiftrt:SI
11498 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11500 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11502 (clobber (match_scratch:SI 3 "=&r,&r"))
11503 (clobber (match_scratch:SI 4 "=X,&r"))]
11504 "! TARGET_POWERPC64"
11506 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11508 [(set_attr "type" "compare")
11509 (set_attr "length" "8,12")])
11512 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11514 (plus:SI (lshiftrt:SI
11515 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11517 (match_operand:SI 2 "gpc_reg_operand" ""))
11519 (clobber (match_scratch:SI 3 ""))
11520 (clobber (match_scratch:SI 4 ""))]
11521 "! TARGET_POWERPC64 && reload_completed"
11522 [(parallel [(set (match_dup 3)
11523 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11526 (clobber (match_dup 4))])
11528 (compare:CC (match_dup 3)
11533 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11535 (plus:DI (lshiftrt:DI
11536 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11538 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11540 (clobber (match_scratch:DI 3 "=&r,&r"))]
11543 addic %3,%1,-1\;addze. %3,%2
11545 [(set_attr "type" "compare")
11546 (set_attr "length" "8,12")])
11549 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11551 (plus:DI (lshiftrt:DI
11552 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11554 (match_operand:DI 2 "gpc_reg_operand" ""))
11556 (clobber (match_scratch:DI 3 ""))]
11557 "TARGET_POWERPC64 && reload_completed"
11558 [(set (match_dup 3)
11559 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11563 (compare:CC (match_dup 3)
11568 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11570 (plus:SI (lshiftrt:SI
11571 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11573 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11575 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11576 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11578 (clobber (match_scratch:SI 3 "=&r,&r"))]
11579 "! TARGET_POWERPC64"
11581 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11583 [(set_attr "type" "compare")
11584 (set_attr "length" "8,12")])
11587 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11589 (plus:SI (lshiftrt:SI
11590 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11592 (match_operand:SI 2 "gpc_reg_operand" ""))
11594 (set (match_operand:SI 0 "gpc_reg_operand" "")
11595 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11597 (clobber (match_scratch:SI 3 ""))]
11598 "! TARGET_POWERPC64 && reload_completed"
11599 [(parallel [(set (match_dup 0)
11600 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11602 (clobber (match_dup 3))])
11604 (compare:CC (match_dup 0)
11609 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11611 (plus:DI (lshiftrt:DI
11612 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11614 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11616 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11617 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11619 (clobber (match_scratch:DI 3 "=&r,&r"))]
11622 addic %3,%1,-1\;addze. %0,%2
11624 [(set_attr "type" "compare")
11625 (set_attr "length" "8,12")])
11628 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11630 (plus:DI (lshiftrt:DI
11631 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11633 (match_operand:DI 2 "gpc_reg_operand" ""))
11635 (set (match_operand:DI 0 "gpc_reg_operand" "")
11636 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11638 (clobber (match_scratch:DI 3 ""))]
11639 "TARGET_POWERPC64 && reload_completed"
11640 [(parallel [(set (match_dup 0)
11641 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11643 (clobber (match_dup 3))])
11645 (compare:CC (match_dup 0)
11650 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11651 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11652 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11653 (clobber (match_scratch:SI 3 "=r,X"))]
11656 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11657 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11658 [(set_attr "length" "12")])
11661 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11663 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11664 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11666 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11667 (le:SI (match_dup 1) (match_dup 2)))
11668 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11671 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11672 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11675 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11676 (set_attr "length" "12,12,16,16")])
11679 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11681 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11682 (match_operand:SI 2 "reg_or_short_operand" ""))
11684 (set (match_operand:SI 0 "gpc_reg_operand" "")
11685 (le:SI (match_dup 1) (match_dup 2)))
11686 (clobber (match_scratch:SI 3 ""))]
11687 "TARGET_POWER && reload_completed"
11688 [(parallel [(set (match_dup 0)
11689 (le:SI (match_dup 1) (match_dup 2)))
11690 (clobber (match_dup 3))])
11692 (compare:CC (match_dup 0)
11697 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11698 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11699 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11700 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11703 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11704 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11705 [(set_attr "length" "12")])
11708 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11710 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11711 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11712 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11714 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11717 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11718 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11721 [(set_attr "type" "compare")
11722 (set_attr "length" "12,12,16,16")])
11725 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11727 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11728 (match_operand:SI 2 "reg_or_short_operand" ""))
11729 (match_operand:SI 3 "gpc_reg_operand" ""))
11731 (clobber (match_scratch:SI 4 ""))]
11732 "TARGET_POWER && reload_completed"
11733 [(set (match_dup 4)
11734 (plus:SI (le:SI (match_dup 1) (match_dup 2))
11737 (compare:CC (match_dup 4)
11742 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11744 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11745 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11746 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11748 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
11749 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11752 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11753 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
11756 [(set_attr "type" "compare")
11757 (set_attr "length" "12,12,16,16")])
11760 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11762 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11763 (match_operand:SI 2 "reg_or_short_operand" ""))
11764 (match_operand:SI 3 "gpc_reg_operand" ""))
11766 (set (match_operand:SI 0 "gpc_reg_operand" "")
11767 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11768 "TARGET_POWER && reload_completed"
11769 [(set (match_dup 0)
11770 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11772 (compare:CC (match_dup 0)
11777 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11778 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11779 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11782 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11783 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11784 [(set_attr "length" "12")])
11787 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11788 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11789 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11790 "! TARGET_POWERPC64"
11791 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11792 [(set_attr "length" "12")])
11795 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11796 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
11797 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11799 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
11800 [(set_attr "length" "12")])
11803 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11805 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11806 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11808 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11809 (leu:DI (match_dup 1) (match_dup 2)))]
11812 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11814 [(set_attr "type" "compare")
11815 (set_attr "length" "12,16")])
11818 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11820 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
11821 (match_operand:DI 2 "reg_or_short_operand" ""))
11823 (set (match_operand:DI 0 "gpc_reg_operand" "")
11824 (leu:DI (match_dup 1) (match_dup 2)))]
11825 "TARGET_POWERPC64 && reload_completed"
11826 [(set (match_dup 0)
11827 (leu:DI (match_dup 1) (match_dup 2)))
11829 (compare:CC (match_dup 0)
11834 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11836 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11837 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11839 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11840 (leu:SI (match_dup 1) (match_dup 2)))]
11841 "! TARGET_POWERPC64"
11843 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11845 [(set_attr "type" "compare")
11846 (set_attr "length" "12,16")])
11849 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11851 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11852 (match_operand:SI 2 "reg_or_short_operand" ""))
11854 (set (match_operand:SI 0 "gpc_reg_operand" "")
11855 (leu:SI (match_dup 1) (match_dup 2)))]
11856 "! TARGET_POWERPC64 && reload_completed"
11857 [(set (match_dup 0)
11858 (leu:SI (match_dup 1) (match_dup 2)))
11860 (compare:CC (match_dup 0)
11865 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11867 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11868 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11870 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11871 (leu:DI (match_dup 1) (match_dup 2)))]
11874 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11876 [(set_attr "type" "compare")
11877 (set_attr "length" "12,16")])
11880 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11881 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11882 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11883 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11884 "! TARGET_POWERPC64"
11885 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
11886 [(set_attr "length" "8")])
11889 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11891 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11892 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11893 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11895 (clobber (match_scratch:SI 4 "=&r,&r"))]
11896 "! TARGET_POWERPC64"
11898 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
11900 [(set_attr "type" "compare")
11901 (set_attr "length" "8,12")])
11904 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11906 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11907 (match_operand:SI 2 "reg_or_short_operand" ""))
11908 (match_operand:SI 3 "gpc_reg_operand" ""))
11910 (clobber (match_scratch:SI 4 ""))]
11911 "! TARGET_POWERPC64 && reload_completed"
11912 [(set (match_dup 4)
11913 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
11916 (compare:CC (match_dup 4)
11921 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11923 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11924 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11925 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11927 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11928 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11929 "! TARGET_POWERPC64"
11931 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
11933 [(set_attr "type" "compare")
11934 (set_attr "length" "8,12")])
11937 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11939 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11940 (match_operand:SI 2 "reg_or_short_operand" ""))
11941 (match_operand:SI 3 "gpc_reg_operand" ""))
11943 (set (match_operand:SI 0 "gpc_reg_operand" "")
11944 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11945 "! TARGET_POWERPC64 && reload_completed"
11946 [(set (match_dup 0)
11947 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11949 (compare:CC (match_dup 0)
11954 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11955 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11956 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11957 "! TARGET_POWERPC64"
11958 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
11959 [(set_attr "length" "12")])
11962 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11964 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11965 (match_operand:SI 2 "reg_or_short_operand" "rI")))
11966 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11967 "! TARGET_POWERPC64"
11968 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
11969 [(set_attr "length" "12")])
11972 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11975 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11976 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11977 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11979 (clobber (match_scratch:SI 4 "=&r,&r"))]
11980 "! TARGET_POWERPC64"
11982 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
11984 [(set_attr "type" "compare")
11985 (set_attr "length" "12,16")])
11988 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11991 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11992 (match_operand:SI 2 "reg_or_short_operand" "")))
11993 (match_operand:SI 3 "gpc_reg_operand" ""))
11995 (clobber (match_scratch:SI 4 ""))]
11996 "! TARGET_POWERPC64 && reload_completed"
11997 [(set (match_dup 4)
11998 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12001 (compare:CC (match_dup 4)
12006 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12009 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12010 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12011 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12013 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12014 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12015 "! TARGET_POWERPC64"
12017 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12019 [(set_attr "type" "compare")
12020 (set_attr "length" "12,16")])
12023 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12026 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12027 (match_operand:SI 2 "reg_or_short_operand" "")))
12028 (match_operand:SI 3 "gpc_reg_operand" ""))
12030 (set (match_operand:SI 0 "gpc_reg_operand" "")
12031 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12032 "! TARGET_POWERPC64 && reload_completed"
12033 [(set (match_dup 0)
12034 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12037 (compare:CC (match_dup 0)
12042 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12043 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12044 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12046 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12047 [(set_attr "length" "12")])
12050 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12052 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12053 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12055 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12056 (lt:SI (match_dup 1) (match_dup 2)))]
12059 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12061 [(set_attr "type" "delayed_compare")
12062 (set_attr "length" "12,16")])
12065 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12067 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12068 (match_operand:SI 2 "reg_or_short_operand" ""))
12070 (set (match_operand:SI 0 "gpc_reg_operand" "")
12071 (lt:SI (match_dup 1) (match_dup 2)))]
12072 "TARGET_POWER && reload_completed"
12073 [(set (match_dup 0)
12074 (lt:SI (match_dup 1) (match_dup 2)))
12076 (compare:CC (match_dup 0)
12081 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12082 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12083 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12084 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12086 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12087 [(set_attr "length" "12")])
12090 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12092 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12093 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12094 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12096 (clobber (match_scratch:SI 4 "=&r,&r"))]
12099 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12101 [(set_attr "type" "compare")
12102 (set_attr "length" "12,16")])
12105 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12107 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12108 (match_operand:SI 2 "reg_or_short_operand" ""))
12109 (match_operand:SI 3 "gpc_reg_operand" ""))
12111 (clobber (match_scratch:SI 4 ""))]
12112 "TARGET_POWER && reload_completed"
12113 [(set (match_dup 4)
12114 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12117 (compare:CC (match_dup 4)
12122 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12124 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12125 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12126 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12128 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12129 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12132 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12134 [(set_attr "type" "compare")
12135 (set_attr "length" "12,16")])
12138 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12140 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12141 (match_operand:SI 2 "reg_or_short_operand" ""))
12142 (match_operand:SI 3 "gpc_reg_operand" ""))
12144 (set (match_operand:SI 0 "gpc_reg_operand" "")
12145 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12146 "TARGET_POWER && reload_completed"
12147 [(set (match_dup 0)
12148 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12150 (compare:CC (match_dup 0)
12155 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12156 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12157 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12159 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12160 [(set_attr "length" "12")])
12163 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12164 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12165 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12166 "! TARGET_POWERPC64"
12168 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg %0,%0
12169 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
12170 [(set_attr "length" "12")])
12173 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12175 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12176 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12178 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12179 (ltu:SI (match_dup 1) (match_dup 2)))]
12180 "! TARGET_POWERPC64"
12182 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12183 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12186 [(set_attr "type" "compare")
12187 (set_attr "length" "12,12,16,16")])
12190 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12192 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12193 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12195 (set (match_operand:SI 0 "gpc_reg_operand" "")
12196 (ltu:SI (match_dup 1) (match_dup 2)))]
12197 "! TARGET_POWERPC64 && reload_completed"
12198 [(set (match_dup 0)
12199 (ltu:SI (match_dup 1) (match_dup 2)))
12201 (compare:CC (match_dup 0)
12206 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12207 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12208 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12209 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12210 "! TARGET_POWERPC64"
12212 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3
12213 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
12214 [(set_attr "length" "12")])
12217 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12219 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12220 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12221 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12223 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12224 "! TARGET_POWERPC64"
12226 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12227 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
12230 [(set_attr "type" "compare")
12231 (set_attr "length" "12,12,16,16")])
12234 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12236 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12237 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12238 (match_operand:SI 3 "gpc_reg_operand" ""))
12240 (clobber (match_scratch:SI 4 ""))]
12241 "! TARGET_POWERPC64 && reload_completed"
12242 [(set (match_dup 4)
12243 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12246 (compare:CC (match_dup 4)
12251 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12253 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12254 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12255 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12257 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12258 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12259 "! TARGET_POWERPC64"
12261 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12262 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
12265 [(set_attr "type" "compare")
12266 (set_attr "length" "12,12,16,16")])
12269 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12271 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12272 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12273 (match_operand:SI 3 "gpc_reg_operand" ""))
12275 (set (match_operand:SI 0 "gpc_reg_operand" "")
12276 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12277 "! TARGET_POWERPC64 && reload_completed"
12278 [(set (match_dup 0)
12279 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12281 (compare:CC (match_dup 0)
12286 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12287 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12288 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12289 "! TARGET_POWERPC64"
12291 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12292 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12293 [(set_attr "length" "8")])
12296 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12297 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12298 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12299 (clobber (match_scratch:SI 3 "=r"))]
12301 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12302 [(set_attr "length" "12")])
12305 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12307 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12308 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12310 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12311 (ge:SI (match_dup 1) (match_dup 2)))
12312 (clobber (match_scratch:SI 3 "=r,r"))]
12315 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12317 [(set_attr "type" "compare")
12318 (set_attr "length" "12,16")])
12321 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12323 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12324 (match_operand:SI 2 "reg_or_short_operand" ""))
12326 (set (match_operand:SI 0 "gpc_reg_operand" "")
12327 (ge:SI (match_dup 1) (match_dup 2)))
12328 (clobber (match_scratch:SI 3 ""))]
12329 "TARGET_POWER && reload_completed"
12330 [(parallel [(set (match_dup 0)
12331 (ge:SI (match_dup 1) (match_dup 2)))
12332 (clobber (match_dup 3))])
12334 (compare:CC (match_dup 0)
12339 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12340 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12341 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12342 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12344 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12345 [(set_attr "length" "12")])
12348 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12350 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12351 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12352 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12354 (clobber (match_scratch:SI 4 "=&r,&r"))]
12357 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12359 [(set_attr "type" "compare")
12360 (set_attr "length" "12,16")])
12363 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12365 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12366 (match_operand:SI 2 "reg_or_short_operand" ""))
12367 (match_operand:SI 3 "gpc_reg_operand" ""))
12369 (clobber (match_scratch:SI 4 ""))]
12370 "TARGET_POWER && reload_completed"
12371 [(set (match_dup 4)
12372 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12375 (compare:CC (match_dup 4)
12380 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12382 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12383 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12384 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12386 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12387 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12390 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12392 [(set_attr "type" "compare")
12393 (set_attr "length" "12,16")])
12396 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12398 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12399 (match_operand:SI 2 "reg_or_short_operand" ""))
12400 (match_operand:SI 3 "gpc_reg_operand" ""))
12402 (set (match_operand:SI 0 "gpc_reg_operand" "")
12403 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12404 "TARGET_POWER && reload_completed"
12405 [(set (match_dup 0)
12406 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12408 (compare:CC (match_dup 0)
12413 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12414 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12415 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12417 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12418 [(set_attr "length" "12")])
12421 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12422 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12423 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12424 "! TARGET_POWERPC64"
12426 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12427 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12428 [(set_attr "length" "12")])
12431 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12432 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12433 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12436 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12437 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12438 [(set_attr "length" "12")])
12441 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12443 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12444 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12446 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12447 (geu:SI (match_dup 1) (match_dup 2)))]
12448 "! TARGET_POWERPC64"
12450 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12451 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12454 [(set_attr "type" "compare")
12455 (set_attr "length" "12,12,16,16")])
12458 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12460 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12461 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12463 (set (match_operand:SI 0 "gpc_reg_operand" "")
12464 (geu:SI (match_dup 1) (match_dup 2)))]
12465 "! TARGET_POWERPC64 && reload_completed"
12466 [(set (match_dup 0)
12467 (geu:SI (match_dup 1) (match_dup 2)))
12469 (compare:CC (match_dup 0)
12474 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12476 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12477 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12479 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12480 (geu:DI (match_dup 1) (match_dup 2)))]
12483 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12484 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12487 [(set_attr "type" "compare")
12488 (set_attr "length" "12,12,16,16")])
12491 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12493 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12494 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12496 (set (match_operand:DI 0 "gpc_reg_operand" "")
12497 (geu:DI (match_dup 1) (match_dup 2)))]
12498 "TARGET_POWERPC64 && reload_completed"
12499 [(set (match_dup 0)
12500 (geu:DI (match_dup 1) (match_dup 2)))
12502 (compare:CC (match_dup 0)
12507 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12508 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12509 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12510 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12511 "! TARGET_POWERPC64"
12513 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12514 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12515 [(set_attr "length" "8")])
12518 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12520 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12521 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12522 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12524 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12525 "! TARGET_POWERPC64"
12527 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12528 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12531 [(set_attr "type" "compare")
12532 (set_attr "length" "8,8,12,12")])
12535 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12537 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12538 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12539 (match_operand:SI 3 "gpc_reg_operand" ""))
12541 (clobber (match_scratch:SI 4 ""))]
12542 "! TARGET_POWERPC64 && reload_completed"
12543 [(set (match_dup 4)
12544 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12547 (compare:CC (match_dup 4)
12552 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12554 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12555 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12556 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12558 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12559 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12560 "! TARGET_POWERPC64"
12562 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12563 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12566 [(set_attr "type" "compare")
12567 (set_attr "length" "8,8,12,12")])
12570 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12572 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12573 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12574 (match_operand:SI 3 "gpc_reg_operand" ""))
12576 (set (match_operand:SI 0 "gpc_reg_operand" "")
12577 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12578 "! TARGET_POWERPC64 && reload_completed"
12579 [(set (match_dup 0)
12580 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12582 (compare:CC (match_dup 0)
12587 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12588 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12589 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12590 "! TARGET_POWERPC64"
12592 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12593 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12594 [(set_attr "length" "12")])
12597 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12599 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12600 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12601 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12602 "! TARGET_POWERPC64"
12604 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12605 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12606 [(set_attr "length" "12")])
12609 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12612 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12613 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12614 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12616 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12617 "! TARGET_POWERPC64"
12619 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12620 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12623 [(set_attr "type" "compare")
12624 (set_attr "length" "12,12,16,16")])
12627 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12630 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12631 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12632 (match_operand:SI 3 "gpc_reg_operand" ""))
12634 (clobber (match_scratch:SI 4 ""))]
12635 "! TARGET_POWERPC64 && reload_completed"
12636 [(set (match_dup 4)
12637 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12640 (compare:CC (match_dup 4)
12645 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12648 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12649 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12650 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12652 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12653 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12654 "! TARGET_POWERPC64"
12656 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12657 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12660 [(set_attr "type" "compare")
12661 (set_attr "length" "12,12,16,16")])
12664 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12667 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12668 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12669 (match_operand:SI 3 "gpc_reg_operand" ""))
12671 (set (match_operand:SI 0 "gpc_reg_operand" "")
12672 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12673 "! TARGET_POWERPC64 && reload_completed"
12674 [(set (match_dup 0)
12675 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12677 (compare:CC (match_dup 0)
12682 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12683 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12685 "! TARGET_POWERPC64"
12686 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12687 [(set_attr "length" "12")])
12690 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12691 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12694 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12695 [(set_attr "length" "12")])
12698 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12700 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12703 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12704 (gt:SI (match_dup 1) (const_int 0)))]
12705 "! TARGET_POWERPC64"
12707 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12709 [(set_attr "type" "delayed_compare")
12710 (set_attr "length" "12,16")])
12713 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12715 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12718 (set (match_operand:SI 0 "gpc_reg_operand" "")
12719 (gt:SI (match_dup 1) (const_int 0)))]
12720 "! TARGET_POWERPC64 && reload_completed"
12721 [(set (match_dup 0)
12722 (gt:SI (match_dup 1) (const_int 0)))
12724 (compare:CC (match_dup 0)
12729 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12731 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12734 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12735 (gt:DI (match_dup 1) (const_int 0)))]
12738 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12740 [(set_attr "type" "delayed_compare")
12741 (set_attr "length" "12,16")])
12744 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12746 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12749 (set (match_operand:DI 0 "gpc_reg_operand" "")
12750 (gt:DI (match_dup 1) (const_int 0)))]
12751 "TARGET_POWERPC64 && reload_completed"
12752 [(set (match_dup 0)
12753 (gt:DI (match_dup 1) (const_int 0)))
12755 (compare:CC (match_dup 0)
12760 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12761 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12762 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12764 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12765 [(set_attr "length" "12")])
12768 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12770 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12771 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12773 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12774 (gt:SI (match_dup 1) (match_dup 2)))]
12777 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12779 [(set_attr "type" "delayed_compare")
12780 (set_attr "length" "12,16")])
12783 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12785 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12786 (match_operand:SI 2 "reg_or_short_operand" ""))
12788 (set (match_operand:SI 0 "gpc_reg_operand" "")
12789 (gt:SI (match_dup 1) (match_dup 2)))]
12790 "TARGET_POWER && reload_completed"
12791 [(set (match_dup 0)
12792 (gt:SI (match_dup 1) (match_dup 2)))
12794 (compare:CC (match_dup 0)
12799 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12800 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12802 (match_operand:SI 2 "gpc_reg_operand" "r")))]
12803 "! TARGET_POWERPC64"
12804 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
12805 [(set_attr "length" "12")])
12808 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
12809 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12811 (match_operand:DI 2 "gpc_reg_operand" "r")))]
12813 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12814 [(set_attr "length" "12")])
12817 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12819 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12821 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12823 (clobber (match_scratch:SI 3 "=&r,&r"))]
12824 "! TARGET_POWERPC64"
12826 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12828 [(set_attr "type" "compare")
12829 (set_attr "length" "12,16")])
12832 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12834 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12836 (match_operand:SI 2 "gpc_reg_operand" ""))
12838 (clobber (match_scratch:SI 3 ""))]
12839 "! TARGET_POWERPC64 && reload_completed"
12840 [(set (match_dup 3)
12841 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12844 (compare:CC (match_dup 3)
12849 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12851 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12853 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12855 (clobber (match_scratch:DI 3 "=&r,&r"))]
12858 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12860 [(set_attr "type" "compare")
12861 (set_attr "length" "12,16")])
12864 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12866 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12868 (match_operand:DI 2 "gpc_reg_operand" ""))
12870 (clobber (match_scratch:DI 3 ""))]
12871 "TARGET_POWERPC64 && reload_completed"
12872 [(set (match_dup 3)
12873 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12876 (compare:CC (match_dup 3)
12881 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12883 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12885 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12887 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12888 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12889 "! TARGET_POWERPC64"
12891 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
12893 [(set_attr "type" "compare")
12894 (set_attr "length" "12,16")])
12897 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12899 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12901 (match_operand:SI 2 "gpc_reg_operand" ""))
12903 (set (match_operand:SI 0 "gpc_reg_operand" "")
12904 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12905 "! TARGET_POWERPC64 && reload_completed"
12906 [(set (match_dup 0)
12907 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12909 (compare:CC (match_dup 0)
12914 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12916 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12918 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12920 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
12921 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12924 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12926 [(set_attr "type" "compare")
12927 (set_attr "length" "12,16")])
12930 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12932 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12934 (match_operand:DI 2 "gpc_reg_operand" ""))
12936 (set (match_operand:DI 0 "gpc_reg_operand" "")
12937 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12938 "TARGET_POWERPC64 && reload_completed"
12939 [(set (match_dup 0)
12940 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12942 (compare:CC (match_dup 0)
12947 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12948 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12949 (match_operand:SI 2 "reg_or_short_operand" "r"))
12950 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12952 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12953 [(set_attr "length" "12")])
12956 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12958 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12959 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12960 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12962 (clobber (match_scratch:SI 4 "=&r,&r"))]
12965 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12967 [(set_attr "type" "compare")
12968 (set_attr "length" "12,16")])
12971 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12973 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12974 (match_operand:SI 2 "reg_or_short_operand" ""))
12975 (match_operand:SI 3 "gpc_reg_operand" ""))
12977 (clobber (match_scratch:SI 4 ""))]
12978 "TARGET_POWER && reload_completed"
12979 [(set (match_dup 4)
12980 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12982 (compare:CC (match_dup 4)
12987 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12989 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12990 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12991 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12993 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12994 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12997 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12999 [(set_attr "type" "compare")
13000 (set_attr "length" "12,16")])
13003 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13005 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13006 (match_operand:SI 2 "reg_or_short_operand" ""))
13007 (match_operand:SI 3 "gpc_reg_operand" ""))
13009 (set (match_operand:SI 0 "gpc_reg_operand" "")
13010 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13011 "TARGET_POWER && reload_completed"
13012 [(set (match_dup 0)
13013 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13015 (compare:CC (match_dup 0)
13020 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13021 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13023 "! TARGET_POWERPC64"
13024 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13025 [(set_attr "length" "12")])
13028 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13029 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13032 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13033 [(set_attr "length" "12")])
13036 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13037 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13038 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13040 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13041 [(set_attr "length" "12")])
13044 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13045 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13046 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13047 "! TARGET_POWERPC64"
13048 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg %0,%0"
13049 [(set_attr "length" "12")])
13052 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13053 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13054 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13056 "subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg %0,%0"
13057 [(set_attr "length" "12")])
13060 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13062 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13063 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13065 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13066 (gtu:SI (match_dup 1) (match_dup 2)))]
13067 "! TARGET_POWERPC64"
13069 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13071 [(set_attr "type" "compare")
13072 (set_attr "length" "12,16")])
13075 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13077 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13078 (match_operand:SI 2 "reg_or_short_operand" ""))
13080 (set (match_operand:SI 0 "gpc_reg_operand" "")
13081 (gtu:SI (match_dup 1) (match_dup 2)))]
13082 "! TARGET_POWERPC64 && reload_completed"
13083 [(set (match_dup 0)
13084 (gtu:SI (match_dup 1) (match_dup 2)))
13086 (compare:CC (match_dup 0)
13091 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13093 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13094 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13096 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13097 (gtu:DI (match_dup 1) (match_dup 2)))]
13100 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13102 [(set_attr "type" "compare")
13103 (set_attr "length" "12,16")])
13106 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13108 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13109 (match_operand:DI 2 "reg_or_short_operand" ""))
13111 (set (match_operand:DI 0 "gpc_reg_operand" "")
13112 (gtu:DI (match_dup 1) (match_dup 2)))]
13113 "TARGET_POWERPC64 && reload_completed"
13114 [(set (match_dup 0)
13115 (gtu:DI (match_dup 1) (match_dup 2)))
13117 (compare:CC (match_dup 0)
13122 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13123 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13124 (match_operand:SI 2 "reg_or_short_operand" "I,rI"))
13125 (match_operand:SI 3 "reg_or_short_operand" "r,rI")))]
13126 "! TARGET_POWERPC64"
13128 {ai|addic} %0,%1,%k2\;{aze|addze} %0,%3
13129 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf%I3|subf%I3c} %0,%0,%3"
13130 [(set_attr "length" "8,12")])
13133 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
13134 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13135 (match_operand:DI 2 "reg_or_short_operand" "I,rI"))
13136 (match_operand:DI 3 "reg_or_short_operand" "r,rI")))]
13139 addic %0,%1,%k2\;addze %0,%3
13140 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf%I3c %0,%0,%3"
13141 [(set_attr "length" "8,12")])
13144 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13146 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13147 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13148 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13150 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13151 "! TARGET_POWERPC64"
13153 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13154 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subfc.} %4,%4,%3
13157 [(set_attr "type" "compare")
13158 (set_attr "length" "8,12,12,16")])
13161 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13163 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13164 (match_operand:SI 2 "reg_or_short_operand" ""))
13165 (match_operand:SI 3 "gpc_reg_operand" ""))
13167 (clobber (match_scratch:SI 4 ""))]
13168 "! TARGET_POWERPC64 && reload_completed"
13169 [(set (match_dup 4)
13170 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13173 (compare:CC (match_dup 4)
13178 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13180 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13181 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13182 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13184 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13187 addic %4,%1,%k2\;addze. %4,%3
13188 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subfc. %4,%4,%3
13191 [(set_attr "type" "compare")
13192 (set_attr "length" "8,12,12,16")])
13195 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13197 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13198 (match_operand:DI 2 "reg_or_short_operand" ""))
13199 (match_operand:DI 3 "gpc_reg_operand" ""))
13201 (clobber (match_scratch:DI 4 ""))]
13202 "TARGET_POWERPC64 && reload_completed"
13203 [(set (match_dup 4)
13204 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13207 (compare:CC (match_dup 4)
13212 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13214 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13215 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13216 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13218 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13219 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13220 "! TARGET_POWERPC64"
13222 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13223 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subfc.} %0,%0,%3
13226 [(set_attr "type" "compare")
13227 (set_attr "length" "8,12,12,16")])
13230 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13232 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13233 (match_operand:SI 2 "reg_or_short_operand" ""))
13234 (match_operand:SI 3 "gpc_reg_operand" ""))
13236 (set (match_operand:SI 0 "gpc_reg_operand" "")
13237 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13238 "! TARGET_POWERPC64 && reload_completed"
13239 [(set (match_dup 0)
13240 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13242 (compare:CC (match_dup 0)
13247 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13249 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13250 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13251 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13253 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13254 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13257 addic %0,%1,%k2\;addze. %0,%3
13258 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subfc. %0,%0,%3
13261 [(set_attr "type" "compare")
13262 (set_attr "length" "8,12,12,16")])
13265 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13267 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13268 (match_operand:DI 2 "reg_or_short_operand" ""))
13269 (match_operand:DI 3 "gpc_reg_operand" ""))
13271 (set (match_operand:DI 0 "gpc_reg_operand" "")
13272 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13273 "TARGET_POWERPC64 && reload_completed"
13274 [(set (match_dup 0)
13275 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13277 (compare:CC (match_dup 0)
13282 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13283 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13284 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13285 "! TARGET_POWERPC64"
13286 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13287 [(set_attr "length" "8")])
13290 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13291 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13292 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13294 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13295 [(set_attr "length" "8")])
13297 ;; Define both directions of branch and return. If we need a reload
13298 ;; register, we'd rather use CR0 since it is much easier to copy a
13299 ;; register CC value to there.
13303 (if_then_else (match_operator 1 "branch_comparison_operator"
13305 "cc_reg_operand" "y")
13307 (label_ref (match_operand 0 "" ""))
13312 return output_cbranch (operands[1], \"%l0\", 0, insn);
13314 [(set_attr "type" "branch")])
13318 (if_then_else (match_operator 0 "branch_comparison_operator"
13320 "cc_reg_operand" "y")
13327 return output_cbranch (operands[0], NULL, 0, insn);
13329 [(set_attr "type" "branch")
13330 (set_attr "length" "4")])
13334 (if_then_else (match_operator 1 "branch_comparison_operator"
13336 "cc_reg_operand" "y")
13339 (label_ref (match_operand 0 "" ""))))]
13343 return output_cbranch (operands[1], \"%l0\", 1, insn);
13345 [(set_attr "type" "branch")])
13349 (if_then_else (match_operator 0 "branch_comparison_operator"
13351 "cc_reg_operand" "y")
13358 return output_cbranch (operands[0], NULL, 1, insn);
13360 [(set_attr "type" "branch")
13361 (set_attr "length" "4")])
13363 ;; Logic on condition register values.
13365 ; This pattern matches things like
13366 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13367 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13369 ; which are generated by the branch logic.
13370 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13373 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13374 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13375 [(match_operator:SI 2
13376 "branch_positive_comparison_operator"
13378 "cc_reg_operand" "y,y")
13380 (match_operator:SI 4
13381 "branch_positive_comparison_operator"
13383 "cc_reg_operand" "0,y")
13387 "cr%q1 %E0,%j2,%j4"
13388 [(set_attr "type" "cr_logical,delayed_cr")])
13390 ; Why is the constant -1 here, but 1 in the previous pattern?
13391 ; Because ~1 has all but the low bit set.
13393 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13394 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13395 [(not:SI (match_operator:SI 2
13396 "branch_positive_comparison_operator"
13398 "cc_reg_operand" "y,y")
13400 (match_operator:SI 4
13401 "branch_positive_comparison_operator"
13403 "cc_reg_operand" "0,y")
13407 "cr%q1 %E0,%j2,%j4"
13408 [(set_attr "type" "cr_logical,delayed_cr")])
13411 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13412 (compare:CCEQ (match_operator:SI 1
13413 "branch_positive_comparison_operator"
13415 "cc_reg_operand" "0,y")
13419 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13420 [(set_attr "type" "cr_logical,delayed_cr")])
13422 ;; If we are comparing the result of two comparisons, this can be done
13423 ;; using creqv or crxor.
13425 (define_insn_and_split ""
13426 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13427 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13428 [(match_operand 2 "cc_reg_operand" "y")
13430 (match_operator 3 "branch_comparison_operator"
13431 [(match_operand 4 "cc_reg_operand" "y")
13436 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13440 int positive_1, positive_2;
13442 positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
13443 positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
13446 operands[1] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[2]),
13447 GET_CODE (operands[1])),
13449 operands[2], const0_rtx);
13450 else if (GET_MODE (operands[1]) != SImode)
13451 operands[1] = gen_rtx (GET_CODE (operands[1]),
13453 operands[2], const0_rtx);
13456 operands[3] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[4]),
13457 GET_CODE (operands[3])),
13459 operands[4], const0_rtx);
13460 else if (GET_MODE (operands[3]) != SImode)
13461 operands[3] = gen_rtx (GET_CODE (operands[3]),
13463 operands[4], const0_rtx);
13465 if (positive_1 == positive_2)
13467 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13468 operands[5] = constm1_rtx;
13472 operands[5] = const1_rtx;
13476 ;; Unconditional branch and return.
13478 (define_insn "jump"
13480 (label_ref (match_operand 0 "" "")))]
13483 [(set_attr "type" "branch")])
13485 (define_insn "return"
13489 [(set_attr "type" "jmpreg")])
13491 (define_expand "indirect_jump"
13492 [(set (pc) (match_operand 0 "register_operand" ""))]
13497 emit_jump_insn (gen_indirect_jumpsi (operands[0]));
13499 emit_jump_insn (gen_indirect_jumpdi (operands[0]));
13503 (define_insn "indirect_jumpsi"
13504 [(set (pc) (match_operand:SI 0 "register_operand" "c,*l"))]
13509 [(set_attr "type" "jmpreg")])
13511 (define_insn "indirect_jumpdi"
13512 [(set (pc) (match_operand:DI 0 "register_operand" "c,*l"))]
13517 [(set_attr "type" "jmpreg")])
13519 ;; Table jump for switch statements:
13520 (define_expand "tablejump"
13521 [(use (match_operand 0 "" ""))
13522 (use (label_ref (match_operand 1 "" "")))]
13527 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13529 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13533 (define_expand "tablejumpsi"
13534 [(set (match_dup 3)
13535 (plus:SI (match_operand:SI 0 "" "")
13537 (parallel [(set (pc) (match_dup 3))
13538 (use (label_ref (match_operand 1 "" "")))])]
13541 { operands[0] = force_reg (SImode, operands[0]);
13542 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13543 operands[3] = gen_reg_rtx (SImode);
13546 (define_expand "tablejumpdi"
13547 [(set (match_dup 4)
13548 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13550 (plus:DI (match_dup 4)
13552 (parallel [(set (pc) (match_dup 3))
13553 (use (label_ref (match_operand 1 "" "")))])]
13556 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13557 operands[3] = gen_reg_rtx (DImode);
13558 operands[4] = gen_reg_rtx (DImode);
13563 (match_operand:SI 0 "register_operand" "c,*l"))
13564 (use (label_ref (match_operand 1 "" "")))]
13569 [(set_attr "type" "jmpreg")])
13573 (match_operand:DI 0 "register_operand" "c,*l"))
13574 (use (label_ref (match_operand 1 "" "")))]
13579 [(set_attr "type" "jmpreg")])
13584 "{cror 0,0,0|nop}")
13586 ;; Define the subtract-one-and-jump insns, starting with the template
13587 ;; so loop.c knows what to generate.
13589 (define_expand "doloop_end"
13590 [(use (match_operand 0 "" "")) ; loop pseudo
13591 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13592 (use (match_operand 2 "" "")) ; max iterations
13593 (use (match_operand 3 "" "")) ; loop level
13594 (use (match_operand 4 "" ""))] ; label
13598 /* Only use this on innermost loops. */
13599 if (INTVAL (operands[3]) > 1)
13601 if (TARGET_POWERPC64)
13603 if (GET_MODE (operands[0]) != DImode)
13605 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13609 if (GET_MODE (operands[0]) != SImode)
13611 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13616 (define_expand "ctrsi"
13617 [(parallel [(set (pc)
13618 (if_then_else (ne (match_operand:SI 0 "register_operand" "")
13620 (label_ref (match_operand 1 "" ""))
13623 (plus:SI (match_dup 0)
13625 (clobber (match_scratch:CC 2 ""))
13626 (clobber (match_scratch:SI 3 ""))])]
13627 "! TARGET_POWERPC64"
13630 (define_expand "ctrdi"
13631 [(parallel [(set (pc)
13632 (if_then_else (ne (match_operand:DI 0 "register_operand" "")
13634 (label_ref (match_operand 1 "" ""))
13637 (plus:DI (match_dup 0)
13639 (clobber (match_scratch:CC 2 ""))
13640 (clobber (match_scratch:DI 3 ""))])]
13644 ;; We need to be able to do this for any operand, including MEM, or we
13645 ;; will cause reload to blow up since we don't allow output reloads on
13647 ;; For the length attribute to be calculated correctly, the
13648 ;; label MUST be operand 0.
13650 (define_insn "*ctrsi_internal1"
13652 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
13654 (label_ref (match_operand 0 "" ""))
13656 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13657 (plus:SI (match_dup 1)
13659 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13660 (clobber (match_scratch:SI 4 "=X,X,r"))]
13661 "! TARGET_POWERPC64"
13664 if (which_alternative != 0)
13666 else if (get_attr_length (insn) == 4)
13667 return \"{bdn|bdnz} %l0\";
13669 return \"bdz $+8\;b %l0\";
13671 [(set_attr "type" "branch")
13672 (set_attr "length" "4,12,16")])
13674 (define_insn "*ctrsi_internal2"
13676 (if_then_else (ne (match_operand:SI 1 "register_operand" "c,*r,*r")
13679 (label_ref (match_operand 0 "" ""))))
13680 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13681 (plus:SI (match_dup 1)
13683 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13684 (clobber (match_scratch:SI 4 "=X,X,r"))]
13685 "! TARGET_POWERPC64"
13688 if (which_alternative != 0)
13690 else if (get_attr_length (insn) == 4)
13691 return \"bdz %l0\";
13693 return \"{bdn|bdnz} $+8\;b %l0\";
13695 [(set_attr "type" "branch")
13696 (set_attr "length" "4,12,16")])
13698 (define_insn "*ctrdi_internal1"
13700 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r")
13702 (label_ref (match_operand 0 "" ""))
13704 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13705 (plus:DI (match_dup 1)
13707 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13708 (clobber (match_scratch:DI 4 "=X,X,r"))]
13712 if (which_alternative != 0)
13714 else if (get_attr_length (insn) == 4)
13715 return \"{bdn|bdnz} %l0\";
13717 return \"bdz $+8\;b %l0\";
13719 [(set_attr "type" "branch")
13720 (set_attr "length" "4,12,16")])
13722 (define_insn "*ctrdi_internal2"
13724 (if_then_else (ne (match_operand:DI 1 "register_operand" "c,*r,*r")
13727 (label_ref (match_operand 0 "" ""))))
13728 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13729 (plus:DI (match_dup 1)
13731 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13732 (clobber (match_scratch:DI 4 "=X,X,r"))]
13736 if (which_alternative != 0)
13738 else if (get_attr_length (insn) == 4)
13739 return \"bdz %l0\";
13741 return \"{bdn|bdnz} $+8\;b %l0\";
13743 [(set_attr "type" "branch")
13744 (set_attr "length" "4,12,16")])
13746 ;; Similar, but we can use GE since we have a REG_NONNEG.
13748 (define_insn "*ctrsi_internal3"
13750 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
13752 (label_ref (match_operand 0 "" ""))
13754 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13755 (plus:SI (match_dup 1)
13757 (clobber (match_scratch:CC 3 "=X,&x,&X"))
13758 (clobber (match_scratch:SI 4 "=X,X,r"))]
13759 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13762 if (which_alternative != 0)
13764 else if (get_attr_length (insn) == 4)
13765 return \"{bdn|bdnz} %l0\";
13767 return \"bdz $+8\;b %l0\";
13769 [(set_attr "type" "branch")
13770 (set_attr "length" "4,12,16")])
13772 (define_insn "*ctrsi_internal4"
13774 (if_then_else (ge (match_operand:SI 1 "register_operand" "c,*r,*r")
13777 (label_ref (match_operand 0 "" ""))))
13778 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13779 (plus:SI (match_dup 1)
13781 (clobber (match_scratch:CC 3 "=X,&x,&X"))
13782 (clobber (match_scratch:SI 4 "=X,X,r"))]
13783 "! TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13786 if (which_alternative != 0)
13788 else if (get_attr_length (insn) == 4)
13789 return \"bdz %l0\";
13791 return \"{bdn|bdnz} $+8\;b %l0\";
13793 [(set_attr "type" "branch")
13794 (set_attr "length" "4,12,16")])
13796 (define_insn "*ctrdi_internal3"
13798 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r")
13800 (label_ref (match_operand 0 "" ""))
13802 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13803 (plus:DI (match_dup 1)
13805 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13806 (clobber (match_scratch:DI 4 "=X,X,r"))]
13807 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13810 if (which_alternative != 0)
13812 else if (get_attr_length (insn) == 4)
13813 return \"{bdn|bdnz} %l0\";
13815 return \"bdz $+8\;b %l0\";
13817 [(set_attr "type" "branch")
13818 (set_attr "length" "4,12,16")])
13820 (define_insn "*ctrdi_internal4"
13822 (if_then_else (ge (match_operand:DI 1 "register_operand" "c,*r,*r")
13825 (label_ref (match_operand 0 "" ""))))
13826 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13827 (plus:DI (match_dup 1)
13829 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13830 (clobber (match_scratch:DI 4 "=X,X,r"))]
13831 "TARGET_POWERPC64 && find_reg_note (insn, REG_NONNEG, 0)"
13834 if (which_alternative != 0)
13836 else if (get_attr_length (insn) == 4)
13837 return \"bdz %l0\";
13839 return \"{bdn|bdnz} $+8\;b %l0\";
13841 [(set_attr "type" "branch")
13842 (set_attr "length" "4,12,16")])
13844 ;; Similar but use EQ
13846 (define_insn "*ctrsi_internal5"
13848 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
13850 (label_ref (match_operand 0 "" ""))
13852 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13853 (plus:SI (match_dup 1)
13855 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13856 (clobber (match_scratch:SI 4 "=X,X,r"))]
13857 "! TARGET_POWERPC64"
13860 if (which_alternative != 0)
13862 else if (get_attr_length (insn) == 4)
13863 return \"bdz %l0\";
13865 return \"{bdn|bdnz} $+8\;b %l0\";
13867 [(set_attr "type" "branch")
13868 (set_attr "length" "4,12,16")])
13870 (define_insn "*ctrsi_internal6"
13872 (if_then_else (eq (match_operand:SI 1 "register_operand" "c,*r,*r")
13875 (label_ref (match_operand 0 "" ""))))
13876 (set (match_operand:SI 2 "register_operand" "=1,*r,m*q*c*l")
13877 (plus:SI (match_dup 1)
13879 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13880 (clobber (match_scratch:SI 4 "=X,X,r"))]
13881 "! TARGET_POWERPC64"
13884 if (which_alternative != 0)
13886 else if (get_attr_length (insn) == 4)
13887 return \"{bdn|bdnz} %l0\";
13889 return \"bdz $+8\;b %l0\";
13891 [(set_attr "type" "branch")
13892 (set_attr "length" "4,12,16")])
13894 (define_insn "*ctrdi_internal5"
13896 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r")
13898 (label_ref (match_operand 0 "" ""))
13900 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13901 (plus:DI (match_dup 1)
13903 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13904 (clobber (match_scratch:DI 4 "=X,X,r"))]
13908 if (which_alternative != 0)
13910 else if (get_attr_length (insn) == 4)
13911 return \"bdz %l0\";
13913 return \"{bdn|bdnz} $+8\;b %l0\";
13915 [(set_attr "type" "branch")
13916 (set_attr "length" "4,12,16")])
13918 (define_insn "*ctrdi_internal6"
13920 (if_then_else (eq (match_operand:DI 1 "register_operand" "c,*r,*r")
13923 (label_ref (match_operand 0 "" ""))))
13924 (set (match_operand:DI 2 "register_operand" "=1,*r,m*c*l")
13925 (plus:DI (match_dup 1)
13927 (clobber (match_scratch:CC 3 "=X,&x,&x"))
13928 (clobber (match_scratch:DI 4 "=X,X,r"))]
13932 if (which_alternative != 0)
13934 else if (get_attr_length (insn) == 4)
13935 return \"{bdn|bdnz} %l0\";
13937 return \"bdz $+8\;b %l0\";
13939 [(set_attr "type" "branch")
13940 (set_attr "length" "4,12,16")])
13942 ;; Now the splitters if we could not allocate the CTR register
13946 (if_then_else (match_operator 2 "comparison_operator"
13947 [(match_operand:SI 1 "gpc_reg_operand" "")
13949 (match_operand 5 "" "")
13950 (match_operand 6 "" "")))
13951 (set (match_operand:SI 0 "gpc_reg_operand" "")
13952 (plus:SI (match_dup 1)
13954 (clobber (match_scratch:CC 3 ""))
13955 (clobber (match_scratch:SI 4 ""))]
13956 "! TARGET_POWERPC64 && reload_completed"
13957 [(parallel [(set (match_dup 3)
13958 (compare:CC (plus:SI (match_dup 1)
13962 (plus:SI (match_dup 1)
13964 (set (pc) (if_then_else (match_dup 7)
13968 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
13973 (if_then_else (match_operator 2 "comparison_operator"
13974 [(match_operand:SI 1 "gpc_reg_operand" "")
13976 (match_operand 5 "" "")
13977 (match_operand 6 "" "")))
13978 (set (match_operand:SI 0 "nonimmediate_operand" "")
13979 (plus:SI (match_dup 1) (const_int -1)))
13980 (clobber (match_scratch:CC 3 ""))
13981 (clobber (match_scratch:SI 4 ""))]
13982 "! TARGET_POWERPC64 && reload_completed
13983 && ! gpc_reg_operand (operands[0], SImode)"
13984 [(parallel [(set (match_dup 3)
13985 (compare:CC (plus:SI (match_dup 1)
13989 (plus:SI (match_dup 1)
13993 (set (pc) (if_then_else (match_dup 7)
13997 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14001 (if_then_else (match_operator 2 "comparison_operator"
14002 [(match_operand:DI 1 "gpc_reg_operand" "")
14004 (match_operand 5 "" "")
14005 (match_operand 6 "" "")))
14006 (set (match_operand:DI 0 "gpc_reg_operand" "")
14007 (plus:DI (match_dup 1)
14009 (clobber (match_scratch:CC 3 ""))
14010 (clobber (match_scratch:DI 4 ""))]
14011 "TARGET_POWERPC64 && reload_completed"
14012 [(parallel [(set (match_dup 3)
14013 (compare:CC (plus:DI (match_dup 1)
14017 (plus:DI (match_dup 1)
14019 (set (pc) (if_then_else (match_dup 7)
14023 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14028 (if_then_else (match_operator 2 "comparison_operator"
14029 [(match_operand:DI 1 "gpc_reg_operand" "")
14031 (match_operand 5 "" "")
14032 (match_operand 6 "" "")))
14033 (set (match_operand:DI 0 "nonimmediate_operand" "")
14034 (plus:DI (match_dup 1) (const_int -1)))
14035 (clobber (match_scratch:CC 3 ""))
14036 (clobber (match_scratch:DI 4 ""))]
14037 "TARGET_POWERPC64 && reload_completed
14038 && ! gpc_reg_operand (operands[0], DImode)"
14039 [(parallel [(set (match_dup 3)
14040 (compare:CC (plus:DI (match_dup 1)
14044 (plus:DI (match_dup 1)
14048 (set (pc) (if_then_else (match_dup 7)
14052 { operands[7] = gen_rtx (GET_CODE (operands[2]), VOIDmode, operands[3],
14056 (define_insn "trap"
14057 [(trap_if (const_int 1) (const_int 0))]
14061 (define_expand "conditional_trap"
14062 [(trap_if (match_operator 0 "trap_comparison_operator"
14063 [(match_dup 2) (match_dup 3)])
14064 (match_operand 1 "const_int_operand" ""))]
14066 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
14067 operands[2] = rs6000_compare_op0;
14068 operands[3] = rs6000_compare_op1;")
14071 [(trap_if (match_operator 0 "trap_comparison_operator"
14072 [(match_operand:SI 1 "register_operand" "r")
14073 (match_operand:SI 2 "reg_or_short_operand" "rI")])
14076 "{t|tw}%V0%I2 %1,%2")
14079 [(trap_if (match_operator 0 "trap_comparison_operator"
14080 [(match_operand:DI 1 "register_operand" "r")
14081 (match_operand:DI 2 "reg_or_short_operand" "rI")])
14086 ;; Insns related to generating the function prologue and epilogue.
14088 (define_expand "prologue"
14089 [(use (const_int 0))]
14090 "TARGET_SCHED_PROLOG"
14093 rs6000_emit_prologue ();
14097 (define_insn "movesi_from_cr"
14098 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
14099 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
14100 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)] 19))]
14103 [(set_attr "type" "mfcr")])
14105 (define_insn "*stmw"
14106 [(match_parallel 0 "stmw_operation"
14107 [(set (match_operand:SI 1 "memory_operand" "=m")
14108 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
14110 "{stm|stmw} %2,%1")
14112 (define_insn "*save_fpregs_si"
14113 [(match_parallel 0 "any_operand"
14114 [(clobber (match_operand:SI 1 "register_operand" "=l"))
14115 (use (match_operand:SI 2 "call_operand" "s"))
14116 (set (match_operand:DF 3 "memory_operand" "=m")
14117 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14121 (define_insn "*save_fpregs_di"
14122 [(match_parallel 0 "any_operand"
14123 [(clobber (match_operand:DI 1 "register_operand" "=l"))
14124 (use (match_operand:DI 2 "call_operand" "s"))
14125 (set (match_operand:DF 3 "memory_operand" "=m")
14126 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
14130 ; These are to explain that changes to the stack pointer should
14131 ; not be moved over stores to stack memory.
14132 (define_insn "stack_tie"
14133 [(set (match_operand:BLK 0 "memory_operand" "+m")
14134 (unspec:BLK [(match_dup 0)] 5))]
14137 [(set_attr "length" "0")])
14140 (define_expand "epilogue"
14141 [(use (const_int 0))]
14142 "TARGET_SCHED_PROLOG"
14145 rs6000_emit_epilogue (FALSE);
14149 ; On some processors, doing the mtcrf one CC register at a time is
14150 ; faster (like on the 604e). On others, doing them all at once is
14151 ; faster; for instance, on the 601 and 750.
14153 (define_expand "movsi_to_cr_one"
14154 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14155 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14156 (match_dup 2)] 20))]
14158 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
14160 (define_insn "*movsi_to_cr"
14161 [(match_parallel 0 "mtcrf_operation"
14162 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
14163 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
14164 (match_operand 3 "immediate_operand" "n")]
14171 for (i = 0; i < XVECLEN (operands[0], 0); i++)
14172 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
14173 operands[4] = GEN_INT (mask);
14174 return \"mtcrf %4,%2\";
14176 [(set_attr "type" "mtcr")])
14178 (define_insn "*mtcrfsi"
14179 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
14180 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
14181 (match_operand 2 "immediate_operand" "n")] 20))]
14182 "GET_CODE (operands[0]) == REG
14183 && CR_REGNO_P (REGNO (operands[0]))
14184 && GET_CODE (operands[2]) == CONST_INT
14185 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
14187 [(set_attr "type" "mtcr")])
14189 ; The load-multiple instructions have similar properties.
14190 ; Note that "load_multiple" is a name known to the machine-independent
14191 ; code that actually corresponds to the powerpc load-string.
14193 (define_insn "*lmw"
14194 [(match_parallel 0 "lmw_operation"
14195 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
14196 (match_operand:SI 2 "memory_operand" "m"))])]
14200 (define_insn "*return_internal_si"
14202 (use (match_operand:SI 0 "register_operand" "lc"))]
14205 [(set_attr "type" "jmpreg")])
14207 (define_insn "*return_internal_di"
14209 (use (match_operand:DI 0 "register_operand" "lc"))]
14212 [(set_attr "type" "jmpreg")])
14214 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
14215 ; stuff was in GCC. Oh, and "any_operand" is a bit flexible...
14217 (define_insn "*return_and_restore_fpregs_si"
14218 [(match_parallel 0 "any_operand"
14220 (use (match_operand:SI 1 "register_operand" "l"))
14221 (use (match_operand:SI 2 "call_operand" "s"))
14222 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14223 (match_operand:DF 4 "memory_operand" "m"))])]
14227 (define_insn "*return_and_restore_fpregs_di"
14228 [(match_parallel 0 "any_operand"
14230 (use (match_operand:DI 1 "register_operand" "l"))
14231 (use (match_operand:DI 2 "call_operand" "s"))
14232 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
14233 (match_operand:DF 4 "memory_operand" "m"))])]
14237 ; This is used in compiling the unwind routines.
14238 (define_expand "eh_return"
14239 [(use (match_operand 0 "general_operand" ""))
14240 (use (match_operand 1 "general_operand" ""))]
14245 rs6000_emit_eh_toc_restore (operands[0]);
14248 emit_insn (gen_eh_set_lr_si (operands[1]));
14250 emit_insn (gen_eh_set_lr_di (operands[1]));
14251 emit_move_insn (EH_RETURN_STACKADJ_RTX, operands[0]);
14255 ; We can't expand this before we know where the link register is stored.
14256 (define_insn "eh_set_lr_si"
14257 [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] 9)
14258 (clobber (match_scratch:SI 1 "=&b"))]
14262 (define_insn "eh_set_lr_di"
14263 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 9)
14264 (clobber (match_scratch:DI 1 "=&b"))]
14269 [(unspec_volatile [(match_operand 0 "register_operand" "")] 9)
14270 (clobber (match_scratch 1 ""))]
14275 rs6000_stack_t *info = rs6000_stack_info ();
14277 if (info->lr_save_p)
14279 rtx frame_rtx = stack_pointer_rtx;
14283 if (frame_pointer_needed
14284 || current_function_calls_alloca
14285 || info->total_size > 32767)
14287 emit_move_insn (operands[1], gen_rtx_MEM (Pmode, frame_rtx));
14288 frame_rtx = operands[1];
14290 else if (info->push_p)
14291 sp_offset = info->total_size;
14293 tmp = plus_constant (frame_rtx, info->lr_save_offset + sp_offset);
14294 tmp = gen_rtx_MEM (Pmode, tmp);
14295 emit_move_insn (tmp, operands[0]);
14298 emit_move_insn (gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM), operands[0]);
14302 (define_insn "prefetch"
14303 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14304 (match_operand:SI 1 "const_int_operand" "n")
14305 (match_operand:SI 2 "const_int_operand" "n"))]
14309 if (GET_CODE (operands[0]) == REG)
14310 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14311 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14313 [(set_attr "type" "load")])
14315 (include "altivec.md")