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, 2004, 2005 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published
10 ;; by the Free Software Foundation; either version 2, or (at your
11 ;; option) any later version.
13 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
14 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 ;; License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21 ;; MA 02110-1301, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
30 [(UNSPEC_FRSP 0) ; frsp for POWER machines
31 (UNSPEC_TIE 5) ; tie stack contents and stack pointer
32 (UNSPEC_TOCPTR 6) ; address of a word pointing to the TOC
33 (UNSPEC_TOC 7) ; address of the TOC (more-or-less)
35 (UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
37 (UNSPEC_LD_MPIC 15) ; load_macho_picbase
38 (UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
41 (UNSPEC_MOVESI_FROM_CR 19)
42 (UNSPEC_MOVESI_TO_CR 20)
44 (UNSPEC_TLSDTPRELHA 22)
45 (UNSPEC_TLSDTPRELLO 23)
46 (UNSPEC_TLSGOTDTPREL 24)
48 (UNSPEC_TLSTPRELHA 26)
49 (UNSPEC_TLSTPRELLO 27)
50 (UNSPEC_TLSGOTTPREL 28)
52 (UNSPEC_FIX_TRUNC_TF 30) ; fadd, rounding towards zero
53 (UNSPEC_MV_CR_GT 31) ; move_from_CR_eq_bit
70 ;; UNSPEC_VOLATILE usage
75 (UNSPECV_LL 1) ; load-locked
76 (UNSPECV_SC 2) ; store-conditional
77 (UNSPECV_EH_RR 9) ; eh_reg_restore
80 ;; Define an insn type attribute. This is used in function unit delay
82 (define_attr "type" "integer,two,three,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,insert_word,branch,cmp,fast_compare,compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,isync,sync,load_l,store_c"
83 (const_string "integer"))
86 ; '(pc)' in the following doesn't include the instruction itself; it is
87 ; calculated as if the instruction had zero size.
88 (define_attr "length" ""
89 (if_then_else (eq_attr "type" "branch")
90 (if_then_else (and (ge (minus (match_dup 0) (pc))
92 (lt (minus (match_dup 0) (pc))
98 ;; Processor type -- this attribute must exactly match the processor_type
99 ;; enumeration in rs6000.h.
101 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
102 (const (symbol_ref "rs6000_cpu_attr")))
104 (automata_option "ndfa")
117 (include "power4.md")
118 (include "power5.md")
120 (include "predicates.md")
122 (include "darwin.md")
127 ; This mode macro allows :GPR to be used to indicate the allowable size
128 ; of whole values in GPRs.
129 (define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
131 ; Any supported integer mode.
132 (define_mode_macro INT [QI HI SI DI TI])
134 ; Any supported integer mode that fits in one register.
135 (define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
137 ; SImode or DImode, even if DImode doesn't fit in GPRs.
138 (define_mode_macro SDI [SI DI])
140 ; The size of a pointer. Also, the size of the value that a record-condition
141 ; (one with a '.') will compare.
142 (define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
144 ; Any hardware-supported floating-point mode
145 (define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
146 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
147 (TF "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
148 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128")])
150 ; Various instructions that come in SI and DI forms.
151 ; A generic w/d attribute, for things like cmpw/cmpd.
152 (define_mode_attr wd [(SI "w") (DI "d")])
155 ;; Start with fixed-point load and store insns. Here we put only the more
156 ;; complex forms. Basic data transfer is done later.
158 (define_expand "zero_extendqidi2"
159 [(set (match_operand:DI 0 "gpc_reg_operand" "")
160 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
165 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
166 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
171 [(set_attr "type" "load,*")])
174 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
175 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
177 (clobber (match_scratch:DI 2 "=r,r"))]
182 [(set_attr "type" "compare")
183 (set_attr "length" "4,8")])
186 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
187 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
189 (clobber (match_scratch:DI 2 ""))]
190 "TARGET_POWERPC64 && reload_completed"
192 (zero_extend:DI (match_dup 1)))
194 (compare:CC (match_dup 2)
199 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
200 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
202 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
203 (zero_extend:DI (match_dup 1)))]
208 [(set_attr "type" "compare")
209 (set_attr "length" "4,8")])
212 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
213 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
215 (set (match_operand:DI 0 "gpc_reg_operand" "")
216 (zero_extend:DI (match_dup 1)))]
217 "TARGET_POWERPC64 && reload_completed"
219 (zero_extend:DI (match_dup 1)))
221 (compare:CC (match_dup 0)
225 (define_insn "extendqidi2"
226 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
227 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
232 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
233 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
235 (clobber (match_scratch:DI 2 "=r,r"))]
240 [(set_attr "type" "compare")
241 (set_attr "length" "4,8")])
244 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
245 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
247 (clobber (match_scratch:DI 2 ""))]
248 "TARGET_POWERPC64 && reload_completed"
250 (sign_extend:DI (match_dup 1)))
252 (compare:CC (match_dup 2)
257 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
258 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
260 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
261 (sign_extend:DI (match_dup 1)))]
266 [(set_attr "type" "compare")
267 (set_attr "length" "4,8")])
270 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
271 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
273 (set (match_operand:DI 0 "gpc_reg_operand" "")
274 (sign_extend:DI (match_dup 1)))]
275 "TARGET_POWERPC64 && reload_completed"
277 (sign_extend:DI (match_dup 1)))
279 (compare:CC (match_dup 0)
283 (define_expand "zero_extendhidi2"
284 [(set (match_operand:DI 0 "gpc_reg_operand" "")
285 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
290 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
291 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
296 [(set_attr "type" "load,*")])
299 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
300 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
302 (clobber (match_scratch:DI 2 "=r,r"))]
307 [(set_attr "type" "compare")
308 (set_attr "length" "4,8")])
311 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
312 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
314 (clobber (match_scratch:DI 2 ""))]
315 "TARGET_POWERPC64 && reload_completed"
317 (zero_extend:DI (match_dup 1)))
319 (compare:CC (match_dup 2)
324 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
325 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
327 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
328 (zero_extend:DI (match_dup 1)))]
333 [(set_attr "type" "compare")
334 (set_attr "length" "4,8")])
337 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
338 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
340 (set (match_operand:DI 0 "gpc_reg_operand" "")
341 (zero_extend:DI (match_dup 1)))]
342 "TARGET_POWERPC64 && reload_completed"
344 (zero_extend:DI (match_dup 1)))
346 (compare:CC (match_dup 0)
350 (define_expand "extendhidi2"
351 [(set (match_operand:DI 0 "gpc_reg_operand" "")
352 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
357 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
358 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
363 [(set_attr "type" "load_ext,*")])
366 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
367 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
369 (clobber (match_scratch:DI 2 "=r,r"))]
374 [(set_attr "type" "compare")
375 (set_attr "length" "4,8")])
378 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
379 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
381 (clobber (match_scratch:DI 2 ""))]
382 "TARGET_POWERPC64 && reload_completed"
384 (sign_extend:DI (match_dup 1)))
386 (compare:CC (match_dup 2)
391 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
392 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
394 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
395 (sign_extend:DI (match_dup 1)))]
400 [(set_attr "type" "compare")
401 (set_attr "length" "4,8")])
404 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
405 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
407 (set (match_operand:DI 0 "gpc_reg_operand" "")
408 (sign_extend:DI (match_dup 1)))]
409 "TARGET_POWERPC64 && reload_completed"
411 (sign_extend:DI (match_dup 1)))
413 (compare:CC (match_dup 0)
417 (define_expand "zero_extendsidi2"
418 [(set (match_operand:DI 0 "gpc_reg_operand" "")
419 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
424 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
425 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
430 [(set_attr "type" "load,*")])
433 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
434 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
436 (clobber (match_scratch:DI 2 "=r,r"))]
441 [(set_attr "type" "compare")
442 (set_attr "length" "4,8")])
445 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
446 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
448 (clobber (match_scratch:DI 2 ""))]
449 "TARGET_POWERPC64 && reload_completed"
451 (zero_extend:DI (match_dup 1)))
453 (compare:CC (match_dup 2)
458 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
459 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
461 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
462 (zero_extend:DI (match_dup 1)))]
467 [(set_attr "type" "compare")
468 (set_attr "length" "4,8")])
471 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
472 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
474 (set (match_operand:DI 0 "gpc_reg_operand" "")
475 (zero_extend:DI (match_dup 1)))]
476 "TARGET_POWERPC64 && reload_completed"
478 (zero_extend:DI (match_dup 1)))
480 (compare:CC (match_dup 0)
484 (define_expand "extendsidi2"
485 [(set (match_operand:DI 0 "gpc_reg_operand" "")
486 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
491 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
492 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
497 [(set_attr "type" "load_ext,*")])
500 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
501 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
503 (clobber (match_scratch:DI 2 "=r,r"))]
508 [(set_attr "type" "compare")
509 (set_attr "length" "4,8")])
512 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
513 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
515 (clobber (match_scratch:DI 2 ""))]
516 "TARGET_POWERPC64 && reload_completed"
518 (sign_extend:DI (match_dup 1)))
520 (compare:CC (match_dup 2)
525 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
526 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
528 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
529 (sign_extend:DI (match_dup 1)))]
534 [(set_attr "type" "compare")
535 (set_attr "length" "4,8")])
538 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
539 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
541 (set (match_operand:DI 0 "gpc_reg_operand" "")
542 (sign_extend:DI (match_dup 1)))]
543 "TARGET_POWERPC64 && reload_completed"
545 (sign_extend:DI (match_dup 1)))
547 (compare:CC (match_dup 0)
551 (define_expand "zero_extendqisi2"
552 [(set (match_operand:SI 0 "gpc_reg_operand" "")
553 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
558 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
559 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
563 {rlinm|rlwinm} %0,%1,0,0xff"
564 [(set_attr "type" "load,*")])
567 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
568 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
570 (clobber (match_scratch:SI 2 "=r,r"))]
573 {andil.|andi.} %2,%1,0xff
575 [(set_attr "type" "compare")
576 (set_attr "length" "4,8")])
579 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
580 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
582 (clobber (match_scratch:SI 2 ""))]
585 (zero_extend:SI (match_dup 1)))
587 (compare:CC (match_dup 2)
592 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
593 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
595 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
596 (zero_extend:SI (match_dup 1)))]
599 {andil.|andi.} %0,%1,0xff
601 [(set_attr "type" "compare")
602 (set_attr "length" "4,8")])
605 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
606 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
608 (set (match_operand:SI 0 "gpc_reg_operand" "")
609 (zero_extend:SI (match_dup 1)))]
612 (zero_extend:SI (match_dup 1)))
614 (compare:CC (match_dup 0)
618 (define_expand "extendqisi2"
619 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
620 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
625 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
626 else if (TARGET_POWER)
627 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
629 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
633 (define_insn "extendqisi2_ppc"
634 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
635 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
640 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
641 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
643 (clobber (match_scratch:SI 2 "=r,r"))]
648 [(set_attr "type" "compare")
649 (set_attr "length" "4,8")])
652 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
653 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
655 (clobber (match_scratch:SI 2 ""))]
656 "TARGET_POWERPC && reload_completed"
658 (sign_extend:SI (match_dup 1)))
660 (compare:CC (match_dup 2)
665 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
666 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
668 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
669 (sign_extend:SI (match_dup 1)))]
674 [(set_attr "type" "compare")
675 (set_attr "length" "4,8")])
678 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
679 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
681 (set (match_operand:SI 0 "gpc_reg_operand" "")
682 (sign_extend:SI (match_dup 1)))]
683 "TARGET_POWERPC && reload_completed"
685 (sign_extend:SI (match_dup 1)))
687 (compare:CC (match_dup 0)
691 (define_expand "extendqisi2_power"
692 [(parallel [(set (match_dup 2)
693 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
695 (clobber (scratch:SI))])
696 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
697 (ashiftrt:SI (match_dup 2)
699 (clobber (scratch:SI))])]
702 { operands[1] = gen_lowpart (SImode, operands[1]);
703 operands[2] = gen_reg_rtx (SImode); }")
705 (define_expand "extendqisi2_no_power"
707 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
709 (set (match_operand:SI 0 "gpc_reg_operand" "")
710 (ashiftrt:SI (match_dup 2)
712 "! TARGET_POWER && ! TARGET_POWERPC"
714 { operands[1] = gen_lowpart (SImode, operands[1]);
715 operands[2] = gen_reg_rtx (SImode); }")
717 (define_expand "zero_extendqihi2"
718 [(set (match_operand:HI 0 "gpc_reg_operand" "")
719 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
724 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
725 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
729 {rlinm|rlwinm} %0,%1,0,0xff"
730 [(set_attr "type" "load,*")])
733 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
734 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
736 (clobber (match_scratch:HI 2 "=r,r"))]
739 {andil.|andi.} %2,%1,0xff
741 [(set_attr "type" "compare")
742 (set_attr "length" "4,8")])
745 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
746 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
748 (clobber (match_scratch:HI 2 ""))]
751 (zero_extend:HI (match_dup 1)))
753 (compare:CC (match_dup 2)
758 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
759 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
761 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
762 (zero_extend:HI (match_dup 1)))]
765 {andil.|andi.} %0,%1,0xff
767 [(set_attr "type" "compare")
768 (set_attr "length" "4,8")])
771 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
772 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
774 (set (match_operand:HI 0 "gpc_reg_operand" "")
775 (zero_extend:HI (match_dup 1)))]
778 (zero_extend:HI (match_dup 1)))
780 (compare:CC (match_dup 0)
784 (define_expand "extendqihi2"
785 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
786 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
791 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
792 else if (TARGET_POWER)
793 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
795 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
799 (define_insn "extendqihi2_ppc"
800 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
801 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
806 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
807 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
809 (clobber (match_scratch:HI 2 "=r,r"))]
814 [(set_attr "type" "compare")
815 (set_attr "length" "4,8")])
818 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
819 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
821 (clobber (match_scratch:HI 2 ""))]
822 "TARGET_POWERPC && reload_completed"
824 (sign_extend:HI (match_dup 1)))
826 (compare:CC (match_dup 2)
831 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
832 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
834 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
835 (sign_extend:HI (match_dup 1)))]
840 [(set_attr "type" "compare")
841 (set_attr "length" "4,8")])
844 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
845 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
847 (set (match_operand:HI 0 "gpc_reg_operand" "")
848 (sign_extend:HI (match_dup 1)))]
849 "TARGET_POWERPC && reload_completed"
851 (sign_extend:HI (match_dup 1)))
853 (compare:CC (match_dup 0)
857 (define_expand "extendqihi2_power"
858 [(parallel [(set (match_dup 2)
859 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
861 (clobber (scratch:SI))])
862 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
863 (ashiftrt:SI (match_dup 2)
865 (clobber (scratch:SI))])]
868 { operands[0] = gen_lowpart (SImode, operands[0]);
869 operands[1] = gen_lowpart (SImode, operands[1]);
870 operands[2] = gen_reg_rtx (SImode); }")
872 (define_expand "extendqihi2_no_power"
874 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
876 (set (match_operand:HI 0 "gpc_reg_operand" "")
877 (ashiftrt:SI (match_dup 2)
879 "! TARGET_POWER && ! TARGET_POWERPC"
881 { operands[0] = gen_lowpart (SImode, operands[0]);
882 operands[1] = gen_lowpart (SImode, operands[1]);
883 operands[2] = gen_reg_rtx (SImode); }")
885 (define_expand "zero_extendhisi2"
886 [(set (match_operand:SI 0 "gpc_reg_operand" "")
887 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
892 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
893 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
897 {rlinm|rlwinm} %0,%1,0,0xffff"
898 [(set_attr "type" "load,*")])
901 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
902 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
904 (clobber (match_scratch:SI 2 "=r,r"))]
907 {andil.|andi.} %2,%1,0xffff
909 [(set_attr "type" "compare")
910 (set_attr "length" "4,8")])
913 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
914 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
916 (clobber (match_scratch:SI 2 ""))]
919 (zero_extend:SI (match_dup 1)))
921 (compare:CC (match_dup 2)
926 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
927 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
929 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
930 (zero_extend:SI (match_dup 1)))]
933 {andil.|andi.} %0,%1,0xffff
935 [(set_attr "type" "compare")
936 (set_attr "length" "4,8")])
939 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
940 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
942 (set (match_operand:SI 0 "gpc_reg_operand" "")
943 (zero_extend:SI (match_dup 1)))]
946 (zero_extend:SI (match_dup 1)))
948 (compare:CC (match_dup 0)
952 (define_expand "extendhisi2"
953 [(set (match_operand:SI 0 "gpc_reg_operand" "")
954 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
959 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
960 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
965 [(set_attr "type" "load_ext,*")])
968 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
969 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
971 (clobber (match_scratch:SI 2 "=r,r"))]
976 [(set_attr "type" "compare")
977 (set_attr "length" "4,8")])
980 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
981 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
983 (clobber (match_scratch:SI 2 ""))]
986 (sign_extend:SI (match_dup 1)))
988 (compare:CC (match_dup 2)
993 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
994 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
996 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
997 (sign_extend:SI (match_dup 1)))]
1000 {exts.|extsh.} %0,%1
1002 [(set_attr "type" "compare")
1003 (set_attr "length" "4,8")])
1006 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1007 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1009 (set (match_operand:SI 0 "gpc_reg_operand" "")
1010 (sign_extend:SI (match_dup 1)))]
1013 (sign_extend:SI (match_dup 1)))
1015 (compare:CC (match_dup 0)
1019 ;; Fixed-point arithmetic insns.
1021 (define_expand "add<mode>3"
1022 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1023 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1024 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1028 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1030 if (non_short_cint_operand (operands[2], DImode))
1033 else if (GET_CODE (operands[2]) == CONST_INT
1034 && ! add_operand (operands[2], <MODE>mode))
1036 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1037 ? operands[0] : gen_reg_rtx (<MODE>mode));
1039 HOST_WIDE_INT val = INTVAL (operands[2]);
1040 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1041 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1043 if (<MODE>mode == DImode && !CONST_OK_FOR_LETTER_P (rest, 'L'))
1046 /* The ordering here is important for the prolog expander.
1047 When space is allocated from the stack, adding 'low' first may
1048 produce a temporary deallocation (which would be bad). */
1049 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1050 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1055 ;; Discourage ai/addic because of carry but provide it in an alternative
1056 ;; allowing register zero as source.
1057 (define_insn "*add<mode>3_internal1"
1058 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1059 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1060 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1064 {cal %0,%2(%1)|addi %0,%1,%2}
1066 {cau|addis} %0,%1,%v2"
1067 [(set_attr "length" "4,4,4,4")])
1069 (define_insn "addsi3_high"
1070 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1071 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1072 (high:SI (match_operand 2 "" ""))))]
1073 "TARGET_MACHO && !TARGET_64BIT"
1074 "{cau|addis} %0,%1,ha16(%2)"
1075 [(set_attr "length" "4")])
1077 (define_insn "*add<mode>3_internal2"
1078 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1079 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1080 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1082 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1085 {cax.|add.} %3,%1,%2
1086 {ai.|addic.} %3,%1,%2
1089 [(set_attr "type" "fast_compare,compare,compare,compare")
1090 (set_attr "length" "4,4,8,8")])
1093 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1094 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1095 (match_operand:GPR 2 "reg_or_short_operand" ""))
1097 (clobber (match_scratch:GPR 3 ""))]
1100 (plus:GPR (match_dup 1)
1103 (compare:CC (match_dup 3)
1107 (define_insn "*add<mode>3_internal3"
1108 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1109 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1110 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1112 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1113 (plus:P (match_dup 1)
1117 {cax.|add.} %0,%1,%2
1118 {ai.|addic.} %0,%1,%2
1121 [(set_attr "type" "fast_compare,compare,compare,compare")
1122 (set_attr "length" "4,4,8,8")])
1125 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1126 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1127 (match_operand:P 2 "reg_or_short_operand" ""))
1129 (set (match_operand:P 0 "gpc_reg_operand" "")
1130 (plus:P (match_dup 1) (match_dup 2)))]
1133 (plus:P (match_dup 1)
1136 (compare:CC (match_dup 0)
1140 ;; Split an add that we can't do in one insn into two insns, each of which
1141 ;; does one 16-bit part. This is used by combine. Note that the low-order
1142 ;; add should be last in case the result gets used in an address.
1145 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1146 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1147 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1149 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1150 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1153 HOST_WIDE_INT val = INTVAL (operands[2]);
1154 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1155 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1157 operands[4] = GEN_INT (low);
1158 if (<MODE>mode == SImode || CONST_OK_FOR_LETTER_P (rest, 'L'))
1159 operands[3] = GEN_INT (rest);
1160 else if (! no_new_pseudos)
1162 operands[3] = gen_reg_rtx (DImode);
1163 emit_move_insn (operands[3], operands[2]);
1164 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1171 (define_insn "one_cmpl<mode>2"
1172 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1173 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1178 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1179 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1181 (clobber (match_scratch:P 2 "=r,r"))]
1186 [(set_attr "type" "compare")
1187 (set_attr "length" "4,8")])
1190 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1191 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1193 (clobber (match_scratch:P 2 ""))]
1196 (not:P (match_dup 1)))
1198 (compare:CC (match_dup 2)
1203 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1204 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1206 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1207 (not:P (match_dup 1)))]
1212 [(set_attr "type" "compare")
1213 (set_attr "length" "4,8")])
1216 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1217 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1219 (set (match_operand:P 0 "gpc_reg_operand" "")
1220 (not:P (match_dup 1)))]
1223 (not:P (match_dup 1)))
1225 (compare:CC (match_dup 0)
1230 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1231 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1232 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1234 "{sf%I1|subf%I1c} %0,%2,%1")
1237 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1238 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1239 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1246 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1247 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1248 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1250 (clobber (match_scratch:SI 3 "=r,r"))]
1253 {sf.|subfc.} %3,%2,%1
1255 [(set_attr "type" "compare")
1256 (set_attr "length" "4,8")])
1259 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1260 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1261 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1263 (clobber (match_scratch:P 3 "=r,r"))]
1268 [(set_attr "type" "fast_compare")
1269 (set_attr "length" "4,8")])
1272 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1273 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1274 (match_operand:P 2 "gpc_reg_operand" ""))
1276 (clobber (match_scratch:P 3 ""))]
1279 (minus:P (match_dup 1)
1282 (compare:CC (match_dup 3)
1287 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1288 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1289 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1291 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1292 (minus:SI (match_dup 1) (match_dup 2)))]
1295 {sf.|subfc.} %0,%2,%1
1297 [(set_attr "type" "compare")
1298 (set_attr "length" "4,8")])
1301 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1302 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1303 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1305 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1306 (minus:P (match_dup 1)
1312 [(set_attr "type" "fast_compare")
1313 (set_attr "length" "4,8")])
1316 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1317 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1318 (match_operand:P 2 "gpc_reg_operand" ""))
1320 (set (match_operand:P 0 "gpc_reg_operand" "")
1321 (minus:P (match_dup 1)
1325 (minus:P (match_dup 1)
1328 (compare:CC (match_dup 0)
1332 (define_expand "sub<mode>3"
1333 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1334 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1335 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1339 if (GET_CODE (operands[2]) == CONST_INT)
1341 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1342 negate_rtx (<MODE>mode, operands[2])));
1347 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1348 ;; instruction and some auxiliary computations. Then we just have a single
1349 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1352 (define_expand "sminsi3"
1354 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1355 (match_operand:SI 2 "reg_or_short_operand" ""))
1357 (minus:SI (match_dup 2) (match_dup 1))))
1358 (set (match_operand:SI 0 "gpc_reg_operand" "")
1359 (minus:SI (match_dup 2) (match_dup 3)))]
1360 "TARGET_POWER || TARGET_ISEL"
1365 operands[2] = force_reg (SImode, operands[2]);
1366 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1370 operands[3] = gen_reg_rtx (SImode);
1374 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1375 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1376 (match_operand:SI 2 "reg_or_short_operand" "")))
1377 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1380 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1382 (minus:SI (match_dup 2) (match_dup 1))))
1383 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1386 (define_expand "smaxsi3"
1388 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1389 (match_operand:SI 2 "reg_or_short_operand" ""))
1391 (minus:SI (match_dup 2) (match_dup 1))))
1392 (set (match_operand:SI 0 "gpc_reg_operand" "")
1393 (plus:SI (match_dup 3) (match_dup 1)))]
1394 "TARGET_POWER || TARGET_ISEL"
1399 operands[2] = force_reg (SImode, operands[2]);
1400 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1403 operands[3] = gen_reg_rtx (SImode);
1407 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1408 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1409 (match_operand:SI 2 "reg_or_short_operand" "")))
1410 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1413 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1415 (minus:SI (match_dup 2) (match_dup 1))))
1416 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1419 (define_expand "uminsi3"
1420 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1422 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1424 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1426 (minus:SI (match_dup 4) (match_dup 3))))
1427 (set (match_operand:SI 0 "gpc_reg_operand" "")
1428 (minus:SI (match_dup 2) (match_dup 3)))]
1429 "TARGET_POWER || TARGET_ISEL"
1434 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1437 operands[3] = gen_reg_rtx (SImode);
1438 operands[4] = gen_reg_rtx (SImode);
1439 operands[5] = GEN_INT (-2147483647 - 1);
1442 (define_expand "umaxsi3"
1443 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1445 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1447 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1449 (minus:SI (match_dup 4) (match_dup 3))))
1450 (set (match_operand:SI 0 "gpc_reg_operand" "")
1451 (plus:SI (match_dup 3) (match_dup 1)))]
1452 "TARGET_POWER || TARGET_ISEL"
1457 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1460 operands[3] = gen_reg_rtx (SImode);
1461 operands[4] = gen_reg_rtx (SImode);
1462 operands[5] = GEN_INT (-2147483647 - 1);
1466 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1467 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1468 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1470 (minus:SI (match_dup 2) (match_dup 1))))]
1475 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1477 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1478 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1480 (minus:SI (match_dup 2) (match_dup 1)))
1482 (clobber (match_scratch:SI 3 "=r,r"))]
1487 [(set_attr "type" "delayed_compare")
1488 (set_attr "length" "4,8")])
1491 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1493 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1494 (match_operand:SI 2 "reg_or_short_operand" ""))
1496 (minus:SI (match_dup 2) (match_dup 1)))
1498 (clobber (match_scratch:SI 3 ""))]
1499 "TARGET_POWER && reload_completed"
1501 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1503 (minus:SI (match_dup 2) (match_dup 1))))
1505 (compare:CC (match_dup 3)
1510 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1512 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1513 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1515 (minus:SI (match_dup 2) (match_dup 1)))
1517 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1518 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1520 (minus:SI (match_dup 2) (match_dup 1))))]
1525 [(set_attr "type" "delayed_compare")
1526 (set_attr "length" "4,8")])
1529 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1531 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1532 (match_operand:SI 2 "reg_or_short_operand" ""))
1534 (minus:SI (match_dup 2) (match_dup 1)))
1536 (set (match_operand:SI 0 "gpc_reg_operand" "")
1537 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1539 (minus:SI (match_dup 2) (match_dup 1))))]
1540 "TARGET_POWER && reload_completed"
1542 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1544 (minus:SI (match_dup 2) (match_dup 1))))
1546 (compare:CC (match_dup 0)
1550 ;; We don't need abs with condition code because such comparisons should
1552 (define_expand "abssi2"
1553 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1554 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1560 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1563 else if (! TARGET_POWER)
1565 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1570 (define_insn "*abssi2_power"
1571 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1572 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1576 (define_insn_and_split "abssi2_isel"
1577 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1578 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1579 (clobber (match_scratch:SI 2 "=&b"))
1580 (clobber (match_scratch:CC 3 "=y"))]
1583 "&& reload_completed"
1584 [(set (match_dup 2) (neg:SI (match_dup 1)))
1586 (compare:CC (match_dup 1)
1589 (if_then_else:SI (ge (match_dup 3)
1595 (define_insn_and_split "abssi2_nopower"
1596 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1597 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1598 (clobber (match_scratch:SI 2 "=&r,&r"))]
1599 "! TARGET_POWER && ! TARGET_ISEL"
1601 "&& reload_completed"
1602 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1603 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1604 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1607 (define_insn "*nabs_power"
1608 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1609 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1613 (define_insn_and_split "*nabs_nopower"
1614 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1615 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1616 (clobber (match_scratch:SI 2 "=&r,&r"))]
1619 "&& reload_completed"
1620 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1621 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1622 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1625 (define_expand "neg<mode>2"
1626 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1627 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1631 (define_insn "*neg<mode>2_internal"
1632 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1633 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1638 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1639 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1641 (clobber (match_scratch:P 2 "=r,r"))]
1646 [(set_attr "type" "fast_compare")
1647 (set_attr "length" "4,8")])
1650 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1651 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1653 (clobber (match_scratch:P 2 ""))]
1656 (neg:P (match_dup 1)))
1658 (compare:CC (match_dup 2)
1663 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1664 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1666 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1667 (neg:P (match_dup 1)))]
1672 [(set_attr "type" "fast_compare")
1673 (set_attr "length" "4,8")])
1676 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1677 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1679 (set (match_operand:P 0 "gpc_reg_operand" "")
1680 (neg:P (match_dup 1)))]
1683 (neg:P (match_dup 1)))
1685 (compare:CC (match_dup 0)
1689 (define_insn "clz<mode>2"
1690 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1691 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1693 "{cntlz|cntlz<wd>} %0,%1")
1695 (define_expand "ctz<mode>2"
1697 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
1698 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1700 (clobber (scratch:CC))])
1701 (set (match_dup 4) (clz:GPR (match_dup 3)))
1702 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1703 (minus:GPR (match_dup 5) (match_dup 4)))]
1706 operands[2] = gen_reg_rtx (<MODE>mode);
1707 operands[3] = gen_reg_rtx (<MODE>mode);
1708 operands[4] = gen_reg_rtx (<MODE>mode);
1709 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
1712 (define_expand "ffs<mode>2"
1714 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
1715 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1717 (clobber (scratch:CC))])
1718 (set (match_dup 4) (clz:GPR (match_dup 3)))
1719 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1720 (minus:GPR (match_dup 5) (match_dup 4)))]
1723 operands[2] = gen_reg_rtx (<MODE>mode);
1724 operands[3] = gen_reg_rtx (<MODE>mode);
1725 operands[4] = gen_reg_rtx (<MODE>mode);
1726 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
1729 (define_expand "popcount<mode>2"
1731 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
1734 (mult:GPR (match_dup 2) (match_dup 4)))
1735 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1736 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
1739 operands[2] = gen_reg_rtx (<MODE>mode);
1740 operands[3] = gen_reg_rtx (<MODE>mode);
1741 operands[4] = force_reg (<MODE>mode,
1742 <MODE>mode == SImode
1743 ? GEN_INT (0x01010101)
1744 : GEN_INT ((HOST_WIDE_INT)
1745 0x01010101 << 32 | 0x01010101));
1746 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 8);
1749 (define_insn "popcntb<mode>2"
1750 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1751 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
1756 (define_expand "mulsi3"
1757 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1758 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1759 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1764 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1766 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1770 (define_insn "mulsi3_mq"
1771 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1772 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1773 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1774 (clobber (match_scratch:SI 3 "=q,q"))]
1777 {muls|mullw} %0,%1,%2
1778 {muli|mulli} %0,%1,%2"
1780 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1781 (const_string "imul3")
1782 (match_operand:SI 2 "short_cint_operand" "")
1783 (const_string "imul2")]
1784 (const_string "imul")))])
1786 (define_insn "mulsi3_no_mq"
1787 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1788 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1789 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1792 {muls|mullw} %0,%1,%2
1793 {muli|mulli} %0,%1,%2"
1795 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1796 (const_string "imul3")
1797 (match_operand:SI 2 "short_cint_operand" "")
1798 (const_string "imul2")]
1799 (const_string "imul")))])
1801 (define_insn "*mulsi3_mq_internal1"
1802 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1803 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1804 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1806 (clobber (match_scratch:SI 3 "=r,r"))
1807 (clobber (match_scratch:SI 4 "=q,q"))]
1810 {muls.|mullw.} %3,%1,%2
1812 [(set_attr "type" "imul_compare")
1813 (set_attr "length" "4,8")])
1816 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1817 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1818 (match_operand:SI 2 "gpc_reg_operand" ""))
1820 (clobber (match_scratch:SI 3 ""))
1821 (clobber (match_scratch:SI 4 ""))]
1822 "TARGET_POWER && reload_completed"
1823 [(parallel [(set (match_dup 3)
1824 (mult:SI (match_dup 1) (match_dup 2)))
1825 (clobber (match_dup 4))])
1827 (compare:CC (match_dup 3)
1831 (define_insn "*mulsi3_no_mq_internal1"
1832 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1833 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1834 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1836 (clobber (match_scratch:SI 3 "=r,r"))]
1839 {muls.|mullw.} %3,%1,%2
1841 [(set_attr "type" "imul_compare")
1842 (set_attr "length" "4,8")])
1845 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1846 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1847 (match_operand:SI 2 "gpc_reg_operand" ""))
1849 (clobber (match_scratch:SI 3 ""))]
1850 "! TARGET_POWER && reload_completed"
1852 (mult:SI (match_dup 1) (match_dup 2)))
1854 (compare:CC (match_dup 3)
1858 (define_insn "*mulsi3_mq_internal2"
1859 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1860 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1861 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1863 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1864 (mult:SI (match_dup 1) (match_dup 2)))
1865 (clobber (match_scratch:SI 4 "=q,q"))]
1868 {muls.|mullw.} %0,%1,%2
1870 [(set_attr "type" "imul_compare")
1871 (set_attr "length" "4,8")])
1874 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1875 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1876 (match_operand:SI 2 "gpc_reg_operand" ""))
1878 (set (match_operand:SI 0 "gpc_reg_operand" "")
1879 (mult:SI (match_dup 1) (match_dup 2)))
1880 (clobber (match_scratch:SI 4 ""))]
1881 "TARGET_POWER && reload_completed"
1882 [(parallel [(set (match_dup 0)
1883 (mult:SI (match_dup 1) (match_dup 2)))
1884 (clobber (match_dup 4))])
1886 (compare:CC (match_dup 0)
1890 (define_insn "*mulsi3_no_mq_internal2"
1891 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1892 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1893 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1895 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1896 (mult:SI (match_dup 1) (match_dup 2)))]
1899 {muls.|mullw.} %0,%1,%2
1901 [(set_attr "type" "imul_compare")
1902 (set_attr "length" "4,8")])
1905 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1906 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1907 (match_operand:SI 2 "gpc_reg_operand" ""))
1909 (set (match_operand:SI 0 "gpc_reg_operand" "")
1910 (mult:SI (match_dup 1) (match_dup 2)))]
1911 "! TARGET_POWER && reload_completed"
1913 (mult:SI (match_dup 1) (match_dup 2)))
1915 (compare:CC (match_dup 0)
1919 ;; Operand 1 is divided by operand 2; quotient goes to operand
1920 ;; 0 and remainder to operand 3.
1921 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1923 (define_expand "divmodsi4"
1924 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1925 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1926 (match_operand:SI 2 "gpc_reg_operand" "")))
1927 (set (match_operand:SI 3 "register_operand" "")
1928 (mod:SI (match_dup 1) (match_dup 2)))])]
1929 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1932 if (! TARGET_POWER && ! TARGET_POWERPC)
1934 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1935 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1936 emit_insn (gen_divss_call ());
1937 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1938 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1943 (define_insn "*divmodsi4_internal"
1944 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1945 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1946 (match_operand:SI 2 "gpc_reg_operand" "r")))
1947 (set (match_operand:SI 3 "register_operand" "=q")
1948 (mod:SI (match_dup 1) (match_dup 2)))]
1951 [(set_attr "type" "idiv")])
1953 (define_expand "udiv<mode>3"
1954 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1955 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1956 (match_operand:GPR 2 "gpc_reg_operand" "")))]
1957 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1960 if (! TARGET_POWER && ! TARGET_POWERPC)
1962 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1963 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1964 emit_insn (gen_quous_call ());
1965 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1968 else if (TARGET_POWER)
1970 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1975 (define_insn "udivsi3_mq"
1976 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1977 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1978 (match_operand:SI 2 "gpc_reg_operand" "r")))
1979 (clobber (match_scratch:SI 3 "=q"))]
1980 "TARGET_POWERPC && TARGET_POWER"
1982 [(set_attr "type" "idiv")])
1984 (define_insn "*udivsi3_no_mq"
1985 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1986 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
1987 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
1988 "TARGET_POWERPC && ! TARGET_POWER"
1990 [(set_attr "type" "idiv")])
1992 ;; For powers of two we can do srai/aze for divide and then adjust for
1993 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1994 ;; used; for PowerPC, force operands into register and do a normal divide;
1995 ;; for AIX common-mode, use quoss call on register operands.
1996 (define_expand "div<mode>3"
1997 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1998 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1999 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
2003 if (GET_CODE (operands[2]) == CONST_INT
2004 && INTVAL (operands[2]) > 0
2005 && exact_log2 (INTVAL (operands[2])) >= 0)
2007 else if (TARGET_POWERPC)
2009 operands[2] = force_reg (SImode, operands[2]);
2012 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2016 else if (TARGET_POWER)
2020 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2021 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2022 emit_insn (gen_quoss_call ());
2023 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2028 (define_insn "divsi3_mq"
2029 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2030 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2031 (match_operand:SI 2 "gpc_reg_operand" "r")))
2032 (clobber (match_scratch:SI 3 "=q"))]
2033 "TARGET_POWERPC && TARGET_POWER"
2035 [(set_attr "type" "idiv")])
2037 (define_insn "*div<mode>3_no_mq"
2038 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2039 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2040 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2041 "TARGET_POWERPC && ! TARGET_POWER"
2043 [(set_attr "type" "idiv")])
2045 (define_expand "mod<mode>3"
2046 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2047 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2048 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2056 if (GET_CODE (operands[2]) != CONST_INT
2057 || INTVAL (operands[2]) <= 0
2058 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2061 temp1 = gen_reg_rtx (<MODE>mode);
2062 temp2 = gen_reg_rtx (<MODE>mode);
2064 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2065 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2066 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2071 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2072 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2073 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2075 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2076 [(set_attr "type" "two")
2077 (set_attr "length" "8")])
2080 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2081 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2082 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2084 (clobber (match_scratch:P 3 "=r,r"))]
2087 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2089 [(set_attr "type" "compare")
2090 (set_attr "length" "8,12")])
2093 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2094 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2095 (match_operand:GPR 2 "exact_log2_cint_operand"
2098 (clobber (match_scratch:GPR 3 ""))]
2101 (div:<MODE> (match_dup 1) (match_dup 2)))
2103 (compare:CC (match_dup 3)
2108 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2109 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2110 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2112 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2113 (div:P (match_dup 1) (match_dup 2)))]
2116 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2118 [(set_attr "type" "compare")
2119 (set_attr "length" "8,12")])
2122 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2123 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2124 (match_operand:GPR 2 "exact_log2_cint_operand"
2127 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2128 (div:GPR (match_dup 1) (match_dup 2)))]
2131 (div:<MODE> (match_dup 1) (match_dup 2)))
2133 (compare:CC (match_dup 0)
2138 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2141 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2143 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2144 (match_operand:SI 3 "gpc_reg_operand" "r")))
2145 (set (match_operand:SI 2 "register_operand" "=*q")
2148 (zero_extend:DI (match_dup 1)) (const_int 32))
2149 (zero_extend:DI (match_dup 4)))
2153 [(set_attr "type" "idiv")])
2155 ;; To do unsigned divide we handle the cases of the divisor looking like a
2156 ;; negative number. If it is a constant that is less than 2**31, we don't
2157 ;; have to worry about the branches. So make a few subroutines here.
2159 ;; First comes the normal case.
2160 (define_expand "udivmodsi4_normal"
2161 [(set (match_dup 4) (const_int 0))
2162 (parallel [(set (match_operand:SI 0 "" "")
2163 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2165 (zero_extend:DI (match_operand:SI 1 "" "")))
2166 (match_operand:SI 2 "" "")))
2167 (set (match_operand:SI 3 "" "")
2168 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2170 (zero_extend:DI (match_dup 1)))
2174 { operands[4] = gen_reg_rtx (SImode); }")
2176 ;; This handles the branches.
2177 (define_expand "udivmodsi4_tests"
2178 [(set (match_operand:SI 0 "" "") (const_int 0))
2179 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2180 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2181 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2182 (label_ref (match_operand:SI 4 "" "")) (pc)))
2183 (set (match_dup 0) (const_int 1))
2184 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2185 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2186 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2187 (label_ref (match_dup 4)) (pc)))]
2190 { operands[5] = gen_reg_rtx (CCUNSmode);
2191 operands[6] = gen_reg_rtx (CCmode);
2194 (define_expand "udivmodsi4"
2195 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2196 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2197 (match_operand:SI 2 "reg_or_cint_operand" "")))
2198 (set (match_operand:SI 3 "gpc_reg_operand" "")
2199 (umod:SI (match_dup 1) (match_dup 2)))])]
2207 if (! TARGET_POWERPC)
2209 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2210 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2211 emit_insn (gen_divus_call ());
2212 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2213 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2220 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2222 operands[2] = force_reg (SImode, operands[2]);
2223 label = gen_label_rtx ();
2224 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2225 operands[3], label));
2228 operands[2] = force_reg (SImode, operands[2]);
2230 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2238 ;; AIX architecture-independent common-mode multiply (DImode),
2239 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2240 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2241 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2242 ;; assumed unused if generating common-mode, so ignore.
2243 (define_insn "mulh_call"
2246 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2247 (sign_extend:DI (reg:SI 4)))
2249 (clobber (match_scratch:SI 0 "=l"))]
2250 "! TARGET_POWER && ! TARGET_POWERPC"
2252 [(set_attr "type" "imul")])
2254 (define_insn "mull_call"
2256 (mult:DI (sign_extend:DI (reg:SI 3))
2257 (sign_extend:DI (reg:SI 4))))
2258 (clobber (match_scratch:SI 0 "=l"))
2259 (clobber (reg:SI 0))]
2260 "! TARGET_POWER && ! TARGET_POWERPC"
2262 [(set_attr "type" "imul")])
2264 (define_insn "divss_call"
2266 (div:SI (reg:SI 3) (reg:SI 4)))
2268 (mod:SI (reg:SI 3) (reg:SI 4)))
2269 (clobber (match_scratch:SI 0 "=l"))
2270 (clobber (reg:SI 0))]
2271 "! TARGET_POWER && ! TARGET_POWERPC"
2273 [(set_attr "type" "idiv")])
2275 (define_insn "divus_call"
2277 (udiv:SI (reg:SI 3) (reg:SI 4)))
2279 (umod:SI (reg:SI 3) (reg:SI 4)))
2280 (clobber (match_scratch:SI 0 "=l"))
2281 (clobber (reg:SI 0))
2282 (clobber (match_scratch:CC 1 "=x"))
2283 (clobber (reg:CC 69))]
2284 "! TARGET_POWER && ! TARGET_POWERPC"
2286 [(set_attr "type" "idiv")])
2288 (define_insn "quoss_call"
2290 (div:SI (reg:SI 3) (reg:SI 4)))
2291 (clobber (match_scratch:SI 0 "=l"))]
2292 "! TARGET_POWER && ! TARGET_POWERPC"
2294 [(set_attr "type" "idiv")])
2296 (define_insn "quous_call"
2298 (udiv:SI (reg:SI 3) (reg:SI 4)))
2299 (clobber (match_scratch:SI 0 "=l"))
2300 (clobber (reg:SI 0))
2301 (clobber (match_scratch:CC 1 "=x"))
2302 (clobber (reg:CC 69))]
2303 "! TARGET_POWER && ! TARGET_POWERPC"
2305 [(set_attr "type" "idiv")])
2307 ;; Logical instructions
2308 ;; The logical instructions are mostly combined by using match_operator,
2309 ;; but the plain AND insns are somewhat different because there is no
2310 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2311 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2313 (define_insn "andsi3"
2314 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2315 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2316 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2317 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2321 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2322 {andil.|andi.} %0,%1,%b2
2323 {andiu.|andis.} %0,%1,%u2"
2324 [(set_attr "type" "*,*,compare,compare")])
2326 ;; Note to set cr's other than cr0 we do the and immediate and then
2327 ;; the test again -- this avoids a mfcr which on the higher end
2328 ;; machines causes an execution serialization
2330 (define_insn "*andsi3_internal2"
2331 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2332 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2333 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2335 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2336 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2340 {andil.|andi.} %3,%1,%b2
2341 {andiu.|andis.} %3,%1,%u2
2342 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2347 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2348 (set_attr "length" "4,4,4,4,8,8,8,8")])
2350 (define_insn "*andsi3_internal3"
2351 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2352 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2353 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2355 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2356 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2360 {andil.|andi.} %3,%1,%b2
2361 {andiu.|andis.} %3,%1,%u2
2362 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2367 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2368 (set_attr "length" "8,4,4,4,8,8,8,8")])
2371 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2372 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2373 (match_operand:GPR 2 "and_operand" ""))
2375 (clobber (match_scratch:GPR 3 ""))
2376 (clobber (match_scratch:CC 4 ""))]
2378 [(parallel [(set (match_dup 3)
2379 (and:<MODE> (match_dup 1)
2381 (clobber (match_dup 4))])
2383 (compare:CC (match_dup 3)
2387 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2388 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2391 [(set (match_operand:CC 0 "cc_reg_operand" "")
2392 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2393 (match_operand:SI 2 "gpc_reg_operand" ""))
2395 (clobber (match_scratch:SI 3 ""))
2396 (clobber (match_scratch:CC 4 ""))]
2397 "TARGET_POWERPC64 && reload_completed"
2398 [(parallel [(set (match_dup 3)
2399 (and:SI (match_dup 1)
2401 (clobber (match_dup 4))])
2403 (compare:CC (match_dup 3)
2407 (define_insn "*andsi3_internal4"
2408 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2409 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2410 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2412 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2413 (and:SI (match_dup 1)
2415 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2419 {andil.|andi.} %0,%1,%b2
2420 {andiu.|andis.} %0,%1,%u2
2421 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2426 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2427 (set_attr "length" "4,4,4,4,8,8,8,8")])
2429 (define_insn "*andsi3_internal5"
2430 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2431 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2432 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2434 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2435 (and:SI (match_dup 1)
2437 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2441 {andil.|andi.} %0,%1,%b2
2442 {andiu.|andis.} %0,%1,%u2
2443 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2448 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2449 (set_attr "length" "8,4,4,4,8,8,8,8")])
2452 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2453 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2454 (match_operand:SI 2 "and_operand" ""))
2456 (set (match_operand:SI 0 "gpc_reg_operand" "")
2457 (and:SI (match_dup 1)
2459 (clobber (match_scratch:CC 4 ""))]
2461 [(parallel [(set (match_dup 0)
2462 (and:SI (match_dup 1)
2464 (clobber (match_dup 4))])
2466 (compare:CC (match_dup 0)
2471 [(set (match_operand:CC 3 "cc_reg_operand" "")
2472 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2473 (match_operand:SI 2 "gpc_reg_operand" ""))
2475 (set (match_operand:SI 0 "gpc_reg_operand" "")
2476 (and:SI (match_dup 1)
2478 (clobber (match_scratch:CC 4 ""))]
2479 "TARGET_POWERPC64 && reload_completed"
2480 [(parallel [(set (match_dup 0)
2481 (and:SI (match_dup 1)
2483 (clobber (match_dup 4))])
2485 (compare:CC (match_dup 0)
2489 ;; Handle the PowerPC64 rlwinm corner case
2491 (define_insn_and_split "*andsi3_internal6"
2492 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2493 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2494 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2499 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2502 (rotate:SI (match_dup 0) (match_dup 5)))]
2505 int mb = extract_MB (operands[2]);
2506 int me = extract_ME (operands[2]);
2507 operands[3] = GEN_INT (me + 1);
2508 operands[5] = GEN_INT (32 - (me + 1));
2509 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2511 [(set_attr "length" "8")])
2513 (define_expand "iorsi3"
2514 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2515 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2516 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2520 if (GET_CODE (operands[2]) == CONST_INT
2521 && ! logical_operand (operands[2], SImode))
2523 HOST_WIDE_INT value = INTVAL (operands[2]);
2524 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2525 ? operands[0] : gen_reg_rtx (SImode));
2527 emit_insn (gen_iorsi3 (tmp, operands[1],
2528 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2529 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2534 (define_expand "xorsi3"
2535 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2536 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2537 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2541 if (GET_CODE (operands[2]) == CONST_INT
2542 && ! logical_operand (operands[2], SImode))
2544 HOST_WIDE_INT value = INTVAL (operands[2]);
2545 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2546 ? operands[0] : gen_reg_rtx (SImode));
2548 emit_insn (gen_xorsi3 (tmp, operands[1],
2549 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2550 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2555 (define_insn "*boolsi3_internal1"
2556 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2557 (match_operator:SI 3 "boolean_or_operator"
2558 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2559 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2563 {%q3il|%q3i} %0,%1,%b2
2564 {%q3iu|%q3is} %0,%1,%u2")
2566 (define_insn "*boolsi3_internal2"
2567 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2568 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2569 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2570 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2572 (clobber (match_scratch:SI 3 "=r,r"))]
2577 [(set_attr "type" "compare")
2578 (set_attr "length" "4,8")])
2581 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2582 (compare:CC (match_operator:SI 4 "boolean_operator"
2583 [(match_operand:SI 1 "gpc_reg_operand" "")
2584 (match_operand:SI 2 "gpc_reg_operand" "")])
2586 (clobber (match_scratch:SI 3 ""))]
2587 "TARGET_32BIT && reload_completed"
2588 [(set (match_dup 3) (match_dup 4))
2590 (compare:CC (match_dup 3)
2594 (define_insn "*boolsi3_internal3"
2595 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2596 (compare:CC (match_operator:SI 4 "boolean_operator"
2597 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2598 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2600 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2606 [(set_attr "type" "compare")
2607 (set_attr "length" "4,8")])
2610 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2611 (compare:CC (match_operator:SI 4 "boolean_operator"
2612 [(match_operand:SI 1 "gpc_reg_operand" "")
2613 (match_operand:SI 2 "gpc_reg_operand" "")])
2615 (set (match_operand:SI 0 "gpc_reg_operand" "")
2617 "TARGET_32BIT && reload_completed"
2618 [(set (match_dup 0) (match_dup 4))
2620 (compare:CC (match_dup 0)
2624 ;; Split a logical operation that we can't do in one insn into two insns,
2625 ;; each of which does one 16-bit part. This is used by combine.
2628 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2629 (match_operator:SI 3 "boolean_or_operator"
2630 [(match_operand:SI 1 "gpc_reg_operand" "")
2631 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2633 [(set (match_dup 0) (match_dup 4))
2634 (set (match_dup 0) (match_dup 5))]
2638 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2639 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2641 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2642 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2646 (define_insn "*boolcsi3_internal1"
2647 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2648 (match_operator:SI 3 "boolean_operator"
2649 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2650 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2654 (define_insn "*boolcsi3_internal2"
2655 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2656 (compare:CC (match_operator:SI 4 "boolean_operator"
2657 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2658 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2660 (clobber (match_scratch:SI 3 "=r,r"))]
2665 [(set_attr "type" "compare")
2666 (set_attr "length" "4,8")])
2669 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2670 (compare:CC (match_operator:SI 4 "boolean_operator"
2671 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2672 (match_operand:SI 2 "gpc_reg_operand" "")])
2674 (clobber (match_scratch:SI 3 ""))]
2675 "TARGET_32BIT && reload_completed"
2676 [(set (match_dup 3) (match_dup 4))
2678 (compare:CC (match_dup 3)
2682 (define_insn "*boolcsi3_internal3"
2683 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2684 (compare:CC (match_operator:SI 4 "boolean_operator"
2685 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2686 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2688 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2694 [(set_attr "type" "compare")
2695 (set_attr "length" "4,8")])
2698 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2699 (compare:CC (match_operator:SI 4 "boolean_operator"
2700 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2701 (match_operand:SI 2 "gpc_reg_operand" "")])
2703 (set (match_operand:SI 0 "gpc_reg_operand" "")
2705 "TARGET_32BIT && reload_completed"
2706 [(set (match_dup 0) (match_dup 4))
2708 (compare:CC (match_dup 0)
2712 (define_insn "*boolccsi3_internal1"
2713 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2714 (match_operator:SI 3 "boolean_operator"
2715 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2716 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2720 (define_insn "*boolccsi3_internal2"
2721 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2722 (compare:CC (match_operator:SI 4 "boolean_operator"
2723 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2724 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2726 (clobber (match_scratch:SI 3 "=r,r"))]
2731 [(set_attr "type" "compare")
2732 (set_attr "length" "4,8")])
2735 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2736 (compare:CC (match_operator:SI 4 "boolean_operator"
2737 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2738 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2740 (clobber (match_scratch:SI 3 ""))]
2741 "TARGET_32BIT && reload_completed"
2742 [(set (match_dup 3) (match_dup 4))
2744 (compare:CC (match_dup 3)
2748 (define_insn "*boolccsi3_internal3"
2749 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2750 (compare:CC (match_operator:SI 4 "boolean_operator"
2751 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2752 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2754 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2760 [(set_attr "type" "compare")
2761 (set_attr "length" "4,8")])
2764 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2765 (compare:CC (match_operator:SI 4 "boolean_operator"
2766 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2767 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2769 (set (match_operand:SI 0 "gpc_reg_operand" "")
2771 "TARGET_32BIT && reload_completed"
2772 [(set (match_dup 0) (match_dup 4))
2774 (compare:CC (match_dup 0)
2778 ;; maskir insn. We need four forms because things might be in arbitrary
2779 ;; orders. Don't define forms that only set CR fields because these
2780 ;; would modify an input register.
2782 (define_insn "*maskir_internal1"
2783 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2784 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2785 (match_operand:SI 1 "gpc_reg_operand" "0"))
2786 (and:SI (match_dup 2)
2787 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2791 (define_insn "*maskir_internal2"
2792 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2793 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2794 (match_operand:SI 1 "gpc_reg_operand" "0"))
2795 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2800 (define_insn "*maskir_internal3"
2801 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2802 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2803 (match_operand:SI 3 "gpc_reg_operand" "r"))
2804 (and:SI (not:SI (match_dup 2))
2805 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2809 (define_insn "*maskir_internal4"
2810 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2811 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2812 (match_operand:SI 2 "gpc_reg_operand" "r"))
2813 (and:SI (not:SI (match_dup 2))
2814 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2818 (define_insn "*maskir_internal5"
2819 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2821 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2822 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2823 (and:SI (match_dup 2)
2824 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2826 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2827 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2828 (and:SI (match_dup 2) (match_dup 3))))]
2833 [(set_attr "type" "compare")
2834 (set_attr "length" "4,8")])
2837 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2839 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2840 (match_operand:SI 1 "gpc_reg_operand" ""))
2841 (and:SI (match_dup 2)
2842 (match_operand:SI 3 "gpc_reg_operand" "")))
2844 (set (match_operand:SI 0 "gpc_reg_operand" "")
2845 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2846 (and:SI (match_dup 2) (match_dup 3))))]
2847 "TARGET_POWER && reload_completed"
2849 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2850 (and:SI (match_dup 2) (match_dup 3))))
2852 (compare:CC (match_dup 0)
2856 (define_insn "*maskir_internal6"
2857 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2859 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2860 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2861 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2864 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2865 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2866 (and:SI (match_dup 3) (match_dup 2))))]
2871 [(set_attr "type" "compare")
2872 (set_attr "length" "4,8")])
2875 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2877 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2878 (match_operand:SI 1 "gpc_reg_operand" ""))
2879 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2882 (set (match_operand:SI 0 "gpc_reg_operand" "")
2883 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2884 (and:SI (match_dup 3) (match_dup 2))))]
2885 "TARGET_POWER && reload_completed"
2887 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2888 (and:SI (match_dup 3) (match_dup 2))))
2890 (compare:CC (match_dup 0)
2894 (define_insn "*maskir_internal7"
2895 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2897 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2898 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2899 (and:SI (not:SI (match_dup 2))
2900 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2902 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2903 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2904 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2909 [(set_attr "type" "compare")
2910 (set_attr "length" "4,8")])
2913 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2915 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2916 (match_operand:SI 3 "gpc_reg_operand" ""))
2917 (and:SI (not:SI (match_dup 2))
2918 (match_operand:SI 1 "gpc_reg_operand" "")))
2920 (set (match_operand:SI 0 "gpc_reg_operand" "")
2921 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2922 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2923 "TARGET_POWER && reload_completed"
2925 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2926 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2928 (compare:CC (match_dup 0)
2932 (define_insn "*maskir_internal8"
2933 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2935 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2936 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2937 (and:SI (not:SI (match_dup 2))
2938 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2940 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2941 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2942 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2947 [(set_attr "type" "compare")
2948 (set_attr "length" "4,8")])
2951 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2953 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2954 (match_operand:SI 2 "gpc_reg_operand" ""))
2955 (and:SI (not:SI (match_dup 2))
2956 (match_operand:SI 1 "gpc_reg_operand" "")))
2958 (set (match_operand:SI 0 "gpc_reg_operand" "")
2959 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2960 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2961 "TARGET_POWER && reload_completed"
2963 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2964 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2966 (compare:CC (match_dup 0)
2970 ;; Rotate and shift insns, in all their variants. These support shifts,
2971 ;; field inserts and extracts, and various combinations thereof.
2972 (define_expand "insv"
2973 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2974 (match_operand:SI 1 "const_int_operand" "")
2975 (match_operand:SI 2 "const_int_operand" ""))
2976 (match_operand 3 "gpc_reg_operand" ""))]
2980 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2981 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2982 compiler if the address of the structure is taken later. */
2983 if (GET_CODE (operands[0]) == SUBREG
2984 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2987 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2988 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2990 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2994 (define_insn "insvsi"
2995 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2996 (match_operand:SI 1 "const_int_operand" "i")
2997 (match_operand:SI 2 "const_int_operand" "i"))
2998 (match_operand:SI 3 "gpc_reg_operand" "r"))]
3002 int start = INTVAL (operands[2]) & 31;
3003 int size = INTVAL (operands[1]) & 31;
3005 operands[4] = GEN_INT (32 - start - size);
3006 operands[1] = GEN_INT (start + size - 1);
3007 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3009 [(set_attr "type" "insert_word")])
3011 (define_insn "*insvsi_internal1"
3012 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3013 (match_operand:SI 1 "const_int_operand" "i")
3014 (match_operand:SI 2 "const_int_operand" "i"))
3015 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3016 (match_operand:SI 4 "const_int_operand" "i")))]
3017 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3020 int shift = INTVAL (operands[4]) & 31;
3021 int start = INTVAL (operands[2]) & 31;
3022 int size = INTVAL (operands[1]) & 31;
3024 operands[4] = GEN_INT (shift - start - size);
3025 operands[1] = GEN_INT (start + size - 1);
3026 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3028 [(set_attr "type" "insert_word")])
3030 (define_insn "*insvsi_internal2"
3031 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3032 (match_operand:SI 1 "const_int_operand" "i")
3033 (match_operand:SI 2 "const_int_operand" "i"))
3034 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3035 (match_operand:SI 4 "const_int_operand" "i")))]
3036 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3039 int shift = INTVAL (operands[4]) & 31;
3040 int start = INTVAL (operands[2]) & 31;
3041 int size = INTVAL (operands[1]) & 31;
3043 operands[4] = GEN_INT (32 - shift - start - size);
3044 operands[1] = GEN_INT (start + size - 1);
3045 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3047 [(set_attr "type" "insert_word")])
3049 (define_insn "*insvsi_internal3"
3050 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3051 (match_operand:SI 1 "const_int_operand" "i")
3052 (match_operand:SI 2 "const_int_operand" "i"))
3053 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3054 (match_operand:SI 4 "const_int_operand" "i")))]
3055 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3058 int shift = INTVAL (operands[4]) & 31;
3059 int start = INTVAL (operands[2]) & 31;
3060 int size = INTVAL (operands[1]) & 31;
3062 operands[4] = GEN_INT (32 - shift - start - size);
3063 operands[1] = GEN_INT (start + size - 1);
3064 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3066 [(set_attr "type" "insert_word")])
3068 (define_insn "*insvsi_internal4"
3069 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3070 (match_operand:SI 1 "const_int_operand" "i")
3071 (match_operand:SI 2 "const_int_operand" "i"))
3072 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3073 (match_operand:SI 4 "const_int_operand" "i")
3074 (match_operand:SI 5 "const_int_operand" "i")))]
3075 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3078 int extract_start = INTVAL (operands[5]) & 31;
3079 int extract_size = INTVAL (operands[4]) & 31;
3080 int insert_start = INTVAL (operands[2]) & 31;
3081 int insert_size = INTVAL (operands[1]) & 31;
3083 /* Align extract field with insert field */
3084 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3085 operands[1] = GEN_INT (insert_start + insert_size - 1);
3086 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3088 [(set_attr "type" "insert_word")])
3090 ;; combine patterns for rlwimi
3091 (define_insn "*insvsi_internal5"
3092 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3093 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3094 (match_operand:SI 1 "mask_operand" "i"))
3095 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3096 (match_operand:SI 2 "const_int_operand" "i"))
3097 (match_operand:SI 5 "mask_operand" "i"))))]
3098 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3101 int me = extract_ME(operands[5]);
3102 int mb = extract_MB(operands[5]);
3103 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3104 operands[2] = GEN_INT(mb);
3105 operands[1] = GEN_INT(me);
3106 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3108 [(set_attr "type" "insert_word")])
3110 (define_insn "*insvsi_internal6"
3111 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3112 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3113 (match_operand:SI 2 "const_int_operand" "i"))
3114 (match_operand:SI 5 "mask_operand" "i"))
3115 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3116 (match_operand:SI 1 "mask_operand" "i"))))]
3117 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3120 int me = extract_ME(operands[5]);
3121 int mb = extract_MB(operands[5]);
3122 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3123 operands[2] = GEN_INT(mb);
3124 operands[1] = GEN_INT(me);
3125 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3127 [(set_attr "type" "insert_word")])
3129 (define_insn "insvdi"
3130 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3131 (match_operand:SI 1 "const_int_operand" "i")
3132 (match_operand:SI 2 "const_int_operand" "i"))
3133 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3137 int start = INTVAL (operands[2]) & 63;
3138 int size = INTVAL (operands[1]) & 63;
3140 operands[1] = GEN_INT (64 - start - size);
3141 return \"rldimi %0,%3,%H1,%H2\";
3144 (define_insn "*insvdi_internal2"
3145 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3146 (match_operand:SI 1 "const_int_operand" "i")
3147 (match_operand:SI 2 "const_int_operand" "i"))
3148 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3149 (match_operand:SI 4 "const_int_operand" "i")))]
3151 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3154 int shift = INTVAL (operands[4]) & 63;
3155 int start = (INTVAL (operands[2]) & 63) - 32;
3156 int size = INTVAL (operands[1]) & 63;
3158 operands[4] = GEN_INT (64 - shift - start - size);
3159 operands[2] = GEN_INT (start);
3160 operands[1] = GEN_INT (start + size - 1);
3161 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3164 (define_insn "*insvdi_internal3"
3165 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3166 (match_operand:SI 1 "const_int_operand" "i")
3167 (match_operand:SI 2 "const_int_operand" "i"))
3168 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3169 (match_operand:SI 4 "const_int_operand" "i")))]
3171 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3174 int shift = INTVAL (operands[4]) & 63;
3175 int start = (INTVAL (operands[2]) & 63) - 32;
3176 int size = INTVAL (operands[1]) & 63;
3178 operands[4] = GEN_INT (64 - shift - start - size);
3179 operands[2] = GEN_INT (start);
3180 operands[1] = GEN_INT (start + size - 1);
3181 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3184 (define_expand "extzv"
3185 [(set (match_operand 0 "gpc_reg_operand" "")
3186 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3187 (match_operand:SI 2 "const_int_operand" "")
3188 (match_operand:SI 3 "const_int_operand" "")))]
3192 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3193 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3194 compiler if the address of the structure is taken later. */
3195 if (GET_CODE (operands[0]) == SUBREG
3196 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3199 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3200 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3202 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3206 (define_insn "extzvsi"
3207 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3208 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3209 (match_operand:SI 2 "const_int_operand" "i")
3210 (match_operand:SI 3 "const_int_operand" "i")))]
3214 int start = INTVAL (operands[3]) & 31;
3215 int size = INTVAL (operands[2]) & 31;
3217 if (start + size >= 32)
3218 operands[3] = const0_rtx;
3220 operands[3] = GEN_INT (start + size);
3221 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3224 (define_insn "*extzvsi_internal1"
3225 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3226 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3227 (match_operand:SI 2 "const_int_operand" "i,i")
3228 (match_operand:SI 3 "const_int_operand" "i,i"))
3230 (clobber (match_scratch:SI 4 "=r,r"))]
3234 int start = INTVAL (operands[3]) & 31;
3235 int size = INTVAL (operands[2]) & 31;
3237 /* Force split for non-cc0 compare. */
3238 if (which_alternative == 1)
3241 /* If the bit-field being tested fits in the upper or lower half of a
3242 word, it is possible to use andiu. or andil. to test it. This is
3243 useful because the condition register set-use delay is smaller for
3244 andi[ul]. than for rlinm. This doesn't work when the starting bit
3245 position is 0 because the LT and GT bits may be set wrong. */
3247 if ((start > 0 && start + size <= 16) || start >= 16)
3249 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3250 - (1 << (16 - (start & 15) - size))));
3252 return \"{andiu.|andis.} %4,%1,%3\";
3254 return \"{andil.|andi.} %4,%1,%3\";
3257 if (start + size >= 32)
3258 operands[3] = const0_rtx;
3260 operands[3] = GEN_INT (start + size);
3261 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3263 [(set_attr "type" "compare")
3264 (set_attr "length" "4,8")])
3267 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3268 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3269 (match_operand:SI 2 "const_int_operand" "")
3270 (match_operand:SI 3 "const_int_operand" ""))
3272 (clobber (match_scratch:SI 4 ""))]
3275 (zero_extract:SI (match_dup 1) (match_dup 2)
3278 (compare:CC (match_dup 4)
3282 (define_insn "*extzvsi_internal2"
3283 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3284 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3285 (match_operand:SI 2 "const_int_operand" "i,i")
3286 (match_operand:SI 3 "const_int_operand" "i,i"))
3288 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3289 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3293 int start = INTVAL (operands[3]) & 31;
3294 int size = INTVAL (operands[2]) & 31;
3296 /* Force split for non-cc0 compare. */
3297 if (which_alternative == 1)
3300 /* Since we are using the output value, we can't ignore any need for
3301 a shift. The bit-field must end at the LSB. */
3302 if (start >= 16 && start + size == 32)
3304 operands[3] = GEN_INT ((1 << size) - 1);
3305 return \"{andil.|andi.} %0,%1,%3\";
3308 if (start + size >= 32)
3309 operands[3] = const0_rtx;
3311 operands[3] = GEN_INT (start + size);
3312 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3314 [(set_attr "type" "compare")
3315 (set_attr "length" "4,8")])
3318 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3319 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3320 (match_operand:SI 2 "const_int_operand" "")
3321 (match_operand:SI 3 "const_int_operand" ""))
3323 (set (match_operand:SI 0 "gpc_reg_operand" "")
3324 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3327 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3329 (compare:CC (match_dup 0)
3333 (define_insn "extzvdi"
3334 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3335 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3336 (match_operand:SI 2 "const_int_operand" "i")
3337 (match_operand:SI 3 "const_int_operand" "i")))]
3341 int start = INTVAL (operands[3]) & 63;
3342 int size = INTVAL (operands[2]) & 63;
3344 if (start + size >= 64)
3345 operands[3] = const0_rtx;
3347 operands[3] = GEN_INT (start + size);
3348 operands[2] = GEN_INT (64 - size);
3349 return \"rldicl %0,%1,%3,%2\";
3352 (define_insn "*extzvdi_internal1"
3353 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3354 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3355 (match_operand:SI 2 "const_int_operand" "i")
3356 (match_operand:SI 3 "const_int_operand" "i"))
3358 (clobber (match_scratch:DI 4 "=r"))]
3362 int start = INTVAL (operands[3]) & 63;
3363 int size = INTVAL (operands[2]) & 63;
3365 if (start + size >= 64)
3366 operands[3] = const0_rtx;
3368 operands[3] = GEN_INT (start + size);
3369 operands[2] = GEN_INT (64 - size);
3370 return \"rldicl. %4,%1,%3,%2\";
3372 [(set_attr "type" "compare")])
3374 (define_insn "*extzvdi_internal2"
3375 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3376 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3377 (match_operand:SI 2 "const_int_operand" "i")
3378 (match_operand:SI 3 "const_int_operand" "i"))
3380 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3381 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3385 int start = INTVAL (operands[3]) & 63;
3386 int size = INTVAL (operands[2]) & 63;
3388 if (start + size >= 64)
3389 operands[3] = const0_rtx;
3391 operands[3] = GEN_INT (start + size);
3392 operands[2] = GEN_INT (64 - size);
3393 return \"rldicl. %0,%1,%3,%2\";
3395 [(set_attr "type" "compare")])
3397 (define_insn "rotlsi3"
3398 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3399 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3400 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3402 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3404 (define_insn "*rotlsi3_internal2"
3405 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3406 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3407 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3409 (clobber (match_scratch:SI 3 "=r,r"))]
3412 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3414 [(set_attr "type" "delayed_compare")
3415 (set_attr "length" "4,8")])
3418 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3419 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3420 (match_operand:SI 2 "reg_or_cint_operand" ""))
3422 (clobber (match_scratch:SI 3 ""))]
3425 (rotate:SI (match_dup 1) (match_dup 2)))
3427 (compare:CC (match_dup 3)
3431 (define_insn "*rotlsi3_internal3"
3432 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3433 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3434 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3436 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3437 (rotate:SI (match_dup 1) (match_dup 2)))]
3440 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3442 [(set_attr "type" "delayed_compare")
3443 (set_attr "length" "4,8")])
3446 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3447 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3448 (match_operand:SI 2 "reg_or_cint_operand" ""))
3450 (set (match_operand:SI 0 "gpc_reg_operand" "")
3451 (rotate:SI (match_dup 1) (match_dup 2)))]
3454 (rotate:SI (match_dup 1) (match_dup 2)))
3456 (compare:CC (match_dup 0)
3460 (define_insn "*rotlsi3_internal4"
3461 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3462 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3463 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3464 (match_operand:SI 3 "mask_operand" "n")))]
3466 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3468 (define_insn "*rotlsi3_internal5"
3469 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3471 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3472 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3473 (match_operand:SI 3 "mask_operand" "n,n"))
3475 (clobber (match_scratch:SI 4 "=r,r"))]
3478 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3480 [(set_attr "type" "delayed_compare")
3481 (set_attr "length" "4,8")])
3484 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3486 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3487 (match_operand:SI 2 "reg_or_cint_operand" ""))
3488 (match_operand:SI 3 "mask_operand" ""))
3490 (clobber (match_scratch:SI 4 ""))]
3493 (and:SI (rotate:SI (match_dup 1)
3497 (compare:CC (match_dup 4)
3501 (define_insn "*rotlsi3_internal6"
3502 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3504 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3505 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3506 (match_operand:SI 3 "mask_operand" "n,n"))
3508 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3509 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3512 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3514 [(set_attr "type" "delayed_compare")
3515 (set_attr "length" "4,8")])
3518 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3520 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3521 (match_operand:SI 2 "reg_or_cint_operand" ""))
3522 (match_operand:SI 3 "mask_operand" ""))
3524 (set (match_operand:SI 0 "gpc_reg_operand" "")
3525 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3528 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3530 (compare:CC (match_dup 0)
3534 (define_insn "*rotlsi3_internal7"
3535 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3538 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3539 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3541 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3543 (define_insn "*rotlsi3_internal8"
3544 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3545 (compare:CC (zero_extend:SI
3547 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3548 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3550 (clobber (match_scratch:SI 3 "=r,r"))]
3553 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3555 [(set_attr "type" "delayed_compare")
3556 (set_attr "length" "4,8")])
3559 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3560 (compare:CC (zero_extend:SI
3562 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3563 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3565 (clobber (match_scratch:SI 3 ""))]
3568 (zero_extend:SI (subreg:QI
3569 (rotate:SI (match_dup 1)
3572 (compare:CC (match_dup 3)
3576 (define_insn "*rotlsi3_internal9"
3577 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3578 (compare:CC (zero_extend:SI
3580 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3581 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3583 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3584 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3587 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3589 [(set_attr "type" "delayed_compare")
3590 (set_attr "length" "4,8")])
3593 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3594 (compare:CC (zero_extend:SI
3596 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3597 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3599 (set (match_operand:SI 0 "gpc_reg_operand" "")
3600 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3603 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3605 (compare:CC (match_dup 0)
3609 (define_insn "*rotlsi3_internal10"
3610 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3613 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3614 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3616 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3618 (define_insn "*rotlsi3_internal11"
3619 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3620 (compare:CC (zero_extend:SI
3622 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3623 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3625 (clobber (match_scratch:SI 3 "=r,r"))]
3628 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3630 [(set_attr "type" "delayed_compare")
3631 (set_attr "length" "4,8")])
3634 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3635 (compare:CC (zero_extend:SI
3637 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3638 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3640 (clobber (match_scratch:SI 3 ""))]
3643 (zero_extend:SI (subreg:HI
3644 (rotate:SI (match_dup 1)
3647 (compare:CC (match_dup 3)
3651 (define_insn "*rotlsi3_internal12"
3652 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3653 (compare:CC (zero_extend:SI
3655 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3656 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3658 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3659 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3662 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3664 [(set_attr "type" "delayed_compare")
3665 (set_attr "length" "4,8")])
3668 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3669 (compare:CC (zero_extend:SI
3671 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3672 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3674 (set (match_operand:SI 0 "gpc_reg_operand" "")
3675 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3678 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3680 (compare:CC (match_dup 0)
3684 ;; Note that we use "sle." instead of "sl." so that we can set
3685 ;; SHIFT_COUNT_TRUNCATED.
3687 (define_expand "ashlsi3"
3688 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3689 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3690 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3695 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3697 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3701 (define_insn "ashlsi3_power"
3702 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3703 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3704 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3705 (clobber (match_scratch:SI 3 "=q,X"))]
3709 {sli|slwi} %0,%1,%h2")
3711 (define_insn "ashlsi3_no_power"
3712 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3713 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3714 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3716 "{sl|slw}%I2 %0,%1,%h2")
3719 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3720 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3721 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3723 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3724 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3728 {sli.|slwi.} %3,%1,%h2
3731 [(set_attr "type" "delayed_compare")
3732 (set_attr "length" "4,4,8,8")])
3735 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3736 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3737 (match_operand:SI 2 "reg_or_cint_operand" ""))
3739 (clobber (match_scratch:SI 3 ""))
3740 (clobber (match_scratch:SI 4 ""))]
3741 "TARGET_POWER && reload_completed"
3742 [(parallel [(set (match_dup 3)
3743 (ashift:SI (match_dup 1) (match_dup 2)))
3744 (clobber (match_dup 4))])
3746 (compare:CC (match_dup 3)
3751 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3752 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3753 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3755 (clobber (match_scratch:SI 3 "=r,r"))]
3756 "! TARGET_POWER && TARGET_32BIT"
3758 {sl|slw}%I2. %3,%1,%h2
3760 [(set_attr "type" "delayed_compare")
3761 (set_attr "length" "4,8")])
3764 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3765 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3766 (match_operand:SI 2 "reg_or_cint_operand" ""))
3768 (clobber (match_scratch:SI 3 ""))]
3769 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3771 (ashift:SI (match_dup 1) (match_dup 2)))
3773 (compare:CC (match_dup 3)
3778 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3779 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3780 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3782 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3783 (ashift:SI (match_dup 1) (match_dup 2)))
3784 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3788 {sli.|slwi.} %0,%1,%h2
3791 [(set_attr "type" "delayed_compare")
3792 (set_attr "length" "4,4,8,8")])
3795 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3796 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3797 (match_operand:SI 2 "reg_or_cint_operand" ""))
3799 (set (match_operand:SI 0 "gpc_reg_operand" "")
3800 (ashift:SI (match_dup 1) (match_dup 2)))
3801 (clobber (match_scratch:SI 4 ""))]
3802 "TARGET_POWER && reload_completed"
3803 [(parallel [(set (match_dup 0)
3804 (ashift:SI (match_dup 1) (match_dup 2)))
3805 (clobber (match_dup 4))])
3807 (compare:CC (match_dup 0)
3812 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3813 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3814 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3816 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3817 (ashift:SI (match_dup 1) (match_dup 2)))]
3818 "! TARGET_POWER && TARGET_32BIT"
3820 {sl|slw}%I2. %0,%1,%h2
3822 [(set_attr "type" "delayed_compare")
3823 (set_attr "length" "4,8")])
3826 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3827 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3828 (match_operand:SI 2 "reg_or_cint_operand" ""))
3830 (set (match_operand:SI 0 "gpc_reg_operand" "")
3831 (ashift:SI (match_dup 1) (match_dup 2)))]
3832 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3834 (ashift:SI (match_dup 1) (match_dup 2)))
3836 (compare:CC (match_dup 0)
3840 (define_insn "rlwinm"
3841 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3842 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3843 (match_operand:SI 2 "const_int_operand" "i"))
3844 (match_operand:SI 3 "mask_operand" "n")))]
3845 "includes_lshift_p (operands[2], operands[3])"
3846 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3849 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3851 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3852 (match_operand:SI 2 "const_int_operand" "i,i"))
3853 (match_operand:SI 3 "mask_operand" "n,n"))
3855 (clobber (match_scratch:SI 4 "=r,r"))]
3856 "includes_lshift_p (operands[2], operands[3])"
3858 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3860 [(set_attr "type" "delayed_compare")
3861 (set_attr "length" "4,8")])
3864 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3866 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3867 (match_operand:SI 2 "const_int_operand" ""))
3868 (match_operand:SI 3 "mask_operand" ""))
3870 (clobber (match_scratch:SI 4 ""))]
3871 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3873 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3876 (compare:CC (match_dup 4)
3881 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3883 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3884 (match_operand:SI 2 "const_int_operand" "i,i"))
3885 (match_operand:SI 3 "mask_operand" "n,n"))
3887 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3888 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3889 "includes_lshift_p (operands[2], operands[3])"
3891 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3893 [(set_attr "type" "delayed_compare")
3894 (set_attr "length" "4,8")])
3897 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3899 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3900 (match_operand:SI 2 "const_int_operand" ""))
3901 (match_operand:SI 3 "mask_operand" ""))
3903 (set (match_operand:SI 0 "gpc_reg_operand" "")
3904 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3905 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3907 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3909 (compare:CC (match_dup 0)
3913 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3915 (define_expand "lshrsi3"
3916 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3917 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3918 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3923 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3925 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3929 (define_insn "lshrsi3_power"
3930 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3931 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3932 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3933 (clobber (match_scratch:SI 3 "=q,X,X"))]
3938 {s%A2i|s%A2wi} %0,%1,%h2")
3940 (define_insn "lshrsi3_no_power"
3941 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3942 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3943 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3947 {sr|srw}%I2 %0,%1,%h2")
3950 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3951 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3952 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3954 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3955 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3960 {s%A2i.|s%A2wi.} %3,%1,%h2
3964 [(set_attr "type" "delayed_compare")
3965 (set_attr "length" "4,4,4,8,8,8")])
3968 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3969 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3970 (match_operand:SI 2 "reg_or_cint_operand" ""))
3972 (clobber (match_scratch:SI 3 ""))
3973 (clobber (match_scratch:SI 4 ""))]
3974 "TARGET_POWER && reload_completed"
3975 [(parallel [(set (match_dup 3)
3976 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3977 (clobber (match_dup 4))])
3979 (compare:CC (match_dup 3)
3984 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3985 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3986 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3988 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3989 "! TARGET_POWER && TARGET_32BIT"
3992 {sr|srw}%I2. %3,%1,%h2
3995 [(set_attr "type" "delayed_compare")
3996 (set_attr "length" "4,4,8,8")])
3999 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4000 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4001 (match_operand:SI 2 "reg_or_cint_operand" ""))
4003 (clobber (match_scratch:SI 3 ""))]
4004 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4006 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4008 (compare:CC (match_dup 3)
4013 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4014 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4015 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4017 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4018 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4019 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4024 {s%A2i.|s%A2wi.} %0,%1,%h2
4028 [(set_attr "type" "delayed_compare")
4029 (set_attr "length" "4,4,4,8,8,8")])
4032 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4033 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4034 (match_operand:SI 2 "reg_or_cint_operand" ""))
4036 (set (match_operand:SI 0 "gpc_reg_operand" "")
4037 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4038 (clobber (match_scratch:SI 4 ""))]
4039 "TARGET_POWER && reload_completed"
4040 [(parallel [(set (match_dup 0)
4041 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4042 (clobber (match_dup 4))])
4044 (compare:CC (match_dup 0)
4049 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4050 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4051 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4053 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4054 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4055 "! TARGET_POWER && TARGET_32BIT"
4058 {sr|srw}%I2. %0,%1,%h2
4061 [(set_attr "type" "delayed_compare")
4062 (set_attr "length" "4,4,8,8")])
4065 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4066 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4067 (match_operand:SI 2 "reg_or_cint_operand" ""))
4069 (set (match_operand:SI 0 "gpc_reg_operand" "")
4070 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4071 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4073 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4075 (compare:CC (match_dup 0)
4080 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4081 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4082 (match_operand:SI 2 "const_int_operand" "i"))
4083 (match_operand:SI 3 "mask_operand" "n")))]
4084 "includes_rshift_p (operands[2], operands[3])"
4085 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4088 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4090 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4091 (match_operand:SI 2 "const_int_operand" "i,i"))
4092 (match_operand:SI 3 "mask_operand" "n,n"))
4094 (clobber (match_scratch:SI 4 "=r,r"))]
4095 "includes_rshift_p (operands[2], operands[3])"
4097 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4099 [(set_attr "type" "delayed_compare")
4100 (set_attr "length" "4,8")])
4103 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4105 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4106 (match_operand:SI 2 "const_int_operand" ""))
4107 (match_operand:SI 3 "mask_operand" ""))
4109 (clobber (match_scratch:SI 4 ""))]
4110 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4112 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4115 (compare:CC (match_dup 4)
4120 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4122 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4123 (match_operand:SI 2 "const_int_operand" "i,i"))
4124 (match_operand:SI 3 "mask_operand" "n,n"))
4126 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4127 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4128 "includes_rshift_p (operands[2], operands[3])"
4130 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4132 [(set_attr "type" "delayed_compare")
4133 (set_attr "length" "4,8")])
4136 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4138 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4139 (match_operand:SI 2 "const_int_operand" ""))
4140 (match_operand:SI 3 "mask_operand" ""))
4142 (set (match_operand:SI 0 "gpc_reg_operand" "")
4143 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4144 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4146 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4148 (compare:CC (match_dup 0)
4153 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4156 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4157 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4158 "includes_rshift_p (operands[2], GEN_INT (255))"
4159 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4162 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4166 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4167 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4169 (clobber (match_scratch:SI 3 "=r,r"))]
4170 "includes_rshift_p (operands[2], GEN_INT (255))"
4172 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4174 [(set_attr "type" "delayed_compare")
4175 (set_attr "length" "4,8")])
4178 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4182 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4183 (match_operand:SI 2 "const_int_operand" "")) 0))
4185 (clobber (match_scratch:SI 3 ""))]
4186 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4188 (zero_extend:SI (subreg:QI
4189 (lshiftrt:SI (match_dup 1)
4192 (compare:CC (match_dup 3)
4197 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4201 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4202 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4204 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4205 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4206 "includes_rshift_p (operands[2], GEN_INT (255))"
4208 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4210 [(set_attr "type" "delayed_compare")
4211 (set_attr "length" "4,8")])
4214 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4218 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4219 (match_operand:SI 2 "const_int_operand" "")) 0))
4221 (set (match_operand:SI 0 "gpc_reg_operand" "")
4222 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4223 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4225 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4227 (compare:CC (match_dup 0)
4232 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4235 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4236 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4237 "includes_rshift_p (operands[2], GEN_INT (65535))"
4238 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4241 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4245 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4246 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4248 (clobber (match_scratch:SI 3 "=r,r"))]
4249 "includes_rshift_p (operands[2], GEN_INT (65535))"
4251 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4253 [(set_attr "type" "delayed_compare")
4254 (set_attr "length" "4,8")])
4257 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4261 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4262 (match_operand:SI 2 "const_int_operand" "")) 0))
4264 (clobber (match_scratch:SI 3 ""))]
4265 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4267 (zero_extend:SI (subreg:HI
4268 (lshiftrt:SI (match_dup 1)
4271 (compare:CC (match_dup 3)
4276 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4280 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4281 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4283 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4284 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4285 "includes_rshift_p (operands[2], GEN_INT (65535))"
4287 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4289 [(set_attr "type" "delayed_compare")
4290 (set_attr "length" "4,8")])
4293 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4297 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4298 (match_operand:SI 2 "const_int_operand" "")) 0))
4300 (set (match_operand:SI 0 "gpc_reg_operand" "")
4301 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4302 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4304 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4306 (compare:CC (match_dup 0)
4311 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4313 (match_operand:SI 1 "gpc_reg_operand" "r"))
4314 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4320 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4322 (match_operand:SI 1 "gpc_reg_operand" "r"))
4323 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4329 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4331 (match_operand:SI 1 "gpc_reg_operand" "r"))
4332 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4338 (define_expand "ashrsi3"
4339 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4340 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4341 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4346 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4348 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4352 (define_insn "ashrsi3_power"
4353 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4354 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4355 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4356 (clobber (match_scratch:SI 3 "=q,X"))]
4360 {srai|srawi} %0,%1,%h2")
4362 (define_insn "ashrsi3_no_power"
4363 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4364 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4365 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4367 "{sra|sraw}%I2 %0,%1,%h2")
4370 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4371 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4372 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4374 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4375 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4379 {srai.|srawi.} %3,%1,%h2
4382 [(set_attr "type" "delayed_compare")
4383 (set_attr "length" "4,4,8,8")])
4386 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4387 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4388 (match_operand:SI 2 "reg_or_cint_operand" ""))
4390 (clobber (match_scratch:SI 3 ""))
4391 (clobber (match_scratch:SI 4 ""))]
4392 "TARGET_POWER && reload_completed"
4393 [(parallel [(set (match_dup 3)
4394 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4395 (clobber (match_dup 4))])
4397 (compare:CC (match_dup 3)
4402 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4403 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4404 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4406 (clobber (match_scratch:SI 3 "=r,r"))]
4409 {sra|sraw}%I2. %3,%1,%h2
4411 [(set_attr "type" "delayed_compare")
4412 (set_attr "length" "4,8")])
4415 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4416 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4417 (match_operand:SI 2 "reg_or_cint_operand" ""))
4419 (clobber (match_scratch:SI 3 ""))]
4420 "! TARGET_POWER && reload_completed"
4422 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4424 (compare:CC (match_dup 3)
4429 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4430 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4431 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4433 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4434 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4435 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4439 {srai.|srawi.} %0,%1,%h2
4442 [(set_attr "type" "delayed_compare")
4443 (set_attr "length" "4,4,8,8")])
4446 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4447 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4448 (match_operand:SI 2 "reg_or_cint_operand" ""))
4450 (set (match_operand:SI 0 "gpc_reg_operand" "")
4451 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4452 (clobber (match_scratch:SI 4 ""))]
4453 "TARGET_POWER && reload_completed"
4454 [(parallel [(set (match_dup 0)
4455 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4456 (clobber (match_dup 4))])
4458 (compare:CC (match_dup 0)
4463 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4464 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4465 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4467 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4468 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4471 {sra|sraw}%I2. %0,%1,%h2
4473 [(set_attr "type" "delayed_compare")
4474 (set_attr "length" "4,8")])
4477 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4478 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4479 (match_operand:SI 2 "reg_or_cint_operand" ""))
4481 (set (match_operand:SI 0 "gpc_reg_operand" "")
4482 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4483 "! TARGET_POWER && reload_completed"
4485 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4487 (compare:CC (match_dup 0)
4491 ;; Floating-point insns, excluding normal data motion.
4493 ;; PowerPC has a full set of single-precision floating point instructions.
4495 ;; For the POWER architecture, we pretend that we have both SFmode and
4496 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4497 ;; The only conversions we will do will be when storing to memory. In that
4498 ;; case, we will use the "frsp" instruction before storing.
4500 ;; Note that when we store into a single-precision memory location, we need to
4501 ;; use the frsp insn first. If the register being stored isn't dead, we
4502 ;; need a scratch register for the frsp. But this is difficult when the store
4503 ;; is done by reload. It is not incorrect to do the frsp on the register in
4504 ;; this case, we just lose precision that we would have otherwise gotten but
4505 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4507 (define_expand "extendsfdf2"
4508 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4509 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4510 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4513 (define_insn_and_split "*extendsfdf2_fpr"
4514 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4515 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4516 "TARGET_HARD_FLOAT && TARGET_FPRS"
4521 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4524 emit_note (NOTE_INSN_DELETED);
4527 [(set_attr "type" "fp,fp,fpload")])
4529 (define_expand "truncdfsf2"
4530 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4531 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4532 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4535 (define_insn "*truncdfsf2_fpr"
4536 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4537 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4538 "TARGET_HARD_FLOAT && TARGET_FPRS"
4540 [(set_attr "type" "fp")])
4542 (define_insn "aux_truncdfsf2"
4543 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4544 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4545 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4547 [(set_attr "type" "fp")])
4549 (define_expand "negsf2"
4550 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4551 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4555 (define_insn "*negsf2"
4556 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4557 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4558 "TARGET_HARD_FLOAT && TARGET_FPRS"
4560 [(set_attr "type" "fp")])
4562 (define_expand "abssf2"
4563 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4564 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4568 (define_insn "*abssf2"
4569 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4570 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4571 "TARGET_HARD_FLOAT && TARGET_FPRS"
4573 [(set_attr "type" "fp")])
4576 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4577 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4578 "TARGET_HARD_FLOAT && TARGET_FPRS"
4580 [(set_attr "type" "fp")])
4582 (define_expand "addsf3"
4583 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4584 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4585 (match_operand:SF 2 "gpc_reg_operand" "")))]
4590 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4591 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4592 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4593 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4595 [(set_attr "type" "fp")])
4598 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4599 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4600 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4601 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4602 "{fa|fadd} %0,%1,%2"
4603 [(set_attr "type" "fp")])
4605 (define_expand "subsf3"
4606 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4607 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4608 (match_operand:SF 2 "gpc_reg_operand" "")))]
4613 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4614 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4615 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4616 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4618 [(set_attr "type" "fp")])
4621 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4622 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4623 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4624 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4625 "{fs|fsub} %0,%1,%2"
4626 [(set_attr "type" "fp")])
4628 (define_expand "mulsf3"
4629 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4630 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4631 (match_operand:SF 2 "gpc_reg_operand" "")))]
4636 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4637 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4638 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4639 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4641 [(set_attr "type" "fp")])
4644 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4645 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4646 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4647 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4648 "{fm|fmul} %0,%1,%2"
4649 [(set_attr "type" "dmul")])
4652 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4653 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
4654 "TARGET_PPC_GFXOPT && flag_finite_math_only"
4656 [(set_attr "type" "fp")])
4658 (define_expand "divsf3"
4659 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4660 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4661 (match_operand:SF 2 "gpc_reg_operand" "")))]
4664 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
4665 && flag_finite_math_only && !flag_trapping_math)
4667 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
4673 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4674 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4675 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4676 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4678 [(set_attr "type" "sdiv")])
4681 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4682 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4683 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4684 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4685 "{fd|fdiv} %0,%1,%2"
4686 [(set_attr "type" "ddiv")])
4689 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4690 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4691 (match_operand:SF 2 "gpc_reg_operand" "f"))
4692 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4693 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4694 "fmadds %0,%1,%2,%3"
4695 [(set_attr "type" "fp")])
4698 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4699 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4700 (match_operand:SF 2 "gpc_reg_operand" "f"))
4701 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4702 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4703 "{fma|fmadd} %0,%1,%2,%3"
4704 [(set_attr "type" "dmul")])
4707 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4708 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4709 (match_operand:SF 2 "gpc_reg_operand" "f"))
4710 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4711 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4712 "fmsubs %0,%1,%2,%3"
4713 [(set_attr "type" "fp")])
4716 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4717 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4718 (match_operand:SF 2 "gpc_reg_operand" "f"))
4719 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4720 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4721 "{fms|fmsub} %0,%1,%2,%3"
4722 [(set_attr "type" "dmul")])
4725 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4726 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4727 (match_operand:SF 2 "gpc_reg_operand" "f"))
4728 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4729 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4730 && HONOR_SIGNED_ZEROS (SFmode)"
4731 "fnmadds %0,%1,%2,%3"
4732 [(set_attr "type" "fp")])
4735 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4736 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4737 (match_operand:SF 2 "gpc_reg_operand" "f"))
4738 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4739 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4740 && ! HONOR_SIGNED_ZEROS (SFmode)"
4741 "fnmadds %0,%1,%2,%3"
4742 [(set_attr "type" "fp")])
4745 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4746 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4747 (match_operand:SF 2 "gpc_reg_operand" "f"))
4748 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4749 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4750 "{fnma|fnmadd} %0,%1,%2,%3"
4751 [(set_attr "type" "dmul")])
4754 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4755 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4756 (match_operand:SF 2 "gpc_reg_operand" "f"))
4757 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4758 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4759 && ! HONOR_SIGNED_ZEROS (SFmode)"
4760 "{fnma|fnmadd} %0,%1,%2,%3"
4761 [(set_attr "type" "dmul")])
4764 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4765 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4766 (match_operand:SF 2 "gpc_reg_operand" "f"))
4767 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4768 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4769 && HONOR_SIGNED_ZEROS (SFmode)"
4770 "fnmsubs %0,%1,%2,%3"
4771 [(set_attr "type" "fp")])
4774 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4775 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4776 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4777 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4778 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4779 && ! HONOR_SIGNED_ZEROS (SFmode)"
4780 "fnmsubs %0,%1,%2,%3"
4781 [(set_attr "type" "fp")])
4784 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4785 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4786 (match_operand:SF 2 "gpc_reg_operand" "f"))
4787 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4788 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4789 "{fnms|fnmsub} %0,%1,%2,%3"
4790 [(set_attr "type" "dmul")])
4793 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4794 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4795 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4796 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4797 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4798 && ! HONOR_SIGNED_ZEROS (SFmode)"
4799 "{fnms|fnmsub} %0,%1,%2,%3"
4800 [(set_attr "type" "fp")])
4802 (define_expand "sqrtsf2"
4803 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4804 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4805 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4809 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4810 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4811 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4813 [(set_attr "type" "ssqrt")])
4816 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4817 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4818 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4820 [(set_attr "type" "dsqrt")])
4822 (define_expand "copysignsf3"
4824 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
4826 (neg:SF (abs:SF (match_dup 1))))
4827 (set (match_operand:SF 0 "gpc_reg_operand" "")
4828 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
4832 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4833 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
4835 operands[3] = gen_reg_rtx (SFmode);
4836 operands[4] = gen_reg_rtx (SFmode);
4837 operands[5] = CONST0_RTX (SFmode);
4840 (define_expand "copysigndf3"
4842 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
4844 (neg:DF (abs:DF (match_dup 1))))
4845 (set (match_operand:DF 0 "gpc_reg_operand" "")
4846 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
4850 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4851 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
4853 operands[3] = gen_reg_rtx (DFmode);
4854 operands[4] = gen_reg_rtx (DFmode);
4855 operands[5] = CONST0_RTX (DFmode);
4858 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4859 ;; fsel instruction and some auxiliary computations. Then we just have a
4860 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4862 (define_expand "smaxsf3"
4863 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4864 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4865 (match_operand:SF 2 "gpc_reg_operand" ""))
4868 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4869 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4871 (define_expand "sminsf3"
4872 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4873 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4874 (match_operand:SF 2 "gpc_reg_operand" ""))
4877 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4878 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4881 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4882 (match_operator:SF 3 "min_max_operator"
4883 [(match_operand:SF 1 "gpc_reg_operand" "")
4884 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4885 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4888 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4889 operands[1], operands[2]);
4893 (define_expand "movsicc"
4894 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4895 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4896 (match_operand:SI 2 "gpc_reg_operand" "")
4897 (match_operand:SI 3 "gpc_reg_operand" "")))]
4901 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4907 ;; We use the BASE_REGS for the isel input operands because, if rA is
4908 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4909 ;; because we may switch the operands and rB may end up being rA.
4911 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4912 ;; leave out the mode in operand 4 and use one pattern, but reload can
4913 ;; change the mode underneath our feet and then gets confused trying
4914 ;; to reload the value.
4915 (define_insn "isel_signed"
4916 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4918 (match_operator 1 "comparison_operator"
4919 [(match_operand:CC 4 "cc_reg_operand" "y")
4921 (match_operand:SI 2 "gpc_reg_operand" "b")
4922 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4925 { return output_isel (operands); }"
4926 [(set_attr "length" "4")])
4928 (define_insn "isel_unsigned"
4929 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4931 (match_operator 1 "comparison_operator"
4932 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4934 (match_operand:SI 2 "gpc_reg_operand" "b")
4935 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4938 { return output_isel (operands); }"
4939 [(set_attr "length" "4")])
4941 (define_expand "movsfcc"
4942 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4943 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4944 (match_operand:SF 2 "gpc_reg_operand" "")
4945 (match_operand:SF 3 "gpc_reg_operand" "")))]
4946 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4949 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4955 (define_insn "*fselsfsf4"
4956 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4957 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4958 (match_operand:SF 4 "zero_fp_constant" "F"))
4959 (match_operand:SF 2 "gpc_reg_operand" "f")
4960 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4961 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4963 [(set_attr "type" "fp")])
4965 (define_insn "*fseldfsf4"
4966 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4967 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4968 (match_operand:DF 4 "zero_fp_constant" "F"))
4969 (match_operand:SF 2 "gpc_reg_operand" "f")
4970 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4971 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4973 [(set_attr "type" "fp")])
4975 (define_expand "negdf2"
4976 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4977 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4978 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4981 (define_insn "*negdf2_fpr"
4982 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4983 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4984 "TARGET_HARD_FLOAT && TARGET_FPRS"
4986 [(set_attr "type" "fp")])
4988 (define_expand "absdf2"
4989 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4990 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4991 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4994 (define_insn "*absdf2_fpr"
4995 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4996 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4997 "TARGET_HARD_FLOAT && TARGET_FPRS"
4999 [(set_attr "type" "fp")])
5001 (define_insn "*nabsdf2_fpr"
5002 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5003 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
5004 "TARGET_HARD_FLOAT && TARGET_FPRS"
5006 [(set_attr "type" "fp")])
5008 (define_expand "adddf3"
5009 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5010 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5011 (match_operand:DF 2 "gpc_reg_operand" "")))]
5012 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5015 (define_insn "*adddf3_fpr"
5016 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5017 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5018 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5019 "TARGET_HARD_FLOAT && TARGET_FPRS"
5020 "{fa|fadd} %0,%1,%2"
5021 [(set_attr "type" "fp")])
5023 (define_expand "subdf3"
5024 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5025 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5026 (match_operand:DF 2 "gpc_reg_operand" "")))]
5027 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5030 (define_insn "*subdf3_fpr"
5031 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5032 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5033 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5034 "TARGET_HARD_FLOAT && TARGET_FPRS"
5035 "{fs|fsub} %0,%1,%2"
5036 [(set_attr "type" "fp")])
5038 (define_expand "muldf3"
5039 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5040 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5041 (match_operand:DF 2 "gpc_reg_operand" "")))]
5042 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5045 (define_insn "*muldf3_fpr"
5046 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5047 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5048 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5049 "TARGET_HARD_FLOAT && TARGET_FPRS"
5050 "{fm|fmul} %0,%1,%2"
5051 [(set_attr "type" "dmul")])
5054 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5055 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5056 "TARGET_POPCNTB && flag_finite_math_only"
5058 [(set_attr "type" "fp")])
5060 (define_expand "divdf3"
5061 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5062 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5063 (match_operand:DF 2 "gpc_reg_operand" "")))]
5064 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5066 if (swdiv && !optimize_size && TARGET_POPCNTB
5067 && flag_finite_math_only && !flag_trapping_math)
5069 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5074 (define_insn "*divdf3_fpr"
5075 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5076 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5077 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5078 "TARGET_HARD_FLOAT && TARGET_FPRS"
5079 "{fd|fdiv} %0,%1,%2"
5080 [(set_attr "type" "ddiv")])
5083 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5084 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5085 (match_operand:DF 2 "gpc_reg_operand" "f"))
5086 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5087 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5088 "{fma|fmadd} %0,%1,%2,%3"
5089 [(set_attr "type" "dmul")])
5092 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5093 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5094 (match_operand:DF 2 "gpc_reg_operand" "f"))
5095 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5096 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5097 "{fms|fmsub} %0,%1,%2,%3"
5098 [(set_attr "type" "dmul")])
5101 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5102 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5103 (match_operand:DF 2 "gpc_reg_operand" "f"))
5104 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5105 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5106 && HONOR_SIGNED_ZEROS (DFmode)"
5107 "{fnma|fnmadd} %0,%1,%2,%3"
5108 [(set_attr "type" "dmul")])
5111 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5112 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5113 (match_operand:DF 2 "gpc_reg_operand" "f"))
5114 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5115 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5116 && ! HONOR_SIGNED_ZEROS (DFmode)"
5117 "{fnma|fnmadd} %0,%1,%2,%3"
5118 [(set_attr "type" "dmul")])
5121 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5122 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5123 (match_operand:DF 2 "gpc_reg_operand" "f"))
5124 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5125 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5126 && HONOR_SIGNED_ZEROS (DFmode)"
5127 "{fnms|fnmsub} %0,%1,%2,%3"
5128 [(set_attr "type" "dmul")])
5131 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5132 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5133 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5134 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5135 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5136 && ! HONOR_SIGNED_ZEROS (DFmode)"
5137 "{fnms|fnmsub} %0,%1,%2,%3"
5138 [(set_attr "type" "dmul")])
5140 (define_insn "sqrtdf2"
5141 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5142 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5143 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5145 [(set_attr "type" "dsqrt")])
5147 ;; The conditional move instructions allow us to perform max and min
5148 ;; operations even when
5150 (define_expand "smaxdf3"
5151 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5152 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5153 (match_operand:DF 2 "gpc_reg_operand" ""))
5156 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5157 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5159 (define_expand "smindf3"
5160 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5161 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5162 (match_operand:DF 2 "gpc_reg_operand" ""))
5165 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5166 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5169 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5170 (match_operator:DF 3 "min_max_operator"
5171 [(match_operand:DF 1 "gpc_reg_operand" "")
5172 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5173 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5176 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5177 operands[1], operands[2]);
5181 (define_expand "movdfcc"
5182 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5183 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5184 (match_operand:DF 2 "gpc_reg_operand" "")
5185 (match_operand:DF 3 "gpc_reg_operand" "")))]
5186 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5189 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5195 (define_insn "*fseldfdf4"
5196 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5197 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5198 (match_operand:DF 4 "zero_fp_constant" "F"))
5199 (match_operand:DF 2 "gpc_reg_operand" "f")
5200 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5201 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5203 [(set_attr "type" "fp")])
5205 (define_insn "*fselsfdf4"
5206 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5207 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5208 (match_operand:SF 4 "zero_fp_constant" "F"))
5209 (match_operand:DF 2 "gpc_reg_operand" "f")
5210 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5213 [(set_attr "type" "fp")])
5215 ;; Conversions to and from floating-point.
5217 (define_expand "fixuns_truncsfsi2"
5218 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5219 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5220 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5223 (define_expand "fix_truncsfsi2"
5224 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5225 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5226 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5229 ; For each of these conversions, there is a define_expand, a define_insn
5230 ; with a '#' template, and a define_split (with C code). The idea is
5231 ; to allow constant folding with the template of the define_insn,
5232 ; then to have the insns split later (between sched1 and final).
5234 (define_expand "floatsidf2"
5235 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5236 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5239 (clobber (match_dup 4))
5240 (clobber (match_dup 5))
5241 (clobber (match_dup 6))])]
5242 "TARGET_HARD_FLOAT && TARGET_FPRS"
5245 if (TARGET_E500_DOUBLE)
5247 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5250 if (TARGET_POWERPC64)
5252 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5253 rtx t1 = gen_reg_rtx (DImode);
5254 rtx t2 = gen_reg_rtx (DImode);
5255 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5259 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5260 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5261 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5262 operands[5] = gen_reg_rtx (DFmode);
5263 operands[6] = gen_reg_rtx (SImode);
5266 (define_insn_and_split "*floatsidf2_internal"
5267 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5268 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5269 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5270 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5271 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5272 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5273 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5274 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5276 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5280 rtx lowword, highword;
5281 gcc_assert (MEM_P (operands[4]));
5282 highword = adjust_address (operands[4], SImode, 0);
5283 lowword = adjust_address (operands[4], SImode, 4);
5284 if (! WORDS_BIG_ENDIAN)
5287 tmp = highword; highword = lowword; lowword = tmp;
5290 emit_insn (gen_xorsi3 (operands[6], operands[1],
5291 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5292 emit_move_insn (lowword, operands[6]);
5293 emit_move_insn (highword, operands[2]);
5294 emit_move_insn (operands[5], operands[4]);
5295 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5298 [(set_attr "length" "24")])
5300 (define_expand "floatunssisf2"
5301 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5302 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5303 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5306 (define_expand "floatunssidf2"
5307 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5308 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5311 (clobber (match_dup 4))
5312 (clobber (match_dup 5))])]
5313 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5316 if (TARGET_E500_DOUBLE)
5318 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5321 if (TARGET_POWERPC64)
5323 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5324 rtx t1 = gen_reg_rtx (DImode);
5325 rtx t2 = gen_reg_rtx (DImode);
5326 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5331 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5332 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5333 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5334 operands[5] = gen_reg_rtx (DFmode);
5337 (define_insn_and_split "*floatunssidf2_internal"
5338 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5339 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5340 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5341 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5342 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5343 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5344 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5346 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5350 rtx lowword, highword;
5351 gcc_assert (MEM_P (operands[4]));
5352 highword = adjust_address (operands[4], SImode, 0);
5353 lowword = adjust_address (operands[4], SImode, 4);
5354 if (! WORDS_BIG_ENDIAN)
5357 tmp = highword; highword = lowword; lowword = tmp;
5360 emit_move_insn (lowword, operands[1]);
5361 emit_move_insn (highword, operands[2]);
5362 emit_move_insn (operands[5], operands[4]);
5363 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5366 [(set_attr "length" "20")])
5368 (define_expand "fix_truncdfsi2"
5369 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5370 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5371 (clobber (match_dup 2))
5372 (clobber (match_dup 3))])]
5373 "(TARGET_POWER2 || TARGET_POWERPC)
5374 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5377 if (TARGET_E500_DOUBLE)
5379 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5382 operands[2] = gen_reg_rtx (DImode);
5383 if (TARGET_PPC_GFXOPT)
5385 rtx orig_dest = operands[0];
5386 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5387 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5388 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5390 if (operands[0] != orig_dest)
5391 emit_move_insn (orig_dest, operands[0]);
5394 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5397 (define_insn_and_split "*fix_truncdfsi2_internal"
5398 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5399 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5400 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5401 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5402 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5404 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[3]))"
5409 gcc_assert (MEM_P (operands[3]));
5410 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5412 emit_insn (gen_fctiwz (operands[2], operands[1]));
5413 emit_move_insn (operands[3], operands[2]);
5414 emit_move_insn (operands[0], lowword);
5417 [(set_attr "length" "16")])
5419 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5420 [(set (match_operand:SI 0 "memory_operand" "=Z")
5421 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5422 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5423 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5424 && TARGET_PPC_GFXOPT"
5430 emit_insn (gen_fctiwz (operands[2], operands[1]));
5431 emit_insn (gen_stfiwx (operands[0], operands[2]));
5434 [(set_attr "length" "16")])
5436 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5437 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5438 ; because the first makes it clear that operand 0 is not live
5439 ; before the instruction.
5440 (define_insn "fctiwz"
5441 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5442 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5444 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5445 "{fcirz|fctiwz} %0,%1"
5446 [(set_attr "type" "fp")])
5448 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5449 (define_insn "stfiwx"
5450 [(set (match_operand:SI 0 "memory_operand" "=Z")
5451 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
5455 [(set_attr "type" "fpstore")])
5457 (define_expand "floatsisf2"
5458 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5459 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5460 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5463 (define_insn "floatdidf2"
5464 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5465 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5466 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5468 [(set_attr "type" "fp")])
5470 (define_insn_and_split "floatsidf_ppc64"
5471 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5472 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5473 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5474 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5475 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5476 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5479 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5480 (set (match_dup 2) (match_dup 3))
5481 (set (match_dup 4) (match_dup 2))
5482 (set (match_dup 0) (float:DF (match_dup 4)))]
5485 (define_insn_and_split "floatunssidf_ppc64"
5486 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5487 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5488 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5489 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5490 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5491 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5494 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5495 (set (match_dup 2) (match_dup 3))
5496 (set (match_dup 4) (match_dup 2))
5497 (set (match_dup 0) (float:DF (match_dup 4)))]
5500 (define_insn "fix_truncdfdi2"
5501 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5502 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5503 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5505 [(set_attr "type" "fp")])
5507 (define_expand "floatdisf2"
5508 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5509 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5510 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5513 rtx val = operands[1];
5514 if (!flag_unsafe_math_optimizations)
5516 rtx label = gen_label_rtx ();
5517 val = gen_reg_rtx (DImode);
5518 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5521 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5525 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5526 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5527 ;; from double rounding.
5528 (define_insn_and_split "floatdisf2_internal1"
5529 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5530 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5531 (clobber (match_scratch:DF 2 "=f"))]
5532 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5534 "&& reload_completed"
5536 (float:DF (match_dup 1)))
5538 (float_truncate:SF (match_dup 2)))]
5541 ;; Twiddles bits to avoid double rounding.
5542 ;; Bits that might be truncated when converting to DFmode are replaced
5543 ;; by a bit that won't be lost at that stage, but is below the SFmode
5544 ;; rounding position.
5545 (define_expand "floatdisf2_internal2"
5546 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
5548 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
5550 (clobber (scratch:CC))])
5551 (set (match_dup 3) (plus:DI (match_dup 3)
5553 (set (match_dup 0) (plus:DI (match_dup 0)
5555 (set (match_dup 4) (compare:CCUNS (match_dup 3)
5557 (set (match_dup 0) (ior:DI (match_dup 0)
5559 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
5561 (clobber (scratch:CC))])
5562 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
5563 (label_ref (match_operand:DI 2 "" ""))
5565 (set (match_dup 0) (match_dup 1))]
5566 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5569 operands[3] = gen_reg_rtx (DImode);
5570 operands[4] = gen_reg_rtx (CCUNSmode);
5573 ;; Define the DImode operations that can be done in a small number
5574 ;; of instructions. The & constraints are to prevent the register
5575 ;; allocator from allocating registers that overlap with the inputs
5576 ;; (for example, having an input in 7,8 and an output in 6,7). We
5577 ;; also allow for the output being the same as one of the inputs.
5579 (define_insn "*adddi3_noppc64"
5580 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5581 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5582 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5583 "! TARGET_POWERPC64"
5586 if (WORDS_BIG_ENDIAN)
5587 return (GET_CODE (operands[2])) != CONST_INT
5588 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5589 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5591 return (GET_CODE (operands[2])) != CONST_INT
5592 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5593 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5595 [(set_attr "type" "two")
5596 (set_attr "length" "8")])
5598 (define_insn "*subdi3_noppc64"
5599 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5600 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5601 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5602 "! TARGET_POWERPC64"
5605 if (WORDS_BIG_ENDIAN)
5606 return (GET_CODE (operands[1]) != CONST_INT)
5607 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5608 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5610 return (GET_CODE (operands[1]) != CONST_INT)
5611 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5612 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5614 [(set_attr "type" "two")
5615 (set_attr "length" "8")])
5617 (define_insn "*negdi2_noppc64"
5618 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5619 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5620 "! TARGET_POWERPC64"
5623 return (WORDS_BIG_ENDIAN)
5624 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5625 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5627 [(set_attr "type" "two")
5628 (set_attr "length" "8")])
5630 (define_expand "mulsidi3"
5631 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5632 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5633 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5634 "! TARGET_POWERPC64"
5637 if (! TARGET_POWER && ! TARGET_POWERPC)
5639 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5640 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5641 emit_insn (gen_mull_call ());
5642 if (WORDS_BIG_ENDIAN)
5643 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5646 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5647 gen_rtx_REG (SImode, 3));
5648 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5649 gen_rtx_REG (SImode, 4));
5653 else if (TARGET_POWER)
5655 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5660 (define_insn "mulsidi3_mq"
5661 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5662 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5663 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5664 (clobber (match_scratch:SI 3 "=q"))]
5666 "mul %0,%1,%2\;mfmq %L0"
5667 [(set_attr "type" "imul")
5668 (set_attr "length" "8")])
5670 (define_insn "*mulsidi3_no_mq"
5671 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5672 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5673 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5674 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5677 return (WORDS_BIG_ENDIAN)
5678 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5679 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5681 [(set_attr "type" "imul")
5682 (set_attr "length" "8")])
5685 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5686 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5687 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5688 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5691 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5692 (sign_extend:DI (match_dup 2)))
5695 (mult:SI (match_dup 1)
5699 int endian = (WORDS_BIG_ENDIAN == 0);
5700 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5701 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5704 (define_expand "umulsidi3"
5705 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5706 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5707 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5708 "TARGET_POWERPC && ! TARGET_POWERPC64"
5713 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5718 (define_insn "umulsidi3_mq"
5719 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5720 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5721 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5722 (clobber (match_scratch:SI 3 "=q"))]
5723 "TARGET_POWERPC && TARGET_POWER"
5726 return (WORDS_BIG_ENDIAN)
5727 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5728 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5730 [(set_attr "type" "imul")
5731 (set_attr "length" "8")])
5733 (define_insn "*umulsidi3_no_mq"
5734 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5735 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5736 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5737 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5740 return (WORDS_BIG_ENDIAN)
5741 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5742 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5744 [(set_attr "type" "imul")
5745 (set_attr "length" "8")])
5748 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5749 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5750 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5751 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5754 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5755 (zero_extend:DI (match_dup 2)))
5758 (mult:SI (match_dup 1)
5762 int endian = (WORDS_BIG_ENDIAN == 0);
5763 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5764 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5767 (define_expand "smulsi3_highpart"
5768 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5770 (lshiftrt:DI (mult:DI (sign_extend:DI
5771 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5773 (match_operand:SI 2 "gpc_reg_operand" "r")))
5778 if (! TARGET_POWER && ! TARGET_POWERPC)
5780 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5781 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5782 emit_insn (gen_mulh_call ());
5783 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5786 else if (TARGET_POWER)
5788 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5793 (define_insn "smulsi3_highpart_mq"
5794 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5796 (lshiftrt:DI (mult:DI (sign_extend:DI
5797 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5799 (match_operand:SI 2 "gpc_reg_operand" "r")))
5801 (clobber (match_scratch:SI 3 "=q"))]
5804 [(set_attr "type" "imul")])
5806 (define_insn "*smulsi3_highpart_no_mq"
5807 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5809 (lshiftrt:DI (mult:DI (sign_extend:DI
5810 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5812 (match_operand:SI 2 "gpc_reg_operand" "r")))
5814 "TARGET_POWERPC && ! TARGET_POWER"
5816 [(set_attr "type" "imul")])
5818 (define_expand "umulsi3_highpart"
5819 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5821 (lshiftrt:DI (mult:DI (zero_extend:DI
5822 (match_operand:SI 1 "gpc_reg_operand" ""))
5824 (match_operand:SI 2 "gpc_reg_operand" "")))
5831 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5836 (define_insn "umulsi3_highpart_mq"
5837 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5839 (lshiftrt:DI (mult:DI (zero_extend:DI
5840 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5842 (match_operand:SI 2 "gpc_reg_operand" "r")))
5844 (clobber (match_scratch:SI 3 "=q"))]
5845 "TARGET_POWERPC && TARGET_POWER"
5847 [(set_attr "type" "imul")])
5849 (define_insn "*umulsi3_highpart_no_mq"
5850 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5852 (lshiftrt:DI (mult:DI (zero_extend:DI
5853 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5855 (match_operand:SI 2 "gpc_reg_operand" "r")))
5857 "TARGET_POWERPC && ! TARGET_POWER"
5859 [(set_attr "type" "imul")])
5861 ;; If operands 0 and 2 are in the same register, we have a problem. But
5862 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5863 ;; why we have the strange constraints below.
5864 (define_insn "ashldi3_power"
5865 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5866 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5867 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5868 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5871 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5872 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5873 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5874 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5875 [(set_attr "length" "8")])
5877 (define_insn "lshrdi3_power"
5878 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5879 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5880 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5881 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5884 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5885 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5886 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5887 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5888 [(set_attr "length" "8")])
5890 ;; Shift by a variable amount is too complex to be worth open-coding. We
5891 ;; just handle shifts by constants.
5892 (define_insn "ashrdi3_power"
5893 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5894 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5895 (match_operand:SI 2 "const_int_operand" "M,i")))
5896 (clobber (match_scratch:SI 3 "=X,q"))]
5899 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5900 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5901 [(set_attr "length" "8")])
5903 (define_insn "ashrdi3_no_power"
5904 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5905 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5906 (match_operand:SI 2 "const_int_operand" "M,i")))]
5907 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5909 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5910 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5911 [(set_attr "type" "two,three")
5912 (set_attr "length" "8,12")])
5914 (define_insn "*ashrdisi3_noppc64"
5915 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5916 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5917 (const_int 32)) 4))]
5918 "TARGET_32BIT && !TARGET_POWERPC64"
5921 if (REGNO (operands[0]) == REGNO (operands[1]))
5924 return \"mr %0,%1\";
5926 [(set_attr "length" "4")])
5929 ;; PowerPC64 DImode operations.
5931 (define_insn_and_split "absdi2"
5932 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5933 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5934 (clobber (match_scratch:DI 2 "=&r,&r"))]
5937 "&& reload_completed"
5938 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5939 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5940 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5943 (define_insn_and_split "*nabsdi2"
5944 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5945 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5946 (clobber (match_scratch:DI 2 "=&r,&r"))]
5949 "&& reload_completed"
5950 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5951 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5952 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
5955 (define_insn "muldi3"
5956 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5957 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5958 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5961 [(set_attr "type" "lmul")])
5963 (define_insn "*muldi3_internal1"
5964 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5965 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
5966 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5968 (clobber (match_scratch:DI 3 "=r,r"))]
5973 [(set_attr "type" "lmul_compare")
5974 (set_attr "length" "4,8")])
5977 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5978 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
5979 (match_operand:DI 2 "gpc_reg_operand" ""))
5981 (clobber (match_scratch:DI 3 ""))]
5982 "TARGET_POWERPC64 && reload_completed"
5984 (mult:DI (match_dup 1) (match_dup 2)))
5986 (compare:CC (match_dup 3)
5990 (define_insn "*muldi3_internal2"
5991 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5992 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
5993 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5995 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5996 (mult:DI (match_dup 1) (match_dup 2)))]
6001 [(set_attr "type" "lmul_compare")
6002 (set_attr "length" "4,8")])
6005 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6006 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6007 (match_operand:DI 2 "gpc_reg_operand" ""))
6009 (set (match_operand:DI 0 "gpc_reg_operand" "")
6010 (mult:DI (match_dup 1) (match_dup 2)))]
6011 "TARGET_POWERPC64 && reload_completed"
6013 (mult:DI (match_dup 1) (match_dup 2)))
6015 (compare:CC (match_dup 0)
6019 (define_insn "smuldi3_highpart"
6020 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6022 (lshiftrt:TI (mult:TI (sign_extend:TI
6023 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6025 (match_operand:DI 2 "gpc_reg_operand" "r")))
6029 [(set_attr "type" "lmul")])
6031 (define_insn "umuldi3_highpart"
6032 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6034 (lshiftrt:TI (mult:TI (zero_extend:TI
6035 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6037 (match_operand:DI 2 "gpc_reg_operand" "r")))
6041 [(set_attr "type" "lmul")])
6043 (define_insn "rotldi3"
6044 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6045 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6046 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6048 "rld%I2cl %0,%1,%H2,0")
6050 (define_insn "*rotldi3_internal2"
6051 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6052 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6053 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6055 (clobber (match_scratch:DI 3 "=r,r"))]
6058 rld%I2cl. %3,%1,%H2,0
6060 [(set_attr "type" "delayed_compare")
6061 (set_attr "length" "4,8")])
6064 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6065 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6066 (match_operand:DI 2 "reg_or_cint_operand" ""))
6068 (clobber (match_scratch:DI 3 ""))]
6069 "TARGET_POWERPC64 && reload_completed"
6071 (rotate:DI (match_dup 1) (match_dup 2)))
6073 (compare:CC (match_dup 3)
6077 (define_insn "*rotldi3_internal3"
6078 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6079 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6080 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6082 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6083 (rotate:DI (match_dup 1) (match_dup 2)))]
6086 rld%I2cl. %0,%1,%H2,0
6088 [(set_attr "type" "delayed_compare")
6089 (set_attr "length" "4,8")])
6092 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6093 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6094 (match_operand:DI 2 "reg_or_cint_operand" ""))
6096 (set (match_operand:DI 0 "gpc_reg_operand" "")
6097 (rotate:DI (match_dup 1) (match_dup 2)))]
6098 "TARGET_POWERPC64 && reload_completed"
6100 (rotate:DI (match_dup 1) (match_dup 2)))
6102 (compare:CC (match_dup 0)
6106 (define_insn "*rotldi3_internal4"
6107 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6108 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6109 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6110 (match_operand:DI 3 "mask_operand" "n")))]
6112 "rld%I2c%B3 %0,%1,%H2,%S3")
6114 (define_insn "*rotldi3_internal5"
6115 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6117 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6118 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6119 (match_operand:DI 3 "mask_operand" "n,n"))
6121 (clobber (match_scratch:DI 4 "=r,r"))]
6124 rld%I2c%B3. %4,%1,%H2,%S3
6126 [(set_attr "type" "delayed_compare")
6127 (set_attr "length" "4,8")])
6130 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6132 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6133 (match_operand:DI 2 "reg_or_cint_operand" ""))
6134 (match_operand:DI 3 "mask_operand" ""))
6136 (clobber (match_scratch:DI 4 ""))]
6137 "TARGET_POWERPC64 && reload_completed"
6139 (and:DI (rotate:DI (match_dup 1)
6143 (compare:CC (match_dup 4)
6147 (define_insn "*rotldi3_internal6"
6148 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6150 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6151 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6152 (match_operand:DI 3 "mask_operand" "n,n"))
6154 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6155 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6158 rld%I2c%B3. %0,%1,%H2,%S3
6160 [(set_attr "type" "delayed_compare")
6161 (set_attr "length" "4,8")])
6164 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6166 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6167 (match_operand:DI 2 "reg_or_cint_operand" ""))
6168 (match_operand:DI 3 "mask_operand" ""))
6170 (set (match_operand:DI 0 "gpc_reg_operand" "")
6171 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6172 "TARGET_POWERPC64 && reload_completed"
6174 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6176 (compare:CC (match_dup 0)
6180 (define_insn "*rotldi3_internal7"
6181 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6184 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6185 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6187 "rld%I2cl %0,%1,%H2,56")
6189 (define_insn "*rotldi3_internal8"
6190 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6191 (compare:CC (zero_extend:DI
6193 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6194 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6196 (clobber (match_scratch:DI 3 "=r,r"))]
6199 rld%I2cl. %3,%1,%H2,56
6201 [(set_attr "type" "delayed_compare")
6202 (set_attr "length" "4,8")])
6205 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6206 (compare:CC (zero_extend:DI
6208 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6209 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6211 (clobber (match_scratch:DI 3 ""))]
6212 "TARGET_POWERPC64 && reload_completed"
6214 (zero_extend:DI (subreg:QI
6215 (rotate:DI (match_dup 1)
6218 (compare:CC (match_dup 3)
6222 (define_insn "*rotldi3_internal9"
6223 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6224 (compare:CC (zero_extend:DI
6226 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6227 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6229 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6230 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6233 rld%I2cl. %0,%1,%H2,56
6235 [(set_attr "type" "delayed_compare")
6236 (set_attr "length" "4,8")])
6239 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6240 (compare:CC (zero_extend:DI
6242 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6243 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6245 (set (match_operand:DI 0 "gpc_reg_operand" "")
6246 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6247 "TARGET_POWERPC64 && reload_completed"
6249 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6251 (compare:CC (match_dup 0)
6255 (define_insn "*rotldi3_internal10"
6256 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6259 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6260 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6262 "rld%I2cl %0,%1,%H2,48")
6264 (define_insn "*rotldi3_internal11"
6265 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6266 (compare:CC (zero_extend:DI
6268 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6269 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6271 (clobber (match_scratch:DI 3 "=r,r"))]
6274 rld%I2cl. %3,%1,%H2,48
6276 [(set_attr "type" "delayed_compare")
6277 (set_attr "length" "4,8")])
6280 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6281 (compare:CC (zero_extend:DI
6283 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6284 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6286 (clobber (match_scratch:DI 3 ""))]
6287 "TARGET_POWERPC64 && reload_completed"
6289 (zero_extend:DI (subreg:HI
6290 (rotate:DI (match_dup 1)
6293 (compare:CC (match_dup 3)
6297 (define_insn "*rotldi3_internal12"
6298 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6299 (compare:CC (zero_extend:DI
6301 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6302 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6304 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6305 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6308 rld%I2cl. %0,%1,%H2,48
6310 [(set_attr "type" "delayed_compare")
6311 (set_attr "length" "4,8")])
6314 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6315 (compare:CC (zero_extend:DI
6317 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6318 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6320 (set (match_operand:DI 0 "gpc_reg_operand" "")
6321 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6322 "TARGET_POWERPC64 && reload_completed"
6324 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6326 (compare:CC (match_dup 0)
6330 (define_insn "*rotldi3_internal13"
6331 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6334 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6335 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6337 "rld%I2cl %0,%1,%H2,32")
6339 (define_insn "*rotldi3_internal14"
6340 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6341 (compare:CC (zero_extend:DI
6343 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6344 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6346 (clobber (match_scratch:DI 3 "=r,r"))]
6349 rld%I2cl. %3,%1,%H2,32
6351 [(set_attr "type" "delayed_compare")
6352 (set_attr "length" "4,8")])
6355 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6356 (compare:CC (zero_extend:DI
6358 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6359 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6361 (clobber (match_scratch:DI 3 ""))]
6362 "TARGET_POWERPC64 && reload_completed"
6364 (zero_extend:DI (subreg:SI
6365 (rotate:DI (match_dup 1)
6368 (compare:CC (match_dup 3)
6372 (define_insn "*rotldi3_internal15"
6373 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6374 (compare:CC (zero_extend:DI
6376 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6377 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6379 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6380 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6383 rld%I2cl. %0,%1,%H2,32
6385 [(set_attr "type" "delayed_compare")
6386 (set_attr "length" "4,8")])
6389 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6390 (compare:CC (zero_extend:DI
6392 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6393 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6395 (set (match_operand:DI 0 "gpc_reg_operand" "")
6396 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6397 "TARGET_POWERPC64 && reload_completed"
6399 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6401 (compare:CC (match_dup 0)
6405 (define_expand "ashldi3"
6406 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6407 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6408 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6409 "TARGET_POWERPC64 || TARGET_POWER"
6412 if (TARGET_POWERPC64)
6414 else if (TARGET_POWER)
6416 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6423 (define_insn "*ashldi3_internal1"
6424 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6425 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6426 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6430 (define_insn "*ashldi3_internal2"
6431 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6432 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6433 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6435 (clobber (match_scratch:DI 3 "=r,r"))]
6440 [(set_attr "type" "delayed_compare")
6441 (set_attr "length" "4,8")])
6444 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6445 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6446 (match_operand:SI 2 "reg_or_cint_operand" ""))
6448 (clobber (match_scratch:DI 3 ""))]
6449 "TARGET_POWERPC64 && reload_completed"
6451 (ashift:DI (match_dup 1) (match_dup 2)))
6453 (compare:CC (match_dup 3)
6457 (define_insn "*ashldi3_internal3"
6458 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6459 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6460 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6462 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6463 (ashift:DI (match_dup 1) (match_dup 2)))]
6468 [(set_attr "type" "delayed_compare")
6469 (set_attr "length" "4,8")])
6472 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6473 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6474 (match_operand:SI 2 "reg_or_cint_operand" ""))
6476 (set (match_operand:DI 0 "gpc_reg_operand" "")
6477 (ashift:DI (match_dup 1) (match_dup 2)))]
6478 "TARGET_POWERPC64 && reload_completed"
6480 (ashift:DI (match_dup 1) (match_dup 2)))
6482 (compare:CC (match_dup 0)
6486 (define_insn "*ashldi3_internal4"
6487 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6488 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6489 (match_operand:SI 2 "const_int_operand" "i"))
6490 (match_operand:DI 3 "const_int_operand" "n")))]
6491 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6492 "rldic %0,%1,%H2,%W3")
6494 (define_insn "ashldi3_internal5"
6495 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6497 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6498 (match_operand:SI 2 "const_int_operand" "i,i"))
6499 (match_operand:DI 3 "const_int_operand" "n,n"))
6501 (clobber (match_scratch:DI 4 "=r,r"))]
6502 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6504 rldic. %4,%1,%H2,%W3
6506 [(set_attr "type" "delayed_compare")
6507 (set_attr "length" "4,8")])
6510 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6512 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6513 (match_operand:SI 2 "const_int_operand" ""))
6514 (match_operand:DI 3 "const_int_operand" ""))
6516 (clobber (match_scratch:DI 4 ""))]
6517 "TARGET_POWERPC64 && reload_completed
6518 && includes_rldic_lshift_p (operands[2], operands[3])"
6520 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6523 (compare:CC (match_dup 4)
6527 (define_insn "*ashldi3_internal6"
6528 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6530 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6531 (match_operand:SI 2 "const_int_operand" "i,i"))
6532 (match_operand:DI 3 "const_int_operand" "n,n"))
6534 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6535 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6536 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6538 rldic. %0,%1,%H2,%W3
6540 [(set_attr "type" "delayed_compare")
6541 (set_attr "length" "4,8")])
6544 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6546 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6547 (match_operand:SI 2 "const_int_operand" ""))
6548 (match_operand:DI 3 "const_int_operand" ""))
6550 (set (match_operand:DI 0 "gpc_reg_operand" "")
6551 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6552 "TARGET_POWERPC64 && reload_completed
6553 && includes_rldic_lshift_p (operands[2], operands[3])"
6555 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6558 (compare:CC (match_dup 0)
6562 (define_insn "*ashldi3_internal7"
6563 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6564 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6565 (match_operand:SI 2 "const_int_operand" "i"))
6566 (match_operand:DI 3 "mask_operand" "n")))]
6567 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6568 "rldicr %0,%1,%H2,%S3")
6570 (define_insn "ashldi3_internal8"
6571 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6573 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6574 (match_operand:SI 2 "const_int_operand" "i,i"))
6575 (match_operand:DI 3 "mask_operand" "n,n"))
6577 (clobber (match_scratch:DI 4 "=r,r"))]
6578 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6580 rldicr. %4,%1,%H2,%S3
6582 [(set_attr "type" "delayed_compare")
6583 (set_attr "length" "4,8")])
6586 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6588 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6589 (match_operand:SI 2 "const_int_operand" ""))
6590 (match_operand:DI 3 "mask_operand" ""))
6592 (clobber (match_scratch:DI 4 ""))]
6593 "TARGET_POWERPC64 && reload_completed
6594 && includes_rldicr_lshift_p (operands[2], operands[3])"
6596 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6599 (compare:CC (match_dup 4)
6603 (define_insn "*ashldi3_internal9"
6604 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6606 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6607 (match_operand:SI 2 "const_int_operand" "i,i"))
6608 (match_operand:DI 3 "mask_operand" "n,n"))
6610 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6611 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6612 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6614 rldicr. %0,%1,%H2,%S3
6616 [(set_attr "type" "delayed_compare")
6617 (set_attr "length" "4,8")])
6620 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6622 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6623 (match_operand:SI 2 "const_int_operand" ""))
6624 (match_operand:DI 3 "mask_operand" ""))
6626 (set (match_operand:DI 0 "gpc_reg_operand" "")
6627 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6628 "TARGET_POWERPC64 && reload_completed
6629 && includes_rldicr_lshift_p (operands[2], operands[3])"
6631 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6634 (compare:CC (match_dup 0)
6638 (define_expand "lshrdi3"
6639 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6640 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6641 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6642 "TARGET_POWERPC64 || TARGET_POWER"
6645 if (TARGET_POWERPC64)
6647 else if (TARGET_POWER)
6649 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6656 (define_insn "*lshrdi3_internal1"
6657 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6658 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6659 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6663 (define_insn "*lshrdi3_internal2"
6664 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6665 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6666 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6668 (clobber (match_scratch:DI 3 "=r,r"))]
6673 [(set_attr "type" "delayed_compare")
6674 (set_attr "length" "4,8")])
6677 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6678 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6679 (match_operand:SI 2 "reg_or_cint_operand" ""))
6681 (clobber (match_scratch:DI 3 ""))]
6682 "TARGET_POWERPC64 && reload_completed"
6684 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6686 (compare:CC (match_dup 3)
6690 (define_insn "*lshrdi3_internal3"
6691 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6692 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6693 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6695 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6696 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6701 [(set_attr "type" "delayed_compare")
6702 (set_attr "length" "4,8")])
6705 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6706 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6707 (match_operand:SI 2 "reg_or_cint_operand" ""))
6709 (set (match_operand:DI 0 "gpc_reg_operand" "")
6710 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6711 "TARGET_POWERPC64 && reload_completed"
6713 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6715 (compare:CC (match_dup 0)
6719 (define_expand "ashrdi3"
6720 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6721 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6722 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6726 if (TARGET_POWERPC64)
6728 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6730 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
6733 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
6734 && WORDS_BIG_ENDIAN)
6736 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
6743 (define_insn "*ashrdi3_internal1"
6744 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6745 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6746 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6748 "srad%I2 %0,%1,%H2")
6750 (define_insn "*ashrdi3_internal2"
6751 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6752 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6753 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6755 (clobber (match_scratch:DI 3 "=r,r"))]
6760 [(set_attr "type" "delayed_compare")
6761 (set_attr "length" "4,8")])
6764 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6765 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6766 (match_operand:SI 2 "reg_or_cint_operand" ""))
6768 (clobber (match_scratch:DI 3 ""))]
6769 "TARGET_POWERPC64 && reload_completed"
6771 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6773 (compare:CC (match_dup 3)
6777 (define_insn "*ashrdi3_internal3"
6778 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6779 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6780 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6782 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6783 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6788 [(set_attr "type" "delayed_compare")
6789 (set_attr "length" "4,8")])
6792 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6793 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6794 (match_operand:SI 2 "reg_or_cint_operand" ""))
6796 (set (match_operand:DI 0 "gpc_reg_operand" "")
6797 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6798 "TARGET_POWERPC64 && reload_completed"
6800 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6802 (compare:CC (match_dup 0)
6806 (define_insn "anddi3"
6807 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
6808 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
6809 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
6810 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
6814 rldic%B2 %0,%1,0,%S2
6815 rlwinm %0,%1,0,%m2,%M2
6819 [(set_attr "type" "*,*,*,compare,compare,*")
6820 (set_attr "length" "4,4,4,4,4,8")])
6823 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6824 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6825 (match_operand:DI 2 "mask64_2_operand" "")))
6826 (clobber (match_scratch:CC 3 ""))]
6828 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6829 && !mask_operand (operands[2], DImode)"
6831 (and:DI (rotate:DI (match_dup 1)
6835 (and:DI (rotate:DI (match_dup 0)
6839 build_mask64_2_operands (operands[2], &operands[4]);
6842 (define_insn "*anddi3_internal2"
6843 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
6844 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
6845 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
6847 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
6848 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
6852 rldic%B2. %3,%1,0,%S2
6861 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
6862 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
6865 [(set (match_operand:CC 0 "cc_reg_operand" "")
6866 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6867 (match_operand:DI 2 "mask64_2_operand" ""))
6869 (clobber (match_scratch:DI 3 ""))
6870 (clobber (match_scratch:CC 4 ""))]
6871 "TARGET_POWERPC64 && reload_completed
6872 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6873 && !mask_operand (operands[2], DImode)"
6875 (and:DI (rotate:DI (match_dup 1)
6878 (parallel [(set (match_dup 0)
6879 (compare:CC (and:DI (rotate:DI (match_dup 3)
6883 (clobber (match_dup 3))])]
6886 build_mask64_2_operands (operands[2], &operands[5]);
6889 (define_insn "*anddi3_internal3"
6890 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
6891 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
6892 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
6894 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
6895 (and:DI (match_dup 1) (match_dup 2)))
6896 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
6900 rldic%B2. %0,%1,0,%S2
6909 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
6910 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
6913 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6914 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6915 (match_operand:DI 2 "and_operand" ""))
6917 (set (match_operand:DI 0 "gpc_reg_operand" "")
6918 (and:DI (match_dup 1) (match_dup 2)))
6919 (clobber (match_scratch:CC 4 ""))]
6920 "TARGET_POWERPC64 && reload_completed"
6921 [(parallel [(set (match_dup 0)
6922 (and:DI (match_dup 1) (match_dup 2)))
6923 (clobber (match_dup 4))])
6925 (compare:CC (match_dup 0)
6930 [(set (match_operand:CC 3 "cc_reg_operand" "")
6931 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6932 (match_operand:DI 2 "mask64_2_operand" ""))
6934 (set (match_operand:DI 0 "gpc_reg_operand" "")
6935 (and:DI (match_dup 1) (match_dup 2)))
6936 (clobber (match_scratch:CC 4 ""))]
6937 "TARGET_POWERPC64 && reload_completed
6938 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6939 && !mask_operand (operands[2], DImode)"
6941 (and:DI (rotate:DI (match_dup 1)
6944 (parallel [(set (match_dup 3)
6945 (compare:CC (and:DI (rotate:DI (match_dup 0)
6950 (and:DI (rotate:DI (match_dup 0)
6955 build_mask64_2_operands (operands[2], &operands[5]);
6958 (define_expand "iordi3"
6959 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6960 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
6961 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
6965 if (non_logical_cint_operand (operands[2], DImode))
6967 HOST_WIDE_INT value;
6968 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
6969 ? operands[0] : gen_reg_rtx (DImode));
6971 if (GET_CODE (operands[2]) == CONST_INT)
6973 value = INTVAL (operands[2]);
6974 emit_insn (gen_iordi3 (tmp, operands[1],
6975 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
6979 value = CONST_DOUBLE_LOW (operands[2]);
6980 emit_insn (gen_iordi3 (tmp, operands[1],
6981 immed_double_const (value
6982 & (~ (HOST_WIDE_INT) 0xffff),
6986 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
6991 (define_expand "xordi3"
6992 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6993 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
6994 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
6998 if (non_logical_cint_operand (operands[2], DImode))
7000 HOST_WIDE_INT value;
7001 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
7002 ? operands[0] : gen_reg_rtx (DImode));
7004 if (GET_CODE (operands[2]) == CONST_INT)
7006 value = INTVAL (operands[2]);
7007 emit_insn (gen_xordi3 (tmp, operands[1],
7008 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7012 value = CONST_DOUBLE_LOW (operands[2]);
7013 emit_insn (gen_xordi3 (tmp, operands[1],
7014 immed_double_const (value
7015 & (~ (HOST_WIDE_INT) 0xffff),
7019 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7024 (define_insn "*booldi3_internal1"
7025 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7026 (match_operator:DI 3 "boolean_or_operator"
7027 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7028 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7035 (define_insn "*booldi3_internal2"
7036 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7037 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7038 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7039 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7041 (clobber (match_scratch:DI 3 "=r,r"))]
7046 [(set_attr "type" "compare")
7047 (set_attr "length" "4,8")])
7050 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7051 (compare:CC (match_operator:DI 4 "boolean_operator"
7052 [(match_operand:DI 1 "gpc_reg_operand" "")
7053 (match_operand:DI 2 "gpc_reg_operand" "")])
7055 (clobber (match_scratch:DI 3 ""))]
7056 "TARGET_POWERPC64 && reload_completed"
7057 [(set (match_dup 3) (match_dup 4))
7059 (compare:CC (match_dup 3)
7063 (define_insn "*booldi3_internal3"
7064 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7065 (compare:CC (match_operator:DI 4 "boolean_operator"
7066 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7067 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7069 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7075 [(set_attr "type" "compare")
7076 (set_attr "length" "4,8")])
7079 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7080 (compare:CC (match_operator:DI 4 "boolean_operator"
7081 [(match_operand:DI 1 "gpc_reg_operand" "")
7082 (match_operand:DI 2 "gpc_reg_operand" "")])
7084 (set (match_operand:DI 0 "gpc_reg_operand" "")
7086 "TARGET_POWERPC64 && reload_completed"
7087 [(set (match_dup 0) (match_dup 4))
7089 (compare:CC (match_dup 0)
7093 ;; Split a logical operation that we can't do in one insn into two insns,
7094 ;; each of which does one 16-bit part. This is used by combine.
7097 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7098 (match_operator:DI 3 "boolean_or_operator"
7099 [(match_operand:DI 1 "gpc_reg_operand" "")
7100 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7102 [(set (match_dup 0) (match_dup 4))
7103 (set (match_dup 0) (match_dup 5))]
7108 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7110 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7111 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7113 i4 = GEN_INT (value & 0xffff);
7117 i3 = GEN_INT (INTVAL (operands[2])
7118 & (~ (HOST_WIDE_INT) 0xffff));
7119 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7121 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7123 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7127 (define_insn "*boolcdi3_internal1"
7128 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7129 (match_operator:DI 3 "boolean_operator"
7130 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7131 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7135 (define_insn "*boolcdi3_internal2"
7136 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7137 (compare:CC (match_operator:DI 4 "boolean_operator"
7138 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7139 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7141 (clobber (match_scratch:DI 3 "=r,r"))]
7146 [(set_attr "type" "compare")
7147 (set_attr "length" "4,8")])
7150 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7151 (compare:CC (match_operator:DI 4 "boolean_operator"
7152 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7153 (match_operand:DI 2 "gpc_reg_operand" "")])
7155 (clobber (match_scratch:DI 3 ""))]
7156 "TARGET_POWERPC64 && reload_completed"
7157 [(set (match_dup 3) (match_dup 4))
7159 (compare:CC (match_dup 3)
7163 (define_insn "*boolcdi3_internal3"
7164 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7165 (compare:CC (match_operator:DI 4 "boolean_operator"
7166 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7167 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7169 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7175 [(set_attr "type" "compare")
7176 (set_attr "length" "4,8")])
7179 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7180 (compare:CC (match_operator:DI 4 "boolean_operator"
7181 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7182 (match_operand:DI 2 "gpc_reg_operand" "")])
7184 (set (match_operand:DI 0 "gpc_reg_operand" "")
7186 "TARGET_POWERPC64 && reload_completed"
7187 [(set (match_dup 0) (match_dup 4))
7189 (compare:CC (match_dup 0)
7193 (define_insn "*boolccdi3_internal1"
7194 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7195 (match_operator:DI 3 "boolean_operator"
7196 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7197 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7201 (define_insn "*boolccdi3_internal2"
7202 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7203 (compare:CC (match_operator:DI 4 "boolean_operator"
7204 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7205 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7207 (clobber (match_scratch:DI 3 "=r,r"))]
7212 [(set_attr "type" "compare")
7213 (set_attr "length" "4,8")])
7216 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7217 (compare:CC (match_operator:DI 4 "boolean_operator"
7218 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7219 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7221 (clobber (match_scratch:DI 3 ""))]
7222 "TARGET_POWERPC64 && reload_completed"
7223 [(set (match_dup 3) (match_dup 4))
7225 (compare:CC (match_dup 3)
7229 (define_insn "*boolccdi3_internal3"
7230 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7231 (compare:CC (match_operator:DI 4 "boolean_operator"
7232 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7233 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7235 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7241 [(set_attr "type" "compare")
7242 (set_attr "length" "4,8")])
7245 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7246 (compare:CC (match_operator:DI 4 "boolean_operator"
7247 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7248 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7250 (set (match_operand:DI 0 "gpc_reg_operand" "")
7252 "TARGET_POWERPC64 && reload_completed"
7253 [(set (match_dup 0) (match_dup 4))
7255 (compare:CC (match_dup 0)
7259 ;; Now define ways of moving data around.
7261 ;; Set up a register with a value from the GOT table
7263 (define_expand "movsi_got"
7264 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7265 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7266 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7267 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7270 if (GET_CODE (operands[1]) == CONST)
7272 rtx offset = const0_rtx;
7273 HOST_WIDE_INT value;
7275 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7276 value = INTVAL (offset);
7279 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7280 emit_insn (gen_movsi_got (tmp, operands[1]));
7281 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7286 operands[2] = rs6000_got_register (operands[1]);
7289 (define_insn "*movsi_got_internal"
7290 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7291 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7292 (match_operand:SI 2 "gpc_reg_operand" "b")]
7294 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7295 "{l|lwz} %0,%a1@got(%2)"
7296 [(set_attr "type" "load")])
7298 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7299 ;; didn't get allocated to a hard register.
7301 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7302 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7303 (match_operand:SI 2 "memory_operand" "")]
7305 "DEFAULT_ABI == ABI_V4
7307 && (reload_in_progress || reload_completed)"
7308 [(set (match_dup 0) (match_dup 2))
7309 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7313 ;; For SI, we special-case integers that can't be loaded in one insn. We
7314 ;; do the load 16-bits at a time. We could do this by loading from memory,
7315 ;; and this is even supposed to be faster, but it is simpler not to get
7316 ;; integers in the TOC.
7317 (define_insn "movsi_low"
7318 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7319 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7320 (match_operand 2 "" ""))))]
7321 "TARGET_MACHO && ! TARGET_64BIT"
7322 "{l|lwz} %0,lo16(%2)(%1)"
7323 [(set_attr "type" "load")
7324 (set_attr "length" "4")])
7326 (define_insn "*movsi_internal1"
7327 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7328 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7329 "gpc_reg_operand (operands[0], SImode)
7330 || gpc_reg_operand (operands[1], SImode)"
7334 {l%U1%X1|lwz%U1%X1} %0,%1
7335 {st%U0%X0|stw%U0%X0} %1,%0
7345 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7346 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7348 ;; Split a load of a large constant into the appropriate two-insn
7352 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7353 (match_operand:SI 1 "const_int_operand" ""))]
7354 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7355 && (INTVAL (operands[1]) & 0xffff) != 0"
7359 (ior:SI (match_dup 0)
7362 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7364 if (tem == operands[0])
7370 (define_insn "*mov<mode>_internal2"
7371 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7372 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7374 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7377 {cmpi|cmp<wd>i} %2,%0,0
7380 [(set_attr "type" "cmp,compare,cmp")
7381 (set_attr "length" "4,4,8")])
7384 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7385 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7387 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7389 [(set (match_dup 0) (match_dup 1))
7391 (compare:CC (match_dup 0)
7395 (define_insn "*movhi_internal"
7396 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7397 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7398 "gpc_reg_operand (operands[0], HImode)
7399 || gpc_reg_operand (operands[1], HImode)"
7409 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7411 (define_expand "mov<mode>"
7412 [(set (match_operand:INT 0 "general_operand" "")
7413 (match_operand:INT 1 "any_operand" ""))]
7415 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7417 (define_insn "*movqi_internal"
7418 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7419 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7420 "gpc_reg_operand (operands[0], QImode)
7421 || gpc_reg_operand (operands[1], QImode)"
7431 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7433 ;; Here is how to move condition codes around. When we store CC data in
7434 ;; an integer register or memory, we store just the high-order 4 bits.
7435 ;; This lets us not shift in the most common case of CR0.
7436 (define_expand "movcc"
7437 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7438 (match_operand:CC 1 "nonimmediate_operand" ""))]
7442 (define_insn "*movcc_internal1"
7443 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7444 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7445 "register_operand (operands[0], CCmode)
7446 || register_operand (operands[1], CCmode)"
7450 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7452 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7457 {l%U1%X1|lwz%U1%X1} %0,%1
7458 {st%U0%U1|stw%U0%U1} %1,%0"
7460 (cond [(eq_attr "alternative" "0")
7461 (const_string "cr_logical")
7462 (eq_attr "alternative" "1,2")
7463 (const_string "mtcr")
7464 (eq_attr "alternative" "5,7")
7465 (const_string "integer")
7466 (eq_attr "alternative" "6")
7467 (const_string "mfjmpr")
7468 (eq_attr "alternative" "8")
7469 (const_string "mtjmpr")
7470 (eq_attr "alternative" "9")
7471 (const_string "load")
7472 (eq_attr "alternative" "10")
7473 (const_string "store")
7474 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7475 (const_string "mfcrf")
7477 (const_string "mfcr")))
7478 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7480 ;; For floating-point, we normally deal with the floating-point registers
7481 ;; unless -msoft-float is used. The sole exception is that parameter passing
7482 ;; can produce floating-point values in fixed-point registers. Unless the
7483 ;; value is a simple constant or already in memory, we deal with this by
7484 ;; allocating memory and copying the value explicitly via that memory location.
7485 (define_expand "movsf"
7486 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7487 (match_operand:SF 1 "any_operand" ""))]
7489 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7492 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7493 (match_operand:SF 1 "const_double_operand" ""))]
7495 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7496 || (GET_CODE (operands[0]) == SUBREG
7497 && GET_CODE (SUBREG_REG (operands[0])) == REG
7498 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7499 [(set (match_dup 2) (match_dup 3))]
7505 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7506 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7508 if (! TARGET_POWERPC64)
7509 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7511 operands[2] = gen_lowpart (SImode, operands[0]);
7513 operands[3] = gen_int_mode (l, SImode);
7516 (define_insn "*movsf_hardfloat"
7517 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7518 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7519 "(gpc_reg_operand (operands[0], SFmode)
7520 || gpc_reg_operand (operands[1], SFmode))
7521 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7524 {l%U1%X1|lwz%U1%X1} %0,%1
7525 {st%U0%X0|stw%U0%X0} %1,%0
7535 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7536 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7538 (define_insn "*movsf_softfloat"
7539 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7540 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7541 "(gpc_reg_operand (operands[0], SFmode)
7542 || gpc_reg_operand (operands[1], SFmode))
7543 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7549 {l%U1%X1|lwz%U1%X1} %0,%1
7550 {st%U0%X0|stw%U0%X0} %1,%0
7557 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
7558 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7561 (define_expand "movdf"
7562 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7563 (match_operand:DF 1 "any_operand" ""))]
7565 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7568 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7569 (match_operand:DF 1 "const_int_operand" ""))]
7570 "! TARGET_POWERPC64 && reload_completed
7571 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7572 || (GET_CODE (operands[0]) == SUBREG
7573 && GET_CODE (SUBREG_REG (operands[0])) == REG
7574 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7575 [(set (match_dup 2) (match_dup 4))
7576 (set (match_dup 3) (match_dup 1))]
7579 int endian = (WORDS_BIG_ENDIAN == 0);
7580 HOST_WIDE_INT value = INTVAL (operands[1]);
7582 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7583 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7584 #if HOST_BITS_PER_WIDE_INT == 32
7585 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7587 operands[4] = GEN_INT (value >> 32);
7588 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7593 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7594 (match_operand:DF 1 "const_double_operand" ""))]
7595 "! TARGET_POWERPC64 && reload_completed
7596 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7597 || (GET_CODE (operands[0]) == SUBREG
7598 && GET_CODE (SUBREG_REG (operands[0])) == REG
7599 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7600 [(set (match_dup 2) (match_dup 4))
7601 (set (match_dup 3) (match_dup 5))]
7604 int endian = (WORDS_BIG_ENDIAN == 0);
7608 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7609 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7611 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7612 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7613 operands[4] = gen_int_mode (l[endian], SImode);
7614 operands[5] = gen_int_mode (l[1 - endian], SImode);
7618 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7619 (match_operand:DF 1 "easy_fp_constant" ""))]
7620 "TARGET_POWERPC64 && reload_completed
7621 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7622 || (GET_CODE (operands[0]) == SUBREG
7623 && GET_CODE (SUBREG_REG (operands[0])) == REG
7624 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7625 [(set (match_dup 2) (match_dup 3))]
7628 int endian = (WORDS_BIG_ENDIAN == 0);
7631 #if HOST_BITS_PER_WIDE_INT >= 64
7635 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7636 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7638 operands[2] = gen_lowpart (DImode, operands[0]);
7639 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
7640 #if HOST_BITS_PER_WIDE_INT >= 64
7641 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
7642 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
7644 operands[3] = gen_int_mode (val, DImode);
7646 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
7650 ;; Don't have reload use general registers to load a constant. First,
7651 ;; it might not work if the output operand is the equivalent of
7652 ;; a non-offsettable memref, but also it is less efficient than loading
7653 ;; the constant into an FP register, since it will probably be used there.
7654 ;; The "??" is a kludge until we can figure out a more reasonable way
7655 ;; of handling these non-offsettable values.
7656 (define_insn "*movdf_hardfloat32"
7657 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
7658 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
7659 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
7660 && (gpc_reg_operand (operands[0], DFmode)
7661 || gpc_reg_operand (operands[1], DFmode))"
7664 switch (which_alternative)
7669 /* We normally copy the low-numbered register first. However, if
7670 the first register operand 0 is the same as the second register
7671 of operand 1, we must copy in the opposite order. */
7672 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7673 return \"mr %L0,%L1\;mr %0,%1\";
7675 return \"mr %0,%1\;mr %L0,%L1\";
7677 if (GET_CODE (operands[1]) == MEM
7678 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[1], 0),
7679 reload_completed || reload_in_progress)
7680 || GET_CODE (XEXP (operands[1], 0)) == REG
7681 || GET_CODE (XEXP (operands[1], 0)) == LO_SUM
7682 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
7683 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC))
7685 /* If the low-address word is used in the address, we must load
7686 it last. Otherwise, load it first. Note that we cannot have
7687 auto-increment in that case since the address register is
7688 known to be dead. */
7689 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7691 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7693 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7699 addreg = find_addr_reg (XEXP (operands[1], 0));
7700 if (refers_to_regno_p (REGNO (operands[0]),
7701 REGNO (operands[0]) + 1,
7704 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7705 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7706 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7707 return \"{lx|lwzx} %0,%1\";
7711 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
7712 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7713 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7714 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7719 if (GET_CODE (operands[0]) == MEM
7720 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[0], 0),
7721 reload_completed || reload_in_progress)
7722 || GET_CODE (XEXP (operands[0], 0)) == REG
7723 || GET_CODE (XEXP (operands[0], 0)) == LO_SUM
7724 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
7725 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))
7726 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
7731 addreg = find_addr_reg (XEXP (operands[0], 0));
7732 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
7733 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7734 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
7735 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7739 return \"fmr %0,%1\";
7741 return \"lfd%U1%X1 %0,%1\";
7743 return \"stfd%U0%X0 %1,%0\";
7750 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
7751 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
7753 (define_insn "*movdf_softfloat32"
7754 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
7755 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
7756 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
7757 && (gpc_reg_operand (operands[0], DFmode)
7758 || gpc_reg_operand (operands[1], DFmode))"
7761 switch (which_alternative)
7766 /* We normally copy the low-numbered register first. However, if
7767 the first register operand 0 is the same as the second register of
7768 operand 1, we must copy in the opposite order. */
7769 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7770 return \"mr %L0,%L1\;mr %0,%1\";
7772 return \"mr %0,%1\;mr %L0,%L1\";
7774 /* If the low-address word is used in the address, we must load
7775 it last. Otherwise, load it first. Note that we cannot have
7776 auto-increment in that case since the address register is
7777 known to be dead. */
7778 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7780 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7782 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7784 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
7791 [(set_attr "type" "two,load,store,*,*,*")
7792 (set_attr "length" "8,8,8,8,12,16")])
7794 ; ld/std require word-aligned displacements -> 'Y' constraint.
7795 ; List Y->r and r->Y before r->r for reload.
7796 (define_insn "*movdf_hardfloat64"
7797 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
7798 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
7799 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
7800 && (gpc_reg_operand (operands[0], DFmode)
7801 || gpc_reg_operand (operands[1], DFmode))"
7815 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
7816 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
7818 (define_insn "*movdf_softfloat64"
7819 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
7820 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
7821 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
7822 && (gpc_reg_operand (operands[0], DFmode)
7823 || gpc_reg_operand (operands[1], DFmode))"
7834 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
7835 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
7837 (define_expand "movtf"
7838 [(set (match_operand:TF 0 "general_operand" "")
7839 (match_operand:TF 1 "any_operand" ""))]
7840 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7841 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7842 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
7844 ; It's important to list the o->f and f->o moves before f->f because
7845 ; otherwise reload, given m->f, will try to pick f->f and reload it,
7846 ; which doesn't make progress. Likewise r->Y must be before r->r.
7847 (define_insn_and_split "*movtf_internal"
7848 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
7849 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
7850 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7851 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
7852 && (gpc_reg_operand (operands[0], TFmode)
7853 || gpc_reg_operand (operands[1], TFmode))"
7855 "&& reload_completed"
7857 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
7858 [(set_attr "length" "8,8,8,20,20,16")])
7860 (define_expand "extenddftf2"
7861 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
7862 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
7863 (use (match_dup 2))])]
7864 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7865 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7867 operands[2] = CONST0_RTX (DFmode);
7870 (define_insn_and_split "*extenddftf2_internal"
7871 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
7872 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
7873 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
7874 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7875 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7877 "&& reload_completed"
7880 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
7881 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
7882 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
7884 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
7889 (define_expand "extendsftf2"
7890 [(set (match_operand:TF 0 "nonimmediate_operand" "")
7891 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
7892 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7893 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7895 rtx tmp = gen_reg_rtx (DFmode);
7896 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
7897 emit_insn (gen_extenddftf2 (operands[0], tmp));
7901 (define_expand "trunctfdf2"
7902 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7903 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
7904 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7905 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7908 (define_insn_and_split "trunctfdf2_internal1"
7909 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
7910 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
7911 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
7912 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7916 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
7919 emit_note (NOTE_INSN_DELETED);
7922 [(set_attr "type" "fp")])
7924 (define_insn "trunctfdf2_internal2"
7925 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
7926 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
7927 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
7928 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7930 [(set_attr "type" "fp")])
7932 (define_insn_and_split "trunctfsf2"
7933 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7934 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
7935 (clobber (match_scratch:DF 2 "=f"))]
7936 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7937 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7939 "&& reload_completed"
7941 (float_truncate:DF (match_dup 1)))
7943 (float_truncate:SF (match_dup 2)))]
7946 (define_expand "floatsitf2"
7947 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
7948 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
7949 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7950 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7952 rtx tmp = gen_reg_rtx (DFmode);
7953 expand_float (tmp, operands[1], false);
7954 emit_insn (gen_extenddftf2 (operands[0], tmp));
7958 ; fadd, but rounding towards zero.
7959 ; This is probably not the optimal code sequence.
7960 (define_insn "fix_trunc_helper"
7961 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
7962 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
7963 UNSPEC_FIX_TRUNC_TF))
7964 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
7965 "TARGET_HARD_FLOAT && TARGET_FPRS"
7966 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
7967 [(set_attr "type" "fp")
7968 (set_attr "length" "20")])
7970 (define_expand "fix_trunctfsi2"
7971 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
7972 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
7973 (clobber (match_dup 2))
7974 (clobber (match_dup 3))
7975 (clobber (match_dup 4))
7976 (clobber (match_dup 5))])]
7977 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7978 && (TARGET_POWER2 || TARGET_POWERPC)
7979 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7981 operands[2] = gen_reg_rtx (DFmode);
7982 operands[3] = gen_reg_rtx (DFmode);
7983 operands[4] = gen_reg_rtx (DImode);
7984 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
7987 (define_insn_and_split "*fix_trunctfsi2_internal"
7988 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7989 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
7990 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
7991 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
7992 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
7993 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
7994 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7995 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7997 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[5]))"
8001 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
8003 gcc_assert (MEM_P (operands[5]));
8004 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8006 emit_insn (gen_fctiwz (operands[4], operands[2]));
8007 emit_move_insn (operands[5], operands[4]);
8008 emit_move_insn (operands[0], lowword);
8012 (define_insn "negtf2"
8013 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8014 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8015 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8016 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8019 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8020 return \"fneg %L0,%L1\;fneg %0,%1\";
8022 return \"fneg %0,%1\;fneg %L0,%L1\";
8024 [(set_attr "type" "fp")
8025 (set_attr "length" "8")])
8027 (define_expand "abstf2"
8028 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8029 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8030 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8031 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8034 rtx label = gen_label_rtx ();
8035 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8040 (define_expand "abstf2_internal"
8041 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8042 (match_operand:TF 1 "gpc_reg_operand" "f"))
8043 (set (match_dup 3) (match_dup 5))
8044 (set (match_dup 5) (abs:DF (match_dup 5)))
8045 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8046 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8047 (label_ref (match_operand 2 "" ""))
8049 (set (match_dup 6) (neg:DF (match_dup 6)))]
8050 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8051 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8054 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8055 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8056 operands[3] = gen_reg_rtx (DFmode);
8057 operands[4] = gen_reg_rtx (CCFPmode);
8058 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8059 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8062 ;; Next come the multi-word integer load and store and the load and store
8065 ; List r->r after r->"o<>", otherwise reload will try to reload a
8066 ; non-offsettable address by using r->r which won't make progress.
8067 (define_insn "*movdi_internal32"
8068 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8069 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8071 && (gpc_reg_operand (operands[0], DImode)
8072 || gpc_reg_operand (operands[1], DImode))"
8081 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8084 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8085 (match_operand:DI 1 "const_int_operand" ""))]
8086 "! TARGET_POWERPC64 && reload_completed"
8087 [(set (match_dup 2) (match_dup 4))
8088 (set (match_dup 3) (match_dup 1))]
8091 HOST_WIDE_INT value = INTVAL (operands[1]);
8092 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8094 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8096 #if HOST_BITS_PER_WIDE_INT == 32
8097 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8099 operands[4] = GEN_INT (value >> 32);
8100 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8105 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8106 (match_operand:DI 1 "input_operand" ""))]
8107 "reload_completed && !TARGET_POWERPC64
8108 && gpr_or_gpr_p (operands[0], operands[1])"
8110 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8112 (define_insn "*movdi_internal64"
8113 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8114 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8116 && (gpc_reg_operand (operands[0], DImode)
8117 || gpc_reg_operand (operands[1], DImode))"
8132 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8133 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8135 ;; immediate value valid for a single instruction hiding in a const_double
8137 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8138 (match_operand:DI 1 "const_double_operand" "F"))]
8139 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8140 && GET_CODE (operands[1]) == CONST_DOUBLE
8141 && num_insns_constant (operands[1], DImode) == 1"
8144 return ((unsigned HOST_WIDE_INT)
8145 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8146 ? \"li %0,%1\" : \"lis %0,%v1\";
8149 ;; Generate all one-bits and clear left or right.
8150 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8152 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8153 (match_operand:DI 1 "mask_operand" ""))]
8154 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8155 [(set (match_dup 0) (const_int -1))
8157 (and:DI (rotate:DI (match_dup 0)
8162 ;; Split a load of a large constant into the appropriate five-instruction
8163 ;; sequence. Handle anything in a constant number of insns.
8164 ;; When non-easy constants can go in the TOC, this should use
8165 ;; easy_fp_constant predicate.
8167 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8168 (match_operand:DI 1 "const_int_operand" ""))]
8169 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8170 [(set (match_dup 0) (match_dup 2))
8171 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8173 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8175 if (tem == operands[0])
8182 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8183 (match_operand:DI 1 "const_double_operand" ""))]
8184 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8185 [(set (match_dup 0) (match_dup 2))
8186 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8188 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8190 if (tem == operands[0])
8196 ;; TImode is similar, except that we usually want to compute the address into
8197 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8198 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8200 ;; We say that MQ is clobbered in the last alternative because the first
8201 ;; alternative would never get used otherwise since it would need a reload
8202 ;; while the 2nd alternative would not. We put memory cases first so they
8203 ;; are preferred. Otherwise, we'd try to reload the output instead of
8204 ;; giving the SCRATCH mq.
8206 (define_insn "*movti_power"
8207 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8208 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8209 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8210 "TARGET_POWER && ! TARGET_POWERPC64
8211 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8214 switch (which_alternative)
8221 return \"{stsi|stswi} %1,%P0,16\";
8226 /* If the address is not used in the output, we can use lsi. Otherwise,
8227 fall through to generating four loads. */
8229 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8230 return \"{lsi|lswi} %0,%P1,16\";
8231 /* ... fall through ... */
8237 [(set_attr "type" "store,store,*,load,load,*")])
8239 (define_insn "*movti_string"
8240 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8241 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8242 "! TARGET_POWER && ! TARGET_POWERPC64
8243 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8246 switch (which_alternative)
8252 return \"{stsi|stswi} %1,%P0,16\";
8257 /* If the address is not used in the output, we can use lsi. Otherwise,
8258 fall through to generating four loads. */
8260 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8261 return \"{lsi|lswi} %0,%P1,16\";
8262 /* ... fall through ... */
8268 [(set_attr "type" "store,store,*,load,load,*")])
8270 (define_insn "*movti_ppc64"
8271 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8272 (match_operand:TI 1 "input_operand" "r,r,m"))]
8273 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8274 || gpc_reg_operand (operands[1], TImode))"
8276 [(set_attr "type" "*,load,store")])
8279 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8280 (match_operand:TI 1 "const_double_operand" ""))]
8282 [(set (match_dup 2) (match_dup 4))
8283 (set (match_dup 3) (match_dup 5))]
8286 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8288 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8290 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8292 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8293 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8295 else if (GET_CODE (operands[1]) == CONST_INT)
8297 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8298 operands[5] = operands[1];
8305 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8306 (match_operand:TI 1 "input_operand" ""))]
8308 && gpr_or_gpr_p (operands[0], operands[1])"
8310 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8312 (define_expand "load_multiple"
8313 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8314 (match_operand:SI 1 "" ""))
8315 (use (match_operand:SI 2 "" ""))])]
8316 "TARGET_STRING && !TARGET_POWERPC64"
8324 /* Support only loading a constant number of fixed-point registers from
8325 memory and only bother with this if more than two; the machine
8326 doesn't support more than eight. */
8327 if (GET_CODE (operands[2]) != CONST_INT
8328 || INTVAL (operands[2]) <= 2
8329 || INTVAL (operands[2]) > 8
8330 || GET_CODE (operands[1]) != MEM
8331 || GET_CODE (operands[0]) != REG
8332 || REGNO (operands[0]) >= 32)
8335 count = INTVAL (operands[2]);
8336 regno = REGNO (operands[0]);
8338 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8339 op1 = replace_equiv_address (operands[1],
8340 force_reg (SImode, XEXP (operands[1], 0)));
8342 for (i = 0; i < count; i++)
8343 XVECEXP (operands[3], 0, i)
8344 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8345 adjust_address_nv (op1, SImode, i * 4));
8348 (define_insn "*ldmsi8"
8349 [(match_parallel 0 "load_multiple_operation"
8350 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8351 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8352 (set (match_operand:SI 3 "gpc_reg_operand" "")
8353 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8354 (set (match_operand:SI 4 "gpc_reg_operand" "")
8355 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8356 (set (match_operand:SI 5 "gpc_reg_operand" "")
8357 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8358 (set (match_operand:SI 6 "gpc_reg_operand" "")
8359 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8360 (set (match_operand:SI 7 "gpc_reg_operand" "")
8361 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8362 (set (match_operand:SI 8 "gpc_reg_operand" "")
8363 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8364 (set (match_operand:SI 9 "gpc_reg_operand" "")
8365 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8366 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8368 { return rs6000_output_load_multiple (operands); }"
8369 [(set_attr "type" "load")
8370 (set_attr "length" "32")])
8372 (define_insn "*ldmsi7"
8373 [(match_parallel 0 "load_multiple_operation"
8374 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8375 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8376 (set (match_operand:SI 3 "gpc_reg_operand" "")
8377 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8378 (set (match_operand:SI 4 "gpc_reg_operand" "")
8379 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8380 (set (match_operand:SI 5 "gpc_reg_operand" "")
8381 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8382 (set (match_operand:SI 6 "gpc_reg_operand" "")
8383 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8384 (set (match_operand:SI 7 "gpc_reg_operand" "")
8385 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8386 (set (match_operand:SI 8 "gpc_reg_operand" "")
8387 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8388 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8390 { return rs6000_output_load_multiple (operands); }"
8391 [(set_attr "type" "load")
8392 (set_attr "length" "32")])
8394 (define_insn "*ldmsi6"
8395 [(match_parallel 0 "load_multiple_operation"
8396 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8397 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8398 (set (match_operand:SI 3 "gpc_reg_operand" "")
8399 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8400 (set (match_operand:SI 4 "gpc_reg_operand" "")
8401 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8402 (set (match_operand:SI 5 "gpc_reg_operand" "")
8403 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8404 (set (match_operand:SI 6 "gpc_reg_operand" "")
8405 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8406 (set (match_operand:SI 7 "gpc_reg_operand" "")
8407 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8408 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8410 { return rs6000_output_load_multiple (operands); }"
8411 [(set_attr "type" "load")
8412 (set_attr "length" "32")])
8414 (define_insn "*ldmsi5"
8415 [(match_parallel 0 "load_multiple_operation"
8416 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8417 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8418 (set (match_operand:SI 3 "gpc_reg_operand" "")
8419 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8420 (set (match_operand:SI 4 "gpc_reg_operand" "")
8421 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8422 (set (match_operand:SI 5 "gpc_reg_operand" "")
8423 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8424 (set (match_operand:SI 6 "gpc_reg_operand" "")
8425 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8426 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8428 { return rs6000_output_load_multiple (operands); }"
8429 [(set_attr "type" "load")
8430 (set_attr "length" "32")])
8432 (define_insn "*ldmsi4"
8433 [(match_parallel 0 "load_multiple_operation"
8434 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8435 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8436 (set (match_operand:SI 3 "gpc_reg_operand" "")
8437 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8438 (set (match_operand:SI 4 "gpc_reg_operand" "")
8439 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8440 (set (match_operand:SI 5 "gpc_reg_operand" "")
8441 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8442 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8444 { return rs6000_output_load_multiple (operands); }"
8445 [(set_attr "type" "load")
8446 (set_attr "length" "32")])
8448 (define_insn "*ldmsi3"
8449 [(match_parallel 0 "load_multiple_operation"
8450 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8451 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8452 (set (match_operand:SI 3 "gpc_reg_operand" "")
8453 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8454 (set (match_operand:SI 4 "gpc_reg_operand" "")
8455 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8456 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8458 { return rs6000_output_load_multiple (operands); }"
8459 [(set_attr "type" "load")
8460 (set_attr "length" "32")])
8462 (define_expand "store_multiple"
8463 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8464 (match_operand:SI 1 "" ""))
8465 (clobber (scratch:SI))
8466 (use (match_operand:SI 2 "" ""))])]
8467 "TARGET_STRING && !TARGET_POWERPC64"
8476 /* Support only storing a constant number of fixed-point registers to
8477 memory and only bother with this if more than two; the machine
8478 doesn't support more than eight. */
8479 if (GET_CODE (operands[2]) != CONST_INT
8480 || INTVAL (operands[2]) <= 2
8481 || INTVAL (operands[2]) > 8
8482 || GET_CODE (operands[0]) != MEM
8483 || GET_CODE (operands[1]) != REG
8484 || REGNO (operands[1]) >= 32)
8487 count = INTVAL (operands[2]);
8488 regno = REGNO (operands[1]);
8490 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8491 to = force_reg (SImode, XEXP (operands[0], 0));
8492 op0 = replace_equiv_address (operands[0], to);
8494 XVECEXP (operands[3], 0, 0)
8495 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8496 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8497 gen_rtx_SCRATCH (SImode));
8499 for (i = 1; i < count; i++)
8500 XVECEXP (operands[3], 0, i + 1)
8501 = gen_rtx_SET (VOIDmode,
8502 adjust_address_nv (op0, SImode, i * 4),
8503 gen_rtx_REG (SImode, regno + i));
8506 (define_insn "*store_multiple_power"
8507 [(match_parallel 0 "store_multiple_operation"
8508 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8509 (match_operand:SI 2 "gpc_reg_operand" "r"))
8510 (clobber (match_scratch:SI 3 "=q"))])]
8511 "TARGET_STRING && TARGET_POWER"
8512 "{stsi|stswi} %2,%P1,%O0"
8513 [(set_attr "type" "store")])
8515 (define_insn "*stmsi8"
8516 [(match_parallel 0 "store_multiple_operation"
8517 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8518 (match_operand:SI 2 "gpc_reg_operand" "r"))
8519 (clobber (match_scratch:SI 3 "X"))
8520 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8521 (match_operand:SI 4 "gpc_reg_operand" "r"))
8522 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8523 (match_operand:SI 5 "gpc_reg_operand" "r"))
8524 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8525 (match_operand:SI 6 "gpc_reg_operand" "r"))
8526 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8527 (match_operand:SI 7 "gpc_reg_operand" "r"))
8528 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8529 (match_operand:SI 8 "gpc_reg_operand" "r"))
8530 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8531 (match_operand:SI 9 "gpc_reg_operand" "r"))
8532 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8533 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8534 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8535 "{stsi|stswi} %2,%1,%O0"
8536 [(set_attr "type" "store")])
8538 (define_insn "*stmsi7"
8539 [(match_parallel 0 "store_multiple_operation"
8540 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8541 (match_operand:SI 2 "gpc_reg_operand" "r"))
8542 (clobber (match_scratch:SI 3 "X"))
8543 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8544 (match_operand:SI 4 "gpc_reg_operand" "r"))
8545 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8546 (match_operand:SI 5 "gpc_reg_operand" "r"))
8547 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8548 (match_operand:SI 6 "gpc_reg_operand" "r"))
8549 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8550 (match_operand:SI 7 "gpc_reg_operand" "r"))
8551 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8552 (match_operand:SI 8 "gpc_reg_operand" "r"))
8553 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8554 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8555 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
8556 "{stsi|stswi} %2,%1,%O0"
8557 [(set_attr "type" "store")])
8559 (define_insn "*stmsi6"
8560 [(match_parallel 0 "store_multiple_operation"
8561 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8562 (match_operand:SI 2 "gpc_reg_operand" "r"))
8563 (clobber (match_scratch:SI 3 "X"))
8564 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8565 (match_operand:SI 4 "gpc_reg_operand" "r"))
8566 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8567 (match_operand:SI 5 "gpc_reg_operand" "r"))
8568 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8569 (match_operand:SI 6 "gpc_reg_operand" "r"))
8570 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8571 (match_operand:SI 7 "gpc_reg_operand" "r"))
8572 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8573 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
8574 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
8575 "{stsi|stswi} %2,%1,%O0"
8576 [(set_attr "type" "store")])
8578 (define_insn "*stmsi5"
8579 [(match_parallel 0 "store_multiple_operation"
8580 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8581 (match_operand:SI 2 "gpc_reg_operand" "r"))
8582 (clobber (match_scratch:SI 3 "X"))
8583 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8584 (match_operand:SI 4 "gpc_reg_operand" "r"))
8585 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8586 (match_operand:SI 5 "gpc_reg_operand" "r"))
8587 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8588 (match_operand:SI 6 "gpc_reg_operand" "r"))
8589 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8590 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
8591 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
8592 "{stsi|stswi} %2,%1,%O0"
8593 [(set_attr "type" "store")])
8595 (define_insn "*stmsi4"
8596 [(match_parallel 0 "store_multiple_operation"
8597 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8598 (match_operand:SI 2 "gpc_reg_operand" "r"))
8599 (clobber (match_scratch:SI 3 "X"))
8600 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8601 (match_operand:SI 4 "gpc_reg_operand" "r"))
8602 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8603 (match_operand:SI 5 "gpc_reg_operand" "r"))
8604 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8605 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
8606 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
8607 "{stsi|stswi} %2,%1,%O0"
8608 [(set_attr "type" "store")])
8610 (define_insn "*stmsi3"
8611 [(match_parallel 0 "store_multiple_operation"
8612 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8613 (match_operand:SI 2 "gpc_reg_operand" "r"))
8614 (clobber (match_scratch:SI 3 "X"))
8615 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8616 (match_operand:SI 4 "gpc_reg_operand" "r"))
8617 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8618 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
8619 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
8620 "{stsi|stswi} %2,%1,%O0"
8621 [(set_attr "type" "store")])
8623 (define_expand "setmemsi"
8624 [(parallel [(set (match_operand:BLK 0 "" "")
8625 (match_operand 2 "const_int_operand" ""))
8626 (use (match_operand:SI 1 "" ""))
8627 (use (match_operand:SI 3 "" ""))])]
8631 /* If value to set is not zero, use the library routine. */
8632 if (operands[2] != const0_rtx)
8635 if (expand_block_clear (operands))
8641 ;; String/block move insn.
8642 ;; Argument 0 is the destination
8643 ;; Argument 1 is the source
8644 ;; Argument 2 is the length
8645 ;; Argument 3 is the alignment
8647 (define_expand "movmemsi"
8648 [(parallel [(set (match_operand:BLK 0 "" "")
8649 (match_operand:BLK 1 "" ""))
8650 (use (match_operand:SI 2 "" ""))
8651 (use (match_operand:SI 3 "" ""))])]
8655 if (expand_block_move (operands))
8661 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
8662 ;; register allocator doesn't have a clue about allocating 8 word registers.
8663 ;; rD/rS = r5 is preferred, efficient form.
8664 (define_expand "movmemsi_8reg"
8665 [(parallel [(set (match_operand 0 "" "")
8666 (match_operand 1 "" ""))
8667 (use (match_operand 2 "" ""))
8668 (use (match_operand 3 "" ""))
8669 (clobber (reg:SI 5))
8670 (clobber (reg:SI 6))
8671 (clobber (reg:SI 7))
8672 (clobber (reg:SI 8))
8673 (clobber (reg:SI 9))
8674 (clobber (reg:SI 10))
8675 (clobber (reg:SI 11))
8676 (clobber (reg:SI 12))
8677 (clobber (match_scratch:SI 4 ""))])]
8682 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8683 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8684 (use (match_operand:SI 2 "immediate_operand" "i"))
8685 (use (match_operand:SI 3 "immediate_operand" "i"))
8686 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8687 (clobber (reg:SI 6))
8688 (clobber (reg:SI 7))
8689 (clobber (reg:SI 8))
8690 (clobber (reg:SI 9))
8691 (clobber (reg:SI 10))
8692 (clobber (reg:SI 11))
8693 (clobber (reg:SI 12))
8694 (clobber (match_scratch:SI 5 "=q"))]
8695 "TARGET_STRING && TARGET_POWER
8696 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8697 || INTVAL (operands[2]) == 0)
8698 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8699 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8700 && REGNO (operands[4]) == 5"
8701 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8702 [(set_attr "type" "load")
8703 (set_attr "length" "8")])
8706 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8707 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8708 (use (match_operand:SI 2 "immediate_operand" "i"))
8709 (use (match_operand:SI 3 "immediate_operand" "i"))
8710 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8711 (clobber (reg:SI 6))
8712 (clobber (reg:SI 7))
8713 (clobber (reg:SI 8))
8714 (clobber (reg:SI 9))
8715 (clobber (reg:SI 10))
8716 (clobber (reg:SI 11))
8717 (clobber (reg:SI 12))
8718 (clobber (match_scratch:SI 5 "X"))]
8719 "TARGET_STRING && ! TARGET_POWER
8720 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8721 || INTVAL (operands[2]) == 0)
8722 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8723 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8724 && REGNO (operands[4]) == 5"
8725 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8726 [(set_attr "type" "load")
8727 (set_attr "length" "8")])
8729 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
8730 ;; register allocator doesn't have a clue about allocating 6 word registers.
8731 ;; rD/rS = r5 is preferred, efficient form.
8732 (define_expand "movmemsi_6reg"
8733 [(parallel [(set (match_operand 0 "" "")
8734 (match_operand 1 "" ""))
8735 (use (match_operand 2 "" ""))
8736 (use (match_operand 3 "" ""))
8737 (clobber (reg:SI 5))
8738 (clobber (reg:SI 6))
8739 (clobber (reg:SI 7))
8740 (clobber (reg:SI 8))
8741 (clobber (reg:SI 9))
8742 (clobber (reg:SI 10))
8743 (clobber (match_scratch:SI 4 ""))])]
8748 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8749 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8750 (use (match_operand:SI 2 "immediate_operand" "i"))
8751 (use (match_operand:SI 3 "immediate_operand" "i"))
8752 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8753 (clobber (reg:SI 6))
8754 (clobber (reg:SI 7))
8755 (clobber (reg:SI 8))
8756 (clobber (reg:SI 9))
8757 (clobber (reg:SI 10))
8758 (clobber (match_scratch:SI 5 "=q"))]
8759 "TARGET_STRING && TARGET_POWER
8760 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
8761 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8762 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8763 && REGNO (operands[4]) == 5"
8764 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8765 [(set_attr "type" "load")
8766 (set_attr "length" "8")])
8769 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8770 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8771 (use (match_operand:SI 2 "immediate_operand" "i"))
8772 (use (match_operand:SI 3 "immediate_operand" "i"))
8773 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8774 (clobber (reg:SI 6))
8775 (clobber (reg:SI 7))
8776 (clobber (reg:SI 8))
8777 (clobber (reg:SI 9))
8778 (clobber (reg:SI 10))
8779 (clobber (match_scratch:SI 5 "X"))]
8780 "TARGET_STRING && ! TARGET_POWER
8781 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
8782 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8783 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8784 && REGNO (operands[4]) == 5"
8785 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8786 [(set_attr "type" "load")
8787 (set_attr "length" "8")])
8789 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
8790 ;; problems with TImode.
8791 ;; rD/rS = r5 is preferred, efficient form.
8792 (define_expand "movmemsi_4reg"
8793 [(parallel [(set (match_operand 0 "" "")
8794 (match_operand 1 "" ""))
8795 (use (match_operand 2 "" ""))
8796 (use (match_operand 3 "" ""))
8797 (clobber (reg:SI 5))
8798 (clobber (reg:SI 6))
8799 (clobber (reg:SI 7))
8800 (clobber (reg:SI 8))
8801 (clobber (match_scratch:SI 4 ""))])]
8806 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8807 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8808 (use (match_operand:SI 2 "immediate_operand" "i"))
8809 (use (match_operand:SI 3 "immediate_operand" "i"))
8810 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8811 (clobber (reg:SI 6))
8812 (clobber (reg:SI 7))
8813 (clobber (reg:SI 8))
8814 (clobber (match_scratch:SI 5 "=q"))]
8815 "TARGET_STRING && TARGET_POWER
8816 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
8817 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
8818 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
8819 && REGNO (operands[4]) == 5"
8820 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8821 [(set_attr "type" "load")
8822 (set_attr "length" "8")])
8825 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8826 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8827 (use (match_operand:SI 2 "immediate_operand" "i"))
8828 (use (match_operand:SI 3 "immediate_operand" "i"))
8829 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8830 (clobber (reg:SI 6))
8831 (clobber (reg:SI 7))
8832 (clobber (reg:SI 8))
8833 (clobber (match_scratch:SI 5 "X"))]
8834 "TARGET_STRING && ! TARGET_POWER
8835 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
8836 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
8837 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
8838 && REGNO (operands[4]) == 5"
8839 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8840 [(set_attr "type" "load")
8841 (set_attr "length" "8")])
8843 ;; Move up to 8 bytes at a time.
8844 (define_expand "movmemsi_2reg"
8845 [(parallel [(set (match_operand 0 "" "")
8846 (match_operand 1 "" ""))
8847 (use (match_operand 2 "" ""))
8848 (use (match_operand 3 "" ""))
8849 (clobber (match_scratch:DI 4 ""))
8850 (clobber (match_scratch:SI 5 ""))])]
8851 "TARGET_STRING && ! TARGET_POWERPC64"
8855 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8856 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8857 (use (match_operand:SI 2 "immediate_operand" "i"))
8858 (use (match_operand:SI 3 "immediate_operand" "i"))
8859 (clobber (match_scratch:DI 4 "=&r"))
8860 (clobber (match_scratch:SI 5 "=q"))]
8861 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
8862 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
8863 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8864 [(set_attr "type" "load")
8865 (set_attr "length" "8")])
8868 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8869 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8870 (use (match_operand:SI 2 "immediate_operand" "i"))
8871 (use (match_operand:SI 3 "immediate_operand" "i"))
8872 (clobber (match_scratch:DI 4 "=&r"))
8873 (clobber (match_scratch:SI 5 "X"))]
8874 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
8875 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
8876 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8877 [(set_attr "type" "load")
8878 (set_attr "length" "8")])
8880 ;; Move up to 4 bytes at a time.
8881 (define_expand "movmemsi_1reg"
8882 [(parallel [(set (match_operand 0 "" "")
8883 (match_operand 1 "" ""))
8884 (use (match_operand 2 "" ""))
8885 (use (match_operand 3 "" ""))
8886 (clobber (match_scratch:SI 4 ""))
8887 (clobber (match_scratch:SI 5 ""))])]
8892 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8893 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8894 (use (match_operand:SI 2 "immediate_operand" "i"))
8895 (use (match_operand:SI 3 "immediate_operand" "i"))
8896 (clobber (match_scratch:SI 4 "=&r"))
8897 (clobber (match_scratch:SI 5 "=q"))]
8898 "TARGET_STRING && TARGET_POWER
8899 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
8900 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8901 [(set_attr "type" "load")
8902 (set_attr "length" "8")])
8905 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8906 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8907 (use (match_operand:SI 2 "immediate_operand" "i"))
8908 (use (match_operand:SI 3 "immediate_operand" "i"))
8909 (clobber (match_scratch:SI 4 "=&r"))
8910 (clobber (match_scratch:SI 5 "X"))]
8911 "TARGET_STRING && ! TARGET_POWER
8912 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
8913 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8914 [(set_attr "type" "load")
8915 (set_attr "length" "8")])
8917 ;; Define insns that do load or store with update. Some of these we can
8918 ;; get by using pre-decrement or pre-increment, but the hardware can also
8919 ;; do cases where the increment is not the size of the object.
8921 ;; In all these cases, we use operands 0 and 1 for the register being
8922 ;; incremented because those are the operands that local-alloc will
8923 ;; tie and these are the pair most likely to be tieable (and the ones
8924 ;; that will benefit the most).
8926 (define_insn "*movdi_update1"
8927 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
8928 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
8929 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
8930 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
8931 (plus:DI (match_dup 1) (match_dup 2)))]
8932 "TARGET_POWERPC64 && TARGET_UPDATE"
8936 [(set_attr "type" "load_ux,load_u")])
8938 (define_insn "movdi_<mode>_update"
8939 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
8940 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
8941 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
8942 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
8943 (plus:P (match_dup 1) (match_dup 2)))]
8944 "TARGET_POWERPC64 && TARGET_UPDATE"
8948 [(set_attr "type" "store_ux,store_u")])
8950 (define_insn "*movsi_update1"
8951 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
8952 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8953 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
8954 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8955 (plus:SI (match_dup 1) (match_dup 2)))]
8958 {lux|lwzux} %3,%0,%2
8959 {lu|lwzu} %3,%2(%0)"
8960 [(set_attr "type" "load_ux,load_u")])
8962 (define_insn "*movsi_update2"
8963 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
8965 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
8966 (match_operand:DI 2 "gpc_reg_operand" "r")))))
8967 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
8968 (plus:DI (match_dup 1) (match_dup 2)))]
8971 [(set_attr "type" "load_ext_ux")])
8973 (define_insn "movsi_update"
8974 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8975 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
8976 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8977 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8978 (plus:SI (match_dup 1) (match_dup 2)))]
8981 {stux|stwux} %3,%0,%2
8982 {stu|stwu} %3,%2(%0)"
8983 [(set_attr "type" "store_ux,store_u")])
8985 (define_insn "*movhi_update1"
8986 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
8987 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8988 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
8989 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8990 (plus:SI (match_dup 1) (match_dup 2)))]
8995 [(set_attr "type" "load_ux,load_u")])
8997 (define_insn "*movhi_update2"
8998 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9000 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9001 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9002 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9003 (plus:SI (match_dup 1) (match_dup 2)))]
9008 [(set_attr "type" "load_ux,load_u")])
9010 (define_insn "*movhi_update3"
9011 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9013 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9014 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9015 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9016 (plus:SI (match_dup 1) (match_dup 2)))]
9021 [(set_attr "type" "load_ext_ux,load_ext_u")])
9023 (define_insn "*movhi_update4"
9024 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9025 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9026 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9027 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9028 (plus:SI (match_dup 1) (match_dup 2)))]
9033 [(set_attr "type" "store_ux,store_u")])
9035 (define_insn "*movqi_update1"
9036 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9037 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9038 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9039 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9040 (plus:SI (match_dup 1) (match_dup 2)))]
9045 [(set_attr "type" "load_ux,load_u")])
9047 (define_insn "*movqi_update2"
9048 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9050 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9051 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9052 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9053 (plus:SI (match_dup 1) (match_dup 2)))]
9058 [(set_attr "type" "load_ux,load_u")])
9060 (define_insn "*movqi_update3"
9061 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9062 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9063 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9064 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9065 (plus:SI (match_dup 1) (match_dup 2)))]
9070 [(set_attr "type" "store_ux,store_u")])
9072 (define_insn "*movsf_update1"
9073 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9074 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9075 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9076 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9077 (plus:SI (match_dup 1) (match_dup 2)))]
9078 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9082 [(set_attr "type" "fpload_ux,fpload_u")])
9084 (define_insn "*movsf_update2"
9085 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9086 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9087 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9088 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9089 (plus:SI (match_dup 1) (match_dup 2)))]
9090 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9094 [(set_attr "type" "fpstore_ux,fpstore_u")])
9096 (define_insn "*movsf_update3"
9097 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9098 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9099 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9100 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9101 (plus:SI (match_dup 1) (match_dup 2)))]
9102 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9104 {lux|lwzux} %3,%0,%2
9105 {lu|lwzu} %3,%2(%0)"
9106 [(set_attr "type" "load_ux,load_u")])
9108 (define_insn "*movsf_update4"
9109 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9110 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9111 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9112 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9113 (plus:SI (match_dup 1) (match_dup 2)))]
9114 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9116 {stux|stwux} %3,%0,%2
9117 {stu|stwu} %3,%2(%0)"
9118 [(set_attr "type" "store_ux,store_u")])
9120 (define_insn "*movdf_update1"
9121 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9122 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9123 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9124 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9125 (plus:SI (match_dup 1) (match_dup 2)))]
9126 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9130 [(set_attr "type" "fpload_ux,fpload_u")])
9132 (define_insn "*movdf_update2"
9133 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9134 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9135 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9136 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9137 (plus:SI (match_dup 1) (match_dup 2)))]
9138 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9142 [(set_attr "type" "fpstore_ux,fpstore_u")])
9144 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9146 (define_insn "*lfq_power2"
9147 [(set (match_operand:V2DF 0 "gpc_reg_operand" "=f")
9148 (match_operand:V2DF 1 "memory_operand" ""))]
9150 && TARGET_HARD_FLOAT && TARGET_FPRS"
9154 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9155 (match_operand:DF 1 "memory_operand" ""))
9156 (set (match_operand:DF 2 "gpc_reg_operand" "")
9157 (match_operand:DF 3 "memory_operand" ""))]
9159 && TARGET_HARD_FLOAT && TARGET_FPRS
9160 && registers_ok_for_quad_peep (operands[0], operands[2])
9161 && mems_ok_for_quad_peep (operands[1], operands[3])"
9164 "operands[1] = widen_memory_access (operands[1], V2DFmode, 0);
9165 operands[0] = gen_rtx_REG (V2DFmode, REGNO (operands[0]));")
9167 (define_insn "*stfq_power2"
9168 [(set (match_operand:V2DF 0 "memory_operand" "")
9169 (match_operand:V2DF 1 "gpc_reg_operand" "f"))]
9171 && TARGET_HARD_FLOAT && TARGET_FPRS"
9176 [(set (match_operand:DF 0 "memory_operand" "")
9177 (match_operand:DF 1 "gpc_reg_operand" ""))
9178 (set (match_operand:DF 2 "memory_operand" "")
9179 (match_operand:DF 3 "gpc_reg_operand" ""))]
9181 && TARGET_HARD_FLOAT && TARGET_FPRS
9182 && registers_ok_for_quad_peep (operands[1], operands[3])
9183 && mems_ok_for_quad_peep (operands[0], operands[2])"
9186 "operands[0] = widen_memory_access (operands[0], V2DFmode, 0);
9187 operands[1] = gen_rtx_REG (V2DFmode, REGNO (operands[1]));")
9189 ;; after inserting conditional returns we can sometimes have
9190 ;; unnecessary register moves. Unfortunately we cannot have a
9191 ;; modeless peephole here, because some single SImode sets have early
9192 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9193 ;; sequences, using get_attr_length here will smash the operands
9194 ;; array. Neither is there an early_cobbler_p predicate.
9196 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9197 (match_operand:DF 1 "any_operand" ""))
9198 (set (match_operand:DF 2 "gpc_reg_operand" "")
9200 "peep2_reg_dead_p (2, operands[0])"
9201 [(set (match_dup 2) (match_dup 1))])
9204 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9205 (match_operand:SF 1 "any_operand" ""))
9206 (set (match_operand:SF 2 "gpc_reg_operand" "")
9208 "peep2_reg_dead_p (2, operands[0])"
9209 [(set (match_dup 2) (match_dup 1))])
9214 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9215 (define_insn "tls_gd_32"
9216 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9217 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9218 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9220 "HAVE_AS_TLS && !TARGET_64BIT"
9221 "addi %0,%1,%2@got@tlsgd")
9223 (define_insn "tls_gd_64"
9224 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9225 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9226 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9228 "HAVE_AS_TLS && TARGET_64BIT"
9229 "addi %0,%1,%2@got@tlsgd")
9231 (define_insn "tls_ld_32"
9232 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9233 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9235 "HAVE_AS_TLS && !TARGET_64BIT"
9236 "addi %0,%1,%&@got@tlsld")
9238 (define_insn "tls_ld_64"
9239 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9240 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9242 "HAVE_AS_TLS && TARGET_64BIT"
9243 "addi %0,%1,%&@got@tlsld")
9245 (define_insn "tls_dtprel_32"
9246 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9247 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9248 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9250 "HAVE_AS_TLS && !TARGET_64BIT"
9251 "addi %0,%1,%2@dtprel")
9253 (define_insn "tls_dtprel_64"
9254 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9255 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9256 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9258 "HAVE_AS_TLS && TARGET_64BIT"
9259 "addi %0,%1,%2@dtprel")
9261 (define_insn "tls_dtprel_ha_32"
9262 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9263 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9264 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9265 UNSPEC_TLSDTPRELHA))]
9266 "HAVE_AS_TLS && !TARGET_64BIT"
9267 "addis %0,%1,%2@dtprel@ha")
9269 (define_insn "tls_dtprel_ha_64"
9270 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9271 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9272 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9273 UNSPEC_TLSDTPRELHA))]
9274 "HAVE_AS_TLS && TARGET_64BIT"
9275 "addis %0,%1,%2@dtprel@ha")
9277 (define_insn "tls_dtprel_lo_32"
9278 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9279 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9280 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9281 UNSPEC_TLSDTPRELLO))]
9282 "HAVE_AS_TLS && !TARGET_64BIT"
9283 "addi %0,%1,%2@dtprel@l")
9285 (define_insn "tls_dtprel_lo_64"
9286 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9287 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9288 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9289 UNSPEC_TLSDTPRELLO))]
9290 "HAVE_AS_TLS && TARGET_64BIT"
9291 "addi %0,%1,%2@dtprel@l")
9293 (define_insn "tls_got_dtprel_32"
9294 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9295 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9296 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9297 UNSPEC_TLSGOTDTPREL))]
9298 "HAVE_AS_TLS && !TARGET_64BIT"
9299 "lwz %0,%2@got@dtprel(%1)")
9301 (define_insn "tls_got_dtprel_64"
9302 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9303 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9304 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9305 UNSPEC_TLSGOTDTPREL))]
9306 "HAVE_AS_TLS && TARGET_64BIT"
9307 "ld %0,%2@got@dtprel(%1)")
9309 (define_insn "tls_tprel_32"
9310 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9311 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9312 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9314 "HAVE_AS_TLS && !TARGET_64BIT"
9315 "addi %0,%1,%2@tprel")
9317 (define_insn "tls_tprel_64"
9318 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9319 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9320 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9322 "HAVE_AS_TLS && TARGET_64BIT"
9323 "addi %0,%1,%2@tprel")
9325 (define_insn "tls_tprel_ha_32"
9326 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9327 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9328 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9329 UNSPEC_TLSTPRELHA))]
9330 "HAVE_AS_TLS && !TARGET_64BIT"
9331 "addis %0,%1,%2@tprel@ha")
9333 (define_insn "tls_tprel_ha_64"
9334 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9335 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9336 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9337 UNSPEC_TLSTPRELHA))]
9338 "HAVE_AS_TLS && TARGET_64BIT"
9339 "addis %0,%1,%2@tprel@ha")
9341 (define_insn "tls_tprel_lo_32"
9342 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9343 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9344 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9345 UNSPEC_TLSTPRELLO))]
9346 "HAVE_AS_TLS && !TARGET_64BIT"
9347 "addi %0,%1,%2@tprel@l")
9349 (define_insn "tls_tprel_lo_64"
9350 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9351 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9352 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9353 UNSPEC_TLSTPRELLO))]
9354 "HAVE_AS_TLS && TARGET_64BIT"
9355 "addi %0,%1,%2@tprel@l")
9357 ;; "b" output constraint here and on tls_tls input to support linker tls
9358 ;; optimization. The linker may edit the instructions emitted by a
9359 ;; tls_got_tprel/tls_tls pair to addis,addi.
9360 (define_insn "tls_got_tprel_32"
9361 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9362 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9363 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9364 UNSPEC_TLSGOTTPREL))]
9365 "HAVE_AS_TLS && !TARGET_64BIT"
9366 "lwz %0,%2@got@tprel(%1)")
9368 (define_insn "tls_got_tprel_64"
9369 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9370 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9371 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9372 UNSPEC_TLSGOTTPREL))]
9373 "HAVE_AS_TLS && TARGET_64BIT"
9374 "ld %0,%2@got@tprel(%1)")
9376 (define_insn "tls_tls_32"
9377 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9378 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9379 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9381 "HAVE_AS_TLS && !TARGET_64BIT"
9384 (define_insn "tls_tls_64"
9385 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9386 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9387 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9389 "HAVE_AS_TLS && TARGET_64BIT"
9392 ;; Next come insns related to the calling sequence.
9394 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9395 ;; We move the back-chain and decrement the stack pointer.
9397 (define_expand "allocate_stack"
9398 [(set (match_operand 0 "gpc_reg_operand" "=r")
9399 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9401 (minus (reg 1) (match_dup 1)))]
9404 { rtx chain = gen_reg_rtx (Pmode);
9405 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9408 emit_move_insn (chain, stack_bot);
9410 /* Check stack bounds if necessary. */
9411 if (current_function_limit_stack)
9414 available = expand_binop (Pmode, sub_optab,
9415 stack_pointer_rtx, stack_limit_rtx,
9416 NULL_RTX, 1, OPTAB_WIDEN);
9417 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9420 if (GET_CODE (operands[1]) != CONST_INT
9421 || INTVAL (operands[1]) < -32767
9422 || INTVAL (operands[1]) > 32768)
9424 neg_op0 = gen_reg_rtx (Pmode);
9426 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9428 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9431 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9434 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
9435 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9439 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9440 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9441 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9444 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9448 ;; These patterns say how to save and restore the stack pointer. We need not
9449 ;; save the stack pointer at function level since we are careful to
9450 ;; preserve the backchain. At block level, we have to restore the backchain
9451 ;; when we restore the stack pointer.
9453 ;; For nonlocal gotos, we must save both the stack pointer and its
9454 ;; backchain and restore both. Note that in the nonlocal case, the
9455 ;; save area is a memory location.
9457 (define_expand "save_stack_function"
9458 [(match_operand 0 "any_operand" "")
9459 (match_operand 1 "any_operand" "")]
9463 (define_expand "restore_stack_function"
9464 [(match_operand 0 "any_operand" "")
9465 (match_operand 1 "any_operand" "")]
9469 (define_expand "restore_stack_block"
9470 [(use (match_operand 0 "register_operand" ""))
9471 (set (match_dup 2) (match_dup 3))
9472 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9473 (set (match_dup 3) (match_dup 2))]
9477 operands[2] = gen_reg_rtx (Pmode);
9478 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9481 (define_expand "save_stack_nonlocal"
9482 [(match_operand 0 "memory_operand" "")
9483 (match_operand 1 "register_operand" "")]
9487 rtx temp = gen_reg_rtx (Pmode);
9488 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9490 /* Copy the backchain to the first word, sp to the second. */
9491 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9492 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
9493 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
9498 (define_expand "restore_stack_nonlocal"
9499 [(match_operand 0 "register_operand" "")
9500 (match_operand 1 "memory_operand" "")]
9504 rtx temp = gen_reg_rtx (Pmode);
9505 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9507 /* Restore the backchain from the first word, sp from the second. */
9508 emit_move_insn (temp,
9509 adjust_address_nv (operands[1], Pmode, 0));
9510 emit_move_insn (operands[0],
9511 adjust_address_nv (operands[1], Pmode, units_per_word));
9512 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9516 ;; TOC register handling.
9518 ;; Code to initialize the TOC register...
9520 (define_insn "load_toc_aix_si"
9521 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9522 (unspec:SI [(const_int 0)] UNSPEC_TOC))
9524 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9528 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9529 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9530 operands[2] = gen_rtx_REG (Pmode, 2);
9531 return \"{l|lwz} %0,%1(%2)\";
9533 [(set_attr "type" "load")])
9535 (define_insn "load_toc_aix_di"
9536 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9537 (unspec:DI [(const_int 0)] UNSPEC_TOC))
9539 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9543 #ifdef TARGET_RELOCATABLE
9544 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9545 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9547 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9550 strcat (buf, \"@toc\");
9551 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9552 operands[2] = gen_rtx_REG (Pmode, 2);
9553 return \"ld %0,%1(%2)\";
9555 [(set_attr "type" "load")])
9557 (define_insn "load_toc_v4_pic_si"
9558 [(set (match_operand:SI 0 "register_operand" "=l")
9559 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
9560 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9561 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9562 [(set_attr "type" "branch")
9563 (set_attr "length" "4")])
9565 (define_insn "load_toc_v4_PIC_1"
9566 [(set (match_operand:SI 0 "register_operand" "=l")
9567 (match_operand:SI 1 "immediate_operand" "s"))
9568 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
9569 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
9570 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
9571 "bcl 20,31,%1\\n%1:"
9572 [(set_attr "type" "branch")
9573 (set_attr "length" "4")])
9575 (define_insn "load_toc_v4_PIC_1b"
9576 [(set (match_operand:SI 0 "register_operand" "=l")
9577 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
9579 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9580 "bcl 20,31,$+8\\n\\t.long %1-$"
9581 [(set_attr "type" "branch")
9582 (set_attr "length" "8")])
9584 (define_insn "load_toc_v4_PIC_2"
9585 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9586 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9587 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
9588 (match_operand:SI 3 "immediate_operand" "s")))))]
9589 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9590 "{l|lwz} %0,%2-%3(%1)"
9591 [(set_attr "type" "load")])
9593 (define_insn "load_toc_v4_PIC_3b"
9594 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9595 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9597 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
9598 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
9599 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
9600 "{cau|addis} %0,%1,%2-%3@ha")
9602 (define_insn "load_toc_v4_PIC_3c"
9603 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9604 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9605 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
9606 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
9607 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
9608 "{cal|addi} %0,%1,%2-%3@l")
9610 ;; If the TOC is shared over a translation unit, as happens with all
9611 ;; the kinds of PIC that we support, we need to restore the TOC
9612 ;; pointer only when jumping over units of translation.
9613 ;; On Darwin, we need to reload the picbase.
9615 (define_expand "builtin_setjmp_receiver"
9616 [(use (label_ref (match_operand 0 "" "")))]
9617 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
9618 || (TARGET_TOC && TARGET_MINIMAL_TOC)
9619 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
9623 if (DEFAULT_ABI == ABI_DARWIN)
9625 const char *picbase = machopic_function_base_name ();
9626 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
9627 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
9631 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
9632 CODE_LABEL_NUMBER (operands[0]));
9633 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
9635 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
9636 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
9640 rs6000_emit_load_toc_table (FALSE);
9644 ;; Elf specific ways of loading addresses for non-PIC code.
9645 ;; The output of this could be r0, but we make a very strong
9646 ;; preference for a base register because it will usually
9648 (define_insn "elf_high"
9649 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
9650 (high:SI (match_operand 1 "" "")))]
9651 "TARGET_ELF && ! TARGET_64BIT"
9652 "{liu|lis} %0,%1@ha")
9654 (define_insn "elf_low"
9655 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9656 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
9657 (match_operand 2 "" "")))]
9658 "TARGET_ELF && ! TARGET_64BIT"
9660 {cal|la} %0,%2@l(%1)
9661 {ai|addic} %0,%1,%K2")
9663 ;; A function pointer under AIX is a pointer to a data area whose first word
9664 ;; contains the actual address of the function, whose second word contains a
9665 ;; pointer to its TOC, and whose third word contains a value to place in the
9666 ;; static chain register (r11). Note that if we load the static chain, our
9667 ;; "trampoline" need not have any executable code.
9669 (define_expand "call_indirect_aix32"
9671 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
9672 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9675 (mem:SI (plus:SI (match_dup 0)
9678 (mem:SI (plus:SI (match_dup 0)
9680 (parallel [(call (mem:SI (match_dup 2))
9681 (match_operand 1 "" ""))
9685 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9686 (clobber (scratch:SI))])]
9689 { operands[2] = gen_reg_rtx (SImode); }")
9691 (define_expand "call_indirect_aix64"
9693 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
9694 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9697 (mem:DI (plus:DI (match_dup 0)
9700 (mem:DI (plus:DI (match_dup 0)
9702 (parallel [(call (mem:SI (match_dup 2))
9703 (match_operand 1 "" ""))
9707 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9708 (clobber (scratch:SI))])]
9711 { operands[2] = gen_reg_rtx (DImode); }")
9713 (define_expand "call_value_indirect_aix32"
9715 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
9716 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9719 (mem:SI (plus:SI (match_dup 1)
9722 (mem:SI (plus:SI (match_dup 1)
9724 (parallel [(set (match_operand 0 "" "")
9725 (call (mem:SI (match_dup 3))
9726 (match_operand 2 "" "")))
9730 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9731 (clobber (scratch:SI))])]
9734 { operands[3] = gen_reg_rtx (SImode); }")
9736 (define_expand "call_value_indirect_aix64"
9738 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
9739 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9742 (mem:DI (plus:DI (match_dup 1)
9745 (mem:DI (plus:DI (match_dup 1)
9747 (parallel [(set (match_operand 0 "" "")
9748 (call (mem:SI (match_dup 3))
9749 (match_operand 2 "" "")))
9753 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9754 (clobber (scratch:SI))])]
9757 { operands[3] = gen_reg_rtx (DImode); }")
9759 ;; Now the definitions for the call and call_value insns
9760 (define_expand "call"
9761 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
9762 (match_operand 1 "" ""))
9763 (use (match_operand 2 "" ""))
9764 (clobber (scratch:SI))])]
9769 if (MACHOPIC_INDIRECT)
9770 operands[0] = machopic_indirect_call_target (operands[0]);
9773 gcc_assert (GET_CODE (operands[0]) == MEM);
9774 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
9776 operands[0] = XEXP (operands[0], 0);
9778 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
9780 && GET_CODE (operands[0]) == SYMBOL_REF
9781 && !SYMBOL_REF_LOCAL_P (operands[0]))
9787 gen_rtx_CALL (VOIDmode,
9788 gen_rtx_MEM (SImode, operands[0]),
9790 gen_rtx_USE (VOIDmode, operands[2]),
9791 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
9792 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
9793 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
9797 if (GET_CODE (operands[0]) != SYMBOL_REF
9798 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
9799 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
9801 if (INTVAL (operands[2]) & CALL_LONG)
9802 operands[0] = rs6000_longcall_ref (operands[0]);
9804 switch (DEFAULT_ABI)
9808 operands[0] = force_reg (Pmode, operands[0]);
9812 /* AIX function pointers are really pointers to a three word
9814 emit_call_insn (TARGET_32BIT
9815 ? gen_call_indirect_aix32 (force_reg (SImode,
9818 : gen_call_indirect_aix64 (force_reg (DImode,
9829 (define_expand "call_value"
9830 [(parallel [(set (match_operand 0 "" "")
9831 (call (mem:SI (match_operand 1 "address_operand" ""))
9832 (match_operand 2 "" "")))
9833 (use (match_operand 3 "" ""))
9834 (clobber (scratch:SI))])]
9839 if (MACHOPIC_INDIRECT)
9840 operands[1] = machopic_indirect_call_target (operands[1]);
9843 gcc_assert (GET_CODE (operands[1]) == MEM);
9844 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
9846 operands[1] = XEXP (operands[1], 0);
9848 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
9850 && GET_CODE (operands[1]) == SYMBOL_REF
9851 && !SYMBOL_REF_LOCAL_P (operands[1]))
9857 gen_rtx_SET (VOIDmode,
9859 gen_rtx_CALL (VOIDmode,
9860 gen_rtx_MEM (SImode,
9863 gen_rtx_USE (VOIDmode, operands[3]),
9864 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
9865 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
9866 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
9870 if (GET_CODE (operands[1]) != SYMBOL_REF
9871 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
9872 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
9874 if (INTVAL (operands[3]) & CALL_LONG)
9875 operands[1] = rs6000_longcall_ref (operands[1]);
9877 switch (DEFAULT_ABI)
9881 operands[1] = force_reg (Pmode, operands[1]);
9885 /* AIX function pointers are really pointers to a three word
9887 emit_call_insn (TARGET_32BIT
9888 ? gen_call_value_indirect_aix32 (operands[0],
9892 : gen_call_value_indirect_aix64 (operands[0],
9904 ;; Call to function in current module. No TOC pointer reload needed.
9905 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
9906 ;; either the function was not prototyped, or it was prototyped as a
9907 ;; variable argument function. It is > 0 if FP registers were passed
9908 ;; and < 0 if they were not.
9910 (define_insn "*call_local32"
9911 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
9912 (match_operand 1 "" "g,g"))
9913 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9914 (clobber (match_scratch:SI 3 "=l,l"))]
9915 "(INTVAL (operands[2]) & CALL_LONG) == 0"
9918 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9919 output_asm_insn (\"crxor 6,6,6\", operands);
9921 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9922 output_asm_insn (\"creqv 6,6,6\", operands);
9924 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9926 [(set_attr "type" "branch")
9927 (set_attr "length" "4,8")])
9929 (define_insn "*call_local64"
9930 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
9931 (match_operand 1 "" "g,g"))
9932 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9933 (clobber (match_scratch:SI 3 "=l,l"))]
9934 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
9937 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9938 output_asm_insn (\"crxor 6,6,6\", operands);
9940 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9941 output_asm_insn (\"creqv 6,6,6\", operands);
9943 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9945 [(set_attr "type" "branch")
9946 (set_attr "length" "4,8")])
9948 (define_insn "*call_value_local32"
9949 [(set (match_operand 0 "" "")
9950 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
9951 (match_operand 2 "" "g,g")))
9952 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9953 (clobber (match_scratch:SI 4 "=l,l"))]
9954 "(INTVAL (operands[3]) & CALL_LONG) == 0"
9957 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9958 output_asm_insn (\"crxor 6,6,6\", operands);
9960 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9961 output_asm_insn (\"creqv 6,6,6\", operands);
9963 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9965 [(set_attr "type" "branch")
9966 (set_attr "length" "4,8")])
9969 (define_insn "*call_value_local64"
9970 [(set (match_operand 0 "" "")
9971 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
9972 (match_operand 2 "" "g,g")))
9973 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9974 (clobber (match_scratch:SI 4 "=l,l"))]
9975 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
9978 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9979 output_asm_insn (\"crxor 6,6,6\", operands);
9981 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9982 output_asm_insn (\"creqv 6,6,6\", operands);
9984 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9986 [(set_attr "type" "branch")
9987 (set_attr "length" "4,8")])
9989 ;; Call to function which may be in another module. Restore the TOC
9990 ;; pointer (r2) after the call unless this is System V.
9991 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
9992 ;; either the function was not prototyped, or it was prototyped as a
9993 ;; variable argument function. It is > 0 if FP registers were passed
9994 ;; and < 0 if they were not.
9996 (define_insn "*call_indirect_nonlocal_aix32"
9997 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
9998 (match_operand 1 "" "g,g"))
10002 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10003 (clobber (match_scratch:SI 2 "=l,l"))]
10004 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10005 "b%T0l\;{l|lwz} 2,20(1)"
10006 [(set_attr "type" "jmpreg")
10007 (set_attr "length" "8")])
10009 (define_insn "*call_nonlocal_aix32"
10010 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10011 (match_operand 1 "" "g"))
10012 (use (match_operand:SI 2 "immediate_operand" "O"))
10013 (clobber (match_scratch:SI 3 "=l"))]
10015 && DEFAULT_ABI == ABI_AIX
10016 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10018 [(set_attr "type" "branch")
10019 (set_attr "length" "8")])
10021 (define_insn "*call_indirect_nonlocal_aix64"
10022 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10023 (match_operand 1 "" "g,g"))
10027 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10028 (clobber (match_scratch:SI 2 "=l,l"))]
10029 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10030 "b%T0l\;ld 2,40(1)"
10031 [(set_attr "type" "jmpreg")
10032 (set_attr "length" "8")])
10034 (define_insn "*call_nonlocal_aix64"
10035 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10036 (match_operand 1 "" "g"))
10037 (use (match_operand:SI 2 "immediate_operand" "O"))
10038 (clobber (match_scratch:SI 3 "=l"))]
10040 && DEFAULT_ABI == ABI_AIX
10041 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10043 [(set_attr "type" "branch")
10044 (set_attr "length" "8")])
10046 (define_insn "*call_value_indirect_nonlocal_aix32"
10047 [(set (match_operand 0 "" "")
10048 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10049 (match_operand 2 "" "g,g")))
10053 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10054 (clobber (match_scratch:SI 3 "=l,l"))]
10055 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10056 "b%T1l\;{l|lwz} 2,20(1)"
10057 [(set_attr "type" "jmpreg")
10058 (set_attr "length" "8")])
10060 (define_insn "*call_value_nonlocal_aix32"
10061 [(set (match_operand 0 "" "")
10062 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10063 (match_operand 2 "" "g")))
10064 (use (match_operand:SI 3 "immediate_operand" "O"))
10065 (clobber (match_scratch:SI 4 "=l"))]
10067 && DEFAULT_ABI == ABI_AIX
10068 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10070 [(set_attr "type" "branch")
10071 (set_attr "length" "8")])
10073 (define_insn "*call_value_indirect_nonlocal_aix64"
10074 [(set (match_operand 0 "" "")
10075 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10076 (match_operand 2 "" "g,g")))
10080 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10081 (clobber (match_scratch:SI 3 "=l,l"))]
10082 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10083 "b%T1l\;ld 2,40(1)"
10084 [(set_attr "type" "jmpreg")
10085 (set_attr "length" "8")])
10087 (define_insn "*call_value_nonlocal_aix64"
10088 [(set (match_operand 0 "" "")
10089 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10090 (match_operand 2 "" "g")))
10091 (use (match_operand:SI 3 "immediate_operand" "O"))
10092 (clobber (match_scratch:SI 4 "=l"))]
10094 && DEFAULT_ABI == ABI_AIX
10095 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10097 [(set_attr "type" "branch")
10098 (set_attr "length" "8")])
10100 ;; A function pointer under System V is just a normal pointer
10101 ;; operands[0] is the function pointer
10102 ;; operands[1] is the stack size to clean up
10103 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10104 ;; which indicates how to set cr1
10106 (define_insn "*call_indirect_nonlocal_sysv"
10107 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
10108 (match_operand 1 "" "g,g,g,g"))
10109 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10110 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10111 "DEFAULT_ABI == ABI_V4
10112 || DEFAULT_ABI == ABI_DARWIN"
10114 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10115 output_asm_insn ("crxor 6,6,6", operands);
10117 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10118 output_asm_insn ("creqv 6,6,6", operands);
10122 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10123 (set_attr "length" "4,4,8,8")])
10125 (define_insn "*call_nonlocal_sysv"
10126 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10127 (match_operand 1 "" "g,g"))
10128 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10129 (clobber (match_scratch:SI 3 "=l,l"))]
10130 "(DEFAULT_ABI == ABI_DARWIN
10131 || (DEFAULT_ABI == ABI_V4
10132 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10134 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10135 output_asm_insn ("crxor 6,6,6", operands);
10137 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10138 output_asm_insn ("creqv 6,6,6", operands);
10141 return output_call(insn, operands, 0, 2);
10143 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10145 if (TARGET_SECURE_PLT && flag_pic == 2)
10146 /* The magic 32768 offset here and in the other sysv call insns
10147 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10148 See sysv4.h:toc_section. */
10149 return "bl %z0+32768@plt";
10151 return "bl %z0@plt";
10157 [(set_attr "type" "branch,branch")
10158 (set_attr "length" "4,8")])
10160 (define_insn "*call_value_indirect_nonlocal_sysv"
10161 [(set (match_operand 0 "" "")
10162 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
10163 (match_operand 2 "" "g,g,g,g")))
10164 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10165 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10166 "DEFAULT_ABI == ABI_V4
10167 || DEFAULT_ABI == ABI_DARWIN"
10169 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10170 output_asm_insn ("crxor 6,6,6", operands);
10172 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10173 output_asm_insn ("creqv 6,6,6", operands);
10177 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10178 (set_attr "length" "4,4,8,8")])
10180 (define_insn "*call_value_nonlocal_sysv"
10181 [(set (match_operand 0 "" "")
10182 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10183 (match_operand 2 "" "g,g")))
10184 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10185 (clobber (match_scratch:SI 4 "=l,l"))]
10186 "(DEFAULT_ABI == ABI_DARWIN
10187 || (DEFAULT_ABI == ABI_V4
10188 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10190 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10191 output_asm_insn ("crxor 6,6,6", operands);
10193 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10194 output_asm_insn ("creqv 6,6,6", operands);
10197 return output_call(insn, operands, 1, 3);
10199 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10201 if (TARGET_SECURE_PLT && flag_pic == 2)
10202 return "bl %z1+32768@plt";
10204 return "bl %z1@plt";
10210 [(set_attr "type" "branch,branch")
10211 (set_attr "length" "4,8")])
10213 ;; Call subroutine returning any type.
10214 (define_expand "untyped_call"
10215 [(parallel [(call (match_operand 0 "" "")
10217 (match_operand 1 "" "")
10218 (match_operand 2 "" "")])]
10224 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10226 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10228 rtx set = XVECEXP (operands[2], 0, i);
10229 emit_move_insn (SET_DEST (set), SET_SRC (set));
10232 /* The optimizer does not know that the call sets the function value
10233 registers we stored in the result block. We avoid problems by
10234 claiming that all hard registers are used and clobbered at this
10236 emit_insn (gen_blockage ());
10241 ;; sibling call patterns
10242 (define_expand "sibcall"
10243 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10244 (match_operand 1 "" ""))
10245 (use (match_operand 2 "" ""))
10246 (use (match_operand 3 "" ""))
10252 if (MACHOPIC_INDIRECT)
10253 operands[0] = machopic_indirect_call_target (operands[0]);
10256 gcc_assert (GET_CODE (operands[0]) == MEM);
10257 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10259 operands[0] = XEXP (operands[0], 0);
10260 operands[3] = gen_reg_rtx (SImode);
10264 ;; this and similar patterns must be marked as using LR, otherwise
10265 ;; dataflow will try to delete the store into it. This is true
10266 ;; even when the actual reg to jump to is in CTR, when LR was
10267 ;; saved and restored around the PIC-setting BCL.
10268 (define_insn "*sibcall_local32"
10269 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10270 (match_operand 1 "" "g,g"))
10271 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10272 (use (match_operand:SI 3 "register_operand" "l,l"))
10274 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10277 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10278 output_asm_insn (\"crxor 6,6,6\", operands);
10280 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10281 output_asm_insn (\"creqv 6,6,6\", operands);
10283 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10285 [(set_attr "type" "branch")
10286 (set_attr "length" "4,8")])
10288 (define_insn "*sibcall_local64"
10289 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10290 (match_operand 1 "" "g,g"))
10291 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10292 (use (match_operand:SI 3 "register_operand" "l,l"))
10294 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10297 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10298 output_asm_insn (\"crxor 6,6,6\", operands);
10300 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10301 output_asm_insn (\"creqv 6,6,6\", operands);
10303 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10305 [(set_attr "type" "branch")
10306 (set_attr "length" "4,8")])
10308 (define_insn "*sibcall_value_local32"
10309 [(set (match_operand 0 "" "")
10310 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10311 (match_operand 2 "" "g,g")))
10312 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10313 (use (match_operand:SI 4 "register_operand" "l,l"))
10315 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10318 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10319 output_asm_insn (\"crxor 6,6,6\", operands);
10321 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10322 output_asm_insn (\"creqv 6,6,6\", operands);
10324 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10326 [(set_attr "type" "branch")
10327 (set_attr "length" "4,8")])
10330 (define_insn "*sibcall_value_local64"
10331 [(set (match_operand 0 "" "")
10332 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10333 (match_operand 2 "" "g,g")))
10334 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10335 (use (match_operand:SI 4 "register_operand" "l,l"))
10337 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10340 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10341 output_asm_insn (\"crxor 6,6,6\", operands);
10343 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10344 output_asm_insn (\"creqv 6,6,6\", operands);
10346 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10348 [(set_attr "type" "branch")
10349 (set_attr "length" "4,8")])
10351 (define_insn "*sibcall_nonlocal_aix32"
10352 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10353 (match_operand 1 "" "g"))
10354 (use (match_operand:SI 2 "immediate_operand" "O"))
10355 (use (match_operand:SI 3 "register_operand" "l"))
10358 && DEFAULT_ABI == ABI_AIX
10359 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10361 [(set_attr "type" "branch")
10362 (set_attr "length" "4")])
10364 (define_insn "*sibcall_nonlocal_aix64"
10365 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10366 (match_operand 1 "" "g"))
10367 (use (match_operand:SI 2 "immediate_operand" "O"))
10368 (use (match_operand:SI 3 "register_operand" "l"))
10371 && DEFAULT_ABI == ABI_AIX
10372 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10374 [(set_attr "type" "branch")
10375 (set_attr "length" "4")])
10377 (define_insn "*sibcall_value_nonlocal_aix32"
10378 [(set (match_operand 0 "" "")
10379 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10380 (match_operand 2 "" "g")))
10381 (use (match_operand:SI 3 "immediate_operand" "O"))
10382 (use (match_operand:SI 4 "register_operand" "l"))
10385 && DEFAULT_ABI == ABI_AIX
10386 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10388 [(set_attr "type" "branch")
10389 (set_attr "length" "4")])
10391 (define_insn "*sibcall_value_nonlocal_aix64"
10392 [(set (match_operand 0 "" "")
10393 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10394 (match_operand 2 "" "g")))
10395 (use (match_operand:SI 3 "immediate_operand" "O"))
10396 (use (match_operand:SI 4 "register_operand" "l"))
10399 && DEFAULT_ABI == ABI_AIX
10400 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10402 [(set_attr "type" "branch")
10403 (set_attr "length" "4")])
10405 (define_insn "*sibcall_nonlocal_sysv"
10406 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10407 (match_operand 1 "" ""))
10408 (use (match_operand 2 "immediate_operand" "O,n"))
10409 (use (match_operand:SI 3 "register_operand" "l,l"))
10411 "(DEFAULT_ABI == ABI_DARWIN
10412 || DEFAULT_ABI == ABI_V4)
10413 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10416 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10417 output_asm_insn (\"crxor 6,6,6\", operands);
10419 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10420 output_asm_insn (\"creqv 6,6,6\", operands);
10422 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10424 if (TARGET_SECURE_PLT && flag_pic == 2)
10425 return \"b %z0+32768@plt\";
10427 return \"b %z0@plt\";
10432 [(set_attr "type" "branch,branch")
10433 (set_attr "length" "4,8")])
10435 (define_expand "sibcall_value"
10436 [(parallel [(set (match_operand 0 "register_operand" "")
10437 (call (mem:SI (match_operand 1 "address_operand" ""))
10438 (match_operand 2 "" "")))
10439 (use (match_operand 3 "" ""))
10440 (use (match_operand 4 "" ""))
10446 if (MACHOPIC_INDIRECT)
10447 operands[1] = machopic_indirect_call_target (operands[1]);
10450 gcc_assert (GET_CODE (operands[1]) == MEM);
10451 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10453 operands[1] = XEXP (operands[1], 0);
10454 operands[4] = gen_reg_rtx (SImode);
10458 (define_insn "*sibcall_value_nonlocal_sysv"
10459 [(set (match_operand 0 "" "")
10460 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10461 (match_operand 2 "" "")))
10462 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10463 (use (match_operand:SI 4 "register_operand" "l,l"))
10465 "(DEFAULT_ABI == ABI_DARWIN
10466 || DEFAULT_ABI == ABI_V4)
10467 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10470 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10471 output_asm_insn (\"crxor 6,6,6\", operands);
10473 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10474 output_asm_insn (\"creqv 6,6,6\", operands);
10476 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10478 if (TARGET_SECURE_PLT && flag_pic == 2)
10479 return \"b %z1+32768@plt\";
10481 return \"b %z1@plt\";
10486 [(set_attr "type" "branch,branch")
10487 (set_attr "length" "4,8")])
10489 (define_expand "sibcall_epilogue"
10490 [(use (const_int 0))]
10491 "TARGET_SCHED_PROLOG"
10494 rs6000_emit_epilogue (TRUE);
10498 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10499 ;; all of memory. This blocks insns from being moved across this point.
10501 (define_insn "blockage"
10502 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10506 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10507 ;; signed & unsigned, and one type of branch.
10509 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10510 ;; insns, and branches. We store the operands of compares until we see
10512 (define_expand "cmp<mode>"
10514 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
10515 (match_operand:GPR 1 "reg_or_short_operand" "")))]
10519 /* Take care of the possibility that operands[1] might be negative but
10520 this might be a logical operation. That insn doesn't exist. */
10521 if (GET_CODE (operands[1]) == CONST_INT
10522 && INTVAL (operands[1]) < 0)
10523 operands[1] = force_reg (<MODE>mode, operands[1]);
10525 rs6000_compare_op0 = operands[0];
10526 rs6000_compare_op1 = operands[1];
10527 rs6000_compare_fp_p = 0;
10531 (define_expand "cmp<mode>"
10532 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
10533 (match_operand:FP 1 "gpc_reg_operand" "")))]
10537 rs6000_compare_op0 = operands[0];
10538 rs6000_compare_op1 = operands[1];
10539 rs6000_compare_fp_p = 1;
10543 (define_expand "beq"
10544 [(use (match_operand 0 "" ""))]
10546 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10548 (define_expand "bne"
10549 [(use (match_operand 0 "" ""))]
10551 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10553 (define_expand "bge"
10554 [(use (match_operand 0 "" ""))]
10556 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10558 (define_expand "bgt"
10559 [(use (match_operand 0 "" ""))]
10561 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10563 (define_expand "ble"
10564 [(use (match_operand 0 "" ""))]
10566 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10568 (define_expand "blt"
10569 [(use (match_operand 0 "" ""))]
10571 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10573 (define_expand "bgeu"
10574 [(use (match_operand 0 "" ""))]
10576 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10578 (define_expand "bgtu"
10579 [(use (match_operand 0 "" ""))]
10581 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10583 (define_expand "bleu"
10584 [(use (match_operand 0 "" ""))]
10586 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10588 (define_expand "bltu"
10589 [(use (match_operand 0 "" ""))]
10591 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10593 (define_expand "bunordered"
10594 [(use (match_operand 0 "" ""))]
10595 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10596 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10598 (define_expand "bordered"
10599 [(use (match_operand 0 "" ""))]
10600 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10601 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10603 (define_expand "buneq"
10604 [(use (match_operand 0 "" ""))]
10606 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10608 (define_expand "bunge"
10609 [(use (match_operand 0 "" ""))]
10611 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10613 (define_expand "bungt"
10614 [(use (match_operand 0 "" ""))]
10616 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10618 (define_expand "bunle"
10619 [(use (match_operand 0 "" ""))]
10621 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10623 (define_expand "bunlt"
10624 [(use (match_operand 0 "" ""))]
10626 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10628 (define_expand "bltgt"
10629 [(use (match_operand 0 "" ""))]
10631 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
10633 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
10634 ;; For SEQ, likewise, except that comparisons with zero should be done
10635 ;; with an scc insns. However, due to the order that combine see the
10636 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
10637 ;; the cases we don't want to handle.
10638 (define_expand "seq"
10639 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10641 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
10643 (define_expand "sne"
10644 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10648 if (! rs6000_compare_fp_p)
10651 rs6000_emit_sCOND (NE, operands[0]);
10655 ;; A >= 0 is best done the portable way for A an integer.
10656 (define_expand "sge"
10657 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10661 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10664 rs6000_emit_sCOND (GE, operands[0]);
10668 ;; A > 0 is best done using the portable sequence, so fail in that case.
10669 (define_expand "sgt"
10670 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10674 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10677 rs6000_emit_sCOND (GT, operands[0]);
10681 ;; A <= 0 is best done the portable way for A an integer.
10682 (define_expand "sle"
10683 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10687 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10690 rs6000_emit_sCOND (LE, operands[0]);
10694 ;; A < 0 is best done in the portable way for A an integer.
10695 (define_expand "slt"
10696 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10700 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10703 rs6000_emit_sCOND (LT, operands[0]);
10707 (define_expand "sgeu"
10708 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10710 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
10712 (define_expand "sgtu"
10713 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10715 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
10717 (define_expand "sleu"
10718 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10720 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
10722 (define_expand "sltu"
10723 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10725 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
10727 (define_expand "sunordered"
10728 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10729 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10730 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
10732 (define_expand "sordered"
10733 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10734 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10735 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
10737 (define_expand "suneq"
10738 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10740 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
10742 (define_expand "sunge"
10743 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10745 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
10747 (define_expand "sungt"
10748 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10750 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
10752 (define_expand "sunle"
10753 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10755 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
10757 (define_expand "sunlt"
10758 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10760 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
10762 (define_expand "sltgt"
10763 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10765 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
10767 (define_expand "stack_protect_set"
10768 [(match_operand 0 "memory_operand" "")
10769 (match_operand 1 "memory_operand" "")]
10772 #ifdef TARGET_THREAD_SSP_OFFSET
10773 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
10774 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
10775 operands[1] = gen_rtx_MEM (Pmode, addr);
10778 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
10780 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
10784 (define_insn "stack_protect_setsi"
10785 [(set (match_operand:SI 0 "memory_operand" "=m")
10786 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
10787 (set (match_scratch:SI 2 "=&r") (const_int 0))]
10789 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
10790 [(set_attr "type" "three")
10791 (set_attr "length" "12")])
10793 (define_insn "stack_protect_setdi"
10794 [(set (match_operand:DI 0 "memory_operand" "=m")
10795 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
10796 (set (match_scratch:DI 2 "=&r") (const_int 0))]
10798 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
10799 [(set_attr "type" "three")
10800 (set_attr "length" "12")])
10802 (define_expand "stack_protect_test"
10803 [(match_operand 0 "memory_operand" "")
10804 (match_operand 1 "memory_operand" "")
10805 (match_operand 2 "" "")]
10808 #ifdef TARGET_THREAD_SSP_OFFSET
10809 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
10810 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
10811 operands[1] = gen_rtx_MEM (Pmode, addr);
10813 rs6000_compare_op0 = operands[0];
10814 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
10816 rs6000_compare_fp_p = 0;
10817 emit_jump_insn (gen_beq (operands[2]));
10821 (define_insn "stack_protect_testsi"
10822 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
10823 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
10824 (match_operand:SI 2 "memory_operand" "m,m")]
10826 (set (match_scratch:SI 4 "=r,r") (const_int 0))
10827 (clobber (match_scratch:SI 3 "=&r,&r"))]
10830 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
10831 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;{cmpl|cmplw} %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
10832 [(set_attr "length" "16,20")])
10834 (define_insn "stack_protect_testdi"
10835 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
10836 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
10837 (match_operand:DI 2 "memory_operand" "m,m")]
10839 (set (match_scratch:DI 4 "=r,r") (const_int 0))
10840 (clobber (match_scratch:DI 3 "=&r,&r"))]
10843 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
10844 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
10845 [(set_attr "length" "16,20")])
10848 ;; Here are the actual compare insns.
10849 (define_insn "*cmp<mode>_internal1"
10850 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10851 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
10852 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
10854 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
10855 [(set_attr "type" "cmp")])
10857 ;; If we are comparing a register for equality with a large constant,
10858 ;; we can do this with an XOR followed by a compare. But we need a scratch
10859 ;; register for the result of the XOR.
10862 [(set (match_operand:CC 0 "cc_reg_operand" "")
10863 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10864 (match_operand:SI 2 "non_short_cint_operand" "")))
10865 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
10866 "find_single_use (operands[0], insn, 0)
10867 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
10868 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
10869 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
10870 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
10873 /* Get the constant we are comparing against, C, and see what it looks like
10874 sign-extended to 16 bits. Then see what constant could be XOR'ed
10875 with C to get the sign-extended value. */
10877 HOST_WIDE_INT c = INTVAL (operands[2]);
10878 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
10879 HOST_WIDE_INT xorv = c ^ sextc;
10881 operands[4] = GEN_INT (xorv);
10882 operands[5] = GEN_INT (sextc);
10885 (define_insn "*cmpsi_internal2"
10886 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10887 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10888 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
10890 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
10891 [(set_attr "type" "cmp")])
10893 (define_insn "*cmpdi_internal2"
10894 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10895 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
10896 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
10898 "cmpld%I2 %0,%1,%b2"
10899 [(set_attr "type" "cmp")])
10901 ;; The following two insns don't exist as single insns, but if we provide
10902 ;; them, we can swap an add and compare, which will enable us to overlap more
10903 ;; of the required delay between a compare and branch. We generate code for
10904 ;; them by splitting.
10907 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
10908 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10909 (match_operand:SI 2 "short_cint_operand" "i")))
10910 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10911 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10914 [(set_attr "length" "8")])
10917 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
10918 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10919 (match_operand:SI 2 "u_short_cint_operand" "i")))
10920 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10921 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10924 [(set_attr "length" "8")])
10927 [(set (match_operand:CC 3 "cc_reg_operand" "")
10928 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10929 (match_operand:SI 2 "short_cint_operand" "")))
10930 (set (match_operand:SI 0 "gpc_reg_operand" "")
10931 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10933 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
10934 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10937 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
10938 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
10939 (match_operand:SI 2 "u_short_cint_operand" "")))
10940 (set (match_operand:SI 0 "gpc_reg_operand" "")
10941 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10943 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
10944 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10946 (define_insn "*cmpsf_internal1"
10947 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10948 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
10949 (match_operand:SF 2 "gpc_reg_operand" "f")))]
10950 "TARGET_HARD_FLOAT && TARGET_FPRS"
10952 [(set_attr "type" "fpcompare")])
10954 (define_insn "*cmpdf_internal1"
10955 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10956 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
10957 (match_operand:DF 2 "gpc_reg_operand" "f")))]
10958 "TARGET_HARD_FLOAT && TARGET_FPRS"
10960 [(set_attr "type" "fpcompare")])
10962 ;; Only need to compare second words if first words equal
10963 (define_insn "*cmptf_internal1"
10964 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10965 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10966 (match_operand:TF 2 "gpc_reg_operand" "f")))]
10967 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
10968 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10969 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
10970 [(set_attr "type" "fpcompare")
10971 (set_attr "length" "12")])
10973 (define_insn_and_split "*cmptf_internal2"
10974 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10975 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10976 (match_operand:TF 2 "gpc_reg_operand" "f")))
10977 (clobber (match_scratch:DF 3 "=f"))
10978 (clobber (match_scratch:DF 4 "=f"))
10979 (clobber (match_scratch:DF 5 "=f"))
10980 (clobber (match_scratch:DF 6 "=f"))
10981 (clobber (match_scratch:DF 7 "=f"))
10982 (clobber (match_scratch:DF 8 "=f"))
10983 (clobber (match_scratch:DF 9 "=f"))
10984 (clobber (match_scratch:DF 10 "=f"))]
10985 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
10986 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10988 "&& reload_completed"
10989 [(set (match_dup 3) (match_dup 13))
10990 (set (match_dup 4) (match_dup 14))
10991 (set (match_dup 9) (abs:DF (match_dup 5)))
10992 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
10993 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
10994 (label_ref (match_dup 11))
10996 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
10997 (set (pc) (label_ref (match_dup 12)))
10999 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
11000 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
11001 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
11002 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11005 REAL_VALUE_TYPE rv;
11006 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11007 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11009 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11010 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11011 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11012 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11013 operands[11] = gen_label_rtx ();
11014 operands[12] = gen_label_rtx ();
11016 operands[13] = force_const_mem (DFmode,
11017 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11018 operands[14] = force_const_mem (DFmode,
11019 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11023 operands[13] = gen_const_mem (DFmode,
11024 create_TOC_reference (XEXP (operands[13], 0)));
11025 operands[14] = gen_const_mem (DFmode,
11026 create_TOC_reference (XEXP (operands[14], 0)));
11027 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11028 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11032 ;; Now we have the scc insns. We can do some combinations because of the
11033 ;; way the machine works.
11035 ;; Note that this is probably faster if we can put an insn between the
11036 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11037 ;; cases the insns below which don't use an intermediate CR field will
11038 ;; be used instead.
11040 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11041 (match_operator:SI 1 "scc_comparison_operator"
11042 [(match_operand 2 "cc_reg_operand" "y")
11045 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11046 [(set (attr "type")
11047 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11048 (const_string "mfcrf")
11050 (const_string "mfcr")))
11051 (set_attr "length" "8")])
11053 ;; Same as above, but get the GT bit.
11054 (define_insn "move_from_CR_gt_bit"
11055 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11056 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11058 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11059 [(set_attr "type" "mfcr")
11060 (set_attr "length" "8")])
11062 ;; Same as above, but get the OV/ORDERED bit.
11063 (define_insn "move_from_CR_ov_bit"
11064 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11065 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11067 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11068 [(set_attr "type" "mfcr")
11069 (set_attr "length" "8")])
11072 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11073 (match_operator:DI 1 "scc_comparison_operator"
11074 [(match_operand 2 "cc_reg_operand" "y")
11077 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11078 [(set (attr "type")
11079 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11080 (const_string "mfcrf")
11082 (const_string "mfcr")))
11083 (set_attr "length" "8")])
11086 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11087 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11088 [(match_operand 2 "cc_reg_operand" "y,y")
11091 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11092 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11095 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11097 [(set_attr "type" "delayed_compare")
11098 (set_attr "length" "8,16")])
11101 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11102 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11103 [(match_operand 2 "cc_reg_operand" "")
11106 (set (match_operand:SI 3 "gpc_reg_operand" "")
11107 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11108 "TARGET_32BIT && reload_completed"
11109 [(set (match_dup 3)
11110 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11112 (compare:CC (match_dup 3)
11117 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11118 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11119 [(match_operand 2 "cc_reg_operand" "y")
11121 (match_operand:SI 3 "const_int_operand" "n")))]
11125 int is_bit = ccr_bit (operands[1], 1);
11126 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11129 if (is_bit >= put_bit)
11130 count = is_bit - put_bit;
11132 count = 32 - (put_bit - is_bit);
11134 operands[4] = GEN_INT (count);
11135 operands[5] = GEN_INT (put_bit);
11137 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11139 [(set (attr "type")
11140 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11141 (const_string "mfcrf")
11143 (const_string "mfcr")))
11144 (set_attr "length" "8")])
11147 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11149 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11150 [(match_operand 2 "cc_reg_operand" "y,y")
11152 (match_operand:SI 3 "const_int_operand" "n,n"))
11154 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11155 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11160 int is_bit = ccr_bit (operands[1], 1);
11161 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11164 /* Force split for non-cc0 compare. */
11165 if (which_alternative == 1)
11168 if (is_bit >= put_bit)
11169 count = is_bit - put_bit;
11171 count = 32 - (put_bit - is_bit);
11173 operands[5] = GEN_INT (count);
11174 operands[6] = GEN_INT (put_bit);
11176 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11178 [(set_attr "type" "delayed_compare")
11179 (set_attr "length" "8,16")])
11182 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11184 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11185 [(match_operand 2 "cc_reg_operand" "")
11187 (match_operand:SI 3 "const_int_operand" ""))
11189 (set (match_operand:SI 4 "gpc_reg_operand" "")
11190 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11193 [(set (match_dup 4)
11194 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11197 (compare:CC (match_dup 4)
11201 ;; There is a 3 cycle delay between consecutive mfcr instructions
11202 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11205 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11206 (match_operator:SI 1 "scc_comparison_operator"
11207 [(match_operand 2 "cc_reg_operand" "y")
11209 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11210 (match_operator:SI 4 "scc_comparison_operator"
11211 [(match_operand 5 "cc_reg_operand" "y")
11213 "REGNO (operands[2]) != REGNO (operands[5])"
11214 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11215 [(set_attr "type" "mfcr")
11216 (set_attr "length" "12")])
11219 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11220 (match_operator:DI 1 "scc_comparison_operator"
11221 [(match_operand 2 "cc_reg_operand" "y")
11223 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11224 (match_operator:DI 4 "scc_comparison_operator"
11225 [(match_operand 5 "cc_reg_operand" "y")
11227 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11228 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11229 [(set_attr "type" "mfcr")
11230 (set_attr "length" "12")])
11232 ;; There are some scc insns that can be done directly, without a compare.
11233 ;; These are faster because they don't involve the communications between
11234 ;; the FXU and branch units. In fact, we will be replacing all of the
11235 ;; integer scc insns here or in the portable methods in emit_store_flag.
11237 ;; Also support (neg (scc ..)) since that construct is used to replace
11238 ;; branches, (plus (scc ..) ..) since that construct is common and
11239 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11240 ;; cases where it is no more expensive than (neg (scc ..)).
11242 ;; Have reload force a constant into a register for the simple insns that
11243 ;; otherwise won't accept constants. We do this because it is faster than
11244 ;; the cmp/mfcr sequence we would otherwise generate.
11246 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11249 (define_insn_and_split "*eq<mode>"
11250 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11251 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11252 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))
11253 (clobber (match_scratch:GPR 3 "=r"))
11254 (clobber (match_scratch:GPR 4 "=r"))]
11258 [(set (match_dup 3)
11259 (clz:GPR (match_dup 4)))
11261 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
11263 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11265 if (logical_operand (operands[2], <MODE>mode))
11266 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11267 gen_rtx_XOR (<MODE>mode,
11268 operands[1], operands[2])));
11270 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11271 gen_rtx_PLUS (<MODE>mode, operands[1],
11272 negate_rtx (<MODE>mode,
11276 operands[4] = operands[1];
11278 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11281 (define_insn_and_split "*eq<mode>_compare"
11282 [(set (match_operand:CC 5 "cc_reg_operand" "=y")
11284 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11285 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11287 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11288 (eq:P (match_dup 1) (match_dup 2)))
11289 (clobber (match_scratch:P 3 "=r"))
11290 (clobber (match_scratch:P 4 "=r"))]
11294 [(set (match_dup 3)
11295 (clz:P (match_dup 4)))
11296 (parallel [(set (match_dup 5)
11297 (compare:CC (lshiftrt:P (match_dup 3) (match_dup 6))
11300 (lshiftrt:P (match_dup 3) (match_dup 6)))])]
11302 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11304 if (logical_operand (operands[2], <MODE>mode))
11305 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11306 gen_rtx_XOR (<MODE>mode,
11307 operands[1], operands[2])));
11309 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11310 gen_rtx_PLUS (<MODE>mode, operands[1],
11311 negate_rtx (<MODE>mode,
11315 operands[4] = operands[1];
11317 operands[6] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11320 ;; We have insns of the form shown by the first define_insn below. If
11321 ;; there is something inside the comparison operation, we must split it.
11323 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11324 (plus:SI (match_operator 1 "comparison_operator"
11325 [(match_operand:SI 2 "" "")
11326 (match_operand:SI 3
11327 "reg_or_cint_operand" "")])
11328 (match_operand:SI 4 "gpc_reg_operand" "")))
11329 (clobber (match_operand:SI 5 "register_operand" ""))]
11330 "! gpc_reg_operand (operands[2], SImode)"
11331 [(set (match_dup 5) (match_dup 2))
11332 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11336 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11337 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11338 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11339 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11342 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11343 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11344 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11345 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11346 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11347 [(set_attr "type" "three,two,three,three,three")
11348 (set_attr "length" "12,8,12,12,12")])
11351 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11354 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11355 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11356 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11358 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11361 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11362 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11363 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11364 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11365 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11371 [(set_attr "type" "compare")
11372 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11375 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11378 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11379 (match_operand:SI 2 "scc_eq_operand" ""))
11380 (match_operand:SI 3 "gpc_reg_operand" ""))
11382 (clobber (match_scratch:SI 4 ""))]
11383 "TARGET_32BIT && reload_completed"
11384 [(set (match_dup 4)
11385 (plus:SI (eq:SI (match_dup 1)
11389 (compare:CC (match_dup 4)
11394 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11397 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11398 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11399 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11401 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11402 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11405 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11406 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11407 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11408 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11409 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11415 [(set_attr "type" "compare")
11416 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11419 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11422 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11423 (match_operand:SI 2 "scc_eq_operand" ""))
11424 (match_operand:SI 3 "gpc_reg_operand" ""))
11426 (set (match_operand:SI 0 "gpc_reg_operand" "")
11427 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11428 "TARGET_32BIT && reload_completed"
11429 [(set (match_dup 0)
11430 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11432 (compare:CC (match_dup 0)
11437 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11438 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11439 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))))]
11442 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11443 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11444 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11445 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11446 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11447 [(set_attr "type" "three,two,three,three,three")
11448 (set_attr "length" "12,8,12,12,12")])
11450 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11451 ;; since it nabs/sr is just as fast.
11452 (define_insn "*ne0"
11453 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11454 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11456 (clobber (match_scratch:SI 2 "=&r"))]
11457 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11458 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11459 [(set_attr "type" "two")
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 "type" "two")
11470 (set_attr "length" "8")])
11472 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11474 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11475 (plus:SI (lshiftrt:SI
11476 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11478 (match_operand:SI 2 "gpc_reg_operand" "r")))
11479 (clobber (match_scratch:SI 3 "=&r"))]
11481 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11482 [(set_attr "type" "two")
11483 (set_attr "length" "8")])
11486 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11487 (plus:DI (lshiftrt:DI
11488 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11490 (match_operand:DI 2 "gpc_reg_operand" "r")))
11491 (clobber (match_scratch:DI 3 "=&r"))]
11493 "addic %3,%1,-1\;addze %0,%2"
11494 [(set_attr "type" "two")
11495 (set_attr "length" "8")])
11498 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11500 (plus:SI (lshiftrt:SI
11501 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11503 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11505 (clobber (match_scratch:SI 3 "=&r,&r"))
11506 (clobber (match_scratch:SI 4 "=X,&r"))]
11509 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11511 [(set_attr "type" "compare")
11512 (set_attr "length" "8,12")])
11515 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11517 (plus:SI (lshiftrt:SI
11518 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11520 (match_operand:SI 2 "gpc_reg_operand" ""))
11522 (clobber (match_scratch:SI 3 ""))
11523 (clobber (match_scratch:SI 4 ""))]
11524 "TARGET_32BIT && reload_completed"
11525 [(parallel [(set (match_dup 3)
11526 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11529 (clobber (match_dup 4))])
11531 (compare:CC (match_dup 3)
11536 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11538 (plus:DI (lshiftrt:DI
11539 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11541 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11543 (clobber (match_scratch:DI 3 "=&r,&r"))]
11546 addic %3,%1,-1\;addze. %3,%2
11548 [(set_attr "type" "compare")
11549 (set_attr "length" "8,12")])
11552 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11554 (plus:DI (lshiftrt:DI
11555 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11557 (match_operand:DI 2 "gpc_reg_operand" ""))
11559 (clobber (match_scratch:DI 3 ""))]
11560 "TARGET_64BIT && reload_completed"
11561 [(set (match_dup 3)
11562 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11566 (compare:CC (match_dup 3)
11571 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11573 (plus:SI (lshiftrt:SI
11574 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11576 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11578 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11579 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11581 (clobber (match_scratch:SI 3 "=&r,&r"))]
11584 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11586 [(set_attr "type" "compare")
11587 (set_attr "length" "8,12")])
11590 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11592 (plus:SI (lshiftrt:SI
11593 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11595 (match_operand:SI 2 "gpc_reg_operand" ""))
11597 (set (match_operand:SI 0 "gpc_reg_operand" "")
11598 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11600 (clobber (match_scratch:SI 3 ""))]
11601 "TARGET_32BIT && reload_completed"
11602 [(parallel [(set (match_dup 0)
11603 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11605 (clobber (match_dup 3))])
11607 (compare:CC (match_dup 0)
11612 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11614 (plus:DI (lshiftrt:DI
11615 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11617 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11619 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11620 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11622 (clobber (match_scratch:DI 3 "=&r,&r"))]
11625 addic %3,%1,-1\;addze. %0,%2
11627 [(set_attr "type" "compare")
11628 (set_attr "length" "8,12")])
11631 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11633 (plus:DI (lshiftrt:DI
11634 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11636 (match_operand:DI 2 "gpc_reg_operand" ""))
11638 (set (match_operand:DI 0 "gpc_reg_operand" "")
11639 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11641 (clobber (match_scratch:DI 3 ""))]
11642 "TARGET_64BIT && reload_completed"
11643 [(parallel [(set (match_dup 0)
11644 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11646 (clobber (match_dup 3))])
11648 (compare:CC (match_dup 0)
11653 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11654 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11655 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11656 (clobber (match_scratch:SI 3 "=r,X"))]
11659 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11660 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11661 [(set_attr "length" "12")])
11664 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11666 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11667 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11669 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11670 (le:SI (match_dup 1) (match_dup 2)))
11671 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11674 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11675 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11678 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11679 (set_attr "length" "12,12,16,16")])
11682 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11684 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11685 (match_operand:SI 2 "reg_or_short_operand" ""))
11687 (set (match_operand:SI 0 "gpc_reg_operand" "")
11688 (le:SI (match_dup 1) (match_dup 2)))
11689 (clobber (match_scratch:SI 3 ""))]
11690 "TARGET_POWER && reload_completed"
11691 [(parallel [(set (match_dup 0)
11692 (le:SI (match_dup 1) (match_dup 2)))
11693 (clobber (match_dup 3))])
11695 (compare:CC (match_dup 0)
11700 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11701 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11702 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11703 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11706 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11707 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11708 [(set_attr "length" "12")])
11711 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11713 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11714 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11715 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11717 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11720 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11721 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11724 [(set_attr "type" "compare")
11725 (set_attr "length" "12,12,16,16")])
11728 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11730 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11731 (match_operand:SI 2 "reg_or_short_operand" ""))
11732 (match_operand:SI 3 "gpc_reg_operand" ""))
11734 (clobber (match_scratch:SI 4 ""))]
11735 "TARGET_POWER && reload_completed"
11736 [(set (match_dup 4)
11737 (plus:SI (le:SI (match_dup 1) (match_dup 2))
11740 (compare:CC (match_dup 4)
11745 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11747 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11748 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11749 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11751 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
11752 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11755 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11756 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
11759 [(set_attr "type" "compare")
11760 (set_attr "length" "12,12,16,16")])
11763 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11765 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11766 (match_operand:SI 2 "reg_or_short_operand" ""))
11767 (match_operand:SI 3 "gpc_reg_operand" ""))
11769 (set (match_operand:SI 0 "gpc_reg_operand" "")
11770 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11771 "TARGET_POWER && reload_completed"
11772 [(set (match_dup 0)
11773 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11775 (compare:CC (match_dup 0)
11780 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11781 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11782 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11785 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11786 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11787 [(set_attr "length" "12")])
11790 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11791 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11792 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11794 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11795 [(set_attr "type" "three")
11796 (set_attr "length" "12")])
11799 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11800 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
11801 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11803 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
11804 [(set_attr "type" "three")
11805 (set_attr "length" "12")])
11808 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11810 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11811 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11813 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11814 (leu:DI (match_dup 1) (match_dup 2)))]
11817 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11819 [(set_attr "type" "compare")
11820 (set_attr "length" "12,16")])
11823 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11825 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
11826 (match_operand:DI 2 "reg_or_short_operand" ""))
11828 (set (match_operand:DI 0 "gpc_reg_operand" "")
11829 (leu:DI (match_dup 1) (match_dup 2)))]
11830 "TARGET_64BIT && reload_completed"
11831 [(set (match_dup 0)
11832 (leu:DI (match_dup 1) (match_dup 2)))
11834 (compare:CC (match_dup 0)
11839 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11841 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11842 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11844 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11845 (leu:SI (match_dup 1) (match_dup 2)))]
11848 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11850 [(set_attr "type" "compare")
11851 (set_attr "length" "12,16")])
11854 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11856 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11857 (match_operand:SI 2 "reg_or_short_operand" ""))
11859 (set (match_operand:SI 0 "gpc_reg_operand" "")
11860 (leu:SI (match_dup 1) (match_dup 2)))]
11861 "TARGET_32BIT && reload_completed"
11862 [(set (match_dup 0)
11863 (leu:SI (match_dup 1) (match_dup 2)))
11865 (compare:CC (match_dup 0)
11870 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11871 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11872 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11873 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11875 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
11876 [(set_attr "type" "two")
11877 (set_attr "length" "8")])
11880 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11882 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11883 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11884 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11886 (clobber (match_scratch:SI 4 "=&r,&r"))]
11889 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
11891 [(set_attr "type" "compare")
11892 (set_attr "length" "8,12")])
11895 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11897 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11898 (match_operand:SI 2 "reg_or_short_operand" ""))
11899 (match_operand:SI 3 "gpc_reg_operand" ""))
11901 (clobber (match_scratch:SI 4 ""))]
11902 "TARGET_32BIT && reload_completed"
11903 [(set (match_dup 4)
11904 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
11907 (compare:CC (match_dup 4)
11912 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11914 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11915 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11916 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11918 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11919 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11922 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
11924 [(set_attr "type" "compare")
11925 (set_attr "length" "8,12")])
11928 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11930 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11931 (match_operand:SI 2 "reg_or_short_operand" ""))
11932 (match_operand:SI 3 "gpc_reg_operand" ""))
11934 (set (match_operand:SI 0 "gpc_reg_operand" "")
11935 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11936 "TARGET_32BIT && reload_completed"
11937 [(set (match_dup 0)
11938 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11940 (compare:CC (match_dup 0)
11945 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11946 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11947 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11949 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
11950 [(set_attr "type" "three")
11951 (set_attr "length" "12")])
11954 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11956 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11957 (match_operand:SI 2 "reg_or_short_operand" "rI")))
11958 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11960 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
11961 [(set_attr "type" "three")
11962 (set_attr "length" "12")])
11965 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11968 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11969 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11970 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11972 (clobber (match_scratch:SI 4 "=&r,&r"))]
11975 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
11977 [(set_attr "type" "compare")
11978 (set_attr "length" "12,16")])
11981 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11984 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11985 (match_operand:SI 2 "reg_or_short_operand" "")))
11986 (match_operand:SI 3 "gpc_reg_operand" ""))
11988 (clobber (match_scratch:SI 4 ""))]
11989 "TARGET_32BIT && reload_completed"
11990 [(set (match_dup 4)
11991 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
11994 (compare:CC (match_dup 4)
11999 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12002 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12003 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
12004 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12006 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12007 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12010 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12012 [(set_attr "type" "compare")
12013 (set_attr "length" "12,16")])
12016 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12019 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12020 (match_operand:SI 2 "reg_or_short_operand" "")))
12021 (match_operand:SI 3 "gpc_reg_operand" ""))
12023 (set (match_operand:SI 0 "gpc_reg_operand" "")
12024 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12025 "TARGET_32BIT && reload_completed"
12026 [(set (match_dup 0)
12027 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12030 (compare:CC (match_dup 0)
12035 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12036 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12037 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12039 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12040 [(set_attr "length" "12")])
12043 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12045 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12046 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12048 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12049 (lt:SI (match_dup 1) (match_dup 2)))]
12052 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12054 [(set_attr "type" "delayed_compare")
12055 (set_attr "length" "12,16")])
12058 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12060 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12061 (match_operand:SI 2 "reg_or_short_operand" ""))
12063 (set (match_operand:SI 0 "gpc_reg_operand" "")
12064 (lt:SI (match_dup 1) (match_dup 2)))]
12065 "TARGET_POWER && reload_completed"
12066 [(set (match_dup 0)
12067 (lt:SI (match_dup 1) (match_dup 2)))
12069 (compare:CC (match_dup 0)
12074 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12075 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12076 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12077 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12079 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12080 [(set_attr "length" "12")])
12083 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12085 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12086 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12087 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12089 (clobber (match_scratch:SI 4 "=&r,&r"))]
12092 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12094 [(set_attr "type" "compare")
12095 (set_attr "length" "12,16")])
12098 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12100 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12101 (match_operand:SI 2 "reg_or_short_operand" ""))
12102 (match_operand:SI 3 "gpc_reg_operand" ""))
12104 (clobber (match_scratch:SI 4 ""))]
12105 "TARGET_POWER && reload_completed"
12106 [(set (match_dup 4)
12107 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12110 (compare:CC (match_dup 4)
12115 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12117 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12118 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12119 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12121 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12122 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12125 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12127 [(set_attr "type" "compare")
12128 (set_attr "length" "12,16")])
12131 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12133 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12134 (match_operand:SI 2 "reg_or_short_operand" ""))
12135 (match_operand:SI 3 "gpc_reg_operand" ""))
12137 (set (match_operand:SI 0 "gpc_reg_operand" "")
12138 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12139 "TARGET_POWER && reload_completed"
12140 [(set (match_dup 0)
12141 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12143 (compare:CC (match_dup 0)
12148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12149 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12150 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12152 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12153 [(set_attr "length" "12")])
12155 (define_insn_and_split ""
12156 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12157 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12158 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12162 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12163 (set (match_dup 0) (neg:SI (match_dup 0)))]
12166 (define_insn_and_split ""
12167 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12168 (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12169 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12173 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12174 (set (match_dup 0) (neg:DI (match_dup 0)))]
12178 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12180 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12181 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12183 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12184 (ltu:SI (match_dup 1) (match_dup 2)))]
12187 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12188 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12191 [(set_attr "type" "compare")
12192 (set_attr "length" "12,12,16,16")])
12195 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12197 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12198 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12200 (set (match_operand:SI 0 "gpc_reg_operand" "")
12201 (ltu:SI (match_dup 1) (match_dup 2)))]
12202 "TARGET_32BIT && reload_completed"
12203 [(set (match_dup 0)
12204 (ltu:SI (match_dup 1) (match_dup 2)))
12206 (compare:CC (match_dup 0)
12210 (define_insn_and_split ""
12211 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
12212 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12213 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12214 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12217 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12218 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12219 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
12222 (define_insn_and_split ""
12223 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
12224 (plus:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12225 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))
12226 (match_operand:DI 3 "reg_or_short_operand" "rI,rI")))]
12229 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12230 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12231 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
12235 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12237 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12238 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12239 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12241 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12244 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12245 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12248 [(set_attr "type" "compare")
12249 (set_attr "length" "12,12,16,16")])
12252 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12254 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12255 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12256 (match_operand:SI 3 "gpc_reg_operand" ""))
12258 (clobber (match_scratch:SI 4 ""))]
12259 "TARGET_32BIT && reload_completed"
12260 [(set (match_dup 4)
12261 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12264 (compare:CC (match_dup 4)
12269 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12271 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12272 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12273 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12275 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12276 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12279 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12280 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12283 [(set_attr "type" "compare")
12284 (set_attr "length" "12,12,16,16")])
12287 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12289 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12290 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12291 (match_operand:SI 3 "gpc_reg_operand" ""))
12293 (set (match_operand:SI 0 "gpc_reg_operand" "")
12294 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12295 "TARGET_32BIT && reload_completed"
12296 [(set (match_dup 0)
12297 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12299 (compare:CC (match_dup 0)
12304 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12305 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12306 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12309 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12310 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12311 [(set_attr "type" "two")
12312 (set_attr "length" "8")])
12315 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12316 (neg:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12317 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))))]
12320 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12321 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12322 [(set_attr "type" "two")
12323 (set_attr "length" "8")])
12326 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12327 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12328 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12329 (clobber (match_scratch:SI 3 "=r"))]
12331 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12332 [(set_attr "length" "12")])
12335 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12337 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12338 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12340 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12341 (ge:SI (match_dup 1) (match_dup 2)))
12342 (clobber (match_scratch:SI 3 "=r,r"))]
12345 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12347 [(set_attr "type" "compare")
12348 (set_attr "length" "12,16")])
12351 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12353 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12354 (match_operand:SI 2 "reg_or_short_operand" ""))
12356 (set (match_operand:SI 0 "gpc_reg_operand" "")
12357 (ge:SI (match_dup 1) (match_dup 2)))
12358 (clobber (match_scratch:SI 3 ""))]
12359 "TARGET_POWER && reload_completed"
12360 [(parallel [(set (match_dup 0)
12361 (ge:SI (match_dup 1) (match_dup 2)))
12362 (clobber (match_dup 3))])
12364 (compare:CC (match_dup 0)
12369 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12370 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12371 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12372 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12374 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12375 [(set_attr "length" "12")])
12378 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12380 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12381 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12382 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12384 (clobber (match_scratch:SI 4 "=&r,&r"))]
12387 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12389 [(set_attr "type" "compare")
12390 (set_attr "length" "12,16")])
12393 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12395 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12396 (match_operand:SI 2 "reg_or_short_operand" ""))
12397 (match_operand:SI 3 "gpc_reg_operand" ""))
12399 (clobber (match_scratch:SI 4 ""))]
12400 "TARGET_POWER && reload_completed"
12401 [(set (match_dup 4)
12402 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12405 (compare:CC (match_dup 4)
12410 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12412 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12413 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12414 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12416 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12417 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12420 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12422 [(set_attr "type" "compare")
12423 (set_attr "length" "12,16")])
12426 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12428 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12429 (match_operand:SI 2 "reg_or_short_operand" ""))
12430 (match_operand:SI 3 "gpc_reg_operand" ""))
12432 (set (match_operand:SI 0 "gpc_reg_operand" "")
12433 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12434 "TARGET_POWER && reload_completed"
12435 [(set (match_dup 0)
12436 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12438 (compare:CC (match_dup 0)
12443 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12444 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12445 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12447 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12448 [(set_attr "length" "12")])
12451 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12452 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12453 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12456 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12457 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12458 [(set_attr "type" "three")
12459 (set_attr "length" "12")])
12462 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12463 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12464 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12467 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12468 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12469 [(set_attr "type" "three")
12470 (set_attr "length" "12")])
12473 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12475 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12476 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12478 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12479 (geu:SI (match_dup 1) (match_dup 2)))]
12482 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12483 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12486 [(set_attr "type" "compare")
12487 (set_attr "length" "12,12,16,16")])
12490 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12492 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12493 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12495 (set (match_operand:SI 0 "gpc_reg_operand" "")
12496 (geu:SI (match_dup 1) (match_dup 2)))]
12497 "TARGET_32BIT && reload_completed"
12498 [(set (match_dup 0)
12499 (geu:SI (match_dup 1) (match_dup 2)))
12501 (compare:CC (match_dup 0)
12506 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12508 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12509 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12511 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12512 (geu:DI (match_dup 1) (match_dup 2)))]
12515 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12516 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12519 [(set_attr "type" "compare")
12520 (set_attr "length" "12,12,16,16")])
12523 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12525 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12526 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12528 (set (match_operand:DI 0 "gpc_reg_operand" "")
12529 (geu:DI (match_dup 1) (match_dup 2)))]
12530 "TARGET_64BIT && reload_completed"
12531 [(set (match_dup 0)
12532 (geu:DI (match_dup 1) (match_dup 2)))
12534 (compare:CC (match_dup 0)
12539 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12540 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12541 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12542 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12545 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12546 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12547 [(set_attr "type" "two")
12548 (set_attr "length" "8")])
12551 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12553 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12554 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12555 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12557 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12560 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12561 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12564 [(set_attr "type" "compare")
12565 (set_attr "length" "8,8,12,12")])
12568 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12570 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12571 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12572 (match_operand:SI 3 "gpc_reg_operand" ""))
12574 (clobber (match_scratch:SI 4 ""))]
12575 "TARGET_32BIT && reload_completed"
12576 [(set (match_dup 4)
12577 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12580 (compare:CC (match_dup 4)
12585 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12587 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12588 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12589 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12591 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12592 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12595 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12596 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12599 [(set_attr "type" "compare")
12600 (set_attr "length" "8,8,12,12")])
12603 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12605 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12606 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12607 (match_operand:SI 3 "gpc_reg_operand" ""))
12609 (set (match_operand:SI 0 "gpc_reg_operand" "")
12610 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12611 "TARGET_32BIT && reload_completed"
12612 [(set (match_dup 0)
12613 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12615 (compare:CC (match_dup 0)
12620 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12621 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12622 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12625 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12626 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12627 [(set_attr "type" "three")
12628 (set_attr "length" "12")])
12631 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12633 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12634 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12635 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12638 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12639 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12640 [(set_attr "type" "three")
12641 (set_attr "length" "12")])
12644 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12647 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12648 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12649 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12651 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12654 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12655 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12658 [(set_attr "type" "compare")
12659 (set_attr "length" "12,12,16,16")])
12662 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12665 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12666 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12667 (match_operand:SI 3 "gpc_reg_operand" ""))
12669 (clobber (match_scratch:SI 4 ""))]
12670 "TARGET_32BIT && reload_completed"
12671 [(set (match_dup 4)
12672 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12675 (compare:CC (match_dup 4)
12680 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12683 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12684 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12685 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12687 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12688 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12691 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12692 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12695 [(set_attr "type" "compare")
12696 (set_attr "length" "12,12,16,16")])
12699 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12702 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12703 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12704 (match_operand:SI 3 "gpc_reg_operand" ""))
12706 (set (match_operand:SI 0 "gpc_reg_operand" "")
12707 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12708 "TARGET_32BIT && reload_completed"
12709 [(set (match_dup 0)
12710 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12712 (compare:CC (match_dup 0)
12717 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12718 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12721 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12722 [(set_attr "type" "three")
12723 (set_attr "length" "12")])
12726 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12727 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12730 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12731 [(set_attr "type" "three")
12732 (set_attr "length" "12")])
12735 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12737 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12740 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12741 (gt:SI (match_dup 1) (const_int 0)))]
12744 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12746 [(set_attr "type" "delayed_compare")
12747 (set_attr "length" "12,16")])
12750 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12752 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12755 (set (match_operand:SI 0 "gpc_reg_operand" "")
12756 (gt:SI (match_dup 1) (const_int 0)))]
12757 "TARGET_32BIT && reload_completed"
12758 [(set (match_dup 0)
12759 (gt:SI (match_dup 1) (const_int 0)))
12761 (compare:CC (match_dup 0)
12766 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12768 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12771 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12772 (gt:DI (match_dup 1) (const_int 0)))]
12775 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12777 [(set_attr "type" "delayed_compare")
12778 (set_attr "length" "12,16")])
12781 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12783 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12786 (set (match_operand:DI 0 "gpc_reg_operand" "")
12787 (gt:DI (match_dup 1) (const_int 0)))]
12788 "TARGET_64BIT && reload_completed"
12789 [(set (match_dup 0)
12790 (gt:DI (match_dup 1) (const_int 0)))
12792 (compare:CC (match_dup 0)
12797 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12798 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12799 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12801 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12802 [(set_attr "length" "12")])
12805 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12807 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12808 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12810 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12811 (gt:SI (match_dup 1) (match_dup 2)))]
12814 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12816 [(set_attr "type" "delayed_compare")
12817 (set_attr "length" "12,16")])
12820 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12822 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12823 (match_operand:SI 2 "reg_or_short_operand" ""))
12825 (set (match_operand:SI 0 "gpc_reg_operand" "")
12826 (gt:SI (match_dup 1) (match_dup 2)))]
12827 "TARGET_POWER && reload_completed"
12828 [(set (match_dup 0)
12829 (gt:SI (match_dup 1) (match_dup 2)))
12831 (compare:CC (match_dup 0)
12836 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12837 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12839 (match_operand:SI 2 "gpc_reg_operand" "r")))]
12841 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
12842 [(set_attr "type" "three")
12843 (set_attr "length" "12")])
12846 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
12847 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12849 (match_operand:DI 2 "gpc_reg_operand" "r")))]
12851 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12852 [(set_attr "type" "three")
12853 (set_attr "length" "12")])
12856 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12858 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12860 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12862 (clobber (match_scratch:SI 3 "=&r,&r"))]
12865 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12867 [(set_attr "type" "compare")
12868 (set_attr "length" "12,16")])
12871 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12873 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12875 (match_operand:SI 2 "gpc_reg_operand" ""))
12877 (clobber (match_scratch:SI 3 ""))]
12878 "TARGET_32BIT && reload_completed"
12879 [(set (match_dup 3)
12880 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12883 (compare:CC (match_dup 3)
12888 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12890 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12892 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12894 (clobber (match_scratch:DI 3 "=&r,&r"))]
12897 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12899 [(set_attr "type" "compare")
12900 (set_attr "length" "12,16")])
12903 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12905 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12907 (match_operand:DI 2 "gpc_reg_operand" ""))
12909 (clobber (match_scratch:DI 3 ""))]
12910 "TARGET_64BIT && reload_completed"
12911 [(set (match_dup 3)
12912 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12915 (compare:CC (match_dup 3)
12920 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12922 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12924 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12926 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12927 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12930 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
12932 [(set_attr "type" "compare")
12933 (set_attr "length" "12,16")])
12936 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12938 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12940 (match_operand:SI 2 "gpc_reg_operand" ""))
12942 (set (match_operand:SI 0 "gpc_reg_operand" "")
12943 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12944 "TARGET_32BIT && reload_completed"
12945 [(set (match_dup 0)
12946 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12948 (compare:CC (match_dup 0)
12953 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12955 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12957 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12959 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
12960 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12963 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12965 [(set_attr "type" "compare")
12966 (set_attr "length" "12,16")])
12969 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12971 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12973 (match_operand:DI 2 "gpc_reg_operand" ""))
12975 (set (match_operand:DI 0 "gpc_reg_operand" "")
12976 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12977 "TARGET_64BIT && reload_completed"
12978 [(set (match_dup 0)
12979 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12981 (compare:CC (match_dup 0)
12986 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12987 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12988 (match_operand:SI 2 "reg_or_short_operand" "r"))
12989 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12991 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12992 [(set_attr "length" "12")])
12995 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12997 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12998 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12999 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13001 (clobber (match_scratch:SI 4 "=&r,&r"))]
13004 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13006 [(set_attr "type" "compare")
13007 (set_attr "length" "12,16")])
13010 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13012 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13013 (match_operand:SI 2 "reg_or_short_operand" ""))
13014 (match_operand:SI 3 "gpc_reg_operand" ""))
13016 (clobber (match_scratch:SI 4 ""))]
13017 "TARGET_POWER && reload_completed"
13018 [(set (match_dup 4)
13019 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13021 (compare:CC (match_dup 4)
13026 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13028 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13029 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13030 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13032 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13033 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13036 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13038 [(set_attr "type" "compare")
13039 (set_attr "length" "12,16")])
13042 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13044 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13045 (match_operand:SI 2 "reg_or_short_operand" ""))
13046 (match_operand:SI 3 "gpc_reg_operand" ""))
13048 (set (match_operand:SI 0 "gpc_reg_operand" "")
13049 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13050 "TARGET_POWER && reload_completed"
13051 [(set (match_dup 0)
13052 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13054 (compare:CC (match_dup 0)
13059 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13060 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13063 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13064 [(set_attr "type" "three")
13065 (set_attr "length" "12")])
13068 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13069 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13072 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13073 [(set_attr "type" "three")
13074 (set_attr "length" "12")])
13077 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13078 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13079 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13081 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13082 [(set_attr "length" "12")])
13084 (define_insn_and_split ""
13085 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13086 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13087 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13091 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13092 (set (match_dup 0) (neg:SI (match_dup 0)))]
13095 (define_insn_and_split ""
13096 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13097 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13098 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13102 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13103 (set (match_dup 0) (neg:DI (match_dup 0)))]
13107 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13109 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13110 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13112 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13113 (gtu:SI (match_dup 1) (match_dup 2)))]
13116 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13118 [(set_attr "type" "compare")
13119 (set_attr "length" "12,16")])
13122 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13124 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13125 (match_operand:SI 2 "reg_or_short_operand" ""))
13127 (set (match_operand:SI 0 "gpc_reg_operand" "")
13128 (gtu:SI (match_dup 1) (match_dup 2)))]
13129 "TARGET_32BIT && reload_completed"
13130 [(set (match_dup 0)
13131 (gtu:SI (match_dup 1) (match_dup 2)))
13133 (compare:CC (match_dup 0)
13138 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13140 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13141 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13143 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13144 (gtu:DI (match_dup 1) (match_dup 2)))]
13147 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13149 [(set_attr "type" "compare")
13150 (set_attr "length" "12,16")])
13153 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13155 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13156 (match_operand:DI 2 "reg_or_short_operand" ""))
13158 (set (match_operand:DI 0 "gpc_reg_operand" "")
13159 (gtu:DI (match_dup 1) (match_dup 2)))]
13160 "TARGET_64BIT && reload_completed"
13161 [(set (match_dup 0)
13162 (gtu:DI (match_dup 1) (match_dup 2)))
13164 (compare:CC (match_dup 0)
13168 (define_insn_and_split ""
13169 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13170 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13171 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13172 (match_operand:SI 3 "reg_or_short_operand" "rI")))]
13175 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13176 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13177 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
13180 (define_insn_and_split ""
13181 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13182 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13183 (match_operand:DI 2 "reg_or_short_operand" "rI"))
13184 (match_operand:DI 3 "reg_or_short_operand" "rI")))]
13187 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13188 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13189 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
13193 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13195 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13196 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13197 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13199 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13202 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13203 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
13206 [(set_attr "type" "compare")
13207 (set_attr "length" "8,12,12,16")])
13210 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13212 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13213 (match_operand:SI 2 "reg_or_short_operand" ""))
13214 (match_operand:SI 3 "gpc_reg_operand" ""))
13216 (clobber (match_scratch:SI 4 ""))]
13217 "TARGET_32BIT && reload_completed"
13218 [(set (match_dup 4)
13219 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13222 (compare:CC (match_dup 4)
13227 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13229 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13230 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13231 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13233 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13236 addic %4,%1,%k2\;addze. %4,%3
13237 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subf. %4,%4,%3
13240 [(set_attr "type" "compare")
13241 (set_attr "length" "8,12,12,16")])
13244 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13246 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13247 (match_operand:DI 2 "reg_or_short_operand" ""))
13248 (match_operand:DI 3 "gpc_reg_operand" ""))
13250 (clobber (match_scratch:DI 4 ""))]
13251 "TARGET_64BIT && reload_completed"
13252 [(set (match_dup 4)
13253 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13256 (compare:CC (match_dup 4)
13261 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13263 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13264 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13265 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13267 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13268 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13271 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13272 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
13275 [(set_attr "type" "compare")
13276 (set_attr "length" "8,12,12,16")])
13279 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13281 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13282 (match_operand:SI 2 "reg_or_short_operand" ""))
13283 (match_operand:SI 3 "gpc_reg_operand" ""))
13285 (set (match_operand:SI 0 "gpc_reg_operand" "")
13286 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13287 "TARGET_32BIT && reload_completed"
13288 [(set (match_dup 0)
13289 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13291 (compare:CC (match_dup 0)
13296 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13298 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13299 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13300 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13302 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13303 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13306 addic %0,%1,%k2\;addze. %0,%3
13307 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf. %0,%0,%3
13310 [(set_attr "type" "compare")
13311 (set_attr "length" "8,12,12,16")])
13314 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13316 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13317 (match_operand:DI 2 "reg_or_short_operand" ""))
13318 (match_operand:DI 3 "gpc_reg_operand" ""))
13320 (set (match_operand:DI 0 "gpc_reg_operand" "")
13321 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13322 "TARGET_64BIT && reload_completed"
13323 [(set (match_dup 0)
13324 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13326 (compare:CC (match_dup 0)
13331 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13332 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13333 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13335 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13336 [(set_attr "type" "two")
13337 (set_attr "length" "8")])
13340 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13341 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13342 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13344 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13345 [(set_attr "type" "two")
13346 (set_attr "length" "8")])
13348 ;; Define both directions of branch and return. If we need a reload
13349 ;; register, we'd rather use CR0 since it is much easier to copy a
13350 ;; register CC value to there.
13354 (if_then_else (match_operator 1 "branch_comparison_operator"
13356 "cc_reg_operand" "y")
13358 (label_ref (match_operand 0 "" ""))
13363 return output_cbranch (operands[1], \"%l0\", 0, insn);
13365 [(set_attr "type" "branch")])
13369 (if_then_else (match_operator 0 "branch_comparison_operator"
13371 "cc_reg_operand" "y")
13378 return output_cbranch (operands[0], NULL, 0, insn);
13380 [(set_attr "type" "branch")
13381 (set_attr "length" "4")])
13385 (if_then_else (match_operator 1 "branch_comparison_operator"
13387 "cc_reg_operand" "y")
13390 (label_ref (match_operand 0 "" ""))))]
13394 return output_cbranch (operands[1], \"%l0\", 1, insn);
13396 [(set_attr "type" "branch")])
13400 (if_then_else (match_operator 0 "branch_comparison_operator"
13402 "cc_reg_operand" "y")
13409 return output_cbranch (operands[0], NULL, 1, insn);
13411 [(set_attr "type" "branch")
13412 (set_attr "length" "4")])
13414 ;; Logic on condition register values.
13416 ; This pattern matches things like
13417 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13418 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13420 ; which are generated by the branch logic.
13421 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13423 (define_insn "*cceq_ior_compare"
13424 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13425 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13426 [(match_operator:SI 2
13427 "branch_positive_comparison_operator"
13429 "cc_reg_operand" "y,y")
13431 (match_operator:SI 4
13432 "branch_positive_comparison_operator"
13434 "cc_reg_operand" "0,y")
13438 "cr%q1 %E0,%j2,%j4"
13439 [(set_attr "type" "cr_logical,delayed_cr")])
13441 ; Why is the constant -1 here, but 1 in the previous pattern?
13442 ; Because ~1 has all but the low bit set.
13444 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13445 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13446 [(not:SI (match_operator:SI 2
13447 "branch_positive_comparison_operator"
13449 "cc_reg_operand" "y,y")
13451 (match_operator:SI 4
13452 "branch_positive_comparison_operator"
13454 "cc_reg_operand" "0,y")
13458 "cr%q1 %E0,%j2,%j4"
13459 [(set_attr "type" "cr_logical,delayed_cr")])
13461 (define_insn "*cceq_rev_compare"
13462 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13463 (compare:CCEQ (match_operator:SI 1
13464 "branch_positive_comparison_operator"
13466 "cc_reg_operand" "0,y")
13470 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13471 [(set_attr "type" "cr_logical,delayed_cr")])
13473 ;; If we are comparing the result of two comparisons, this can be done
13474 ;; using creqv or crxor.
13476 (define_insn_and_split ""
13477 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13478 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13479 [(match_operand 2 "cc_reg_operand" "y")
13481 (match_operator 3 "branch_comparison_operator"
13482 [(match_operand 4 "cc_reg_operand" "y")
13487 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13491 int positive_1, positive_2;
13493 positive_1 = branch_positive_comparison_operator (operands[1],
13494 GET_MODE (operands[1]));
13495 positive_2 = branch_positive_comparison_operator (operands[3],
13496 GET_MODE (operands[3]));
13499 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13500 GET_CODE (operands[1])),
13502 operands[2], const0_rtx);
13503 else if (GET_MODE (operands[1]) != SImode)
13504 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13505 operands[2], const0_rtx);
13508 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13509 GET_CODE (operands[3])),
13511 operands[4], const0_rtx);
13512 else if (GET_MODE (operands[3]) != SImode)
13513 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13514 operands[4], const0_rtx);
13516 if (positive_1 == positive_2)
13518 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13519 operands[5] = constm1_rtx;
13523 operands[5] = const1_rtx;
13527 ;; Unconditional branch and return.
13529 (define_insn "jump"
13531 (label_ref (match_operand 0 "" "")))]
13534 [(set_attr "type" "branch")])
13536 (define_insn "return"
13540 [(set_attr "type" "jmpreg")])
13542 (define_expand "indirect_jump"
13543 [(set (pc) (match_operand 0 "register_operand" ""))])
13545 (define_insn "*indirect_jump<mode>"
13546 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13551 [(set_attr "type" "jmpreg")])
13553 ;; Table jump for switch statements:
13554 (define_expand "tablejump"
13555 [(use (match_operand 0 "" ""))
13556 (use (label_ref (match_operand 1 "" "")))]
13561 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13563 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13567 (define_expand "tablejumpsi"
13568 [(set (match_dup 3)
13569 (plus:SI (match_operand:SI 0 "" "")
13571 (parallel [(set (pc) (match_dup 3))
13572 (use (label_ref (match_operand 1 "" "")))])]
13575 { operands[0] = force_reg (SImode, operands[0]);
13576 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13577 operands[3] = gen_reg_rtx (SImode);
13580 (define_expand "tablejumpdi"
13581 [(set (match_dup 4)
13582 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13584 (plus:DI (match_dup 4)
13586 (parallel [(set (pc) (match_dup 3))
13587 (use (label_ref (match_operand 1 "" "")))])]
13590 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13591 operands[3] = gen_reg_rtx (DImode);
13592 operands[4] = gen_reg_rtx (DImode);
13597 (match_operand:P 0 "register_operand" "c,*l"))
13598 (use (label_ref (match_operand 1 "" "")))]
13603 [(set_attr "type" "jmpreg")])
13608 "{cror 0,0,0|nop}")
13610 ;; Define the subtract-one-and-jump insns, starting with the template
13611 ;; so loop.c knows what to generate.
13613 (define_expand "doloop_end"
13614 [(use (match_operand 0 "" "")) ; loop pseudo
13615 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13616 (use (match_operand 2 "" "")) ; max iterations
13617 (use (match_operand 3 "" "")) ; loop level
13618 (use (match_operand 4 "" ""))] ; label
13622 /* Only use this on innermost loops. */
13623 if (INTVAL (operands[3]) > 1)
13627 if (GET_MODE (operands[0]) != DImode)
13629 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13633 if (GET_MODE (operands[0]) != SImode)
13635 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13640 (define_expand "ctr<mode>"
13641 [(parallel [(set (pc)
13642 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13644 (label_ref (match_operand 1 "" ""))
13647 (plus:P (match_dup 0)
13649 (clobber (match_scratch:CC 2 ""))
13650 (clobber (match_scratch:P 3 ""))])]
13654 ;; We need to be able to do this for any operand, including MEM, or we
13655 ;; will cause reload to blow up since we don't allow output reloads on
13657 ;; For the length attribute to be calculated correctly, the
13658 ;; label MUST be operand 0.
13660 (define_insn "*ctr<mode>_internal1"
13662 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13664 (label_ref (match_operand 0 "" ""))
13666 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13667 (plus:P (match_dup 1)
13669 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13670 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13674 if (which_alternative != 0)
13676 else if (get_attr_length (insn) == 4)
13677 return \"{bdn|bdnz} %l0\";
13679 return \"bdz $+8\;b %l0\";
13681 [(set_attr "type" "branch")
13682 (set_attr "length" "*,12,16,16")])
13684 (define_insn "*ctr<mode>_internal2"
13686 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13689 (label_ref (match_operand 0 "" ""))))
13690 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13691 (plus:P (match_dup 1)
13693 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13694 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13698 if (which_alternative != 0)
13700 else if (get_attr_length (insn) == 4)
13701 return \"bdz %l0\";
13703 return \"{bdn|bdnz} $+8\;b %l0\";
13705 [(set_attr "type" "branch")
13706 (set_attr "length" "*,12,16,16")])
13708 ;; Similar but use EQ
13710 (define_insn "*ctr<mode>_internal5"
13712 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13714 (label_ref (match_operand 0 "" ""))
13716 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13717 (plus:P (match_dup 1)
13719 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13720 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13724 if (which_alternative != 0)
13726 else if (get_attr_length (insn) == 4)
13727 return \"bdz %l0\";
13729 return \"{bdn|bdnz} $+8\;b %l0\";
13731 [(set_attr "type" "branch")
13732 (set_attr "length" "*,12,16,16")])
13734 (define_insn "*ctr<mode>_internal6"
13736 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13739 (label_ref (match_operand 0 "" ""))))
13740 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13741 (plus:P (match_dup 1)
13743 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13744 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13748 if (which_alternative != 0)
13750 else if (get_attr_length (insn) == 4)
13751 return \"{bdn|bdnz} %l0\";
13753 return \"bdz $+8\;b %l0\";
13755 [(set_attr "type" "branch")
13756 (set_attr "length" "*,12,16,16")])
13758 ;; Now the splitters if we could not allocate the CTR register
13762 (if_then_else (match_operator 2 "comparison_operator"
13763 [(match_operand:P 1 "gpc_reg_operand" "")
13765 (match_operand 5 "" "")
13766 (match_operand 6 "" "")))
13767 (set (match_operand:P 0 "gpc_reg_operand" "")
13768 (plus:P (match_dup 1) (const_int -1)))
13769 (clobber (match_scratch:CC 3 ""))
13770 (clobber (match_scratch:P 4 ""))]
13772 [(parallel [(set (match_dup 3)
13773 (compare:CC (plus:P (match_dup 1)
13777 (plus:P (match_dup 1)
13779 (set (pc) (if_then_else (match_dup 7)
13783 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13784 operands[3], const0_rtx); }")
13788 (if_then_else (match_operator 2 "comparison_operator"
13789 [(match_operand:P 1 "gpc_reg_operand" "")
13791 (match_operand 5 "" "")
13792 (match_operand 6 "" "")))
13793 (set (match_operand:P 0 "nonimmediate_operand" "")
13794 (plus:P (match_dup 1) (const_int -1)))
13795 (clobber (match_scratch:CC 3 ""))
13796 (clobber (match_scratch:P 4 ""))]
13797 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13798 [(parallel [(set (match_dup 3)
13799 (compare:CC (plus:P (match_dup 1)
13803 (plus:P (match_dup 1)
13807 (set (pc) (if_then_else (match_dup 7)
13811 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13812 operands[3], const0_rtx); }")
13814 (define_insn "trap"
13815 [(trap_if (const_int 1) (const_int 0))]
13819 (define_expand "conditional_trap"
13820 [(trap_if (match_operator 0 "trap_comparison_operator"
13821 [(match_dup 2) (match_dup 3)])
13822 (match_operand 1 "const_int_operand" ""))]
13824 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
13825 operands[2] = rs6000_compare_op0;
13826 operands[3] = rs6000_compare_op1;")
13829 [(trap_if (match_operator 0 "trap_comparison_operator"
13830 [(match_operand:GPR 1 "register_operand" "r")
13831 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13834 "{t|t<wd>}%V0%I2 %1,%2")
13836 ;; Insns related to generating the function prologue and epilogue.
13838 (define_expand "prologue"
13839 [(use (const_int 0))]
13840 "TARGET_SCHED_PROLOG"
13843 rs6000_emit_prologue ();
13847 (define_insn "*movesi_from_cr_one"
13848 [(match_parallel 0 "mfcr_operation"
13849 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13850 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13851 (match_operand 3 "immediate_operand" "n")]
13852 UNSPEC_MOVESI_FROM_CR))])]
13858 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13860 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13861 operands[4] = GEN_INT (mask);
13862 output_asm_insn (\"mfcr %1,%4\", operands);
13866 [(set_attr "type" "mfcrf")])
13868 (define_insn "movesi_from_cr"
13869 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13870 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
13871 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
13872 UNSPEC_MOVESI_FROM_CR))]
13875 [(set_attr "type" "mfcr")])
13877 (define_insn "*stmw"
13878 [(match_parallel 0 "stmw_operation"
13879 [(set (match_operand:SI 1 "memory_operand" "=m")
13880 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13882 "{stm|stmw} %2,%1")
13884 (define_insn "*save_fpregs_<mode>"
13885 [(match_parallel 0 "any_parallel_operand"
13886 [(clobber (match_operand:P 1 "register_operand" "=l"))
13887 (use (match_operand:P 2 "call_operand" "s"))
13888 (set (match_operand:DF 3 "memory_operand" "=m")
13889 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
13892 [(set_attr "type" "branch")
13893 (set_attr "length" "4")])
13895 ; These are to explain that changes to the stack pointer should
13896 ; not be moved over stores to stack memory.
13897 (define_insn "stack_tie"
13898 [(set (match_operand:BLK 0 "memory_operand" "+m")
13899 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
13902 [(set_attr "length" "0")])
13905 (define_expand "epilogue"
13906 [(use (const_int 0))]
13907 "TARGET_SCHED_PROLOG"
13910 rs6000_emit_epilogue (FALSE);
13914 ; On some processors, doing the mtcrf one CC register at a time is
13915 ; faster (like on the 604e). On others, doing them all at once is
13916 ; faster; for instance, on the 601 and 750.
13918 (define_expand "movsi_to_cr_one"
13919 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13920 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13921 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13923 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13925 (define_insn "*movsi_to_cr"
13926 [(match_parallel 0 "mtcrf_operation"
13927 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13928 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13929 (match_operand 3 "immediate_operand" "n")]
13930 UNSPEC_MOVESI_TO_CR))])]
13936 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13937 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13938 operands[4] = GEN_INT (mask);
13939 return \"mtcrf %4,%2\";
13941 [(set_attr "type" "mtcr")])
13943 (define_insn "*mtcrfsi"
13944 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13945 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13946 (match_operand 2 "immediate_operand" "n")]
13947 UNSPEC_MOVESI_TO_CR))]
13948 "GET_CODE (operands[0]) == REG
13949 && CR_REGNO_P (REGNO (operands[0]))
13950 && GET_CODE (operands[2]) == CONST_INT
13951 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13953 [(set_attr "type" "mtcr")])
13955 ; The load-multiple instructions have similar properties.
13956 ; Note that "load_multiple" is a name known to the machine-independent
13957 ; code that actually corresponds to the powerpc load-string.
13959 (define_insn "*lmw"
13960 [(match_parallel 0 "lmw_operation"
13961 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13962 (match_operand:SI 2 "memory_operand" "m"))])]
13966 (define_insn "*return_internal_<mode>"
13968 (use (match_operand:P 0 "register_operand" "lc"))]
13971 [(set_attr "type" "jmpreg")])
13973 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13974 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13976 (define_insn "*return_and_restore_fpregs_<mode>"
13977 [(match_parallel 0 "any_parallel_operand"
13979 (use (match_operand:P 1 "register_operand" "l"))
13980 (use (match_operand:P 2 "call_operand" "s"))
13981 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
13982 (match_operand:DF 4 "memory_operand" "m"))])]
13986 ; This is used in compiling the unwind routines.
13987 (define_expand "eh_return"
13988 [(use (match_operand 0 "general_operand" ""))]
13993 emit_insn (gen_eh_set_lr_si (operands[0]));
13995 emit_insn (gen_eh_set_lr_di (operands[0]));
13999 ; We can't expand this before we know where the link register is stored.
14000 (define_insn "eh_set_lr_<mode>"
14001 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
14003 (clobber (match_scratch:P 1 "=&b"))]
14008 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14009 (clobber (match_scratch 1 ""))]
14014 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14018 (define_insn "prefetch"
14019 [(prefetch (match_operand 0 "indexed_or_indirect_address" "a")
14020 (match_operand:SI 1 "const_int_operand" "n")
14021 (match_operand:SI 2 "const_int_operand" "n"))]
14025 if (GET_CODE (operands[0]) == REG)
14026 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14027 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14029 [(set_attr "type" "load")])
14032 (include "sync.md")
14033 (include "altivec.md")