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
67 ;; UNSPEC_VOLATILE usage
72 (UNSPECV_EH_RR 9) ; eh_reg_restore
75 ;; Define an insn type attribute. This is used in function unit delay
77 (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"
78 (const_string "integer"))
81 ; '(pc)' in the following doesn't include the instruction itself; it is
82 ; calculated as if the instruction had zero size.
83 (define_attr "length" ""
84 (if_then_else (eq_attr "type" "branch")
85 (if_then_else (and (ge (minus (match_dup 0) (pc))
87 (lt (minus (match_dup 0) (pc))
93 ;; Processor type -- this attribute must exactly match the processor_type
94 ;; enumeration in rs6000.h.
96 (define_attr "cpu" "rios1,rios2,rs64a,mpccore,ppc403,ppc405,ppc440,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,power4,power5"
97 (const (symbol_ref "rs6000_cpu_attr")))
99 (automata_option "ndfa")
112 (include "power4.md")
113 (include "power5.md")
115 (include "predicates.md")
117 (include "darwin.md")
122 ; This mode macro allows :GPR to be used to indicate the allowable size
123 ; of whole values in GPRs.
124 (define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
126 ; Any supported integer mode.
127 (define_mode_macro INT [QI HI SI DI TI])
129 ; Any supported integer mode that fits in one register.
130 (define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
132 ; SImode or DImode, even if DImode doesn't fit in GPRs.
133 (define_mode_macro SDI [SI DI])
135 ; The size of a pointer. Also, the size of the value that a record-condition
136 ; (one with a '.') will compare.
137 (define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
139 ; Any hardware-supported floating-point mode
140 (define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
141 (DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
142 (TF "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
143 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128")])
145 ; Various instructions that come in SI and DI forms.
146 ; A generic w/d attribute, for things like cmpw/cmpd.
147 (define_mode_attr wd [(SI "w") (DI "d")])
150 ;; Start with fixed-point load and store insns. Here we put only the more
151 ;; complex forms. Basic data transfer is done later.
153 (define_expand "zero_extendqidi2"
154 [(set (match_operand:DI 0 "gpc_reg_operand" "")
155 (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "")))]
160 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
161 (zero_extend:DI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
166 [(set_attr "type" "load,*")])
169 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
170 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
172 (clobber (match_scratch:DI 2 "=r,r"))]
177 [(set_attr "type" "compare")
178 (set_attr "length" "4,8")])
181 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
182 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
184 (clobber (match_scratch:DI 2 ""))]
185 "TARGET_POWERPC64 && reload_completed"
187 (zero_extend:DI (match_dup 1)))
189 (compare:CC (match_dup 2)
194 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
195 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
197 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
198 (zero_extend:DI (match_dup 1)))]
203 [(set_attr "type" "compare")
204 (set_attr "length" "4,8")])
207 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
208 (compare:CC (zero_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
210 (set (match_operand:DI 0 "gpc_reg_operand" "")
211 (zero_extend:DI (match_dup 1)))]
212 "TARGET_POWERPC64 && reload_completed"
214 (zero_extend:DI (match_dup 1)))
216 (compare:CC (match_dup 0)
220 (define_insn "extendqidi2"
221 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
222 (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
227 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
228 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
230 (clobber (match_scratch:DI 2 "=r,r"))]
235 [(set_attr "type" "compare")
236 (set_attr "length" "4,8")])
239 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
240 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
242 (clobber (match_scratch:DI 2 ""))]
243 "TARGET_POWERPC64 && reload_completed"
245 (sign_extend:DI (match_dup 1)))
247 (compare:CC (match_dup 2)
252 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
253 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
255 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
256 (sign_extend:DI (match_dup 1)))]
261 [(set_attr "type" "compare")
262 (set_attr "length" "4,8")])
265 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
266 (compare:CC (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" ""))
268 (set (match_operand:DI 0 "gpc_reg_operand" "")
269 (sign_extend:DI (match_dup 1)))]
270 "TARGET_POWERPC64 && reload_completed"
272 (sign_extend:DI (match_dup 1)))
274 (compare:CC (match_dup 0)
278 (define_expand "zero_extendhidi2"
279 [(set (match_operand:DI 0 "gpc_reg_operand" "")
280 (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
285 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
286 (zero_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
291 [(set_attr "type" "load,*")])
294 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
295 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
297 (clobber (match_scratch:DI 2 "=r,r"))]
302 [(set_attr "type" "compare")
303 (set_attr "length" "4,8")])
306 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
307 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
309 (clobber (match_scratch:DI 2 ""))]
310 "TARGET_POWERPC64 && reload_completed"
312 (zero_extend:DI (match_dup 1)))
314 (compare:CC (match_dup 2)
319 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
320 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
322 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
323 (zero_extend:DI (match_dup 1)))]
328 [(set_attr "type" "compare")
329 (set_attr "length" "4,8")])
332 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
333 (compare:CC (zero_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
335 (set (match_operand:DI 0 "gpc_reg_operand" "")
336 (zero_extend:DI (match_dup 1)))]
337 "TARGET_POWERPC64 && reload_completed"
339 (zero_extend:DI (match_dup 1)))
341 (compare:CC (match_dup 0)
345 (define_expand "extendhidi2"
346 [(set (match_operand:DI 0 "gpc_reg_operand" "")
347 (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "")))]
352 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
353 (sign_extend:DI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
358 [(set_attr "type" "load_ext,*")])
361 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
362 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
364 (clobber (match_scratch:DI 2 "=r,r"))]
369 [(set_attr "type" "compare")
370 (set_attr "length" "4,8")])
373 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
374 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
376 (clobber (match_scratch:DI 2 ""))]
377 "TARGET_POWERPC64 && reload_completed"
379 (sign_extend:DI (match_dup 1)))
381 (compare:CC (match_dup 2)
386 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
387 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
389 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
390 (sign_extend:DI (match_dup 1)))]
395 [(set_attr "type" "compare")
396 (set_attr "length" "4,8")])
399 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
400 (compare:CC (sign_extend:DI (match_operand:HI 1 "gpc_reg_operand" ""))
402 (set (match_operand:DI 0 "gpc_reg_operand" "")
403 (sign_extend:DI (match_dup 1)))]
404 "TARGET_POWERPC64 && reload_completed"
406 (sign_extend:DI (match_dup 1)))
408 (compare:CC (match_dup 0)
412 (define_expand "zero_extendsidi2"
413 [(set (match_operand:DI 0 "gpc_reg_operand" "")
414 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
419 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
420 (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r")))]
425 [(set_attr "type" "load,*")])
428 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
429 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
431 (clobber (match_scratch:DI 2 "=r,r"))]
436 [(set_attr "type" "compare")
437 (set_attr "length" "4,8")])
440 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
441 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
443 (clobber (match_scratch:DI 2 ""))]
444 "TARGET_POWERPC64 && reload_completed"
446 (zero_extend:DI (match_dup 1)))
448 (compare:CC (match_dup 2)
453 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
454 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
456 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
457 (zero_extend:DI (match_dup 1)))]
462 [(set_attr "type" "compare")
463 (set_attr "length" "4,8")])
466 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
467 (compare:CC (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
469 (set (match_operand:DI 0 "gpc_reg_operand" "")
470 (zero_extend:DI (match_dup 1)))]
471 "TARGET_POWERPC64 && reload_completed"
473 (zero_extend:DI (match_dup 1)))
475 (compare:CC (match_dup 0)
479 (define_expand "extendsidi2"
480 [(set (match_operand:DI 0 "gpc_reg_operand" "")
481 (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "")))]
486 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
487 (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
492 [(set_attr "type" "load_ext,*")])
495 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
496 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
498 (clobber (match_scratch:DI 2 "=r,r"))]
503 [(set_attr "type" "compare")
504 (set_attr "length" "4,8")])
507 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
508 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
510 (clobber (match_scratch:DI 2 ""))]
511 "TARGET_POWERPC64 && reload_completed"
513 (sign_extend:DI (match_dup 1)))
515 (compare:CC (match_dup 2)
520 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
521 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
523 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
524 (sign_extend:DI (match_dup 1)))]
529 [(set_attr "type" "compare")
530 (set_attr "length" "4,8")])
533 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
534 (compare:CC (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
536 (set (match_operand:DI 0 "gpc_reg_operand" "")
537 (sign_extend:DI (match_dup 1)))]
538 "TARGET_POWERPC64 && reload_completed"
540 (sign_extend:DI (match_dup 1)))
542 (compare:CC (match_dup 0)
546 (define_expand "zero_extendqisi2"
547 [(set (match_operand:SI 0 "gpc_reg_operand" "")
548 (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "")))]
553 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
554 (zero_extend:SI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
558 {rlinm|rlwinm} %0,%1,0,0xff"
559 [(set_attr "type" "load,*")])
562 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
563 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
565 (clobber (match_scratch:SI 2 "=r,r"))]
568 {andil.|andi.} %2,%1,0xff
570 [(set_attr "type" "compare")
571 (set_attr "length" "4,8")])
574 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
575 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
577 (clobber (match_scratch:SI 2 ""))]
580 (zero_extend:SI (match_dup 1)))
582 (compare:CC (match_dup 2)
587 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
588 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
590 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
591 (zero_extend:SI (match_dup 1)))]
594 {andil.|andi.} %0,%1,0xff
596 [(set_attr "type" "compare")
597 (set_attr "length" "4,8")])
600 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
601 (compare:CC (zero_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
603 (set (match_operand:SI 0 "gpc_reg_operand" "")
604 (zero_extend:SI (match_dup 1)))]
607 (zero_extend:SI (match_dup 1)))
609 (compare:CC (match_dup 0)
613 (define_expand "extendqisi2"
614 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
615 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
620 emit_insn (gen_extendqisi2_ppc (operands[0], operands[1]));
621 else if (TARGET_POWER)
622 emit_insn (gen_extendqisi2_power (operands[0], operands[1]));
624 emit_insn (gen_extendqisi2_no_power (operands[0], operands[1]));
628 (define_insn "extendqisi2_ppc"
629 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
630 (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r")))]
635 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
636 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
638 (clobber (match_scratch:SI 2 "=r,r"))]
643 [(set_attr "type" "compare")
644 (set_attr "length" "4,8")])
647 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
648 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
650 (clobber (match_scratch:SI 2 ""))]
651 "TARGET_POWERPC && reload_completed"
653 (sign_extend:SI (match_dup 1)))
655 (compare:CC (match_dup 2)
660 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
661 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
663 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
664 (sign_extend:SI (match_dup 1)))]
669 [(set_attr "type" "compare")
670 (set_attr "length" "4,8")])
673 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
674 (compare:CC (sign_extend:SI (match_operand:QI 1 "gpc_reg_operand" ""))
676 (set (match_operand:SI 0 "gpc_reg_operand" "")
677 (sign_extend:SI (match_dup 1)))]
678 "TARGET_POWERPC && reload_completed"
680 (sign_extend:SI (match_dup 1)))
682 (compare:CC (match_dup 0)
686 (define_expand "extendqisi2_power"
687 [(parallel [(set (match_dup 2)
688 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
690 (clobber (scratch:SI))])
691 (parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
692 (ashiftrt:SI (match_dup 2)
694 (clobber (scratch:SI))])]
697 { operands[1] = gen_lowpart (SImode, operands[1]);
698 operands[2] = gen_reg_rtx (SImode); }")
700 (define_expand "extendqisi2_no_power"
702 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
704 (set (match_operand:SI 0 "gpc_reg_operand" "")
705 (ashiftrt:SI (match_dup 2)
707 "! TARGET_POWER && ! TARGET_POWERPC"
709 { operands[1] = gen_lowpart (SImode, operands[1]);
710 operands[2] = gen_reg_rtx (SImode); }")
712 (define_expand "zero_extendqihi2"
713 [(set (match_operand:HI 0 "gpc_reg_operand" "")
714 (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "")))]
719 [(set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
720 (zero_extend:HI (match_operand:QI 1 "reg_or_mem_operand" "m,r")))]
724 {rlinm|rlwinm} %0,%1,0,0xff"
725 [(set_attr "type" "load,*")])
728 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
729 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
731 (clobber (match_scratch:HI 2 "=r,r"))]
734 {andil.|andi.} %2,%1,0xff
736 [(set_attr "type" "compare")
737 (set_attr "length" "4,8")])
740 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
741 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
743 (clobber (match_scratch:HI 2 ""))]
746 (zero_extend:HI (match_dup 1)))
748 (compare:CC (match_dup 2)
753 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
754 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
756 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
757 (zero_extend:HI (match_dup 1)))]
760 {andil.|andi.} %0,%1,0xff
762 [(set_attr "type" "compare")
763 (set_attr "length" "4,8")])
766 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
767 (compare:CC (zero_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
769 (set (match_operand:HI 0 "gpc_reg_operand" "")
770 (zero_extend:HI (match_dup 1)))]
773 (zero_extend:HI (match_dup 1)))
775 (compare:CC (match_dup 0)
779 (define_expand "extendqihi2"
780 [(use (match_operand:HI 0 "gpc_reg_operand" ""))
781 (use (match_operand:QI 1 "gpc_reg_operand" ""))]
786 emit_insn (gen_extendqihi2_ppc (operands[0], operands[1]));
787 else if (TARGET_POWER)
788 emit_insn (gen_extendqihi2_power (operands[0], operands[1]));
790 emit_insn (gen_extendqihi2_no_power (operands[0], operands[1]));
794 (define_insn "extendqihi2_ppc"
795 [(set (match_operand:HI 0 "gpc_reg_operand" "=r")
796 (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r")))]
801 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
802 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
804 (clobber (match_scratch:HI 2 "=r,r"))]
809 [(set_attr "type" "compare")
810 (set_attr "length" "4,8")])
813 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
814 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
816 (clobber (match_scratch:HI 2 ""))]
817 "TARGET_POWERPC && reload_completed"
819 (sign_extend:HI (match_dup 1)))
821 (compare:CC (match_dup 2)
826 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
827 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" "r,r"))
829 (set (match_operand:HI 0 "gpc_reg_operand" "=r,r")
830 (sign_extend:HI (match_dup 1)))]
835 [(set_attr "type" "compare")
836 (set_attr "length" "4,8")])
839 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
840 (compare:CC (sign_extend:HI (match_operand:QI 1 "gpc_reg_operand" ""))
842 (set (match_operand:HI 0 "gpc_reg_operand" "")
843 (sign_extend:HI (match_dup 1)))]
844 "TARGET_POWERPC && reload_completed"
846 (sign_extend:HI (match_dup 1)))
848 (compare:CC (match_dup 0)
852 (define_expand "extendqihi2_power"
853 [(parallel [(set (match_dup 2)
854 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
856 (clobber (scratch:SI))])
857 (parallel [(set (match_operand:HI 0 "gpc_reg_operand" "")
858 (ashiftrt:SI (match_dup 2)
860 (clobber (scratch:SI))])]
863 { operands[0] = gen_lowpart (SImode, operands[0]);
864 operands[1] = gen_lowpart (SImode, operands[1]);
865 operands[2] = gen_reg_rtx (SImode); }")
867 (define_expand "extendqihi2_no_power"
869 (ashift:SI (match_operand:QI 1 "gpc_reg_operand" "")
871 (set (match_operand:HI 0 "gpc_reg_operand" "")
872 (ashiftrt:SI (match_dup 2)
874 "! TARGET_POWER && ! TARGET_POWERPC"
876 { operands[0] = gen_lowpart (SImode, operands[0]);
877 operands[1] = gen_lowpart (SImode, operands[1]);
878 operands[2] = gen_reg_rtx (SImode); }")
880 (define_expand "zero_extendhisi2"
881 [(set (match_operand:SI 0 "gpc_reg_operand" "")
882 (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
887 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
888 (zero_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
892 {rlinm|rlwinm} %0,%1,0,0xffff"
893 [(set_attr "type" "load,*")])
896 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
897 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
899 (clobber (match_scratch:SI 2 "=r,r"))]
902 {andil.|andi.} %2,%1,0xffff
904 [(set_attr "type" "compare")
905 (set_attr "length" "4,8")])
908 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
909 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
911 (clobber (match_scratch:SI 2 ""))]
914 (zero_extend:SI (match_dup 1)))
916 (compare:CC (match_dup 2)
921 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
922 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
924 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
925 (zero_extend:SI (match_dup 1)))]
928 {andil.|andi.} %0,%1,0xffff
930 [(set_attr "type" "compare")
931 (set_attr "length" "4,8")])
934 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
935 (compare:CC (zero_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
937 (set (match_operand:SI 0 "gpc_reg_operand" "")
938 (zero_extend:SI (match_dup 1)))]
941 (zero_extend:SI (match_dup 1)))
943 (compare:CC (match_dup 0)
947 (define_expand "extendhisi2"
948 [(set (match_operand:SI 0 "gpc_reg_operand" "")
949 (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "")))]
954 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
955 (sign_extend:SI (match_operand:HI 1 "reg_or_mem_operand" "m,r")))]
960 [(set_attr "type" "load_ext,*")])
963 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
964 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
966 (clobber (match_scratch:SI 2 "=r,r"))]
971 [(set_attr "type" "compare")
972 (set_attr "length" "4,8")])
975 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
976 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
978 (clobber (match_scratch:SI 2 ""))]
981 (sign_extend:SI (match_dup 1)))
983 (compare:CC (match_dup 2)
988 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
989 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" "r,r"))
991 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
992 (sign_extend:SI (match_dup 1)))]
997 [(set_attr "type" "compare")
998 (set_attr "length" "4,8")])
1001 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1002 (compare:CC (sign_extend:SI (match_operand:HI 1 "gpc_reg_operand" ""))
1004 (set (match_operand:SI 0 "gpc_reg_operand" "")
1005 (sign_extend:SI (match_dup 1)))]
1008 (sign_extend:SI (match_dup 1)))
1010 (compare:CC (match_dup 0)
1014 ;; Fixed-point arithmetic insns.
1016 (define_expand "add<mode>3"
1017 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1018 (plus:SDI (match_operand:SDI 1 "gpc_reg_operand" "")
1019 (match_operand:SDI 2 "reg_or_add_cint_operand" "")))]
1023 if (<MODE>mode == DImode && ! TARGET_POWERPC64)
1025 if (non_short_cint_operand (operands[2], DImode))
1028 else if (GET_CODE (operands[2]) == CONST_INT
1029 && ! add_operand (operands[2], <MODE>mode))
1031 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
1032 ? operands[0] : gen_reg_rtx (<MODE>mode));
1034 HOST_WIDE_INT val = INTVAL (operands[2]);
1035 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1036 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1038 if (<MODE>mode == DImode && !CONST_OK_FOR_LETTER_P (rest, 'L'))
1041 /* The ordering here is important for the prolog expander.
1042 When space is allocated from the stack, adding 'low' first may
1043 produce a temporary deallocation (which would be bad). */
1044 emit_insn (gen_add<mode>3 (tmp, operands[1], GEN_INT (rest)));
1045 emit_insn (gen_add<mode>3 (operands[0], tmp, GEN_INT (low)));
1050 ;; Discourage ai/addic because of carry but provide it in an alternative
1051 ;; allowing register zero as source.
1052 (define_insn "*add<mode>3_internal1"
1053 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r,?r,r")
1054 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "%r,b,r,b")
1055 (match_operand:GPR 2 "add_operand" "r,I,I,L")))]
1059 {cal %0,%2(%1)|addi %0,%1,%2}
1061 {cau|addis} %0,%1,%v2"
1062 [(set_attr "length" "4,4,4,4")])
1064 (define_insn "addsi3_high"
1065 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
1066 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
1067 (high:SI (match_operand 2 "" ""))))]
1068 "TARGET_MACHO && !TARGET_64BIT"
1069 "{cau|addis} %0,%1,ha16(%2)"
1070 [(set_attr "length" "4")])
1072 (define_insn "*add<mode>3_internal2"
1073 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
1074 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1075 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1077 (clobber (match_scratch:P 3 "=r,r,r,r"))]
1080 {cax.|add.} %3,%1,%2
1081 {ai.|addic.} %3,%1,%2
1084 [(set_attr "type" "fast_compare,compare,compare,compare")
1085 (set_attr "length" "4,4,8,8")])
1088 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1089 (compare:CC (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1090 (match_operand:GPR 2 "reg_or_short_operand" ""))
1092 (clobber (match_scratch:GPR 3 ""))]
1095 (plus:GPR (match_dup 1)
1098 (compare:CC (match_dup 3)
1102 (define_insn "*add<mode>3_internal3"
1103 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
1104 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "%r,r,r,r")
1105 (match_operand:P 2 "reg_or_short_operand" "r,I,r,I"))
1107 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r,r")
1108 (plus:P (match_dup 1)
1112 {cax.|add.} %0,%1,%2
1113 {ai.|addic.} %0,%1,%2
1116 [(set_attr "type" "fast_compare,compare,compare,compare")
1117 (set_attr "length" "4,4,8,8")])
1120 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1121 (compare:CC (plus:P (match_operand:P 1 "gpc_reg_operand" "")
1122 (match_operand:P 2 "reg_or_short_operand" ""))
1124 (set (match_operand:P 0 "gpc_reg_operand" "")
1125 (plus:P (match_dup 1) (match_dup 2)))]
1128 (plus:P (match_dup 1)
1131 (compare:CC (match_dup 0)
1135 ;; Split an add that we can't do in one insn into two insns, each of which
1136 ;; does one 16-bit part. This is used by combine. Note that the low-order
1137 ;; add should be last in case the result gets used in an address.
1140 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1141 (plus:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1142 (match_operand:GPR 2 "non_add_cint_operand" "")))]
1144 [(set (match_dup 0) (plus:GPR (match_dup 1) (match_dup 3)))
1145 (set (match_dup 0) (plus:GPR (match_dup 0) (match_dup 4)))]
1148 HOST_WIDE_INT val = INTVAL (operands[2]);
1149 HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
1150 HOST_WIDE_INT rest = trunc_int_for_mode (val - low, <MODE>mode);
1152 operands[4] = GEN_INT (low);
1153 if (<MODE>mode == SImode || CONST_OK_FOR_LETTER_P (rest, 'L'))
1154 operands[3] = GEN_INT (rest);
1155 else if (! no_new_pseudos)
1157 operands[3] = gen_reg_rtx (DImode);
1158 emit_move_insn (operands[3], operands[2]);
1159 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
1166 (define_insn "one_cmpl<mode>2"
1167 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1168 (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1173 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1174 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1176 (clobber (match_scratch:P 2 "=r,r"))]
1181 [(set_attr "type" "compare")
1182 (set_attr "length" "4,8")])
1185 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1186 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1188 (clobber (match_scratch:P 2 ""))]
1191 (not:P (match_dup 1)))
1193 (compare:CC (match_dup 2)
1198 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1199 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1201 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1202 (not:P (match_dup 1)))]
1207 [(set_attr "type" "compare")
1208 (set_attr "length" "4,8")])
1211 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1212 (compare:CC (not:P (match_operand:P 1 "gpc_reg_operand" ""))
1214 (set (match_operand:P 0 "gpc_reg_operand" "")
1215 (not:P (match_dup 1)))]
1218 (not:P (match_dup 1)))
1220 (compare:CC (match_dup 0)
1225 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1226 (minus:SI (match_operand:SI 1 "reg_or_short_operand" "rI")
1227 (match_operand:SI 2 "gpc_reg_operand" "r")))]
1229 "{sf%I1|subf%I1c} %0,%2,%1")
1232 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r,r")
1233 (minus:GPR (match_operand:GPR 1 "reg_or_short_operand" "r,I")
1234 (match_operand:GPR 2 "gpc_reg_operand" "r,r")))]
1241 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1242 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1243 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1245 (clobber (match_scratch:SI 3 "=r,r"))]
1248 {sf.|subfc.} %3,%2,%1
1250 [(set_attr "type" "compare")
1251 (set_attr "length" "4,8")])
1254 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1255 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1256 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1258 (clobber (match_scratch:P 3 "=r,r"))]
1263 [(set_attr "type" "fast_compare")
1264 (set_attr "length" "4,8")])
1267 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1268 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1269 (match_operand:P 2 "gpc_reg_operand" ""))
1271 (clobber (match_scratch:P 3 ""))]
1274 (minus:P (match_dup 1)
1277 (compare:CC (match_dup 3)
1282 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1283 (compare:CC (minus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
1284 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1286 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1287 (minus:SI (match_dup 1) (match_dup 2)))]
1290 {sf.|subfc.} %0,%2,%1
1292 [(set_attr "type" "compare")
1293 (set_attr "length" "4,8")])
1296 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1297 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "r,r")
1298 (match_operand:P 2 "gpc_reg_operand" "r,r"))
1300 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1301 (minus:P (match_dup 1)
1307 [(set_attr "type" "fast_compare")
1308 (set_attr "length" "4,8")])
1311 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1312 (compare:CC (minus:P (match_operand:P 1 "gpc_reg_operand" "")
1313 (match_operand:P 2 "gpc_reg_operand" ""))
1315 (set (match_operand:P 0 "gpc_reg_operand" "")
1316 (minus:P (match_dup 1)
1320 (minus:P (match_dup 1)
1323 (compare:CC (match_dup 0)
1327 (define_expand "sub<mode>3"
1328 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1329 (minus:SDI (match_operand:SDI 1 "reg_or_short_operand" "")
1330 (match_operand:SDI 2 "reg_or_sub_cint_operand" "")))]
1334 if (GET_CODE (operands[2]) == CONST_INT)
1336 emit_insn (gen_add<mode>3 (operands[0], operands[1],
1337 negate_rtx (<MODE>mode, operands[2])));
1342 ;; For SMIN, SMAX, UMIN, and UMAX, we use DEFINE_EXPAND's that involve a doz[i]
1343 ;; instruction and some auxiliary computations. Then we just have a single
1344 ;; DEFINE_INSN for doz[i] and the define_splits to make them if made by
1347 (define_expand "sminsi3"
1349 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1350 (match_operand:SI 2 "reg_or_short_operand" ""))
1352 (minus:SI (match_dup 2) (match_dup 1))))
1353 (set (match_operand:SI 0 "gpc_reg_operand" "")
1354 (minus:SI (match_dup 2) (match_dup 3)))]
1355 "TARGET_POWER || TARGET_ISEL"
1360 operands[2] = force_reg (SImode, operands[2]);
1361 rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
1365 operands[3] = gen_reg_rtx (SImode);
1369 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1370 (smin:SI (match_operand:SI 1 "gpc_reg_operand" "")
1371 (match_operand:SI 2 "reg_or_short_operand" "")))
1372 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1375 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1377 (minus:SI (match_dup 2) (match_dup 1))))
1378 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 3)))]
1381 (define_expand "smaxsi3"
1383 (if_then_else:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
1384 (match_operand:SI 2 "reg_or_short_operand" ""))
1386 (minus:SI (match_dup 2) (match_dup 1))))
1387 (set (match_operand:SI 0 "gpc_reg_operand" "")
1388 (plus:SI (match_dup 3) (match_dup 1)))]
1389 "TARGET_POWER || TARGET_ISEL"
1394 operands[2] = force_reg (SImode, operands[2]);
1395 rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
1398 operands[3] = gen_reg_rtx (SImode);
1402 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1403 (smax:SI (match_operand:SI 1 "gpc_reg_operand" "")
1404 (match_operand:SI 2 "reg_or_short_operand" "")))
1405 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
1408 (if_then_else:SI (gt:SI (match_dup 1) (match_dup 2))
1410 (minus:SI (match_dup 2) (match_dup 1))))
1411 (set (match_dup 0) (plus:SI (match_dup 3) (match_dup 1)))]
1414 (define_expand "uminsi3"
1415 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1417 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1419 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1421 (minus:SI (match_dup 4) (match_dup 3))))
1422 (set (match_operand:SI 0 "gpc_reg_operand" "")
1423 (minus:SI (match_dup 2) (match_dup 3)))]
1424 "TARGET_POWER || TARGET_ISEL"
1429 rs6000_emit_minmax (operands[0], UMIN, operands[1], operands[2]);
1432 operands[3] = gen_reg_rtx (SImode);
1433 operands[4] = gen_reg_rtx (SImode);
1434 operands[5] = GEN_INT (-2147483647 - 1);
1437 (define_expand "umaxsi3"
1438 [(set (match_dup 3) (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
1440 (set (match_dup 4) (xor:SI (match_operand:SI 2 "gpc_reg_operand" "")
1442 (set (match_dup 3) (if_then_else:SI (gt (match_dup 3) (match_dup 4))
1444 (minus:SI (match_dup 4) (match_dup 3))))
1445 (set (match_operand:SI 0 "gpc_reg_operand" "")
1446 (plus:SI (match_dup 3) (match_dup 1)))]
1447 "TARGET_POWER || TARGET_ISEL"
1452 rs6000_emit_minmax (operands[0], UMAX, operands[1], operands[2]);
1455 operands[3] = gen_reg_rtx (SImode);
1456 operands[4] = gen_reg_rtx (SImode);
1457 operands[5] = GEN_INT (-2147483647 - 1);
1461 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1462 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r")
1463 (match_operand:SI 2 "reg_or_short_operand" "rI"))
1465 (minus:SI (match_dup 2) (match_dup 1))))]
1470 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1472 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1473 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1475 (minus:SI (match_dup 2) (match_dup 1)))
1477 (clobber (match_scratch:SI 3 "=r,r"))]
1482 [(set_attr "type" "delayed_compare")
1483 (set_attr "length" "4,8")])
1486 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1488 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1489 (match_operand:SI 2 "reg_or_short_operand" ""))
1491 (minus:SI (match_dup 2) (match_dup 1)))
1493 (clobber (match_scratch:SI 3 ""))]
1494 "TARGET_POWER && reload_completed"
1496 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1498 (minus:SI (match_dup 2) (match_dup 1))))
1500 (compare:CC (match_dup 3)
1505 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1507 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "r,r")
1508 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
1510 (minus:SI (match_dup 2) (match_dup 1)))
1512 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1513 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1515 (minus:SI (match_dup 2) (match_dup 1))))]
1520 [(set_attr "type" "delayed_compare")
1521 (set_attr "length" "4,8")])
1524 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1526 (if_then_else:SI (gt (match_operand:SI 1 "gpc_reg_operand" "")
1527 (match_operand:SI 2 "reg_or_short_operand" ""))
1529 (minus:SI (match_dup 2) (match_dup 1)))
1531 (set (match_operand:SI 0 "gpc_reg_operand" "")
1532 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1534 (minus:SI (match_dup 2) (match_dup 1))))]
1535 "TARGET_POWER && reload_completed"
1537 (if_then_else:SI (gt (match_dup 1) (match_dup 2))
1539 (minus:SI (match_dup 2) (match_dup 1))))
1541 (compare:CC (match_dup 0)
1545 ;; We don't need abs with condition code because such comparisons should
1547 (define_expand "abssi2"
1548 [(set (match_operand:SI 0 "gpc_reg_operand" "")
1549 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
1555 emit_insn (gen_abssi2_isel (operands[0], operands[1]));
1558 else if (! TARGET_POWER)
1560 emit_insn (gen_abssi2_nopower (operands[0], operands[1]));
1565 (define_insn "*abssi2_power"
1566 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1567 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))]
1571 (define_insn_and_split "abssi2_isel"
1572 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1573 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
1574 (clobber (match_scratch:SI 2 "=&b"))
1575 (clobber (match_scratch:CC 3 "=y"))]
1578 "&& reload_completed"
1579 [(set (match_dup 2) (neg:SI (match_dup 1)))
1581 (compare:CC (match_dup 1)
1584 (if_then_else:SI (ge (match_dup 3)
1590 (define_insn_and_split "abssi2_nopower"
1591 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1592 (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0")))
1593 (clobber (match_scratch:SI 2 "=&r,&r"))]
1594 "! TARGET_POWER && ! TARGET_ISEL"
1596 "&& reload_completed"
1597 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1598 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1599 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1602 (define_insn "*nabs_power"
1603 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1604 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r"))))]
1608 (define_insn_and_split "*nabs_nopower"
1609 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
1610 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,0"))))
1611 (clobber (match_scratch:SI 2 "=&r,&r"))]
1614 "&& reload_completed"
1615 [(set (match_dup 2) (ashiftrt:SI (match_dup 1) (const_int 31)))
1616 (set (match_dup 0) (xor:SI (match_dup 2) (match_dup 1)))
1617 (set (match_dup 0) (minus:SI (match_dup 2) (match_dup 0)))]
1620 (define_expand "neg<mode>2"
1621 [(set (match_operand:SDI 0 "gpc_reg_operand" "")
1622 (neg:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
1626 (define_insn "*neg<mode>2_internal"
1627 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1628 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1633 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1634 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1636 (clobber (match_scratch:P 2 "=r,r"))]
1641 [(set_attr "type" "fast_compare")
1642 (set_attr "length" "4,8")])
1645 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1646 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1648 (clobber (match_scratch:P 2 ""))]
1651 (neg:P (match_dup 1)))
1653 (compare:CC (match_dup 2)
1658 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
1659 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" "r,r"))
1661 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
1662 (neg:P (match_dup 1)))]
1667 [(set_attr "type" "fast_compare")
1668 (set_attr "length" "4,8")])
1671 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
1672 (compare:CC (neg:P (match_operand:P 1 "gpc_reg_operand" ""))
1674 (set (match_operand:P 0 "gpc_reg_operand" "")
1675 (neg:P (match_dup 1)))]
1678 (neg:P (match_dup 1)))
1680 (compare:CC (match_dup 0)
1684 (define_insn "clz<mode>2"
1685 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1686 (clz:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
1688 "{cntlz|cntlz<wd>} %0,%1")
1690 (define_expand "ctz<mode>2"
1692 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
1693 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1695 (clobber (scratch:CC))])
1696 (set (match_dup 4) (clz:GPR (match_dup 3)))
1697 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1698 (minus:GPR (match_dup 5) (match_dup 4)))]
1701 operands[2] = gen_reg_rtx (<MODE>mode);
1702 operands[3] = gen_reg_rtx (<MODE>mode);
1703 operands[4] = gen_reg_rtx (<MODE>mode);
1704 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 1);
1707 (define_expand "ffs<mode>2"
1709 (neg:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))
1710 (parallel [(set (match_dup 3) (and:GPR (match_dup 1)
1712 (clobber (scratch:CC))])
1713 (set (match_dup 4) (clz:GPR (match_dup 3)))
1714 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1715 (minus:GPR (match_dup 5) (match_dup 4)))]
1718 operands[2] = gen_reg_rtx (<MODE>mode);
1719 operands[3] = gen_reg_rtx (<MODE>mode);
1720 operands[4] = gen_reg_rtx (<MODE>mode);
1721 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
1724 (define_expand "popcount<mode>2"
1726 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
1729 (mult:GPR (match_dup 2) (match_dup 4)))
1730 (set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1731 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
1734 operands[2] = gen_reg_rtx (<MODE>mode);
1735 operands[3] = gen_reg_rtx (<MODE>mode);
1736 operands[4] = force_reg (<MODE>mode,
1737 <MODE>mode == SImode
1738 ? GEN_INT (0x01010101)
1739 : GEN_INT ((HOST_WIDE_INT)
1740 0x01010101 << 32 | 0x01010101));
1741 operands[5] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode) - 8);
1744 (define_insn "popcntb<mode>2"
1745 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1746 (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")]
1751 (define_expand "mulsi3"
1752 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
1753 (use (match_operand:SI 1 "gpc_reg_operand" ""))
1754 (use (match_operand:SI 2 "reg_or_short_operand" ""))]
1759 emit_insn (gen_mulsi3_mq (operands[0], operands[1], operands[2]));
1761 emit_insn (gen_mulsi3_no_mq (operands[0], operands[1], operands[2]));
1765 (define_insn "mulsi3_mq"
1766 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1767 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1768 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
1769 (clobber (match_scratch:SI 3 "=q,q"))]
1772 {muls|mullw} %0,%1,%2
1773 {muli|mulli} %0,%1,%2"
1775 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1776 (const_string "imul3")
1777 (match_operand:SI 2 "short_cint_operand" "")
1778 (const_string "imul2")]
1779 (const_string "imul")))])
1781 (define_insn "mulsi3_no_mq"
1782 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1783 (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1784 (match_operand:SI 2 "reg_or_short_operand" "r,I")))]
1787 {muls|mullw} %0,%1,%2
1788 {muli|mulli} %0,%1,%2"
1790 (cond [(match_operand:SI 2 "s8bit_cint_operand" "")
1791 (const_string "imul3")
1792 (match_operand:SI 2 "short_cint_operand" "")
1793 (const_string "imul2")]
1794 (const_string "imul")))])
1796 (define_insn "*mulsi3_mq_internal1"
1797 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1798 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1799 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1801 (clobber (match_scratch:SI 3 "=r,r"))
1802 (clobber (match_scratch:SI 4 "=q,q"))]
1805 {muls.|mullw.} %3,%1,%2
1807 [(set_attr "type" "imul_compare")
1808 (set_attr "length" "4,8")])
1811 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1812 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1813 (match_operand:SI 2 "gpc_reg_operand" ""))
1815 (clobber (match_scratch:SI 3 ""))
1816 (clobber (match_scratch:SI 4 ""))]
1817 "TARGET_POWER && reload_completed"
1818 [(parallel [(set (match_dup 3)
1819 (mult:SI (match_dup 1) (match_dup 2)))
1820 (clobber (match_dup 4))])
1822 (compare:CC (match_dup 3)
1826 (define_insn "*mulsi3_no_mq_internal1"
1827 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
1828 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1829 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1831 (clobber (match_scratch:SI 3 "=r,r"))]
1834 {muls.|mullw.} %3,%1,%2
1836 [(set_attr "type" "imul_compare")
1837 (set_attr "length" "4,8")])
1840 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
1841 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1842 (match_operand:SI 2 "gpc_reg_operand" ""))
1844 (clobber (match_scratch:SI 3 ""))]
1845 "! TARGET_POWER && reload_completed"
1847 (mult:SI (match_dup 1) (match_dup 2)))
1849 (compare:CC (match_dup 3)
1853 (define_insn "*mulsi3_mq_internal2"
1854 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1855 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1856 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1858 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1859 (mult:SI (match_dup 1) (match_dup 2)))
1860 (clobber (match_scratch:SI 4 "=q,q"))]
1863 {muls.|mullw.} %0,%1,%2
1865 [(set_attr "type" "imul_compare")
1866 (set_attr "length" "4,8")])
1869 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1870 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1871 (match_operand:SI 2 "gpc_reg_operand" ""))
1873 (set (match_operand:SI 0 "gpc_reg_operand" "")
1874 (mult:SI (match_dup 1) (match_dup 2)))
1875 (clobber (match_scratch:SI 4 ""))]
1876 "TARGET_POWER && reload_completed"
1877 [(parallel [(set (match_dup 0)
1878 (mult:SI (match_dup 1) (match_dup 2)))
1879 (clobber (match_dup 4))])
1881 (compare:CC (match_dup 0)
1885 (define_insn "*mulsi3_no_mq_internal2"
1886 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
1887 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r")
1888 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
1890 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
1891 (mult:SI (match_dup 1) (match_dup 2)))]
1894 {muls.|mullw.} %0,%1,%2
1896 [(set_attr "type" "imul_compare")
1897 (set_attr "length" "4,8")])
1900 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
1901 (compare:CC (mult:SI (match_operand:SI 1 "gpc_reg_operand" "")
1902 (match_operand:SI 2 "gpc_reg_operand" ""))
1904 (set (match_operand:SI 0 "gpc_reg_operand" "")
1905 (mult:SI (match_dup 1) (match_dup 2)))]
1906 "! TARGET_POWER && reload_completed"
1908 (mult:SI (match_dup 1) (match_dup 2)))
1910 (compare:CC (match_dup 0)
1914 ;; Operand 1 is divided by operand 2; quotient goes to operand
1915 ;; 0 and remainder to operand 3.
1916 ;; ??? At some point, see what, if anything, we can do about if (x % y == 0).
1918 (define_expand "divmodsi4"
1919 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
1920 (div:SI (match_operand:SI 1 "gpc_reg_operand" "")
1921 (match_operand:SI 2 "gpc_reg_operand" "")))
1922 (set (match_operand:SI 3 "register_operand" "")
1923 (mod:SI (match_dup 1) (match_dup 2)))])]
1924 "TARGET_POWER || (! TARGET_POWER && ! TARGET_POWERPC)"
1927 if (! TARGET_POWER && ! TARGET_POWERPC)
1929 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1930 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1931 emit_insn (gen_divss_call ());
1932 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1933 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
1938 (define_insn "*divmodsi4_internal"
1939 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1940 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1941 (match_operand:SI 2 "gpc_reg_operand" "r")))
1942 (set (match_operand:SI 3 "register_operand" "=q")
1943 (mod:SI (match_dup 1) (match_dup 2)))]
1946 [(set_attr "type" "idiv")])
1948 (define_expand "udiv<mode>3"
1949 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1950 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1951 (match_operand:GPR 2 "gpc_reg_operand" "")))]
1952 "TARGET_POWERPC || (! TARGET_POWER && ! TARGET_POWERPC)"
1955 if (! TARGET_POWER && ! TARGET_POWERPC)
1957 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
1958 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
1959 emit_insn (gen_quous_call ());
1960 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
1963 else if (TARGET_POWER)
1965 emit_insn (gen_udivsi3_mq (operands[0], operands[1], operands[2]));
1970 (define_insn "udivsi3_mq"
1971 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
1972 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "r")
1973 (match_operand:SI 2 "gpc_reg_operand" "r")))
1974 (clobber (match_scratch:SI 3 "=q"))]
1975 "TARGET_POWERPC && TARGET_POWER"
1977 [(set_attr "type" "idiv")])
1979 (define_insn "*udivsi3_no_mq"
1980 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
1981 (udiv:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
1982 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
1983 "TARGET_POWERPC && ! TARGET_POWER"
1985 [(set_attr "type" "idiv")])
1987 ;; For powers of two we can do srai/aze for divide and then adjust for
1988 ;; modulus. If it isn't a power of two, FAIL on POWER so divmodsi4 will be
1989 ;; used; for PowerPC, force operands into register and do a normal divide;
1990 ;; for AIX common-mode, use quoss call on register operands.
1991 (define_expand "div<mode>3"
1992 [(set (match_operand:GPR 0 "gpc_reg_operand" "")
1993 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
1994 (match_operand:GPR 2 "reg_or_cint_operand" "")))]
1998 if (GET_CODE (operands[2]) == CONST_INT
1999 && INTVAL (operands[2]) > 0
2000 && exact_log2 (INTVAL (operands[2])) >= 0)
2002 else if (TARGET_POWERPC)
2004 operands[2] = force_reg (SImode, operands[2]);
2007 emit_insn (gen_divsi3_mq (operands[0], operands[1], operands[2]));
2011 else if (TARGET_POWER)
2015 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2016 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2017 emit_insn (gen_quoss_call ());
2018 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2023 (define_insn "divsi3_mq"
2024 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2025 (div:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2026 (match_operand:SI 2 "gpc_reg_operand" "r")))
2027 (clobber (match_scratch:SI 3 "=q"))]
2028 "TARGET_POWERPC && TARGET_POWER"
2030 [(set_attr "type" "idiv")])
2032 (define_insn "*div<mode>3_no_mq"
2033 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2034 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2035 (match_operand:GPR 2 "gpc_reg_operand" "r")))]
2036 "TARGET_POWERPC && ! TARGET_POWER"
2038 [(set_attr "type" "idiv")])
2040 (define_expand "mod<mode>3"
2041 [(use (match_operand:GPR 0 "gpc_reg_operand" ""))
2042 (use (match_operand:GPR 1 "gpc_reg_operand" ""))
2043 (use (match_operand:GPR 2 "reg_or_cint_operand" ""))]
2051 if (GET_CODE (operands[2]) != CONST_INT
2052 || INTVAL (operands[2]) <= 0
2053 || (i = exact_log2 (INTVAL (operands[2]))) < 0)
2056 temp1 = gen_reg_rtx (<MODE>mode);
2057 temp2 = gen_reg_rtx (<MODE>mode);
2059 emit_insn (gen_div<mode>3 (temp1, operands[1], operands[2]));
2060 emit_insn (gen_ashl<mode>3 (temp2, temp1, GEN_INT (i)));
2061 emit_insn (gen_sub<mode>3 (operands[0], operands[1], temp2));
2066 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
2067 (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
2068 (match_operand:GPR 2 "exact_log2_cint_operand" "N")))]
2070 "{srai|sra<wd>i} %0,%1,%p2\;{aze|addze} %0,%0"
2071 [(set_attr "type" "two")
2072 (set_attr "length" "8")])
2075 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2076 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2077 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2079 (clobber (match_scratch:P 3 "=r,r"))]
2082 {srai|sra<wd>i} %3,%1,%p2\;{aze.|addze.} %3,%3
2084 [(set_attr "type" "compare")
2085 (set_attr "length" "8,12")])
2088 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2089 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2090 (match_operand:GPR 2 "exact_log2_cint_operand"
2093 (clobber (match_scratch:GPR 3 ""))]
2096 (div:<MODE> (match_dup 1) (match_dup 2)))
2098 (compare:CC (match_dup 3)
2103 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2104 (compare:CC (div:P (match_operand:P 1 "gpc_reg_operand" "r,r")
2105 (match_operand:P 2 "exact_log2_cint_operand" "N,N"))
2107 (set (match_operand:P 0 "gpc_reg_operand" "=r,r")
2108 (div:P (match_dup 1) (match_dup 2)))]
2111 {srai|sra<wd>i} %0,%1,%p2\;{aze.|addze.} %0,%0
2113 [(set_attr "type" "compare")
2114 (set_attr "length" "8,12")])
2117 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2118 (compare:CC (div:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2119 (match_operand:GPR 2 "exact_log2_cint_operand"
2122 (set (match_operand:GPR 0 "gpc_reg_operand" "")
2123 (div:GPR (match_dup 1) (match_dup 2)))]
2126 (div:<MODE> (match_dup 1) (match_dup 2)))
2128 (compare:CC (match_dup 0)
2133 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2136 (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r"))
2138 (zero_extend:DI (match_operand:SI 4 "register_operand" "2")))
2139 (match_operand:SI 3 "gpc_reg_operand" "r")))
2140 (set (match_operand:SI 2 "register_operand" "=*q")
2143 (zero_extend:DI (match_dup 1)) (const_int 32))
2144 (zero_extend:DI (match_dup 4)))
2148 [(set_attr "type" "idiv")])
2150 ;; To do unsigned divide we handle the cases of the divisor looking like a
2151 ;; negative number. If it is a constant that is less than 2**31, we don't
2152 ;; have to worry about the branches. So make a few subroutines here.
2154 ;; First comes the normal case.
2155 (define_expand "udivmodsi4_normal"
2156 [(set (match_dup 4) (const_int 0))
2157 (parallel [(set (match_operand:SI 0 "" "")
2158 (udiv:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2160 (zero_extend:DI (match_operand:SI 1 "" "")))
2161 (match_operand:SI 2 "" "")))
2162 (set (match_operand:SI 3 "" "")
2163 (umod:SI (plus:DI (ashift:DI (zero_extend:DI (match_dup 4))
2165 (zero_extend:DI (match_dup 1)))
2169 { operands[4] = gen_reg_rtx (SImode); }")
2171 ;; This handles the branches.
2172 (define_expand "udivmodsi4_tests"
2173 [(set (match_operand:SI 0 "" "") (const_int 0))
2174 (set (match_operand:SI 3 "" "") (match_operand:SI 1 "" ""))
2175 (set (match_dup 5) (compare:CCUNS (match_dup 1) (match_operand:SI 2 "" "")))
2176 (set (pc) (if_then_else (ltu (match_dup 5) (const_int 0))
2177 (label_ref (match_operand:SI 4 "" "")) (pc)))
2178 (set (match_dup 0) (const_int 1))
2179 (set (match_dup 3) (minus:SI (match_dup 1) (match_dup 2)))
2180 (set (match_dup 6) (compare:CC (match_dup 2) (const_int 0)))
2181 (set (pc) (if_then_else (lt (match_dup 6) (const_int 0))
2182 (label_ref (match_dup 4)) (pc)))]
2185 { operands[5] = gen_reg_rtx (CCUNSmode);
2186 operands[6] = gen_reg_rtx (CCmode);
2189 (define_expand "udivmodsi4"
2190 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
2191 (udiv:SI (match_operand:SI 1 "gpc_reg_operand" "")
2192 (match_operand:SI 2 "reg_or_cint_operand" "")))
2193 (set (match_operand:SI 3 "gpc_reg_operand" "")
2194 (umod:SI (match_dup 1) (match_dup 2)))])]
2202 if (! TARGET_POWERPC)
2204 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
2205 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
2206 emit_insn (gen_divus_call ());
2207 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
2208 emit_move_insn (operands[3], gen_rtx_REG (SImode, 4));
2215 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 0)
2217 operands[2] = force_reg (SImode, operands[2]);
2218 label = gen_label_rtx ();
2219 emit (gen_udivmodsi4_tests (operands[0], operands[1], operands[2],
2220 operands[3], label));
2223 operands[2] = force_reg (SImode, operands[2]);
2225 emit (gen_udivmodsi4_normal (operands[0], operands[1], operands[2],
2233 ;; AIX architecture-independent common-mode multiply (DImode),
2234 ;; divide/modulus, and quotient subroutine calls. Input operands in R3 and
2235 ;; R4; results in R3 and sometimes R4; link register always clobbered by bla
2236 ;; instruction; R0 sometimes clobbered; also, MQ sometimes clobbered but
2237 ;; assumed unused if generating common-mode, so ignore.
2238 (define_insn "mulh_call"
2241 (lshiftrt:DI (mult:DI (sign_extend:DI (reg:SI 3))
2242 (sign_extend:DI (reg:SI 4)))
2244 (clobber (match_scratch:SI 0 "=l"))]
2245 "! TARGET_POWER && ! TARGET_POWERPC"
2247 [(set_attr "type" "imul")])
2249 (define_insn "mull_call"
2251 (mult:DI (sign_extend:DI (reg:SI 3))
2252 (sign_extend:DI (reg:SI 4))))
2253 (clobber (match_scratch:SI 0 "=l"))
2254 (clobber (reg:SI 0))]
2255 "! TARGET_POWER && ! TARGET_POWERPC"
2257 [(set_attr "type" "imul")])
2259 (define_insn "divss_call"
2261 (div:SI (reg:SI 3) (reg:SI 4)))
2263 (mod:SI (reg:SI 3) (reg:SI 4)))
2264 (clobber (match_scratch:SI 0 "=l"))
2265 (clobber (reg:SI 0))]
2266 "! TARGET_POWER && ! TARGET_POWERPC"
2268 [(set_attr "type" "idiv")])
2270 (define_insn "divus_call"
2272 (udiv:SI (reg:SI 3) (reg:SI 4)))
2274 (umod:SI (reg:SI 3) (reg:SI 4)))
2275 (clobber (match_scratch:SI 0 "=l"))
2276 (clobber (reg:SI 0))
2277 (clobber (match_scratch:CC 1 "=x"))
2278 (clobber (reg:CC 69))]
2279 "! TARGET_POWER && ! TARGET_POWERPC"
2281 [(set_attr "type" "idiv")])
2283 (define_insn "quoss_call"
2285 (div:SI (reg:SI 3) (reg:SI 4)))
2286 (clobber (match_scratch:SI 0 "=l"))]
2287 "! TARGET_POWER && ! TARGET_POWERPC"
2289 [(set_attr "type" "idiv")])
2291 (define_insn "quous_call"
2293 (udiv:SI (reg:SI 3) (reg:SI 4)))
2294 (clobber (match_scratch:SI 0 "=l"))
2295 (clobber (reg:SI 0))
2296 (clobber (match_scratch:CC 1 "=x"))
2297 (clobber (reg:CC 69))]
2298 "! TARGET_POWER && ! TARGET_POWERPC"
2300 [(set_attr "type" "idiv")])
2302 ;; Logical instructions
2303 ;; The logical instructions are mostly combined by using match_operator,
2304 ;; but the plain AND insns are somewhat different because there is no
2305 ;; plain 'andi' (only 'andi.'), no plain 'andis', and there are all
2306 ;; those rotate-and-mask operations. Thus, the AND insns come first.
2308 (define_insn "andsi3"
2309 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
2310 (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r")
2311 (match_operand:SI 2 "and_operand" "?r,T,K,L")))
2312 (clobber (match_scratch:CC 3 "=X,X,x,x"))]
2316 {rlinm|rlwinm} %0,%1,0,%m2,%M2
2317 {andil.|andi.} %0,%1,%b2
2318 {andiu.|andis.} %0,%1,%u2"
2319 [(set_attr "type" "*,*,compare,compare")])
2321 ;; Note to set cr's other than cr0 we do the and immediate and then
2322 ;; the test again -- this avoids a mfcr which on the higher end
2323 ;; machines causes an execution serialization
2325 (define_insn "*andsi3_internal2"
2326 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2327 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2328 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2330 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2331 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2335 {andil.|andi.} %3,%1,%b2
2336 {andiu.|andis.} %3,%1,%u2
2337 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2342 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2343 (set_attr "length" "4,4,4,4,8,8,8,8")])
2345 (define_insn "*andsi3_internal3"
2346 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2347 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2348 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2350 (clobber (match_scratch:SI 3 "=r,r,r,r,r,r,r,r"))
2351 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2355 {andil.|andi.} %3,%1,%b2
2356 {andiu.|andis.} %3,%1,%u2
2357 {rlinm.|rlwinm.} %3,%1,0,%m2,%M2
2362 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2363 (set_attr "length" "8,4,4,4,8,8,8,8")])
2366 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2367 (compare:CC (and:GPR (match_operand:GPR 1 "gpc_reg_operand" "")
2368 (match_operand:GPR 2 "and_operand" ""))
2370 (clobber (match_scratch:GPR 3 ""))
2371 (clobber (match_scratch:CC 4 ""))]
2373 [(parallel [(set (match_dup 3)
2374 (and:<MODE> (match_dup 1)
2376 (clobber (match_dup 4))])
2378 (compare:CC (match_dup 3)
2382 ;; We don't have a 32 bit "and. rt,ra,rb" for ppc64. cr is set from the
2383 ;; whole 64 bit reg, and we don't know what is in the high 32 bits.
2386 [(set (match_operand:CC 0 "cc_reg_operand" "")
2387 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2388 (match_operand:SI 2 "gpc_reg_operand" ""))
2390 (clobber (match_scratch:SI 3 ""))
2391 (clobber (match_scratch:CC 4 ""))]
2392 "TARGET_POWERPC64 && reload_completed"
2393 [(parallel [(set (match_dup 3)
2394 (and:SI (match_dup 1)
2396 (clobber (match_dup 4))])
2398 (compare:CC (match_dup 3)
2402 (define_insn "*andsi3_internal4"
2403 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2404 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2405 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2407 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2408 (and:SI (match_dup 1)
2410 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2414 {andil.|andi.} %0,%1,%b2
2415 {andiu.|andis.} %0,%1,%u2
2416 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2421 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2422 (set_attr "length" "4,4,4,4,8,8,8,8")])
2424 (define_insn "*andsi3_internal5"
2425 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,?y,??y,??y,?y")
2426 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r")
2427 (match_operand:SI 2 "and_operand" "r,K,L,T,r,K,L,T"))
2429 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r")
2430 (and:SI (match_dup 1)
2432 (clobber (match_scratch:CC 4 "=X,X,X,X,X,x,x,X"))]
2436 {andil.|andi.} %0,%1,%b2
2437 {andiu.|andis.} %0,%1,%u2
2438 {rlinm.|rlwinm.} %0,%1,0,%m2,%M2
2443 [(set_attr "type" "compare,compare,compare,delayed_compare,compare,compare,compare,compare")
2444 (set_attr "length" "8,4,4,4,8,8,8,8")])
2447 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2448 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2449 (match_operand:SI 2 "and_operand" ""))
2451 (set (match_operand:SI 0 "gpc_reg_operand" "")
2452 (and:SI (match_dup 1)
2454 (clobber (match_scratch:CC 4 ""))]
2456 [(parallel [(set (match_dup 0)
2457 (and:SI (match_dup 1)
2459 (clobber (match_dup 4))])
2461 (compare:CC (match_dup 0)
2466 [(set (match_operand:CC 3 "cc_reg_operand" "")
2467 (compare:CC (and:SI (match_operand:SI 1 "gpc_reg_operand" "")
2468 (match_operand:SI 2 "gpc_reg_operand" ""))
2470 (set (match_operand:SI 0 "gpc_reg_operand" "")
2471 (and:SI (match_dup 1)
2473 (clobber (match_scratch:CC 4 ""))]
2474 "TARGET_POWERPC64 && reload_completed"
2475 [(parallel [(set (match_dup 0)
2476 (and:SI (match_dup 1)
2478 (clobber (match_dup 4))])
2480 (compare:CC (match_dup 0)
2484 ;; Handle the PowerPC64 rlwinm corner case
2486 (define_insn_and_split "*andsi3_internal6"
2487 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2488 (and:SI (match_operand:SI 1 "gpc_reg_operand" "r")
2489 (match_operand:SI 2 "mask_operand_wrap" "i")))]
2494 (and:SI (rotate:SI (match_dup 1) (match_dup 3))
2497 (rotate:SI (match_dup 0) (match_dup 5)))]
2500 int mb = extract_MB (operands[2]);
2501 int me = extract_ME (operands[2]);
2502 operands[3] = GEN_INT (me + 1);
2503 operands[5] = GEN_INT (32 - (me + 1));
2504 operands[4] = GEN_INT (~((HOST_WIDE_INT) -1 << (33 + me - mb)));
2506 [(set_attr "length" "8")])
2508 (define_expand "iorsi3"
2509 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2510 (ior:SI (match_operand:SI 1 "gpc_reg_operand" "")
2511 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2515 if (GET_CODE (operands[2]) == CONST_INT
2516 && ! logical_operand (operands[2], SImode))
2518 HOST_WIDE_INT value = INTVAL (operands[2]);
2519 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2520 ? operands[0] : gen_reg_rtx (SImode));
2522 emit_insn (gen_iorsi3 (tmp, operands[1],
2523 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2524 emit_insn (gen_iorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2529 (define_expand "xorsi3"
2530 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2531 (xor:SI (match_operand:SI 1 "gpc_reg_operand" "")
2532 (match_operand:SI 2 "reg_or_logical_cint_operand" "")))]
2536 if (GET_CODE (operands[2]) == CONST_INT
2537 && ! logical_operand (operands[2], SImode))
2539 HOST_WIDE_INT value = INTVAL (operands[2]);
2540 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
2541 ? operands[0] : gen_reg_rtx (SImode));
2543 emit_insn (gen_xorsi3 (tmp, operands[1],
2544 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
2545 emit_insn (gen_xorsi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
2550 (define_insn "*boolsi3_internal1"
2551 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
2552 (match_operator:SI 3 "boolean_or_operator"
2553 [(match_operand:SI 1 "gpc_reg_operand" "%r,r,r")
2554 (match_operand:SI 2 "logical_operand" "r,K,L")]))]
2558 {%q3il|%q3i} %0,%1,%b2
2559 {%q3iu|%q3is} %0,%1,%u2")
2561 (define_insn "*boolsi3_internal2"
2562 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2563 (compare:CC (match_operator:SI 4 "boolean_or_operator"
2564 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2565 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2567 (clobber (match_scratch:SI 3 "=r,r"))]
2572 [(set_attr "type" "compare")
2573 (set_attr "length" "4,8")])
2576 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2577 (compare:CC (match_operator:SI 4 "boolean_operator"
2578 [(match_operand:SI 1 "gpc_reg_operand" "")
2579 (match_operand:SI 2 "gpc_reg_operand" "")])
2581 (clobber (match_scratch:SI 3 ""))]
2582 "TARGET_32BIT && reload_completed"
2583 [(set (match_dup 3) (match_dup 4))
2585 (compare:CC (match_dup 3)
2589 (define_insn "*boolsi3_internal3"
2590 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2591 (compare:CC (match_operator:SI 4 "boolean_operator"
2592 [(match_operand:SI 1 "gpc_reg_operand" "%r,r")
2593 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2595 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2601 [(set_attr "type" "compare")
2602 (set_attr "length" "4,8")])
2605 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2606 (compare:CC (match_operator:SI 4 "boolean_operator"
2607 [(match_operand:SI 1 "gpc_reg_operand" "")
2608 (match_operand:SI 2 "gpc_reg_operand" "")])
2610 (set (match_operand:SI 0 "gpc_reg_operand" "")
2612 "TARGET_32BIT && reload_completed"
2613 [(set (match_dup 0) (match_dup 4))
2615 (compare:CC (match_dup 0)
2619 ;; Split a logical operation that we can't do in one insn into two insns,
2620 ;; each of which does one 16-bit part. This is used by combine.
2623 [(set (match_operand:SI 0 "gpc_reg_operand" "")
2624 (match_operator:SI 3 "boolean_or_operator"
2625 [(match_operand:SI 1 "gpc_reg_operand" "")
2626 (match_operand:SI 2 "non_logical_cint_operand" "")]))]
2628 [(set (match_dup 0) (match_dup 4))
2629 (set (match_dup 0) (match_dup 5))]
2633 i = GEN_INT (INTVAL (operands[2]) & (~ (HOST_WIDE_INT) 0xffff));
2634 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2636 i = GEN_INT (INTVAL (operands[2]) & 0xffff);
2637 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
2641 (define_insn "*boolcsi3_internal1"
2642 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2643 (match_operator:SI 3 "boolean_operator"
2644 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2645 (match_operand:SI 2 "gpc_reg_operand" "r")]))]
2649 (define_insn "*boolcsi3_internal2"
2650 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2651 (compare:CC (match_operator:SI 4 "boolean_operator"
2652 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2653 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2655 (clobber (match_scratch:SI 3 "=r,r"))]
2660 [(set_attr "type" "compare")
2661 (set_attr "length" "4,8")])
2664 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2665 (compare:CC (match_operator:SI 4 "boolean_operator"
2666 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2667 (match_operand:SI 2 "gpc_reg_operand" "")])
2669 (clobber (match_scratch:SI 3 ""))]
2670 "TARGET_32BIT && reload_completed"
2671 [(set (match_dup 3) (match_dup 4))
2673 (compare:CC (match_dup 3)
2677 (define_insn "*boolcsi3_internal3"
2678 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2679 (compare:CC (match_operator:SI 4 "boolean_operator"
2680 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2681 (match_operand:SI 2 "gpc_reg_operand" "r,r")])
2683 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2689 [(set_attr "type" "compare")
2690 (set_attr "length" "4,8")])
2693 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2694 (compare:CC (match_operator:SI 4 "boolean_operator"
2695 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2696 (match_operand:SI 2 "gpc_reg_operand" "")])
2698 (set (match_operand:SI 0 "gpc_reg_operand" "")
2700 "TARGET_32BIT && reload_completed"
2701 [(set (match_dup 0) (match_dup 4))
2703 (compare:CC (match_dup 0)
2707 (define_insn "*boolccsi3_internal1"
2708 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2709 (match_operator:SI 3 "boolean_operator"
2710 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r"))
2711 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))]))]
2715 (define_insn "*boolccsi3_internal2"
2716 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
2717 (compare:CC (match_operator:SI 4 "boolean_operator"
2718 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "r,r"))
2719 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2721 (clobber (match_scratch:SI 3 "=r,r"))]
2726 [(set_attr "type" "compare")
2727 (set_attr "length" "4,8")])
2730 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
2731 (compare:CC (match_operator:SI 4 "boolean_operator"
2732 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2733 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2735 (clobber (match_scratch:SI 3 ""))]
2736 "TARGET_32BIT && reload_completed"
2737 [(set (match_dup 3) (match_dup 4))
2739 (compare:CC (match_dup 3)
2743 (define_insn "*boolccsi3_internal3"
2744 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
2745 (compare:CC (match_operator:SI 4 "boolean_operator"
2746 [(not:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r"))
2747 (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))])
2749 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2755 [(set_attr "type" "compare")
2756 (set_attr "length" "4,8")])
2759 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
2760 (compare:CC (match_operator:SI 4 "boolean_operator"
2761 [(not:SI (match_operand:SI 1 "gpc_reg_operand" ""))
2762 (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))])
2764 (set (match_operand:SI 0 "gpc_reg_operand" "")
2766 "TARGET_32BIT && reload_completed"
2767 [(set (match_dup 0) (match_dup 4))
2769 (compare:CC (match_dup 0)
2773 ;; maskir insn. We need four forms because things might be in arbitrary
2774 ;; orders. Don't define forms that only set CR fields because these
2775 ;; would modify an input register.
2777 (define_insn "*maskir_internal1"
2778 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2779 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2780 (match_operand:SI 1 "gpc_reg_operand" "0"))
2781 (and:SI (match_dup 2)
2782 (match_operand:SI 3 "gpc_reg_operand" "r"))))]
2786 (define_insn "*maskir_internal2"
2787 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2788 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r"))
2789 (match_operand:SI 1 "gpc_reg_operand" "0"))
2790 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2795 (define_insn "*maskir_internal3"
2796 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2797 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r")
2798 (match_operand:SI 3 "gpc_reg_operand" "r"))
2799 (and:SI (not:SI (match_dup 2))
2800 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2804 (define_insn "*maskir_internal4"
2805 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
2806 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r")
2807 (match_operand:SI 2 "gpc_reg_operand" "r"))
2808 (and:SI (not:SI (match_dup 2))
2809 (match_operand:SI 1 "gpc_reg_operand" "0"))))]
2813 (define_insn "*maskir_internal5"
2814 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2816 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2817 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2818 (and:SI (match_dup 2)
2819 (match_operand:SI 3 "gpc_reg_operand" "r,r")))
2821 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2822 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2823 (and:SI (match_dup 2) (match_dup 3))))]
2828 [(set_attr "type" "compare")
2829 (set_attr "length" "4,8")])
2832 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2834 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2835 (match_operand:SI 1 "gpc_reg_operand" ""))
2836 (and:SI (match_dup 2)
2837 (match_operand:SI 3 "gpc_reg_operand" "")))
2839 (set (match_operand:SI 0 "gpc_reg_operand" "")
2840 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2841 (and:SI (match_dup 2) (match_dup 3))))]
2842 "TARGET_POWER && reload_completed"
2844 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2845 (and:SI (match_dup 2) (match_dup 3))))
2847 (compare:CC (match_dup 0)
2851 (define_insn "*maskir_internal6"
2852 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2854 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2855 (match_operand:SI 1 "gpc_reg_operand" "0,0"))
2856 (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2859 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2860 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2861 (and:SI (match_dup 3) (match_dup 2))))]
2866 [(set_attr "type" "compare")
2867 (set_attr "length" "4,8")])
2870 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2872 (ior:SI (and:SI (not:SI (match_operand:SI 2 "gpc_reg_operand" ""))
2873 (match_operand:SI 1 "gpc_reg_operand" ""))
2874 (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2877 (set (match_operand:SI 0 "gpc_reg_operand" "")
2878 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2879 (and:SI (match_dup 3) (match_dup 2))))]
2880 "TARGET_POWER && reload_completed"
2882 (ior:SI (and:SI (not:SI (match_dup 2)) (match_dup 1))
2883 (and:SI (match_dup 3) (match_dup 2))))
2885 (compare:CC (match_dup 0)
2889 (define_insn "*maskir_internal7"
2890 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2892 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "r,r")
2893 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
2894 (and:SI (not:SI (match_dup 2))
2895 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2897 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2898 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2899 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2904 [(set_attr "type" "compare")
2905 (set_attr "length" "4,8")])
2908 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2910 (ior:SI (and:SI (match_operand:SI 2 "gpc_reg_operand" "")
2911 (match_operand:SI 3 "gpc_reg_operand" ""))
2912 (and:SI (not:SI (match_dup 2))
2913 (match_operand:SI 1 "gpc_reg_operand" "")))
2915 (set (match_operand:SI 0 "gpc_reg_operand" "")
2916 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2917 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2918 "TARGET_POWER && reload_completed"
2920 (ior:SI (and:SI (match_dup 2) (match_dup 3))
2921 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2923 (compare:CC (match_dup 0)
2927 (define_insn "*maskir_internal8"
2928 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
2930 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "r,r")
2931 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
2932 (and:SI (not:SI (match_dup 2))
2933 (match_operand:SI 1 "gpc_reg_operand" "0,0")))
2935 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
2936 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2937 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2942 [(set_attr "type" "compare")
2943 (set_attr "length" "4,8")])
2946 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
2948 (ior:SI (and:SI (match_operand:SI 3 "gpc_reg_operand" "")
2949 (match_operand:SI 2 "gpc_reg_operand" ""))
2950 (and:SI (not:SI (match_dup 2))
2951 (match_operand:SI 1 "gpc_reg_operand" "")))
2953 (set (match_operand:SI 0 "gpc_reg_operand" "")
2954 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2955 (and:SI (not:SI (match_dup 2)) (match_dup 1))))]
2956 "TARGET_POWER && reload_completed"
2958 (ior:SI (and:SI (match_dup 3) (match_dup 2))
2959 (and:SI (not:SI (match_dup 2)) (match_dup 1))))
2961 (compare:CC (match_dup 0)
2965 ;; Rotate and shift insns, in all their variants. These support shifts,
2966 ;; field inserts and extracts, and various combinations thereof.
2967 (define_expand "insv"
2968 [(set (zero_extract (match_operand 0 "gpc_reg_operand" "")
2969 (match_operand:SI 1 "const_int_operand" "")
2970 (match_operand:SI 2 "const_int_operand" ""))
2971 (match_operand 3 "gpc_reg_operand" ""))]
2975 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
2976 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
2977 compiler if the address of the structure is taken later. */
2978 if (GET_CODE (operands[0]) == SUBREG
2979 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
2982 if (TARGET_POWERPC64 && GET_MODE (operands[0]) == DImode)
2983 emit_insn (gen_insvdi (operands[0], operands[1], operands[2], operands[3]));
2985 emit_insn (gen_insvsi (operands[0], operands[1], operands[2], operands[3]));
2989 (define_insn "insvsi"
2990 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
2991 (match_operand:SI 1 "const_int_operand" "i")
2992 (match_operand:SI 2 "const_int_operand" "i"))
2993 (match_operand:SI 3 "gpc_reg_operand" "r"))]
2997 int start = INTVAL (operands[2]) & 31;
2998 int size = INTVAL (operands[1]) & 31;
3000 operands[4] = GEN_INT (32 - start - size);
3001 operands[1] = GEN_INT (start + size - 1);
3002 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3004 [(set_attr "type" "insert_word")])
3006 (define_insn "*insvsi_internal1"
3007 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3008 (match_operand:SI 1 "const_int_operand" "i")
3009 (match_operand:SI 2 "const_int_operand" "i"))
3010 (rotate:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3011 (match_operand:SI 4 "const_int_operand" "i")))]
3012 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3015 int shift = INTVAL (operands[4]) & 31;
3016 int start = INTVAL (operands[2]) & 31;
3017 int size = INTVAL (operands[1]) & 31;
3019 operands[4] = GEN_INT (shift - start - size);
3020 operands[1] = GEN_INT (start + size - 1);
3021 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3023 [(set_attr "type" "insert_word")])
3025 (define_insn "*insvsi_internal2"
3026 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3027 (match_operand:SI 1 "const_int_operand" "i")
3028 (match_operand:SI 2 "const_int_operand" "i"))
3029 (ashiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3030 (match_operand:SI 4 "const_int_operand" "i")))]
3031 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3034 int shift = INTVAL (operands[4]) & 31;
3035 int start = INTVAL (operands[2]) & 31;
3036 int size = INTVAL (operands[1]) & 31;
3038 operands[4] = GEN_INT (32 - shift - start - size);
3039 operands[1] = GEN_INT (start + size - 1);
3040 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3042 [(set_attr "type" "insert_word")])
3044 (define_insn "*insvsi_internal3"
3045 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3046 (match_operand:SI 1 "const_int_operand" "i")
3047 (match_operand:SI 2 "const_int_operand" "i"))
3048 (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3049 (match_operand:SI 4 "const_int_operand" "i")))]
3050 "(32 - (INTVAL (operands[4]) & 31)) >= INTVAL (operands[1])"
3053 int shift = INTVAL (operands[4]) & 31;
3054 int start = INTVAL (operands[2]) & 31;
3055 int size = INTVAL (operands[1]) & 31;
3057 operands[4] = GEN_INT (32 - shift - start - size);
3058 operands[1] = GEN_INT (start + size - 1);
3059 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3061 [(set_attr "type" "insert_word")])
3063 (define_insn "*insvsi_internal4"
3064 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
3065 (match_operand:SI 1 "const_int_operand" "i")
3066 (match_operand:SI 2 "const_int_operand" "i"))
3067 (zero_extract:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3068 (match_operand:SI 4 "const_int_operand" "i")
3069 (match_operand:SI 5 "const_int_operand" "i")))]
3070 "INTVAL (operands[4]) >= INTVAL (operands[1])"
3073 int extract_start = INTVAL (operands[5]) & 31;
3074 int extract_size = INTVAL (operands[4]) & 31;
3075 int insert_start = INTVAL (operands[2]) & 31;
3076 int insert_size = INTVAL (operands[1]) & 31;
3078 /* Align extract field with insert field */
3079 operands[5] = GEN_INT (extract_start + extract_size - insert_start - insert_size);
3080 operands[1] = GEN_INT (insert_start + insert_size - 1);
3081 return \"{rlimi|rlwimi} %0,%3,%h5,%h2,%h1\";
3083 [(set_attr "type" "insert_word")])
3085 ;; combine patterns for rlwimi
3086 (define_insn "*insvsi_internal5"
3087 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3088 (ior:SI (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3089 (match_operand:SI 1 "mask_operand" "i"))
3090 (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3091 (match_operand:SI 2 "const_int_operand" "i"))
3092 (match_operand:SI 5 "mask_operand" "i"))))]
3093 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3096 int me = extract_ME(operands[5]);
3097 int mb = extract_MB(operands[5]);
3098 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3099 operands[2] = GEN_INT(mb);
3100 operands[1] = GEN_INT(me);
3101 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3103 [(set_attr "type" "insert_word")])
3105 (define_insn "*insvsi_internal6"
3106 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3107 (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 3 "gpc_reg_operand" "r")
3108 (match_operand:SI 2 "const_int_operand" "i"))
3109 (match_operand:SI 5 "mask_operand" "i"))
3110 (and:SI (match_operand:SI 4 "gpc_reg_operand" "0")
3111 (match_operand:SI 1 "mask_operand" "i"))))]
3112 "TARGET_POWERPC && INTVAL(operands[1]) == ~INTVAL(operands[5])"
3115 int me = extract_ME(operands[5]);
3116 int mb = extract_MB(operands[5]);
3117 operands[4] = GEN_INT(32 - INTVAL(operands[2]));
3118 operands[2] = GEN_INT(mb);
3119 operands[1] = GEN_INT(me);
3120 return \"{rlimi|rlwimi} %0,%3,%h4,%h2,%h1\";
3122 [(set_attr "type" "insert_word")])
3124 (define_insn "insvdi"
3125 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3126 (match_operand:SI 1 "const_int_operand" "i")
3127 (match_operand:SI 2 "const_int_operand" "i"))
3128 (match_operand:DI 3 "gpc_reg_operand" "r"))]
3132 int start = INTVAL (operands[2]) & 63;
3133 int size = INTVAL (operands[1]) & 63;
3135 operands[1] = GEN_INT (64 - start - size);
3136 return \"rldimi %0,%3,%H1,%H2\";
3139 (define_insn "*insvdi_internal2"
3140 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3141 (match_operand:SI 1 "const_int_operand" "i")
3142 (match_operand:SI 2 "const_int_operand" "i"))
3143 (ashiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3144 (match_operand:SI 4 "const_int_operand" "i")))]
3146 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3149 int shift = INTVAL (operands[4]) & 63;
3150 int start = (INTVAL (operands[2]) & 63) - 32;
3151 int size = INTVAL (operands[1]) & 63;
3153 operands[4] = GEN_INT (64 - shift - start - size);
3154 operands[2] = GEN_INT (start);
3155 operands[1] = GEN_INT (start + size - 1);
3156 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3159 (define_insn "*insvdi_internal3"
3160 [(set (zero_extract:DI (match_operand:DI 0 "gpc_reg_operand" "+r")
3161 (match_operand:SI 1 "const_int_operand" "i")
3162 (match_operand:SI 2 "const_int_operand" "i"))
3163 (lshiftrt:DI (match_operand:DI 3 "gpc_reg_operand" "r")
3164 (match_operand:SI 4 "const_int_operand" "i")))]
3166 && insvdi_rshift_rlwimi_p (operands[1], operands[2], operands[4])"
3169 int shift = INTVAL (operands[4]) & 63;
3170 int start = (INTVAL (operands[2]) & 63) - 32;
3171 int size = INTVAL (operands[1]) & 63;
3173 operands[4] = GEN_INT (64 - shift - start - size);
3174 operands[2] = GEN_INT (start);
3175 operands[1] = GEN_INT (start + size - 1);
3176 return \"rlwimi %0,%3,%h4,%h2,%h1\";
3179 (define_expand "extzv"
3180 [(set (match_operand 0 "gpc_reg_operand" "")
3181 (zero_extract (match_operand 1 "gpc_reg_operand" "")
3182 (match_operand:SI 2 "const_int_operand" "")
3183 (match_operand:SI 3 "const_int_operand" "")))]
3187 /* Do not handle 16/8 bit structures that fit in HI/QI modes directly, since
3188 the (SUBREG:SI (REG:HI xxx)) that is otherwise generated can confuse the
3189 compiler if the address of the structure is taken later. */
3190 if (GET_CODE (operands[0]) == SUBREG
3191 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[0]))) < UNITS_PER_WORD))
3194 if (TARGET_POWERPC64 && GET_MODE (operands[1]) == DImode)
3195 emit_insn (gen_extzvdi (operands[0], operands[1], operands[2], operands[3]));
3197 emit_insn (gen_extzvsi (operands[0], operands[1], operands[2], operands[3]));
3201 (define_insn "extzvsi"
3202 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3203 (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3204 (match_operand:SI 2 "const_int_operand" "i")
3205 (match_operand:SI 3 "const_int_operand" "i")))]
3209 int start = INTVAL (operands[3]) & 31;
3210 int size = INTVAL (operands[2]) & 31;
3212 if (start + size >= 32)
3213 operands[3] = const0_rtx;
3215 operands[3] = GEN_INT (start + size);
3216 return \"{rlinm|rlwinm} %0,%1,%3,%s2,31\";
3219 (define_insn "*extzvsi_internal1"
3220 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3221 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3222 (match_operand:SI 2 "const_int_operand" "i,i")
3223 (match_operand:SI 3 "const_int_operand" "i,i"))
3225 (clobber (match_scratch:SI 4 "=r,r"))]
3229 int start = INTVAL (operands[3]) & 31;
3230 int size = INTVAL (operands[2]) & 31;
3232 /* Force split for non-cc0 compare. */
3233 if (which_alternative == 1)
3236 /* If the bit-field being tested fits in the upper or lower half of a
3237 word, it is possible to use andiu. or andil. to test it. This is
3238 useful because the condition register set-use delay is smaller for
3239 andi[ul]. than for rlinm. This doesn't work when the starting bit
3240 position is 0 because the LT and GT bits may be set wrong. */
3242 if ((start > 0 && start + size <= 16) || start >= 16)
3244 operands[3] = GEN_INT (((1 << (16 - (start & 15)))
3245 - (1 << (16 - (start & 15) - size))));
3247 return \"{andiu.|andis.} %4,%1,%3\";
3249 return \"{andil.|andi.} %4,%1,%3\";
3252 if (start + size >= 32)
3253 operands[3] = const0_rtx;
3255 operands[3] = GEN_INT (start + size);
3256 return \"{rlinm.|rlwinm.} %4,%1,%3,%s2,31\";
3258 [(set_attr "type" "compare")
3259 (set_attr "length" "4,8")])
3262 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3263 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3264 (match_operand:SI 2 "const_int_operand" "")
3265 (match_operand:SI 3 "const_int_operand" ""))
3267 (clobber (match_scratch:SI 4 ""))]
3270 (zero_extract:SI (match_dup 1) (match_dup 2)
3273 (compare:CC (match_dup 4)
3277 (define_insn "*extzvsi_internal2"
3278 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3279 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3280 (match_operand:SI 2 "const_int_operand" "i,i")
3281 (match_operand:SI 3 "const_int_operand" "i,i"))
3283 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3284 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3288 int start = INTVAL (operands[3]) & 31;
3289 int size = INTVAL (operands[2]) & 31;
3291 /* Force split for non-cc0 compare. */
3292 if (which_alternative == 1)
3295 /* Since we are using the output value, we can't ignore any need for
3296 a shift. The bit-field must end at the LSB. */
3297 if (start >= 16 && start + size == 32)
3299 operands[3] = GEN_INT ((1 << size) - 1);
3300 return \"{andil.|andi.} %0,%1,%3\";
3303 if (start + size >= 32)
3304 operands[3] = const0_rtx;
3306 operands[3] = GEN_INT (start + size);
3307 return \"{rlinm.|rlwinm.} %0,%1,%3,%s2,31\";
3309 [(set_attr "type" "compare")
3310 (set_attr "length" "4,8")])
3313 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3314 (compare:CC (zero_extract:SI (match_operand:SI 1 "gpc_reg_operand" "")
3315 (match_operand:SI 2 "const_int_operand" "")
3316 (match_operand:SI 3 "const_int_operand" ""))
3318 (set (match_operand:SI 0 "gpc_reg_operand" "")
3319 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))]
3322 (zero_extract:SI (match_dup 1) (match_dup 2) (match_dup 3)))
3324 (compare:CC (match_dup 0)
3328 (define_insn "extzvdi"
3329 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
3330 (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3331 (match_operand:SI 2 "const_int_operand" "i")
3332 (match_operand:SI 3 "const_int_operand" "i")))]
3336 int start = INTVAL (operands[3]) & 63;
3337 int size = INTVAL (operands[2]) & 63;
3339 if (start + size >= 64)
3340 operands[3] = const0_rtx;
3342 operands[3] = GEN_INT (start + size);
3343 operands[2] = GEN_INT (64 - size);
3344 return \"rldicl %0,%1,%3,%2\";
3347 (define_insn "*extzvdi_internal1"
3348 [(set (match_operand:CC 0 "gpc_reg_operand" "=x")
3349 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3350 (match_operand:SI 2 "const_int_operand" "i")
3351 (match_operand:SI 3 "const_int_operand" "i"))
3353 (clobber (match_scratch:DI 4 "=r"))]
3357 int start = INTVAL (operands[3]) & 63;
3358 int size = INTVAL (operands[2]) & 63;
3360 if (start + size >= 64)
3361 operands[3] = const0_rtx;
3363 operands[3] = GEN_INT (start + size);
3364 operands[2] = GEN_INT (64 - size);
3365 return \"rldicl. %4,%1,%3,%2\";
3367 [(set_attr "type" "compare")])
3369 (define_insn "*extzvdi_internal2"
3370 [(set (match_operand:CC 4 "gpc_reg_operand" "=x")
3371 (compare:CC (zero_extract:DI (match_operand:DI 1 "gpc_reg_operand" "r")
3372 (match_operand:SI 2 "const_int_operand" "i")
3373 (match_operand:SI 3 "const_int_operand" "i"))
3375 (set (match_operand:DI 0 "gpc_reg_operand" "=r")
3376 (zero_extract:DI (match_dup 1) (match_dup 2) (match_dup 3)))]
3380 int start = INTVAL (operands[3]) & 63;
3381 int size = INTVAL (operands[2]) & 63;
3383 if (start + size >= 64)
3384 operands[3] = const0_rtx;
3386 operands[3] = GEN_INT (start + size);
3387 operands[2] = GEN_INT (64 - size);
3388 return \"rldicl. %0,%1,%3,%2\";
3390 [(set_attr "type" "compare")])
3392 (define_insn "rotlsi3"
3393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3394 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3395 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3397 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffffffff")
3399 (define_insn "*rotlsi3_internal2"
3400 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3401 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3402 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3404 (clobber (match_scratch:SI 3 "=r,r"))]
3407 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffffffff
3409 [(set_attr "type" "delayed_compare")
3410 (set_attr "length" "4,8")])
3413 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3414 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3415 (match_operand:SI 2 "reg_or_cint_operand" ""))
3417 (clobber (match_scratch:SI 3 ""))]
3420 (rotate:SI (match_dup 1) (match_dup 2)))
3422 (compare:CC (match_dup 3)
3426 (define_insn "*rotlsi3_internal3"
3427 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3428 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3429 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3431 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3432 (rotate:SI (match_dup 1) (match_dup 2)))]
3435 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffffffff
3437 [(set_attr "type" "delayed_compare")
3438 (set_attr "length" "4,8")])
3441 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3442 (compare:CC (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3443 (match_operand:SI 2 "reg_or_cint_operand" ""))
3445 (set (match_operand:SI 0 "gpc_reg_operand" "")
3446 (rotate:SI (match_dup 1) (match_dup 2)))]
3449 (rotate:SI (match_dup 1) (match_dup 2)))
3451 (compare:CC (match_dup 0)
3455 (define_insn "*rotlsi3_internal4"
3456 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3457 (and:SI (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3458 (match_operand:SI 2 "reg_or_cint_operand" "ri"))
3459 (match_operand:SI 3 "mask_operand" "n")))]
3461 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,%m3,%M3")
3463 (define_insn "*rotlsi3_internal5"
3464 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3466 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3467 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3468 (match_operand:SI 3 "mask_operand" "n,n"))
3470 (clobber (match_scratch:SI 4 "=r,r"))]
3473 {rl%I2nm.|rlw%I2nm.} %4,%1,%h2,%m3,%M3
3475 [(set_attr "type" "delayed_compare")
3476 (set_attr "length" "4,8")])
3479 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3481 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3482 (match_operand:SI 2 "reg_or_cint_operand" ""))
3483 (match_operand:SI 3 "mask_operand" ""))
3485 (clobber (match_scratch:SI 4 ""))]
3488 (and:SI (rotate:SI (match_dup 1)
3492 (compare:CC (match_dup 4)
3496 (define_insn "*rotlsi3_internal6"
3497 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3499 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3500 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3501 (match_operand:SI 3 "mask_operand" "n,n"))
3503 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3504 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3507 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,%m3,%M3
3509 [(set_attr "type" "delayed_compare")
3510 (set_attr "length" "4,8")])
3513 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3515 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3516 (match_operand:SI 2 "reg_or_cint_operand" ""))
3517 (match_operand:SI 3 "mask_operand" ""))
3519 (set (match_operand:SI 0 "gpc_reg_operand" "")
3520 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3523 (and:SI (rotate:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3525 (compare:CC (match_dup 0)
3529 (define_insn "*rotlsi3_internal7"
3530 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3533 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3534 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3536 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xff")
3538 (define_insn "*rotlsi3_internal8"
3539 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3540 (compare:CC (zero_extend:SI
3542 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3543 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3545 (clobber (match_scratch:SI 3 "=r,r"))]
3548 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xff
3550 [(set_attr "type" "delayed_compare")
3551 (set_attr "length" "4,8")])
3554 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3555 (compare:CC (zero_extend:SI
3557 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3558 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3560 (clobber (match_scratch:SI 3 ""))]
3563 (zero_extend:SI (subreg:QI
3564 (rotate:SI (match_dup 1)
3567 (compare:CC (match_dup 3)
3571 (define_insn "*rotlsi3_internal9"
3572 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3573 (compare:CC (zero_extend:SI
3575 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3576 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3578 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3579 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3582 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xff
3584 [(set_attr "type" "delayed_compare")
3585 (set_attr "length" "4,8")])
3588 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3589 (compare:CC (zero_extend:SI
3591 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3592 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3594 (set (match_operand:SI 0 "gpc_reg_operand" "")
3595 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3598 (zero_extend:SI (subreg:QI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3600 (compare:CC (match_dup 0)
3604 (define_insn "*rotlsi3_internal10"
3605 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3608 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3609 (match_operand:SI 2 "reg_or_cint_operand" "ri")) 0)))]
3611 "{rl%I2nm|rlw%I2nm} %0,%1,%h2,0xffff")
3613 (define_insn "*rotlsi3_internal11"
3614 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3615 (compare:CC (zero_extend:SI
3617 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3618 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3620 (clobber (match_scratch:SI 3 "=r,r"))]
3623 {rl%I2nm.|rlw%I2nm.} %3,%1,%h2,0xffff
3625 [(set_attr "type" "delayed_compare")
3626 (set_attr "length" "4,8")])
3629 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3630 (compare:CC (zero_extend:SI
3632 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3633 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3635 (clobber (match_scratch:SI 3 ""))]
3638 (zero_extend:SI (subreg:HI
3639 (rotate:SI (match_dup 1)
3642 (compare:CC (match_dup 3)
3646 (define_insn "*rotlsi3_internal12"
3647 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3648 (compare:CC (zero_extend:SI
3650 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3651 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri")) 0))
3653 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3654 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3657 {rl%I2nm.|rlw%I2nm.} %0,%1,%h2,0xffff
3659 [(set_attr "type" "delayed_compare")
3660 (set_attr "length" "4,8")])
3663 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3664 (compare:CC (zero_extend:SI
3666 (rotate:SI (match_operand:SI 1 "gpc_reg_operand" "")
3667 (match_operand:SI 2 "reg_or_cint_operand" "")) 0))
3669 (set (match_operand:SI 0 "gpc_reg_operand" "")
3670 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))]
3673 (zero_extend:SI (subreg:HI (rotate:SI (match_dup 1) (match_dup 2)) 0)))
3675 (compare:CC (match_dup 0)
3679 ;; Note that we use "sle." instead of "sl." so that we can set
3680 ;; SHIFT_COUNT_TRUNCATED.
3682 (define_expand "ashlsi3"
3683 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3684 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3685 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3690 emit_insn (gen_ashlsi3_power (operands[0], operands[1], operands[2]));
3692 emit_insn (gen_ashlsi3_no_power (operands[0], operands[1], operands[2]));
3696 (define_insn "ashlsi3_power"
3697 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3698 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3699 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
3700 (clobber (match_scratch:SI 3 "=q,X"))]
3704 {sli|slwi} %0,%1,%h2")
3706 (define_insn "ashlsi3_no_power"
3707 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3708 (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3709 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
3711 "{sl|slw}%I2 %0,%1,%h2")
3714 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3715 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3716 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3718 (clobber (match_scratch:SI 3 "=r,r,r,r"))
3719 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3723 {sli.|slwi.} %3,%1,%h2
3726 [(set_attr "type" "delayed_compare")
3727 (set_attr "length" "4,4,8,8")])
3730 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3731 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3732 (match_operand:SI 2 "reg_or_cint_operand" ""))
3734 (clobber (match_scratch:SI 3 ""))
3735 (clobber (match_scratch:SI 4 ""))]
3736 "TARGET_POWER && reload_completed"
3737 [(parallel [(set (match_dup 3)
3738 (ashift:SI (match_dup 1) (match_dup 2)))
3739 (clobber (match_dup 4))])
3741 (compare:CC (match_dup 3)
3746 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3747 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3748 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3750 (clobber (match_scratch:SI 3 "=r,r"))]
3751 "! TARGET_POWER && TARGET_32BIT"
3753 {sl|slw}%I2. %3,%1,%h2
3755 [(set_attr "type" "delayed_compare")
3756 (set_attr "length" "4,8")])
3759 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3760 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3761 (match_operand:SI 2 "reg_or_cint_operand" ""))
3763 (clobber (match_scratch:SI 3 ""))]
3764 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3766 (ashift:SI (match_dup 1) (match_dup 2)))
3768 (compare:CC (match_dup 3)
3773 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
3774 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3775 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
3777 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
3778 (ashift:SI (match_dup 1) (match_dup 2)))
3779 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
3783 {sli.|slwi.} %0,%1,%h2
3786 [(set_attr "type" "delayed_compare")
3787 (set_attr "length" "4,4,8,8")])
3790 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3791 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3792 (match_operand:SI 2 "reg_or_cint_operand" ""))
3794 (set (match_operand:SI 0 "gpc_reg_operand" "")
3795 (ashift:SI (match_dup 1) (match_dup 2)))
3796 (clobber (match_scratch:SI 4 ""))]
3797 "TARGET_POWER && reload_completed"
3798 [(parallel [(set (match_dup 0)
3799 (ashift:SI (match_dup 1) (match_dup 2)))
3800 (clobber (match_dup 4))])
3802 (compare:CC (match_dup 0)
3807 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
3808 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3809 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
3811 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3812 (ashift:SI (match_dup 1) (match_dup 2)))]
3813 "! TARGET_POWER && TARGET_32BIT"
3815 {sl|slw}%I2. %0,%1,%h2
3817 [(set_attr "type" "delayed_compare")
3818 (set_attr "length" "4,8")])
3821 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
3822 (compare:CC (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3823 (match_operand:SI 2 "reg_or_cint_operand" ""))
3825 (set (match_operand:SI 0 "gpc_reg_operand" "")
3826 (ashift:SI (match_dup 1) (match_dup 2)))]
3827 "! TARGET_POWER && TARGET_32BIT && reload_completed"
3829 (ashift:SI (match_dup 1) (match_dup 2)))
3831 (compare:CC (match_dup 0)
3835 (define_insn "rlwinm"
3836 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
3837 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r")
3838 (match_operand:SI 2 "const_int_operand" "i"))
3839 (match_operand:SI 3 "mask_operand" "n")))]
3840 "includes_lshift_p (operands[2], operands[3])"
3841 "{rlinm|rlwinm} %0,%1,%h2,%m3,%M3")
3844 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
3846 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3847 (match_operand:SI 2 "const_int_operand" "i,i"))
3848 (match_operand:SI 3 "mask_operand" "n,n"))
3850 (clobber (match_scratch:SI 4 "=r,r"))]
3851 "includes_lshift_p (operands[2], operands[3])"
3853 {rlinm.|rlwinm.} %4,%1,%h2,%m3,%M3
3855 [(set_attr "type" "delayed_compare")
3856 (set_attr "length" "4,8")])
3859 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3861 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3862 (match_operand:SI 2 "const_int_operand" ""))
3863 (match_operand:SI 3 "mask_operand" ""))
3865 (clobber (match_scratch:SI 4 ""))]
3866 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3868 (and:SI (ashift:SI (match_dup 1) (match_dup 2))
3871 (compare:CC (match_dup 4)
3876 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
3878 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3879 (match_operand:SI 2 "const_int_operand" "i,i"))
3880 (match_operand:SI 3 "mask_operand" "n,n"))
3882 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3883 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3884 "includes_lshift_p (operands[2], operands[3])"
3886 {rlinm.|rlwinm.} %0,%1,%h2,%m3,%M3
3888 [(set_attr "type" "delayed_compare")
3889 (set_attr "length" "4,8")])
3892 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
3894 (and:SI (ashift:SI (match_operand:SI 1 "gpc_reg_operand" "")
3895 (match_operand:SI 2 "const_int_operand" ""))
3896 (match_operand:SI 3 "mask_operand" ""))
3898 (set (match_operand:SI 0 "gpc_reg_operand" "")
3899 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
3900 "includes_lshift_p (operands[2], operands[3]) && reload_completed"
3902 (and:SI (ashift:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
3904 (compare:CC (match_dup 0)
3908 ;; The AIX assembler mis-handles "sri x,x,0", so write that case as
3910 (define_expand "lshrsi3"
3911 [(use (match_operand:SI 0 "gpc_reg_operand" ""))
3912 (use (match_operand:SI 1 "gpc_reg_operand" ""))
3913 (use (match_operand:SI 2 "reg_or_cint_operand" ""))]
3918 emit_insn (gen_lshrsi3_power (operands[0], operands[1], operands[2]));
3920 emit_insn (gen_lshrsi3_no_power (operands[0], operands[1], operands[2]));
3924 (define_insn "lshrsi3_power"
3925 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
3926 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r")
3927 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i")))
3928 (clobber (match_scratch:SI 3 "=q,X,X"))]
3933 {s%A2i|s%A2wi} %0,%1,%h2")
3935 (define_insn "lshrsi3_no_power"
3936 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
3937 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
3938 (match_operand:SI 2 "reg_or_cint_operand" "O,ri")))]
3942 {sr|srw}%I2 %0,%1,%h2")
3945 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,?y,?y,?y")
3946 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
3947 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
3949 (clobber (match_scratch:SI 3 "=r,X,r,r,X,r"))
3950 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
3955 {s%A2i.|s%A2wi.} %3,%1,%h2
3959 [(set_attr "type" "delayed_compare")
3960 (set_attr "length" "4,4,4,8,8,8")])
3963 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3964 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3965 (match_operand:SI 2 "reg_or_cint_operand" ""))
3967 (clobber (match_scratch:SI 3 ""))
3968 (clobber (match_scratch:SI 4 ""))]
3969 "TARGET_POWER && reload_completed"
3970 [(parallel [(set (match_dup 3)
3971 (lshiftrt:SI (match_dup 1) (match_dup 2)))
3972 (clobber (match_dup 4))])
3974 (compare:CC (match_dup 3)
3979 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
3980 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
3981 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
3983 (clobber (match_scratch:SI 3 "=X,r,X,r"))]
3984 "! TARGET_POWER && TARGET_32BIT"
3987 {sr|srw}%I2. %3,%1,%h2
3990 [(set_attr "type" "delayed_compare")
3991 (set_attr "length" "4,4,8,8")])
3994 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
3995 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
3996 (match_operand:SI 2 "reg_or_cint_operand" ""))
3998 (clobber (match_scratch:SI 3 ""))]
3999 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4001 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4003 (compare:CC (match_dup 3)
4008 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,?y,?y,?y")
4009 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r,r,r")
4010 (match_operand:SI 2 "reg_or_cint_operand" "r,O,i,r,O,i"))
4012 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
4013 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4014 (clobber (match_scratch:SI 4 "=q,X,X,q,X,X"))]
4019 {s%A2i.|s%A2wi.} %0,%1,%h2
4023 [(set_attr "type" "delayed_compare")
4024 (set_attr "length" "4,4,4,8,8,8")])
4027 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4028 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4029 (match_operand:SI 2 "reg_or_cint_operand" ""))
4031 (set (match_operand:SI 0 "gpc_reg_operand" "")
4032 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4033 (clobber (match_scratch:SI 4 ""))]
4034 "TARGET_POWER && reload_completed"
4035 [(parallel [(set (match_dup 0)
4036 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4037 (clobber (match_dup 4))])
4039 (compare:CC (match_dup 0)
4044 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4045 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4046 (match_operand:SI 2 "reg_or_cint_operand" "O,ri,O,ri"))
4048 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4049 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4050 "! TARGET_POWER && TARGET_32BIT"
4053 {sr|srw}%I2. %0,%1,%h2
4056 [(set_attr "type" "delayed_compare")
4057 (set_attr "length" "4,4,8,8")])
4060 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4061 (compare:CC (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4062 (match_operand:SI 2 "reg_or_cint_operand" ""))
4064 (set (match_operand:SI 0 "gpc_reg_operand" "")
4065 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
4066 "! TARGET_POWER && TARGET_32BIT && reload_completed"
4068 (lshiftrt:SI (match_dup 1) (match_dup 2)))
4070 (compare:CC (match_dup 0)
4075 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4076 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4077 (match_operand:SI 2 "const_int_operand" "i"))
4078 (match_operand:SI 3 "mask_operand" "n")))]
4079 "includes_rshift_p (operands[2], operands[3])"
4080 "{rlinm|rlwinm} %0,%1,%s2,%m3,%M3")
4083 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4085 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4086 (match_operand:SI 2 "const_int_operand" "i,i"))
4087 (match_operand:SI 3 "mask_operand" "n,n"))
4089 (clobber (match_scratch:SI 4 "=r,r"))]
4090 "includes_rshift_p (operands[2], operands[3])"
4092 {rlinm.|rlwinm.} %4,%1,%s2,%m3,%M3
4094 [(set_attr "type" "delayed_compare")
4095 (set_attr "length" "4,8")])
4098 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4100 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4101 (match_operand:SI 2 "const_int_operand" ""))
4102 (match_operand:SI 3 "mask_operand" ""))
4104 (clobber (match_scratch:SI 4 ""))]
4105 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4107 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2))
4110 (compare:CC (match_dup 4)
4115 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
4117 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4118 (match_operand:SI 2 "const_int_operand" "i,i"))
4119 (match_operand:SI 3 "mask_operand" "n,n"))
4121 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4122 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4123 "includes_rshift_p (operands[2], operands[3])"
4125 {rlinm.|rlwinm.} %0,%1,%s2,%m3,%M3
4127 [(set_attr "type" "delayed_compare")
4128 (set_attr "length" "4,8")])
4131 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
4133 (and:SI (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4134 (match_operand:SI 2 "const_int_operand" ""))
4135 (match_operand:SI 3 "mask_operand" ""))
4137 (set (match_operand:SI 0 "gpc_reg_operand" "")
4138 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
4139 "includes_rshift_p (operands[2], operands[3]) && reload_completed"
4141 (and:SI (lshiftrt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
4143 (compare:CC (match_dup 0)
4148 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4151 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4152 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4153 "includes_rshift_p (operands[2], GEN_INT (255))"
4154 "{rlinm|rlwinm} %0,%1,%s2,0xff")
4157 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4161 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4162 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4164 (clobber (match_scratch:SI 3 "=r,r"))]
4165 "includes_rshift_p (operands[2], GEN_INT (255))"
4167 {rlinm.|rlwinm.} %3,%1,%s2,0xff
4169 [(set_attr "type" "delayed_compare")
4170 (set_attr "length" "4,8")])
4173 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4177 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4178 (match_operand:SI 2 "const_int_operand" "")) 0))
4180 (clobber (match_scratch:SI 3 ""))]
4181 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4183 (zero_extend:SI (subreg:QI
4184 (lshiftrt:SI (match_dup 1)
4187 (compare:CC (match_dup 3)
4192 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4196 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4197 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4199 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4200 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4201 "includes_rshift_p (operands[2], GEN_INT (255))"
4203 {rlinm.|rlwinm.} %0,%1,%s2,0xff
4205 [(set_attr "type" "delayed_compare")
4206 (set_attr "length" "4,8")])
4209 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4213 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4214 (match_operand:SI 2 "const_int_operand" "")) 0))
4216 (set (match_operand:SI 0 "gpc_reg_operand" "")
4217 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4218 "includes_rshift_p (operands[2], GEN_INT (255)) && reload_completed"
4220 (zero_extend:SI (subreg:QI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4222 (compare:CC (match_dup 0)
4227 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4230 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4231 (match_operand:SI 2 "const_int_operand" "i")) 0)))]
4232 "includes_rshift_p (operands[2], GEN_INT (65535))"
4233 "{rlinm|rlwinm} %0,%1,%s2,0xffff")
4236 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4240 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4241 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4243 (clobber (match_scratch:SI 3 "=r,r"))]
4244 "includes_rshift_p (operands[2], GEN_INT (65535))"
4246 {rlinm.|rlwinm.} %3,%1,%s2,0xffff
4248 [(set_attr "type" "delayed_compare")
4249 (set_attr "length" "4,8")])
4252 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4256 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4257 (match_operand:SI 2 "const_int_operand" "")) 0))
4259 (clobber (match_scratch:SI 3 ""))]
4260 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4262 (zero_extend:SI (subreg:HI
4263 (lshiftrt:SI (match_dup 1)
4266 (compare:CC (match_dup 3)
4271 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4275 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4276 (match_operand:SI 2 "const_int_operand" "i,i")) 0))
4278 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4279 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4280 "includes_rshift_p (operands[2], GEN_INT (65535))"
4282 {rlinm.|rlwinm.} %0,%1,%s2,0xffff
4284 [(set_attr "type" "delayed_compare")
4285 (set_attr "length" "4,8")])
4288 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4292 (lshiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4293 (match_operand:SI 2 "const_int_operand" "")) 0))
4295 (set (match_operand:SI 0 "gpc_reg_operand" "")
4296 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))]
4297 "includes_rshift_p (operands[2], GEN_INT (65535)) && reload_completed"
4299 (zero_extend:SI (subreg:HI (lshiftrt:SI (match_dup 1) (match_dup 2)) 0)))
4301 (compare:CC (match_dup 0)
4306 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4308 (match_operand:SI 1 "gpc_reg_operand" "r"))
4309 (ashiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4315 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4317 (match_operand:SI 1 "gpc_reg_operand" "r"))
4318 (lshiftrt:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4324 [(set (zero_extract:SI (match_operand:SI 0 "gpc_reg_operand" "+r")
4326 (match_operand:SI 1 "gpc_reg_operand" "r"))
4327 (zero_extract:SI (match_operand:SI 2 "gpc_reg_operand" "r")
4333 (define_expand "ashrsi3"
4334 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4335 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4336 (match_operand:SI 2 "reg_or_cint_operand" "")))]
4341 emit_insn (gen_ashrsi3_power (operands[0], operands[1], operands[2]));
4343 emit_insn (gen_ashrsi3_no_power (operands[0], operands[1], operands[2]));
4347 (define_insn "ashrsi3_power"
4348 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4349 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4350 (match_operand:SI 2 "reg_or_cint_operand" "r,i")))
4351 (clobber (match_scratch:SI 3 "=q,X"))]
4355 {srai|srawi} %0,%1,%h2")
4357 (define_insn "ashrsi3_no_power"
4358 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4359 (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
4360 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
4362 "{sra|sraw}%I2 %0,%1,%h2")
4365 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
4366 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4367 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4369 (clobber (match_scratch:SI 3 "=r,r,r,r"))
4370 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4374 {srai.|srawi.} %3,%1,%h2
4377 [(set_attr "type" "delayed_compare")
4378 (set_attr "length" "4,4,8,8")])
4381 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4382 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4383 (match_operand:SI 2 "reg_or_cint_operand" ""))
4385 (clobber (match_scratch:SI 3 ""))
4386 (clobber (match_scratch:SI 4 ""))]
4387 "TARGET_POWER && reload_completed"
4388 [(parallel [(set (match_dup 3)
4389 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4390 (clobber (match_dup 4))])
4392 (compare:CC (match_dup 3)
4397 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
4398 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4399 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4401 (clobber (match_scratch:SI 3 "=r,r"))]
4404 {sra|sraw}%I2. %3,%1,%h2
4406 [(set_attr "type" "delayed_compare")
4407 (set_attr "length" "4,8")])
4410 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
4411 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4412 (match_operand:SI 2 "reg_or_cint_operand" ""))
4414 (clobber (match_scratch:SI 3 ""))]
4415 "! TARGET_POWER && reload_completed"
4417 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4419 (compare:CC (match_dup 3)
4424 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
4425 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
4426 (match_operand:SI 2 "reg_or_cint_operand" "r,i,r,i"))
4428 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
4429 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4430 (clobber (match_scratch:SI 4 "=q,X,q,X"))]
4434 {srai.|srawi.} %0,%1,%h2
4437 [(set_attr "type" "delayed_compare")
4438 (set_attr "length" "4,4,8,8")])
4441 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4442 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4443 (match_operand:SI 2 "reg_or_cint_operand" ""))
4445 (set (match_operand:SI 0 "gpc_reg_operand" "")
4446 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4447 (clobber (match_scratch:SI 4 ""))]
4448 "TARGET_POWER && reload_completed"
4449 [(parallel [(set (match_dup 0)
4450 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4451 (clobber (match_dup 4))])
4453 (compare:CC (match_dup 0)
4458 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
4459 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
4460 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
4462 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
4463 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4466 {sra|sraw}%I2. %0,%1,%h2
4468 [(set_attr "type" "delayed_compare")
4469 (set_attr "length" "4,8")])
4472 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
4473 (compare:CC (ashiftrt:SI (match_operand:SI 1 "gpc_reg_operand" "")
4474 (match_operand:SI 2 "reg_or_cint_operand" ""))
4476 (set (match_operand:SI 0 "gpc_reg_operand" "")
4477 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
4478 "! TARGET_POWER && reload_completed"
4480 (ashiftrt:SI (match_dup 1) (match_dup 2)))
4482 (compare:CC (match_dup 0)
4486 ;; Floating-point insns, excluding normal data motion.
4488 ;; PowerPC has a full set of single-precision floating point instructions.
4490 ;; For the POWER architecture, we pretend that we have both SFmode and
4491 ;; DFmode insns, while, in fact, all fp insns are actually done in double.
4492 ;; The only conversions we will do will be when storing to memory. In that
4493 ;; case, we will use the "frsp" instruction before storing.
4495 ;; Note that when we store into a single-precision memory location, we need to
4496 ;; use the frsp insn first. If the register being stored isn't dead, we
4497 ;; need a scratch register for the frsp. But this is difficult when the store
4498 ;; is done by reload. It is not incorrect to do the frsp on the register in
4499 ;; this case, we just lose precision that we would have otherwise gotten but
4500 ;; is not guaranteed. Perhaps this should be tightened up at some point.
4502 (define_expand "extendsfdf2"
4503 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4504 (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
4505 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4508 (define_insn_and_split "*extendsfdf2_fpr"
4509 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
4510 (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
4511 "TARGET_HARD_FLOAT && TARGET_FPRS"
4516 "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
4519 emit_note (NOTE_INSN_DELETED);
4522 [(set_attr "type" "fp,fp,fpload")])
4524 (define_expand "truncdfsf2"
4525 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4526 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
4527 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4530 (define_insn "*truncdfsf2_fpr"
4531 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4532 (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4533 "TARGET_HARD_FLOAT && TARGET_FPRS"
4535 [(set_attr "type" "fp")])
4537 (define_insn "aux_truncdfsf2"
4538 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4539 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRSP))]
4540 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4542 [(set_attr "type" "fp")])
4544 (define_expand "negsf2"
4545 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4546 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4550 (define_insn "*negsf2"
4551 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4552 (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4553 "TARGET_HARD_FLOAT && TARGET_FPRS"
4555 [(set_attr "type" "fp")])
4557 (define_expand "abssf2"
4558 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4559 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4563 (define_insn "*abssf2"
4564 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4565 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4566 "TARGET_HARD_FLOAT && TARGET_FPRS"
4568 [(set_attr "type" "fp")])
4571 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4572 (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
4573 "TARGET_HARD_FLOAT && TARGET_FPRS"
4575 [(set_attr "type" "fp")])
4577 (define_expand "addsf3"
4578 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4579 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4580 (match_operand:SF 2 "gpc_reg_operand" "")))]
4585 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4586 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4587 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4588 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4590 [(set_attr "type" "fp")])
4593 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4594 (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4595 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4596 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4597 "{fa|fadd} %0,%1,%2"
4598 [(set_attr "type" "fp")])
4600 (define_expand "subsf3"
4601 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4602 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
4603 (match_operand:SF 2 "gpc_reg_operand" "")))]
4608 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4609 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4610 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4611 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4613 [(set_attr "type" "fp")])
4616 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4617 (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4618 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4619 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4620 "{fs|fsub} %0,%1,%2"
4621 [(set_attr "type" "fp")])
4623 (define_expand "mulsf3"
4624 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4625 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
4626 (match_operand:SF 2 "gpc_reg_operand" "")))]
4631 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4632 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4633 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4634 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4636 [(set_attr "type" "fp")])
4639 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4640 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4641 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4642 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4643 "{fm|fmul} %0,%1,%2"
4644 [(set_attr "type" "dmul")])
4647 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4648 (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
4649 "TARGET_PPC_GFXOPT && flag_finite_math_only"
4651 [(set_attr "type" "fp")])
4653 (define_expand "divsf3"
4654 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4655 (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
4656 (match_operand:SF 2 "gpc_reg_operand" "")))]
4659 if (swdiv && !optimize_size && TARGET_PPC_GFXOPT
4660 && flag_finite_math_only && !flag_trapping_math)
4662 rs6000_emit_swdivsf (operands[0], operands[1], operands[2]);
4668 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4669 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4670 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4671 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4673 [(set_attr "type" "sdiv")])
4676 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4677 (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
4678 (match_operand:SF 2 "gpc_reg_operand" "f")))]
4679 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS"
4680 "{fd|fdiv} %0,%1,%2"
4681 [(set_attr "type" "ddiv")])
4684 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4685 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4686 (match_operand:SF 2 "gpc_reg_operand" "f"))
4687 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4688 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4689 "fmadds %0,%1,%2,%3"
4690 [(set_attr "type" "fp")])
4693 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4694 (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4695 (match_operand:SF 2 "gpc_reg_operand" "f"))
4696 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4697 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4698 "{fma|fmadd} %0,%1,%2,%3"
4699 [(set_attr "type" "dmul")])
4702 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4703 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4704 (match_operand:SF 2 "gpc_reg_operand" "f"))
4705 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4706 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4707 "fmsubs %0,%1,%2,%3"
4708 [(set_attr "type" "fp")])
4711 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4712 (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4713 (match_operand:SF 2 "gpc_reg_operand" "f"))
4714 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4715 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4716 "{fms|fmsub} %0,%1,%2,%3"
4717 [(set_attr "type" "dmul")])
4720 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4721 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4722 (match_operand:SF 2 "gpc_reg_operand" "f"))
4723 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4724 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4725 && HONOR_SIGNED_ZEROS (SFmode)"
4726 "fnmadds %0,%1,%2,%3"
4727 [(set_attr "type" "fp")])
4730 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4731 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4732 (match_operand:SF 2 "gpc_reg_operand" "f"))
4733 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4734 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4735 && ! HONOR_SIGNED_ZEROS (SFmode)"
4736 "fnmadds %0,%1,%2,%3"
4737 [(set_attr "type" "fp")])
4740 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4741 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4742 (match_operand:SF 2 "gpc_reg_operand" "f"))
4743 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4744 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4745 "{fnma|fnmadd} %0,%1,%2,%3"
4746 [(set_attr "type" "dmul")])
4749 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4750 (minus:SF (mult:SF (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f"))
4751 (match_operand:SF 2 "gpc_reg_operand" "f"))
4752 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4753 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4754 && ! HONOR_SIGNED_ZEROS (SFmode)"
4755 "{fnma|fnmadd} %0,%1,%2,%3"
4756 [(set_attr "type" "dmul")])
4759 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4760 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4761 (match_operand:SF 2 "gpc_reg_operand" "f"))
4762 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4763 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4764 && HONOR_SIGNED_ZEROS (SFmode)"
4765 "fnmsubs %0,%1,%2,%3"
4766 [(set_attr "type" "fp")])
4769 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4770 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4771 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4772 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4773 "TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4774 && ! HONOR_SIGNED_ZEROS (SFmode)"
4775 "fnmsubs %0,%1,%2,%3"
4776 [(set_attr "type" "fp")])
4779 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4780 (neg:SF (minus:SF (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4781 (match_operand:SF 2 "gpc_reg_operand" "f"))
4782 (match_operand:SF 3 "gpc_reg_operand" "f"))))]
4783 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
4784 "{fnms|fnmsub} %0,%1,%2,%3"
4785 [(set_attr "type" "dmul")])
4788 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4789 (minus:SF (match_operand:SF 3 "gpc_reg_operand" "f")
4790 (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
4791 (match_operand:SF 2 "gpc_reg_operand" "f"))))]
4792 "! TARGET_POWERPC && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
4793 && ! HONOR_SIGNED_ZEROS (SFmode)"
4794 "{fnms|fnmsub} %0,%1,%2,%3"
4795 [(set_attr "type" "fp")])
4797 (define_expand "sqrtsf2"
4798 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4799 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
4800 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
4804 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4805 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4806 "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4808 [(set_attr "type" "ssqrt")])
4811 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4812 (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
4813 "TARGET_POWER2 && TARGET_HARD_FLOAT && TARGET_FPRS"
4815 [(set_attr "type" "dsqrt")])
4817 (define_expand "copysignsf3"
4819 (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))
4821 (neg:SF (abs:SF (match_dup 1))))
4822 (set (match_operand:SF 0 "gpc_reg_operand" "")
4823 (if_then_else:SF (ge (match_operand:SF 2 "gpc_reg_operand" "")
4827 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4828 && !HONOR_NANS (SFmode) && !HONOR_SIGNED_ZEROS (SFmode)"
4830 operands[3] = gen_reg_rtx (SFmode);
4831 operands[4] = gen_reg_rtx (SFmode);
4832 operands[5] = CONST0_RTX (SFmode);
4835 (define_expand "copysigndf3"
4837 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))
4839 (neg:DF (abs:DF (match_dup 1))))
4840 (set (match_operand:DF 0 "gpc_reg_operand" "")
4841 (if_then_else:DF (ge (match_operand:DF 2 "gpc_reg_operand" "")
4845 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
4846 && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
4848 operands[3] = gen_reg_rtx (DFmode);
4849 operands[4] = gen_reg_rtx (DFmode);
4850 operands[5] = CONST0_RTX (DFmode);
4853 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
4854 ;; fsel instruction and some auxiliary computations. Then we just have a
4855 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
4857 (define_expand "smaxsf3"
4858 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4859 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4860 (match_operand:SF 2 "gpc_reg_operand" ""))
4863 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4864 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
4866 (define_expand "sminsf3"
4867 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4868 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
4869 (match_operand:SF 2 "gpc_reg_operand" ""))
4872 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4873 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
4876 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4877 (match_operator:SF 3 "min_max_operator"
4878 [(match_operand:SF 1 "gpc_reg_operand" "")
4879 (match_operand:SF 2 "gpc_reg_operand" "")]))]
4880 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
4883 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
4884 operands[1], operands[2]);
4888 (define_expand "movsicc"
4889 [(set (match_operand:SI 0 "gpc_reg_operand" "")
4890 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4891 (match_operand:SI 2 "gpc_reg_operand" "")
4892 (match_operand:SI 3 "gpc_reg_operand" "")))]
4896 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4902 ;; We use the BASE_REGS for the isel input operands because, if rA is
4903 ;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
4904 ;; because we may switch the operands and rB may end up being rA.
4906 ;; We need 2 patterns: an unsigned and a signed pattern. We could
4907 ;; leave out the mode in operand 4 and use one pattern, but reload can
4908 ;; change the mode underneath our feet and then gets confused trying
4909 ;; to reload the value.
4910 (define_insn "isel_signed"
4911 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4913 (match_operator 1 "comparison_operator"
4914 [(match_operand:CC 4 "cc_reg_operand" "y")
4916 (match_operand:SI 2 "gpc_reg_operand" "b")
4917 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4920 { return output_isel (operands); }"
4921 [(set_attr "length" "4")])
4923 (define_insn "isel_unsigned"
4924 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
4926 (match_operator 1 "comparison_operator"
4927 [(match_operand:CCUNS 4 "cc_reg_operand" "y")
4929 (match_operand:SI 2 "gpc_reg_operand" "b")
4930 (match_operand:SI 3 "gpc_reg_operand" "b")))]
4933 { return output_isel (operands); }"
4934 [(set_attr "length" "4")])
4936 (define_expand "movsfcc"
4937 [(set (match_operand:SF 0 "gpc_reg_operand" "")
4938 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4939 (match_operand:SF 2 "gpc_reg_operand" "")
4940 (match_operand:SF 3 "gpc_reg_operand" "")))]
4941 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4944 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
4950 (define_insn "*fselsfsf4"
4951 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4952 (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
4953 (match_operand:SF 4 "zero_fp_constant" "F"))
4954 (match_operand:SF 2 "gpc_reg_operand" "f")
4955 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4956 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4958 [(set_attr "type" "fp")])
4960 (define_insn "*fseldfsf4"
4961 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
4962 (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
4963 (match_operand:DF 4 "zero_fp_constant" "F"))
4964 (match_operand:SF 2 "gpc_reg_operand" "f")
4965 (match_operand:SF 3 "gpc_reg_operand" "f")))]
4966 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
4968 [(set_attr "type" "fp")])
4970 (define_expand "negdf2"
4971 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4972 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4973 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4976 (define_insn "*negdf2_fpr"
4977 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4978 (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4979 "TARGET_HARD_FLOAT && TARGET_FPRS"
4981 [(set_attr "type" "fp")])
4983 (define_expand "absdf2"
4984 [(set (match_operand:DF 0 "gpc_reg_operand" "")
4985 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
4986 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
4989 (define_insn "*absdf2_fpr"
4990 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4991 (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
4992 "TARGET_HARD_FLOAT && TARGET_FPRS"
4994 [(set_attr "type" "fp")])
4996 (define_insn "*nabsdf2_fpr"
4997 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
4998 (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
4999 "TARGET_HARD_FLOAT && TARGET_FPRS"
5001 [(set_attr "type" "fp")])
5003 (define_expand "adddf3"
5004 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5005 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5006 (match_operand:DF 2 "gpc_reg_operand" "")))]
5007 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5010 (define_insn "*adddf3_fpr"
5011 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5012 (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5013 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5014 "TARGET_HARD_FLOAT && TARGET_FPRS"
5015 "{fa|fadd} %0,%1,%2"
5016 [(set_attr "type" "fp")])
5018 (define_expand "subdf3"
5019 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5020 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
5021 (match_operand:DF 2 "gpc_reg_operand" "")))]
5022 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5025 (define_insn "*subdf3_fpr"
5026 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5027 (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5028 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5029 "TARGET_HARD_FLOAT && TARGET_FPRS"
5030 "{fs|fsub} %0,%1,%2"
5031 [(set_attr "type" "fp")])
5033 (define_expand "muldf3"
5034 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5035 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
5036 (match_operand:DF 2 "gpc_reg_operand" "")))]
5037 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5040 (define_insn "*muldf3_fpr"
5041 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5042 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5043 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5044 "TARGET_HARD_FLOAT && TARGET_FPRS"
5045 "{fm|fmul} %0,%1,%2"
5046 [(set_attr "type" "dmul")])
5049 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5050 (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
5051 "TARGET_POPCNTB && flag_finite_math_only"
5053 [(set_attr "type" "fp")])
5055 (define_expand "divdf3"
5056 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5057 (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
5058 (match_operand:DF 2 "gpc_reg_operand" "")))]
5059 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5061 if (swdiv && !optimize_size && TARGET_POPCNTB
5062 && flag_finite_math_only && !flag_trapping_math)
5064 rs6000_emit_swdivdf (operands[0], operands[1], operands[2]);
5069 (define_insn "*divdf3_fpr"
5070 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5071 (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
5072 (match_operand:DF 2 "gpc_reg_operand" "f")))]
5073 "TARGET_HARD_FLOAT && TARGET_FPRS"
5074 "{fd|fdiv} %0,%1,%2"
5075 [(set_attr "type" "ddiv")])
5078 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5079 (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5080 (match_operand:DF 2 "gpc_reg_operand" "f"))
5081 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5082 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5083 "{fma|fmadd} %0,%1,%2,%3"
5084 [(set_attr "type" "dmul")])
5087 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5088 (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5089 (match_operand:DF 2 "gpc_reg_operand" "f"))
5090 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5091 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD"
5092 "{fms|fmsub} %0,%1,%2,%3"
5093 [(set_attr "type" "dmul")])
5096 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5097 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5098 (match_operand:DF 2 "gpc_reg_operand" "f"))
5099 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5100 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5101 && HONOR_SIGNED_ZEROS (DFmode)"
5102 "{fnma|fnmadd} %0,%1,%2,%3"
5103 [(set_attr "type" "dmul")])
5106 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5107 (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
5108 (match_operand:DF 2 "gpc_reg_operand" "f"))
5109 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5110 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5111 && ! HONOR_SIGNED_ZEROS (DFmode)"
5112 "{fnma|fnmadd} %0,%1,%2,%3"
5113 [(set_attr "type" "dmul")])
5116 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5117 (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5118 (match_operand:DF 2 "gpc_reg_operand" "f"))
5119 (match_operand:DF 3 "gpc_reg_operand" "f"))))]
5120 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5121 && HONOR_SIGNED_ZEROS (DFmode)"
5122 "{fnms|fnmsub} %0,%1,%2,%3"
5123 [(set_attr "type" "dmul")])
5126 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5127 (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
5128 (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
5129 (match_operand:DF 2 "gpc_reg_operand" "f"))))]
5130 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD
5131 && ! HONOR_SIGNED_ZEROS (DFmode)"
5132 "{fnms|fnmsub} %0,%1,%2,%3"
5133 [(set_attr "type" "dmul")])
5135 (define_insn "sqrtdf2"
5136 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5137 (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
5138 "(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS"
5140 [(set_attr "type" "dsqrt")])
5142 ;; The conditional move instructions allow us to perform max and min
5143 ;; operations even when
5145 (define_expand "smaxdf3"
5146 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5147 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5148 (match_operand:DF 2 "gpc_reg_operand" ""))
5151 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5152 "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
5154 (define_expand "smindf3"
5155 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5156 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
5157 (match_operand:DF 2 "gpc_reg_operand" ""))
5160 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5161 "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
5164 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5165 (match_operator:DF 3 "min_max_operator"
5166 [(match_operand:DF 1 "gpc_reg_operand" "")
5167 (match_operand:DF 2 "gpc_reg_operand" "")]))]
5168 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && !flag_trapping_math"
5171 { rs6000_emit_minmax (operands[0], GET_CODE (operands[3]),
5172 operands[1], operands[2]);
5176 (define_expand "movdfcc"
5177 [(set (match_operand:DF 0 "gpc_reg_operand" "")
5178 (if_then_else:DF (match_operand 1 "comparison_operator" "")
5179 (match_operand:DF 2 "gpc_reg_operand" "")
5180 (match_operand:DF 3 "gpc_reg_operand" "")))]
5181 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5184 if (rs6000_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
5190 (define_insn "*fseldfdf4"
5191 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5192 (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
5193 (match_operand:DF 4 "zero_fp_constant" "F"))
5194 (match_operand:DF 2 "gpc_reg_operand" "f")
5195 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5196 "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS"
5198 [(set_attr "type" "fp")])
5200 (define_insn "*fselsfdf4"
5201 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5202 (if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
5203 (match_operand:SF 4 "zero_fp_constant" "F"))
5204 (match_operand:DF 2 "gpc_reg_operand" "f")
5205 (match_operand:DF 3 "gpc_reg_operand" "f")))]
5208 [(set_attr "type" "fp")])
5210 ;; Conversions to and from floating-point.
5212 (define_expand "fixuns_truncsfsi2"
5213 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5214 (unsigned_fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5215 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5218 (define_expand "fix_truncsfsi2"
5219 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5220 (fix:SI (match_operand:SF 1 "gpc_reg_operand" "")))]
5221 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5224 ; For each of these conversions, there is a define_expand, a define_insn
5225 ; with a '#' template, and a define_split (with C code). The idea is
5226 ; to allow constant folding with the template of the define_insn,
5227 ; then to have the insns split later (between sched1 and final).
5229 (define_expand "floatsidf2"
5230 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5231 (float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5234 (clobber (match_dup 4))
5235 (clobber (match_dup 5))
5236 (clobber (match_dup 6))])]
5237 "TARGET_HARD_FLOAT && TARGET_FPRS"
5240 if (TARGET_E500_DOUBLE)
5242 emit_insn (gen_spe_floatsidf2 (operands[0], operands[1]));
5245 if (TARGET_POWERPC64)
5247 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5248 rtx t1 = gen_reg_rtx (DImode);
5249 rtx t2 = gen_reg_rtx (DImode);
5250 emit_insn (gen_floatsidf_ppc64 (operands[0], operands[1], mem, t1, t2));
5254 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5255 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503601774854144\", DFmode));
5256 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5257 operands[5] = gen_reg_rtx (DFmode);
5258 operands[6] = gen_reg_rtx (SImode);
5261 (define_insn_and_split "*floatsidf2_internal"
5262 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5263 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5264 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5265 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5266 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5267 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
5268 (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
5269 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5271 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5275 rtx lowword, highword;
5276 gcc_assert (MEM_P (operands[4]));
5277 highword = adjust_address (operands[4], SImode, 0);
5278 lowword = adjust_address (operands[4], SImode, 4);
5279 if (! WORDS_BIG_ENDIAN)
5282 tmp = highword; highword = lowword; lowword = tmp;
5285 emit_insn (gen_xorsi3 (operands[6], operands[1],
5286 GEN_INT (~ (HOST_WIDE_INT) 0x7fffffff)));
5287 emit_move_insn (lowword, operands[6]);
5288 emit_move_insn (highword, operands[2]);
5289 emit_move_insn (operands[5], operands[4]);
5290 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5293 [(set_attr "length" "24")])
5295 (define_expand "floatunssisf2"
5296 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5297 (unsigned_float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5298 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5301 (define_expand "floatunssidf2"
5302 [(parallel [(set (match_operand:DF 0 "gpc_reg_operand" "")
5303 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "")))
5306 (clobber (match_dup 4))
5307 (clobber (match_dup 5))])]
5308 "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5311 if (TARGET_E500_DOUBLE)
5313 emit_insn (gen_spe_floatunssidf2 (operands[0], operands[1]));
5316 if (TARGET_POWERPC64)
5318 rtx mem = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5319 rtx t1 = gen_reg_rtx (DImode);
5320 rtx t2 = gen_reg_rtx (DImode);
5321 emit_insn (gen_floatunssidf_ppc64 (operands[0], operands[1], mem,
5326 operands[2] = force_reg (SImode, GEN_INT (0x43300000));
5327 operands[3] = force_reg (DFmode, CONST_DOUBLE_ATOF (\"4503599627370496\", DFmode));
5328 operands[4] = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
5329 operands[5] = gen_reg_rtx (DFmode);
5332 (define_insn_and_split "*floatunssidf2_internal"
5333 [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
5334 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5335 (use (match_operand:SI 2 "gpc_reg_operand" "r"))
5336 (use (match_operand:DF 3 "gpc_reg_operand" "f"))
5337 (clobber (match_operand:DF 4 "memory_operand" "=o"))
5338 (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
5339 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5341 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[4]))"
5345 rtx lowword, highword;
5346 gcc_assert (MEM_P (operands[4]));
5347 highword = adjust_address (operands[4], SImode, 0);
5348 lowword = adjust_address (operands[4], SImode, 4);
5349 if (! WORDS_BIG_ENDIAN)
5352 tmp = highword; highword = lowword; lowword = tmp;
5355 emit_move_insn (lowword, operands[1]);
5356 emit_move_insn (highword, operands[2]);
5357 emit_move_insn (operands[5], operands[4]);
5358 emit_insn (gen_subdf3 (operands[0], operands[5], operands[3]));
5361 [(set_attr "length" "20")])
5363 (define_expand "fix_truncdfsi2"
5364 [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
5365 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
5366 (clobber (match_dup 2))
5367 (clobber (match_dup 3))])]
5368 "(TARGET_POWER2 || TARGET_POWERPC)
5369 && TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)"
5372 if (TARGET_E500_DOUBLE)
5374 emit_insn (gen_spe_fix_truncdfsi2 (operands[0], operands[1]));
5377 operands[2] = gen_reg_rtx (DImode);
5378 if (TARGET_PPC_GFXOPT)
5380 rtx orig_dest = operands[0];
5381 if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
5382 operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
5383 emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
5385 if (operands[0] != orig_dest)
5386 emit_move_insn (orig_dest, operands[0]);
5389 operands[3] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
5392 (define_insn_and_split "*fix_truncdfsi2_internal"
5393 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5394 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5395 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
5396 (clobber (match_operand:DI 3 "memory_operand" "=o"))]
5397 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5399 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[3]))"
5404 gcc_assert (MEM_P (operands[3]));
5405 lowword = adjust_address (operands[3], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
5407 emit_insn (gen_fctiwz (operands[2], operands[1]));
5408 emit_move_insn (operands[3], operands[2]);
5409 emit_move_insn (operands[0], lowword);
5412 [(set_attr "length" "16")])
5414 (define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
5415 [(set (match_operand:SI 0 "memory_operand" "=Z")
5416 (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
5417 (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
5418 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
5419 && TARGET_PPC_GFXOPT"
5425 emit_insn (gen_fctiwz (operands[2], operands[1]));
5426 emit_insn (gen_stfiwx (operands[0], operands[2]));
5429 [(set_attr "length" "16")])
5431 ; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
5432 ; rather than (set (subreg:SI (reg)) (fix:SI ...))
5433 ; because the first makes it clear that operand 0 is not live
5434 ; before the instruction.
5435 (define_insn "fctiwz"
5436 [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
5437 (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
5439 "(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
5440 "{fcirz|fctiwz} %0,%1"
5441 [(set_attr "type" "fp")])
5443 ; An UNSPEC is used so we don't have to support SImode in FP registers.
5444 (define_insn "stfiwx"
5445 [(set (match_operand:SI 0 "memory_operand" "=Z")
5446 (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
5450 [(set_attr "type" "fpstore")])
5452 (define_expand "floatsisf2"
5453 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5454 (float:SF (match_operand:SI 1 "gpc_reg_operand" "")))]
5455 "TARGET_HARD_FLOAT && !TARGET_FPRS"
5458 (define_insn "floatdidf2"
5459 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5460 (float:DF (match_operand:DI 1 "gpc_reg_operand" "*f")))]
5461 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5463 [(set_attr "type" "fp")])
5465 (define_insn_and_split "floatsidf_ppc64"
5466 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5467 (float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5468 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5469 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5470 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5471 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5474 [(set (match_dup 3) (sign_extend:DI (match_dup 1)))
5475 (set (match_dup 2) (match_dup 3))
5476 (set (match_dup 4) (match_dup 2))
5477 (set (match_dup 0) (float:DF (match_dup 4)))]
5480 (define_insn_and_split "floatunssidf_ppc64"
5481 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
5482 (unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
5483 (clobber (match_operand:DI 2 "memory_operand" "=o"))
5484 (clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
5485 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
5486 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5489 [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
5490 (set (match_dup 2) (match_dup 3))
5491 (set (match_dup 4) (match_dup 2))
5492 (set (match_dup 0) (float:DF (match_dup 4)))]
5495 (define_insn "fix_truncdfdi2"
5496 [(set (match_operand:DI 0 "gpc_reg_operand" "=*f")
5497 (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
5498 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5500 [(set_attr "type" "fp")])
5502 (define_expand "floatdisf2"
5503 [(set (match_operand:SF 0 "gpc_reg_operand" "")
5504 (float:SF (match_operand:DI 1 "gpc_reg_operand" "")))]
5505 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5508 rtx val = operands[1];
5509 if (!flag_unsafe_math_optimizations)
5511 rtx label = gen_label_rtx ();
5512 val = gen_reg_rtx (DImode);
5513 emit_insn (gen_floatdisf2_internal2 (val, operands[1], label));
5516 emit_insn (gen_floatdisf2_internal1 (operands[0], val));
5520 ;; This is not IEEE compliant if rounding mode is "round to nearest".
5521 ;; If the DI->DF conversion is inexact, then it's possible to suffer
5522 ;; from double rounding.
5523 (define_insn_and_split "floatdisf2_internal1"
5524 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
5525 (float:SF (match_operand:DI 1 "gpc_reg_operand" "*f")))
5526 (clobber (match_scratch:DF 2 "=f"))]
5527 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5529 "&& reload_completed"
5531 (float:DF (match_dup 1)))
5533 (float_truncate:SF (match_dup 2)))]
5536 ;; Twiddles bits to avoid double rounding.
5537 ;; Bits that might be truncated when converting to DFmode are replaced
5538 ;; by a bit that won't be lost at that stage, but is below the SFmode
5539 ;; rounding position.
5540 (define_expand "floatdisf2_internal2"
5541 [(set (match_dup 3) (ashiftrt:DI (match_operand:DI 1 "" "")
5543 (parallel [(set (match_operand:DI 0 "" "") (and:DI (match_dup 1)
5545 (clobber (scratch:CC))])
5546 (set (match_dup 3) (plus:DI (match_dup 3)
5548 (set (match_dup 0) (plus:DI (match_dup 0)
5550 (set (match_dup 4) (compare:CCUNS (match_dup 3)
5552 (set (match_dup 0) (ior:DI (match_dup 0)
5554 (parallel [(set (match_dup 0) (and:DI (match_dup 0)
5556 (clobber (scratch:CC))])
5557 (set (pc) (if_then_else (geu (match_dup 4) (const_int 0))
5558 (label_ref (match_operand:DI 2 "" ""))
5560 (set (match_dup 0) (match_dup 1))]
5561 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
5564 operands[3] = gen_reg_rtx (DImode);
5565 operands[4] = gen_reg_rtx (CCUNSmode);
5568 ;; Define the DImode operations that can be done in a small number
5569 ;; of instructions. The & constraints are to prevent the register
5570 ;; allocator from allocating registers that overlap with the inputs
5571 ;; (for example, having an input in 7,8 and an output in 6,7). We
5572 ;; also allow for the output being the same as one of the inputs.
5574 (define_insn "*adddi3_noppc64"
5575 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r")
5576 (plus:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,0,0")
5577 (match_operand:DI 2 "reg_or_short_operand" "r,I,r,I")))]
5578 "! TARGET_POWERPC64"
5581 if (WORDS_BIG_ENDIAN)
5582 return (GET_CODE (operands[2])) != CONST_INT
5583 ? \"{a|addc} %L0,%L1,%L2\;{ae|adde} %0,%1,%2\"
5584 : \"{ai|addic} %L0,%L1,%2\;{a%G2e|add%G2e} %0,%1\";
5586 return (GET_CODE (operands[2])) != CONST_INT
5587 ? \"{a|addc} %0,%1,%2\;{ae|adde} %L0,%L1,%L2\"
5588 : \"{ai|addic} %0,%1,%2\;{a%G2e|add%G2e} %L0,%L1\";
5590 [(set_attr "type" "two")
5591 (set_attr "length" "8")])
5593 (define_insn "*subdi3_noppc64"
5594 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,r,r,r")
5595 (minus:DI (match_operand:DI 1 "reg_or_short_operand" "r,I,0,r,I")
5596 (match_operand:DI 2 "gpc_reg_operand" "r,r,r,0,0")))]
5597 "! TARGET_POWERPC64"
5600 if (WORDS_BIG_ENDIAN)
5601 return (GET_CODE (operands[1]) != CONST_INT)
5602 ? \"{sf|subfc} %L0,%L2,%L1\;{sfe|subfe} %0,%2,%1\"
5603 : \"{sfi|subfic} %L0,%L2,%1\;{sf%G1e|subf%G1e} %0,%2\";
5605 return (GET_CODE (operands[1]) != CONST_INT)
5606 ? \"{sf|subfc} %0,%2,%1\;{sfe|subfe} %L0,%L2,%L1\"
5607 : \"{sfi|subfic} %0,%2,%1\;{sf%G1e|subf%G1e} %L0,%L2\";
5609 [(set_attr "type" "two")
5610 (set_attr "length" "8")])
5612 (define_insn "*negdi2_noppc64"
5613 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5614 (neg:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))]
5615 "! TARGET_POWERPC64"
5618 return (WORDS_BIG_ENDIAN)
5619 ? \"{sfi|subfic} %L0,%L1,0\;{sfze|subfze} %0,%1\"
5620 : \"{sfi|subfic} %0,%1,0\;{sfze|subfze} %L0,%L1\";
5622 [(set_attr "type" "two")
5623 (set_attr "length" "8")])
5625 (define_expand "mulsidi3"
5626 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5627 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5628 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5629 "! TARGET_POWERPC64"
5632 if (! TARGET_POWER && ! TARGET_POWERPC)
5634 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5635 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5636 emit_insn (gen_mull_call ());
5637 if (WORDS_BIG_ENDIAN)
5638 emit_move_insn (operands[0], gen_rtx_REG (DImode, 3));
5641 emit_move_insn (operand_subword (operands[0], 0, 0, DImode),
5642 gen_rtx_REG (SImode, 3));
5643 emit_move_insn (operand_subword (operands[0], 1, 0, DImode),
5644 gen_rtx_REG (SImode, 4));
5648 else if (TARGET_POWER)
5650 emit_insn (gen_mulsidi3_mq (operands[0], operands[1], operands[2]));
5655 (define_insn "mulsidi3_mq"
5656 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5657 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5658 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5659 (clobber (match_scratch:SI 3 "=q"))]
5661 "mul %0,%1,%2\;mfmq %L0"
5662 [(set_attr "type" "imul")
5663 (set_attr "length" "8")])
5665 (define_insn "*mulsidi3_no_mq"
5666 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5667 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5668 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5669 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5672 return (WORDS_BIG_ENDIAN)
5673 ? \"mulhw %0,%1,%2\;mullw %L0,%1,%2\"
5674 : \"mulhw %L0,%1,%2\;mullw %0,%1,%2\";
5676 [(set_attr "type" "imul")
5677 (set_attr "length" "8")])
5680 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5681 (mult:DI (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5682 (sign_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5683 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5686 (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
5687 (sign_extend:DI (match_dup 2)))
5690 (mult:SI (match_dup 1)
5694 int endian = (WORDS_BIG_ENDIAN == 0);
5695 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5696 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5699 (define_expand "umulsidi3"
5700 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5701 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5702 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5703 "TARGET_POWERPC && ! TARGET_POWERPC64"
5708 emit_insn (gen_umulsidi3_mq (operands[0], operands[1], operands[2]));
5713 (define_insn "umulsidi3_mq"
5714 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5715 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5716 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))
5717 (clobber (match_scratch:SI 3 "=q"))]
5718 "TARGET_POWERPC && TARGET_POWER"
5721 return (WORDS_BIG_ENDIAN)
5722 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5723 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5725 [(set_attr "type" "imul")
5726 (set_attr "length" "8")])
5728 (define_insn "*umulsidi3_no_mq"
5729 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
5730 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" "%r"))
5731 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" "r"))))]
5732 "TARGET_POWERPC && ! TARGET_POWER && ! TARGET_POWERPC64"
5735 return (WORDS_BIG_ENDIAN)
5736 ? \"mulhwu %0,%1,%2\;mullw %L0,%1,%2\"
5737 : \"mulhwu %L0,%1,%2\;mullw %0,%1,%2\";
5739 [(set_attr "type" "imul")
5740 (set_attr "length" "8")])
5743 [(set (match_operand:DI 0 "gpc_reg_operand" "")
5744 (mult:DI (zero_extend:DI (match_operand:SI 1 "gpc_reg_operand" ""))
5745 (zero_extend:DI (match_operand:SI 2 "gpc_reg_operand" ""))))]
5746 "TARGET_POWERPC && ! TARGET_POWERPC64 && reload_completed"
5749 (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
5750 (zero_extend:DI (match_dup 2)))
5753 (mult:SI (match_dup 1)
5757 int endian = (WORDS_BIG_ENDIAN == 0);
5758 operands[3] = operand_subword (operands[0], endian, 0, DImode);
5759 operands[4] = operand_subword (operands[0], 1 - endian, 0, DImode);
5762 (define_expand "smulsi3_highpart"
5763 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5765 (lshiftrt:DI (mult:DI (sign_extend:DI
5766 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5768 (match_operand:SI 2 "gpc_reg_operand" "r")))
5773 if (! TARGET_POWER && ! TARGET_POWERPC)
5775 emit_move_insn (gen_rtx_REG (SImode, 3), operands[1]);
5776 emit_move_insn (gen_rtx_REG (SImode, 4), operands[2]);
5777 emit_insn (gen_mulh_call ());
5778 emit_move_insn (operands[0], gen_rtx_REG (SImode, 3));
5781 else if (TARGET_POWER)
5783 emit_insn (gen_smulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5788 (define_insn "smulsi3_highpart_mq"
5789 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5791 (lshiftrt:DI (mult:DI (sign_extend:DI
5792 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5794 (match_operand:SI 2 "gpc_reg_operand" "r")))
5796 (clobber (match_scratch:SI 3 "=q"))]
5799 [(set_attr "type" "imul")])
5801 (define_insn "*smulsi3_highpart_no_mq"
5802 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5804 (lshiftrt:DI (mult:DI (sign_extend:DI
5805 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5807 (match_operand:SI 2 "gpc_reg_operand" "r")))
5809 "TARGET_POWERPC && ! TARGET_POWER"
5811 [(set_attr "type" "imul")])
5813 (define_expand "umulsi3_highpart"
5814 [(set (match_operand:SI 0 "gpc_reg_operand" "")
5816 (lshiftrt:DI (mult:DI (zero_extend:DI
5817 (match_operand:SI 1 "gpc_reg_operand" ""))
5819 (match_operand:SI 2 "gpc_reg_operand" "")))
5826 emit_insn (gen_umulsi3_highpart_mq (operands[0], operands[1], operands[2]));
5831 (define_insn "umulsi3_highpart_mq"
5832 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5834 (lshiftrt:DI (mult:DI (zero_extend:DI
5835 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5837 (match_operand:SI 2 "gpc_reg_operand" "r")))
5839 (clobber (match_scratch:SI 3 "=q"))]
5840 "TARGET_POWERPC && TARGET_POWER"
5842 [(set_attr "type" "imul")])
5844 (define_insn "*umulsi3_highpart_no_mq"
5845 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5847 (lshiftrt:DI (mult:DI (zero_extend:DI
5848 (match_operand:SI 1 "gpc_reg_operand" "%r"))
5850 (match_operand:SI 2 "gpc_reg_operand" "r")))
5852 "TARGET_POWERPC && ! TARGET_POWER"
5854 [(set_attr "type" "imul")])
5856 ;; If operands 0 and 2 are in the same register, we have a problem. But
5857 ;; operands 0 and 1 (the usual case) can be in the same register. That's
5858 ;; why we have the strange constraints below.
5859 (define_insn "ashldi3_power"
5860 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5861 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5862 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5863 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5866 {sli|slwi} %0,%L1,%h2\;{cal %L0,0(0)|li %L0,0}
5867 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5868 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2
5869 sl%I2q %L0,%L1,%h2\;sll%I2q %0,%1,%h2"
5870 [(set_attr "length" "8")])
5872 (define_insn "lshrdi3_power"
5873 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,&r")
5874 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,0,r")
5875 (match_operand:SI 2 "reg_or_cint_operand" "M,i,r,r")))
5876 (clobber (match_scratch:SI 3 "=X,q,q,q"))]
5879 {s%A2i|s%A2wi} %L0,%1,%h2\;{cal %0,0(0)|li %0,0}
5880 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5881 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2
5882 sr%I2q %0,%1,%h2\;srl%I2q %L0,%L1,%h2"
5883 [(set_attr "length" "8")])
5885 ;; Shift by a variable amount is too complex to be worth open-coding. We
5886 ;; just handle shifts by constants.
5887 (define_insn "ashrdi3_power"
5888 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5889 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5890 (match_operand:SI 2 "const_int_operand" "M,i")))
5891 (clobber (match_scratch:SI 3 "=X,q"))]
5894 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5895 sraiq %0,%1,%h2\;srliq %L0,%L1,%h2"
5896 [(set_attr "length" "8")])
5898 (define_insn "ashrdi3_no_power"
5899 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
5900 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
5901 (match_operand:SI 2 "const_int_operand" "M,i")))]
5902 "TARGET_32BIT && !TARGET_POWERPC64 && !TARGET_POWER && WORDS_BIG_ENDIAN"
5904 {srai|srawi} %0,%1,31\;{srai|srawi} %L0,%1,%h2
5905 {sri|srwi} %L0,%L1,%h2\;insrwi %L0,%1,%h2,0\;{srai|srawi} %0,%1,%h2"
5906 [(set_attr "type" "two,three")
5907 (set_attr "length" "8,12")])
5909 (define_insn "*ashrdisi3_noppc64"
5910 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
5911 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
5912 (const_int 32)) 4))]
5913 "TARGET_32BIT && !TARGET_POWERPC64"
5916 if (REGNO (operands[0]) == REGNO (operands[1]))
5919 return \"mr %0,%1\";
5921 [(set_attr "length" "4")])
5924 ;; PowerPC64 DImode operations.
5926 (define_insn_and_split "absdi2"
5927 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5928 (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0")))
5929 (clobber (match_scratch:DI 2 "=&r,&r"))]
5932 "&& reload_completed"
5933 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5934 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5935 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
5938 (define_insn_and_split "*nabsdi2"
5939 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
5940 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,0"))))
5941 (clobber (match_scratch:DI 2 "=&r,&r"))]
5944 "&& reload_completed"
5945 [(set (match_dup 2) (ashiftrt:DI (match_dup 1) (const_int 63)))
5946 (set (match_dup 0) (xor:DI (match_dup 2) (match_dup 1)))
5947 (set (match_dup 0) (minus:DI (match_dup 2) (match_dup 0)))]
5950 (define_insn "muldi3"
5951 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
5952 (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r")
5953 (match_operand:DI 2 "gpc_reg_operand" "r")))]
5956 [(set_attr "type" "lmul")])
5958 (define_insn "*muldi3_internal1"
5959 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
5960 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
5961 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5963 (clobber (match_scratch:DI 3 "=r,r"))]
5968 [(set_attr "type" "lmul_compare")
5969 (set_attr "length" "4,8")])
5972 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
5973 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
5974 (match_operand:DI 2 "gpc_reg_operand" ""))
5976 (clobber (match_scratch:DI 3 ""))]
5977 "TARGET_POWERPC64 && reload_completed"
5979 (mult:DI (match_dup 1) (match_dup 2)))
5981 (compare:CC (match_dup 3)
5985 (define_insn "*muldi3_internal2"
5986 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
5987 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r")
5988 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
5990 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
5991 (mult:DI (match_dup 1) (match_dup 2)))]
5996 [(set_attr "type" "lmul_compare")
5997 (set_attr "length" "4,8")])
6000 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6001 (compare:CC (mult:DI (match_operand:DI 1 "gpc_reg_operand" "")
6002 (match_operand:DI 2 "gpc_reg_operand" ""))
6004 (set (match_operand:DI 0 "gpc_reg_operand" "")
6005 (mult:DI (match_dup 1) (match_dup 2)))]
6006 "TARGET_POWERPC64 && reload_completed"
6008 (mult:DI (match_dup 1) (match_dup 2)))
6010 (compare:CC (match_dup 0)
6014 (define_insn "smuldi3_highpart"
6015 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6017 (lshiftrt:TI (mult:TI (sign_extend:TI
6018 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6020 (match_operand:DI 2 "gpc_reg_operand" "r")))
6024 [(set_attr "type" "lmul")])
6026 (define_insn "umuldi3_highpart"
6027 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6029 (lshiftrt:TI (mult:TI (zero_extend:TI
6030 (match_operand:DI 1 "gpc_reg_operand" "%r"))
6032 (match_operand:DI 2 "gpc_reg_operand" "r")))
6036 [(set_attr "type" "lmul")])
6038 (define_insn "rotldi3"
6039 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6040 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6041 (match_operand:DI 2 "reg_or_cint_operand" "ri")))]
6043 "rld%I2cl %0,%1,%H2,0")
6045 (define_insn "*rotldi3_internal2"
6046 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6047 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6048 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6050 (clobber (match_scratch:DI 3 "=r,r"))]
6053 rld%I2cl. %3,%1,%H2,0
6055 [(set_attr "type" "delayed_compare")
6056 (set_attr "length" "4,8")])
6059 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6060 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6061 (match_operand:DI 2 "reg_or_cint_operand" ""))
6063 (clobber (match_scratch:DI 3 ""))]
6064 "TARGET_POWERPC64 && reload_completed"
6066 (rotate:DI (match_dup 1) (match_dup 2)))
6068 (compare:CC (match_dup 3)
6072 (define_insn "*rotldi3_internal3"
6073 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6074 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6075 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6077 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6078 (rotate:DI (match_dup 1) (match_dup 2)))]
6081 rld%I2cl. %0,%1,%H2,0
6083 [(set_attr "type" "delayed_compare")
6084 (set_attr "length" "4,8")])
6087 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6088 (compare:CC (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6089 (match_operand:DI 2 "reg_or_cint_operand" ""))
6091 (set (match_operand:DI 0 "gpc_reg_operand" "")
6092 (rotate:DI (match_dup 1) (match_dup 2)))]
6093 "TARGET_POWERPC64 && reload_completed"
6095 (rotate:DI (match_dup 1) (match_dup 2)))
6097 (compare:CC (match_dup 0)
6101 (define_insn "*rotldi3_internal4"
6102 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6103 (and:DI (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6104 (match_operand:DI 2 "reg_or_cint_operand" "ri"))
6105 (match_operand:DI 3 "mask_operand" "n")))]
6107 "rld%I2c%B3 %0,%1,%H2,%S3")
6109 (define_insn "*rotldi3_internal5"
6110 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6112 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6113 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6114 (match_operand:DI 3 "mask_operand" "n,n"))
6116 (clobber (match_scratch:DI 4 "=r,r"))]
6119 rld%I2c%B3. %4,%1,%H2,%S3
6121 [(set_attr "type" "delayed_compare")
6122 (set_attr "length" "4,8")])
6125 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6127 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6128 (match_operand:DI 2 "reg_or_cint_operand" ""))
6129 (match_operand:DI 3 "mask_operand" ""))
6131 (clobber (match_scratch:DI 4 ""))]
6132 "TARGET_POWERPC64 && reload_completed"
6134 (and:DI (rotate:DI (match_dup 1)
6138 (compare:CC (match_dup 4)
6142 (define_insn "*rotldi3_internal6"
6143 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6145 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6146 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri"))
6147 (match_operand:DI 3 "mask_operand" "n,n"))
6149 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6150 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6153 rld%I2c%B3. %0,%1,%H2,%S3
6155 [(set_attr "type" "delayed_compare")
6156 (set_attr "length" "4,8")])
6159 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6161 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6162 (match_operand:DI 2 "reg_or_cint_operand" ""))
6163 (match_operand:DI 3 "mask_operand" ""))
6165 (set (match_operand:DI 0 "gpc_reg_operand" "")
6166 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6167 "TARGET_POWERPC64 && reload_completed"
6169 (and:DI (rotate:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
6171 (compare:CC (match_dup 0)
6175 (define_insn "*rotldi3_internal7"
6176 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6179 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6180 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6182 "rld%I2cl %0,%1,%H2,56")
6184 (define_insn "*rotldi3_internal8"
6185 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6186 (compare:CC (zero_extend:DI
6188 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6189 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6191 (clobber (match_scratch:DI 3 "=r,r"))]
6194 rld%I2cl. %3,%1,%H2,56
6196 [(set_attr "type" "delayed_compare")
6197 (set_attr "length" "4,8")])
6200 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6201 (compare:CC (zero_extend:DI
6203 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6204 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6206 (clobber (match_scratch:DI 3 ""))]
6207 "TARGET_POWERPC64 && reload_completed"
6209 (zero_extend:DI (subreg:QI
6210 (rotate:DI (match_dup 1)
6213 (compare:CC (match_dup 3)
6217 (define_insn "*rotldi3_internal9"
6218 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6219 (compare:CC (zero_extend:DI
6221 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6222 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6224 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6225 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6228 rld%I2cl. %0,%1,%H2,56
6230 [(set_attr "type" "delayed_compare")
6231 (set_attr "length" "4,8")])
6234 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6235 (compare:CC (zero_extend:DI
6237 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6238 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6240 (set (match_operand:DI 0 "gpc_reg_operand" "")
6241 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6242 "TARGET_POWERPC64 && reload_completed"
6244 (zero_extend:DI (subreg:QI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6246 (compare:CC (match_dup 0)
6250 (define_insn "*rotldi3_internal10"
6251 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6254 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6255 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6257 "rld%I2cl %0,%1,%H2,48")
6259 (define_insn "*rotldi3_internal11"
6260 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6261 (compare:CC (zero_extend:DI
6263 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6264 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6266 (clobber (match_scratch:DI 3 "=r,r"))]
6269 rld%I2cl. %3,%1,%H2,48
6271 [(set_attr "type" "delayed_compare")
6272 (set_attr "length" "4,8")])
6275 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6276 (compare:CC (zero_extend:DI
6278 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6279 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6281 (clobber (match_scratch:DI 3 ""))]
6282 "TARGET_POWERPC64 && reload_completed"
6284 (zero_extend:DI (subreg:HI
6285 (rotate:DI (match_dup 1)
6288 (compare:CC (match_dup 3)
6292 (define_insn "*rotldi3_internal12"
6293 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6294 (compare:CC (zero_extend:DI
6296 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6297 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6299 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6300 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6303 rld%I2cl. %0,%1,%H2,48
6305 [(set_attr "type" "delayed_compare")
6306 (set_attr "length" "4,8")])
6309 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6310 (compare:CC (zero_extend:DI
6312 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6313 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6315 (set (match_operand:DI 0 "gpc_reg_operand" "")
6316 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6317 "TARGET_POWERPC64 && reload_completed"
6319 (zero_extend:DI (subreg:HI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6321 (compare:CC (match_dup 0)
6325 (define_insn "*rotldi3_internal13"
6326 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6329 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6330 (match_operand:DI 2 "reg_or_cint_operand" "ri")) 0)))]
6332 "rld%I2cl %0,%1,%H2,32")
6334 (define_insn "*rotldi3_internal14"
6335 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6336 (compare:CC (zero_extend:DI
6338 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6339 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6341 (clobber (match_scratch:DI 3 "=r,r"))]
6344 rld%I2cl. %3,%1,%H2,32
6346 [(set_attr "type" "delayed_compare")
6347 (set_attr "length" "4,8")])
6350 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6351 (compare:CC (zero_extend:DI
6353 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6354 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6356 (clobber (match_scratch:DI 3 ""))]
6357 "TARGET_POWERPC64 && reload_completed"
6359 (zero_extend:DI (subreg:SI
6360 (rotate:DI (match_dup 1)
6363 (compare:CC (match_dup 3)
6367 (define_insn "*rotldi3_internal15"
6368 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6369 (compare:CC (zero_extend:DI
6371 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6372 (match_operand:DI 2 "reg_or_cint_operand" "ri,ri")) 0))
6374 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6375 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6378 rld%I2cl. %0,%1,%H2,32
6380 [(set_attr "type" "delayed_compare")
6381 (set_attr "length" "4,8")])
6384 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6385 (compare:CC (zero_extend:DI
6387 (rotate:DI (match_operand:DI 1 "gpc_reg_operand" "")
6388 (match_operand:DI 2 "reg_or_cint_operand" "")) 0))
6390 (set (match_operand:DI 0 "gpc_reg_operand" "")
6391 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))]
6392 "TARGET_POWERPC64 && reload_completed"
6394 (zero_extend:DI (subreg:SI (rotate:DI (match_dup 1) (match_dup 2)) 0)))
6396 (compare:CC (match_dup 0)
6400 (define_expand "ashldi3"
6401 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6402 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6403 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6404 "TARGET_POWERPC64 || TARGET_POWER"
6407 if (TARGET_POWERPC64)
6409 else if (TARGET_POWER)
6411 emit_insn (gen_ashldi3_power (operands[0], operands[1], operands[2]));
6418 (define_insn "*ashldi3_internal1"
6419 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6420 (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6421 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6425 (define_insn "*ashldi3_internal2"
6426 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6427 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6428 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6430 (clobber (match_scratch:DI 3 "=r,r"))]
6435 [(set_attr "type" "delayed_compare")
6436 (set_attr "length" "4,8")])
6439 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6440 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6441 (match_operand:SI 2 "reg_or_cint_operand" ""))
6443 (clobber (match_scratch:DI 3 ""))]
6444 "TARGET_POWERPC64 && reload_completed"
6446 (ashift:DI (match_dup 1) (match_dup 2)))
6448 (compare:CC (match_dup 3)
6452 (define_insn "*ashldi3_internal3"
6453 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6454 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6455 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6457 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6458 (ashift:DI (match_dup 1) (match_dup 2)))]
6463 [(set_attr "type" "delayed_compare")
6464 (set_attr "length" "4,8")])
6467 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6468 (compare:CC (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6469 (match_operand:SI 2 "reg_or_cint_operand" ""))
6471 (set (match_operand:DI 0 "gpc_reg_operand" "")
6472 (ashift:DI (match_dup 1) (match_dup 2)))]
6473 "TARGET_POWERPC64 && reload_completed"
6475 (ashift:DI (match_dup 1) (match_dup 2)))
6477 (compare:CC (match_dup 0)
6481 (define_insn "*ashldi3_internal4"
6482 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6483 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6484 (match_operand:SI 2 "const_int_operand" "i"))
6485 (match_operand:DI 3 "const_int_operand" "n")))]
6486 "TARGET_POWERPC64 && includes_rldic_lshift_p (operands[2], operands[3])"
6487 "rldic %0,%1,%H2,%W3")
6489 (define_insn "ashldi3_internal5"
6490 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6492 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6493 (match_operand:SI 2 "const_int_operand" "i,i"))
6494 (match_operand:DI 3 "const_int_operand" "n,n"))
6496 (clobber (match_scratch:DI 4 "=r,r"))]
6497 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6499 rldic. %4,%1,%H2,%W3
6501 [(set_attr "type" "delayed_compare")
6502 (set_attr "length" "4,8")])
6505 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6507 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6508 (match_operand:SI 2 "const_int_operand" ""))
6509 (match_operand:DI 3 "const_int_operand" ""))
6511 (clobber (match_scratch:DI 4 ""))]
6512 "TARGET_POWERPC64 && reload_completed
6513 && includes_rldic_lshift_p (operands[2], operands[3])"
6515 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6518 (compare:CC (match_dup 4)
6522 (define_insn "*ashldi3_internal6"
6523 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6525 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6526 (match_operand:SI 2 "const_int_operand" "i,i"))
6527 (match_operand:DI 3 "const_int_operand" "n,n"))
6529 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6530 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6531 "TARGET_64BIT && includes_rldic_lshift_p (operands[2], operands[3])"
6533 rldic. %0,%1,%H2,%W3
6535 [(set_attr "type" "delayed_compare")
6536 (set_attr "length" "4,8")])
6539 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6541 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6542 (match_operand:SI 2 "const_int_operand" ""))
6543 (match_operand:DI 3 "const_int_operand" ""))
6545 (set (match_operand:DI 0 "gpc_reg_operand" "")
6546 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6547 "TARGET_POWERPC64 && reload_completed
6548 && includes_rldic_lshift_p (operands[2], operands[3])"
6550 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6553 (compare:CC (match_dup 0)
6557 (define_insn "*ashldi3_internal7"
6558 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6559 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6560 (match_operand:SI 2 "const_int_operand" "i"))
6561 (match_operand:DI 3 "mask_operand" "n")))]
6562 "TARGET_POWERPC64 && includes_rldicr_lshift_p (operands[2], operands[3])"
6563 "rldicr %0,%1,%H2,%S3")
6565 (define_insn "ashldi3_internal8"
6566 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6568 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6569 (match_operand:SI 2 "const_int_operand" "i,i"))
6570 (match_operand:DI 3 "mask_operand" "n,n"))
6572 (clobber (match_scratch:DI 4 "=r,r"))]
6573 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6575 rldicr. %4,%1,%H2,%S3
6577 [(set_attr "type" "delayed_compare")
6578 (set_attr "length" "4,8")])
6581 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6583 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6584 (match_operand:SI 2 "const_int_operand" ""))
6585 (match_operand:DI 3 "mask_operand" ""))
6587 (clobber (match_scratch:DI 4 ""))]
6588 "TARGET_POWERPC64 && reload_completed
6589 && includes_rldicr_lshift_p (operands[2], operands[3])"
6591 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6594 (compare:CC (match_dup 4)
6598 (define_insn "*ashldi3_internal9"
6599 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
6601 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6602 (match_operand:SI 2 "const_int_operand" "i,i"))
6603 (match_operand:DI 3 "mask_operand" "n,n"))
6605 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6606 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6607 "TARGET_64BIT && includes_rldicr_lshift_p (operands[2], operands[3])"
6609 rldicr. %0,%1,%H2,%S3
6611 [(set_attr "type" "delayed_compare")
6612 (set_attr "length" "4,8")])
6615 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
6617 (and:DI (ashift:DI (match_operand:DI 1 "gpc_reg_operand" "")
6618 (match_operand:SI 2 "const_int_operand" ""))
6619 (match_operand:DI 3 "mask_operand" ""))
6621 (set (match_operand:DI 0 "gpc_reg_operand" "")
6622 (and:DI (ashift:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
6623 "TARGET_POWERPC64 && reload_completed
6624 && includes_rldicr_lshift_p (operands[2], operands[3])"
6626 (and:DI (ashift:DI (match_dup 1) (match_dup 2))
6629 (compare:CC (match_dup 0)
6633 (define_expand "lshrdi3"
6634 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6635 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6636 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6637 "TARGET_POWERPC64 || TARGET_POWER"
6640 if (TARGET_POWERPC64)
6642 else if (TARGET_POWER)
6644 emit_insn (gen_lshrdi3_power (operands[0], operands[1], operands[2]));
6651 (define_insn "*lshrdi3_internal1"
6652 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6653 (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6654 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6658 (define_insn "*lshrdi3_internal2"
6659 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6660 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6661 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6663 (clobber (match_scratch:DI 3 "=r,r"))]
6668 [(set_attr "type" "delayed_compare")
6669 (set_attr "length" "4,8")])
6672 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6673 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6674 (match_operand:SI 2 "reg_or_cint_operand" ""))
6676 (clobber (match_scratch:DI 3 ""))]
6677 "TARGET_POWERPC64 && reload_completed"
6679 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6681 (compare:CC (match_dup 3)
6685 (define_insn "*lshrdi3_internal3"
6686 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6687 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6688 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6690 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6691 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6696 [(set_attr "type" "delayed_compare")
6697 (set_attr "length" "4,8")])
6700 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6701 (compare:CC (lshiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6702 (match_operand:SI 2 "reg_or_cint_operand" ""))
6704 (set (match_operand:DI 0 "gpc_reg_operand" "")
6705 (lshiftrt:DI (match_dup 1) (match_dup 2)))]
6706 "TARGET_POWERPC64 && reload_completed"
6708 (lshiftrt:DI (match_dup 1) (match_dup 2)))
6710 (compare:CC (match_dup 0)
6714 (define_expand "ashrdi3"
6715 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6716 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6717 (match_operand:SI 2 "reg_or_cint_operand" "")))]
6721 if (TARGET_POWERPC64)
6723 else if (TARGET_POWER && GET_CODE (operands[2]) == CONST_INT)
6725 emit_insn (gen_ashrdi3_power (operands[0], operands[1], operands[2]));
6728 else if (TARGET_32BIT && GET_CODE (operands[2]) == CONST_INT
6729 && WORDS_BIG_ENDIAN)
6731 emit_insn (gen_ashrdi3_no_power (operands[0], operands[1], operands[2]));
6738 (define_insn "*ashrdi3_internal1"
6739 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
6740 (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
6741 (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
6743 "srad%I2 %0,%1,%H2")
6745 (define_insn "*ashrdi3_internal2"
6746 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
6747 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6748 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6750 (clobber (match_scratch:DI 3 "=r,r"))]
6755 [(set_attr "type" "delayed_compare")
6756 (set_attr "length" "4,8")])
6759 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
6760 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6761 (match_operand:SI 2 "reg_or_cint_operand" ""))
6763 (clobber (match_scratch:DI 3 ""))]
6764 "TARGET_POWERPC64 && reload_completed"
6766 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6768 (compare:CC (match_dup 3)
6772 (define_insn "*ashrdi3_internal3"
6773 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
6774 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
6775 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
6777 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
6778 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6783 [(set_attr "type" "delayed_compare")
6784 (set_attr "length" "4,8")])
6787 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6788 (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "")
6789 (match_operand:SI 2 "reg_or_cint_operand" ""))
6791 (set (match_operand:DI 0 "gpc_reg_operand" "")
6792 (ashiftrt:DI (match_dup 1) (match_dup 2)))]
6793 "TARGET_POWERPC64 && reload_completed"
6795 (ashiftrt:DI (match_dup 1) (match_dup 2)))
6797 (compare:CC (match_dup 0)
6801 (define_insn "anddi3"
6802 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
6803 (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r")
6804 (match_operand:DI 2 "and64_2_operand" "?r,S,T,K,J,t")))
6805 (clobber (match_scratch:CC 3 "=X,X,X,x,x,X"))]
6809 rldic%B2 %0,%1,0,%S2
6810 rlwinm %0,%1,0,%m2,%M2
6814 [(set_attr "type" "*,*,*,compare,compare,*")
6815 (set_attr "length" "4,4,4,4,4,8")])
6818 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6819 (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6820 (match_operand:DI 2 "mask64_2_operand" "")))
6821 (clobber (match_scratch:CC 3 ""))]
6823 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6824 && !mask_operand (operands[2], DImode)"
6826 (and:DI (rotate:DI (match_dup 1)
6830 (and:DI (rotate:DI (match_dup 0)
6834 build_mask64_2_operands (operands[2], &operands[4]);
6837 (define_insn "*anddi3_internal2"
6838 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
6839 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
6840 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
6842 (clobber (match_scratch:DI 3 "=r,r,r,r,r,r,r,r,r,r"))
6843 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
6847 rldic%B2. %3,%1,0,%S2
6856 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
6857 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
6860 [(set (match_operand:CC 0 "cc_reg_operand" "")
6861 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6862 (match_operand:DI 2 "mask64_2_operand" ""))
6864 (clobber (match_scratch:DI 3 ""))
6865 (clobber (match_scratch:CC 4 ""))]
6866 "TARGET_POWERPC64 && reload_completed
6867 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6868 && !mask_operand (operands[2], DImode)"
6870 (and:DI (rotate:DI (match_dup 1)
6873 (parallel [(set (match_dup 0)
6874 (compare:CC (and:DI (rotate:DI (match_dup 3)
6878 (clobber (match_dup 3))])]
6881 build_mask64_2_operands (operands[2], &operands[5]);
6884 (define_insn "*anddi3_internal3"
6885 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,x,x,x,?y,?y,??y,??y,?y")
6886 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
6887 (match_operand:DI 2 "and64_2_operand" "r,S,K,J,t,r,S,K,J,t"))
6889 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
6890 (and:DI (match_dup 1) (match_dup 2)))
6891 (clobber (match_scratch:CC 4 "=X,X,X,X,X,X,X,x,x,X"))]
6895 rldic%B2. %0,%1,0,%S2
6904 [(set_attr "type" "compare,delayed_compare,compare,compare,delayed_compare,compare,compare,compare,compare,compare")
6905 (set_attr "length" "4,4,4,4,8,8,8,8,8,12")])
6908 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
6909 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6910 (match_operand:DI 2 "and_operand" ""))
6912 (set (match_operand:DI 0 "gpc_reg_operand" "")
6913 (and:DI (match_dup 1) (match_dup 2)))
6914 (clobber (match_scratch:CC 4 ""))]
6915 "TARGET_POWERPC64 && reload_completed"
6916 [(parallel [(set (match_dup 0)
6917 (and:DI (match_dup 1) (match_dup 2)))
6918 (clobber (match_dup 4))])
6920 (compare:CC (match_dup 0)
6925 [(set (match_operand:CC 3 "cc_reg_operand" "")
6926 (compare:CC (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
6927 (match_operand:DI 2 "mask64_2_operand" ""))
6929 (set (match_operand:DI 0 "gpc_reg_operand" "")
6930 (and:DI (match_dup 1) (match_dup 2)))
6931 (clobber (match_scratch:CC 4 ""))]
6932 "TARGET_POWERPC64 && reload_completed
6933 && (fixed_regs[CR0_REGNO] || !logical_operand (operands[2], DImode))
6934 && !mask_operand (operands[2], DImode)"
6936 (and:DI (rotate:DI (match_dup 1)
6939 (parallel [(set (match_dup 3)
6940 (compare:CC (and:DI (rotate:DI (match_dup 0)
6945 (and:DI (rotate:DI (match_dup 0)
6950 build_mask64_2_operands (operands[2], &operands[5]);
6953 (define_expand "iordi3"
6954 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6955 (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
6956 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
6960 if (non_logical_cint_operand (operands[2], DImode))
6962 HOST_WIDE_INT value;
6963 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
6964 ? operands[0] : gen_reg_rtx (DImode));
6966 if (GET_CODE (operands[2]) == CONST_INT)
6968 value = INTVAL (operands[2]);
6969 emit_insn (gen_iordi3 (tmp, operands[1],
6970 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
6974 value = CONST_DOUBLE_LOW (operands[2]);
6975 emit_insn (gen_iordi3 (tmp, operands[1],
6976 immed_double_const (value
6977 & (~ (HOST_WIDE_INT) 0xffff),
6981 emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
6986 (define_expand "xordi3"
6987 [(set (match_operand:DI 0 "gpc_reg_operand" "")
6988 (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
6989 (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
6993 if (non_logical_cint_operand (operands[2], DImode))
6995 HOST_WIDE_INT value;
6996 rtx tmp = ((no_new_pseudos || rtx_equal_p (operands[0], operands[1]))
6997 ? operands[0] : gen_reg_rtx (DImode));
6999 if (GET_CODE (operands[2]) == CONST_INT)
7001 value = INTVAL (operands[2]);
7002 emit_insn (gen_xordi3 (tmp, operands[1],
7003 GEN_INT (value & (~ (HOST_WIDE_INT) 0xffff))));
7007 value = CONST_DOUBLE_LOW (operands[2]);
7008 emit_insn (gen_xordi3 (tmp, operands[1],
7009 immed_double_const (value
7010 & (~ (HOST_WIDE_INT) 0xffff),
7014 emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
7019 (define_insn "*booldi3_internal1"
7020 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
7021 (match_operator:DI 3 "boolean_or_operator"
7022 [(match_operand:DI 1 "gpc_reg_operand" "%r,r,r")
7023 (match_operand:DI 2 "logical_operand" "r,K,JF")]))]
7030 (define_insn "*booldi3_internal2"
7031 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7032 (compare:CC (match_operator:DI 4 "boolean_or_operator"
7033 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7034 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7036 (clobber (match_scratch:DI 3 "=r,r"))]
7041 [(set_attr "type" "compare")
7042 (set_attr "length" "4,8")])
7045 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7046 (compare:CC (match_operator:DI 4 "boolean_operator"
7047 [(match_operand:DI 1 "gpc_reg_operand" "")
7048 (match_operand:DI 2 "gpc_reg_operand" "")])
7050 (clobber (match_scratch:DI 3 ""))]
7051 "TARGET_POWERPC64 && reload_completed"
7052 [(set (match_dup 3) (match_dup 4))
7054 (compare:CC (match_dup 3)
7058 (define_insn "*booldi3_internal3"
7059 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7060 (compare:CC (match_operator:DI 4 "boolean_operator"
7061 [(match_operand:DI 1 "gpc_reg_operand" "%r,r")
7062 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7064 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7070 [(set_attr "type" "compare")
7071 (set_attr "length" "4,8")])
7074 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7075 (compare:CC (match_operator:DI 4 "boolean_operator"
7076 [(match_operand:DI 1 "gpc_reg_operand" "")
7077 (match_operand:DI 2 "gpc_reg_operand" "")])
7079 (set (match_operand:DI 0 "gpc_reg_operand" "")
7081 "TARGET_POWERPC64 && reload_completed"
7082 [(set (match_dup 0) (match_dup 4))
7084 (compare:CC (match_dup 0)
7088 ;; Split a logical operation that we can't do in one insn into two insns,
7089 ;; each of which does one 16-bit part. This is used by combine.
7092 [(set (match_operand:DI 0 "gpc_reg_operand" "")
7093 (match_operator:DI 3 "boolean_or_operator"
7094 [(match_operand:DI 1 "gpc_reg_operand" "")
7095 (match_operand:DI 2 "non_logical_cint_operand" "")]))]
7097 [(set (match_dup 0) (match_dup 4))
7098 (set (match_dup 0) (match_dup 5))]
7103 if (GET_CODE (operands[2]) == CONST_DOUBLE)
7105 HOST_WIDE_INT value = CONST_DOUBLE_LOW (operands[2]);
7106 i3 = immed_double_const (value & (~ (HOST_WIDE_INT) 0xffff),
7108 i4 = GEN_INT (value & 0xffff);
7112 i3 = GEN_INT (INTVAL (operands[2])
7113 & (~ (HOST_WIDE_INT) 0xffff));
7114 i4 = GEN_INT (INTVAL (operands[2]) & 0xffff);
7116 operands[4] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7118 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[3]), DImode,
7122 (define_insn "*boolcdi3_internal1"
7123 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7124 (match_operator:DI 3 "boolean_operator"
7125 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7126 (match_operand:DI 2 "gpc_reg_operand" "r")]))]
7130 (define_insn "*boolcdi3_internal2"
7131 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7132 (compare:CC (match_operator:DI 4 "boolean_operator"
7133 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7134 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7136 (clobber (match_scratch:DI 3 "=r,r"))]
7141 [(set_attr "type" "compare")
7142 (set_attr "length" "4,8")])
7145 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7146 (compare:CC (match_operator:DI 4 "boolean_operator"
7147 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7148 (match_operand:DI 2 "gpc_reg_operand" "")])
7150 (clobber (match_scratch:DI 3 ""))]
7151 "TARGET_POWERPC64 && reload_completed"
7152 [(set (match_dup 3) (match_dup 4))
7154 (compare:CC (match_dup 3)
7158 (define_insn "*boolcdi3_internal3"
7159 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7160 (compare:CC (match_operator:DI 4 "boolean_operator"
7161 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7162 (match_operand:DI 2 "gpc_reg_operand" "r,r")])
7164 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7170 [(set_attr "type" "compare")
7171 (set_attr "length" "4,8")])
7174 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7175 (compare:CC (match_operator:DI 4 "boolean_operator"
7176 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7177 (match_operand:DI 2 "gpc_reg_operand" "")])
7179 (set (match_operand:DI 0 "gpc_reg_operand" "")
7181 "TARGET_POWERPC64 && reload_completed"
7182 [(set (match_dup 0) (match_dup 4))
7184 (compare:CC (match_dup 0)
7188 (define_insn "*boolccdi3_internal1"
7189 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
7190 (match_operator:DI 3 "boolean_operator"
7191 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r"))
7192 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r"))]))]
7196 (define_insn "*boolccdi3_internal2"
7197 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
7198 (compare:CC (match_operator:DI 4 "boolean_operator"
7199 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "r,r"))
7200 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7202 (clobber (match_scratch:DI 3 "=r,r"))]
7207 [(set_attr "type" "compare")
7208 (set_attr "length" "4,8")])
7211 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
7212 (compare:CC (match_operator:DI 4 "boolean_operator"
7213 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7214 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7216 (clobber (match_scratch:DI 3 ""))]
7217 "TARGET_POWERPC64 && reload_completed"
7218 [(set (match_dup 3) (match_dup 4))
7220 (compare:CC (match_dup 3)
7224 (define_insn "*boolccdi3_internal3"
7225 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
7226 (compare:CC (match_operator:DI 4 "boolean_operator"
7227 [(not:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r"))
7228 (not:DI (match_operand:DI 2 "gpc_reg_operand" "r,r"))])
7230 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
7236 [(set_attr "type" "compare")
7237 (set_attr "length" "4,8")])
7240 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
7241 (compare:CC (match_operator:DI 4 "boolean_operator"
7242 [(not:DI (match_operand:DI 1 "gpc_reg_operand" ""))
7243 (not:DI (match_operand:DI 2 "gpc_reg_operand" ""))])
7245 (set (match_operand:DI 0 "gpc_reg_operand" "")
7247 "TARGET_POWERPC64 && reload_completed"
7248 [(set (match_dup 0) (match_dup 4))
7250 (compare:CC (match_dup 0)
7254 ;; Now define ways of moving data around.
7256 ;; Set up a register with a value from the GOT table
7258 (define_expand "movsi_got"
7259 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7260 (unspec:SI [(match_operand:SI 1 "got_operand" "")
7261 (match_dup 2)] UNSPEC_MOVSI_GOT))]
7262 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7265 if (GET_CODE (operands[1]) == CONST)
7267 rtx offset = const0_rtx;
7268 HOST_WIDE_INT value;
7270 operands[1] = eliminate_constant_term (XEXP (operands[1], 0), &offset);
7271 value = INTVAL (offset);
7274 rtx tmp = (no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode));
7275 emit_insn (gen_movsi_got (tmp, operands[1]));
7276 emit_insn (gen_addsi3 (operands[0], tmp, offset));
7281 operands[2] = rs6000_got_register (operands[1]);
7284 (define_insn "*movsi_got_internal"
7285 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7286 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7287 (match_operand:SI 2 "gpc_reg_operand" "b")]
7289 "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
7290 "{l|lwz} %0,%a1@got(%2)"
7291 [(set_attr "type" "load")])
7293 ;; Used by sched, shorten_branches and final when the GOT pseudo reg
7294 ;; didn't get allocated to a hard register.
7296 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7297 (unspec:SI [(match_operand:SI 1 "got_no_const_operand" "")
7298 (match_operand:SI 2 "memory_operand" "")]
7300 "DEFAULT_ABI == ABI_V4
7302 && (reload_in_progress || reload_completed)"
7303 [(set (match_dup 0) (match_dup 2))
7304 (set (match_dup 0) (unspec:SI [(match_dup 1)(match_dup 0)]
7308 ;; For SI, we special-case integers that can't be loaded in one insn. We
7309 ;; do the load 16-bits at a time. We could do this by loading from memory,
7310 ;; and this is even supposed to be faster, but it is simpler not to get
7311 ;; integers in the TOC.
7312 (define_insn "movsi_low"
7313 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7314 (mem:SI (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
7315 (match_operand 2 "" ""))))]
7316 "TARGET_MACHO && ! TARGET_64BIT"
7317 "{l|lwz} %0,lo16(%2)(%1)"
7318 [(set_attr "type" "load")
7319 (set_attr "length" "4")])
7321 (define_insn "*movsi_internal1"
7322 [(set (match_operand:SI 0 "rs6000_nonimmediate_operand" "=r,r,r,m,r,r,r,r,r,*q,*c*l,*h,*h")
7323 (match_operand:SI 1 "input_operand" "r,U,m,r,I,L,n,R,*h,r,r,r,0"))]
7324 "gpc_reg_operand (operands[0], SImode)
7325 || gpc_reg_operand (operands[1], SImode)"
7329 {l%U1%X1|lwz%U1%X1} %0,%1
7330 {st%U0%X0|stw%U0%X0} %1,%0
7340 [(set_attr "type" "*,*,load,store,*,*,*,*,mfjmpr,*,mtjmpr,*,*")
7341 (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
7343 ;; Split a load of a large constant into the appropriate two-insn
7347 [(set (match_operand:SI 0 "gpc_reg_operand" "")
7348 (match_operand:SI 1 "const_int_operand" ""))]
7349 "(unsigned HOST_WIDE_INT) (INTVAL (operands[1]) + 0x8000) >= 0x10000
7350 && (INTVAL (operands[1]) & 0xffff) != 0"
7354 (ior:SI (match_dup 0)
7357 { rtx tem = rs6000_emit_set_const (operands[0], SImode, operands[1], 2);
7359 if (tem == operands[0])
7365 (define_insn "*mov<mode>_internal2"
7366 [(set (match_operand:CC 2 "cc_reg_operand" "=y,x,?y")
7367 (compare:CC (match_operand:P 1 "gpc_reg_operand" "0,r,r")
7369 (set (match_operand:P 0 "gpc_reg_operand" "=r,r,r") (match_dup 1))]
7372 {cmpi|cmp<wd>i} %2,%0,0
7375 [(set_attr "type" "cmp,compare,cmp")
7376 (set_attr "length" "4,4,8")])
7379 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
7380 (compare:CC (match_operand:P 1 "gpc_reg_operand" "")
7382 (set (match_operand:P 0 "gpc_reg_operand" "") (match_dup 1))]
7384 [(set (match_dup 0) (match_dup 1))
7386 (compare:CC (match_dup 0)
7390 (define_insn "*movhi_internal"
7391 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7392 (match_operand:HI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7393 "gpc_reg_operand (operands[0], HImode)
7394 || gpc_reg_operand (operands[1], HImode)"
7404 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7406 (define_expand "mov<mode>"
7407 [(set (match_operand:INT 0 "general_operand" "")
7408 (match_operand:INT 1 "any_operand" ""))]
7410 "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
7412 (define_insn "*movqi_internal"
7413 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,m,r,r,*q,*c*l,*h")
7414 (match_operand:QI 1 "input_operand" "r,m,r,i,*h,r,r,0"))]
7415 "gpc_reg_operand (operands[0], QImode)
7416 || gpc_reg_operand (operands[1], QImode)"
7426 [(set_attr "type" "*,load,store,*,mfjmpr,*,mtjmpr,*")])
7428 ;; Here is how to move condition codes around. When we store CC data in
7429 ;; an integer register or memory, we store just the high-order 4 bits.
7430 ;; This lets us not shift in the most common case of CR0.
7431 (define_expand "movcc"
7432 [(set (match_operand:CC 0 "nonimmediate_operand" "")
7433 (match_operand:CC 1 "nonimmediate_operand" ""))]
7437 (define_insn "*movcc_internal1"
7438 [(set (match_operand:CC 0 "nonimmediate_operand" "=y,x,?y,r,r,r,r,q,cl,r,m")
7439 (match_operand:CC 1 "nonimmediate_operand" "y,r,r,x,y,r,h,r,r,m,r"))]
7440 "register_operand (operands[0], CCmode)
7441 || register_operand (operands[1], CCmode)"
7445 {rlinm|rlwinm} %1,%1,%F0,0xffffffff\;mtcrf %R0,%1\;{rlinm|rlwinm} %1,%1,%f0,0xffffffff
7447 mfcr %0%Q1\;{rlinm|rlwinm} %0,%0,%f1,0xf0000000
7452 {l%U1%X1|lwz%U1%X1} %0,%1
7453 {st%U0%U1|stw%U0%U1} %1,%0"
7455 (cond [(eq_attr "alternative" "0")
7456 (const_string "cr_logical")
7457 (eq_attr "alternative" "1,2")
7458 (const_string "mtcr")
7459 (eq_attr "alternative" "5,7")
7460 (const_string "integer")
7461 (eq_attr "alternative" "6")
7462 (const_string "mfjmpr")
7463 (eq_attr "alternative" "8")
7464 (const_string "mtjmpr")
7465 (eq_attr "alternative" "9")
7466 (const_string "load")
7467 (eq_attr "alternative" "10")
7468 (const_string "store")
7469 (ne (symbol_ref "TARGET_MFCRF") (const_int 0))
7470 (const_string "mfcrf")
7472 (const_string "mfcr")))
7473 (set_attr "length" "4,4,12,4,8,4,4,4,4,4,4")])
7475 ;; For floating-point, we normally deal with the floating-point registers
7476 ;; unless -msoft-float is used. The sole exception is that parameter passing
7477 ;; can produce floating-point values in fixed-point registers. Unless the
7478 ;; value is a simple constant or already in memory, we deal with this by
7479 ;; allocating memory and copying the value explicitly via that memory location.
7480 (define_expand "movsf"
7481 [(set (match_operand:SF 0 "nonimmediate_operand" "")
7482 (match_operand:SF 1 "any_operand" ""))]
7484 "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
7487 [(set (match_operand:SF 0 "gpc_reg_operand" "")
7488 (match_operand:SF 1 "const_double_operand" ""))]
7490 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7491 || (GET_CODE (operands[0]) == SUBREG
7492 && GET_CODE (SUBREG_REG (operands[0])) == REG
7493 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7494 [(set (match_dup 2) (match_dup 3))]
7500 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7501 REAL_VALUE_TO_TARGET_SINGLE (rv, l);
7503 if (! TARGET_POWERPC64)
7504 operands[2] = operand_subword (operands[0], 0, 0, SFmode);
7506 operands[2] = gen_lowpart (SImode, operands[0]);
7508 operands[3] = gen_int_mode (l, SImode);
7511 (define_insn "*movsf_hardfloat"
7512 [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r")
7513 (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))]
7514 "(gpc_reg_operand (operands[0], SFmode)
7515 || gpc_reg_operand (operands[1], SFmode))
7516 && (TARGET_HARD_FLOAT && TARGET_FPRS)"
7519 {l%U1%X1|lwz%U1%X1} %0,%1
7520 {st%U0%X0|stw%U0%X0} %1,%0
7530 [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*")
7531 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")])
7533 (define_insn "*movsf_softfloat"
7534 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h")
7535 (match_operand:SF 1 "input_operand" "r,r,r,h,m,r,I,L,R,G,Fn,0"))]
7536 "(gpc_reg_operand (operands[0], SFmode)
7537 || gpc_reg_operand (operands[1], SFmode))
7538 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
7544 {l%U1%X1|lwz%U1%X1} %0,%1
7545 {st%U0%X0|stw%U0%X0} %1,%0
7552 [(set_attr "type" "*,mtjmpr,*,*,load,store,*,*,*,*,*,*")
7553 (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,4")])
7556 (define_expand "movdf"
7557 [(set (match_operand:DF 0 "nonimmediate_operand" "")
7558 (match_operand:DF 1 "any_operand" ""))]
7560 "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
7563 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7564 (match_operand:DF 1 "const_int_operand" ""))]
7565 "! TARGET_POWERPC64 && reload_completed
7566 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7567 || (GET_CODE (operands[0]) == SUBREG
7568 && GET_CODE (SUBREG_REG (operands[0])) == REG
7569 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7570 [(set (match_dup 2) (match_dup 4))
7571 (set (match_dup 3) (match_dup 1))]
7574 int endian = (WORDS_BIG_ENDIAN == 0);
7575 HOST_WIDE_INT value = INTVAL (operands[1]);
7577 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7578 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7579 #if HOST_BITS_PER_WIDE_INT == 32
7580 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
7582 operands[4] = GEN_INT (value >> 32);
7583 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
7588 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7589 (match_operand:DF 1 "const_double_operand" ""))]
7590 "! TARGET_POWERPC64 && reload_completed
7591 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7592 || (GET_CODE (operands[0]) == SUBREG
7593 && GET_CODE (SUBREG_REG (operands[0])) == REG
7594 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7595 [(set (match_dup 2) (match_dup 4))
7596 (set (match_dup 3) (match_dup 5))]
7599 int endian = (WORDS_BIG_ENDIAN == 0);
7603 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7604 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7606 operands[2] = operand_subword (operands[0], endian, 0, DFmode);
7607 operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
7608 operands[4] = gen_int_mode (l[endian], SImode);
7609 operands[5] = gen_int_mode (l[1 - endian], SImode);
7613 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7614 (match_operand:DF 1 "easy_fp_constant" ""))]
7615 "TARGET_POWERPC64 && reload_completed
7616 && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
7617 || (GET_CODE (operands[0]) == SUBREG
7618 && GET_CODE (SUBREG_REG (operands[0])) == REG
7619 && REGNO (SUBREG_REG (operands[0])) <= 31))"
7620 [(set (match_dup 2) (match_dup 3))]
7623 int endian = (WORDS_BIG_ENDIAN == 0);
7626 #if HOST_BITS_PER_WIDE_INT >= 64
7630 REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
7631 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
7633 operands[2] = gen_lowpart (DImode, operands[0]);
7634 /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
7635 #if HOST_BITS_PER_WIDE_INT >= 64
7636 val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
7637 | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
7639 operands[3] = gen_int_mode (val, DImode);
7641 operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
7645 ;; Don't have reload use general registers to load a constant. First,
7646 ;; it might not work if the output operand is the equivalent of
7647 ;; a non-offsettable memref, but also it is less efficient than loading
7648 ;; the constant into an FP register, since it will probably be used there.
7649 ;; The "??" is a kludge until we can figure out a more reasonable way
7650 ;; of handling these non-offsettable values.
7651 (define_insn "*movdf_hardfloat32"
7652 [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
7653 (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
7654 "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
7655 && (gpc_reg_operand (operands[0], DFmode)
7656 || gpc_reg_operand (operands[1], DFmode))"
7659 switch (which_alternative)
7664 /* We normally copy the low-numbered register first. However, if
7665 the first register operand 0 is the same as the second register
7666 of operand 1, we must copy in the opposite order. */
7667 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7668 return \"mr %L0,%L1\;mr %0,%1\";
7670 return \"mr %0,%1\;mr %L0,%L1\";
7672 if (GET_CODE (operands[1]) == MEM
7673 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[1], 0),
7674 reload_completed || reload_in_progress)
7675 || GET_CODE (XEXP (operands[1], 0)) == REG
7676 || GET_CODE (XEXP (operands[1], 0)) == LO_SUM
7677 || GET_CODE (XEXP (operands[1], 0)) == PRE_INC
7678 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC))
7680 /* If the low-address word is used in the address, we must load
7681 it last. Otherwise, load it first. Note that we cannot have
7682 auto-increment in that case since the address register is
7683 known to be dead. */
7684 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7686 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7688 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7694 addreg = find_addr_reg (XEXP (operands[1], 0));
7695 if (refers_to_regno_p (REGNO (operands[0]),
7696 REGNO (operands[0]) + 1,
7699 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7700 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7701 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7702 return \"{lx|lwzx} %0,%1\";
7706 output_asm_insn (\"{lx|lwzx} %0,%1\", operands);
7707 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7708 output_asm_insn (\"{lx|lwzx} %L0,%1\", operands);
7709 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7714 if (GET_CODE (operands[0]) == MEM
7715 && (rs6000_legitimate_offset_address_p (DFmode, XEXP (operands[0], 0),
7716 reload_completed || reload_in_progress)
7717 || GET_CODE (XEXP (operands[0], 0)) == REG
7718 || GET_CODE (XEXP (operands[0], 0)) == LO_SUM
7719 || GET_CODE (XEXP (operands[0], 0)) == PRE_INC
7720 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))
7721 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
7726 addreg = find_addr_reg (XEXP (operands[0], 0));
7727 output_asm_insn (\"{stx|stwx} %1,%0\", operands);
7728 output_asm_insn (\"{cal|la} %0,4(%0)\", &addreg);
7729 output_asm_insn (\"{stx|stwx} %L1,%0\", operands);
7730 output_asm_insn (\"{cal|la} %0,-4(%0)\", &addreg);
7734 return \"fmr %0,%1\";
7736 return \"lfd%U1%X1 %0,%1\";
7738 return \"stfd%U0%X0 %1,%0\";
7745 [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
7746 (set_attr "length" "8,16,16,4,4,4,8,12,16")])
7748 (define_insn "*movdf_softfloat32"
7749 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
7750 (match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
7751 "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
7752 && (gpc_reg_operand (operands[0], DFmode)
7753 || gpc_reg_operand (operands[1], DFmode))"
7756 switch (which_alternative)
7761 /* We normally copy the low-numbered register first. However, if
7762 the first register operand 0 is the same as the second register of
7763 operand 1, we must copy in the opposite order. */
7764 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
7765 return \"mr %L0,%L1\;mr %0,%1\";
7767 return \"mr %0,%1\;mr %L0,%L1\";
7769 /* If the low-address word is used in the address, we must load
7770 it last. Otherwise, load it first. Note that we cannot have
7771 auto-increment in that case since the address register is
7772 known to be dead. */
7773 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
7775 return \"{l|lwz} %L0,%L1\;{l|lwz} %0,%1\";
7777 return \"{l%U1|lwz%U1} %0,%1\;{l|lwz} %L0,%L1\";
7779 return \"{st%U0|stw%U0} %1,%0\;{st|stw} %L1,%L0\";
7786 [(set_attr "type" "two,load,store,*,*,*")
7787 (set_attr "length" "8,8,8,8,12,16")])
7789 ; ld/std require word-aligned displacements -> 'Y' constraint.
7790 ; List Y->r and r->Y before r->r for reload.
7791 (define_insn "*movdf_hardfloat64"
7792 [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r")
7793 (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
7794 "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
7795 && (gpc_reg_operand (operands[0], DFmode)
7796 || gpc_reg_operand (operands[1], DFmode))"
7810 [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,*,*,*,*,*")
7811 (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
7813 (define_insn "*movdf_softfloat64"
7814 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
7815 (match_operand:DF 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
7816 "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
7817 && (gpc_reg_operand (operands[0], DFmode)
7818 || gpc_reg_operand (operands[1], DFmode))"
7829 [(set_attr "type" "load,store,*,*,*,*,*,*,*")
7830 (set_attr "length" "4,4,4,4,4,8,12,16,4")])
7832 (define_expand "movtf"
7833 [(set (match_operand:TF 0 "general_operand" "")
7834 (match_operand:TF 1 "any_operand" ""))]
7835 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7836 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7837 "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
7839 ; It's important to list the o->f and f->o moves before f->f because
7840 ; otherwise reload, given m->f, will try to pick f->f and reload it,
7841 ; which doesn't make progress. Likewise r->Y must be before r->r.
7842 (define_insn_and_split "*movtf_internal"
7843 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
7844 (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
7845 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7846 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
7847 && (gpc_reg_operand (operands[0], TFmode)
7848 || gpc_reg_operand (operands[1], TFmode))"
7850 "&& reload_completed"
7852 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
7853 [(set_attr "length" "8,8,8,20,20,16")])
7855 (define_expand "extenddftf2"
7856 [(parallel [(set (match_operand:TF 0 "nonimmediate_operand" "")
7857 (float_extend:TF (match_operand:DF 1 "input_operand" "")))
7858 (use (match_dup 2))])]
7859 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7860 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7862 operands[2] = CONST0_RTX (DFmode);
7865 (define_insn_and_split "*extenddftf2_internal"
7866 [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
7867 (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
7868 (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
7869 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7870 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7872 "&& reload_completed"
7875 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
7876 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
7877 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word),
7879 emit_move_insn (simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word),
7884 (define_expand "extendsftf2"
7885 [(set (match_operand:TF 0 "nonimmediate_operand" "")
7886 (float_extend:TF (match_operand:SF 1 "gpc_reg_operand" "")))]
7887 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7888 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7890 rtx tmp = gen_reg_rtx (DFmode);
7891 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
7892 emit_insn (gen_extenddftf2 (operands[0], tmp));
7896 (define_expand "trunctfdf2"
7897 [(set (match_operand:DF 0 "gpc_reg_operand" "")
7898 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "")))]
7899 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7900 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7903 (define_insn_and_split "trunctfdf2_internal1"
7904 [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
7905 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
7906 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
7907 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7911 "&& reload_completed && REGNO (operands[0]) == REGNO (operands[1])"
7914 emit_note (NOTE_INSN_DELETED);
7917 [(set_attr "type" "fp")])
7919 (define_insn "trunctfdf2_internal2"
7920 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
7921 (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
7922 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
7923 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7925 [(set_attr "type" "fp")])
7927 (define_insn_and_split "trunctfsf2"
7928 [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
7929 (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
7930 (clobber (match_scratch:DF 2 "=f"))]
7931 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7932 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7934 "&& reload_completed"
7936 (float_truncate:DF (match_dup 1)))
7938 (float_truncate:SF (match_dup 2)))]
7941 (define_expand "floatsitf2"
7942 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
7943 (float:TF (match_operand:SI 1 "gpc_reg_operand" "r")))]
7944 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7945 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7947 rtx tmp = gen_reg_rtx (DFmode);
7948 expand_float (tmp, operands[1], false);
7949 emit_insn (gen_extenddftf2 (operands[0], tmp));
7953 ; fadd, but rounding towards zero.
7954 ; This is probably not the optimal code sequence.
7955 (define_insn "fix_trunc_helper"
7956 [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
7957 (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
7958 UNSPEC_FIX_TRUNC_TF))
7959 (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
7960 "TARGET_HARD_FLOAT && TARGET_FPRS"
7961 "mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
7962 [(set_attr "type" "fp")
7963 (set_attr "length" "20")])
7965 (define_expand "fix_trunctfsi2"
7966 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
7967 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "")))
7968 (clobber (match_dup 2))
7969 (clobber (match_dup 3))
7970 (clobber (match_dup 4))
7971 (clobber (match_dup 5))])]
7972 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7973 && (TARGET_POWER2 || TARGET_POWERPC)
7974 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7976 operands[2] = gen_reg_rtx (DFmode);
7977 operands[3] = gen_reg_rtx (DFmode);
7978 operands[4] = gen_reg_rtx (DImode);
7979 operands[5] = assign_stack_temp (DImode, GET_MODE_SIZE (DImode), 0);
7982 (define_insn_and_split "*fix_trunctfsi2_internal"
7983 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
7984 (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
7985 (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
7986 (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
7987 (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
7988 (clobber (match_operand:DI 5 "memory_operand" "=o"))]
7989 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
7990 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
7992 "&& (!no_new_pseudos || offsettable_nonstrict_memref_p (operands[5]))"
7996 emit_insn (gen_fix_trunc_helper (operands[2], operands[1], operands[3]));
7998 gcc_assert (MEM_P (operands[5]));
7999 lowword = adjust_address (operands[5], SImode, WORDS_BIG_ENDIAN ? 4 : 0);
8001 emit_insn (gen_fctiwz (operands[4], operands[2]));
8002 emit_move_insn (operands[5], operands[4]);
8003 emit_move_insn (operands[0], lowword);
8007 (define_insn "negtf2"
8008 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8009 (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8010 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8011 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8014 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
8015 return \"fneg %L0,%L1\;fneg %0,%1\";
8017 return \"fneg %0,%1\;fneg %L0,%L1\";
8019 [(set_attr "type" "fp")
8020 (set_attr "length" "8")])
8022 (define_expand "abstf2"
8023 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8024 (abs:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
8025 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8026 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8029 rtx label = gen_label_rtx ();
8030 emit_insn (gen_abstf2_internal (operands[0], operands[1], label));
8035 (define_expand "abstf2_internal"
8036 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
8037 (match_operand:TF 1 "gpc_reg_operand" "f"))
8038 (set (match_dup 3) (match_dup 5))
8039 (set (match_dup 5) (abs:DF (match_dup 5)))
8040 (set (match_dup 4) (compare:CCFP (match_dup 3) (match_dup 5)))
8041 (set (pc) (if_then_else (eq (match_dup 4) (const_int 0))
8042 (label_ref (match_operand 2 "" ""))
8044 (set (match_dup 6) (neg:DF (match_dup 6)))]
8045 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN)
8046 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
8049 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
8050 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
8051 operands[3] = gen_reg_rtx (DFmode);
8052 operands[4] = gen_reg_rtx (CCFPmode);
8053 operands[5] = simplify_gen_subreg (DFmode, operands[0], TFmode, hi_word);
8054 operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
8057 ;; Next come the multi-word integer load and store and the load and store
8060 ; List r->r after r->"o<>", otherwise reload will try to reload a
8061 ; non-offsettable address by using r->r which won't make progress.
8062 (define_insn "*movdi_internal32"
8063 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
8064 (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
8066 && (gpc_reg_operand (operands[0], DImode)
8067 || gpc_reg_operand (operands[1], DImode))"
8076 [(set_attr "type" "load,*,store,fp,fpload,fpstore,*")])
8079 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8080 (match_operand:DI 1 "const_int_operand" ""))]
8081 "! TARGET_POWERPC64 && reload_completed"
8082 [(set (match_dup 2) (match_dup 4))
8083 (set (match_dup 3) (match_dup 1))]
8086 HOST_WIDE_INT value = INTVAL (operands[1]);
8087 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8089 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8091 #if HOST_BITS_PER_WIDE_INT == 32
8092 operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
8094 operands[4] = GEN_INT (value >> 32);
8095 operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
8100 [(set (match_operand:DI 0 "nonimmediate_operand" "")
8101 (match_operand:DI 1 "input_operand" ""))]
8102 "reload_completed && !TARGET_POWERPC64
8103 && gpr_or_gpr_p (operands[0], operands[1])"
8105 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8107 (define_insn "*movdi_internal64"
8108 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
8109 (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
8111 && (gpc_reg_operand (operands[0], DImode)
8112 || gpc_reg_operand (operands[1], DImode))"
8127 [(set_attr "type" "*,load,store,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*")
8128 (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
8130 ;; immediate value valid for a single instruction hiding in a const_double
8132 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
8133 (match_operand:DI 1 "const_double_operand" "F"))]
8134 "HOST_BITS_PER_WIDE_INT == 32 && TARGET_POWERPC64
8135 && GET_CODE (operands[1]) == CONST_DOUBLE
8136 && num_insns_constant (operands[1], DImode) == 1"
8139 return ((unsigned HOST_WIDE_INT)
8140 (CONST_DOUBLE_LOW (operands[1]) + 0x8000) < 0x10000)
8141 ? \"li %0,%1\" : \"lis %0,%v1\";
8144 ;; Generate all one-bits and clear left or right.
8145 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
8147 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8148 (match_operand:DI 1 "mask_operand" ""))]
8149 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8150 [(set (match_dup 0) (const_int -1))
8152 (and:DI (rotate:DI (match_dup 0)
8157 ;; Split a load of a large constant into the appropriate five-instruction
8158 ;; sequence. Handle anything in a constant number of insns.
8159 ;; When non-easy constants can go in the TOC, this should use
8160 ;; easy_fp_constant predicate.
8162 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8163 (match_operand:DI 1 "const_int_operand" ""))]
8164 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8165 [(set (match_dup 0) (match_dup 2))
8166 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8168 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8170 if (tem == operands[0])
8177 [(set (match_operand:DI 0 "gpc_reg_operand" "")
8178 (match_operand:DI 1 "const_double_operand" ""))]
8179 "TARGET_POWERPC64 && num_insns_constant (operands[1], DImode) > 1"
8180 [(set (match_dup 0) (match_dup 2))
8181 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
8183 { rtx tem = rs6000_emit_set_const (operands[0], DImode, operands[1], 5);
8185 if (tem == operands[0])
8191 ;; TImode is similar, except that we usually want to compute the address into
8192 ;; a register and use lsi/stsi (the exception is during reload). MQ is also
8193 ;; clobbered in stsi for POWER, so we need a SCRATCH for it.
8195 ;; We say that MQ is clobbered in the last alternative because the first
8196 ;; alternative would never get used otherwise since it would need a reload
8197 ;; while the 2nd alternative would not. We put memory cases first so they
8198 ;; are preferred. Otherwise, we'd try to reload the output instead of
8199 ;; giving the SCRATCH mq.
8201 (define_insn "*movti_power"
8202 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,m,????r,????r,????r,r")
8203 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))
8204 (clobber (match_scratch:SI 2 "=q,q#X,X,X,X,X"))]
8205 "TARGET_POWER && ! TARGET_POWERPC64
8206 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8209 switch (which_alternative)
8216 return \"{stsi|stswi} %1,%P0,16\";
8221 /* If the address is not used in the output, we can use lsi. Otherwise,
8222 fall through to generating four loads. */
8224 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8225 return \"{lsi|lswi} %0,%P1,16\";
8226 /* ... fall through ... */
8232 [(set_attr "type" "store,store,*,load,load,*")])
8234 (define_insn "*movti_string"
8235 [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,o<>,????r,????r,????r,r")
8236 (match_operand:TI 1 "input_operand" "r,r,r,Q,m,n"))]
8237 "! TARGET_POWER && ! TARGET_POWERPC64
8238 && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
8241 switch (which_alternative)
8247 return \"{stsi|stswi} %1,%P0,16\";
8252 /* If the address is not used in the output, we can use lsi. Otherwise,
8253 fall through to generating four loads. */
8255 && ! reg_overlap_mentioned_p (operands[0], operands[1]))
8256 return \"{lsi|lswi} %0,%P1,16\";
8257 /* ... fall through ... */
8263 [(set_attr "type" "store,store,*,load,load,*")])
8265 (define_insn "*movti_ppc64"
8266 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
8267 (match_operand:TI 1 "input_operand" "r,r,m"))]
8268 "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
8269 || gpc_reg_operand (operands[1], TImode))"
8271 [(set_attr "type" "*,load,store")])
8274 [(set (match_operand:TI 0 "gpc_reg_operand" "")
8275 (match_operand:TI 1 "const_double_operand" ""))]
8277 [(set (match_dup 2) (match_dup 4))
8278 (set (match_dup 3) (match_dup 5))]
8281 operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
8283 operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
8285 if (GET_CODE (operands[1]) == CONST_DOUBLE)
8287 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
8288 operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
8290 else if (GET_CODE (operands[1]) == CONST_INT)
8292 operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
8293 operands[5] = operands[1];
8300 [(set (match_operand:TI 0 "nonimmediate_operand" "")
8301 (match_operand:TI 1 "input_operand" ""))]
8303 && gpr_or_gpr_p (operands[0], operands[1])"
8305 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
8307 (define_expand "load_multiple"
8308 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8309 (match_operand:SI 1 "" ""))
8310 (use (match_operand:SI 2 "" ""))])]
8311 "TARGET_STRING && !TARGET_POWERPC64"
8319 /* Support only loading a constant number of fixed-point registers from
8320 memory and only bother with this if more than two; the machine
8321 doesn't support more than eight. */
8322 if (GET_CODE (operands[2]) != CONST_INT
8323 || INTVAL (operands[2]) <= 2
8324 || INTVAL (operands[2]) > 8
8325 || GET_CODE (operands[1]) != MEM
8326 || GET_CODE (operands[0]) != REG
8327 || REGNO (operands[0]) >= 32)
8330 count = INTVAL (operands[2]);
8331 regno = REGNO (operands[0]);
8333 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
8334 op1 = replace_equiv_address (operands[1],
8335 force_reg (SImode, XEXP (operands[1], 0)));
8337 for (i = 0; i < count; i++)
8338 XVECEXP (operands[3], 0, i)
8339 = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, regno + i),
8340 adjust_address_nv (op1, SImode, i * 4));
8343 (define_insn "*ldmsi8"
8344 [(match_parallel 0 "load_multiple_operation"
8345 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8346 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8347 (set (match_operand:SI 3 "gpc_reg_operand" "")
8348 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8349 (set (match_operand:SI 4 "gpc_reg_operand" "")
8350 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8351 (set (match_operand:SI 5 "gpc_reg_operand" "")
8352 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8353 (set (match_operand:SI 6 "gpc_reg_operand" "")
8354 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8355 (set (match_operand:SI 7 "gpc_reg_operand" "")
8356 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8357 (set (match_operand:SI 8 "gpc_reg_operand" "")
8358 (mem:SI (plus:SI (match_dup 1) (const_int 24))))
8359 (set (match_operand:SI 9 "gpc_reg_operand" "")
8360 (mem:SI (plus:SI (match_dup 1) (const_int 28))))])]
8361 "TARGET_STRING && XVECLEN (operands[0], 0) == 8"
8363 { return rs6000_output_load_multiple (operands); }"
8364 [(set_attr "type" "load")
8365 (set_attr "length" "32")])
8367 (define_insn "*ldmsi7"
8368 [(match_parallel 0 "load_multiple_operation"
8369 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8370 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8371 (set (match_operand:SI 3 "gpc_reg_operand" "")
8372 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8373 (set (match_operand:SI 4 "gpc_reg_operand" "")
8374 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8375 (set (match_operand:SI 5 "gpc_reg_operand" "")
8376 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8377 (set (match_operand:SI 6 "gpc_reg_operand" "")
8378 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8379 (set (match_operand:SI 7 "gpc_reg_operand" "")
8380 (mem:SI (plus:SI (match_dup 1) (const_int 20))))
8381 (set (match_operand:SI 8 "gpc_reg_operand" "")
8382 (mem:SI (plus:SI (match_dup 1) (const_int 24))))])]
8383 "TARGET_STRING && XVECLEN (operands[0], 0) == 7"
8385 { return rs6000_output_load_multiple (operands); }"
8386 [(set_attr "type" "load")
8387 (set_attr "length" "32")])
8389 (define_insn "*ldmsi6"
8390 [(match_parallel 0 "load_multiple_operation"
8391 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8392 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8393 (set (match_operand:SI 3 "gpc_reg_operand" "")
8394 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8395 (set (match_operand:SI 4 "gpc_reg_operand" "")
8396 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8397 (set (match_operand:SI 5 "gpc_reg_operand" "")
8398 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8399 (set (match_operand:SI 6 "gpc_reg_operand" "")
8400 (mem:SI (plus:SI (match_dup 1) (const_int 16))))
8401 (set (match_operand:SI 7 "gpc_reg_operand" "")
8402 (mem:SI (plus:SI (match_dup 1) (const_int 20))))])]
8403 "TARGET_STRING && XVECLEN (operands[0], 0) == 6"
8405 { return rs6000_output_load_multiple (operands); }"
8406 [(set_attr "type" "load")
8407 (set_attr "length" "32")])
8409 (define_insn "*ldmsi5"
8410 [(match_parallel 0 "load_multiple_operation"
8411 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8412 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8413 (set (match_operand:SI 3 "gpc_reg_operand" "")
8414 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8415 (set (match_operand:SI 4 "gpc_reg_operand" "")
8416 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8417 (set (match_operand:SI 5 "gpc_reg_operand" "")
8418 (mem:SI (plus:SI (match_dup 1) (const_int 12))))
8419 (set (match_operand:SI 6 "gpc_reg_operand" "")
8420 (mem:SI (plus:SI (match_dup 1) (const_int 16))))])]
8421 "TARGET_STRING && XVECLEN (operands[0], 0) == 5"
8423 { return rs6000_output_load_multiple (operands); }"
8424 [(set_attr "type" "load")
8425 (set_attr "length" "32")])
8427 (define_insn "*ldmsi4"
8428 [(match_parallel 0 "load_multiple_operation"
8429 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8430 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8431 (set (match_operand:SI 3 "gpc_reg_operand" "")
8432 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8433 (set (match_operand:SI 4 "gpc_reg_operand" "")
8434 (mem:SI (plus:SI (match_dup 1) (const_int 8))))
8435 (set (match_operand:SI 5 "gpc_reg_operand" "")
8436 (mem:SI (plus:SI (match_dup 1) (const_int 12))))])]
8437 "TARGET_STRING && XVECLEN (operands[0], 0) == 4"
8439 { return rs6000_output_load_multiple (operands); }"
8440 [(set_attr "type" "load")
8441 (set_attr "length" "32")])
8443 (define_insn "*ldmsi3"
8444 [(match_parallel 0 "load_multiple_operation"
8445 [(set (match_operand:SI 2 "gpc_reg_operand" "")
8446 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b")))
8447 (set (match_operand:SI 3 "gpc_reg_operand" "")
8448 (mem:SI (plus:SI (match_dup 1) (const_int 4))))
8449 (set (match_operand:SI 4 "gpc_reg_operand" "")
8450 (mem:SI (plus:SI (match_dup 1) (const_int 8))))])]
8451 "TARGET_STRING && XVECLEN (operands[0], 0) == 3"
8453 { return rs6000_output_load_multiple (operands); }"
8454 [(set_attr "type" "load")
8455 (set_attr "length" "32")])
8457 (define_expand "store_multiple"
8458 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
8459 (match_operand:SI 1 "" ""))
8460 (clobber (scratch:SI))
8461 (use (match_operand:SI 2 "" ""))])]
8462 "TARGET_STRING && !TARGET_POWERPC64"
8471 /* Support only storing a constant number of fixed-point registers to
8472 memory and only bother with this if more than two; the machine
8473 doesn't support more than eight. */
8474 if (GET_CODE (operands[2]) != CONST_INT
8475 || INTVAL (operands[2]) <= 2
8476 || INTVAL (operands[2]) > 8
8477 || GET_CODE (operands[0]) != MEM
8478 || GET_CODE (operands[1]) != REG
8479 || REGNO (operands[1]) >= 32)
8482 count = INTVAL (operands[2]);
8483 regno = REGNO (operands[1]);
8485 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count + 1));
8486 to = force_reg (SImode, XEXP (operands[0], 0));
8487 op0 = replace_equiv_address (operands[0], to);
8489 XVECEXP (operands[3], 0, 0)
8490 = gen_rtx_SET (VOIDmode, adjust_address_nv (op0, SImode, 0), operands[1]);
8491 XVECEXP (operands[3], 0, 1) = gen_rtx_CLOBBER (VOIDmode,
8492 gen_rtx_SCRATCH (SImode));
8494 for (i = 1; i < count; i++)
8495 XVECEXP (operands[3], 0, i + 1)
8496 = gen_rtx_SET (VOIDmode,
8497 adjust_address_nv (op0, SImode, i * 4),
8498 gen_rtx_REG (SImode, regno + i));
8501 (define_insn "*store_multiple_power"
8502 [(match_parallel 0 "store_multiple_operation"
8503 [(set (match_operand:SI 1 "indirect_operand" "=Q")
8504 (match_operand:SI 2 "gpc_reg_operand" "r"))
8505 (clobber (match_scratch:SI 3 "=q"))])]
8506 "TARGET_STRING && TARGET_POWER"
8507 "{stsi|stswi} %2,%P1,%O0"
8508 [(set_attr "type" "store")])
8510 (define_insn "*stmsi8"
8511 [(match_parallel 0 "store_multiple_operation"
8512 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8513 (match_operand:SI 2 "gpc_reg_operand" "r"))
8514 (clobber (match_scratch:SI 3 "X"))
8515 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8516 (match_operand:SI 4 "gpc_reg_operand" "r"))
8517 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8518 (match_operand:SI 5 "gpc_reg_operand" "r"))
8519 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8520 (match_operand:SI 6 "gpc_reg_operand" "r"))
8521 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8522 (match_operand:SI 7 "gpc_reg_operand" "r"))
8523 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8524 (match_operand:SI 8 "gpc_reg_operand" "r"))
8525 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8526 (match_operand:SI 9 "gpc_reg_operand" "r"))
8527 (set (mem:SI (plus:SI (match_dup 1) (const_int 28)))
8528 (match_operand:SI 10 "gpc_reg_operand" "r"))])]
8529 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 9"
8530 "{stsi|stswi} %2,%1,%O0"
8531 [(set_attr "type" "store")])
8533 (define_insn "*stmsi7"
8534 [(match_parallel 0 "store_multiple_operation"
8535 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8536 (match_operand:SI 2 "gpc_reg_operand" "r"))
8537 (clobber (match_scratch:SI 3 "X"))
8538 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8539 (match_operand:SI 4 "gpc_reg_operand" "r"))
8540 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8541 (match_operand:SI 5 "gpc_reg_operand" "r"))
8542 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8543 (match_operand:SI 6 "gpc_reg_operand" "r"))
8544 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8545 (match_operand:SI 7 "gpc_reg_operand" "r"))
8546 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8547 (match_operand:SI 8 "gpc_reg_operand" "r"))
8548 (set (mem:SI (plus:SI (match_dup 1) (const_int 24)))
8549 (match_operand:SI 9 "gpc_reg_operand" "r"))])]
8550 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 8"
8551 "{stsi|stswi} %2,%1,%O0"
8552 [(set_attr "type" "store")])
8554 (define_insn "*stmsi6"
8555 [(match_parallel 0 "store_multiple_operation"
8556 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8557 (match_operand:SI 2 "gpc_reg_operand" "r"))
8558 (clobber (match_scratch:SI 3 "X"))
8559 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8560 (match_operand:SI 4 "gpc_reg_operand" "r"))
8561 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8562 (match_operand:SI 5 "gpc_reg_operand" "r"))
8563 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8564 (match_operand:SI 6 "gpc_reg_operand" "r"))
8565 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8566 (match_operand:SI 7 "gpc_reg_operand" "r"))
8567 (set (mem:SI (plus:SI (match_dup 1) (const_int 20)))
8568 (match_operand:SI 8 "gpc_reg_operand" "r"))])]
8569 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 7"
8570 "{stsi|stswi} %2,%1,%O0"
8571 [(set_attr "type" "store")])
8573 (define_insn "*stmsi5"
8574 [(match_parallel 0 "store_multiple_operation"
8575 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8576 (match_operand:SI 2 "gpc_reg_operand" "r"))
8577 (clobber (match_scratch:SI 3 "X"))
8578 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8579 (match_operand:SI 4 "gpc_reg_operand" "r"))
8580 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8581 (match_operand:SI 5 "gpc_reg_operand" "r"))
8582 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8583 (match_operand:SI 6 "gpc_reg_operand" "r"))
8584 (set (mem:SI (plus:SI (match_dup 1) (const_int 16)))
8585 (match_operand:SI 7 "gpc_reg_operand" "r"))])]
8586 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 6"
8587 "{stsi|stswi} %2,%1,%O0"
8588 [(set_attr "type" "store")])
8590 (define_insn "*stmsi4"
8591 [(match_parallel 0 "store_multiple_operation"
8592 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8593 (match_operand:SI 2 "gpc_reg_operand" "r"))
8594 (clobber (match_scratch:SI 3 "X"))
8595 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8596 (match_operand:SI 4 "gpc_reg_operand" "r"))
8597 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8598 (match_operand:SI 5 "gpc_reg_operand" "r"))
8599 (set (mem:SI (plus:SI (match_dup 1) (const_int 12)))
8600 (match_operand:SI 6 "gpc_reg_operand" "r"))])]
8601 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 5"
8602 "{stsi|stswi} %2,%1,%O0"
8603 [(set_attr "type" "store")])
8605 (define_insn "*stmsi3"
8606 [(match_parallel 0 "store_multiple_operation"
8607 [(set (mem:SI (match_operand:SI 1 "gpc_reg_operand" "b"))
8608 (match_operand:SI 2 "gpc_reg_operand" "r"))
8609 (clobber (match_scratch:SI 3 "X"))
8610 (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
8611 (match_operand:SI 4 "gpc_reg_operand" "r"))
8612 (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
8613 (match_operand:SI 5 "gpc_reg_operand" "r"))])]
8614 "TARGET_STRING && !TARGET_POWER && XVECLEN (operands[0], 0) == 4"
8615 "{stsi|stswi} %2,%1,%O0"
8616 [(set_attr "type" "store")])
8618 (define_expand "setmemsi"
8619 [(parallel [(set (match_operand:BLK 0 "" "")
8620 (match_operand 2 "const_int_operand" ""))
8621 (use (match_operand:SI 1 "" ""))
8622 (use (match_operand:SI 3 "" ""))])]
8626 /* If value to set is not zero, use the library routine. */
8627 if (operands[2] != const0_rtx)
8630 if (expand_block_clear (operands))
8636 ;; String/block move insn.
8637 ;; Argument 0 is the destination
8638 ;; Argument 1 is the source
8639 ;; Argument 2 is the length
8640 ;; Argument 3 is the alignment
8642 (define_expand "movmemsi"
8643 [(parallel [(set (match_operand:BLK 0 "" "")
8644 (match_operand:BLK 1 "" ""))
8645 (use (match_operand:SI 2 "" ""))
8646 (use (match_operand:SI 3 "" ""))])]
8650 if (expand_block_move (operands))
8656 ;; Move up to 32 bytes at a time. The fixed registers are needed because the
8657 ;; register allocator doesn't have a clue about allocating 8 word registers.
8658 ;; rD/rS = r5 is preferred, efficient form.
8659 (define_expand "movmemsi_8reg"
8660 [(parallel [(set (match_operand 0 "" "")
8661 (match_operand 1 "" ""))
8662 (use (match_operand 2 "" ""))
8663 (use (match_operand 3 "" ""))
8664 (clobber (reg:SI 5))
8665 (clobber (reg:SI 6))
8666 (clobber (reg:SI 7))
8667 (clobber (reg:SI 8))
8668 (clobber (reg:SI 9))
8669 (clobber (reg:SI 10))
8670 (clobber (reg:SI 11))
8671 (clobber (reg:SI 12))
8672 (clobber (match_scratch:SI 4 ""))])]
8677 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8678 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8679 (use (match_operand:SI 2 "immediate_operand" "i"))
8680 (use (match_operand:SI 3 "immediate_operand" "i"))
8681 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8682 (clobber (reg:SI 6))
8683 (clobber (reg:SI 7))
8684 (clobber (reg:SI 8))
8685 (clobber (reg:SI 9))
8686 (clobber (reg:SI 10))
8687 (clobber (reg:SI 11))
8688 (clobber (reg:SI 12))
8689 (clobber (match_scratch:SI 5 "=q"))]
8690 "TARGET_STRING && TARGET_POWER
8691 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8692 || INTVAL (operands[2]) == 0)
8693 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8694 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8695 && REGNO (operands[4]) == 5"
8696 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8697 [(set_attr "type" "load")
8698 (set_attr "length" "8")])
8701 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8702 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8703 (use (match_operand:SI 2 "immediate_operand" "i"))
8704 (use (match_operand:SI 3 "immediate_operand" "i"))
8705 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8706 (clobber (reg:SI 6))
8707 (clobber (reg:SI 7))
8708 (clobber (reg:SI 8))
8709 (clobber (reg:SI 9))
8710 (clobber (reg:SI 10))
8711 (clobber (reg:SI 11))
8712 (clobber (reg:SI 12))
8713 (clobber (match_scratch:SI 5 "X"))]
8714 "TARGET_STRING && ! TARGET_POWER
8715 && ((INTVAL (operands[2]) > 24 && INTVAL (operands[2]) < 32)
8716 || INTVAL (operands[2]) == 0)
8717 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 12)
8718 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 12)
8719 && REGNO (operands[4]) == 5"
8720 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8721 [(set_attr "type" "load")
8722 (set_attr "length" "8")])
8724 ;; Move up to 24 bytes at a time. The fixed registers are needed because the
8725 ;; register allocator doesn't have a clue about allocating 6 word registers.
8726 ;; rD/rS = r5 is preferred, efficient form.
8727 (define_expand "movmemsi_6reg"
8728 [(parallel [(set (match_operand 0 "" "")
8729 (match_operand 1 "" ""))
8730 (use (match_operand 2 "" ""))
8731 (use (match_operand 3 "" ""))
8732 (clobber (reg:SI 5))
8733 (clobber (reg:SI 6))
8734 (clobber (reg:SI 7))
8735 (clobber (reg:SI 8))
8736 (clobber (reg:SI 9))
8737 (clobber (reg:SI 10))
8738 (clobber (match_scratch:SI 4 ""))])]
8743 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8744 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8745 (use (match_operand:SI 2 "immediate_operand" "i"))
8746 (use (match_operand:SI 3 "immediate_operand" "i"))
8747 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8748 (clobber (reg:SI 6))
8749 (clobber (reg:SI 7))
8750 (clobber (reg:SI 8))
8751 (clobber (reg:SI 9))
8752 (clobber (reg:SI 10))
8753 (clobber (match_scratch:SI 5 "=q"))]
8754 "TARGET_STRING && TARGET_POWER
8755 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24
8756 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8757 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8758 && REGNO (operands[4]) == 5"
8759 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8760 [(set_attr "type" "load")
8761 (set_attr "length" "8")])
8764 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8765 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8766 (use (match_operand:SI 2 "immediate_operand" "i"))
8767 (use (match_operand:SI 3 "immediate_operand" "i"))
8768 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8769 (clobber (reg:SI 6))
8770 (clobber (reg:SI 7))
8771 (clobber (reg:SI 8))
8772 (clobber (reg:SI 9))
8773 (clobber (reg:SI 10))
8774 (clobber (match_scratch:SI 5 "X"))]
8775 "TARGET_STRING && ! TARGET_POWER
8776 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 32
8777 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 10)
8778 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 10)
8779 && REGNO (operands[4]) == 5"
8780 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8781 [(set_attr "type" "load")
8782 (set_attr "length" "8")])
8784 ;; Move up to 16 bytes at a time, using 4 fixed registers to avoid spill
8785 ;; problems with TImode.
8786 ;; rD/rS = r5 is preferred, efficient form.
8787 (define_expand "movmemsi_4reg"
8788 [(parallel [(set (match_operand 0 "" "")
8789 (match_operand 1 "" ""))
8790 (use (match_operand 2 "" ""))
8791 (use (match_operand 3 "" ""))
8792 (clobber (reg:SI 5))
8793 (clobber (reg:SI 6))
8794 (clobber (reg:SI 7))
8795 (clobber (reg:SI 8))
8796 (clobber (match_scratch:SI 4 ""))])]
8801 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8802 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8803 (use (match_operand:SI 2 "immediate_operand" "i"))
8804 (use (match_operand:SI 3 "immediate_operand" "i"))
8805 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8806 (clobber (reg:SI 6))
8807 (clobber (reg:SI 7))
8808 (clobber (reg:SI 8))
8809 (clobber (match_scratch:SI 5 "=q"))]
8810 "TARGET_STRING && TARGET_POWER
8811 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
8812 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
8813 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
8814 && REGNO (operands[4]) == 5"
8815 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8816 [(set_attr "type" "load")
8817 (set_attr "length" "8")])
8820 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8821 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8822 (use (match_operand:SI 2 "immediate_operand" "i"))
8823 (use (match_operand:SI 3 "immediate_operand" "i"))
8824 (clobber (match_operand:SI 4 "gpc_reg_operand" "=r"))
8825 (clobber (reg:SI 6))
8826 (clobber (reg:SI 7))
8827 (clobber (reg:SI 8))
8828 (clobber (match_scratch:SI 5 "X"))]
8829 "TARGET_STRING && ! TARGET_POWER
8830 && INTVAL (operands[2]) > 8 && INTVAL (operands[2]) <= 16
8831 && (REGNO (operands[0]) < 5 || REGNO (operands[0]) > 8)
8832 && (REGNO (operands[1]) < 5 || REGNO (operands[1]) > 8)
8833 && REGNO (operands[4]) == 5"
8834 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8835 [(set_attr "type" "load")
8836 (set_attr "length" "8")])
8838 ;; Move up to 8 bytes at a time.
8839 (define_expand "movmemsi_2reg"
8840 [(parallel [(set (match_operand 0 "" "")
8841 (match_operand 1 "" ""))
8842 (use (match_operand 2 "" ""))
8843 (use (match_operand 3 "" ""))
8844 (clobber (match_scratch:DI 4 ""))
8845 (clobber (match_scratch:SI 5 ""))])]
8846 "TARGET_STRING && ! TARGET_POWERPC64"
8850 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8851 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8852 (use (match_operand:SI 2 "immediate_operand" "i"))
8853 (use (match_operand:SI 3 "immediate_operand" "i"))
8854 (clobber (match_scratch:DI 4 "=&r"))
8855 (clobber (match_scratch:SI 5 "=q"))]
8856 "TARGET_STRING && TARGET_POWER && ! TARGET_POWERPC64
8857 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
8858 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8859 [(set_attr "type" "load")
8860 (set_attr "length" "8")])
8863 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8864 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8865 (use (match_operand:SI 2 "immediate_operand" "i"))
8866 (use (match_operand:SI 3 "immediate_operand" "i"))
8867 (clobber (match_scratch:DI 4 "=&r"))
8868 (clobber (match_scratch:SI 5 "X"))]
8869 "TARGET_STRING && ! TARGET_POWER && ! TARGET_POWERPC64
8870 && INTVAL (operands[2]) > 4 && INTVAL (operands[2]) <= 8"
8871 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8872 [(set_attr "type" "load")
8873 (set_attr "length" "8")])
8875 ;; Move up to 4 bytes at a time.
8876 (define_expand "movmemsi_1reg"
8877 [(parallel [(set (match_operand 0 "" "")
8878 (match_operand 1 "" ""))
8879 (use (match_operand 2 "" ""))
8880 (use (match_operand 3 "" ""))
8881 (clobber (match_scratch:SI 4 ""))
8882 (clobber (match_scratch:SI 5 ""))])]
8887 [(set (mem:BLK (match_operand:SI 0 "gpc_reg_operand" "b"))
8888 (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b")))
8889 (use (match_operand:SI 2 "immediate_operand" "i"))
8890 (use (match_operand:SI 3 "immediate_operand" "i"))
8891 (clobber (match_scratch:SI 4 "=&r"))
8892 (clobber (match_scratch:SI 5 "=q"))]
8893 "TARGET_STRING && TARGET_POWER
8894 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
8895 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8896 [(set_attr "type" "load")
8897 (set_attr "length" "8")])
8900 [(set (mem:BLK (match_operand:P 0 "gpc_reg_operand" "b"))
8901 (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b")))
8902 (use (match_operand:SI 2 "immediate_operand" "i"))
8903 (use (match_operand:SI 3 "immediate_operand" "i"))
8904 (clobber (match_scratch:SI 4 "=&r"))
8905 (clobber (match_scratch:SI 5 "X"))]
8906 "TARGET_STRING && ! TARGET_POWER
8907 && INTVAL (operands[2]) > 0 && INTVAL (operands[2]) <= 4"
8908 "{lsi|lswi} %4,%1,%2\;{stsi|stswi} %4,%0,%2"
8909 [(set_attr "type" "load")
8910 (set_attr "length" "8")])
8912 ;; Define insns that do load or store with update. Some of these we can
8913 ;; get by using pre-decrement or pre-increment, but the hardware can also
8914 ;; do cases where the increment is not the size of the object.
8916 ;; In all these cases, we use operands 0 and 1 for the register being
8917 ;; incremented because those are the operands that local-alloc will
8918 ;; tie and these are the pair most likely to be tieable (and the ones
8919 ;; that will benefit the most).
8921 (define_insn "*movdi_update1"
8922 [(set (match_operand:DI 3 "gpc_reg_operand" "=r,r")
8923 (mem:DI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0,0")
8924 (match_operand:DI 2 "reg_or_aligned_short_operand" "r,I"))))
8925 (set (match_operand:DI 0 "gpc_reg_operand" "=b,b")
8926 (plus:DI (match_dup 1) (match_dup 2)))]
8927 "TARGET_POWERPC64 && TARGET_UPDATE"
8931 [(set_attr "type" "load_ux,load_u")])
8933 (define_insn "movdi_<mode>_update"
8934 [(set (mem:DI (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
8935 (match_operand:P 2 "reg_or_aligned_short_operand" "r,I")))
8936 (match_operand:DI 3 "gpc_reg_operand" "r,r"))
8937 (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
8938 (plus:P (match_dup 1) (match_dup 2)))]
8939 "TARGET_POWERPC64 && TARGET_UPDATE"
8943 [(set_attr "type" "store_ux,store_u")])
8945 (define_insn "*movsi_update1"
8946 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
8947 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8948 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
8949 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8950 (plus:SI (match_dup 1) (match_dup 2)))]
8953 {lux|lwzux} %3,%0,%2
8954 {lu|lwzu} %3,%2(%0)"
8955 [(set_attr "type" "load_ux,load_u")])
8957 (define_insn "*movsi_update2"
8958 [(set (match_operand:DI 3 "gpc_reg_operand" "=r")
8960 (mem:SI (plus:DI (match_operand:DI 1 "gpc_reg_operand" "0")
8961 (match_operand:DI 2 "gpc_reg_operand" "r")))))
8962 (set (match_operand:DI 0 "gpc_reg_operand" "=b")
8963 (plus:DI (match_dup 1) (match_dup 2)))]
8966 [(set_attr "type" "load_ext_ux")])
8968 (define_insn "movsi_update"
8969 [(set (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8970 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
8971 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
8972 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8973 (plus:SI (match_dup 1) (match_dup 2)))]
8976 {stux|stwux} %3,%0,%2
8977 {stu|stwu} %3,%2(%0)"
8978 [(set_attr "type" "store_ux,store_u")])
8980 (define_insn "*movhi_update1"
8981 [(set (match_operand:HI 3 "gpc_reg_operand" "=r,r")
8982 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8983 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
8984 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8985 (plus:SI (match_dup 1) (match_dup 2)))]
8990 [(set_attr "type" "load_ux,load_u")])
8992 (define_insn "*movhi_update2"
8993 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
8995 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
8996 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
8997 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
8998 (plus:SI (match_dup 1) (match_dup 2)))]
9003 [(set_attr "type" "load_ux,load_u")])
9005 (define_insn "*movhi_update3"
9006 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9008 (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9009 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9010 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9011 (plus:SI (match_dup 1) (match_dup 2)))]
9016 [(set_attr "type" "load_ext_ux,load_ext_u")])
9018 (define_insn "*movhi_update4"
9019 [(set (mem:HI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9020 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9021 (match_operand:HI 3 "gpc_reg_operand" "r,r"))
9022 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9023 (plus:SI (match_dup 1) (match_dup 2)))]
9028 [(set_attr "type" "store_ux,store_u")])
9030 (define_insn "*movqi_update1"
9031 [(set (match_operand:QI 3 "gpc_reg_operand" "=r,r")
9032 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9033 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9034 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9035 (plus:SI (match_dup 1) (match_dup 2)))]
9040 [(set_attr "type" "load_ux,load_u")])
9042 (define_insn "*movqi_update2"
9043 [(set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
9045 (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9046 (match_operand:SI 2 "reg_or_short_operand" "r,I")))))
9047 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9048 (plus:SI (match_dup 1) (match_dup 2)))]
9053 [(set_attr "type" "load_ux,load_u")])
9055 (define_insn "*movqi_update3"
9056 [(set (mem:QI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9057 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9058 (match_operand:QI 3 "gpc_reg_operand" "r,r"))
9059 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9060 (plus:SI (match_dup 1) (match_dup 2)))]
9065 [(set_attr "type" "store_ux,store_u")])
9067 (define_insn "*movsf_update1"
9068 [(set (match_operand:SF 3 "gpc_reg_operand" "=f,f")
9069 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9070 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9071 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9072 (plus:SI (match_dup 1) (match_dup 2)))]
9073 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9077 [(set_attr "type" "fpload_ux,fpload_u")])
9079 (define_insn "*movsf_update2"
9080 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9081 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9082 (match_operand:SF 3 "gpc_reg_operand" "f,f"))
9083 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9084 (plus:SI (match_dup 1) (match_dup 2)))]
9085 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9089 [(set_attr "type" "fpstore_ux,fpstore_u")])
9091 (define_insn "*movsf_update3"
9092 [(set (match_operand:SF 3 "gpc_reg_operand" "=r,r")
9093 (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9094 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9095 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9096 (plus:SI (match_dup 1) (match_dup 2)))]
9097 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9099 {lux|lwzux} %3,%0,%2
9100 {lu|lwzu} %3,%2(%0)"
9101 [(set_attr "type" "load_ux,load_u")])
9103 (define_insn "*movsf_update4"
9104 [(set (mem:SF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9105 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9106 (match_operand:SF 3 "gpc_reg_operand" "r,r"))
9107 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9108 (plus:SI (match_dup 1) (match_dup 2)))]
9109 "(TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_UPDATE"
9111 {stux|stwux} %3,%0,%2
9112 {stu|stwu} %3,%2(%0)"
9113 [(set_attr "type" "store_ux,store_u")])
9115 (define_insn "*movdf_update1"
9116 [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
9117 (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9118 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))
9119 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9120 (plus:SI (match_dup 1) (match_dup 2)))]
9121 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9125 [(set_attr "type" "fpload_ux,fpload_u")])
9127 (define_insn "*movdf_update2"
9128 [(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
9129 (match_operand:SI 2 "reg_or_short_operand" "r,I")))
9130 (match_operand:DF 3 "gpc_reg_operand" "f,f"))
9131 (set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
9132 (plus:SI (match_dup 1) (match_dup 2)))]
9133 "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_UPDATE"
9137 [(set_attr "type" "fpstore_ux,fpstore_u")])
9139 ;; Peephole to convert two consecutive FP loads or stores into lfq/stfq.
9141 (define_insn "*lfq_power2"
9142 [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
9143 (match_operand:TF 1 "memory_operand" ""))]
9145 && TARGET_HARD_FLOAT && TARGET_FPRS"
9149 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9150 (match_operand:DF 1 "memory_operand" ""))
9151 (set (match_operand:DF 2 "gpc_reg_operand" "")
9152 (match_operand:DF 3 "memory_operand" ""))]
9154 && TARGET_HARD_FLOAT && TARGET_FPRS
9155 && registers_ok_for_quad_peep (operands[0], operands[2])
9156 && mems_ok_for_quad_peep (operands[1], operands[3])"
9159 "operands[1] = widen_memory_access (operands[1], TFmode, 0);
9160 operands[0] = gen_rtx_REG (TFmode, REGNO (operands[0]));")
9162 (define_insn "*stfq_power2"
9163 [(set (match_operand:TF 0 "memory_operand" "")
9164 (match_operand:TF 1 "gpc_reg_operand" "f"))]
9166 && TARGET_HARD_FLOAT && TARGET_FPRS"
9171 [(set (match_operand:DF 0 "memory_operand" "")
9172 (match_operand:DF 1 "gpc_reg_operand" ""))
9173 (set (match_operand:DF 2 "memory_operand" "")
9174 (match_operand:DF 3 "gpc_reg_operand" ""))]
9176 && TARGET_HARD_FLOAT && TARGET_FPRS
9177 && registers_ok_for_quad_peep (operands[1], operands[3])
9178 && mems_ok_for_quad_peep (operands[0], operands[2])"
9181 "operands[0] = widen_memory_access (operands[0], TFmode, 0);
9182 operands[1] = gen_rtx_REG (TFmode, REGNO (operands[1]));")
9184 ;; after inserting conditional returns we can sometimes have
9185 ;; unnecessary register moves. Unfortunately we cannot have a
9186 ;; modeless peephole here, because some single SImode sets have early
9187 ;; clobber outputs. Although those sets expand to multi-ppc-insn
9188 ;; sequences, using get_attr_length here will smash the operands
9189 ;; array. Neither is there an early_cobbler_p predicate.
9191 [(set (match_operand:DF 0 "gpc_reg_operand" "")
9192 (match_operand:DF 1 "any_operand" ""))
9193 (set (match_operand:DF 2 "gpc_reg_operand" "")
9195 "peep2_reg_dead_p (2, operands[0])"
9196 [(set (match_dup 2) (match_dup 1))])
9199 [(set (match_operand:SF 0 "gpc_reg_operand" "")
9200 (match_operand:SF 1 "any_operand" ""))
9201 (set (match_operand:SF 2 "gpc_reg_operand" "")
9203 "peep2_reg_dead_p (2, operands[0])"
9204 [(set (match_dup 2) (match_dup 1))])
9209 ;; "b" output constraint here and on tls_ld to support tls linker optimization.
9210 (define_insn "tls_gd_32"
9211 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9212 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9213 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9215 "HAVE_AS_TLS && !TARGET_64BIT"
9216 "addi %0,%1,%2@got@tlsgd")
9218 (define_insn "tls_gd_64"
9219 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9220 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9221 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9223 "HAVE_AS_TLS && TARGET_64BIT"
9224 "addi %0,%1,%2@got@tlsgd")
9226 (define_insn "tls_ld_32"
9227 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9228 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")]
9230 "HAVE_AS_TLS && !TARGET_64BIT"
9231 "addi %0,%1,%&@got@tlsld")
9233 (define_insn "tls_ld_64"
9234 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9235 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")]
9237 "HAVE_AS_TLS && TARGET_64BIT"
9238 "addi %0,%1,%&@got@tlsld")
9240 (define_insn "tls_dtprel_32"
9241 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9242 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9243 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9245 "HAVE_AS_TLS && !TARGET_64BIT"
9246 "addi %0,%1,%2@dtprel")
9248 (define_insn "tls_dtprel_64"
9249 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9250 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9251 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9253 "HAVE_AS_TLS && TARGET_64BIT"
9254 "addi %0,%1,%2@dtprel")
9256 (define_insn "tls_dtprel_ha_32"
9257 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9258 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9259 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9260 UNSPEC_TLSDTPRELHA))]
9261 "HAVE_AS_TLS && !TARGET_64BIT"
9262 "addis %0,%1,%2@dtprel@ha")
9264 (define_insn "tls_dtprel_ha_64"
9265 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9266 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9267 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9268 UNSPEC_TLSDTPRELHA))]
9269 "HAVE_AS_TLS && TARGET_64BIT"
9270 "addis %0,%1,%2@dtprel@ha")
9272 (define_insn "tls_dtprel_lo_32"
9273 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9274 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9275 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9276 UNSPEC_TLSDTPRELLO))]
9277 "HAVE_AS_TLS && !TARGET_64BIT"
9278 "addi %0,%1,%2@dtprel@l")
9280 (define_insn "tls_dtprel_lo_64"
9281 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9282 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9283 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9284 UNSPEC_TLSDTPRELLO))]
9285 "HAVE_AS_TLS && TARGET_64BIT"
9286 "addi %0,%1,%2@dtprel@l")
9288 (define_insn "tls_got_dtprel_32"
9289 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9290 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9291 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9292 UNSPEC_TLSGOTDTPREL))]
9293 "HAVE_AS_TLS && !TARGET_64BIT"
9294 "lwz %0,%2@got@dtprel(%1)")
9296 (define_insn "tls_got_dtprel_64"
9297 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9298 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9299 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9300 UNSPEC_TLSGOTDTPREL))]
9301 "HAVE_AS_TLS && TARGET_64BIT"
9302 "ld %0,%2@got@dtprel(%1)")
9304 (define_insn "tls_tprel_32"
9305 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9306 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9307 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9309 "HAVE_AS_TLS && !TARGET_64BIT"
9310 "addi %0,%1,%2@tprel")
9312 (define_insn "tls_tprel_64"
9313 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9314 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9315 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9317 "HAVE_AS_TLS && TARGET_64BIT"
9318 "addi %0,%1,%2@tprel")
9320 (define_insn "tls_tprel_ha_32"
9321 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9322 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9323 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9324 UNSPEC_TLSTPRELHA))]
9325 "HAVE_AS_TLS && !TARGET_64BIT"
9326 "addis %0,%1,%2@tprel@ha")
9328 (define_insn "tls_tprel_ha_64"
9329 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9330 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9331 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9332 UNSPEC_TLSTPRELHA))]
9333 "HAVE_AS_TLS && TARGET_64BIT"
9334 "addis %0,%1,%2@tprel@ha")
9336 (define_insn "tls_tprel_lo_32"
9337 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9338 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9339 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9340 UNSPEC_TLSTPRELLO))]
9341 "HAVE_AS_TLS && !TARGET_64BIT"
9342 "addi %0,%1,%2@tprel@l")
9344 (define_insn "tls_tprel_lo_64"
9345 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9346 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9347 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9348 UNSPEC_TLSTPRELLO))]
9349 "HAVE_AS_TLS && TARGET_64BIT"
9350 "addi %0,%1,%2@tprel@l")
9352 ;; "b" output constraint here and on tls_tls input to support linker tls
9353 ;; optimization. The linker may edit the instructions emitted by a
9354 ;; tls_got_tprel/tls_tls pair to addis,addi.
9355 (define_insn "tls_got_tprel_32"
9356 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9357 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9358 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9359 UNSPEC_TLSGOTTPREL))]
9360 "HAVE_AS_TLS && !TARGET_64BIT"
9361 "lwz %0,%2@got@tprel(%1)")
9363 (define_insn "tls_got_tprel_64"
9364 [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
9365 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9366 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9367 UNSPEC_TLSGOTTPREL))]
9368 "HAVE_AS_TLS && TARGET_64BIT"
9369 "ld %0,%2@got@tprel(%1)")
9371 (define_insn "tls_tls_32"
9372 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9373 (unspec:SI [(match_operand:SI 1 "gpc_reg_operand" "b")
9374 (match_operand:SI 2 "rs6000_tls_symbol_ref" "")]
9376 "HAVE_AS_TLS && !TARGET_64BIT"
9379 (define_insn "tls_tls_64"
9380 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9381 (unspec:DI [(match_operand:DI 1 "gpc_reg_operand" "b")
9382 (match_operand:DI 2 "rs6000_tls_symbol_ref" "")]
9384 "HAVE_AS_TLS && TARGET_64BIT"
9387 ;; Next come insns related to the calling sequence.
9389 ;; First, an insn to allocate new stack space for dynamic use (e.g., alloca).
9390 ;; We move the back-chain and decrement the stack pointer.
9392 (define_expand "allocate_stack"
9393 [(set (match_operand 0 "gpc_reg_operand" "=r")
9394 (minus (reg 1) (match_operand 1 "reg_or_short_operand" "")))
9396 (minus (reg 1) (match_dup 1)))]
9399 { rtx chain = gen_reg_rtx (Pmode);
9400 rtx stack_bot = gen_rtx_MEM (Pmode, stack_pointer_rtx);
9403 emit_move_insn (chain, stack_bot);
9405 /* Check stack bounds if necessary. */
9406 if (current_function_limit_stack)
9409 available = expand_binop (Pmode, sub_optab,
9410 stack_pointer_rtx, stack_limit_rtx,
9411 NULL_RTX, 1, OPTAB_WIDEN);
9412 emit_insn (gen_cond_trap (LTU, available, operands[1], const0_rtx));
9415 if (GET_CODE (operands[1]) != CONST_INT
9416 || INTVAL (operands[1]) < -32767
9417 || INTVAL (operands[1]) > 32768)
9419 neg_op0 = gen_reg_rtx (Pmode);
9421 emit_insn (gen_negsi2 (neg_op0, operands[1]));
9423 emit_insn (gen_negdi2 (neg_op0, operands[1]));
9426 neg_op0 = GEN_INT (- INTVAL (operands[1]));
9429 emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update : gen_movdi_di_update))
9430 (stack_pointer_rtx, stack_pointer_rtx, neg_op0, chain));
9434 emit_insn ((* ((TARGET_32BIT) ? gen_addsi3 : gen_adddi3))
9435 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
9436 emit_move_insn (gen_rtx_MEM (Pmode, stack_pointer_rtx), chain);
9439 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
9443 ;; These patterns say how to save and restore the stack pointer. We need not
9444 ;; save the stack pointer at function level since we are careful to
9445 ;; preserve the backchain. At block level, we have to restore the backchain
9446 ;; when we restore the stack pointer.
9448 ;; For nonlocal gotos, we must save both the stack pointer and its
9449 ;; backchain and restore both. Note that in the nonlocal case, the
9450 ;; save area is a memory location.
9452 (define_expand "save_stack_function"
9453 [(match_operand 0 "any_operand" "")
9454 (match_operand 1 "any_operand" "")]
9458 (define_expand "restore_stack_function"
9459 [(match_operand 0 "any_operand" "")
9460 (match_operand 1 "any_operand" "")]
9464 (define_expand "restore_stack_block"
9465 [(use (match_operand 0 "register_operand" ""))
9466 (set (match_dup 2) (match_dup 3))
9467 (set (match_dup 0) (match_operand 1 "register_operand" ""))
9468 (set (match_dup 3) (match_dup 2))]
9472 operands[2] = gen_reg_rtx (Pmode);
9473 operands[3] = gen_rtx_MEM (Pmode, operands[0]);
9476 (define_expand "save_stack_nonlocal"
9477 [(match_operand 0 "memory_operand" "")
9478 (match_operand 1 "register_operand" "")]
9482 rtx temp = gen_reg_rtx (Pmode);
9483 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9485 /* Copy the backchain to the first word, sp to the second. */
9486 emit_move_insn (temp, gen_rtx_MEM (Pmode, operands[1]));
9487 emit_move_insn (adjust_address_nv (operands[0], Pmode, 0), temp);
9488 emit_move_insn (adjust_address_nv (operands[0], Pmode, units_per_word),
9493 (define_expand "restore_stack_nonlocal"
9494 [(match_operand 0 "register_operand" "")
9495 (match_operand 1 "memory_operand" "")]
9499 rtx temp = gen_reg_rtx (Pmode);
9500 int units_per_word = (TARGET_32BIT) ? 4 : 8;
9502 /* Restore the backchain from the first word, sp from the second. */
9503 emit_move_insn (temp,
9504 adjust_address_nv (operands[1], Pmode, 0));
9505 emit_move_insn (operands[0],
9506 adjust_address_nv (operands[1], Pmode, units_per_word));
9507 emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp);
9511 ;; TOC register handling.
9513 ;; Code to initialize the TOC register...
9515 (define_insn "load_toc_aix_si"
9516 [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9517 (unspec:SI [(const_int 0)] UNSPEC_TOC))
9519 "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
9523 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9524 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9525 operands[2] = gen_rtx_REG (Pmode, 2);
9526 return \"{l|lwz} %0,%1(%2)\";
9528 [(set_attr "type" "load")])
9530 (define_insn "load_toc_aix_di"
9531 [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
9532 (unspec:DI [(const_int 0)] UNSPEC_TOC))
9534 "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
9538 #ifdef TARGET_RELOCATABLE
9539 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\",
9540 !TARGET_MINIMAL_TOC || TARGET_RELOCATABLE);
9542 ASM_GENERATE_INTERNAL_LABEL (buf, \"LCTOC\", 1);
9545 strcat (buf, \"@toc\");
9546 operands[1] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
9547 operands[2] = gen_rtx_REG (Pmode, 2);
9548 return \"ld %0,%1(%2)\";
9550 [(set_attr "type" "load")])
9552 (define_insn "load_toc_v4_pic_si"
9553 [(set (match_operand:SI 0 "register_operand" "=l")
9554 (unspec:SI [(const_int 0)] UNSPEC_TOC))]
9555 "DEFAULT_ABI == ABI_V4 && flag_pic == 1 && TARGET_32BIT"
9556 "bl _GLOBAL_OFFSET_TABLE_@local-4"
9557 [(set_attr "type" "branch")
9558 (set_attr "length" "4")])
9560 (define_insn "load_toc_v4_PIC_1"
9561 [(set (match_operand:SI 0 "register_operand" "=l")
9562 (match_operand:SI 1 "immediate_operand" "s"))
9563 (use (unspec [(match_dup 1)] UNSPEC_TOC))]
9564 "TARGET_ELF && DEFAULT_ABI != ABI_AIX
9565 && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
9566 "bcl 20,31,%1\\n%1:"
9567 [(set_attr "type" "branch")
9568 (set_attr "length" "4")])
9570 (define_insn "load_toc_v4_PIC_1b"
9571 [(set (match_operand:SI 0 "register_operand" "=l")
9572 (unspec:SI [(match_operand:SI 1 "immediate_operand" "s")]
9574 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9575 "bcl 20,31,$+8\\n\\t.long %1-$"
9576 [(set_attr "type" "branch")
9577 (set_attr "length" "8")])
9579 (define_insn "load_toc_v4_PIC_2"
9580 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9581 (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9582 (minus:SI (match_operand:SI 2 "immediate_operand" "s")
9583 (match_operand:SI 3 "immediate_operand" "s")))))]
9584 "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
9585 "{l|lwz} %0,%2-%3(%1)"
9586 [(set_attr "type" "load")])
9588 (define_insn "load_toc_v4_PIC_3b"
9589 [(set (match_operand:SI 0 "gpc_reg_operand" "=b")
9590 (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r")
9592 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
9593 (match_operand:SI 3 "symbol_ref_operand" "s")))))]
9594 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
9595 "{cau|addis} %0,%1,%2-%3@ha")
9597 (define_insn "load_toc_v4_PIC_3c"
9598 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
9599 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
9600 (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
9601 (match_operand:SI 3 "symbol_ref_operand" "s"))))]
9602 "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
9603 "{cal|addi} %0,%1,%2-%3@l")
9605 ;; If the TOC is shared over a translation unit, as happens with all
9606 ;; the kinds of PIC that we support, we need to restore the TOC
9607 ;; pointer only when jumping over units of translation.
9608 ;; On Darwin, we need to reload the picbase.
9610 (define_expand "builtin_setjmp_receiver"
9611 [(use (label_ref (match_operand 0 "" "")))]
9612 "(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
9613 || (TARGET_TOC && TARGET_MINIMAL_TOC)
9614 || (DEFAULT_ABI == ABI_DARWIN && flag_pic)"
9618 if (DEFAULT_ABI == ABI_DARWIN)
9620 const char *picbase = machopic_function_base_name ();
9621 rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (picbase));
9622 rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
9626 ASM_GENERATE_INTERNAL_LABEL(tmplab, \"LSJR\",
9627 CODE_LABEL_NUMBER (operands[0]));
9628 tmplabrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
9630 emit_insn (gen_load_macho_picbase (picreg, tmplabrtx));
9631 emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplabrtx));
9635 rs6000_emit_load_toc_table (FALSE);
9639 ;; Elf specific ways of loading addresses for non-PIC code.
9640 ;; The output of this could be r0, but we make a very strong
9641 ;; preference for a base register because it will usually
9643 (define_insn "elf_high"
9644 [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r")
9645 (high:SI (match_operand 1 "" "")))]
9646 "TARGET_ELF && ! TARGET_64BIT"
9647 "{liu|lis} %0,%1@ha")
9649 (define_insn "elf_low"
9650 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
9651 (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
9652 (match_operand 2 "" "")))]
9653 "TARGET_ELF && ! TARGET_64BIT"
9655 {cal|la} %0,%2@l(%1)
9656 {ai|addic} %0,%1,%K2")
9658 ;; A function pointer under AIX is a pointer to a data area whose first word
9659 ;; contains the actual address of the function, whose second word contains a
9660 ;; pointer to its TOC, and whose third word contains a value to place in the
9661 ;; static chain register (r11). Note that if we load the static chain, our
9662 ;; "trampoline" need not have any executable code.
9664 (define_expand "call_indirect_aix32"
9666 (mem:SI (match_operand:SI 0 "gpc_reg_operand" "")))
9667 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9670 (mem:SI (plus:SI (match_dup 0)
9673 (mem:SI (plus:SI (match_dup 0)
9675 (parallel [(call (mem:SI (match_dup 2))
9676 (match_operand 1 "" ""))
9680 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9681 (clobber (scratch:SI))])]
9684 { operands[2] = gen_reg_rtx (SImode); }")
9686 (define_expand "call_indirect_aix64"
9688 (mem:DI (match_operand:DI 0 "gpc_reg_operand" "")))
9689 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9692 (mem:DI (plus:DI (match_dup 0)
9695 (mem:DI (plus:DI (match_dup 0)
9697 (parallel [(call (mem:SI (match_dup 2))
9698 (match_operand 1 "" ""))
9702 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9703 (clobber (scratch:SI))])]
9706 { operands[2] = gen_reg_rtx (DImode); }")
9708 (define_expand "call_value_indirect_aix32"
9710 (mem:SI (match_operand:SI 1 "gpc_reg_operand" "")))
9711 (set (mem:SI (plus:SI (reg:SI 1) (const_int 20)))
9714 (mem:SI (plus:SI (match_dup 1)
9717 (mem:SI (plus:SI (match_dup 1)
9719 (parallel [(set (match_operand 0 "" "")
9720 (call (mem:SI (match_dup 3))
9721 (match_operand 2 "" "")))
9725 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9726 (clobber (scratch:SI))])]
9729 { operands[3] = gen_reg_rtx (SImode); }")
9731 (define_expand "call_value_indirect_aix64"
9733 (mem:DI (match_operand:DI 1 "gpc_reg_operand" "")))
9734 (set (mem:DI (plus:DI (reg:DI 1) (const_int 40)))
9737 (mem:DI (plus:DI (match_dup 1)
9740 (mem:DI (plus:DI (match_dup 1)
9742 (parallel [(set (match_operand 0 "" "")
9743 (call (mem:SI (match_dup 3))
9744 (match_operand 2 "" "")))
9748 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
9749 (clobber (scratch:SI))])]
9752 { operands[3] = gen_reg_rtx (DImode); }")
9754 ;; Now the definitions for the call and call_value insns
9755 (define_expand "call"
9756 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
9757 (match_operand 1 "" ""))
9758 (use (match_operand 2 "" ""))
9759 (clobber (scratch:SI))])]
9764 if (MACHOPIC_INDIRECT)
9765 operands[0] = machopic_indirect_call_target (operands[0]);
9768 gcc_assert (GET_CODE (operands[0]) == MEM);
9769 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
9771 operands[0] = XEXP (operands[0], 0);
9773 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
9775 && GET_CODE (operands[0]) == SYMBOL_REF
9776 && !SYMBOL_REF_LOCAL_P (operands[0]))
9782 gen_rtx_CALL (VOIDmode,
9783 gen_rtx_MEM (SImode, operands[0]),
9785 gen_rtx_USE (VOIDmode, operands[2]),
9786 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
9787 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
9788 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
9792 if (GET_CODE (operands[0]) != SYMBOL_REF
9793 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
9794 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
9796 if (INTVAL (operands[2]) & CALL_LONG)
9797 operands[0] = rs6000_longcall_ref (operands[0]);
9799 switch (DEFAULT_ABI)
9803 operands[0] = force_reg (Pmode, operands[0]);
9807 /* AIX function pointers are really pointers to a three word
9809 emit_call_insn (TARGET_32BIT
9810 ? gen_call_indirect_aix32 (force_reg (SImode,
9813 : gen_call_indirect_aix64 (force_reg (DImode,
9824 (define_expand "call_value"
9825 [(parallel [(set (match_operand 0 "" "")
9826 (call (mem:SI (match_operand 1 "address_operand" ""))
9827 (match_operand 2 "" "")))
9828 (use (match_operand 3 "" ""))
9829 (clobber (scratch:SI))])]
9834 if (MACHOPIC_INDIRECT)
9835 operands[1] = machopic_indirect_call_target (operands[1]);
9838 gcc_assert (GET_CODE (operands[1]) == MEM);
9839 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
9841 operands[1] = XEXP (operands[1], 0);
9843 if (DEFAULT_ABI == ABI_V4 && TARGET_SECURE_PLT
9845 && GET_CODE (operands[1]) == SYMBOL_REF
9846 && !SYMBOL_REF_LOCAL_P (operands[1]))
9852 gen_rtx_SET (VOIDmode,
9854 gen_rtx_CALL (VOIDmode,
9855 gen_rtx_MEM (SImode,
9858 gen_rtx_USE (VOIDmode, operands[3]),
9859 gen_rtx_CLOBBER (VOIDmode, gen_rtx_SCRATCH (SImode)));
9860 call = emit_call_insn (gen_rtx_PARALLEL (VOIDmode, tmp));
9861 use_reg (&CALL_INSN_FUNCTION_USAGE (call), pic_offset_table_rtx);
9865 if (GET_CODE (operands[1]) != SYMBOL_REF
9866 || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
9867 || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
9869 if (INTVAL (operands[3]) & CALL_LONG)
9870 operands[1] = rs6000_longcall_ref (operands[1]);
9872 switch (DEFAULT_ABI)
9876 operands[1] = force_reg (Pmode, operands[1]);
9880 /* AIX function pointers are really pointers to a three word
9882 emit_call_insn (TARGET_32BIT
9883 ? gen_call_value_indirect_aix32 (operands[0],
9887 : gen_call_value_indirect_aix64 (operands[0],
9899 ;; Call to function in current module. No TOC pointer reload needed.
9900 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
9901 ;; either the function was not prototyped, or it was prototyped as a
9902 ;; variable argument function. It is > 0 if FP registers were passed
9903 ;; and < 0 if they were not.
9905 (define_insn "*call_local32"
9906 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
9907 (match_operand 1 "" "g,g"))
9908 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9909 (clobber (match_scratch:SI 3 "=l,l"))]
9910 "(INTVAL (operands[2]) & CALL_LONG) == 0"
9913 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9914 output_asm_insn (\"crxor 6,6,6\", operands);
9916 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9917 output_asm_insn (\"creqv 6,6,6\", operands);
9919 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9921 [(set_attr "type" "branch")
9922 (set_attr "length" "4,8")])
9924 (define_insn "*call_local64"
9925 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
9926 (match_operand 1 "" "g,g"))
9927 (use (match_operand:SI 2 "immediate_operand" "O,n"))
9928 (clobber (match_scratch:SI 3 "=l,l"))]
9929 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
9932 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
9933 output_asm_insn (\"crxor 6,6,6\", operands);
9935 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
9936 output_asm_insn (\"creqv 6,6,6\", operands);
9938 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z0@local\" : \"bl %z0\";
9940 [(set_attr "type" "branch")
9941 (set_attr "length" "4,8")])
9943 (define_insn "*call_value_local32"
9944 [(set (match_operand 0 "" "")
9945 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
9946 (match_operand 2 "" "g,g")))
9947 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9948 (clobber (match_scratch:SI 4 "=l,l"))]
9949 "(INTVAL (operands[3]) & CALL_LONG) == 0"
9952 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9953 output_asm_insn (\"crxor 6,6,6\", operands);
9955 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9956 output_asm_insn (\"creqv 6,6,6\", operands);
9958 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9960 [(set_attr "type" "branch")
9961 (set_attr "length" "4,8")])
9964 (define_insn "*call_value_local64"
9965 [(set (match_operand 0 "" "")
9966 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
9967 (match_operand 2 "" "g,g")))
9968 (use (match_operand:SI 3 "immediate_operand" "O,n"))
9969 (clobber (match_scratch:SI 4 "=l,l"))]
9970 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
9973 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
9974 output_asm_insn (\"crxor 6,6,6\", operands);
9976 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
9977 output_asm_insn (\"creqv 6,6,6\", operands);
9979 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"bl %z1@local\" : \"bl %z1\";
9981 [(set_attr "type" "branch")
9982 (set_attr "length" "4,8")])
9984 ;; Call to function which may be in another module. Restore the TOC
9985 ;; pointer (r2) after the call unless this is System V.
9986 ;; Operand2 is nonzero if we are using the V.4 calling sequence and
9987 ;; either the function was not prototyped, or it was prototyped as a
9988 ;; variable argument function. It is > 0 if FP registers were passed
9989 ;; and < 0 if they were not.
9991 (define_insn "*call_indirect_nonlocal_aix32"
9992 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l"))
9993 (match_operand 1 "" "g,g"))
9997 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
9998 (clobber (match_scratch:SI 2 "=l,l"))]
9999 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10000 "b%T0l\;{l|lwz} 2,20(1)"
10001 [(set_attr "type" "jmpreg")
10002 (set_attr "length" "8")])
10004 (define_insn "*call_nonlocal_aix32"
10005 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10006 (match_operand 1 "" "g"))
10007 (use (match_operand:SI 2 "immediate_operand" "O"))
10008 (clobber (match_scratch:SI 3 "=l"))]
10010 && DEFAULT_ABI == ABI_AIX
10011 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10013 [(set_attr "type" "branch")
10014 (set_attr "length" "8")])
10016 (define_insn "*call_indirect_nonlocal_aix64"
10017 [(call (mem:SI (match_operand:DI 0 "register_operand" "c,*l"))
10018 (match_operand 1 "" "g,g"))
10022 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10023 (clobber (match_scratch:SI 2 "=l,l"))]
10024 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10025 "b%T0l\;ld 2,40(1)"
10026 [(set_attr "type" "jmpreg")
10027 (set_attr "length" "8")])
10029 (define_insn "*call_nonlocal_aix64"
10030 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10031 (match_operand 1 "" "g"))
10032 (use (match_operand:SI 2 "immediate_operand" "O"))
10033 (clobber (match_scratch:SI 3 "=l"))]
10035 && DEFAULT_ABI == ABI_AIX
10036 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10038 [(set_attr "type" "branch")
10039 (set_attr "length" "8")])
10041 (define_insn "*call_value_indirect_nonlocal_aix32"
10042 [(set (match_operand 0 "" "")
10043 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l"))
10044 (match_operand 2 "" "g,g")))
10048 (mem:SI (plus:SI (reg:SI 1) (const_int 20))))
10049 (clobber (match_scratch:SI 3 "=l,l"))]
10050 "TARGET_32BIT && DEFAULT_ABI == ABI_AIX"
10051 "b%T1l\;{l|lwz} 2,20(1)"
10052 [(set_attr "type" "jmpreg")
10053 (set_attr "length" "8")])
10055 (define_insn "*call_value_nonlocal_aix32"
10056 [(set (match_operand 0 "" "")
10057 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10058 (match_operand 2 "" "g")))
10059 (use (match_operand:SI 3 "immediate_operand" "O"))
10060 (clobber (match_scratch:SI 4 "=l"))]
10062 && DEFAULT_ABI == ABI_AIX
10063 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10065 [(set_attr "type" "branch")
10066 (set_attr "length" "8")])
10068 (define_insn "*call_value_indirect_nonlocal_aix64"
10069 [(set (match_operand 0 "" "")
10070 (call (mem:SI (match_operand:DI 1 "register_operand" "c,*l"))
10071 (match_operand 2 "" "g,g")))
10075 (mem:DI (plus:DI (reg:DI 1) (const_int 40))))
10076 (clobber (match_scratch:SI 3 "=l,l"))]
10077 "TARGET_64BIT && DEFAULT_ABI == ABI_AIX"
10078 "b%T1l\;ld 2,40(1)"
10079 [(set_attr "type" "jmpreg")
10080 (set_attr "length" "8")])
10082 (define_insn "*call_value_nonlocal_aix64"
10083 [(set (match_operand 0 "" "")
10084 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10085 (match_operand 2 "" "g")))
10086 (use (match_operand:SI 3 "immediate_operand" "O"))
10087 (clobber (match_scratch:SI 4 "=l"))]
10089 && DEFAULT_ABI == ABI_AIX
10090 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10092 [(set_attr "type" "branch")
10093 (set_attr "length" "8")])
10095 ;; A function pointer under System V is just a normal pointer
10096 ;; operands[0] is the function pointer
10097 ;; operands[1] is the stack size to clean up
10098 ;; operands[2] is the value FUNCTION_ARG returns for the VOID argument
10099 ;; which indicates how to set cr1
10101 (define_insn "*call_indirect_nonlocal_sysv"
10102 [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
10103 (match_operand 1 "" "g,g,g,g"))
10104 (use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
10105 (clobber (match_scratch:SI 3 "=l,l,l,l"))]
10106 "DEFAULT_ABI == ABI_V4
10107 || DEFAULT_ABI == ABI_DARWIN"
10109 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10110 output_asm_insn ("crxor 6,6,6", operands);
10112 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10113 output_asm_insn ("creqv 6,6,6", operands);
10117 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10118 (set_attr "length" "4,4,8,8")])
10120 (define_insn "*call_nonlocal_sysv"
10121 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10122 (match_operand 1 "" "g,g"))
10123 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10124 (clobber (match_scratch:SI 3 "=l,l"))]
10125 "(DEFAULT_ABI == ABI_DARWIN
10126 || (DEFAULT_ABI == ABI_V4
10127 && (INTVAL (operands[2]) & CALL_LONG) == 0))"
10129 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10130 output_asm_insn ("crxor 6,6,6", operands);
10132 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10133 output_asm_insn ("creqv 6,6,6", operands);
10136 return output_call(insn, operands, 0, 2);
10138 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10140 if (TARGET_SECURE_PLT && flag_pic == 2)
10141 /* The magic 32768 offset here and in the other sysv call insns
10142 corresponds to the offset of r30 in .got2, as given by LCTOC1.
10143 See sysv4.h:toc_section. */
10144 return "bl %z0+32768@plt";
10146 return "bl %z0@plt";
10152 [(set_attr "type" "branch,branch")
10153 (set_attr "length" "4,8")])
10155 (define_insn "*call_value_indirect_nonlocal_sysv"
10156 [(set (match_operand 0 "" "")
10157 (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
10158 (match_operand 2 "" "g,g,g,g")))
10159 (use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
10160 (clobber (match_scratch:SI 4 "=l,l,l,l"))]
10161 "DEFAULT_ABI == ABI_V4
10162 || DEFAULT_ABI == ABI_DARWIN"
10164 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10165 output_asm_insn ("crxor 6,6,6", operands);
10167 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10168 output_asm_insn ("creqv 6,6,6", operands);
10172 [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
10173 (set_attr "length" "4,4,8,8")])
10175 (define_insn "*call_value_nonlocal_sysv"
10176 [(set (match_operand 0 "" "")
10177 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10178 (match_operand 2 "" "g,g")))
10179 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10180 (clobber (match_scratch:SI 4 "=l,l"))]
10181 "(DEFAULT_ABI == ABI_DARWIN
10182 || (DEFAULT_ABI == ABI_V4
10183 && (INTVAL (operands[3]) & CALL_LONG) == 0))"
10185 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10186 output_asm_insn ("crxor 6,6,6", operands);
10188 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10189 output_asm_insn ("creqv 6,6,6", operands);
10192 return output_call(insn, operands, 1, 3);
10194 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10196 if (TARGET_SECURE_PLT && flag_pic == 2)
10197 return "bl %z1+32768@plt";
10199 return "bl %z1@plt";
10205 [(set_attr "type" "branch,branch")
10206 (set_attr "length" "4,8")])
10208 ;; Call subroutine returning any type.
10209 (define_expand "untyped_call"
10210 [(parallel [(call (match_operand 0 "" "")
10212 (match_operand 1 "" "")
10213 (match_operand 2 "" "")])]
10219 emit_call_insn (GEN_CALL (operands[0], const0_rtx, const0_rtx, const0_rtx));
10221 for (i = 0; i < XVECLEN (operands[2], 0); i++)
10223 rtx set = XVECEXP (operands[2], 0, i);
10224 emit_move_insn (SET_DEST (set), SET_SRC (set));
10227 /* The optimizer does not know that the call sets the function value
10228 registers we stored in the result block. We avoid problems by
10229 claiming that all hard registers are used and clobbered at this
10231 emit_insn (gen_blockage ());
10236 ;; sibling call patterns
10237 (define_expand "sibcall"
10238 [(parallel [(call (mem:SI (match_operand 0 "address_operand" ""))
10239 (match_operand 1 "" ""))
10240 (use (match_operand 2 "" ""))
10241 (use (match_operand 3 "" ""))
10247 if (MACHOPIC_INDIRECT)
10248 operands[0] = machopic_indirect_call_target (operands[0]);
10251 gcc_assert (GET_CODE (operands[0]) == MEM);
10252 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
10254 operands[0] = XEXP (operands[0], 0);
10255 operands[3] = gen_reg_rtx (SImode);
10259 ;; this and similar patterns must be marked as using LR, otherwise
10260 ;; dataflow will try to delete the store into it. This is true
10261 ;; even when the actual reg to jump to is in CTR, when LR was
10262 ;; saved and restored around the PIC-setting BCL.
10263 (define_insn "*sibcall_local32"
10264 [(call (mem:SI (match_operand:SI 0 "current_file_function_operand" "s,s"))
10265 (match_operand 1 "" "g,g"))
10266 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10267 (use (match_operand:SI 3 "register_operand" "l,l"))
10269 "(INTVAL (operands[2]) & CALL_LONG) == 0"
10272 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10273 output_asm_insn (\"crxor 6,6,6\", operands);
10275 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10276 output_asm_insn (\"creqv 6,6,6\", operands);
10278 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10280 [(set_attr "type" "branch")
10281 (set_attr "length" "4,8")])
10283 (define_insn "*sibcall_local64"
10284 [(call (mem:SI (match_operand:DI 0 "current_file_function_operand" "s,s"))
10285 (match_operand 1 "" "g,g"))
10286 (use (match_operand:SI 2 "immediate_operand" "O,n"))
10287 (use (match_operand:SI 3 "register_operand" "l,l"))
10289 "TARGET_64BIT && (INTVAL (operands[2]) & CALL_LONG) == 0"
10292 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10293 output_asm_insn (\"crxor 6,6,6\", operands);
10295 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10296 output_asm_insn (\"creqv 6,6,6\", operands);
10298 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z0@local\" : \"b %z0\";
10300 [(set_attr "type" "branch")
10301 (set_attr "length" "4,8")])
10303 (define_insn "*sibcall_value_local32"
10304 [(set (match_operand 0 "" "")
10305 (call (mem:SI (match_operand:SI 1 "current_file_function_operand" "s,s"))
10306 (match_operand 2 "" "g,g")))
10307 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10308 (use (match_operand:SI 4 "register_operand" "l,l"))
10310 "(INTVAL (operands[3]) & CALL_LONG) == 0"
10313 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10314 output_asm_insn (\"crxor 6,6,6\", operands);
10316 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10317 output_asm_insn (\"creqv 6,6,6\", operands);
10319 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10321 [(set_attr "type" "branch")
10322 (set_attr "length" "4,8")])
10325 (define_insn "*sibcall_value_local64"
10326 [(set (match_operand 0 "" "")
10327 (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
10328 (match_operand 2 "" "g,g")))
10329 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10330 (use (match_operand:SI 4 "register_operand" "l,l"))
10332 "TARGET_64BIT && (INTVAL (operands[3]) & CALL_LONG) == 0"
10335 if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
10336 output_asm_insn (\"crxor 6,6,6\", operands);
10338 else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
10339 output_asm_insn (\"creqv 6,6,6\", operands);
10341 return (DEFAULT_ABI == ABI_V4 && flag_pic) ? \"b %z1@local\" : \"b %z1\";
10343 [(set_attr "type" "branch")
10344 (set_attr "length" "4,8")])
10346 (define_insn "*sibcall_nonlocal_aix32"
10347 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
10348 (match_operand 1 "" "g"))
10349 (use (match_operand:SI 2 "immediate_operand" "O"))
10350 (use (match_operand:SI 3 "register_operand" "l"))
10353 && DEFAULT_ABI == ABI_AIX
10354 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10356 [(set_attr "type" "branch")
10357 (set_attr "length" "4")])
10359 (define_insn "*sibcall_nonlocal_aix64"
10360 [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
10361 (match_operand 1 "" "g"))
10362 (use (match_operand:SI 2 "immediate_operand" "O"))
10363 (use (match_operand:SI 3 "register_operand" "l"))
10366 && DEFAULT_ABI == ABI_AIX
10367 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10369 [(set_attr "type" "branch")
10370 (set_attr "length" "4")])
10372 (define_insn "*sibcall_value_nonlocal_aix32"
10373 [(set (match_operand 0 "" "")
10374 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
10375 (match_operand 2 "" "g")))
10376 (use (match_operand:SI 3 "immediate_operand" "O"))
10377 (use (match_operand:SI 4 "register_operand" "l"))
10380 && DEFAULT_ABI == ABI_AIX
10381 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10383 [(set_attr "type" "branch")
10384 (set_attr "length" "4")])
10386 (define_insn "*sibcall_value_nonlocal_aix64"
10387 [(set (match_operand 0 "" "")
10388 (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
10389 (match_operand 2 "" "g")))
10390 (use (match_operand:SI 3 "immediate_operand" "O"))
10391 (use (match_operand:SI 4 "register_operand" "l"))
10394 && DEFAULT_ABI == ABI_AIX
10395 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10397 [(set_attr "type" "branch")
10398 (set_attr "length" "4")])
10400 (define_insn "*sibcall_nonlocal_sysv"
10401 [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
10402 (match_operand 1 "" ""))
10403 (use (match_operand 2 "immediate_operand" "O,n"))
10404 (use (match_operand:SI 3 "register_operand" "l,l"))
10406 "(DEFAULT_ABI == ABI_DARWIN
10407 || DEFAULT_ABI == ABI_V4)
10408 && (INTVAL (operands[2]) & CALL_LONG) == 0"
10411 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10412 output_asm_insn (\"crxor 6,6,6\", operands);
10414 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10415 output_asm_insn (\"creqv 6,6,6\", operands);
10417 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10419 if (TARGET_SECURE_PLT && flag_pic == 2)
10420 return \"b %z0+32768@plt\";
10422 return \"b %z0@plt\";
10427 [(set_attr "type" "branch,branch")
10428 (set_attr "length" "4,8")])
10430 (define_expand "sibcall_value"
10431 [(parallel [(set (match_operand 0 "register_operand" "")
10432 (call (mem:SI (match_operand 1 "address_operand" ""))
10433 (match_operand 2 "" "")))
10434 (use (match_operand 3 "" ""))
10435 (use (match_operand 4 "" ""))
10441 if (MACHOPIC_INDIRECT)
10442 operands[1] = machopic_indirect_call_target (operands[1]);
10445 gcc_assert (GET_CODE (operands[1]) == MEM);
10446 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
10448 operands[1] = XEXP (operands[1], 0);
10449 operands[4] = gen_reg_rtx (SImode);
10453 (define_insn "*sibcall_value_nonlocal_sysv"
10454 [(set (match_operand 0 "" "")
10455 (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
10456 (match_operand 2 "" "")))
10457 (use (match_operand:SI 3 "immediate_operand" "O,n"))
10458 (use (match_operand:SI 4 "register_operand" "l,l"))
10460 "(DEFAULT_ABI == ABI_DARWIN
10461 || DEFAULT_ABI == ABI_V4)
10462 && (INTVAL (operands[3]) & CALL_LONG) == 0"
10465 if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
10466 output_asm_insn (\"crxor 6,6,6\", operands);
10468 else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
10469 output_asm_insn (\"creqv 6,6,6\", operands);
10471 if (DEFAULT_ABI == ABI_V4 && flag_pic)
10473 if (TARGET_SECURE_PLT && flag_pic == 2)
10474 return \"b %z1+32768@plt\";
10476 return \"b %z1@plt\";
10481 [(set_attr "type" "branch,branch")
10482 (set_attr "length" "4,8")])
10484 (define_expand "sibcall_epilogue"
10485 [(use (const_int 0))]
10486 "TARGET_SCHED_PROLOG"
10489 rs6000_emit_epilogue (TRUE);
10493 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
10494 ;; all of memory. This blocks insns from being moved across this point.
10496 (define_insn "blockage"
10497 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCK)]
10501 ;; Compare insns are next. Note that the RS/6000 has two types of compares,
10502 ;; signed & unsigned, and one type of branch.
10504 ;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
10505 ;; insns, and branches. We store the operands of compares until we see
10507 (define_expand "cmp<mode>"
10509 (compare (match_operand:GPR 0 "gpc_reg_operand" "")
10510 (match_operand:GPR 1 "reg_or_short_operand" "")))]
10514 /* Take care of the possibility that operands[1] might be negative but
10515 this might be a logical operation. That insn doesn't exist. */
10516 if (GET_CODE (operands[1]) == CONST_INT
10517 && INTVAL (operands[1]) < 0)
10518 operands[1] = force_reg (<MODE>mode, operands[1]);
10520 rs6000_compare_op0 = operands[0];
10521 rs6000_compare_op1 = operands[1];
10522 rs6000_compare_fp_p = 0;
10526 (define_expand "cmp<mode>"
10527 [(set (cc0) (compare (match_operand:FP 0 "gpc_reg_operand" "")
10528 (match_operand:FP 1 "gpc_reg_operand" "")))]
10532 rs6000_compare_op0 = operands[0];
10533 rs6000_compare_op1 = operands[1];
10534 rs6000_compare_fp_p = 1;
10538 (define_expand "beq"
10539 [(use (match_operand 0 "" ""))]
10541 "{ rs6000_emit_cbranch (EQ, operands[0]); DONE; }")
10543 (define_expand "bne"
10544 [(use (match_operand 0 "" ""))]
10546 "{ rs6000_emit_cbranch (NE, operands[0]); DONE; }")
10548 (define_expand "bge"
10549 [(use (match_operand 0 "" ""))]
10551 "{ rs6000_emit_cbranch (GE, operands[0]); DONE; }")
10553 (define_expand "bgt"
10554 [(use (match_operand 0 "" ""))]
10556 "{ rs6000_emit_cbranch (GT, operands[0]); DONE; }")
10558 (define_expand "ble"
10559 [(use (match_operand 0 "" ""))]
10561 "{ rs6000_emit_cbranch (LE, operands[0]); DONE; }")
10563 (define_expand "blt"
10564 [(use (match_operand 0 "" ""))]
10566 "{ rs6000_emit_cbranch (LT, operands[0]); DONE; }")
10568 (define_expand "bgeu"
10569 [(use (match_operand 0 "" ""))]
10571 "{ rs6000_emit_cbranch (GEU, operands[0]); DONE; }")
10573 (define_expand "bgtu"
10574 [(use (match_operand 0 "" ""))]
10576 "{ rs6000_emit_cbranch (GTU, operands[0]); DONE; }")
10578 (define_expand "bleu"
10579 [(use (match_operand 0 "" ""))]
10581 "{ rs6000_emit_cbranch (LEU, operands[0]); DONE; }")
10583 (define_expand "bltu"
10584 [(use (match_operand 0 "" ""))]
10586 "{ rs6000_emit_cbranch (LTU, operands[0]); DONE; }")
10588 (define_expand "bunordered"
10589 [(use (match_operand 0 "" ""))]
10590 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10591 "{ rs6000_emit_cbranch (UNORDERED, operands[0]); DONE; }")
10593 (define_expand "bordered"
10594 [(use (match_operand 0 "" ""))]
10595 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10596 "{ rs6000_emit_cbranch (ORDERED, operands[0]); DONE; }")
10598 (define_expand "buneq"
10599 [(use (match_operand 0 "" ""))]
10601 "{ rs6000_emit_cbranch (UNEQ, operands[0]); DONE; }")
10603 (define_expand "bunge"
10604 [(use (match_operand 0 "" ""))]
10606 "{ rs6000_emit_cbranch (UNGE, operands[0]); DONE; }")
10608 (define_expand "bungt"
10609 [(use (match_operand 0 "" ""))]
10611 "{ rs6000_emit_cbranch (UNGT, operands[0]); DONE; }")
10613 (define_expand "bunle"
10614 [(use (match_operand 0 "" ""))]
10616 "{ rs6000_emit_cbranch (UNLE, operands[0]); DONE; }")
10618 (define_expand "bunlt"
10619 [(use (match_operand 0 "" ""))]
10621 "{ rs6000_emit_cbranch (UNLT, operands[0]); DONE; }")
10623 (define_expand "bltgt"
10624 [(use (match_operand 0 "" ""))]
10626 "{ rs6000_emit_cbranch (LTGT, operands[0]); DONE; }")
10628 ;; For SNE, we would prefer that the xor/abs sequence be used for integers.
10629 ;; For SEQ, likewise, except that comparisons with zero should be done
10630 ;; with an scc insns. However, due to the order that combine see the
10631 ;; resulting insns, we must, in fact, allow SEQ for integers. Fail in
10632 ;; the cases we don't want to handle.
10633 (define_expand "seq"
10634 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10636 "{ rs6000_emit_sCOND (EQ, operands[0]); DONE; }")
10638 (define_expand "sne"
10639 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10643 if (! rs6000_compare_fp_p)
10646 rs6000_emit_sCOND (NE, operands[0]);
10650 ;; A >= 0 is best done the portable way for A an integer.
10651 (define_expand "sge"
10652 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10656 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10659 rs6000_emit_sCOND (GE, operands[0]);
10663 ;; A > 0 is best done using the portable sequence, so fail in that case.
10664 (define_expand "sgt"
10665 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10669 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10672 rs6000_emit_sCOND (GT, operands[0]);
10676 ;; A <= 0 is best done the portable way for A an integer.
10677 (define_expand "sle"
10678 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10682 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10685 rs6000_emit_sCOND (LE, operands[0]);
10689 ;; A < 0 is best done in the portable way for A an integer.
10690 (define_expand "slt"
10691 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10695 if (! rs6000_compare_fp_p && rs6000_compare_op1 == const0_rtx)
10698 rs6000_emit_sCOND (LT, operands[0]);
10702 (define_expand "sgeu"
10703 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10705 "{ rs6000_emit_sCOND (GEU, operands[0]); DONE; }")
10707 (define_expand "sgtu"
10708 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10710 "{ rs6000_emit_sCOND (GTU, operands[0]); DONE; }")
10712 (define_expand "sleu"
10713 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10715 "{ rs6000_emit_sCOND (LEU, operands[0]); DONE; }")
10717 (define_expand "sltu"
10718 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10720 "{ rs6000_emit_sCOND (LTU, operands[0]); DONE; }")
10722 (define_expand "sunordered"
10723 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10724 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10725 "{ rs6000_emit_sCOND (UNORDERED, operands[0]); DONE; }")
10727 (define_expand "sordered"
10728 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10729 "! (TARGET_HARD_FLOAT && TARGET_E500 && !TARGET_FPRS)"
10730 "{ rs6000_emit_sCOND (ORDERED, operands[0]); DONE; }")
10732 (define_expand "suneq"
10733 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10735 "{ rs6000_emit_sCOND (UNEQ, operands[0]); DONE; }")
10737 (define_expand "sunge"
10738 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10740 "{ rs6000_emit_sCOND (UNGE, operands[0]); DONE; }")
10742 (define_expand "sungt"
10743 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10745 "{ rs6000_emit_sCOND (UNGT, operands[0]); DONE; }")
10747 (define_expand "sunle"
10748 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10750 "{ rs6000_emit_sCOND (UNLE, operands[0]); DONE; }")
10752 (define_expand "sunlt"
10753 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10755 "{ rs6000_emit_sCOND (UNLT, operands[0]); DONE; }")
10757 (define_expand "sltgt"
10758 [(clobber (match_operand:SI 0 "gpc_reg_operand" ""))]
10760 "{ rs6000_emit_sCOND (LTGT, operands[0]); DONE; }")
10762 (define_expand "stack_protect_set"
10763 [(match_operand 0 "memory_operand" "")
10764 (match_operand 1 "memory_operand" "")]
10767 #ifdef TARGET_THREAD_SSP_OFFSET
10768 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
10769 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
10770 operands[1] = gen_rtx_MEM (Pmode, addr);
10773 emit_insn (gen_stack_protect_setdi (operands[0], operands[1]));
10775 emit_insn (gen_stack_protect_setsi (operands[0], operands[1]));
10779 (define_insn "stack_protect_setsi"
10780 [(set (match_operand:SI 0 "memory_operand" "=m")
10781 (unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
10782 (set (match_scratch:SI 2 "=&r") (const_int 0))]
10784 "{l%U1%X1|lwz%U1%X1} %2,%1\;{st%U0%X0|stw%U0%X0} %2,%0\;{lil|li} %2,0"
10785 [(set_attr "type" "three")
10786 (set_attr "length" "12")])
10788 (define_insn "stack_protect_setdi"
10789 [(set (match_operand:DI 0 "memory_operand" "=m")
10790 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
10791 (set (match_scratch:DI 2 "=&r") (const_int 0))]
10793 "ld%U1%X1 %2,%1\;std%U0%X0 %2,%0\;{lil|li} %2,0"
10794 [(set_attr "type" "three")
10795 (set_attr "length" "12")])
10797 (define_expand "stack_protect_test"
10798 [(match_operand 0 "memory_operand" "")
10799 (match_operand 1 "memory_operand" "")
10800 (match_operand 2 "" "")]
10803 #ifdef TARGET_THREAD_SSP_OFFSET
10804 rtx tlsreg = gen_rtx_REG (Pmode, TARGET_64BIT ? 13 : 2);
10805 rtx addr = gen_rtx_PLUS (Pmode, tlsreg, GEN_INT (TARGET_THREAD_SSP_OFFSET));
10806 operands[1] = gen_rtx_MEM (Pmode, addr);
10808 rs6000_compare_op0 = operands[0];
10809 rs6000_compare_op1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
10811 rs6000_compare_fp_p = 0;
10812 emit_jump_insn (gen_beq (operands[2]));
10816 (define_insn "stack_protect_testsi"
10817 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
10818 (unspec:CCEQ [(match_operand:SI 1 "memory_operand" "m,m")
10819 (match_operand:SI 2 "memory_operand" "m,m")]
10821 (clobber (match_scratch:SI 3 "=&r,&r"))
10822 (set (match_scratch:SI 4 "=r,r") (const_int 0))]
10825 {l%U1%X1|lwz%U1%X1} %3,%1\;{l%U2%X2|lwz%U2%X2} %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
10826 {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"
10827 [(set_attr "length" "16,20")])
10829 (define_insn "stack_protect_testdi"
10830 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=x,?y")
10831 (unspec:CCEQ [(match_operand:DI 1 "memory_operand" "m,m")
10832 (match_operand:DI 2 "memory_operand" "m,m")]
10834 (clobber (match_scratch:DI 3 "=&r,&r"))
10835 (set (match_scratch:DI 4 "=r,r") (const_int 0))]
10838 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;xor. %3,%3,%4\;{lil|li} %4,0
10839 ld%U1%X1 %3,%1\;ld%U2%X2 %4,%2\;cmpld %0,%3,%4\;{lil|li} %3,0\;{lil|li} %4,0"
10840 [(set_attr "length" "16,20")])
10843 ;; Here are the actual compare insns.
10844 (define_insn "*cmp<mode>_internal1"
10845 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
10846 (compare:CC (match_operand:GPR 1 "gpc_reg_operand" "r")
10847 (match_operand:GPR 2 "reg_or_short_operand" "rI")))]
10849 "{cmp%I2|cmp<wd>%I2} %0,%1,%2"
10850 [(set_attr "type" "cmp")])
10852 ;; If we are comparing a register for equality with a large constant,
10853 ;; we can do this with an XOR followed by a compare. But we need a scratch
10854 ;; register for the result of the XOR.
10857 [(set (match_operand:CC 0 "cc_reg_operand" "")
10858 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10859 (match_operand:SI 2 "non_short_cint_operand" "")))
10860 (clobber (match_operand:SI 3 "gpc_reg_operand" ""))]
10861 "find_single_use (operands[0], insn, 0)
10862 && (GET_CODE (*find_single_use (operands[0], insn, 0)) == EQ
10863 || GET_CODE (*find_single_use (operands[0], insn, 0)) == NE)"
10864 [(set (match_dup 3) (xor:SI (match_dup 1) (match_dup 4)))
10865 (set (match_dup 0) (compare:CC (match_dup 3) (match_dup 5)))]
10868 /* Get the constant we are comparing against, C, and see what it looks like
10869 sign-extended to 16 bits. Then see what constant could be XOR'ed
10870 with C to get the sign-extended value. */
10872 HOST_WIDE_INT c = INTVAL (operands[2]);
10873 HOST_WIDE_INT sextc = ((c & 0xffff) ^ 0x8000) - 0x8000;
10874 HOST_WIDE_INT xorv = c ^ sextc;
10876 operands[4] = GEN_INT (xorv);
10877 operands[5] = GEN_INT (sextc);
10880 (define_insn "*cmpsi_internal2"
10881 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10882 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10883 (match_operand:SI 2 "reg_or_u_short_operand" "rK")))]
10885 "{cmpl%I2|cmplw%I2} %0,%1,%b2"
10886 [(set_attr "type" "cmp")])
10888 (define_insn "*cmpdi_internal2"
10889 [(set (match_operand:CCUNS 0 "cc_reg_operand" "=y")
10890 (compare:CCUNS (match_operand:DI 1 "gpc_reg_operand" "r")
10891 (match_operand:DI 2 "reg_or_u_short_operand" "rK")))]
10893 "cmpld%I2 %0,%1,%b2"
10894 [(set_attr "type" "cmp")])
10896 ;; The following two insns don't exist as single insns, but if we provide
10897 ;; them, we can swap an add and compare, which will enable us to overlap more
10898 ;; of the required delay between a compare and branch. We generate code for
10899 ;; them by splitting.
10902 [(set (match_operand:CC 3 "cc_reg_operand" "=y")
10903 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "r")
10904 (match_operand:SI 2 "short_cint_operand" "i")))
10905 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10906 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10909 [(set_attr "length" "8")])
10912 [(set (match_operand:CCUNS 3 "cc_reg_operand" "=y")
10913 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "r")
10914 (match_operand:SI 2 "u_short_cint_operand" "i")))
10915 (set (match_operand:SI 0 "gpc_reg_operand" "=r")
10916 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "i")))]
10919 [(set_attr "length" "8")])
10922 [(set (match_operand:CC 3 "cc_reg_operand" "")
10923 (compare:CC (match_operand:SI 1 "gpc_reg_operand" "")
10924 (match_operand:SI 2 "short_cint_operand" "")))
10925 (set (match_operand:SI 0 "gpc_reg_operand" "")
10926 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10928 [(set (match_dup 3) (compare:CC (match_dup 1) (match_dup 2)))
10929 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10932 [(set (match_operand:CCUNS 3 "cc_reg_operand" "")
10933 (compare:CCUNS (match_operand:SI 1 "gpc_reg_operand" "")
10934 (match_operand:SI 2 "u_short_cint_operand" "")))
10935 (set (match_operand:SI 0 "gpc_reg_operand" "")
10936 (plus:SI (match_dup 1) (match_operand:SI 4 "short_cint_operand" "")))]
10938 [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
10939 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
10941 (define_insn "*cmpsf_internal1"
10942 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10943 (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
10944 (match_operand:SF 2 "gpc_reg_operand" "f")))]
10945 "TARGET_HARD_FLOAT && TARGET_FPRS"
10947 [(set_attr "type" "fpcompare")])
10949 (define_insn "*cmpdf_internal1"
10950 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10951 (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
10952 (match_operand:DF 2 "gpc_reg_operand" "f")))]
10953 "TARGET_HARD_FLOAT && TARGET_FPRS"
10955 [(set_attr "type" "fpcompare")])
10957 ;; Only need to compare second words if first words equal
10958 (define_insn "*cmptf_internal1"
10959 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10960 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10961 (match_operand:TF 2 "gpc_reg_operand" "f")))]
10962 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && !TARGET_XL_COMPAT
10963 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10964 "fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
10965 [(set_attr "type" "fpcompare")
10966 (set_attr "length" "12")])
10968 (define_insn_and_split "*cmptf_internal2"
10969 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
10970 (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
10971 (match_operand:TF 2 "gpc_reg_operand" "f")))
10972 (clobber (match_scratch:DF 3 "=f"))
10973 (clobber (match_scratch:DF 4 "=f"))
10974 (clobber (match_scratch:DF 5 "=f"))
10975 (clobber (match_scratch:DF 6 "=f"))
10976 (clobber (match_scratch:DF 7 "=f"))
10977 (clobber (match_scratch:DF 8 "=f"))
10978 (clobber (match_scratch:DF 9 "=f"))
10979 (clobber (match_scratch:DF 10 "=f"))]
10980 "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) && TARGET_XL_COMPAT
10981 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
10983 "&& reload_completed"
10984 [(set (match_dup 3) (match_dup 13))
10985 (set (match_dup 4) (match_dup 14))
10986 (set (match_dup 9) (abs:DF (match_dup 5)))
10987 (set (match_dup 0) (compare:CCFP (match_dup 9) (match_dup 3)))
10988 (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
10989 (label_ref (match_dup 11))
10991 (set (match_dup 0) (compare:CCFP (match_dup 5) (match_dup 7)))
10992 (set (pc) (label_ref (match_dup 12)))
10994 (set (match_dup 10) (minus:DF (match_dup 5) (match_dup 7)))
10995 (set (match_dup 9) (minus:DF (match_dup 6) (match_dup 8)))
10996 (set (match_dup 9) (plus:DF (match_dup 10) (match_dup 9)))
10997 (set (match_dup 0) (compare:CCFP (match_dup 7) (match_dup 4)))
11000 REAL_VALUE_TYPE rv;
11001 const int lo_word = FLOAT_WORDS_BIG_ENDIAN ? GET_MODE_SIZE (DFmode) : 0;
11002 const int hi_word = FLOAT_WORDS_BIG_ENDIAN ? 0 : GET_MODE_SIZE (DFmode);
11004 operands[5] = simplify_gen_subreg (DFmode, operands[1], TFmode, hi_word);
11005 operands[6] = simplify_gen_subreg (DFmode, operands[1], TFmode, lo_word);
11006 operands[7] = simplify_gen_subreg (DFmode, operands[2], TFmode, hi_word);
11007 operands[8] = simplify_gen_subreg (DFmode, operands[2], TFmode, lo_word);
11008 operands[11] = gen_label_rtx ();
11009 operands[12] = gen_label_rtx ();
11011 operands[13] = force_const_mem (DFmode,
11012 CONST_DOUBLE_FROM_REAL_VALUE (rv, DFmode));
11013 operands[14] = force_const_mem (DFmode,
11014 CONST_DOUBLE_FROM_REAL_VALUE (dconst0,
11018 operands[13] = gen_const_mem (DFmode,
11019 create_TOC_reference (XEXP (operands[13], 0)));
11020 operands[14] = gen_const_mem (DFmode,
11021 create_TOC_reference (XEXP (operands[14], 0)));
11022 set_mem_alias_set (operands[13], get_TOC_alias_set ());
11023 set_mem_alias_set (operands[14], get_TOC_alias_set ());
11027 ;; Now we have the scc insns. We can do some combinations because of the
11028 ;; way the machine works.
11030 ;; Note that this is probably faster if we can put an insn between the
11031 ;; mfcr and rlinm, but this is tricky. Let's leave it for now. In most
11032 ;; cases the insns below which don't use an intermediate CR field will
11033 ;; be used instead.
11035 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11036 (match_operator:SI 1 "scc_comparison_operator"
11037 [(match_operand 2 "cc_reg_operand" "y")
11040 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11041 [(set (attr "type")
11042 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11043 (const_string "mfcrf")
11045 (const_string "mfcr")))
11046 (set_attr "length" "8")])
11048 ;; Same as above, but get the GT bit.
11049 (define_insn "move_from_CR_gt_bit"
11050 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11051 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_GT))]
11053 "mfcr %0\;{rlinm|rlwinm} %0,%0,%D1,31,31"
11054 [(set_attr "type" "mfcr")
11055 (set_attr "length" "8")])
11057 ;; Same as above, but get the OV/ORDERED bit.
11058 (define_insn "move_from_CR_ov_bit"
11059 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11060 (unspec:SI [(match_operand 1 "cc_reg_operand" "y")] UNSPEC_MV_CR_OV))]
11062 "mfcr %0\;{rlinm|rlwinm} %0,%0,%t1,1"
11063 [(set_attr "type" "mfcr")
11064 (set_attr "length" "8")])
11067 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11068 (match_operator:DI 1 "scc_comparison_operator"
11069 [(match_operand 2 "cc_reg_operand" "y")
11072 "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1"
11073 [(set (attr "type")
11074 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11075 (const_string "mfcrf")
11077 (const_string "mfcr")))
11078 (set_attr "length" "8")])
11081 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11082 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11083 [(match_operand 2 "cc_reg_operand" "y,y")
11086 (set (match_operand:SI 3 "gpc_reg_operand" "=r,r")
11087 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11090 mfcr %3%Q2\;{rlinm.|rlwinm.} %3,%3,%J1,1
11092 [(set_attr "type" "delayed_compare")
11093 (set_attr "length" "8,16")])
11096 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11097 (compare:CC (match_operator:SI 1 "scc_comparison_operator"
11098 [(match_operand 2 "cc_reg_operand" "")
11101 (set (match_operand:SI 3 "gpc_reg_operand" "")
11102 (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
11103 "TARGET_32BIT && reload_completed"
11104 [(set (match_dup 3)
11105 (match_op_dup 1 [(match_dup 2) (const_int 0)]))
11107 (compare:CC (match_dup 3)
11112 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11113 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11114 [(match_operand 2 "cc_reg_operand" "y")
11116 (match_operand:SI 3 "const_int_operand" "n")))]
11120 int is_bit = ccr_bit (operands[1], 1);
11121 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11124 if (is_bit >= put_bit)
11125 count = is_bit - put_bit;
11127 count = 32 - (put_bit - is_bit);
11129 operands[4] = GEN_INT (count);
11130 operands[5] = GEN_INT (put_bit);
11132 return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\";
11134 [(set (attr "type")
11135 (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0))
11136 (const_string "mfcrf")
11138 (const_string "mfcr")))
11139 (set_attr "length" "8")])
11142 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11144 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11145 [(match_operand 2 "cc_reg_operand" "y,y")
11147 (match_operand:SI 3 "const_int_operand" "n,n"))
11149 (set (match_operand:SI 4 "gpc_reg_operand" "=r,r")
11150 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11155 int is_bit = ccr_bit (operands[1], 1);
11156 int put_bit = 31 - (INTVAL (operands[3]) & 31);
11159 /* Force split for non-cc0 compare. */
11160 if (which_alternative == 1)
11163 if (is_bit >= put_bit)
11164 count = is_bit - put_bit;
11166 count = 32 - (put_bit - is_bit);
11168 operands[5] = GEN_INT (count);
11169 operands[6] = GEN_INT (put_bit);
11171 return \"mfcr %4%Q2\;{rlinm.|rlwinm.} %4,%4,%5,%6,%6\";
11173 [(set_attr "type" "delayed_compare")
11174 (set_attr "length" "8,16")])
11177 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11179 (ashift:SI (match_operator:SI 1 "scc_comparison_operator"
11180 [(match_operand 2 "cc_reg_operand" "")
11182 (match_operand:SI 3 "const_int_operand" ""))
11184 (set (match_operand:SI 4 "gpc_reg_operand" "")
11185 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11188 [(set (match_dup 4)
11189 (ashift:SI (match_op_dup 1 [(match_dup 2) (const_int 0)])
11192 (compare:CC (match_dup 4)
11196 ;; There is a 3 cycle delay between consecutive mfcr instructions
11197 ;; so it is useful to combine 2 scc instructions to use only one mfcr.
11200 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11201 (match_operator:SI 1 "scc_comparison_operator"
11202 [(match_operand 2 "cc_reg_operand" "y")
11204 (set (match_operand:SI 3 "gpc_reg_operand" "=r")
11205 (match_operator:SI 4 "scc_comparison_operator"
11206 [(match_operand 5 "cc_reg_operand" "y")
11208 "REGNO (operands[2]) != REGNO (operands[5])"
11209 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11210 [(set_attr "type" "mfcr")
11211 (set_attr "length" "12")])
11214 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11215 (match_operator:DI 1 "scc_comparison_operator"
11216 [(match_operand 2 "cc_reg_operand" "y")
11218 (set (match_operand:DI 3 "gpc_reg_operand" "=r")
11219 (match_operator:DI 4 "scc_comparison_operator"
11220 [(match_operand 5 "cc_reg_operand" "y")
11222 "TARGET_POWERPC64 && REGNO (operands[2]) != REGNO (operands[5])"
11223 "mfcr %3\;{rlinm|rlwinm} %0,%3,%J1,1\;{rlinm|rlwinm} %3,%3,%J4,1"
11224 [(set_attr "type" "mfcr")
11225 (set_attr "length" "12")])
11227 ;; There are some scc insns that can be done directly, without a compare.
11228 ;; These are faster because they don't involve the communications between
11229 ;; the FXU and branch units. In fact, we will be replacing all of the
11230 ;; integer scc insns here or in the portable methods in emit_store_flag.
11232 ;; Also support (neg (scc ..)) since that construct is used to replace
11233 ;; branches, (plus (scc ..) ..) since that construct is common and
11234 ;; takes no more insns than scc, and (and (neg (scc ..)) ..) in the
11235 ;; cases where it is no more expensive than (neg (scc ..)).
11237 ;; Have reload force a constant into a register for the simple insns that
11238 ;; otherwise won't accept constants. We do this because it is faster than
11239 ;; the cmp/mfcr sequence we would otherwise generate.
11241 (define_mode_attr scc_eq_op2 [(SI "rKLI")
11244 (define_insn_and_split "*eq<mode>"
11245 [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
11246 (eq:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
11247 (match_operand:GPR 2 "scc_eq_operand" "<scc_eq_op2>")))
11248 (clobber (match_scratch:GPR 3 "=r"))
11249 (clobber (match_scratch:GPR 4 "=r"))]
11253 [(set (match_dup 3)
11254 (clz:GPR (match_dup 4)))
11256 (lshiftrt:GPR (match_dup 3) (match_dup 5)))]
11258 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11260 if (logical_operand (operands[2], <MODE>mode))
11261 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11262 gen_rtx_XOR (<MODE>mode,
11263 operands[1], operands[2])));
11265 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11266 gen_rtx_PLUS (<MODE>mode, operands[1],
11267 negate_rtx (<MODE>mode,
11271 operands[4] = operands[1];
11273 operands[5] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11276 (define_insn_and_split "*eq<mode>_compare"
11277 [(set (match_operand:CC 5 "cc_reg_operand" "=y")
11279 (eq:P (match_operand:P 1 "gpc_reg_operand" "=r")
11280 (match_operand:P 2 "scc_eq_operand" "<scc_eq_op2>"))
11282 (set (match_operand:P 0 "gpc_reg_operand" "=r")
11283 (eq:P (match_dup 1) (match_dup 2)))
11284 (clobber (match_scratch:P 3 "=r"))
11285 (clobber (match_scratch:P 4 "=r"))]
11289 [(set (match_dup 3)
11290 (clz:P (match_dup 4)))
11291 (parallel [(set (match_dup 5)
11292 (compare:CC (lshiftrt:P (match_dup 3) (match_dup 6))
11295 (lshiftrt:P (match_dup 3) (match_dup 6)))])]
11297 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)
11299 if (logical_operand (operands[2], <MODE>mode))
11300 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11301 gen_rtx_XOR (<MODE>mode,
11302 operands[1], operands[2])));
11304 emit_insn (gen_rtx_SET (VOIDmode, operands[4],
11305 gen_rtx_PLUS (<MODE>mode, operands[1],
11306 negate_rtx (<MODE>mode,
11310 operands[4] = operands[1];
11312 operands[6] = GEN_INT (exact_log2 (GET_MODE_BITSIZE (<MODE>mode)));
11315 ;; We have insns of the form shown by the first define_insn below. If
11316 ;; there is something inside the comparison operation, we must split it.
11318 [(set (match_operand:SI 0 "gpc_reg_operand" "")
11319 (plus:SI (match_operator 1 "comparison_operator"
11320 [(match_operand:SI 2 "" "")
11321 (match_operand:SI 3
11322 "reg_or_cint_operand" "")])
11323 (match_operand:SI 4 "gpc_reg_operand" "")))
11324 (clobber (match_operand:SI 5 "register_operand" ""))]
11325 "! gpc_reg_operand (operands[2], SImode)"
11326 [(set (match_dup 5) (match_dup 2))
11327 (set (match_dup 2) (plus:SI (match_op_dup 1 [(match_dup 2) (match_dup 3)])
11331 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r")
11332 (plus:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11333 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))
11334 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r")))]
11337 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11338 {sfi|subfic} %0,%1,0\;{aze|addze} %0,%3
11339 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11340 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11341 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
11342 [(set_attr "type" "three,two,three,three,three")
11343 (set_attr "length" "12,8,12,12,12")])
11346 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11349 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11350 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11351 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11353 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r"))]
11356 xor %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11357 {sfi|subfic} %4,%1,0\;{aze.|addze.} %4,%3
11358 {xoril|xori} %4,%1,%b2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11359 {xoriu|xoris} %4,%1,%u2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11360 {sfi|subfic} %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11366 [(set_attr "type" "compare")
11367 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11370 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11373 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11374 (match_operand:SI 2 "scc_eq_operand" ""))
11375 (match_operand:SI 3 "gpc_reg_operand" ""))
11377 (clobber (match_scratch:SI 4 ""))]
11378 "TARGET_32BIT && reload_completed"
11379 [(set (match_dup 4)
11380 (plus:SI (eq:SI (match_dup 1)
11384 (compare:CC (match_dup 4)
11389 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
11392 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
11393 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I,r,O,K,L,I"))
11394 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r,r,r,r,r,r,r"))
11396 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r,&r,&r,&r,&r,&r,&r")
11397 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11400 xor %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11401 {sfi|subfic} %0,%1,0\;{aze.|addze.} %0,%3
11402 {xoril|xori} %0,%1,%b2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11403 {xoriu|xoris} %0,%1,%u2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11404 {sfi|subfic} %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11410 [(set_attr "type" "compare")
11411 (set_attr "length" "12,8,12,12,12,16,12,16,16,16")])
11414 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11417 (eq:SI (match_operand:SI 1 "gpc_reg_operand" "")
11418 (match_operand:SI 2 "scc_eq_operand" ""))
11419 (match_operand:SI 3 "gpc_reg_operand" ""))
11421 (set (match_operand:SI 0 "gpc_reg_operand" "")
11422 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11423 "TARGET_32BIT && reload_completed"
11424 [(set (match_dup 0)
11425 (plus:SI (eq:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11427 (compare:CC (match_dup 0)
11432 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
11433 (neg:SI (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
11434 (match_operand:SI 2 "scc_eq_operand" "r,O,K,L,I"))))]
11437 xor %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11438 {ai|addic} %0,%1,-1\;{sfe|subfe} %0,%0,%0
11439 {xoril|xori} %0,%1,%b2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11440 {xoriu|xoris} %0,%1,%u2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11441 {sfi|subfic} %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
11442 [(set_attr "type" "three,two,three,three,three")
11443 (set_attr "length" "12,8,12,12,12")])
11445 ;; Simplify (ne X (const_int 0)) on the PowerPC. No need to on the Power,
11446 ;; since it nabs/sr is just as fast.
11447 (define_insn "*ne0"
11448 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11449 (lshiftrt:SI (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11451 (clobber (match_scratch:SI 2 "=&r"))]
11452 "! TARGET_POWER && TARGET_32BIT && !TARGET_ISEL"
11453 "{ai|addic} %2,%1,-1\;{sfe|subfe} %0,%2,%1"
11454 [(set_attr "type" "two")
11455 (set_attr "length" "8")])
11458 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11459 (lshiftrt:DI (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11461 (clobber (match_scratch:DI 2 "=&r"))]
11463 "addic %2,%1,-1\;subfe %0,%2,%1"
11464 [(set_attr "type" "two")
11465 (set_attr "length" "8")])
11467 ;; This is what (plus (ne X (const_int 0)) Y) looks like.
11469 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11470 (plus:SI (lshiftrt:SI
11471 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r")))
11473 (match_operand:SI 2 "gpc_reg_operand" "r")))
11474 (clobber (match_scratch:SI 3 "=&r"))]
11476 "{ai|addic} %3,%1,-1\;{aze|addze} %0,%2"
11477 [(set_attr "type" "two")
11478 (set_attr "length" "8")])
11481 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11482 (plus:DI (lshiftrt:DI
11483 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r")))
11485 (match_operand:DI 2 "gpc_reg_operand" "r")))
11486 (clobber (match_scratch:DI 3 "=&r"))]
11488 "addic %3,%1,-1\;addze %0,%2"
11489 [(set_attr "type" "two")
11490 (set_attr "length" "8")])
11493 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11495 (plus:SI (lshiftrt:SI
11496 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11498 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11500 (clobber (match_scratch:SI 3 "=&r,&r"))
11501 (clobber (match_scratch:SI 4 "=X,&r"))]
11504 {ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
11506 [(set_attr "type" "compare")
11507 (set_attr "length" "8,12")])
11510 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11512 (plus:SI (lshiftrt:SI
11513 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11515 (match_operand:SI 2 "gpc_reg_operand" ""))
11517 (clobber (match_scratch:SI 3 ""))
11518 (clobber (match_scratch:SI 4 ""))]
11519 "TARGET_32BIT && reload_completed"
11520 [(parallel [(set (match_dup 3)
11521 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
11524 (clobber (match_dup 4))])
11526 (compare:CC (match_dup 3)
11531 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11533 (plus:DI (lshiftrt:DI
11534 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11536 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11538 (clobber (match_scratch:DI 3 "=&r,&r"))]
11541 addic %3,%1,-1\;addze. %3,%2
11543 [(set_attr "type" "compare")
11544 (set_attr "length" "8,12")])
11547 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11549 (plus:DI (lshiftrt:DI
11550 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11552 (match_operand:DI 2 "gpc_reg_operand" ""))
11554 (clobber (match_scratch:DI 3 ""))]
11555 "TARGET_64BIT && reload_completed"
11556 [(set (match_dup 3)
11557 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1)))
11561 (compare:CC (match_dup 3)
11566 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11568 (plus:SI (lshiftrt:SI
11569 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")))
11571 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
11573 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11574 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11576 (clobber (match_scratch:SI 3 "=&r,&r"))]
11579 {ai|addic} %3,%1,-1\;{aze.|addze.} %0,%2
11581 [(set_attr "type" "compare")
11582 (set_attr "length" "8,12")])
11585 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11587 (plus:SI (lshiftrt:SI
11588 (neg:SI (abs:SI (match_operand:SI 1 "gpc_reg_operand" "")))
11590 (match_operand:SI 2 "gpc_reg_operand" ""))
11592 (set (match_operand:SI 0 "gpc_reg_operand" "")
11593 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11595 (clobber (match_scratch:SI 3 ""))]
11596 "TARGET_32BIT && reload_completed"
11597 [(parallel [(set (match_dup 0)
11598 (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1))) (const_int 31))
11600 (clobber (match_dup 3))])
11602 (compare:CC (match_dup 0)
11607 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11609 (plus:DI (lshiftrt:DI
11610 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")))
11612 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
11614 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11615 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11617 (clobber (match_scratch:DI 3 "=&r,&r"))]
11620 addic %3,%1,-1\;addze. %0,%2
11622 [(set_attr "type" "compare")
11623 (set_attr "length" "8,12")])
11626 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11628 (plus:DI (lshiftrt:DI
11629 (neg:DI (abs:DI (match_operand:DI 1 "gpc_reg_operand" "")))
11631 (match_operand:DI 2 "gpc_reg_operand" ""))
11633 (set (match_operand:DI 0 "gpc_reg_operand" "")
11634 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11636 (clobber (match_scratch:DI 3 ""))]
11637 "TARGET_64BIT && reload_completed"
11638 [(parallel [(set (match_dup 0)
11639 (plus:DI (lshiftrt:DI (neg:DI (abs:DI (match_dup 1))) (const_int 63))
11641 (clobber (match_dup 3))])
11643 (compare:CC (match_dup 0)
11648 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11649 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11650 (match_operand:SI 2 "reg_or_short_operand" "r,O")))
11651 (clobber (match_scratch:SI 3 "=r,X"))]
11654 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3
11655 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri|srwi} %0,%0,31"
11656 [(set_attr "length" "12")])
11659 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11661 (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11662 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11664 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
11665 (le:SI (match_dup 1) (match_dup 2)))
11666 (clobber (match_scratch:SI 3 "=r,X,r,X"))]
11669 doz %3,%2,%1\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
11670 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{sri.|srwi.} %0,%0,31
11673 [(set_attr "type" "compare,delayed_compare,compare,delayed_compare")
11674 (set_attr "length" "12,12,16,16")])
11677 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11679 (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11680 (match_operand:SI 2 "reg_or_short_operand" ""))
11682 (set (match_operand:SI 0 "gpc_reg_operand" "")
11683 (le:SI (match_dup 1) (match_dup 2)))
11684 (clobber (match_scratch:SI 3 ""))]
11685 "TARGET_POWER && reload_completed"
11686 [(parallel [(set (match_dup 0)
11687 (le:SI (match_dup 1) (match_dup 2)))
11688 (clobber (match_dup 3))])
11690 (compare:CC (match_dup 0)
11695 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11696 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11697 (match_operand:SI 2 "reg_or_short_operand" "r,O"))
11698 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
11701 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3
11702 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze|addze} %0,%3"
11703 [(set_attr "length" "12")])
11706 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
11708 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11709 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11710 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11712 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
11715 doz %4,%2,%1\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
11716 {srai|srawi} %4,%1,31\;{sf|subfc} %4,%1,%4\;{aze.|addze.} %4,%3
11719 [(set_attr "type" "compare")
11720 (set_attr "length" "12,12,16,16")])
11723 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11725 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11726 (match_operand:SI 2 "reg_or_short_operand" ""))
11727 (match_operand:SI 3 "gpc_reg_operand" ""))
11729 (clobber (match_scratch:SI 4 ""))]
11730 "TARGET_POWER && reload_completed"
11731 [(set (match_dup 4)
11732 (plus:SI (le:SI (match_dup 1) (match_dup 2))
11735 (compare:CC (match_dup 4)
11740 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
11742 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
11743 (match_operand:SI 2 "reg_or_short_operand" "r,O,r,O"))
11744 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
11746 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
11747 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11750 doz %0,%2,%1\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
11751 {srai|srawi} %0,%1,31\;{sf|subfc} %0,%1,%0\;{aze.|addze.} %0,%3
11754 [(set_attr "type" "compare")
11755 (set_attr "length" "12,12,16,16")])
11758 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11760 (plus:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "")
11761 (match_operand:SI 2 "reg_or_short_operand" ""))
11762 (match_operand:SI 3 "gpc_reg_operand" ""))
11764 (set (match_operand:SI 0 "gpc_reg_operand" "")
11765 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11766 "TARGET_POWER && reload_completed"
11767 [(set (match_dup 0)
11768 (plus:SI (le:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11770 (compare:CC (match_dup 0)
11775 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11776 (neg:SI (le:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11777 (match_operand:SI 2 "reg_or_short_operand" "r,O"))))]
11780 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0
11781 {ai|addic} %0,%1,-1\;{aze|addze} %0,%0\;{srai|srawi} %0,%0,31"
11782 [(set_attr "length" "12")])
11785 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11786 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11787 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
11789 "{sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
11790 [(set_attr "type" "three")
11791 (set_attr "length" "12")])
11794 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
11795 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
11796 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
11798 "subf%I2c %0,%1,%2\;li %0,0\;adde %0,%0,%0"
11799 [(set_attr "type" "three")
11800 (set_attr "length" "12")])
11803 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11805 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
11806 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
11808 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
11809 (leu:DI (match_dup 1) (match_dup 2)))]
11812 subf%I2c %0,%1,%2\;li %0,0\;adde. %0,%0,%0
11814 [(set_attr "type" "compare")
11815 (set_attr "length" "12,16")])
11818 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11820 (leu:DI (match_operand:DI 1 "gpc_reg_operand" "")
11821 (match_operand:DI 2 "reg_or_short_operand" ""))
11823 (set (match_operand:DI 0 "gpc_reg_operand" "")
11824 (leu:DI (match_dup 1) (match_dup 2)))]
11825 "TARGET_64BIT && reload_completed"
11826 [(set (match_dup 0)
11827 (leu:DI (match_dup 1) (match_dup 2)))
11829 (compare:CC (match_dup 0)
11834 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
11836 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11837 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11839 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
11840 (leu:SI (match_dup 1) (match_dup 2)))]
11843 {sf%I2|subf%I2c} %0,%1,%2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
11845 [(set_attr "type" "compare")
11846 (set_attr "length" "12,16")])
11849 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
11851 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11852 (match_operand:SI 2 "reg_or_short_operand" ""))
11854 (set (match_operand:SI 0 "gpc_reg_operand" "")
11855 (leu:SI (match_dup 1) (match_dup 2)))]
11856 "TARGET_32BIT && reload_completed"
11857 [(set (match_dup 0)
11858 (leu:SI (match_dup 1) (match_dup 2)))
11860 (compare:CC (match_dup 0)
11865 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11866 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11867 (match_operand:SI 2 "reg_or_short_operand" "rI"))
11868 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11870 "{sf%I2|subf%I2c} %0,%1,%2\;{aze|addze} %0,%3"
11871 [(set_attr "type" "two")
11872 (set_attr "length" "8")])
11875 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11877 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11878 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11879 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11881 (clobber (match_scratch:SI 4 "=&r,&r"))]
11884 {sf%I2|subf%I2c} %4,%1,%2\;{aze.|addze.} %4,%3
11886 [(set_attr "type" "compare")
11887 (set_attr "length" "8,12")])
11890 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11892 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11893 (match_operand:SI 2 "reg_or_short_operand" ""))
11894 (match_operand:SI 3 "gpc_reg_operand" ""))
11896 (clobber (match_scratch:SI 4 ""))]
11897 "TARGET_32BIT && reload_completed"
11898 [(set (match_dup 4)
11899 (plus:SI (leu:SI (match_dup 1) (match_dup 2))
11902 (compare:CC (match_dup 4)
11907 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11909 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11910 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
11911 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11913 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
11914 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11917 {sf%I2|subf%I2c} %0,%1,%2\;{aze.|addze.} %0,%3
11919 [(set_attr "type" "compare")
11920 (set_attr "length" "8,12")])
11923 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
11925 (plus:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11926 (match_operand:SI 2 "reg_or_short_operand" ""))
11927 (match_operand:SI 3 "gpc_reg_operand" ""))
11929 (set (match_operand:SI 0 "gpc_reg_operand" "")
11930 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
11931 "TARGET_32BIT && reload_completed"
11932 [(set (match_dup 0)
11933 (plus:SI (leu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
11935 (compare:CC (match_dup 0)
11940 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
11941 (neg:SI (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11942 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
11944 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0"
11945 [(set_attr "type" "three")
11946 (set_attr "length" "12")])
11949 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
11951 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
11952 (match_operand:SI 2 "reg_or_short_operand" "rI")))
11953 (match_operand:SI 3 "gpc_reg_operand" "r")))]
11955 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
11956 [(set_attr "type" "three")
11957 (set_attr "length" "12")])
11960 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
11963 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11964 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11965 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
11967 (clobber (match_scratch:SI 4 "=&r,&r"))]
11970 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
11972 [(set_attr "type" "compare")
11973 (set_attr "length" "12,16")])
11976 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
11979 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
11980 (match_operand:SI 2 "reg_or_short_operand" "")))
11981 (match_operand:SI 3 "gpc_reg_operand" ""))
11983 (clobber (match_scratch:SI 4 ""))]
11984 "TARGET_32BIT && reload_completed"
11985 [(set (match_dup 4)
11986 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
11989 (compare:CC (match_dup 4)
11994 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
11997 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
11998 (match_operand:SI 2 "reg_or_short_operand" "rI,rI")))
11999 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12001 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12002 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12005 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12007 [(set_attr "type" "compare")
12008 (set_attr "length" "12,16")])
12011 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12014 (leu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12015 (match_operand:SI 2 "reg_or_short_operand" "")))
12016 (match_operand:SI 3 "gpc_reg_operand" ""))
12018 (set (match_operand:SI 0 "gpc_reg_operand" "")
12019 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12020 "TARGET_32BIT && reload_completed"
12021 [(set (match_dup 0)
12022 (and:SI (neg:SI (leu:SI (match_dup 1) (match_dup 2)))
12025 (compare:CC (match_dup 0)
12030 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12031 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12032 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
12034 "doz%I2 %0,%1,%2\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12035 [(set_attr "length" "12")])
12038 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12040 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12041 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12043 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12044 (lt:SI (match_dup 1) (match_dup 2)))]
12047 doz%I2 %0,%1,%2\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12049 [(set_attr "type" "delayed_compare")
12050 (set_attr "length" "12,16")])
12053 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12055 (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12056 (match_operand:SI 2 "reg_or_short_operand" ""))
12058 (set (match_operand:SI 0 "gpc_reg_operand" "")
12059 (lt:SI (match_dup 1) (match_dup 2)))]
12060 "TARGET_POWER && reload_completed"
12061 [(set (match_dup 0)
12062 (lt:SI (match_dup 1) (match_dup 2)))
12064 (compare:CC (match_dup 0)
12069 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12070 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12071 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12072 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12074 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12075 [(set_attr "length" "12")])
12078 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12080 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12081 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12082 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12084 (clobber (match_scratch:SI 4 "=&r,&r"))]
12087 doz%I2 %4,%1,%2\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
12089 [(set_attr "type" "compare")
12090 (set_attr "length" "12,16")])
12093 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12095 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12096 (match_operand:SI 2 "reg_or_short_operand" ""))
12097 (match_operand:SI 3 "gpc_reg_operand" ""))
12099 (clobber (match_scratch:SI 4 ""))]
12100 "TARGET_POWER && reload_completed"
12101 [(set (match_dup 4)
12102 (plus:SI (lt:SI (match_dup 1) (match_dup 2))
12105 (compare:CC (match_dup 4)
12110 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12112 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12113 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12114 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12116 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12117 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12120 doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
12122 [(set_attr "type" "compare")
12123 (set_attr "length" "12,16")])
12126 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12128 (plus:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12129 (match_operand:SI 2 "reg_or_short_operand" ""))
12130 (match_operand:SI 3 "gpc_reg_operand" ""))
12132 (set (match_operand:SI 0 "gpc_reg_operand" "")
12133 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12134 "TARGET_POWER && reload_completed"
12135 [(set (match_dup 0)
12136 (plus:SI (lt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12138 (compare:CC (match_dup 0)
12143 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12144 (neg:SI (lt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12145 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12147 "doz%I2 %0,%1,%2\;nabs %0,%0\;{srai|srawi} %0,%0,31"
12148 [(set_attr "length" "12")])
12150 (define_insn_and_split ""
12151 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12152 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12153 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12157 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12158 (set (match_dup 0) (neg:SI (match_dup 0)))]
12161 (define_insn_and_split ""
12162 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12163 (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12164 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12168 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12169 (set (match_dup 0) (neg:DI (match_dup 0)))]
12173 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12175 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12176 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12178 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12179 (ltu:SI (match_dup 1) (match_dup 2)))]
12182 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12183 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
12186 [(set_attr "type" "compare")
12187 (set_attr "length" "12,12,16,16")])
12190 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12192 (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12193 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12195 (set (match_operand:SI 0 "gpc_reg_operand" "")
12196 (ltu:SI (match_dup 1) (match_dup 2)))]
12197 "TARGET_32BIT && reload_completed"
12198 [(set (match_dup 0)
12199 (ltu:SI (match_dup 1) (match_dup 2)))
12201 (compare:CC (match_dup 0)
12205 (define_insn_and_split ""
12206 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,r")
12207 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12208 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12209 (match_operand:SI 3 "reg_or_short_operand" "rI,rI")))]
12212 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12213 [(set (match_dup 0) (neg:SI (ltu:SI (match_dup 1) (match_dup 2))))
12214 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
12217 (define_insn_and_split ""
12218 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r,r")
12219 (plus:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12220 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))
12221 (match_operand:DI 3 "reg_or_short_operand" "rI,rI")))]
12224 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
12225 [(set (match_dup 0) (neg:DI (ltu:DI (match_dup 1) (match_dup 2))))
12226 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
12230 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12232 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12233 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12234 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12236 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12239 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12240 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
12243 [(set_attr "type" "compare")
12244 (set_attr "length" "12,12,16,16")])
12247 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12249 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12250 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12251 (match_operand:SI 3 "gpc_reg_operand" ""))
12253 (clobber (match_scratch:SI 4 ""))]
12254 "TARGET_32BIT && reload_completed"
12255 [(set (match_dup 4)
12256 (plus:SI (ltu:SI (match_dup 1) (match_dup 2))
12259 (compare:CC (match_dup 4)
12264 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12266 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12267 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12268 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12270 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12271 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12274 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12275 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
12278 [(set_attr "type" "compare")
12279 (set_attr "length" "12,12,16,16")])
12282 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12284 (plus:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12285 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12286 (match_operand:SI 3 "gpc_reg_operand" ""))
12288 (set (match_operand:SI 0 "gpc_reg_operand" "")
12289 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12290 "TARGET_32BIT && reload_completed"
12291 [(set (match_dup 0)
12292 (plus:SI (ltu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12294 (compare:CC (match_dup 0)
12299 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12300 (neg:SI (ltu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12301 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))))]
12304 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12305 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12306 [(set_attr "type" "two")
12307 (set_attr "length" "8")])
12310 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12311 (neg:DI (ltu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12312 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P"))))]
12315 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0
12316 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0"
12317 [(set_attr "type" "two")
12318 (set_attr "length" "8")])
12321 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12322 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12323 (match_operand:SI 2 "reg_or_short_operand" "rI")))
12324 (clobber (match_scratch:SI 3 "=r"))]
12326 "doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae|adde} %0,%0,%3"
12327 [(set_attr "length" "12")])
12330 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12332 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12333 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12335 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12336 (ge:SI (match_dup 1) (match_dup 2)))
12337 (clobber (match_scratch:SI 3 "=r,r"))]
12340 doz%I2 %3,%1,%2\;{sfi|subfic} %0,%3,0\;{ae.|adde.} %0,%0,%3
12342 [(set_attr "type" "compare")
12343 (set_attr "length" "12,16")])
12346 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12348 (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12349 (match_operand:SI 2 "reg_or_short_operand" ""))
12351 (set (match_operand:SI 0 "gpc_reg_operand" "")
12352 (ge:SI (match_dup 1) (match_dup 2)))
12353 (clobber (match_scratch:SI 3 ""))]
12354 "TARGET_POWER && reload_completed"
12355 [(parallel [(set (match_dup 0)
12356 (ge:SI (match_dup 1) (match_dup 2)))
12357 (clobber (match_dup 3))])
12359 (compare:CC (match_dup 0)
12364 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12365 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12366 (match_operand:SI 2 "reg_or_short_operand" "rI"))
12367 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12369 "doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze|addze} %0,%3"
12370 [(set_attr "length" "12")])
12373 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12375 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12376 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12377 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12379 (clobber (match_scratch:SI 4 "=&r,&r"))]
12382 doz%I2 %4,%1,%2\;{sfi|subfic} %4,%4,0\;{aze.|addze.} %4,%3
12384 [(set_attr "type" "compare")
12385 (set_attr "length" "12,16")])
12388 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12390 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12391 (match_operand:SI 2 "reg_or_short_operand" ""))
12392 (match_operand:SI 3 "gpc_reg_operand" ""))
12394 (clobber (match_scratch:SI 4 ""))]
12395 "TARGET_POWER && reload_completed"
12396 [(set (match_dup 4)
12397 (plus:SI (ge:SI (match_dup 1) (match_dup 2))
12400 (compare:CC (match_dup 4)
12405 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
12407 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12408 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
12409 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12411 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12412 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12415 doz%I2 %0,%1,%2\;{sfi|subfic} %0,%0,0\;{aze.|addze.} %0,%3
12417 [(set_attr "type" "compare")
12418 (set_attr "length" "12,16")])
12421 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12423 (plus:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "")
12424 (match_operand:SI 2 "reg_or_short_operand" ""))
12425 (match_operand:SI 3 "gpc_reg_operand" ""))
12427 (set (match_operand:SI 0 "gpc_reg_operand" "")
12428 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12429 "TARGET_POWER && reload_completed"
12430 [(set (match_dup 0)
12431 (plus:SI (ge:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12433 (compare:CC (match_dup 0)
12438 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12439 (neg:SI (ge:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12440 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
12442 "doz%I2 %0,%1,%2\;{ai|addic} %0,%0,-1\;{sfe|subfe} %0,%0,%0"
12443 [(set_attr "length" "12")])
12446 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12447 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12448 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))]
12451 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0
12452 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae|adde} %0,%0,%0"
12453 [(set_attr "type" "three")
12454 (set_attr "length" "12")])
12457 [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12458 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12459 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P")))]
12462 subfc %0,%2,%1\;li %0,0\;adde %0,%0,%0
12463 addic %0,%1,%n2\;li %0,0\;adde %0,%0,%0"
12464 [(set_attr "type" "three")
12465 (set_attr "length" "12")])
12468 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12470 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12471 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12473 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r")
12474 (geu:SI (match_dup 1) (match_dup 2)))]
12477 {sf|subfc} %0,%2,%1\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12478 {ai|addic} %0,%1,%n2\;{cal %0,0(0)|li %0,0}\;{ae.|adde.} %0,%0,%0
12481 [(set_attr "type" "compare")
12482 (set_attr "length" "12,12,16,16")])
12485 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12487 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12488 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12490 (set (match_operand:SI 0 "gpc_reg_operand" "")
12491 (geu:SI (match_dup 1) (match_dup 2)))]
12492 "TARGET_32BIT && reload_completed"
12493 [(set (match_dup 0)
12494 (geu:SI (match_dup 1) (match_dup 2)))
12496 (compare:CC (match_dup 0)
12501 [(set (match_operand:CC 3 "cc_reg_operand" "=x,x,?y,?y")
12503 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
12504 (match_operand:DI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12506 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r")
12507 (geu:DI (match_dup 1) (match_dup 2)))]
12510 subfc %0,%2,%1\;li %0,0\;adde. %0,%0,%0
12511 addic %0,%1,%n2\;li %0,0\;adde. %0,%0,%0
12514 [(set_attr "type" "compare")
12515 (set_attr "length" "12,12,16,16")])
12518 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12520 (geu:DI (match_operand:DI 1 "gpc_reg_operand" "")
12521 (match_operand:DI 2 "reg_or_neg_short_operand" ""))
12523 (set (match_operand:DI 0 "gpc_reg_operand" "")
12524 (geu:DI (match_dup 1) (match_dup 2)))]
12525 "TARGET_64BIT && reload_completed"
12526 [(set (match_dup 0)
12527 (geu:DI (match_dup 1) (match_dup 2)))
12529 (compare:CC (match_dup 0)
12534 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12535 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12536 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P"))
12537 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12540 {sf|subfc} %0,%2,%1\;{aze|addze} %0,%3
12541 {ai|addic} %0,%1,%n2\;{aze|addze} %0,%3"
12542 [(set_attr "type" "two")
12543 (set_attr "length" "8")])
12546 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12548 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12549 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12550 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12552 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12555 {sf|subfc} %4,%2,%1\;{aze.|addze.} %4,%3
12556 {ai|addic} %4,%1,%n2\;{aze.|addze.} %4,%3
12559 [(set_attr "type" "compare")
12560 (set_attr "length" "8,8,12,12")])
12563 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12565 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12566 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12567 (match_operand:SI 3 "gpc_reg_operand" ""))
12569 (clobber (match_scratch:SI 4 ""))]
12570 "TARGET_32BIT && reload_completed"
12571 [(set (match_dup 4)
12572 (plus:SI (geu:SI (match_dup 1) (match_dup 2))
12575 (compare:CC (match_dup 4)
12580 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12582 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12583 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P"))
12584 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12586 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12587 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12590 {sf|subfc} %0,%2,%1\;{aze.|addze.} %0,%3
12591 {ai|addic} %0,%1,%n2\;{aze.|addze.} %0,%3
12594 [(set_attr "type" "compare")
12595 (set_attr "length" "8,8,12,12")])
12598 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12600 (plus:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12601 (match_operand:SI 2 "reg_or_neg_short_operand" ""))
12602 (match_operand:SI 3 "gpc_reg_operand" ""))
12604 (set (match_operand:SI 0 "gpc_reg_operand" "")
12605 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
12606 "TARGET_32BIT && reload_completed"
12607 [(set (match_dup 0)
12608 (plus:SI (geu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
12610 (compare:CC (match_dup 0)
12615 [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12616 (neg:SI (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12617 (match_operand:SI 2 "reg_or_short_operand" "r,I"))))]
12620 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;nand %0,%0,%0
12621 {sfi|subfic} %0,%1,-1\;{a%I2|add%I2c} %0,%0,%2\;{sfe|subfe} %0,%0,%0"
12622 [(set_attr "type" "three")
12623 (set_attr "length" "12")])
12626 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12628 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12629 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P")))
12630 (match_operand:SI 3 "gpc_reg_operand" "r,r")))]
12633 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0
12634 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc %0,%3,%0"
12635 [(set_attr "type" "three")
12636 (set_attr "length" "12")])
12639 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
12642 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12643 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12644 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12646 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
12649 {sf|subfc} %4,%2,%1\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12650 {ai|addic} %4,%1,%n2\;{sfe|subfe} %4,%4,%4\;andc. %4,%3,%4
12653 [(set_attr "type" "compare")
12654 (set_attr "length" "12,12,16,16")])
12657 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12660 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12661 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12662 (match_operand:SI 3 "gpc_reg_operand" ""))
12664 (clobber (match_scratch:SI 4 ""))]
12665 "TARGET_32BIT && reload_completed"
12666 [(set (match_dup 4)
12667 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2)))
12670 (compare:CC (match_dup 4)
12675 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
12678 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
12679 (match_operand:SI 2 "reg_or_neg_short_operand" "r,P,r,P")))
12680 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
12682 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
12683 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12686 {sf|subfc} %0,%2,%1\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12687 {ai|addic} %0,%1,%n2\;{sfe|subfe} %0,%0,%0\;andc. %0,%3,%0
12690 [(set_attr "type" "compare")
12691 (set_attr "length" "12,12,16,16")])
12694 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
12697 (geu:SI (match_operand:SI 1 "gpc_reg_operand" "")
12698 (match_operand:SI 2 "reg_or_neg_short_operand" "")))
12699 (match_operand:SI 3 "gpc_reg_operand" ""))
12701 (set (match_operand:SI 0 "gpc_reg_operand" "")
12702 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))]
12703 "TARGET_32BIT && reload_completed"
12704 [(set (match_dup 0)
12705 (and:SI (neg:SI (geu:SI (match_dup 1) (match_dup 2))) (match_dup 3)))
12707 (compare:CC (match_dup 0)
12712 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12713 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12716 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri|srwi} %0,%0,31"
12717 [(set_attr "type" "three")
12718 (set_attr "length" "12")])
12721 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
12722 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12725 "subfic %0,%1,0\;addme %0,%0\;srdi %0,%0,63"
12726 [(set_attr "type" "three")
12727 (set_attr "length" "12")])
12730 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12732 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12735 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12736 (gt:SI (match_dup 1) (const_int 0)))]
12739 {sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{sri.|srwi.} %0,%0,31
12741 [(set_attr "type" "delayed_compare")
12742 (set_attr "length" "12,16")])
12745 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12747 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12750 (set (match_operand:SI 0 "gpc_reg_operand" "")
12751 (gt:SI (match_dup 1) (const_int 0)))]
12752 "TARGET_32BIT && reload_completed"
12753 [(set (match_dup 0)
12754 (gt:SI (match_dup 1) (const_int 0)))
12756 (compare:CC (match_dup 0)
12761 [(set (match_operand:CC 2 "cc_reg_operand" "=x,?y")
12763 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12766 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
12767 (gt:DI (match_dup 1) (const_int 0)))]
12770 subfic %0,%1,0\;addme %0,%0\;srdi. %0,%0,63
12772 [(set_attr "type" "delayed_compare")
12773 (set_attr "length" "12,16")])
12776 [(set (match_operand:CC 2 "cc_reg_not_cr0_operand" "")
12778 (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12781 (set (match_operand:DI 0 "gpc_reg_operand" "")
12782 (gt:DI (match_dup 1) (const_int 0)))]
12783 "TARGET_64BIT && reload_completed"
12784 [(set (match_dup 0)
12785 (gt:DI (match_dup 1) (const_int 0)))
12787 (compare:CC (match_dup 0)
12792 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
12793 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12794 (match_operand:SI 2 "reg_or_short_operand" "r")))]
12796 "doz %0,%2,%1\;nabs %0,%0\;{sri|srwi} %0,%0,31"
12797 [(set_attr "length" "12")])
12800 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12802 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12803 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12805 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
12806 (gt:SI (match_dup 1) (match_dup 2)))]
12809 doz %0,%2,%1\;nabs %0,%0\;{sri.|srwi.} %0,%0,31
12811 [(set_attr "type" "delayed_compare")
12812 (set_attr "length" "12,16")])
12815 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12817 (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12818 (match_operand:SI 2 "reg_or_short_operand" ""))
12820 (set (match_operand:SI 0 "gpc_reg_operand" "")
12821 (gt:SI (match_dup 1) (match_dup 2)))]
12822 "TARGET_POWER && reload_completed"
12823 [(set (match_dup 0)
12824 (gt:SI (match_dup 1) (match_dup 2)))
12826 (compare:CC (match_dup 0)
12831 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12832 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12834 (match_operand:SI 2 "gpc_reg_operand" "r")))]
12836 "{a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze|addze} %0,%2"
12837 [(set_attr "type" "three")
12838 (set_attr "length" "12")])
12841 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
12842 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
12844 (match_operand:DI 2 "gpc_reg_operand" "r")))]
12846 "addc %0,%1,%1\;subfe %0,%1,%0\;addze %0,%2"
12847 [(set_attr "type" "three")
12848 (set_attr "length" "12")])
12851 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12853 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12855 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12857 (clobber (match_scratch:SI 3 "=&r,&r"))]
12860 {a|addc} %3,%1,%1\;{sfe|subfe} %3,%1,%3\;{aze.|addze.} %3,%2
12862 [(set_attr "type" "compare")
12863 (set_attr "length" "12,16")])
12866 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12868 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12870 (match_operand:SI 2 "gpc_reg_operand" ""))
12872 (clobber (match_scratch:SI 3 ""))]
12873 "TARGET_32BIT && reload_completed"
12874 [(set (match_dup 3)
12875 (plus:SI (gt:SI (match_dup 1) (const_int 0))
12878 (compare:CC (match_dup 3)
12883 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12885 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12887 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12889 (clobber (match_scratch:DI 3 "=&r,&r"))]
12892 addc %3,%1,%1\;subfe %3,%1,%3\;addze. %3,%2
12894 [(set_attr "type" "compare")
12895 (set_attr "length" "12,16")])
12898 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
12900 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12902 (match_operand:DI 2 "gpc_reg_operand" ""))
12904 (clobber (match_scratch:DI 3 ""))]
12905 "TARGET_64BIT && reload_completed"
12906 [(set (match_dup 3)
12907 (plus:DI (gt:DI (match_dup 1) (const_int 0))
12910 (compare:CC (match_dup 3)
12915 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12917 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12919 (match_operand:SI 2 "gpc_reg_operand" "r,r"))
12921 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
12922 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12925 {a|addc} %0,%1,%1\;{sfe|subfe} %0,%1,%0\;{aze.|addze.} %0,%2
12927 [(set_attr "type" "compare")
12928 (set_attr "length" "12,16")])
12931 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12933 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
12935 (match_operand:SI 2 "gpc_reg_operand" ""))
12937 (set (match_operand:SI 0 "gpc_reg_operand" "")
12938 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))]
12939 "TARGET_32BIT && reload_completed"
12940 [(set (match_dup 0)
12941 (plus:SI (gt:SI (match_dup 1) (const_int 0)) (match_dup 2)))
12943 (compare:CC (match_dup 0)
12948 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
12950 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
12952 (match_operand:DI 2 "gpc_reg_operand" "r,r"))
12954 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r")
12955 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12958 addc %0,%1,%1\;subfe %0,%1,%0\;addze. %0,%2
12960 [(set_attr "type" "compare")
12961 (set_attr "length" "12,16")])
12964 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
12966 (plus:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "")
12968 (match_operand:DI 2 "gpc_reg_operand" ""))
12970 (set (match_operand:DI 0 "gpc_reg_operand" "")
12971 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))]
12972 "TARGET_64BIT && reload_completed"
12973 [(set (match_dup 0)
12974 (plus:DI (gt:DI (match_dup 1) (const_int 0)) (match_dup 2)))
12976 (compare:CC (match_dup 0)
12981 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
12982 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
12983 (match_operand:SI 2 "reg_or_short_operand" "r"))
12984 (match_operand:SI 3 "gpc_reg_operand" "r")))]
12986 "doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze|addze} %0,%3"
12987 [(set_attr "length" "12")])
12990 [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
12992 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
12993 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
12994 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
12996 (clobber (match_scratch:SI 4 "=&r,&r"))]
12999 doz %4,%2,%1\;{ai|addic} %4,%4,-1\;{aze.|addze.} %4,%3
13001 [(set_attr "type" "compare")
13002 (set_attr "length" "12,16")])
13005 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13007 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13008 (match_operand:SI 2 "reg_or_short_operand" ""))
13009 (match_operand:SI 3 "gpc_reg_operand" ""))
13011 (clobber (match_scratch:SI 4 ""))]
13012 "TARGET_POWER && reload_completed"
13013 [(set (match_dup 4)
13014 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13016 (compare:CC (match_dup 4)
13021 [(set (match_operand:CC 4 "cc_reg_operand" "=x,?y")
13023 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13024 (match_operand:SI 2 "reg_or_short_operand" "r,r"))
13025 (match_operand:SI 3 "gpc_reg_operand" "r,r"))
13027 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r")
13028 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13031 doz %0,%2,%1\;{ai|addic} %0,%0,-1\;{aze.|addze.} %0,%3
13033 [(set_attr "type" "compare")
13034 (set_attr "length" "12,16")])
13037 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13039 (plus:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "")
13040 (match_operand:SI 2 "reg_or_short_operand" ""))
13041 (match_operand:SI 3 "gpc_reg_operand" ""))
13043 (set (match_operand:SI 0 "gpc_reg_operand" "")
13044 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13045 "TARGET_POWER && reload_completed"
13046 [(set (match_dup 0)
13047 (plus:SI (gt:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13049 (compare:CC (match_dup 0)
13054 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13055 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13058 "{sfi|subfic} %0,%1,0\;{ame|addme} %0,%0\;{srai|srawi} %0,%0,31"
13059 [(set_attr "type" "three")
13060 (set_attr "length" "12")])
13063 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13064 (neg:DI (gt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13067 "subfic %0,%1,0\;addme %0,%0\;sradi %0,%0,63"
13068 [(set_attr "type" "three")
13069 (set_attr "length" "12")])
13072 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13073 (neg:SI (gt:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13074 (match_operand:SI 2 "reg_or_short_operand" "r"))))]
13076 "doz %0,%2,%1\;nabs %0,%0\;{srai|srawi} %0,%0,31"
13077 [(set_attr "length" "12")])
13079 (define_insn_and_split ""
13080 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13081 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13082 (match_operand:SI 2 "reg_or_short_operand" "rI")))]
13086 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13087 (set (match_dup 0) (neg:SI (match_dup 0)))]
13090 (define_insn_and_split ""
13091 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13092 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13093 (match_operand:DI 2 "reg_or_short_operand" "rI")))]
13097 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13098 (set (match_dup 0) (neg:DI (match_dup 0)))]
13102 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13104 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
13105 (match_operand:SI 2 "reg_or_short_operand" "rI,rI"))
13107 (set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
13108 (gtu:SI (match_dup 1) (match_dup 2)))]
13111 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;neg. %0,%0
13113 [(set_attr "type" "compare")
13114 (set_attr "length" "12,16")])
13117 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13119 (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13120 (match_operand:SI 2 "reg_or_short_operand" ""))
13122 (set (match_operand:SI 0 "gpc_reg_operand" "")
13123 (gtu:SI (match_dup 1) (match_dup 2)))]
13124 "TARGET_32BIT && reload_completed"
13125 [(set (match_dup 0)
13126 (gtu:SI (match_dup 1) (match_dup 2)))
13128 (compare:CC (match_dup 0)
13133 [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
13135 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
13136 (match_operand:DI 2 "reg_or_short_operand" "rI,rI"))
13138 (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
13139 (gtu:DI (match_dup 1) (match_dup 2)))]
13142 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;neg. %0,%0
13144 [(set_attr "type" "compare")
13145 (set_attr "length" "12,16")])
13148 [(set (match_operand:CC 3 "cc_reg_not_cr0_operand" "")
13150 (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13151 (match_operand:DI 2 "reg_or_short_operand" ""))
13153 (set (match_operand:DI 0 "gpc_reg_operand" "")
13154 (gtu:DI (match_dup 1) (match_dup 2)))]
13155 "TARGET_64BIT && reload_completed"
13156 [(set (match_dup 0)
13157 (gtu:DI (match_dup 1) (match_dup 2)))
13159 (compare:CC (match_dup 0)
13163 (define_insn_and_split ""
13164 [(set (match_operand:SI 0 "gpc_reg_operand" "=&r")
13165 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13166 (match_operand:SI 2 "reg_or_short_operand" "rI"))
13167 (match_operand:SI 3 "reg_or_short_operand" "rI")))]
13170 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13171 [(set (match_dup 0) (neg:SI (gtu:SI (match_dup 1) (match_dup 2))))
13172 (set (match_dup 0) (minus:SI (match_dup 3) (match_dup 0)))]
13175 (define_insn_and_split ""
13176 [(set (match_operand:DI 0 "gpc_reg_operand" "=&r")
13177 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13178 (match_operand:DI 2 "reg_or_short_operand" "rI"))
13179 (match_operand:DI 3 "reg_or_short_operand" "rI")))]
13182 "&& !reg_overlap_mentioned_p (operands[0], operands[3])"
13183 [(set (match_dup 0) (neg:DI (gtu:DI (match_dup 1) (match_dup 2))))
13184 (set (match_dup 0) (minus:DI (match_dup 3) (match_dup 0)))]
13188 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13190 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13191 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13192 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13194 (clobber (match_scratch:SI 4 "=&r,&r,&r,&r"))]
13197 {ai|addic} %4,%1,%k2\;{aze.|addze.} %4,%3
13198 {sf%I2|subf%I2c} %4,%1,%2\;{sfe|subfe} %4,%4,%4\;{sf.|subf.} %4,%4,%3
13201 [(set_attr "type" "compare")
13202 (set_attr "length" "8,12,12,16")])
13205 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13207 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13208 (match_operand:SI 2 "reg_or_short_operand" ""))
13209 (match_operand:SI 3 "gpc_reg_operand" ""))
13211 (clobber (match_scratch:SI 4 ""))]
13212 "TARGET_32BIT && reload_completed"
13213 [(set (match_dup 4)
13214 (plus:SI (gtu:SI (match_dup 1) (match_dup 2))
13217 (compare:CC (match_dup 4)
13222 [(set (match_operand:CC 0 "cc_reg_operand" "=x,x,?y,?y")
13224 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13225 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13226 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13228 (clobber (match_scratch:DI 4 "=&r,&r,&r,&r"))]
13231 addic %4,%1,%k2\;addze. %4,%3
13232 subf%I2c %4,%1,%2\;subfe %4,%4,%4\;subf. %4,%4,%3
13235 [(set_attr "type" "compare")
13236 (set_attr "length" "8,12,12,16")])
13239 [(set (match_operand:CC 0 "cc_reg_not_cr0_operand" "")
13241 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13242 (match_operand:DI 2 "reg_or_short_operand" ""))
13243 (match_operand:DI 3 "gpc_reg_operand" ""))
13245 (clobber (match_scratch:DI 4 ""))]
13246 "TARGET_64BIT && reload_completed"
13247 [(set (match_dup 4)
13248 (plus:DI (gtu:DI (match_dup 1) (match_dup 2))
13251 (compare:CC (match_dup 4)
13256 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13258 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r,r,r,r")
13259 (match_operand:SI 2 "reg_or_short_operand" "I,r,I,r"))
13260 (match_operand:SI 3 "gpc_reg_operand" "r,r,r,r"))
13262 (set (match_operand:SI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13263 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13266 {ai|addic} %0,%1,%k2\;{aze.|addze.} %0,%3
13267 {sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0\;{sf.|subf.} %0,%0,%3
13270 [(set_attr "type" "compare")
13271 (set_attr "length" "8,12,12,16")])
13274 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13276 (plus:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "")
13277 (match_operand:SI 2 "reg_or_short_operand" ""))
13278 (match_operand:SI 3 "gpc_reg_operand" ""))
13280 (set (match_operand:SI 0 "gpc_reg_operand" "")
13281 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13282 "TARGET_32BIT && reload_completed"
13283 [(set (match_dup 0)
13284 (plus:SI (gtu:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
13286 (compare:CC (match_dup 0)
13291 [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,?y,?y")
13293 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r,r,r,r")
13294 (match_operand:DI 2 "reg_or_short_operand" "I,r,I,r"))
13295 (match_operand:DI 3 "gpc_reg_operand" "r,r,r,r"))
13297 (set (match_operand:DI 0 "gpc_reg_operand" "=&r,&r,&r,&r")
13298 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13301 addic %0,%1,%k2\;addze. %0,%3
13302 subf%I2c %0,%1,%2\;subfe %0,%0,%0\;subf. %0,%0,%3
13305 [(set_attr "type" "compare")
13306 (set_attr "length" "8,12,12,16")])
13309 [(set (match_operand:CC 4 "cc_reg_not_cr0_operand" "")
13311 (plus:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "")
13312 (match_operand:DI 2 "reg_or_short_operand" ""))
13313 (match_operand:DI 3 "gpc_reg_operand" ""))
13315 (set (match_operand:DI 0 "gpc_reg_operand" "")
13316 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))]
13317 "TARGET_64BIT && reload_completed"
13318 [(set (match_dup 0)
13319 (plus:DI (gtu:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
13321 (compare:CC (match_dup 0)
13326 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13327 (neg:SI (gtu:SI (match_operand:SI 1 "gpc_reg_operand" "r")
13328 (match_operand:SI 2 "reg_or_short_operand" "rI"))))]
13330 "{sf%I2|subf%I2c} %0,%1,%2\;{sfe|subfe} %0,%0,%0"
13331 [(set_attr "type" "two")
13332 (set_attr "length" "8")])
13335 [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
13336 (neg:DI (gtu:DI (match_operand:DI 1 "gpc_reg_operand" "r")
13337 (match_operand:DI 2 "reg_or_short_operand" "rI"))))]
13339 "subf%I2c %0,%1,%2\;subfe %0,%0,%0"
13340 [(set_attr "type" "two")
13341 (set_attr "length" "8")])
13343 ;; Define both directions of branch and return. If we need a reload
13344 ;; register, we'd rather use CR0 since it is much easier to copy a
13345 ;; register CC value to there.
13349 (if_then_else (match_operator 1 "branch_comparison_operator"
13351 "cc_reg_operand" "y")
13353 (label_ref (match_operand 0 "" ""))
13358 return output_cbranch (operands[1], \"%l0\", 0, insn);
13360 [(set_attr "type" "branch")])
13364 (if_then_else (match_operator 0 "branch_comparison_operator"
13366 "cc_reg_operand" "y")
13373 return output_cbranch (operands[0], NULL, 0, insn);
13375 [(set_attr "type" "branch")
13376 (set_attr "length" "4")])
13380 (if_then_else (match_operator 1 "branch_comparison_operator"
13382 "cc_reg_operand" "y")
13385 (label_ref (match_operand 0 "" ""))))]
13389 return output_cbranch (operands[1], \"%l0\", 1, insn);
13391 [(set_attr "type" "branch")])
13395 (if_then_else (match_operator 0 "branch_comparison_operator"
13397 "cc_reg_operand" "y")
13404 return output_cbranch (operands[0], NULL, 1, insn);
13406 [(set_attr "type" "branch")
13407 (set_attr "length" "4")])
13409 ;; Logic on condition register values.
13411 ; This pattern matches things like
13412 ; (set (reg:CCEQ 68) (compare:CCEQ (ior:SI (gt:SI (reg:CCFP 68) (const_int 0))
13413 ; (eq:SI (reg:CCFP 68) (const_int 0)))
13415 ; which are generated by the branch logic.
13416 ; Prefer destructive operations where BT = BB (for crXX BT,BA,BB)
13418 (define_insn "*cceq_ior_compare"
13419 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13420 (compare:CCEQ (match_operator:SI 1 "boolean_operator"
13421 [(match_operator:SI 2
13422 "branch_positive_comparison_operator"
13424 "cc_reg_operand" "y,y")
13426 (match_operator:SI 4
13427 "branch_positive_comparison_operator"
13429 "cc_reg_operand" "0,y")
13433 "cr%q1 %E0,%j2,%j4"
13434 [(set_attr "type" "cr_logical,delayed_cr")])
13436 ; Why is the constant -1 here, but 1 in the previous pattern?
13437 ; Because ~1 has all but the low bit set.
13439 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13440 (compare:CCEQ (match_operator:SI 1 "boolean_or_operator"
13441 [(not:SI (match_operator:SI 2
13442 "branch_positive_comparison_operator"
13444 "cc_reg_operand" "y,y")
13446 (match_operator:SI 4
13447 "branch_positive_comparison_operator"
13449 "cc_reg_operand" "0,y")
13453 "cr%q1 %E0,%j2,%j4"
13454 [(set_attr "type" "cr_logical,delayed_cr")])
13456 (define_insn "*cceq_rev_compare"
13457 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y,?y")
13458 (compare:CCEQ (match_operator:SI 1
13459 "branch_positive_comparison_operator"
13461 "cc_reg_operand" "0,y")
13465 "{crnor %E0,%j1,%j1|crnot %E0,%j1}"
13466 [(set_attr "type" "cr_logical,delayed_cr")])
13468 ;; If we are comparing the result of two comparisons, this can be done
13469 ;; using creqv or crxor.
13471 (define_insn_and_split ""
13472 [(set (match_operand:CCEQ 0 "cc_reg_operand" "=y")
13473 (compare:CCEQ (match_operator 1 "branch_comparison_operator"
13474 [(match_operand 2 "cc_reg_operand" "y")
13476 (match_operator 3 "branch_comparison_operator"
13477 [(match_operand 4 "cc_reg_operand" "y")
13482 [(set (match_dup 0) (compare:CCEQ (xor:SI (match_dup 1) (match_dup 3))
13486 int positive_1, positive_2;
13488 positive_1 = branch_positive_comparison_operator (operands[1],
13489 GET_MODE (operands[1]));
13490 positive_2 = branch_positive_comparison_operator (operands[3],
13491 GET_MODE (operands[3]));
13494 operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
13495 GET_CODE (operands[1])),
13497 operands[2], const0_rtx);
13498 else if (GET_MODE (operands[1]) != SImode)
13499 operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), SImode,
13500 operands[2], const0_rtx);
13503 operands[3] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[4]),
13504 GET_CODE (operands[3])),
13506 operands[4], const0_rtx);
13507 else if (GET_MODE (operands[3]) != SImode)
13508 operands[3] = gen_rtx_fmt_ee (GET_CODE (operands[3]), SImode,
13509 operands[4], const0_rtx);
13511 if (positive_1 == positive_2)
13513 operands[1] = gen_rtx_NOT (SImode, operands[1]);
13514 operands[5] = constm1_rtx;
13518 operands[5] = const1_rtx;
13522 ;; Unconditional branch and return.
13524 (define_insn "jump"
13526 (label_ref (match_operand 0 "" "")))]
13529 [(set_attr "type" "branch")])
13531 (define_insn "return"
13535 [(set_attr "type" "jmpreg")])
13537 (define_expand "indirect_jump"
13538 [(set (pc) (match_operand 0 "register_operand" ""))])
13540 (define_insn "*indirect_jump<mode>"
13541 [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
13546 [(set_attr "type" "jmpreg")])
13548 ;; Table jump for switch statements:
13549 (define_expand "tablejump"
13550 [(use (match_operand 0 "" ""))
13551 (use (label_ref (match_operand 1 "" "")))]
13556 emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
13558 emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
13562 (define_expand "tablejumpsi"
13563 [(set (match_dup 3)
13564 (plus:SI (match_operand:SI 0 "" "")
13566 (parallel [(set (pc) (match_dup 3))
13567 (use (label_ref (match_operand 1 "" "")))])]
13570 { operands[0] = force_reg (SImode, operands[0]);
13571 operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
13572 operands[3] = gen_reg_rtx (SImode);
13575 (define_expand "tablejumpdi"
13576 [(set (match_dup 4)
13577 (sign_extend:DI (match_operand:SI 0 "lwa_operand" "rm")))
13579 (plus:DI (match_dup 4)
13581 (parallel [(set (pc) (match_dup 3))
13582 (use (label_ref (match_operand 1 "" "")))])]
13585 { operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
13586 operands[3] = gen_reg_rtx (DImode);
13587 operands[4] = gen_reg_rtx (DImode);
13592 (match_operand:P 0 "register_operand" "c,*l"))
13593 (use (label_ref (match_operand 1 "" "")))]
13598 [(set_attr "type" "jmpreg")])
13603 "{cror 0,0,0|nop}")
13605 ;; Define the subtract-one-and-jump insns, starting with the template
13606 ;; so loop.c knows what to generate.
13608 (define_expand "doloop_end"
13609 [(use (match_operand 0 "" "")) ; loop pseudo
13610 (use (match_operand 1 "" "")) ; iterations; zero if unknown
13611 (use (match_operand 2 "" "")) ; max iterations
13612 (use (match_operand 3 "" "")) ; loop level
13613 (use (match_operand 4 "" ""))] ; label
13617 /* Only use this on innermost loops. */
13618 if (INTVAL (operands[3]) > 1)
13622 if (GET_MODE (operands[0]) != DImode)
13624 emit_jump_insn (gen_ctrdi (operands[0], operands[4]));
13628 if (GET_MODE (operands[0]) != SImode)
13630 emit_jump_insn (gen_ctrsi (operands[0], operands[4]));
13635 (define_expand "ctr<mode>"
13636 [(parallel [(set (pc)
13637 (if_then_else (ne (match_operand:P 0 "register_operand" "")
13639 (label_ref (match_operand 1 "" ""))
13642 (plus:P (match_dup 0)
13644 (clobber (match_scratch:CC 2 ""))
13645 (clobber (match_scratch:P 3 ""))])]
13649 ;; We need to be able to do this for any operand, including MEM, or we
13650 ;; will cause reload to blow up since we don't allow output reloads on
13652 ;; For the length attribute to be calculated correctly, the
13653 ;; label MUST be operand 0.
13655 (define_insn "*ctr<mode>_internal1"
13657 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13659 (label_ref (match_operand 0 "" ""))
13661 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13662 (plus:P (match_dup 1)
13664 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13665 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13669 if (which_alternative != 0)
13671 else if (get_attr_length (insn) == 4)
13672 return \"{bdn|bdnz} %l0\";
13674 return \"bdz $+8\;b %l0\";
13676 [(set_attr "type" "branch")
13677 (set_attr "length" "*,12,16,16")])
13679 (define_insn "*ctr<mode>_internal2"
13681 (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13684 (label_ref (match_operand 0 "" ""))))
13685 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13686 (plus:P (match_dup 1)
13688 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13689 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13693 if (which_alternative != 0)
13695 else if (get_attr_length (insn) == 4)
13696 return \"bdz %l0\";
13698 return \"{bdn|bdnz} $+8\;b %l0\";
13700 [(set_attr "type" "branch")
13701 (set_attr "length" "*,12,16,16")])
13703 ;; Similar but use EQ
13705 (define_insn "*ctr<mode>_internal5"
13707 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13709 (label_ref (match_operand 0 "" ""))
13711 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13712 (plus:P (match_dup 1)
13714 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13715 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13719 if (which_alternative != 0)
13721 else if (get_attr_length (insn) == 4)
13722 return \"bdz %l0\";
13724 return \"{bdn|bdnz} $+8\;b %l0\";
13726 [(set_attr "type" "branch")
13727 (set_attr "length" "*,12,16,16")])
13729 (define_insn "*ctr<mode>_internal6"
13731 (if_then_else (eq (match_operand:P 1 "register_operand" "c,*r,*r,*r")
13734 (label_ref (match_operand 0 "" ""))))
13735 (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
13736 (plus:P (match_dup 1)
13738 (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
13739 (clobber (match_scratch:P 4 "=X,X,&r,r"))]
13743 if (which_alternative != 0)
13745 else if (get_attr_length (insn) == 4)
13746 return \"{bdn|bdnz} %l0\";
13748 return \"bdz $+8\;b %l0\";
13750 [(set_attr "type" "branch")
13751 (set_attr "length" "*,12,16,16")])
13753 ;; Now the splitters if we could not allocate the CTR register
13757 (if_then_else (match_operator 2 "comparison_operator"
13758 [(match_operand:P 1 "gpc_reg_operand" "")
13760 (match_operand 5 "" "")
13761 (match_operand 6 "" "")))
13762 (set (match_operand:P 0 "gpc_reg_operand" "")
13763 (plus:P (match_dup 1) (const_int -1)))
13764 (clobber (match_scratch:CC 3 ""))
13765 (clobber (match_scratch:P 4 ""))]
13767 [(parallel [(set (match_dup 3)
13768 (compare:CC (plus:P (match_dup 1)
13772 (plus:P (match_dup 1)
13774 (set (pc) (if_then_else (match_dup 7)
13778 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13779 operands[3], const0_rtx); }")
13783 (if_then_else (match_operator 2 "comparison_operator"
13784 [(match_operand:P 1 "gpc_reg_operand" "")
13786 (match_operand 5 "" "")
13787 (match_operand 6 "" "")))
13788 (set (match_operand:P 0 "nonimmediate_operand" "")
13789 (plus:P (match_dup 1) (const_int -1)))
13790 (clobber (match_scratch:CC 3 ""))
13791 (clobber (match_scratch:P 4 ""))]
13792 "reload_completed && ! gpc_reg_operand (operands[0], SImode)"
13793 [(parallel [(set (match_dup 3)
13794 (compare:CC (plus:P (match_dup 1)
13798 (plus:P (match_dup 1)
13802 (set (pc) (if_then_else (match_dup 7)
13806 { operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[2]), VOIDmode,
13807 operands[3], const0_rtx); }")
13809 (define_insn "trap"
13810 [(trap_if (const_int 1) (const_int 0))]
13814 (define_expand "conditional_trap"
13815 [(trap_if (match_operator 0 "trap_comparison_operator"
13816 [(match_dup 2) (match_dup 3)])
13817 (match_operand 1 "const_int_operand" ""))]
13819 "if (rs6000_compare_fp_p || operands[1] != const0_rtx) FAIL;
13820 operands[2] = rs6000_compare_op0;
13821 operands[3] = rs6000_compare_op1;")
13824 [(trap_if (match_operator 0 "trap_comparison_operator"
13825 [(match_operand:GPR 1 "register_operand" "r")
13826 (match_operand:GPR 2 "reg_or_short_operand" "rI")])
13829 "{t|t<wd>}%V0%I2 %1,%2")
13831 ;; Insns related to generating the function prologue and epilogue.
13833 (define_expand "prologue"
13834 [(use (const_int 0))]
13835 "TARGET_SCHED_PROLOG"
13838 rs6000_emit_prologue ();
13842 (define_insn "*movesi_from_cr_one"
13843 [(match_parallel 0 "mfcr_operation"
13844 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13845 (unspec:SI [(match_operand:CC 2 "cc_reg_operand" "y")
13846 (match_operand 3 "immediate_operand" "n")]
13847 UNSPEC_MOVESI_FROM_CR))])]
13853 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13855 mask = INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13856 operands[4] = GEN_INT (mask);
13857 output_asm_insn (\"mfcr %1,%4\", operands);
13861 [(set_attr "type" "mfcrf")])
13863 (define_insn "movesi_from_cr"
13864 [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
13865 (unspec:SI [(reg:CC 68) (reg:CC 69) (reg:CC 70) (reg:CC 71)
13866 (reg:CC 72) (reg:CC 73) (reg:CC 74) (reg:CC 75)]
13867 UNSPEC_MOVESI_FROM_CR))]
13870 [(set_attr "type" "mfcr")])
13872 (define_insn "*stmw"
13873 [(match_parallel 0 "stmw_operation"
13874 [(set (match_operand:SI 1 "memory_operand" "=m")
13875 (match_operand:SI 2 "gpc_reg_operand" "r"))])]
13877 "{stm|stmw} %2,%1")
13879 (define_insn "*save_fpregs_<mode>"
13880 [(match_parallel 0 "any_parallel_operand"
13881 [(clobber (match_operand:P 1 "register_operand" "=l"))
13882 (use (match_operand:P 2 "call_operand" "s"))
13883 (set (match_operand:DF 3 "memory_operand" "=m")
13884 (match_operand:DF 4 "gpc_reg_operand" "f"))])]
13887 [(set_attr "type" "branch")
13888 (set_attr "length" "4")])
13890 ; These are to explain that changes to the stack pointer should
13891 ; not be moved over stores to stack memory.
13892 (define_insn "stack_tie"
13893 [(set (match_operand:BLK 0 "memory_operand" "+m")
13894 (unspec:BLK [(match_dup 0)] UNSPEC_TIE))]
13897 [(set_attr "length" "0")])
13900 (define_expand "epilogue"
13901 [(use (const_int 0))]
13902 "TARGET_SCHED_PROLOG"
13905 rs6000_emit_epilogue (FALSE);
13909 ; On some processors, doing the mtcrf one CC register at a time is
13910 ; faster (like on the 604e). On others, doing them all at once is
13911 ; faster; for instance, on the 601 and 750.
13913 (define_expand "movsi_to_cr_one"
13914 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13915 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13916 (match_dup 2)] UNSPEC_MOVESI_TO_CR))]
13918 "operands[2] = GEN_INT (1 << (75 - REGNO (operands[0])));")
13920 (define_insn "*movsi_to_cr"
13921 [(match_parallel 0 "mtcrf_operation"
13922 [(set (match_operand:CC 1 "cc_reg_operand" "=y")
13923 (unspec:CC [(match_operand:SI 2 "gpc_reg_operand" "r")
13924 (match_operand 3 "immediate_operand" "n")]
13925 UNSPEC_MOVESI_TO_CR))])]
13931 for (i = 0; i < XVECLEN (operands[0], 0); i++)
13932 mask |= INTVAL (XVECEXP (SET_SRC (XVECEXP (operands[0], 0, i)), 0, 1));
13933 operands[4] = GEN_INT (mask);
13934 return \"mtcrf %4,%2\";
13936 [(set_attr "type" "mtcr")])
13938 (define_insn "*mtcrfsi"
13939 [(set (match_operand:CC 0 "cc_reg_operand" "=y")
13940 (unspec:CC [(match_operand:SI 1 "gpc_reg_operand" "r")
13941 (match_operand 2 "immediate_operand" "n")]
13942 UNSPEC_MOVESI_TO_CR))]
13943 "GET_CODE (operands[0]) == REG
13944 && CR_REGNO_P (REGNO (operands[0]))
13945 && GET_CODE (operands[2]) == CONST_INT
13946 && INTVAL (operands[2]) == 1 << (75 - REGNO (operands[0]))"
13948 [(set_attr "type" "mtcr")])
13950 ; The load-multiple instructions have similar properties.
13951 ; Note that "load_multiple" is a name known to the machine-independent
13952 ; code that actually corresponds to the powerpc load-string.
13954 (define_insn "*lmw"
13955 [(match_parallel 0 "lmw_operation"
13956 [(set (match_operand:SI 1 "gpc_reg_operand" "=r")
13957 (match_operand:SI 2 "memory_operand" "m"))])]
13961 (define_insn "*return_internal_<mode>"
13963 (use (match_operand:P 0 "register_operand" "lc"))]
13966 [(set_attr "type" "jmpreg")])
13968 ; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
13969 ; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
13971 (define_insn "*return_and_restore_fpregs_<mode>"
13972 [(match_parallel 0 "any_parallel_operand"
13974 (use (match_operand:P 1 "register_operand" "l"))
13975 (use (match_operand:P 2 "call_operand" "s"))
13976 (set (match_operand:DF 3 "gpc_reg_operand" "=f")
13977 (match_operand:DF 4 "memory_operand" "m"))])]
13981 ; This is used in compiling the unwind routines.
13982 (define_expand "eh_return"
13983 [(use (match_operand 0 "general_operand" ""))]
13988 emit_insn (gen_eh_set_lr_si (operands[0]));
13990 emit_insn (gen_eh_set_lr_di (operands[0]));
13994 ; We can't expand this before we know where the link register is stored.
13995 (define_insn "eh_set_lr_<mode>"
13996 [(unspec_volatile [(match_operand:P 0 "register_operand" "r")]
13998 (clobber (match_scratch:P 1 "=&b"))]
14003 [(unspec_volatile [(match_operand 0 "register_operand" "")] UNSPECV_EH_RR)
14004 (clobber (match_scratch 1 ""))]
14009 rs6000_emit_eh_reg_restore (operands[0], operands[1]);
14013 (define_insn "prefetch"
14014 [(prefetch (match_operand:V4SI 0 "address_operand" "p")
14015 (match_operand:SI 1 "const_int_operand" "n")
14016 (match_operand:SI 2 "const_int_operand" "n"))]
14020 if (GET_CODE (operands[0]) == REG)
14021 return INTVAL (operands[1]) ? \"dcbtst 0,%0\" : \"dcbt 0,%0\";
14022 return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
14024 [(set_attr "type" "load")])
14027 (include "sync.md")
14028 (include "altivec.md")